[PATCH] d3d9: Implement d3d9_device_CreateRenderTargetEx().
Henri Verbeet
hverbeet at codeweavers.com
Tue Jun 25 07:00:24 CDT 2019
From: Justin Martin <jaming at protonmail.com>
Signed-off-by: Justin Martin <jaming at protonmail.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
This had a Wine-Bug reference to bug 45354, but there's no indication there
that this function even gets called. This supersedes patch 167138.
dlls/d3d9/device.c | 21 ++++++++++++++++++---
dlls/d3d9/tests/d3d9ex.c | 5 ++---
2 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 9fbdcebf075..e2da02b35dc 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -4059,16 +4059,31 @@ static HRESULT WINAPI d3d9_device_CreateRenderTargetEx(IDirect3DDevice9Ex *iface
UINT width, UINT height, D3DFORMAT format, D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality,
BOOL lockable, IDirect3DSurface9 **surface, HANDLE *shared_handle, DWORD usage)
{
- FIXME("iface %p, width %u, height %u, format %#x, multisample_type %#x, multisample_quality %u, "
- "lockable %#x, surface %p, shared_handle %p, usage %#x stub!\n",
+ struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
+ unsigned int access = WINED3D_RESOURCE_ACCESS_GPU;
+
+ TRACE("iface %p, width %u, height %u, format %#x, multisample_type %#x, multisample_quality %u, "
+ "lockable %#x, surface %p, shared_handle %p, usage %#x.\n",
iface, width, height, format, multisample_type, multisample_quality,
lockable, surface, shared_handle, usage);
*surface = NULL;
+
+ if (usage & (D3DUSAGE_DEPTHSTENCIL | D3DUSAGE_RENDERTARGET))
+ {
+ WARN("Invalid usage %#x.\n", usage);
+ return D3DERR_INVALIDCALL;
+ }
+
if (shared_handle)
FIXME("Resource sharing not implemented, *shared_handle %p.\n", *shared_handle);
- return E_NOTIMPL;
+ if (lockable)
+ access |= WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
+
+ return d3d9_device_create_surface(device, 0, wined3dformat_from_d3dformat(format),
+ multisample_type, multisample_quality, usage & WINED3DUSAGE_MASK,
+ WINED3D_BIND_RENDER_TARGET, access, width, height, NULL, surface);
}
static HRESULT WINAPI d3d9_device_CreateOffscreenPlainSurfaceEx(IDirect3DDevice9Ex *iface,
diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c
index 306241a7118..354a51d85a1 100644
--- a/dlls/d3d9/tests/d3d9ex.c
+++ b/dlls/d3d9/tests/d3d9ex.c
@@ -3932,7 +3932,7 @@ static void test_format_unknown(void)
iface = (void *)0xdeadbeef;
hr = IDirect3DDevice9Ex_CreateRenderTargetEx(device, 64, 64,
D3DFMT_UNKNOWN, D3DMULTISAMPLE_NONE, 0, FALSE, (IDirect3DSurface9 **)&iface, NULL, 0);
- todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
ok(!iface, "Got unexpected iface %p.\n", iface);
iface = (void *)0xdeadbeef;
@@ -4372,8 +4372,7 @@ static void test_resource_access(void)
case SURFACE_RT_EX:
hr = IDirect3DDevice9Ex_CreateRenderTargetEx(device, 16, 16, format, D3DMULTISAMPLE_NONE,
0, tests[j].pool != D3DPOOL_DEFAULT, &surface, NULL, tests[j].usage);
- todo_wine
- ok(hr == (tests[j].format == FORMAT_COLOUR && !tests[j].usage ? D3D_OK : D3DERR_INVALIDCALL),
+ ok(hr == (tests[j].format == FORMAT_COLOUR && !tests[j].usage ? D3D_OK : D3DERR_INVALIDCALL),
"Test %s %u: Got unexpected hr %#x.\n", surface_types[i].name, j, hr);
if (FAILED(hr))
continue;
--
2.11.0
More information about the wine-devel
mailing list