[PATCH 11/13] wined3d: Implement SM5 countbits instruction.

Józef Kucia jkucia at codeweavers.com
Sat Jan 28 10:14:10 CST 2017


Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
 dlls/wined3d/arb_program_shader.c | 1 +
 dlls/wined3d/glsl_shader.c        | 2 ++
 dlls/wined3d/shader.c             | 1 +
 dlls/wined3d/shader_sm4.c         | 2 ++
 dlls/wined3d/wined3d_private.h    | 1 +
 5 files changed, 7 insertions(+)

diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index db76d37..0ab724c 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -5040,6 +5040,7 @@ static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABL
     /* WINED3DSIH_CMP                              */ pshader_hw_cmp,
     /* WINED3DSIH_CND                              */ pshader_hw_cnd,
     /* WINED3DSIH_CONTINUE                         */ NULL,
+    /* WINED3DSIH_COUNTBITS                        */ NULL,
     /* WINED3DSIH_CRS                              */ shader_hw_map2gl,
     /* WINED3DSIH_CUT                              */ NULL,
     /* WINED3DSIH_CUT_STREAM                       */ NULL,
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 785cd76..eaa903a 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -3724,6 +3724,7 @@ static void shader_glsl_map2gl(const struct wined3d_shader_instruction *ins)
     {
         case WINED3DSIH_ABS: instruction = "abs"; break;
         case WINED3DSIH_BFREV: instruction = "bitfieldReverse"; break;
+        case WINED3DSIH_COUNTBITS: instruction = "bitCount"; break;
         case WINED3DSIH_DSX: instruction = "dFdx"; break;
         case WINED3DSIH_DSX_COARSE: instruction = "dFdxCoarse"; break;
         case WINED3DSIH_DSX_FINE: instruction = "dFdxFine"; break;
@@ -8893,6 +8894,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB
     /* WINED3DSIH_CMP                              */ shader_glsl_conditional_move,
     /* WINED3DSIH_CND                              */ shader_glsl_cnd,
     /* WINED3DSIH_CONTINUE                         */ shader_glsl_continue,
+    /* WINED3DSIH_COUNTBITS                        */ shader_glsl_map2gl,
     /* WINED3DSIH_CRS                              */ shader_glsl_cross,
     /* WINED3DSIH_CUT                              */ shader_glsl_cut,
     /* WINED3DSIH_CUT_STREAM                       */ shader_glsl_cut,
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 32a000e..a4e74fd 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -65,6 +65,7 @@ static const char * const shader_opcode_names[] =
     /* WINED3DSIH_CMP                              */ "cmp",
     /* WINED3DSIH_CND                              */ "cnd",
     /* WINED3DSIH_CONTINUE                         */ "continue",
+    /* WINED3DSIH_COUNTBITS                        */ "countbits",
     /* WINED3DSIH_CRS                              */ "crs",
     /* WINED3DSIH_CUT                              */ "cut",
     /* WINED3DSIH_CUT_STREAM                       */ "cut_stream",
diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c
index 4b2c012..a7adb64 100644
--- a/dlls/wined3d/shader_sm4.c
+++ b/dlls/wined3d/shader_sm4.c
@@ -233,6 +233,7 @@ enum wined3d_sm4_opcode
     WINED3D_SM5_OP_RCP                              = 0x81,
     WINED3D_SM5_OP_F32TOF16                         = 0x82,
     WINED3D_SM5_OP_F16TOF32                         = 0x83,
+    WINED3D_SM5_OP_COUNTBITS                        = 0x86,
     WINED3D_SM5_OP_UBFE                             = 0x8a,
     WINED3D_SM5_OP_BFI                              = 0x8c,
     WINED3D_SM5_OP_BFREV                            = 0x8d,
@@ -926,6 +927,7 @@ static const struct wined3d_sm4_opcode_info opcode_table[] =
     {WINED3D_SM5_OP_RCP,                              WINED3DSIH_RCP,                              "f",    "f"},
     {WINED3D_SM5_OP_F32TOF16,                         WINED3DSIH_F32TOF16,                         "u",    "f"},
     {WINED3D_SM5_OP_F16TOF32,                         WINED3DSIH_F16TOF32,                         "f",    "u"},
+    {WINED3D_SM5_OP_COUNTBITS,                        WINED3DSIH_COUNTBITS,                        "u",    "u"},
     {WINED3D_SM5_OP_UBFE,                             WINED3DSIH_UBFE,                             "u",    "iiu"},
     {WINED3D_SM5_OP_BFI,                              WINED3DSIH_BFI,                              "u",    "iiuu"},
     {WINED3D_SM5_OP_BFREV,                            WINED3DSIH_BFREV,                            "u",    "u"},
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 5b471d5..8eeaaf3 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -595,6 +595,7 @@ enum WINED3D_SHADER_INSTRUCTION_HANDLER
     WINED3DSIH_CMP,
     WINED3DSIH_CND,
     WINED3DSIH_CONTINUE,
+    WINED3DSIH_COUNTBITS,
     WINED3DSIH_CRS,
     WINED3DSIH_CUT,
     WINED3DSIH_CUT_STREAM,
-- 
2.10.2




More information about the wine-patches mailing list