[PATCH 3/5] d3d9: Buffers do not support user memory (try 4).
Stefan Dösinger
stefan at codeweavers.com
Tue Dec 10 07:36:57 CST 2013
Try 4: Change the WARN message again.
Try 3: Change the WARN message.
I also investigated the possibility that the different return value
happens because native interprets the pointer as an invalid handle. This
is not the case. Passing a valid vertex buffer handle (created via
CreateVertexBuffer(..., D3DPOOL_DEFAULT, ...) or a pointer to a NULL
handle still return D3DERR_NOTAVAILABLE. When native interprets the
shared_handle value as a handle, and the handle is invalid, E_INVALIDARG
is returned.
Index buffers are the only resource that do not support resource sharing
in D3DPOOL_DEFAULT in native d3d. I have no explanation for this
behavior, but I suspect that Microsoft simply forgot about them.
Try 2: Handle pools other than D3DPOOL_SYSMEM.
---
dlls/d3d9/device.c | 14 ++++++++++++++
dlls/d3d9/tests/d3d9ex.c | 9 +++++++++
2 files changed, 23 insertions(+)
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 65fd377..598fff0 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -879,7 +879,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("Trying to create a shared vertex buffer in pool %#x.\n", pool);
+ return D3DERR_NOTAVAILABLE;
+ }
FIXME("Resource sharing not implemented, *shared_handle %p.\n", *shared_handle);
+ }
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
@@ -911,7 +918,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("Trying to create a shared index buffer in pool %#x.\n", pool);
+ 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 1df6eb8..22134c3 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;
@@ -596,6 +598,13 @@ static void test_user_memory(void)
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);
+
HeapFree(GetProcessHeap(), 0, mem);
refcount = IDirect3DDevice9Ex_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
--
1.8.3.2
More information about the wine-patches
mailing list