[PATCH 1/6] d3d8: Disallow rendertarget and depth/stencil usage on vertex buffers.

Henri Verbeet hverbeet at codeweavers.com
Wed Nov 21 07:17:22 CST 2018


Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
 dlls/d3d8/buffer.c       | 4 ++++
 dlls/d3d8/tests/device.c | 8 +++-----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/dlls/d3d8/buffer.c b/dlls/d3d8/buffer.c
index 475bf48aa1b..84873128cf0 100644
--- a/dlls/d3d8/buffer.c
+++ b/dlls/d3d8/buffer.c
@@ -282,6 +282,10 @@ HRESULT vertexbuffer_init(struct d3d8_vertexbuffer *buffer, struct d3d8_device *
         return D3DERR_INVALIDCALL;
     }
 
+    /* In d3d8, buffers can't be used as rendertarget or depth/stencil buffer. */
+    if (usage & (D3DUSAGE_RENDERTARGET | D3DUSAGE_DEPTHSTENCIL))
+        return D3DERR_INVALIDCALL;
+
     buffer->IDirect3DVertexBuffer8_iface.lpVtbl = &Direct3DVertexBuffer8_Vtbl;
     d3d8_resource_init(&buffer->resource);
     buffer->fvf = fvf;
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index 8ac6ed70b23..b3260eaaf6c 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -9163,16 +9163,14 @@ static void test_resource_access(void)
 
         hr = IDirect3DDevice8_CreateVertexBuffer(device, 16, tests[i].usage,
                 tests[i].format == FORMAT_COLOUR ? 0 : D3DFVF_XYZRHW, tests[i].pool, &vb);
-        todo_wine_if(tests[i].pool != D3DPOOL_SCRATCH && tests[i].usage & ~D3DUSAGE_DYNAMIC)
-            ok(hr == (tests[i].pool == D3DPOOL_SCRATCH || (tests[i].usage & ~D3DUSAGE_DYNAMIC)
-                    ? D3DERR_INVALIDCALL : D3D_OK), "Test %u: Got unexpected hr %#x.\n", i, hr);
+        ok(hr == (tests[i].pool == D3DPOOL_SCRATCH || (tests[i].usage & ~D3DUSAGE_DYNAMIC)
+                ? D3DERR_INVALIDCALL : D3D_OK), "Test %u: Got unexpected hr %#x.\n", i, hr);
         if (FAILED(hr))
             continue;
 
         hr = IDirect3DVertexBuffer8_GetDesc(vb, &vb_desc);
         ok(hr == D3D_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
-        todo_wine_if(tests[i].usage & ~D3DUSAGE_DYNAMIC)
-            ok(vb_desc.Usage == tests[i].usage, "Test %u: Got unexpected usage %#x.\n", i, vb_desc.Usage);
+        ok(vb_desc.Usage == tests[i].usage, "Test %u: Got unexpected usage %#x.\n", i, vb_desc.Usage);
         ok(vb_desc.Pool == tests[i].pool, "Test %u: Got unexpected pool %#x.\n", i, vb_desc.Pool);
 
         hr = IDirect3DVertexBuffer8_Lock(vb, 0, 0, &data, 0);
-- 
2.11.0




More information about the wine-devel mailing list