Commit 65089c39 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

wined3d: Do not pass LOD to texelFetch() for buffer resources.

parent 81878178
......@@ -4956,10 +4956,12 @@ static void shader_glsl_resinfo(const struct wined3d_shader_instruction *ins)
/* FIXME: The current implementation does not handle multisample textures correctly. */
static void shader_glsl_ld(const struct wined3d_shader_instruction *ins)
{
const struct wined3d_shader_reg_maps *reg_maps = ins->ctx->reg_maps;
unsigned int resource_idx, sampler_idx, sampler_bind_idx;
struct glsl_src_param coord_param, lod_param;
struct glsl_sample_function sample_function;
DWORD flags = WINED3D_GLSL_SAMPLE_LOAD;
BOOL has_lod_param;
if (wined3d_shader_instruction_has_texel_offset(ins))
flags |= WINED3D_GLSL_SAMPLE_OFFSET;
......@@ -4967,12 +4969,20 @@ static void shader_glsl_ld(const struct wined3d_shader_instruction *ins)
resource_idx = ins->src[1].reg.idx[0].offset;
sampler_idx = WINED3D_SAMPLER_DEFAULT;
if (resource_idx >= ARRAY_SIZE(reg_maps->resource_info))
{
ERR("Invalid resource index %u.\n", resource_idx);
return;
}
has_lod_param = reg_maps->resource_info[resource_idx].type != WINED3D_SHADER_RESOURCE_BUFFER;
shader_glsl_get_sample_function(ins->ctx, resource_idx, sampler_idx, flags, &sample_function);
shader_glsl_add_src_param(ins, &ins->src[0], sample_function.coord_mask, &coord_param);
shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_3, &lod_param);
sampler_bind_idx = shader_glsl_find_sampler(&ins->ctx->reg_maps->sampler_map, resource_idx, sampler_idx);
sampler_bind_idx = shader_glsl_find_sampler(&reg_maps->sampler_map, resource_idx, sampler_idx);
shader_glsl_gen_sample_code(ins, sampler_bind_idx, &sample_function, ins->src[1].swizzle,
NULL, NULL, lod_param.param_str, &ins->texel_offset, "%s", coord_param.param_str);
NULL, NULL, has_lod_param ? lod_param.param_str : NULL, &ins->texel_offset,
"%s", coord_param.param_str);
shader_glsl_release_sample_function(ins->ctx, &sample_function);
}
......
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