[PATCH 5/5] wined3d: Replace WINED3DUSAGE_WRITEONLY with resource access flags.

Matteo Bruni mbruni at codeweavers.com
Tue Jan 29 08:28:09 CST 2019


Always allow read and write mapping of ddraw buffers:
test_vb_writeonly() depends on that.

Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
---
 dlls/d3d8/buffer.c         |  4 ++--
 dlls/d3d8/d3d8_private.h   | 12 ++++++++++--
 dlls/d3d8/device.c         |  4 ++--
 dlls/d3d8/surface.c        |  2 +-
 dlls/d3d8/texture.c        |  6 +++---
 dlls/d3d8/volume.c         |  2 +-
 dlls/d3d9/buffer.c         |  4 ++--
 dlls/d3d9/d3d9_private.h   | 12 ++++++++++--
 dlls/d3d9/device.c         |  4 ++--
 dlls/d3d9/surface.c        |  2 +-
 dlls/d3d9/volume.c         |  2 +-
 dlls/ddraw/device.c        |  4 ++--
 dlls/ddraw/executebuffer.c |  2 +-
 dlls/ddraw/vertexbuffer.c  |  2 --
 dlls/wined3d/resource.c    | 13 ++++++-------
 dlls/wined3d/utils.c       |  1 -
 include/wine/wined3d.h     |  3 +--
 17 files changed, 45 insertions(+), 34 deletions(-)

diff --git a/dlls/d3d8/buffer.c b/dlls/d3d8/buffer.c
index 909504049a6..850d30b1176 100644
--- a/dlls/d3d8/buffer.c
+++ b/dlls/d3d8/buffer.c
@@ -239,7 +239,7 @@ static HRESULT WINAPI d3d8_vertexbuffer_GetDesc(IDirect3DVertexBuffer8 *iface,
 
     desc->Format = D3DFMT_VERTEXDATA;
     desc->Type = D3DRTYPE_VERTEXBUFFER;
-    desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags);
+    desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags, wined3d_desc.access);
     desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
     desc->Size = wined3d_desc.size;
     desc->FVF = buffer->fvf;
@@ -563,7 +563,7 @@ static HRESULT WINAPI d3d8_indexbuffer_GetDesc(IDirect3DIndexBuffer8 *iface,
 
     desc->Format = d3dformat_from_wined3dformat(buffer->format);
     desc->Type = D3DRTYPE_INDEXBUFFER;
-    desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags);
+    desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags, wined3d_desc.access);
     desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
     desc->Size = wined3d_desc.size;
 
diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h
index 9d551c693d0..841b22c111c 100644
--- a/dlls/d3d8/d3d8_private.h
+++ b/dlls/d3d8/d3d8_private.h
@@ -286,13 +286,17 @@ unsigned int wined3dmapflags_from_d3dmapflags(unsigned int flags, unsigned int a
 void load_local_constants(const DWORD *d3d8_elements, struct wined3d_shader *wined3d_vertex_shader) DECLSPEC_HIDDEN;
 size_t parse_token(const DWORD *pToken) DECLSPEC_HIDDEN;
 
-static inline DWORD d3dusage_from_wined3dusage(unsigned int wined3d_usage, unsigned int bind_flags)
+static inline DWORD d3dusage_from_wined3dusage(unsigned int wined3d_usage, unsigned int bind_flags,
+        unsigned int access)
 {
     DWORD usage = wined3d_usage & WINED3DUSAGE_MASK;
+
     if (bind_flags & WINED3D_BIND_RENDER_TARGET)
         usage |= D3DUSAGE_RENDERTARGET;
     if (bind_flags & WINED3D_BIND_DEPTH_STENCIL)
         usage |= D3DUSAGE_DEPTHSTENCIL;
+    if ((access & (WINED3D_RESOURCE_ACCESS_MAP_W | WINED3D_RESOURCE_ACCESS_MAP_R)) == WINED3D_RESOURCE_ACCESS_MAP_W)
+        usage |= D3DUSAGE_WRITEONLY;
     return usage;
 }
 
@@ -333,7 +337,11 @@ static inline unsigned int wined3daccess_from_d3dpool(D3DPOOL pool, unsigned int
     }
     if (type == D3DRTYPE_VERTEXBUFFER || type == D3DRTYPE_INDEXBUFFER
             || pool != D3DPOOL_DEFAULT || usage & D3DUSAGE_DYNAMIC)
-        access |= WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
+    {
+        access |= WINED3D_RESOURCE_ACCESS_MAP_W;
+        if (~usage & D3DUSAGE_WRITEONLY)
+            access |= WINED3D_RESOURCE_ACCESS_MAP_R;
+    }
     return access;
 }
 
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 6151a8b2e8d..ed68d81ad62 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -2395,7 +2395,7 @@ static HRESULT d3d8_device_prepare_vertex_buffer(struct d3d8_device *device, UIN
         TRACE("Growing vertex buffer to %u bytes\n", size);
 
         desc.byte_width = size;
-        desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY;
+        desc.usage = WINED3DUSAGE_DYNAMIC;
         desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER;
         desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_W;
         desc.misc_flags = 0;
@@ -2490,7 +2490,7 @@ static HRESULT d3d8_device_prepare_index_buffer(struct d3d8_device *device, UINT
         TRACE("Growing index buffer to %u bytes\n", size);
 
         desc.byte_width = size;
-        desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY | WINED3DUSAGE_STATICDECL;
+        desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_STATICDECL;
         desc.bind_flags = WINED3D_BIND_INDEX_BUFFER;
         desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_W;
         desc.misc_flags = 0;
diff --git a/dlls/d3d8/surface.c b/dlls/d3d8/surface.c
index 4fba7c92f2d..671bca1f707 100644
--- a/dlls/d3d8/surface.c
+++ b/dlls/d3d8/surface.c
@@ -192,7 +192,7 @@ static HRESULT WINAPI d3d8_surface_GetDesc(IDirect3DSurface8 *iface, D3DSURFACE_
 
     desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
     desc->Type = D3DRTYPE_SURFACE;
-    desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags);
+    desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags, wined3d_desc.access);
     desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
     desc->Size = wined3d_desc.size;
     desc->MultiSampleType = wined3d_desc.multisample_type;
diff --git a/dlls/d3d8/texture.c b/dlls/d3d8/texture.c
index 6a7e6b4203c..e29924a259e 100644
--- a/dlls/d3d8/texture.c
+++ b/dlls/d3d8/texture.c
@@ -254,7 +254,7 @@ static HRESULT WINAPI d3d8_texture_2d_GetLevelDesc(IDirect3DTexture8 *iface, UIN
     {
         desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
         desc->Type = D3DRTYPE_SURFACE;
-        desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags);
+        desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags, wined3d_desc.access);
         desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
         desc->Size = wined3d_desc.size;
         desc->MultiSampleType = wined3d_desc.multisample_type;
@@ -601,7 +601,7 @@ static HRESULT WINAPI d3d8_texture_cube_GetLevelDesc(IDirect3DCubeTexture8 *ifac
     {
         desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
         desc->Type = D3DRTYPE_SURFACE;
-        desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags);
+        desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags, wined3d_desc.access);
         desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
         desc->Size = wined3d_desc.size;
         desc->MultiSampleType = wined3d_desc.multisample_type;
@@ -946,7 +946,7 @@ static HRESULT WINAPI d3d8_texture_3d_GetLevelDesc(IDirect3DVolumeTexture8 *ifac
     {
         desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
         desc->Type = D3DRTYPE_VOLUME;
-        desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags);
+        desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags, wined3d_desc.access);
         desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
         desc->Size = wined3d_desc.size;
         desc->Width = wined3d_desc.width;
diff --git a/dlls/d3d8/volume.c b/dlls/d3d8/volume.c
index a4d6c0bcd24..794e51d40c0 100644
--- a/dlls/d3d8/volume.c
+++ b/dlls/d3d8/volume.c
@@ -126,7 +126,7 @@ static HRESULT WINAPI d3d8_volume_GetDesc(IDirect3DVolume8 *iface, D3DVOLUME_DES
 
     desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
     desc->Type = D3DRTYPE_VOLUME;
-    desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags);
+    desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags, wined3d_desc.access);
     desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
     desc->Size = wined3d_desc.size;
     desc->Width = wined3d_desc.width;
diff --git a/dlls/d3d9/buffer.c b/dlls/d3d9/buffer.c
index ca6493363f5..434ec11e384 100644
--- a/dlls/d3d9/buffer.c
+++ b/dlls/d3d9/buffer.c
@@ -240,7 +240,7 @@ static HRESULT WINAPI d3d9_vertexbuffer_GetDesc(IDirect3DVertexBuffer9 *iface,
 
     desc->Format = D3DFMT_VERTEXDATA;
     desc->Type = D3DRTYPE_VERTEXBUFFER;
-    desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags);
+    desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags, wined3d_desc.access);
     desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
     desc->Size = wined3d_desc.size;
     desc->FVF = buffer->fvf;
@@ -568,7 +568,7 @@ static HRESULT WINAPI d3d9_indexbuffer_GetDesc(IDirect3DIndexBuffer9 *iface, D3D
 
     desc->Format = d3dformat_from_wined3dformat(buffer->format);
     desc->Type = D3DRTYPE_INDEXBUFFER;
-    desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags);
+    desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags, wined3d_desc.access);
     desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
     desc->Size = wined3d_desc.size;
 
diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h
index 3566ab91239..b19863d68de 100644
--- a/dlls/d3d9/d3d9_private.h
+++ b/dlls/d3d9/d3d9_private.h
@@ -298,13 +298,17 @@ static inline struct d3d9_device *impl_from_IDirect3DDevice9Ex(IDirect3DDevice9E
     return CONTAINING_RECORD(iface, struct d3d9_device, IDirect3DDevice9Ex_iface);
 }
 
-static inline DWORD d3dusage_from_wined3dusage(unsigned int wined3d_usage, unsigned int bind_flags)
+static inline DWORD d3dusage_from_wined3dusage(unsigned int wined3d_usage, unsigned int bind_flags,
+        unsigned int access)
 {
     DWORD usage = wined3d_usage & WINED3DUSAGE_MASK;
+
     if (bind_flags & WINED3D_BIND_RENDER_TARGET)
         usage |= D3DUSAGE_RENDERTARGET;
     if (bind_flags & WINED3D_BIND_DEPTH_STENCIL)
         usage |= D3DUSAGE_DEPTHSTENCIL;
+    if ((access & (WINED3D_RESOURCE_ACCESS_MAP_W | WINED3D_RESOURCE_ACCESS_MAP_R)) == WINED3D_RESOURCE_ACCESS_MAP_W)
+        usage |= D3DUSAGE_WRITEONLY;
     return usage;
 }
 
@@ -345,7 +349,11 @@ static inline unsigned int wined3daccess_from_d3dpool(D3DPOOL pool, unsigned int
     }
     if (type == D3DRTYPE_VERTEXBUFFER || type == D3DRTYPE_INDEXBUFFER
             || pool != D3DPOOL_DEFAULT || usage & D3DUSAGE_DYNAMIC)
