[PATCH 3/4] d3d9: Buffers do not support user memory (try 2).
Stefan Dösinger
stefan at codeweavers.com
Mon Dec 9 06:28:15 CST 2013
Try 2: Handle pools other than D3DPOOL_SYSMEM.
The different return values for SYSMEM and SCRATCH suggest that support
for this may exist, or was at some point planned. I could not find a way
to make sysmem buffers work on Windows.
---
dlls/d3d9/device.c | 14 ++++++++++++++
dlls/d3d9/tests/d3d9ex.c | 10 ++++++++++
2 files changed, 24 insertions(+)
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index e92c84e..6759f97 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -886,7 +886,14 @@ static HRESULT WINAPI d3d9_device_CreateVertexBuffer(IDirect3DDevice9Ex *iface,
iface, size, usage, fvf, pool, buffer, shared_handle);
if (shared_handle)
+ {
+ if (pool != D3DPOOL_DEFAULT)
+ {
+ WARN("User memory is not allowed on vertex buffers.\n");
+ return D3DERR_NOTAVAILABLE;
+ }
FIXME("Resource sharing not implemented, *shared_handle %p.\n", *shared_handle);
+ }
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
@@ -918,7 +925,14 @@ static HRESULT WINAPI d3d9_device_CreateIndexBuffer(IDirect3DDevice9Ex *iface, U
iface, size, usage, format, pool, buffer, shared_handle);
if (shared_handle)
+ {
+ if (pool != D3DPOOL_DEFAULT)
+ {
+ WARN("User memory is not allowed on index buffers.\n");
+ return D3DERR_NOTAVAILABLE;
+ }
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 65ffce0..9d7b3a0 100644
--- a/dlls/d3d9/tests/d3d9ex.c
+++ b/dlls/d3d9/tests/d3d9ex.c
@@ -541,6 +541,8 @@ static void test_user_memory(void)
IDirect3DTexture9 *texture;
IDirect3DCubeTexture9 *cube_texture;
IDirect3DVolumeTexture9 *volume_texture;
+ IDirect3DVertexBuffer9 *vertex_buffer;
+ IDirect3DIndexBuffer9 *index_buffer;
D3DLOCKED_RECT locked_rect;
UINT refcount;
HWND window;
@@ -606,6 +608,14 @@ static void test_user_memory(void)
hr = IDirect3DDevice9Ex_CreateVolumeTexture(device, 2, 2, 2, 1, 0, D3DFMT_A8R8G8B8,
test_data[i].pool, &volume_texture, &mem);
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x, pool %s.\n", hr, test_data[i].name);
+
+ /* D3DPOOL_SYSTEMMEM returns D3DERR_NOTAVAILABLE, D3DPOOL_SCRATCH returns D3DERR_INVALIDCALL. */
+ hr = IDirect3DDevice9Ex_CreateIndexBuffer(device, 16, 0, D3DFMT_INDEX32, test_data[i].pool,
+ &index_buffer, &mem);
+ ok(FAILED(hr), "Got unexpected hr %#x, pool %s.\n", hr, test_data[i].name);
+ hr = IDirect3DDevice9Ex_CreateVertexBuffer(device, 16, 0, 0, test_data[i].pool,
+ &vertex_buffer, &mem);
+ ok(FAILED(hr), "Got unexpected hr %#x, pool %s.\n", hr, test_data[i].name);
}
HeapFree(GetProcessHeap(), 0, mem);
--
1.8.3.2
More information about the wine-patches
mailing list