Henri Verbeet : d3d8: Disallow rendertarget and depth/ stencil usage on index buffers.

Alexandre Julliard julliard at winehq.org
Wed Nov 21 16:08:06 CST 2018


Module: wine
Branch: master
Commit: b9d50242a639ce22aaca52b7446958f006ea8c28
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=b9d50242a639ce22aaca52b7446958f006ea8c28

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Wed Nov 21 17:05:24 2018 +0330

d3d8: Disallow rendertarget and depth/stencil usage on index buffers.

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 8487312..558583d 100644
--- a/dlls/d3d8/buffer.c
+++ b/dlls/d3d8/buffer.c
@@ -580,6 +580,10 @@ HRESULT indexbuffer_init(struct d3d8_indexbuffer *buffer, struct d3d8_device *de
     if (pool == D3DPOOL_SCRATCH)
         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;
+
     desc.byte_width = size;
     desc.usage = (usage & WINED3DUSAGE_MASK) | WINED3DUSAGE_STATICDECL;
     if (pool == D3DPOOL_SCRATCH)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index b3260ea..49d2a98 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -9130,16 +9130,14 @@ static void test_resource_access(void)
 
         hr = IDirect3DDevice8_CreateIndexBuffer(device, 16, tests[i].usage,
                 tests[i].format == FORMAT_COLOUR ? D3DFMT_INDEX32 : D3DFMT_INDEX16, tests[i].pool, &ib);
-        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 = IDirect3DIndexBuffer8_GetDesc(ib, &ib_desc);
         ok(hr == D3D_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
-        todo_wine_if(tests[i].usage & ~D3DUSAGE_DYNAMIC)
-            ok(ib_desc.Usage == tests[i].usage, "Test %u: Got unexpected usage %#x.\n", i, ib_desc.Usage);
+        ok(ib_desc.Usage == tests[i].usage, "Test %u: Got unexpected usage %#x.\n", i, ib_desc.Usage);
         ok(ib_desc.Pool == tests[i].pool, "Test %u: Got unexpected pool %#x.\n", i, ib_desc.Pool);
 
         hr = IDirect3DIndexBuffer8_Lock(ib, 0, 0, &data, 0);




More information about the wine-cvs mailing list