[PATCH 3/4] d3d9: Buffers do not support user memory.
Stefan Dösinger
stefan at codeweavers.com
Wed Dec 4 07:01:33 CST 2013
No idea why native returns NOTAVAILABLE instead of INVALIDCALL. The
non-NULL shared handle is the only thing that makes those create calls
fail, so there's no higher priority error condition causing this.
---
dlls/d3d9/device.c | 20 ++++++++++++++++++--
dlls/d3d9/tests/d3d9ex.c | 13 +++++++++++--
2 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index e48a641..25c65f7 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -874,7 +874,15 @@ static HRESULT WINAPI d3d9_device_CreateVertexBuffer(IDirect3DDevice9Ex *iface,
iface, size, usage, fvf, pool, buffer, shared_handle);
if (shared_handle)
- FIXME("Resource sharing not implemented, *shared_handle %p.\n", *shared_handle);
+ {
+ if (pool == D3DPOOL_SYSTEMMEM)
+ {
+ WARN("User memory is not allowed on vertex buffers.\n");
+ return D3DERR_NOTAVAILABLE;
+ }
+ else
+ FIXME("Resource sharing not implemented, *shared_handle %p.\n", *shared_handle);
+ }
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
@@ -906,7 +914,15 @@ static HRESULT WINAPI d3d9_device_CreateIndexBuffer(IDirect3DDevice9Ex *iface, U
iface, size, usage, format, pool, buffer, shared_handle);
if (shared_handle)
- FIXME("Resource sharing not implemented, *shared_handle %p.\n", *shared_handle);
+ {
+ if (pool == D3DPOOL_SYSTEMMEM)
+ {
+ WARN("User memory is not allowed on index buffers.\n");
+ return D3DERR_NOTAVAILABLE;
+ }
+ else
+ FIXME("Resource sharing not implemented, *shared_handle %p.\n", *shared_handle);
+ }
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c
index e6ce770..9f04832 100644
--- a/dlls/d3d9/tests/d3d9ex.c
+++ b/dlls/d3d9/tests/d3d9ex.c
@@ -535,12 +535,14 @@ out:
IDirect3D9Ex_Release(d3d9ex);
}
-static void test_texture_sysmem_create(void)
+static void test_user_memory(void)
{
IDirect3DDevice9Ex *device;
IDirect3DTexture9 *texture;
IDirect3DCubeTexture9 *cube_texture;
IDirect3DVolumeTexture9 *volume_texture;
+ IDirect3DVertexBuffer9 *vertex_buffer;
+ IDirect3DIndexBuffer9 *index_buffer;
D3DLOCKED_RECT locked_rect;
UINT refcount;
HWND window;
@@ -584,6 +586,13 @@ static void test_texture_sysmem_create(void)
D3DPOOL_SYSTEMMEM, &volume_texture, &mem);
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ hr = IDirect3DDevice9Ex_CreateIndexBuffer(device, 16, 0, D3DFMT_INDEX32, D3DPOOL_SYSTEMMEM,
+ &index_buffer, &mem);
+ ok(hr == D3DERR_NOTAVAILABLE, "Got unexpected hr %#x.\n", hr);
+ hr = IDirect3DDevice9Ex_CreateVertexBuffer(device, 16, 0, 0, D3DPOOL_SYSTEMMEM,
+ &vertex_buffer, &mem);
+ ok(hr == D3DERR_NOTAVAILABLE, "Got unexpected hr %#x.\n", hr);
+
refcount = IDirect3DDevice9Ex_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
@@ -1123,7 +1132,7 @@ START_TEST(d3d9ex)
test_swapchain_get_displaymode_ex();
test_get_adapter_luid();
test_get_adapter_displaymode_ex();
- test_texture_sysmem_create();
+ test_user_memory();
test_reset();
test_reset_resources();
test_vidmem_accounting();
--
1.8.3.2
More information about the wine-patches
mailing list