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

Alexandre Julliard julliard at wine.codeweavers.com
Tue Feb 2 09:59:29 CST 2016


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

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Tue Feb  2 11:32:27 2016 +0100

wined3d: Recognize SM4 dcl_input_ps 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             | 39 +++++++++++++++++++++++++++++++++++++++
 dlls/wined3d/shader_sm4.c         | 10 ++++++++++
 dlls/wined3d/wined3d_private.h    | 12 ++++++++++++
 5 files changed, 63 insertions(+)

diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 9f4295a..825a771 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -5229,6 +5229,7 @@ static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABL
     /* WINED3DSIH_DCL_CONSTANT_BUFFER           */ shader_hw_nop,
     /* WINED3DSIH_DCL_IMMEDIATE_CONSTANT_BUFFER */ NULL,
     /* WINED3DSIH_DCL_INPUT_PRIMITIVE           */ shader_hw_nop,
+    /* WINED3DSIH_DCL_INPUT_PS                  */ NULL,
     /* WINED3DSIH_DCL_OUTPUT                    */ NULL,
     /* WINED3DSIH_DCL_OUTPUT_TOPOLOGY           */ shader_hw_nop,
     /* WINED3DSIH_DCL_SAMPLER                   */ NULL,
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 3b5513b..e679ae5 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -8017,6 +8017,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB
     /* WINED3DSIH_DCL_CONSTANT_BUFFER           */ shader_glsl_nop,
     /* WINED3DSIH_DCL_IMMEDIATE_CONSTANT_BUFFER */ NULL,
     /* WINED3DSIH_DCL_INPUT_PRIMITIVE           */ shader_glsl_nop,
+    /* WINED3DSIH_DCL_INPUT_PS                  */ NULL,
     /* WINED3DSIH_DCL_OUTPUT                    */ shader_glsl_nop,
     /* WINED3DSIH_DCL_OUTPUT_TOPOLOGY           */ shader_glsl_nop,
     /* WINED3DSIH_DCL_SAMPLER                   */ NULL,
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 934af23..cab6335 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -57,6 +57,7 @@ static const char * const shader_opcode_names[] =
     /* WINED3DSIH_DCL_CONSTANT_BUFFER           */ "dcl_constantBuffer",
     /* WINED3DSIH_DCL_IMMEDIATE_CONSTANT_BUFFER */ "dcl_immediateConstantBuffer",
     /* WINED3DSIH_DCL_INPUT_PRIMITIVE           */ "dcl_inputPrimitive",
+    /* WINED3DSIH_DCL_INPUT_PS                  */ "dcl_input_ps",
     /* WINED3DSIH_DCL_OUTPUT                    */ "dcl_output",
     /* WINED3DSIH_DCL_OUTPUT_TOPOLOGY           */ "dcl_outputTopology",
     /* WINED3DSIH_DCL_SAMPLER                   */ "dcl_sampler",
@@ -1774,6 +1775,37 @@ static void shader_dump_primitive_type(enum wined3d_primitive_type primitive_typ
     }
 }
 
+static void shader_dump_interpolation_mode(enum wined3d_shader_interpolation_mode interpolation_mode)
+{
+    switch (interpolation_mode)
+    {
+        case WINED3DSIM_CONSTANT:
+            TRACE("constant");
+            break;
+        case WINED3DSIM_LINEAR:
+            TRACE("linear");
+            break;
+        case WINED3DSIM_LINEAR_CENTROID:
+            TRACE("linear centroid");
+            break;
+        case WINED3DSIM_LINEAR_NOPERSPECTIVE:
+            TRACE("linear noperspective");
+            break;
+        case WINED3DSIM_LINEAR_SAMPLE:
+            TRACE("linear sample");
+            break;
+        case WINED3DSIM_LINEAR_NOPERSPECTIVE_CENTROID:
+            TRACE("linear noperspective centroid");
+            break;
+        case WINED3DSIM_LINEAR_NOPERSPECTIVE_SAMPLE:
+            TRACE("linear noperspective sample");
+            break;
+        default:
+            TRACE("<unrecognized_interpolation_mode %#x>", interpolation_mode);
+            break;
+    }
+}
+
 static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe_data, const DWORD *byte_code)
 {
     struct wined3d_shader_version shader_version;
@@ -1844,6 +1876,13 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe
             }
             TRACE("}");
         }
+        else if (ins.handler_idx == WINED3DSIH_DCL_INPUT_PS)
+        {
+            TRACE("%s ", shader_opcode_names[ins.handler_idx]);
+            shader_dump_interpolation_mode(ins.flags);
+            TRACE(" ");
+            shader_dump_dst_param(&ins.declaration.dst, &shader_version);
+        }
         else if (ins.handler_idx == WINED3DSIH_DCL_OUTPUT)
         {
             TRACE("%s ", shader_opcode_names[ins.handler_idx]);
diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c
index 63dbc9e..3babd4e 100644
--- a/dlls/wined3d/shader_sm4.c
+++ b/dlls/wined3d/shader_sm4.c
@@ -47,6 +47,9 @@ WINE_DECLARE_DEBUG_CHANNEL(d3d_bytecode);
 #define WINED3D_SM4_SHADER_DATA_TYPE_SHIFT      11
 #define WINED3D_SM4_SHADER_DATA_TYPE_MASK       (0xfu << WINED3D_SM4_SHADER_DATA_TYPE_SHIFT)
 
+#define WINED3D_SM4_INTERPOLATION_MODE_SHIFT    11
+#define WINED3D_SM4_INTERPOLATION_MODE_MASK     (0xfu << WINED3D_SM4_INTERPOLATION_MODE_SHIFT)
+
 #define WINED3D_SM4_OPCODE_MASK                 0xff
 
 #define WINED3D_SM4_REGISTER_MODIFIER           (0x1u << 31)
@@ -158,6 +161,7 @@ enum wined3d_sm4_opcode
     WINED3D_SM4_OP_DCL_OUTPUT_TOPOLOGY  = 0x5c,
     WINED3D_SM4_OP_DCL_INPUT_PRIMITIVE  = 0x5d,
     WINED3D_SM4_OP_DCL_VERTICES_OUT     = 0x5e,
+    WINED3D_SM4_OP_DCL_INPUT_PS         = 0x62,
     WINED3D_SM4_OP_DCL_OUTPUT           = 0x65,
     WINED3D_SM4_OP_DCL_TEMPS            = 0x68,
 };
@@ -361,6 +365,7 @@ static const struct wined3d_sm4_opcode_info opcode_table[] =
     {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,              "",     ""},
+    {WINED3D_SM4_OP_DCL_INPUT_PS,           WINED3DSIH_DCL_INPUT_PS,                  "",     ""},
     {WINED3D_SM4_OP_DCL_OUTPUT,             WINED3DSIH_DCL_OUTPUT,                    "",     ""},
     {WINED3D_SM4_OP_DCL_TEMPS,              WINED3DSIH_DCL_TEMPS,                     "",     ""},
 };
@@ -973,6 +978,11 @@ static void shader_sm4_read_instruction(void *data, const DWORD **ptr, struct wi
             ins->declaration.primitive_type = input_primitive_type_table[primitive_type];
         }
     }
+    else if (opcode == WINED3D_SM4_OP_DCL_INPUT_PS)
+    {
+        ins->flags = (opcode_token & WINED3D_SM4_INTERPOLATION_MODE_MASK) >> WINED3D_SM4_INTERPOLATION_MODE_SHIFT;
+        shader_sm4_read_dst_param(priv, &p, WINED3D_DATA_FLOAT, &ins->declaration.dst);
+    }
     else if (opcode == WINED3D_SM4_OP_DCL_OUTPUT)
     {
         shader_sm4_read_dst_param(priv, &p, WINED3D_DATA_FLOAT, &ins->declaration.dst);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 7ab2ae8..cda6c39 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -416,6 +416,17 @@ enum wined3d_shader_dst_modifier
     WINED3DSPDM_MSAMPCENTROID = 4,
 };
 
+enum wined3d_shader_interpolation_mode
+{
+    WINED3DSIM_CONSTANT = 1,
+    WINED3DSIM_LINEAR = 2,
+    WINED3DSIM_LINEAR_CENTROID = 3,
+    WINED3DSIM_LINEAR_NOPERSPECTIVE = 4,
+    WINED3DSIM_LINEAR_NOPERSPECTIVE_CENTROID = 5,
+    WINED3DSIM_LINEAR_SAMPLE = 6,
+    WINED3DSIM_LINEAR_NOPERSPECTIVE_SAMPLE = 7,
+};
+
 /* Undocumented opcode control to identify projective texture lookups in ps 2.0 and later */
 #define WINED3DSI_TEXLD_PROJECT     0x1
 #define WINED3DSI_TEXLD_BIAS        0x2
@@ -490,6 +501,7 @@ enum WINED3D_SHADER_INSTRUCTION_HANDLER
     WINED3DSIH_DCL_CONSTANT_BUFFER,
     WINED3DSIH_DCL_IMMEDIATE_CONSTANT_BUFFER,
     WINED3DSIH_DCL_INPUT_PRIMITIVE,
+    WINED3DSIH_DCL_INPUT_PS,
     WINED3DSIH_DCL_OUTPUT,
     WINED3DSIH_DCL_OUTPUT_TOPOLOGY,
     WINED3DSIH_DCL_SAMPLER,




More information about the wine-cvs mailing list