-        access |= WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
+    {
+        access |= WINED3D_RESOURCE_ACCESS_MAP_W;
+        if (~usage & D3DUSAGE_WRITEONLY)
+            access |= WINED3D_RESOURCE_ACCESS_MAP_R;
+    }
     return access;
 }
 
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 094a87b8479..546925ae276 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -2866,7 +2866,7 @@ static HRESULT d3d9_device_prepare_vertex_buffer(struct d3d9_device *device, UIN
         TRACE("Growing vertex buffer to %u bytes.\n", size);
 
         desc.byte_width = size;
-        desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY;
+        desc.usage = WINED3DUSAGE_DYNAMIC;
         desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER;
         desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_W;
         desc.misc_flags = 0;
@@ -2971,7 +2971,7 @@ static HRESULT d3d9_device_prepare_index_buffer(struct d3d9_device *device, UINT
         TRACE("Growing index buffer to %u bytes.\n", size);
 
         desc.byte_width = size;
-        desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY | WINED3DUSAGE_STATICDECL;
+        desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_STATICDECL;
         desc.bind_flags = WINED3D_BIND_INDEX_BUFFER;
         desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_W;
         desc.misc_flags = 0;
diff --git a/dlls/d3d9/surface.c b/dlls/d3d9/surface.c
index 5905d87b5d6..24606fbfb20 100644
--- a/dlls/d3d9/surface.c
+++ b/dlls/d3d9/surface.c
@@ -224,7 +224,7 @@ static HRESULT WINAPI d3d9_surface_GetDesc(IDirect3DSurface9 *iface, D3DSURFACE_
 
     desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
     desc->Type = D3DRTYPE_SURFACE;
-    desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags);
+    desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags, wined3d_desc.access);
     desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
     desc->MultiSampleType = wined3d_desc.multisample_type;
     desc->MultiSampleQuality = wined3d_desc.multisample_quality;
diff --git a/dlls/d3d9/volume.c b/dlls/d3d9/volume.c
index 4a4eab08f6d..270fae473bc 100644
--- a/dlls/d3d9/volume.c
+++ b/dlls/d3d9/volume.c
@@ -127,7 +127,7 @@ static HRESULT WINAPI d3d9_volume_GetDesc(IDirect3DVolume9 *iface, D3DVOLUME_DES
 
     desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
     desc->Type = D3DRTYPE_VOLUME;
-    desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags);
+    desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags, wined3d_desc.access);
     desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
     desc->Width = wined3d_desc.width;
     desc->Height = wined3d_desc.height;
diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index 4b58b75f3c2..af9f28d8cbf 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -3469,7 +3469,7 @@ static HRESULT d3d_device_prepare_vertex_buffer(struct d3d_device *device, UINT
         TRACE("Growing vertex buffer to %u bytes\n", size);
 
         desc.byte_width = size;
-        desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY;
+        desc.usage = WINED3DUSAGE_DYNAMIC;
         desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER;
         desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_W;
         desc.misc_flags = 0;
@@ -3661,7 +3661,7 @@ static HRESULT d3d_device_prepare_index_buffer(struct d3d_device *device, UINT m
         TRACE("Growing index buffer to %u bytes\n", size);
 
         desc.byte_width = size;
-        desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY | WINED3DUSAGE_STATICDECL;
+        desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_STATICDECL;
         desc.bind_flags = WINED3D_BIND_INDEX_BUFFER;
         desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_W;
         desc.misc_flags = 0;
diff --git a/dlls/ddraw/executebuffer.c b/dlls/ddraw/executebuffer.c
index 4b4af63b915..f9082dc028c 100644
--- a/dlls/ddraw/executebuffer.c
+++ b/dlls/ddraw/executebuffer.c
@@ -129,7 +129,7 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer,
                     struct wined3d_buffer_desc desc;
 
                     desc.byte_width = new_size * sizeof(*indices);
-                    desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY | WINED3DUSAGE_STATICDECL;
+                    desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_STATICDECL;
                     desc.bind_flags = WINED3D_BIND_INDEX_BUFFER;
                     desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_W;
                     desc.misc_flags = 0;
diff --git a/dlls/ddraw/vertexbuffer.c b/dlls/ddraw/vertexbuffer.c
index 3ad8f7e1bdd..d2c2f8ff804 100644
--- a/dlls/ddraw/vertexbuffer.c
+++ b/dlls/ddraw/vertexbuffer.c
@@ -119,8 +119,6 @@ static HRESULT d3d_vertex_buffer_create_wined3d_buffer(struct d3d_vertex_buffer
 
     desc.byte_width = buffer->size;
     desc.usage = WINED3DUSAGE_STATICDECL;
-    if (buffer->Caps & D3DVBCAPS_WRITEONLY)
-        desc.usage |= WINED3DUSAGE_WRITEONLY;
     if (dynamic)
         desc.usage |= WINED3DUSAGE_DYNAMIC;
     desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER;
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index 82e9019a0ed..90025e9648b 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -28,10 +28,9 @@
 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
 WINE_DECLARE_DEBUG_CHANNEL(d3d_perf);
 
-static void resource_check_usage(DWORD usage)
+static void resource_check_usage(DWORD usage, unsigned int access)
 {
-    static const DWORD handled = WINED3DUSAGE_WRITEONLY
-            | WINED3DUSAGE_DYNAMIC
+    static const DWORD handled = WINED3DUSAGE_DYNAMIC
             | WINED3DUSAGE_STATICDECL
             | WINED3DUSAGE_OVERLAY
             | WINED3DUSAGE_SCRATCH
@@ -39,7 +38,7 @@ static void resource_check_usage(DWORD usage)
             | WINED3DUSAGE_LEGACY_CUBEMAP
             | ~WINED3DUSAGE_MASK;
 
-    /* WINED3DUSAGE_WRITEONLY is supposed to result in write-combined mappings
+    /* Write-only CPU access is supposed to result in write-combined mappings
      * being returned. OpenGL doesn't give us explicit control over that, but
      * the hints and access flags we set for typical access patterns on
      * dynamic resources should in theory have the same effect on the OpenGL
@@ -47,8 +46,8 @@ static void resource_check_usage(DWORD usage)
 
     if (usage & ~handled)
         FIXME("Unhandled usage flags %#x.\n", usage & ~handled);
-    if ((usage & (WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY)) == WINED3DUSAGE_DYNAMIC)
-        WARN_(d3d_perf)("WINED3DUSAGE_DYNAMIC used without WINED3DUSAGE_WRITEONLY.\n");
+    if (usage & WINED3DUSAGE_DYNAMIC && access & WINED3D_RESOURCE_ACCESS_MAP_R)
+        WARN_(d3d_perf)("WINED3DUSAGE_DYNAMIC used with WINED3D_RESOURCE_ACCESS_MAP_R.\n");
 }
 
 HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *device,
@@ -82,7 +81,7 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
         {WINED3D_RTYPE_TEXTURE_3D,  0,                              WINED3D_GL_RES_TYPE_TEX_3D},
     };
 
-    resource_check_usage(usage);
+    resource_check_usage(usage, access);
 
     if (usage & WINED3DUSAGE_SCRATCH && access & WINED3D_RESOURCE_ACCESS_GPU)
     {
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index dd70d3fc2d5..7b422022138 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -4515,7 +4515,6 @@ const char *debug_d3dusage(DWORD usage)
 
     init_debug_buffer(&buffer, "0");
 #define WINED3DUSAGE_TO_STR(x) if (usage & x) { debug_append(&buffer, #x, " | "); usage &= ~x; }
-    WINED3DUSAGE_TO_STR(WINED3DUSAGE_WRITEONLY);
     WINED3DUSAGE_TO_STR(WINED3DUSAGE_SOFTWAREPROCESSING);
     WINED3DUSAGE_TO_STR(WINED3DUSAGE_DONOTCLIP);
     WINED3DUSAGE_TO_STR(WINED3DUSAGE_POINTS);
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 06f4f76ef21..e09e4e1fce2 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -914,7 +914,6 @@ enum wined3d_shader_type
 #define WINED3D_BIND_DEPTH_STENCIL                              0x00000040
 #define WINED3D_BIND_UNORDERED_ACCESS                           0x00000080
 
-#define WINED3DUSAGE_WRITEONLY                                  0x00000008
 #define WINED3DUSAGE_SOFTWAREPROCESSING                         0x00000010
 #define WINED3DUSAGE_DONOTCLIP                                  0x00000020
 #define WINED3DUSAGE_POINTS                                     0x00000040
@@ -926,7 +925,7 @@ enum wined3d_shader_type
 #define WINED3DUSAGE_RESTRICT_SHARED_RESOURCE                   0x00002000
 #define WINED3DUSAGE_DMAP                                       0x00004000
 #define WINED3DUSAGE_TEXTAPI                                    0x10000000
-#define WINED3DUSAGE_MASK                                       0x10007bf8
+#define WINED3DUSAGE_MASK                                       0x10007bf0
 
 #define WINED3DUSAGE_SCRATCH                                    0x00400000
 #define WINED3DUSAGE_PRIVATE                                    0x00800000
-- 
2.19.2




More information about the wine-devel mailing list