[PATCH 4/4] wined3d: Just handle all instructions in the shader backend.

Henri Verbeet hverbeet at codeweavers.com
Fri Sep 14 06:11:34 CDT 2012


---
 dlls/wined3d/arb_program_shader.c |   16 ++++++----------
 dlls/wined3d/glsl_shader.c        |   14 ++++++++------
 dlls/wined3d/shader.c             |    9 ---------
 3 files changed, 14 insertions(+), 25 deletions(-)

diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index c4064b9..cb94d6e 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -1786,11 +1786,7 @@ static void shader_hw_map2gl(const struct wined3d_shader_instruction *ins)
     shader_addline(buffer, "%s%s %s%s;\n", instruction, shader_arb_get_modifier(ins), dst_str, arguments);
 }
 
-static void shader_hw_nop(const struct wined3d_shader_instruction *ins)
-{
-    struct wined3d_shader_buffer *buffer = ins->ctx->buffer;
-    shader_addline(buffer, "NOP;\n");
-}
+static void shader_hw_nop(const struct wined3d_shader_instruction *ins) {}
 
 static void shader_hw_mov(const struct wined3d_shader_instruction *ins)
 {
@@ -5102,10 +5098,10 @@ static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABL
     /* WINED3DSIH_CND           */ pshader_hw_cnd,
     /* WINED3DSIH_CRS           */ shader_hw_map2gl,
     /* WINED3DSIH_CUT           */ NULL,
-    /* WINED3DSIH_DCL           */ NULL,
-    /* WINED3DSIH_DEF           */ NULL,
-    /* WINED3DSIH_DEFB          */ NULL,
-    /* WINED3DSIH_DEFI          */ NULL,
+    /* WINED3DSIH_DCL           */ shader_hw_nop,
+    /* WINED3DSIH_DEF           */ shader_hw_nop,
+    /* WINED3DSIH_DEFB          */ shader_hw_nop,
+    /* WINED3DSIH_DEFI          */ shader_hw_nop,
     /* WINED3DSIH_DIV           */ NULL,
     /* WINED3DSIH_DP2ADD        */ pshader_hw_dp2add,
     /* WINED3DSIH_DP3           */ shader_hw_map2gl,
@@ -5153,7 +5149,7 @@ static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABL
     /* WINED3DSIH_MUL           */ shader_hw_map2gl,
     /* WINED3DSIH_NOP           */ shader_hw_nop,
     /* WINED3DSIH_NRM           */ shader_hw_nrm,
-    /* WINED3DSIH_PHASE         */ NULL,
+    /* WINED3DSIH_PHASE         */ shader_hw_nop,
     /* WINED3DSIH_POW           */ shader_hw_pow,
     /* WINED3DSIH_RCP           */ shader_hw_rcp,
     /* WINED3DSIH_REP           */ shader_hw_rep,
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 66c30f8..fe961b9 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -2301,6 +2301,8 @@ static void shader_glsl_map2gl(const struct wined3d_shader_instruction *ins)
     shader_addline(buffer, "));\n");
 }
 
+static void shader_glsl_nop(const struct wined3d_shader_instruction *ins) {}
+
 static void shader_glsl_nrm(const struct wined3d_shader_instruction *ins)
 {
     struct wined3d_shader_buffer *buffer = ins->ctx->buffer;
@@ -5028,10 +5030,10 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB
     /* WINED3DSIH_CND           */ shader_glsl_cnd,
     /* WINED3DSIH_CRS           */ shader_glsl_cross,
     /* WINED3DSIH_CUT           */ NULL,
-    /* WINED3DSIH_DCL           */ NULL,
-    /* WINED3DSIH_DEF           */ NULL,
-    /* WINED3DSIH_DEFB          */ NULL,
-    /* WINED3DSIH_DEFI          */ NULL,
+    /* WINED3DSIH_DCL           */ shader_glsl_nop,
+    /* WINED3DSIH_DEF           */ shader_glsl_nop,
+    /* WINED3DSIH_DEFB          */ shader_glsl_nop,
+    /* WINED3DSIH_DEFI          */ shader_glsl_nop,
     /* WINED3DSIH_DIV           */ NULL,
     /* WINED3DSIH_DP2ADD        */ shader_glsl_dp2add,
     /* WINED3DSIH_DP3           */ shader_glsl_dot,
@@ -5077,9 +5079,9 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB
     /* WINED3DSIH_MOVA          */ shader_glsl_mov,
     /* WINED3DSIH_MOVC          */ NULL,
     /* WINED3DSIH_MUL           */ shader_glsl_arith,
-    /* WINED3DSIH_NOP           */ NULL,
+    /* WINED3DSIH_NOP           */ shader_glsl_nop,
     /* WINED3DSIH_NRM           */ shader_glsl_nrm,
-    /* WINED3DSIH_PHASE         */ NULL,
+    /* WINED3DSIH_PHASE         */ shader_glsl_nop,
     /* WINED3DSIH_POW           */ shader_glsl_pow,
     /* WINED3DSIH_RCP           */ shader_glsl_rcp,
     /* WINED3DSIH_REP           */ shader_glsl_rep,
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 7e282aa..6bb3b5b 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -1206,15 +1206,6 @@ void shader_generate_main(const struct wined3d_shader *shader, struct wined3d_sh
             continue;
         }
 
-        /* Nothing to do. */
-        if (ins.handler_idx == WINED3DSIH_DCL
-                || ins.handler_idx == WINED3DSIH_NOP
-                || ins.handler_idx == WINED3DSIH_DEF
-                || ins.handler_idx == WINED3DSIH_DEFI
-                || ins.handler_idx == WINED3DSIH_DEFB
-                || ins.handler_idx == WINED3DSIH_PHASE)
-            continue;
-
         if (ins.predicate)
             FIXME("Predicates not implemented.\n");
 
-- 
1.7.8.6




More information about the wine-patches mailing list