[PATCH 2/2] wined3d: Implement SM5 ubfe opcode in glsl.

Guillaume Charifi guillaume.charifi at sfr.fr
Fri Jul 15 06:53:39 CDT 2016


Signed-off-by: Guillaume Charifi <guillaume.charifi at sfr.fr>
---
 dlls/wined3d/arb_program_shader.c | 1 +
 dlls/wined3d/glsl_shader.c        | 7 +++++++
 dlls/wined3d/shader_sm4.c         | 2 ++
 dlls/wined3d/wined3d_private.h    | 1 +
 4 files changed, 11 insertions(+)

diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 9aa4252..84b9087 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -5394,6 +5394,7 @@ static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABL
     /* WINED3DSIH_TEXREG2AR                        */ pshader_hw_texreg2ar,
     /* WINED3DSIH_TEXREG2GB                        */ pshader_hw_texreg2gb,
     /* WINED3DSIH_TEXREG2RGB                       */ pshader_hw_texreg2rgb,
+    /* WINED3DSIH_UBFE                             */ NULL,
     /* WINED3DSIH_UDIV                             */ NULL,
     /* WINED3DSIH_UGE                              */ NULL,
     /* WINED3DSIH_ULT                              */ NULL,
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index b0d3a91..a037414 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -4401,6 +4401,12 @@ static void shader_glsl_bitfield_op(const struct wined3d_shader_instruction *ins
 
     switch(ins->handler_idx)
     {
+        case WINED3DSIH_UBFE:
+            prefix = "bitfieldExtract(";
+            suffix = ")";
+            nb_params = 3;
+            break;
+
         case WINED3DSIH_BFI:
             prefix = "bitfieldInsert(";
             suffix = ")";
@@ -8919,6 +8925,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB
     /* WINED3DSIH_TEXREG2AR                        */ shader_glsl_texreg2ar,
     /* WINED3DSIH_TEXREG2GB                        */ shader_glsl_texreg2gb,
     /* WINED3DSIH_TEXREG2RGB                       */ shader_glsl_texreg2rgb,
+    /* WINED3DSIH_UBFE                             */ shader_glsl_bitfield_op,
     /* WINED3DSIH_UDIV                             */ shader_glsl_udiv,
     /* WINED3DSIH_UGE                              */ shader_glsl_relop,
     /* WINED3DSIH_ULT                              */ shader_glsl_relop,
diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c
index 6c15751..83cfd0d 100644
--- a/dlls/wined3d/shader_sm4.c
+++ b/dlls/wined3d/shader_sm4.c
@@ -216,6 +216,7 @@ enum wined3d_sm4_opcode
     WINED3D_SM5_OP_DERIV_RTY_FINE                   = 0x7d,
     WINED3D_SM5_OP_GATHER4_C                        = 0x7e,
     WINED3D_SM5_OP_F32TOF16                         = 0x82,
+    WINED3D_SM5_OP_UBFE                             = 0x8a,
     WINED3D_SM5_OP_BFI                              = 0x8c,
     WINED3D_SM5_OP_BFREV                            = 0x8d,
     WINED3D_SM5_OP_SWAPC                            = 0x8e,
@@ -813,6 +814,7 @@ static const struct wined3d_sm4_opcode_info opcode_table[] =
     {WINED3D_SM5_OP_DERIV_RTY_FINE,                   WINED3DSIH_DSY_FINE,                         "f",    "f"},
     {WINED3D_SM5_OP_GATHER4_C,                        WINED3DSIH_GATHER4_C,                        "f",    "fRSf"},
     {WINED3D_SM5_OP_F32TOF16,                         WINED3DSIH_F32TOF16,                         "f",    "f"},
+    {WINED3D_SM5_OP_UBFE,                             WINED3DSIH_UBFE,                             "u",    "uuu"},
     {WINED3D_SM5_OP_BFI,                              WINED3DSIH_BFI,                              "u",    "uuuu"},
     {WINED3D_SM5_OP_BFREV,                            WINED3DSIH_BFREV,                            "u",    "u"},
     {WINED3D_SM5_OP_SWAPC,                            WINED3DSIH_SWAPC,                            "ff",   "uff"},
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 6f95a46..b505bfa 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -739,6 +739,7 @@ enum WINED3D_SHADER_INSTRUCTION_HANDLER
     WINED3DSIH_TEXREG2AR,
     WINED3DSIH_TEXREG2GB,
     WINED3DSIH_TEXREG2RGB,
+    WINED3DSIH_UBFE,
     WINED3DSIH_UDIV,
     WINED3DSIH_UGE,
     WINED3DSIH_ULT,
-- 
2.7.4




More information about the wine-patches mailing list