=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: wined3d: Recognize SM4 dcl_sampler opcode.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Feb 1 09:24:46 CST 2016


Module: wine
Branch: master
Commit: 5bfa02efdbbf55bd8aeadd56bcc31262944bdcc8
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=5bfa02efdbbf55bd8aeadd56bcc31262944bdcc8

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Mon Feb  1 00:14:38 2016 +0100

wined3d: Recognize SM4 dcl_sampler opcode.

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>

---

 dlls/wined3d/arb_program_shader.c |  1 +
 dlls/wined3d/glsl_shader.c        |  1 +
 dlls/wined3d/shader.c             |  8 ++++++++
 dlls/wined3d/shader_sm4.c         | 18 ++++++++++++++++++
 dlls/wined3d/wined3d_private.h    |  2 ++
 5 files changed, 30 insertions(+)

diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index a6db262..9f4295a 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -5231,6 +5231,7 @@ static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABL
     /* WINED3DSIH_DCL_INPUT_PRIMITIVE           */ shader_hw_nop,
     /* WINED3DSIH_DCL_OUTPUT                    */ NULL,
     /* WINED3DSIH_DCL_OUTPUT_TOPOLOGY           */ shader_hw_nop,
+    /* WINED3DSIH_DCL_SAMPLER                   */ NULL,
     /* WINED3DSIH_DCL_TEMPS                     */ NULL,
     /* WINED3DSIH_DCL_VERTICES_OUT              */ shader_hw_nop,
     /* WINED3DSIH_DEF                           */ shader_hw_nop,
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 04f8ab4..bf11a91 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -8014,6 +8014,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB
     /* WINED3DSIH_DCL_INPUT_PRIMITIVE           */ shader_glsl_nop,
     /* WINED3DSIH_DCL_OUTPUT                    */ shader_glsl_nop,
     /* WINED3DSIH_DCL_OUTPUT_TOPOLOGY           */ shader_glsl_nop,
+    /* WINED3DSIH_DCL_SAMPLER                   */ NULL,
     /* WINED3DSIH_DCL_TEMPS                     */ shader_glsl_nop,
     /* WINED3DSIH_DCL_VERTICES_OUT              */ shader_glsl_nop,
     /* WINED3DSIH_DEF                           */ shader_glsl_nop,
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 88c1330..934af23 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -59,6 +59,7 @@ static const char * const shader_opcode_names[] =
     /* WINED3DSIH_DCL_INPUT_PRIMITIVE           */ "dcl_inputPrimitive",
     /* WINED3DSIH_DCL_OUTPUT                    */ "dcl_output",
     /* WINED3DSIH_DCL_OUTPUT_TOPOLOGY           */ "dcl_outputTopology",
+    /* WINED3DSIH_DCL_SAMPLER                   */ "dcl_sampler",
     /* WINED3DSIH_DCL_TEMPS                     */ "dcl_temps",
     /* WINED3DSIH_DCL_VERTICES_OUT              */ "dcl_maxOutputVertexCount",
     /* WINED3DSIH_DEF                           */ "def",
@@ -1854,6 +1855,13 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe
             TRACE("%s ", shader_opcode_names[ins.handler_idx]);
             shader_dump_primitive_type(ins.declaration.primitive_type);
         }
+        else if (ins.handler_idx == WINED3DSIH_DCL_SAMPLER)
+        {
+            TRACE("%s ", shader_opcode_names[ins.handler_idx]);
+            shader_dump_dst_param(&ins.declaration.dst, &shader_version);
+            if (ins.flags == WINED3DSI_SAMPLER_COMPARISON_MODE)
+                TRACE(", comparisonMode");
+        }
         else if (ins.handler_idx == WINED3DSIH_DCL_TEMPS
                 || ins.handler_idx == WINED3DSIH_DCL_VERTICES_OUT)
         {
diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c
index d9535a5..63dbc9e 100644
--- a/dlls/wined3d/shader_sm4.c
+++ b/dlls/wined3d/shader_sm4.c
@@ -41,6 +41,9 @@ WINE_DECLARE_DEBUG_CHANNEL(d3d_bytecode);
 #define WINED3D_SM4_INDEX_TYPE_SHIFT            11
 #define WINED3D_SM4_INDEX_TYPE_MASK             (0x1u << WINED3D_SM4_INDEX_TYPE_SHIFT)
 
+#define WINED3D_SM4_SAMPLER_MODE_SHIFT          11
+#define WINED3D_SM4_SAMPLER_MODE_MASK           (0xfu << WINED3D_SM4_SAMPLER_MODE_SHIFT)
+
 #define WINED3D_SM4_SHADER_DATA_TYPE_SHIFT      11
 #define WINED3D_SM4_SHADER_DATA_TYPE_MASK       (0xfu << WINED3D_SM4_SHADER_DATA_TYPE_SHIFT)
 
@@ -151,6 +154,7 @@ enum wined3d_sm4_opcode
     WINED3D_SM4_OP_XOR                  = 0x57,
     WINED3D_SM4_OP_DCL_RESOURCE         = 0x58,
     WINED3D_SM4_OP_DCL_CONSTANT_BUFFER  = 0x59,
+    WINED3D_SM4_OP_DCL_SAMPLER          = 0x5a,
     WINED3D_SM4_OP_DCL_OUTPUT_TOPOLOGY  = 0x5c,
     WINED3D_SM4_OP_DCL_INPUT_PRIMITIVE  = 0x5d,
     WINED3D_SM4_OP_DCL_VERTICES_OUT     = 0x5e,
@@ -224,6 +228,12 @@ enum wined3d_sm4_data_type
     WINED3D_SM4_DATA_FLOAT  = 0x5,
 };
 
+enum wined3d_sm4_sampler_mode
+{
+    WINED3D_SM4_SAMPLER_DEFAULT    = 0x0,
+    WINED3D_SM4_SAMPLER_COMPARISON = 0x1,
+};
+
 enum wined3d_sm4_shader_data_type
 {
     WINED3D_SM4_SHADER_DATA_IMMEDIATE_CONSTANT_BUFFER = 0x3,
@@ -347,6 +357,7 @@ static const struct wined3d_sm4_opcode_info opcode_table[] =
     {WINED3D_SM4_OP_XOR,                    WINED3DSIH_XOR,                           "U",    "UU"},
     {WINED3D_SM4_OP_DCL_RESOURCE,           WINED3DSIH_DCL,                           "R",    ""},
     {WINED3D_SM4_OP_DCL_CONSTANT_BUFFER,    WINED3DSIH_DCL_CONSTANT_BUFFER,           "",     ""},
+    {WINED3D_SM4_OP_DCL_SAMPLER,            WINED3DSIH_DCL_SAMPLER,                   "",     ""},
     {WINED3D_SM4_OP_DCL_OUTPUT_TOPOLOGY,    WINED3DSIH_DCL_OUTPUT_TOPOLOGY,           "",     ""},
     {WINED3D_SM4_OP_DCL_INPUT_PRIMITIVE,    WINED3DSIH_DCL_INPUT_PRIMITIVE,           "",     ""},
     {WINED3D_SM4_OP_DCL_VERTICES_OUT,       WINED3DSIH_DCL_VERTICES_OUT,              "",     ""},
@@ -925,6 +936,13 @@ static void shader_sm4_read_instruction(void *data, const DWORD **ptr, struct wi
         if (opcode_token & WINED3D_SM4_INDEX_TYPE_MASK)
             ins->flags |= WINED3DSI_INDEXED_DYNAMIC;
     }
+    else if (opcode == WINED3D_SM4_OP_DCL_SAMPLER)
+    {
+        ins->flags = (opcode_token & WINED3D_SM4_SAMPLER_MODE_MASK) >> WINED3D_SM4_SAMPLER_MODE_SHIFT;
+        if (ins->flags & ~WINED3D_SM4_SAMPLER_COMPARISON)
+            FIXME("Unhandled sampler mode %#x.\n", ins->flags);
+        shader_sm4_read_dst_param(priv, &p, WINED3D_DATA_SAMPLER, &ins->declaration.dst);
+    }
     else if (opcode == WINED3D_SM4_OP_DCL_OUTPUT_TOPOLOGY)
     {
         enum wined3d_sm4_output_primitive_type primitive_type;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 9960685..1b25704 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -422,6 +422,7 @@ enum wined3d_shader_dst_modifier
 #define WINED3DSI_INDEXED_DYNAMIC   0x4
 #define WINED3DSI_RESINFO_RCP_FLOAT 0x1
 #define WINED3DSI_RESINFO_UINT      0x2
+#define WINED3DSI_SAMPLER_COMPARISON_MODE 0x1
 
 enum wined3d_shader_rel_op
 {
@@ -491,6 +492,7 @@ enum WINED3D_SHADER_INSTRUCTION_HANDLER
     WINED3DSIH_DCL_INPUT_PRIMITIVE,
     WINED3DSIH_DCL_OUTPUT,
     WINED3DSIH_DCL_OUTPUT_TOPOLOGY,
+    WINED3DSIH_DCL_SAMPLER,
     WINED3DSIH_DCL_TEMPS,
     WINED3DSIH_DCL_VERTICES_OUT,
     WINED3DSIH_DEF,




More information about the wine-cvs mailing list