diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 240c995f8bb..0be9331a484 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -909,7 +909,8 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_ClearRenderTargetView(ID3D iface, render_target_view, color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]); wined3d_mutex_lock(); - if (FAILED(hr = wined3d_device_clear_rendertarget_view(device->wined3d_device, view->wined3d_view, NULL, &color))) + if (FAILED(hr = wined3d_device_clear_rendertarget_view(device->wined3d_device, view->wined3d_view, NULL, + WINED3DCLEAR_TARGET, &color, 0.0f, 0))) ERR("Failed to clear view, hr %#x.\n", hr); wined3d_mutex_unlock(); } @@ -3301,7 +3302,8 @@ static void STDMETHODCALLTYPE d3d10_device_ClearRenderTargetView(ID3D10Device1 * iface, render_target_view, color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]); wined3d_mutex_lock(); - if (FAILED(hr = wined3d_device_clear_rendertarget_view(device->wined3d_device, view->wined3d_view, NULL, &color))) + if (FAILED(hr = wined3d_device_clear_rendertarget_view(device->wined3d_device, view->wined3d_view, NULL, + WINED3DCLEAR_TARGET, &color, 0.0f, 0))) ERR("Failed to clear view, hr %#x.\n", hr); wined3d_mutex_unlock(); } diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 918e1e0f897..0ed2aff4d95 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -1450,7 +1450,8 @@ static HRESULT WINAPI d3d9_device_ColorFill(IDirect3DDevice9Ex *iface, } hr = wined3d_device_clear_rendertarget_view(device->wined3d_device, - d3d9_surface_get_rendertarget_view(surface_impl), rect, &c); + d3d9_surface_get_rendertarget_view(surface_impl), rect, + WINED3DCLEAR_TARGET, &c, 0.0f, 0); wined3d_mutex_unlock(); diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 53e64203ee4..be8d36f8187 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4078,13 +4078,25 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str } HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *device, - struct wined3d_rendertarget_view *view, const RECT *rect, const struct wined3d_color *color) + struct wined3d_rendertarget_view *view, const RECT *rect, DWORD flags, + const struct wined3d_color *color, float depth, DWORD stencil) { + const struct blit_shader *blitter; struct wined3d_resource *resource; + enum wined3d_blit_op blit_op; RECT r; - TRACE("device %p, view %p, rect %s, color %s.\n", - device, view, wine_dbgstr_rect(rect), debug_color(color)); + TRACE("device %p, view %p, rect %s, flags %#x, color %s, depth %.8e, stencil %u.\n", + device, view, wine_dbgstr_rect(rect), flags, debug_color(color), depth, stencil); + + if (!flags) + return WINED3D_OK; + + if (flags & WINED3DCLEAR_STENCIL) + { + FIXME("Stencil clear not implemented.\n"); + return E_NOTIMPL; + } resource = view->resource; if (resource->type != WINED3D_RTYPE_TEXTURE_2D) @@ -4105,9 +4117,22 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi rect = &r; } - resource = wined3d_texture_get_sub_resource(wined3d_texture_from_resource(resource), view->sub_resource_idx); + if (flags & WINED3DCLEAR_TARGET) + blit_op = WINED3D_BLIT_OP_COLOR_FILL; + else + blit_op = WINED3D_BLIT_OP_DEPTH_FILL; - return surface_color_fill(surface_from_resource(resource), rect, color); + if (!(blitter = wined3d_select_blitter(&device->adapter->gl_info, &device->adapter->d3d_info, + blit_op, NULL, 0, 0, NULL, rect, resource->usage, resource->pool, resource->format))) + { + FIXME("No blitter is capable of performing the requested fill operation.\n"); + return WINED3DERR_INVALIDCALL; + } + + if (blit_op == WINED3D_BLIT_OP_COLOR_FILL) + return blitter->color_fill(device, view, rect, color); + else + return blitter->depth_fill(device, view, rect, depth); } struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(const struct wined3d_device *device, diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index 247e4dec66e..82e0d4ffff2 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -36,7 +36,7 @@ @ cdecl wined3d_device_begin_scene(ptr) @ cdecl wined3d_device_begin_stateblock(ptr) @ cdecl wined3d_device_clear(ptr long ptr long ptr float long) -@ cdecl wined3d_device_clear_rendertarget_view(ptr ptr ptr ptr) +@ cdecl wined3d_device_clear_rendertarget_view(ptr ptr ptr long ptr float long) @ cdecl wined3d_device_copy_resource(ptr ptr ptr) @ cdecl wined3d_device_copy_sub_resource_region(ptr ptr long long long long ptr long ptr) @ cdecl wined3d_device_create(ptr long long ptr long long ptr ptr) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index e678c39a45d..d69d11efc01 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2054,7 +2054,8 @@ HRESULT __cdecl wined3d_device_begin_stateblock(struct wined3d_device *device); HRESULT __cdecl wined3d_device_clear(struct wined3d_device *device, DWORD rect_count, const RECT *rects, DWORD flags, const struct wined3d_color *color, float z, DWORD stencil); HRESULT __cdecl wined3d_device_clear_rendertarget_view(struct wined3d_device *device, - struct wined3d_rendertarget_view *view, const RECT *rect, const struct wined3d_color *color); + struct wined3d_rendertarget_view *view, const RECT *rect, DWORD flags, + const struct wined3d_color *color, float depth, DWORD stencil); void __cdecl wined3d_device_copy_resource(struct wined3d_device *device, struct wined3d_resource *dst_resource, struct wined3d_resource *src_resource); HRESULT __cdecl wined3d_device_copy_sub_resource_region(struct wined3d_device *device,