[PATCH 1/5] wined3d: Mapping a mapped volume is an error.
Stefan Dösinger
stefan at codeweavers.com
Wed Sep 18 05:24:55 CDT 2013
---
dlls/wined3d/volume.c | 15 ++++++++++-----
dlls/wined3d/wined3d_private.h | 7 +++----
2 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c
index 540db93..508b1df 100644
--- a/dlls/wined3d/volume.c
+++ b/dlls/wined3d/volume.c
@@ -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;
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 4928f92..f85bfec 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -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
--
1.8.1.5
More information about the wine-patches
mailing list