d3d11: Implement d3d11_immediate_context_ClearDepthStencilView().

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:
Józef Kucia 2016-03-15 10:52:50 +01:00 committed by Alexandre Julliard
parent 3ae4be8696
commit 526c4612c8
3 changed files with 34 additions and 2 deletions

View File

@ -67,6 +67,7 @@ DWORD wined3d_usage_from_d3d11(UINT bind_flags, enum D3D11_USAGE usage) DECLSPEC
struct wined3d_resource *wined3d_resource_from_d3d11_resource(ID3D11Resource *resource) DECLSPEC_HIDDEN; struct wined3d_resource *wined3d_resource_from_d3d11_resource(ID3D11Resource *resource) DECLSPEC_HIDDEN;
struct wined3d_resource *wined3d_resource_from_d3d10_resource(ID3D10Resource *resource) DECLSPEC_HIDDEN; struct wined3d_resource *wined3d_resource_from_d3d10_resource(ID3D10Resource *resource) DECLSPEC_HIDDEN;
DWORD wined3d_map_flags_from_d3d11_map_type(D3D11_MAP map_type) DECLSPEC_HIDDEN; DWORD wined3d_map_flags_from_d3d11_map_type(D3D11_MAP map_type) DECLSPEC_HIDDEN;
DWORD wined3d_clear_flags_from_d3d11_clear_flags(UINT clear_flags) DECLSPEC_HIDDEN;
enum D3D11_USAGE d3d11_usage_from_d3d10_usage(enum D3D10_USAGE usage) DECLSPEC_HIDDEN; enum D3D11_USAGE d3d11_usage_from_d3d10_usage(enum D3D10_USAGE usage) DECLSPEC_HIDDEN;
enum D3D10_USAGE d3d10_usage_from_d3d11_usage(enum D3D11_USAGE usage) DECLSPEC_HIDDEN; enum D3D10_USAGE d3d10_usage_from_d3d11_usage(enum D3D11_USAGE usage) DECLSPEC_HIDDEN;

View File

@ -905,7 +905,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_ClearRenderTargetView(ID3D
const struct wined3d_color color = {color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]}; const struct wined3d_color color = {color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]};
HRESULT hr; HRESULT hr;
TRACE("iface %p, render_target_view %p, color_rgba {%.8e %.8e %.8e %.8e}.\n", TRACE("iface %p, render_target_view %p, color_rgba {%.8e, %.8e, %.8e, %.8e}.\n",
iface, render_target_view, color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]); iface, render_target_view, color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]);
wined3d_mutex_lock(); wined3d_mutex_lock();
@ -932,8 +932,21 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_ClearUnorderedAccessViewFl
static void STDMETHODCALLTYPE d3d11_immediate_context_ClearDepthStencilView(ID3D11DeviceContext *iface, static void STDMETHODCALLTYPE d3d11_immediate_context_ClearDepthStencilView(ID3D11DeviceContext *iface,
ID3D11DepthStencilView *depth_stencil_view, UINT flags, FLOAT depth, UINT8 stencil) ID3D11DepthStencilView *depth_stencil_view, UINT flags, FLOAT depth, UINT8 stencil)
{ {
FIXME("iface %p, depth_stencil_view %p, flags %#x, depth %f, stencil %u stub!\n", struct d3d_device *device = device_from_immediate_ID3D11DeviceContext(iface);
struct d3d_depthstencil_view *view = unsafe_impl_from_ID3D11DepthStencilView(depth_stencil_view);
DWORD wined3d_flags;
HRESULT hr;
TRACE("iface %p, depth_stencil_view %p, flags %#x, depth %.8e, stencil %u.\n",
iface, depth_stencil_view, flags, depth, stencil); iface, depth_stencil_view, flags, depth, stencil);
wined3d_flags = wined3d_clear_flags_from_d3d11_clear_flags(flags);
wined3d_mutex_lock();
if (FAILED(hr = wined3d_device_clear_rendertarget_view(device->wined3d_device, view->wined3d_view, NULL,
wined3d_flags, NULL, depth, stencil)))
ERR("Failed to clear view, hr %#x.\n", hr);
wined3d_mutex_unlock();
} }
static void STDMETHODCALLTYPE d3d11_immediate_context_GenerateMips(ID3D11DeviceContext *iface, static void STDMETHODCALLTYPE d3d11_immediate_context_GenerateMips(ID3D11DeviceContext *iface,

View File

@ -593,6 +593,24 @@ DWORD wined3d_map_flags_from_d3d11_map_type(D3D11_MAP map_type)
} }
} }
DWORD wined3d_clear_flags_from_d3d11_clear_flags(UINT clear_flags)
{
DWORD wined3d_clear_flags = 0;
if (clear_flags & D3D11_CLEAR_DEPTH)
wined3d_clear_flags |= WINED3DCLEAR_ZBUFFER;
if (clear_flags & D3D11_CLEAR_STENCIL)
wined3d_clear_flags |= WINED3DCLEAR_STENCIL;
if (clear_flags & ~(D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL))
{
FIXME("Unhandled clear flags %#x.\n",
clear_flags & ~(D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL));
}
return wined3d_clear_flags;
}
HRESULT d3d_get_private_data(struct wined3d_private_store *store, HRESULT d3d_get_private_data(struct wined3d_private_store *store,
REFGUID guid, UINT *data_size, void *data) REFGUID guid, UINT *data_size, void *data)
{ {