=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: wined3d: Do not pass LOD to texelFetch( ) for buffer resources.

Alexandre Julliard julliard at winehq.org
Thu Jul 20 12:11:30 CDT 2017


Module: wine
Branch: stable
Commit: 3588c533b043bbab1938801d6518bb43776570db
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=3588c533b043bbab1938801d6518bb43776570db

Author: Józef Kucia <jkucia at 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 at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 65089c395dbb44eb4f2bf8a7722092254d277549)
Signed-off-by: Michael Stefaniuc <mstefani at 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 a8d208e..fedc216 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -4908,10 +4908,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;
@@ -4919,12 +4921,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);
 }
 




More information about the wine-cvs mailing list