wined3d: Introduce wined3d_device_context_set_depth_stencil_view().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-03-18 23:16:35 -05:00 committed by Alexandre Julliard
parent 4a5d320609
commit 0acd15dec8
3 changed files with 36 additions and 25 deletions

View file

@ -2372,6 +2372,38 @@ HRESULT CDECL wined3d_device_context_set_rendertarget_view(struct wined3d_device
return WINED3D_OK;
}
HRESULT CDECL wined3d_device_context_set_depth_stencil_view(struct wined3d_device_context *context,
struct wined3d_rendertarget_view *view)
{
struct wined3d_fb_state *fb = &context->state->fb;
struct wined3d_rendertarget_view *prev;
TRACE("context %p, view %p.\n", context, 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 = fb->depth_stencil;
if (prev == view)
{
TRACE("Trying to do a NOP SetRenderTarget operation.\n");
return WINED3D_OK;
}
if ((fb->depth_stencil = view))
wined3d_rendertarget_view_incref(view);
wined3d_device_context_emit_set_depth_stencil_view(context, view);
if (prev)
wined3d_rendertarget_view_decref(prev);
wined3d_device_context_unbind_srv_for_rtv(context, view, TRUE);
return WINED3D_OK;
}
void CDECL wined3d_device_set_vertex_shader(struct wined3d_device *device, struct wined3d_shader *shader)
{
TRACE("device %p, shader %p.\n", device, shader);
@ -5272,33 +5304,9 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device
HRESULT CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device,
struct wined3d_rendertarget_view *view)
{
struct wined3d_fb_state *fb = &device->cs->c.state->fb;
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 = fb->depth_stencil;
if (prev == view)
{
TRACE("Trying to do a NOP SetRenderTarget operation.\n");
return WINED3D_OK;
}
if ((fb->depth_stencil = view))
wined3d_rendertarget_view_incref(view);
wined3d_device_context_emit_set_depth_stencil_view(&device->cs->c, view);
if (prev)
wined3d_rendertarget_view_decref(prev);
wined3d_device_context_unbind_srv_for_rtv(&device->cs->c, view, TRUE);
return WINED3D_OK;
return wined3d_device_context_set_depth_stencil_view(&device->cs->c, view);
}
static struct wined3d_texture *wined3d_device_create_cursor_texture(struct wined3d_device *device,

View file

@ -169,6 +169,7 @@
@ cdecl wined3d_device_context_set_blend_state(ptr ptr ptr long)
@ cdecl wined3d_device_context_set_constant_buffer(ptr long long ptr)
@ cdecl wined3d_device_context_set_depth_stencil_state(ptr ptr long)
@ cdecl wined3d_device_context_set_depth_stencil_view(ptr ptr)
@ cdecl wined3d_device_context_set_rasterizer_state(ptr ptr)
@ cdecl wined3d_device_context_set_rendertarget_view(ptr long ptr long)
@ cdecl wined3d_device_context_set_sampler(ptr long long ptr)

View file

@ -2561,6 +2561,8 @@ void __cdecl wined3d_device_context_set_constant_buffer(struct wined3d_device_co
enum wined3d_shader_type type, unsigned int idx, struct wined3d_buffer *buffer);
void __cdecl wined3d_device_context_set_depth_stencil_state(struct wined3d_device_context *context,
struct wined3d_depth_stencil_state *depth_stencil_state, unsigned int stencil_ref);
HRESULT __cdecl wined3d_device_context_set_depth_stencil_view(struct wined3d_device_context *context,
struct wined3d_rendertarget_view *view);
void __cdecl wined3d_device_context_set_rasterizer_state(struct wined3d_device_context *context,
struct wined3d_rasterizer_state *rasterizer_state);
HRESULT __cdecl wined3d_device_context_set_rendertarget_view(struct wined3d_device_context *context,