wined3d: Mapping a mapped volume is an error.
This commit is contained in:
parent
16f99ce662
commit
83b404879c
|
@ -524,10 +524,15 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume,
|
||||||
TRACE("volume %p, map_desc %p, box %p, flags %#x.\n",
|
TRACE("volume %p, map_desc %p, box %p, flags %#x.\n",
|
||||||
volume, map_desc, box, flags);
|
volume, map_desc, box, flags);
|
||||||
|
|
||||||
|
map_desc->data = NULL;
|
||||||
if (!(volume->resource.access_flags & WINED3D_RESOURCE_ACCESS_CPU))
|
if (!(volume->resource.access_flags & WINED3D_RESOURCE_ACCESS_CPU))
|
||||||
{
|
{
|
||||||
WARN("Volume %p is not CPU accessible.\n", volume);
|
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;
|
return WINED3DERR_INVALIDCALL;
|
||||||
}
|
}
|
||||||
flags = wined3d_resource_sanitize_map_flags(&volume->resource, flags);
|
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);
|
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",
|
TRACE("Returning memory %p, row pitch %d, slice pitch %d.\n",
|
||||||
map_desc->data, map_desc->row_pitch, map_desc->slice_pitch);
|
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);
|
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;
|
return WINED3DERR_INVALIDCALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -651,7 +656,7 @@ HRESULT CDECL wined3d_volume_unmap(struct wined3d_volume *volume)
|
||||||
context_release(context);
|
context_release(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
volume->flags &= ~WINED3D_VFLAG_LOCKED;
|
volume->resource.map_count--;
|
||||||
|
|
||||||
return WINED3D_OK;
|
return WINED3D_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2110,10 +2110,9 @@ void wined3d_texture_apply_state_changes(struct wined3d_texture *texture,
|
||||||
const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
|
const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
|
||||||
void wined3d_texture_set_dirty(struct wined3d_texture *texture) DECLSPEC_HIDDEN;
|
void wined3d_texture_set_dirty(struct wined3d_texture *texture) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
#define WINED3D_VFLAG_LOCKED 0x00000001
|
#define WINED3D_VFLAG_ALLOCATED 0x00000001
|
||||||
#define WINED3D_VFLAG_ALLOCATED 0x00000002
|
#define WINED3D_VFLAG_SRGB_ALLOCATED 0x00000002
|
||||||
#define WINED3D_VFLAG_SRGB_ALLOCATED 0x00000004
|
#define WINED3D_VFLAG_PBO 0x00000004
|
||||||
#define WINED3D_VFLAG_PBO 0x00000008
|
|
||||||
|
|
||||||
#define WINED3D_LOCATION_DISCARDED 0x00000001
|
#define WINED3D_LOCATION_DISCARDED 0x00000001
|
||||||
#define WINED3D_LOCATION_SYSMEM 0x00000002
|
#define WINED3D_LOCATION_SYSMEM 0x00000002
|
||||||
|
|
Loading…
Reference in New Issue