Signed-off-by: Henri Verbeet hverbeet@codeweavers.com --- dlls/d3d8/device.c | 13 ++++++++----- dlls/d3d8/tests/device.c | 5 ++--- dlls/d3d9/device.c | 5 +++-- dlls/d3d9/tests/device.c | 5 ++--- dlls/wined3d/device.c | 14 ++++++++++++-- include/wine/wined3d.h | 2 +- 6 files changed, 28 insertions(+), 16 deletions(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 476e3e11b78..67996a78e70 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -1438,12 +1438,15 @@ static HRESULT WINAPI d3d8_device_SetRenderTarget(IDirect3DDevice8 *iface,
original_dsv = wined3d_device_get_depth_stencil_view(device->wined3d_device); rtv = ds_impl ? d3d8_surface_acquire_rendertarget_view(ds_impl) : NULL; - wined3d_device_set_depth_stencil_view(device->wined3d_device, rtv); + hr = wined3d_device_set_depth_stencil_view(device->wined3d_device, rtv); d3d8_surface_release_rendertarget_view(ds_impl, rtv); - rtv = render_target ? d3d8_surface_acquire_rendertarget_view(rt_impl) : NULL; - if (render_target && FAILED(hr = wined3d_device_set_rendertarget_view(device->wined3d_device, 0, rtv, TRUE))) - wined3d_device_set_depth_stencil_view(device->wined3d_device, original_dsv); - d3d8_surface_release_rendertarget_view(rt_impl, rtv); + if (SUCCEEDED(hr)) + { + rtv = render_target ? d3d8_surface_acquire_rendertarget_view(rt_impl) : NULL; + if (render_target && FAILED(hr = wined3d_device_set_rendertarget_view(device->wined3d_device, 0, rtv, TRUE))) + wined3d_device_set_depth_stencil_view(device->wined3d_device, original_dsv); + d3d8_surface_release_rendertarget_view(rt_impl, rtv); + }
wined3d_mutex_unlock();
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 9f1d8167af9..862dbb4c45a 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -9069,9 +9069,8 @@ static void test_resource_access(void) ok(hr == D3D_OK, "Test %s %u: Got unexpected hr %#x.\n", surface_types[i].name, j, hr);
hr = IDirect3DDevice8_SetRenderTarget(device, backbuffer, surface); - todo_wine_if(!(surface_desc.Usage & D3DUSAGE_DEPTHSTENCIL)) - ok(hr == (surface_desc.Usage & D3DUSAGE_DEPTHSTENCIL ? D3D_OK : D3DERR_INVALIDCALL), - "Test %s %u: Got unexpected hr %#x.\n", surface_types[i].name, j, hr); + ok(hr == (surface_desc.Usage & D3DUSAGE_DEPTHSTENCIL ? D3D_OK : D3DERR_INVALIDCALL), + "Test %s %u: Got unexpected hr %#x.\n", surface_types[i].name, j, hr); hr = IDirect3DDevice8_SetRenderTarget(device, backbuffer, depth_stencil); ok(hr == D3D_OK, "Test %s %u: Got unexpected hr %#x.\n", surface_types[i].name, j, hr);
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index dd40ddaa04c..eed3a043a67 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -1903,16 +1903,17 @@ static HRESULT WINAPI d3d9_device_SetDepthStencilSurface(IDirect3DDevice9Ex *ifa struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); struct d3d9_surface *ds_impl = unsafe_impl_from_IDirect3DSurface9(depth_stencil); struct wined3d_rendertarget_view *rtv; + HRESULT hr;
TRACE("iface %p, depth_stencil %p.\n", iface, depth_stencil);
wined3d_mutex_lock(); rtv = ds_impl ? d3d9_surface_acquire_rendertarget_view(ds_impl) : NULL; - wined3d_device_set_depth_stencil_view(device->wined3d_device, rtv); + hr = wined3d_device_set_depth_stencil_view(device->wined3d_device, rtv); d3d9_surface_release_rendertarget_view(ds_impl, rtv); wined3d_mutex_unlock();
- return D3D_OK; + return hr; }
static HRESULT WINAPI d3d9_device_GetDepthStencilSurface(IDirect3DDevice9Ex *iface, IDirect3DSurface9 **depth_stencil) diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index aca578db16c..ee7d0c622ab 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -12902,9 +12902,8 @@ static void test_resource_access(void) ok(hr == D3D_OK, "Test %s %u: Got unexpected hr %#x.\n", surface_types[i].name, j, hr);
hr = IDirect3DDevice9_SetDepthStencilSurface(device, surface); - todo_wine_if(!(surface_desc.Usage & D3DUSAGE_DEPTHSTENCIL)) - ok(hr == (surface_desc.Usage & D3DUSAGE_DEPTHSTENCIL ? D3D_OK : D3DERR_INVALIDCALL), - "Test %s %u: Got unexpected hr %#x.\n", surface_types[i].name, j, hr); + ok(hr == (surface_desc.Usage & D3DUSAGE_DEPTHSTENCIL ? D3D_OK : D3DERR_INVALIDCALL), + "Test %s %u: Got unexpected hr %#x.\n", surface_types[i].name, j, hr); hr = IDirect3DDevice9_SetDepthStencilSurface(device, depth_stencil); ok(hr == D3D_OK, "Test %s %u: Got unexpected hr %#x.\n", surface_types[i].name, j, hr);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index b1a322e33de..50ce89ac181 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4504,17 +4504,25 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device return WINED3D_OK; }
-void CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view) +HRESULT CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, + struct wined3d_rendertarget_view *view) { struct wined3d_rendertarget_view *prev;
TRACE("device %p, view %p.\n", device, view);
+ if (view && !(view->resource->bind_flags & WINED3D_BIND_DEPTH_STENCIL)) + { + WARN("View resource %p has incompatible %s bind flags.\n", + view->resource, wined3d_debug_bind_flags(view->resource->bind_flags)); + return WINED3DERR_INVALIDCALL; + } + prev = device->fb.depth_stencil; if (prev == view) { TRACE("Trying to do a NOP SetRenderTarget operation.\n"); - return; + return WINED3D_OK; }
if ((device->fb.depth_stencil = view)) @@ -4522,6 +4530,8 @@ void CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, wined3d_cs_emit_set_depth_stencil_view(device->cs, view); if (prev) wined3d_rendertarget_view_decref(prev); + + return WINED3D_OK; }
static struct wined3d_texture *wined3d_device_create_cursor_texture(struct wined3d_device *device, diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 70b27bb3d3a..f8e201c3d08 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2399,7 +2399,7 @@ void __cdecl wined3d_device_set_cursor_position(struct wined3d_device *device, int x_screen_space, int y_screen_space, DWORD flags); HRESULT __cdecl wined3d_device_set_cursor_properties(struct wined3d_device *device, UINT x_hotspot, UINT y_hotspot, struct wined3d_texture *texture, unsigned int sub_resource_idx); -void __cdecl wined3d_device_set_depth_stencil_view(struct wined3d_device *device, +HRESULT __cdecl wined3d_device_set_depth_stencil_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view); HRESULT __cdecl wined3d_device_set_dialog_box_mode(struct wined3d_device *device, BOOL enable_dialogs); void __cdecl wined3d_device_set_domain_shader(struct wined3d_device *device, struct wined3d_shader *shader);
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=44546
Your paranoid android.
=== debian9 (build log) ===
X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig)
=== debian9 (build log) ===
X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig)