[PATCH 3/8] wined3d: Implement SM5 gather4_c instruction.

Józef Kucia jkucia at codeweavers.com
Tue Apr 11 06:30:32 CDT 2017


Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
 dlls/wined3d/glsl_shader.c | 11 ++++++++---
 dlls/wined3d/shader.c      |  1 +
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index c617393..7cd1698 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -5898,8 +5898,8 @@ static void shader_glsl_sample_c(const struct wined3d_shader_instruction *ins)
     struct glsl_src_param coord_param, compare_param;
     struct glsl_sample_function sample_function;
     const char *lod_param = NULL;
+    unsigned int coord_size;
     DWORD flags = 0;
-    UINT coord_size;
 
     if (ins->handler_idx == WINED3DSIH_SAMPLE_C_LZ)
     {
@@ -5932,8 +5932,8 @@ static void shader_glsl_gather4(const struct wined3d_shader_instruction *ins)
     const struct wined3d_shader_resource_info *resource_info;
     unsigned int resource_idx, sampler_idx, sampler_bind_idx;
     struct wined3d_string_buffer *buffer = ins->ctx->buffer;
+    struct glsl_src_param coord_param, compare_param;
     unsigned int coord_size, offset_size;
-    struct glsl_src_param coord_param;
     char dst_swizzle[6];
     BOOL has_offset;
 
@@ -5966,6 +5966,11 @@ static void shader_glsl_gather4(const struct wined3d_shader_instruction *ins)
 
     shader_addline(buffer, "textureGather%s(%s_sampler%u, %s",
             has_offset ? "Offset" : "", prefix, sampler_bind_idx, coord_param.param_str);
+    if (ins->handler_idx == WINED3DSIH_GATHER4_C)
+    {
+        shader_glsl_add_src_param(ins, &ins->src[3], WINED3DSP_WRITEMASK_0, &compare_param);
+        shader_addline(buffer, ", %s", compare_param.param_str);
+    }
     if (has_offset)
     {
         int offset_immdata[4] = {ins->texel_offset.u, ins->texel_offset.v, ins->texel_offset.w};
@@ -10040,7 +10045,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB
     /* WINED3DSIH_FTOI                             */ shader_glsl_to_int,
     /* WINED3DSIH_FTOU                             */ shader_glsl_to_uint,
     /* WINED3DSIH_GATHER4                          */ shader_glsl_gather4,
-    /* WINED3DSIH_GATHER4_C                        */ NULL,
+    /* WINED3DSIH_GATHER4_C                        */ shader_glsl_gather4,
     /* WINED3DSIH_GE                               */ shader_glsl_relop,
     /* WINED3DSIH_HS_CONTROL_POINT_PHASE           */ NULL,
     /* WINED3DSIH_HS_DECLS                         */ shader_glsl_nop,
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index f44ce28..acf914b 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -1449,6 +1449,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
                 --cur_loop_depth;
             }
             else if (ins.handler_idx == WINED3DSIH_GATHER4
+                    || ins.handler_idx == WINED3DSIH_GATHER4_C
                     || ins.handler_idx == WINED3DSIH_SAMPLE
                     || ins.handler_idx == WINED3DSIH_SAMPLE_B
                     || ins.handler_idx == WINED3DSIH_SAMPLE_C
-- 
2.10.2




More information about the wine-patches mailing list