Module: wine Branch: master Commit: 65089c395dbb44eb4f2bf8a7722092254d277549 URL: http://source.winehq.org/git/wine.git/?a=commit;h=65089c395dbb44eb4f2bf8a772...
Author: Józef Kucia jkucia@codeweavers.com Date: Thu Jan 26 13:07:32 2017 +0100
wined3d: Do not pass LOD to texelFetch() for buffer resources.
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
---
dlls/wined3d/glsl_shader.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 3cdc957..c6a51c5 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -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(®_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); }