Henri Verbeet : d3d9: Disallow rendertarget and depth/ stencil usage on vertex buffers.
Alexandre Julliard
julliard at winehq.org
Wed Nov 21 16:08:06 CST 2018
Module: wine
Branch: master
Commit: 5e000be16ec3ec3ecc98ada8db710364960e6dee
URL: https://source.winehq.org/git/wine.git/?a=commit;h=5e000be16ec3ec3ecc98ada8db710364960e6dee
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Wed Nov 21 17:05:23 2018 +0330
d3d9: Disallow rendertarget and depth/stencil usage on vertex buffers.
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/d3d9/buffer.c | 4 ++++
dlls/d3d9/tests/device.c | 8 +++-----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/dlls/d3d9/buffer.c b/dlls/d3d9/buffer.c
index b870107..67586c2 100644
--- a/dlls/d3d9/buffer.c
+++ b/dlls/d3d9/buffer.c
@@ -283,6 +283,10 @@ HRESULT vertexbuffer_init(struct d3d9_vertexbuffer *buffer, struct d3d9_device *
return D3DERR_INVALIDCALL;
}
+ /* In d3d9, buffers can't be used as rendertarget or depth/stencil buffer. */
+ if (usage & (D3DUSAGE_RENDERTARGET | D3DUSAGE_DEPTHSTENCIL))
+ return D3DERR_INVALIDCALL;
+
buffer->IDirect3DVertexBuffer9_iface.lpVtbl = &d3d9_vertexbuffer_vtbl;
buffer->fvf = fvf;
d3d9_resource_init(&buffer->resource);
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index af0e8a0..b2803ba 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -12998,16 +12998,14 @@ static void test_resource_access(void)
hr = IDirect3DDevice9_CreateVertexBuffer(device, 16, tests[i].usage,
tests[i].format == FORMAT_COLOUR ? 0 : D3DFVF_XYZRHW, tests[i].pool, &vb, NULL);
- 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 = IDirect3DVertexBuffer9_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 = IDirect3DVertexBuffer9_Lock(vb, 0, 0, &data, 0);
More information about the wine-cvs
mailing list