Commit ef290846 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

wined3d: Explicitly bind 0 for a NULL SRV.

Currently we invalidate STATE_SAMPLER whenever an SRV is bound, and hence rely on sampler() to do this for us, which is a bit obscure and won't work with the next patch.
parent d95a04b4
......@@ -3966,6 +3966,7 @@ void context_state_drawbuf(struct wined3d_context *context, const struct wined3d
static void wined3d_context_gl_bind_shader_resources(struct wined3d_context_gl *context_gl,
const struct wined3d_state *state, enum wined3d_shader_type shader_type)
{
const struct wined3d_gl_info *gl_info = context_gl->gl_info;
unsigned int bind_idx, shader_sampler_count, base, count, i;
const struct wined3d_device *device = context_gl->c.device;
struct wined3d_shader_sampler_map_entry *entry;
......@@ -3993,18 +3994,23 @@ static void wined3d_context_gl_bind_shader_resources(struct wined3d_context_gl *
if (tex_unit_map)
bind_idx = tex_unit_map[bind_idx];
if (!(view = state->shader_resource_view[shader_type][entry->resource_idx]))
if ((view = state->shader_resource_view[shader_type][entry->resource_idx]))
{
if (entry->sampler_idx == WINED3D_SAMPLER_DEFAULT)
sampler = device->default_sampler;
else if (!(sampler = state->sampler[shader_type][entry->sampler_idx]))
sampler = device->null_sampler;
wined3d_shader_resource_view_gl_bind(wined3d_shader_resource_view_gl(view),
bind_idx, wined3d_sampler_gl(sampler), context_gl);
}
else
{
WARN("No resource view bound at index %u, %u.\n", shader_type, entry->resource_idx);
continue;
wined3d_context_gl_active_texture(context_gl, gl_info, bind_idx);
wined3d_context_gl_bind_texture(context_gl, GL_NONE, 0);
if (gl_info->supported[ARB_SAMPLER_OBJECTS])
GL_EXTCALL(glBindSampler(bind_idx, 0));
}
if (entry->sampler_idx == WINED3D_SAMPLER_DEFAULT)
sampler = device->default_sampler;
else if (!(sampler = state->sampler[shader_type][entry->sampler_idx]))
sampler = device->null_sampler;
wined3d_shader_resource_view_gl_bind(wined3d_shader_resource_view_gl(view),
bind_idx, wined3d_sampler_gl(sampler), context_gl);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment