wined3d: Record texture accesses for SM4 ld instruction.

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-01-05 21:52:31 +01:00 committed by Alexandre Julliard
parent 3193505f9f
commit 5ca86ca4ee
3 changed files with 19 additions and 2 deletions

View File

@ -3112,6 +3112,7 @@ static void context_load_shader_resources(struct wined3d_context *context, const
static void context_bind_shader_resources(struct wined3d_context *context, const struct wined3d_state *state)
{
const struct wined3d_device *device = context->swapchain->device;
const struct wined3d_gl_info *gl_info = context->gl_info;
struct wined3d_shader_sampler_map_entry *entry;
struct wined3d_shader_resource_view *view;
@ -3119,6 +3120,7 @@ static void context_bind_shader_resources(struct wined3d_context *context, const
struct wined3d_texture *texture;
struct wined3d_shader *shader;
unsigned int i, j, count;
GLuint sampler_name;
static const struct
{
@ -3161,7 +3163,15 @@ static void context_bind_shader_resources(struct wined3d_context *context, const
continue;
}
if (!(sampler = state->sampler[shader_types[i].type][entry->sampler_idx]))
if (entry->sampler_idx == WINED3D_SAMPLER_DEFAULT)
{
sampler_name = device->default_sampler;
}
else if ((sampler = state->sampler[shader_types[i].type][entry->sampler_idx]))
{
sampler_name = sampler->name;
}
else
{
WARN("No sampler object bound at index %u, %u.\n", shader_types[i].type, entry->sampler_idx);
continue;
@ -3171,7 +3181,7 @@ static void context_bind_shader_resources(struct wined3d_context *context, const
context_active_texture(context, gl_info, shader_types[i].base_idx + entry->bind_idx);
wined3d_texture_bind(texture, context, FALSE);
GL_EXTCALL(glBindSampler(shader_types[i].base_idx + entry->bind_idx, sampler->name));
GL_EXTCALL(glBindSampler(shader_types[i].base_idx + entry->bind_idx, sampler_name));
checkGLcall("glBindSampler");
}
}

View File

@ -1068,6 +1068,11 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
shader_record_sample(reg_maps, ins.src[1].reg.idx[0].offset,
ins.src[2].reg.idx[0].offset, reg_maps->sampler_map.count);
}
else if (ins.handler_idx == WINED3DSIH_LD)
{
shader_record_sample(reg_maps, ins.src[1].reg.idx[0].offset,
WINED3D_SAMPLER_DEFAULT, reg_maps->sampler_map.count);
}
if (ins.predicate)
if (!shader_record_register_usage(shader, reg_maps, &ins.predicate->reg,

View File

@ -597,6 +597,8 @@ struct wined3d_shader_resource_info
enum wined3d_data_type data_type;
};
#define WINED3D_SAMPLER_DEFAULT ~0x0u
struct wined3d_shader_sampler_map_entry
{
unsigned int resource_idx;