wined3d: Mapping a mapped volume is an error.

This commit is contained in:
Stefan Dösinger 2013-09-18 12:24:55 +02:00 committed by Alexandre Julliard
parent 16f99ce662
commit 83b404879c
2 changed files with 13 additions and 9 deletions

View File

@ -524,10 +524,15 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume,
TRACE("volume %p, map_desc %p, box %p, flags %#x.\n",
volume, map_desc, box, flags);
map_desc->data = NULL;
if (!(volume->resource.access_flags & WINED3D_RESOURCE_ACCESS_CPU))
{
WARN("Volume %p is not CPU accessible.\n", volume);
map_desc->data = NULL;
return WINED3DERR_INVALIDCALL;
}
if (volume->resource.map_count)
{
WARN("Volume is already mapped.\n");
return WINED3DERR_INVALIDCALL;
}
flags = wined3d_resource_sanitize_map_flags(&volume->resource, flags);
@ -614,7 +619,7 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume,
wined3d_volume_invalidate_location(volume, ~WINED3D_LOCATION_SYSMEM);
}
volume->flags |= WINED3D_VFLAG_LOCKED;
volume->resource.map_count++;
TRACE("Returning memory %p, row pitch %d, slice pitch %d.\n",
map_desc->data, map_desc->row_pitch, map_desc->slice_pitch);
@ -631,9 +636,9 @@ HRESULT CDECL wined3d_volume_unmap(struct wined3d_volume *volume)
{
TRACE("volume %p.\n", volume);
if (!(volume->flags & WINED3D_VFLAG_LOCKED))
if (!volume->resource.map_count)
{
WARN("Trying to unlock unlocked volume %p.\n", volume);
WARN("Trying to unlock an unlocked volume %p.\n", volume);
return WINED3DERR_INVALIDCALL;
}
@ -651,7 +656,7 @@ HRESULT CDECL wined3d_volume_unmap(struct wined3d_volume *volume)
context_release(context);
}
volume->flags &= ~WINED3D_VFLAG_LOCKED;
volume->resource.map_count--;
return WINED3D_OK;
}

View File

@ -2110,10 +2110,9 @@ void wined3d_texture_apply_state_changes(struct wined3d_texture *texture,
const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
void wined3d_texture_set_dirty(struct wined3d_texture *texture) DECLSPEC_HIDDEN;
#define WINED3D_VFLAG_LOCKED 0x00000001
#define WINED3D_VFLAG_ALLOCATED 0x00000002
#define WINED3D_VFLAG_SRGB_ALLOCATED 0x00000004
#define WINED3D_VFLAG_PBO 0x00000008
#define WINED3D_VFLAG_ALLOCATED 0x00000001
#define WINED3D_VFLAG_SRGB_ALLOCATED 0x00000002
#define WINED3D_VFLAG_PBO 0x00000004
#define WINED3D_LOCATION_DISCARDED 0x00000001
#define WINED3D_LOCATION_SYSMEM 0x00000002