[PATCH v2 2/5] wined3d: Recognize SM4 resinfo opcode.

Józef Kucia jkucia at codeweavers.com
Thu Jan 14 05:39:54 CST 2016


Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
v2: Use instruction flags instead of destination modifiers.
---
 dlls/wined3d/arb_program_shader.c |  1 +
 dlls/wined3d/glsl_shader.c        |  1 +
 dlls/wined3d/shader.c             | 11 +++++++++++
 dlls/wined3d/shader_sm4.c         |  7 ++++++-
 dlls/wined3d/wined3d_private.h    |  3 +++
 5 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 074b74f..84b85c4 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -5295,6 +5295,7 @@ static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABL
     /* WINED3DSIH_POW                   */ shader_hw_pow,
     /* WINED3DSIH_RCP                   */ shader_hw_scalar_op,
     /* WINED3DSIH_REP                   */ shader_hw_rep,
+    /* WINED3DSIH_RESINFO               */ NULL,
     /* WINED3DSIH_RET                   */ shader_hw_ret,
     /* WINED3DSIH_ROUND_NI              */ NULL,
     /* WINED3DSIH_RSQ                   */ shader_hw_scalar_op,
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index b7d30ca..0b29378 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -7948,6 +7948,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB
     /* WINED3DSIH_POW                   */ shader_glsl_pow,
     /* WINED3DSIH_RCP                   */ shader_glsl_scalar_op,
     /* WINED3DSIH_REP                   */ shader_glsl_rep,
+    /* WINED3DSIH_RESINFO               */ NULL,
     /* WINED3DSIH_RET                   */ shader_glsl_ret,
     /* WINED3DSIH_ROUND_NI              */ shader_glsl_map2gl,
     /* WINED3DSIH_RSQ                   */ shader_glsl_scalar_op,
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index d747816..a2bece7 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -123,6 +123,7 @@ static const char * const shader_opcode_names[] =
     /* WINED3DSIH_POW                   */ "pow",
     /* WINED3DSIH_RCP                   */ "rcp",
     /* WINED3DSIH_REP                   */ "rep",
+    /* WINED3DSIH_RESINFO               */ "resinfo",
     /* WINED3DSIH_RET                   */ "ret",
     /* WINED3DSIH_ROUND_NI              */ "round_ni",
     /* WINED3DSIH_RSQ                   */ "rsq",
@@ -1873,6 +1874,16 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe
             {
                 TRACE("p");
             }
+            else if (ins.handler_idx == WINED3DSIH_RESINFO
+                    && ins.flags)
+            {
+                switch (ins.flags)
+                {
+                    case WINED3DSI_RESINFO_UINT: TRACE("_uint"); break;
+                    case WINED3DSI_RESINFO_RCP_FLOAT: TRACE("_rcpFloat");
+                    default: TRACE("_unrecognized(%#x)", ins.flags); break;
+                }
+            }
 
             for (i = 0; i < ins.dst_count; ++i)
             {
diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c
index 6e02352..d1a0abf 100644
--- a/dlls/wined3d/shader_sm4.c
+++ b/dlls/wined3d/shader_sm4.c
@@ -29,6 +29,9 @@ WINE_DECLARE_DEBUG_CHANNEL(d3d_bytecode);
 #define WINED3D_SM4_INSTRUCTION_LENGTH_SHIFT    24
 #define WINED3D_SM4_INSTRUCTION_LENGTH_MASK     (0x1fu << WINED3D_SM4_INSTRUCTION_LENGTH_SHIFT)
 
+#define WINED3D_SM4_OPCODESPECIFICCONTROL_SHIFT 11
+#define WINED3D_SM4_OPCODESPECIFICCONTROL_MASK  (0x3u << WINED3D_SM4_OPCODESPECIFICCONTROL_SHIFT)
+
 #define WINED3D_SM4_RESOURCE_TYPE_SHIFT         11
 #define WINED3D_SM4_RESOURCE_TYPE_MASK          (0xfu << WINED3D_SM4_RESOURCE_TYPE_SHIFT)
 
@@ -120,6 +123,7 @@ enum wined3d_sm4_opcode
     WINED3D_SM4_OP_MUL                  = 0x38,
     WINED3D_SM4_OP_NE                   = 0x39,
     WINED3D_SM4_OP_OR                   = 0x3c,
+    WINED3D_SM4_OP_RESINFO              = 0x3d,
     WINED3D_SM4_OP_RET                  = 0x3e,
     WINED3D_SM4_OP_ROUND_NI             = 0x41,
     WINED3D_SM4_OP_RSQ                  = 0x44,
@@ -296,6 +300,7 @@ static const struct wined3d_sm4_opcode_info opcode_table[] =
     {WINED3D_SM4_OP_MUL,                    WINED3DSIH_MUL,                 "F",    "FF"},
     {WINED3D_SM4_OP_NE,                     WINED3DSIH_NE,                  "U",    "FF"},
     {WINED3D_SM4_OP_OR,                     WINED3DSIH_OR,                  "U",    "UU"},
+    {WINED3D_SM4_OP_RESINFO,                WINED3DSIH_RESINFO,             "F",    "IR"},
     {WINED3D_SM4_OP_RET,                    WINED3DSIH_RET,                 "",     ""},
     {WINED3D_SM4_OP_ROUND_NI,               WINED3DSIH_ROUND_NI,            "F",    "F"},
     {WINED3D_SM4_OP_RSQ,                    WINED3DSIH_RSQ,                 "F",    "F"},
@@ -796,7 +801,7 @@ static void shader_sm4_read_instruction(void *data, const DWORD **ptr, struct wi
     }
 
     ins->handler_idx = opcode_info->handler_idx;
-    ins->flags = 0;
+    ins->flags = (opcode_token & WINED3D_SM4_OPCODESPECIFICCONTROL_MASK) >> WINED3D_SM4_OPCODESPECIFICCONTROL_SHIFT;
     ins->coissue = 0;
     ins->predicate = NULL;
     ins->dst_count = strlen(opcode_info->dst_info);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 07007c0..3393d62 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -407,6 +407,8 @@ enum wined3d_shader_dst_modifier
 #define WINED3DSI_TEXLD_PROJECT     0x1
 #define WINED3DSI_TEXLD_BIAS        0x2
 #define WINED3DSI_INDEXED_DYNAMIC   0x4
+#define WINED3DSI_RESINFO_RCP_FLOAT 0x1
+#define WINED3DSI_RESINFO_UINT      0x2
 
 enum wined3d_shader_rel_op
 {
@@ -538,6 +540,7 @@ enum WINED3D_SHADER_INSTRUCTION_HANDLER
     WINED3DSIH_POW,
     WINED3DSIH_RCP,
     WINED3DSIH_REP,
+    WINED3DSIH_RESINFO,
     WINED3DSIH_RET,
     WINED3DSIH_ROUND_NI,
     WINED3DSIH_RSQ,
-- 
2.4.10




More information about the wine-patches mailing list