wined3d: Use the depth/stencil view to acquire a context for depth-only draws.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2017-01-24 22:15:25 +01:00 committed by Alexandre Julliard
parent 87c6ac4258
commit c93f2e3f85
1 changed files with 5 additions and 4 deletions

View File

@ -414,8 +414,8 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
const struct wined3d_fb_state *fb = state->fb; const struct wined3d_fb_state *fb = state->fb;
const struct wined3d_stream_info *stream_info; const struct wined3d_stream_info *stream_info;
struct wined3d_event_query *ib_query = NULL; struct wined3d_event_query *ib_query = NULL;
struct wined3d_rendertarget_view *dsv, *rtv;
struct wined3d_stream_info si_emulated; struct wined3d_stream_info si_emulated;
struct wined3d_rendertarget_view *dsv;
const struct wined3d_gl_info *gl_info; const struct wined3d_gl_info *gl_info;
struct wined3d_context *context; struct wined3d_context *context;
unsigned int i, idx_size = 0; unsigned int i, idx_size = 0;
@ -425,7 +425,9 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
if (!index_count) if (!index_count)
return; return;
context = context_acquire(device, wined3d_rendertarget_view_get_surface(fb->render_targets[0])); if (!(rtv = fb->render_targets[0]))
rtv = fb->depth_stencil;
context = context_acquire(device, wined3d_rendertarget_view_get_surface(rtv));
if (!context->valid) if (!context->valid)
{ {
context_release(context); context_release(context);
@ -436,10 +438,9 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
for (i = 0; i < gl_info->limits.buffers; ++i) for (i = 0; i < gl_info->limits.buffers; ++i)
{ {
struct wined3d_rendertarget_view *rtv = fb->render_targets[i];
struct wined3d_texture *rt; struct wined3d_texture *rt;
if (!rtv || rtv->format->id == WINED3DFMT_NULL) if (!(rtv = fb->render_targets[i]) || rtv->format->id == WINED3DFMT_NULL)
continue; continue;
rt = wined3d_texture_from_resource(rtv->resource); rt = wined3d_texture_from_resource(rtv->resource);