mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
wined3d: Implement depth clear in wined3d_device_clear_rendertarget_view().
Signed-off-by: Józef Kucia <jkucia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
c099f3a060
commit
c21dbb5149
5 changed files with 39 additions and 10 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue