Commit b9d50242 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

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

parent 5e000be1
......@@ -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)
......
......@@ -9130,7 +9130,6 @@ 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);
if (FAILED(hr))
......@@ -9138,7 +9137,6 @@ static void test_resource_access(void)
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.Pool == tests[i].pool, "Test %u: Got unexpected pool %#x.\n", i, ib_desc.Pool);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment