=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: wined3d: Implement SM5 ubfe instruction.

Alexandre Julliard julliard at winehq.org
Tue Jan 31 15:42:51 CST 2017


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

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Sat Jan 28 17:14:08 2017 +0100

wined3d: Implement SM5 ubfe instruction.

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/glsl_shader.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index e550318..785cd76 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -3793,11 +3793,22 @@ static void shader_glsl_float16(const struct wined3d_shader_instruction *ins)
 
 static void shader_glsl_bitwise_op(const struct wined3d_shader_instruction *ins)
 {
+    struct wined3d_string_buffer *buffer = ins->ctx->buffer;
     struct wined3d_shader_dst_param dst;
     struct glsl_src_param src[4];
+    const char *instruction;
     unsigned int i, j;
     DWORD write_mask;
 
+    switch (ins->handler_idx)
+    {
+        case WINED3DSIH_BFI:  instruction = "bitfieldInsert";  break;
+        case WINED3DSIH_UBFE: instruction = "bitfieldExtract"; break;
+        default:
+            ERR("Unhandled opcode %#x.\n", ins->handler_idx);
+            return;
+    }
+
     dst = ins->dst[0];
     for (i = 0; i < 4; ++i)
     {
@@ -3808,10 +3819,12 @@ static void shader_glsl_bitwise_op(const struct wined3d_shader_instruction *ins)
                 &dst, dst.reg.data_type)))
             continue;
 
-        for (j = 0; j < ARRAY_SIZE(src); ++j)
+        for (j = 0; j < ins->src_count; ++j)
             shader_glsl_add_src_param(ins, &ins->src[j], write_mask, &src[j]);
-        shader_addline(ins->ctx->buffer, "bitfieldInsert(%s, %s, %s & 0x1f, %s & 0x1f));\n",
-                src[3].param_str, src[2].param_str, src[1].param_str, src[0].param_str);
+        shader_addline(buffer, "%s(", instruction);
+        for (j = 0; j < ins->src_count - 2; ++j)
+            shader_addline(buffer, "%s, ", src[ins->src_count - j - 1].param_str);
+        shader_addline(buffer, "%s & 0x1f, %s & 0x1f));\n", src[1].param_str, src[0].param_str);
     }
 }
 
@@ -9066,7 +9079,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                             */ NULL,
+    /* WINED3DSIH_UBFE                             */ shader_glsl_bitwise_op,
     /* WINED3DSIH_UDIV                             */ shader_glsl_udiv,
     /* WINED3DSIH_UGE                              */ shader_glsl_relop,
     /* WINED3DSIH_ULT                              */ shader_glsl_relop,




More information about the wine-cvs mailing list