[PATCH 3/5] wined3d: Recognize SM4 dcl_immediateConstantBuffer.

Józef Kucia jkucia at codeweavers.com
Fri Jan 29 02:44:43 CST 2016


Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
It seems that this opcode was introduced for data that
can be larger than the maximum value of the instruction length
field. It can carry data for immediate constant buffers and shader
messages (the printf function in HLSL).
---
 dlls/wined3d/arb_program_shader.c | 261 +++++++++++++++++-----------------
 dlls/wined3d/glsl_shader.c        | 261 +++++++++++++++++-----------------
 dlls/wined3d/shader.c             | 291 +++++++++++++++++++++-----------------
 dlls/wined3d/shader_sm4.c         | 190 +++++++++++++++----------
 dlls/wined3d/wined3d_private.h    |  12 ++
 5 files changed, 551 insertions(+), 464 deletions(-)

diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index ea542b9..58c4c12 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -5212,136 +5212,137 @@ static void shader_arb_add_instruction_modifiers(const struct wined3d_shader_ins
 
 static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABLE_SIZE] =
 {
-    /* WINED3DSIH_ABS                   */ shader_hw_map2gl,
-    /* WINED3DSIH_ADD                   */ shader_hw_map2gl,
-    /* WINED3DSIH_AND                   */ NULL,
-    /* WINED3DSIH_BEM                   */ pshader_hw_bem,
-    /* WINED3DSIH_BREAK                 */ shader_hw_break,
-    /* WINED3DSIH_BREAKC                */ shader_hw_breakc,
-    /* WINED3DSIH_BREAKP                */ NULL,
-    /* WINED3DSIH_CALL                  */ shader_hw_call,
-    /* WINED3DSIH_CALLNZ                */ NULL,
-    /* WINED3DSIH_CMP                   */ pshader_hw_cmp,
-    /* WINED3DSIH_CND                   */ pshader_hw_cnd,
-    /* WINED3DSIH_CRS                   */ shader_hw_map2gl,
-    /* WINED3DSIH_CUT                   */ NULL,
-    /* WINED3DSIH_DCL                   */ shader_hw_nop,
-    /* WINED3DSIH_DCL_CONSTANT_BUFFER   */ shader_hw_nop,
-    /* WINED3DSIH_DCL_INPUT_PRIMITIVE   */ shader_hw_nop,
-    /* WINED3DSIH_DCL_OUTPUT_TOPOLOGY   */ shader_hw_nop,
-    /* WINED3DSIH_DCL_TEMPS             */ NULL,
-    /* WINED3DSIH_DCL_VERTICES_OUT      */ shader_hw_nop,
-    /* WINED3DSIH_DEF                   */ shader_hw_nop,
-    /* WINED3DSIH_DEFB                  */ shader_hw_nop,
-    /* WINED3DSIH_DEFI                  */ shader_hw_nop,
-    /* WINED3DSIH_DIV                   */ NULL,
-    /* WINED3DSIH_DP2                   */ NULL,
-    /* WINED3DSIH_DP2ADD                */ pshader_hw_dp2add,
-    /* WINED3DSIH_DP3                   */ shader_hw_map2gl,
-    /* WINED3DSIH_DP4                   */ shader_hw_map2gl,
-    /* WINED3DSIH_DST                   */ shader_hw_map2gl,
-    /* WINED3DSIH_DSX                   */ shader_hw_map2gl,
-    /* WINED3DSIH_DSY                   */ shader_hw_dsy,
-    /* WINED3DSIH_ELSE                  */ shader_hw_else,
-    /* WINED3DSIH_EMIT                  */ NULL,
-    /* WINED3DSIH_ENDIF                 */ shader_hw_endif,
-    /* WINED3DSIH_ENDLOOP               */ shader_hw_endloop,
-    /* WINED3DSIH_ENDREP                */ shader_hw_endrep,
-    /* WINED3DSIH_EQ                    */ NULL,
-    /* WINED3DSIH_EXP                   */ shader_hw_scalar_op,
-    /* WINED3DSIH_EXPP                  */ shader_hw_scalar_op,
-    /* WINED3DSIH_FRC                   */ shader_hw_map2gl,
-    /* WINED3DSIH_FTOI                  */ NULL,
-    /* WINED3DSIH_FTOU                  */ NULL,
-    /* WINED3DSIH_GE                    */ NULL,
-    /* WINED3DSIH_IADD                  */ NULL,
-    /* WINED3DSIH_IEQ                   */ NULL,
-    /* WINED3DSIH_IF                    */ NULL /* Hardcoded into the shader */,
-    /* WINED3DSIH_IFC                   */ shader_hw_ifc,
-    /* WINED3DSIH_IGE                   */ NULL,
-    /* WINED3DSIH_ILT                   */ NULL,
-    /* WINED3DSIH_IMAD                  */ NULL,
-    /* WINED3DSIH_IMAX                  */ NULL,
-    /* WINED3DSIH_IMIN                  */ NULL,
-    /* WINED3DSIH_IMUL                  */ NULL,
-    /* WINED3DSIH_INE                   */ NULL,
-    /* WINED3DSIH_INEG                  */ NULL,
-    /* WINED3DSIH_ISHL                  */ NULL,
-    /* WINED3DSIH_ITOF                  */ NULL,
-    /* WINED3DSIH_LABEL                 */ shader_hw_label,
-    /* WINED3DSIH_LD                    */ NULL,
-    /* WINED3DSIH_LIT                   */ shader_hw_map2gl,
-    /* WINED3DSIH_LOG                   */ shader_hw_scalar_op,
-    /* WINED3DSIH_LOGP                  */ shader_hw_scalar_op,
-    /* WINED3DSIH_LOOP                  */ shader_hw_loop,
-    /* WINED3DSIH_LRP                   */ shader_hw_lrp,
-    /* WINED3DSIH_LT                    */ NULL,
-    /* WINED3DSIH_M3x2                  */ shader_hw_mnxn,
-    /* WINED3DSIH_M3x3                  */ shader_hw_mnxn,
-    /* WINED3DSIH_M3x4                  */ shader_hw_mnxn,
-    /* WINED3DSIH_M4x3                  */ shader_hw_mnxn,
-    /* WINED3DSIH_M4x4                  */ shader_hw_mnxn,
-    /* WINED3DSIH_MAD                   */ shader_hw_map2gl,
-    /* WINED3DSIH_MAX                   */ shader_hw_map2gl,
-    /* WINED3DSIH_MIN                   */ shader_hw_map2gl,
-    /* WINED3DSIH_MOV                   */ shader_hw_mov,
-    /* WINED3DSIH_MOVA                  */ shader_hw_mov,
-    /* WINED3DSIH_MOVC                  */ NULL,
-    /* WINED3DSIH_MUL                   */ shader_hw_map2gl,
-    /* WINED3DSIH_NE                    */ NULL,
-    /* WINED3DSIH_NOP                   */ shader_hw_nop,
-    /* WINED3DSIH_NOT                   */ NULL,
-    /* WINED3DSIH_NRM                   */ shader_hw_nrm,
-    /* WINED3DSIH_OR                    */ NULL,
-    /* WINED3DSIH_PHASE                 */ shader_hw_nop,
-    /* 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_ROUND_PI              */ NULL,
-    /* WINED3DSIH_ROUND_Z               */ NULL,
-    /* WINED3DSIH_RSQ                   */ shader_hw_scalar_op,
-    /* WINED3DSIH_SAMPLE                */ NULL,
-    /* WINED3DSIH_SAMPLE_B              */ NULL,
-    /* WINED3DSIH_SAMPLE_C_LZ           */ NULL,
-    /* WINED3DSIH_SAMPLE_GRAD           */ NULL,
-    /* WINED3DSIH_SAMPLE_LOD            */ NULL,
-    /* WINED3DSIH_SETP                  */ NULL,
-    /* WINED3DSIH_SGE                   */ shader_hw_map2gl,
-    /* WINED3DSIH_SGN                   */ shader_hw_sgn,
-    /* WINED3DSIH_SINCOS                */ shader_hw_sincos,
-    /* WINED3DSIH_SLT                   */ shader_hw_map2gl,
-    /* WINED3DSIH_SQRT                  */ NULL,
-    /* WINED3DSIH_SUB                   */ shader_hw_map2gl,
-    /* WINED3DSIH_TEX                   */ pshader_hw_tex,
-    /* WINED3DSIH_TEXBEM                */ pshader_hw_texbem,
-    /* WINED3DSIH_TEXBEML               */ pshader_hw_texbem,
-    /* WINED3DSIH_TEXCOORD              */ pshader_hw_texcoord,
-    /* WINED3DSIH_TEXDEPTH              */ pshader_hw_texdepth,
-    /* WINED3DSIH_TEXDP3                */ pshader_hw_texdp3,
-    /* WINED3DSIH_TEXDP3TEX             */ pshader_hw_texdp3tex,
-    /* WINED3DSIH_TEXKILL               */ pshader_hw_texkill,
-    /* WINED3DSIH_TEXLDD                */ shader_hw_texldd,
-    /* WINED3DSIH_TEXLDL                */ shader_hw_texldl,
-    /* WINED3DSIH_TEXM3x2DEPTH          */ pshader_hw_texm3x2depth,
-    /* WINED3DSIH_TEXM3x2PAD            */ pshader_hw_texm3x2pad,
-    /* WINED3DSIH_TEXM3x2TEX            */ pshader_hw_texm3x2tex,
-    /* WINED3DSIH_TEXM3x3               */ pshader_hw_texm3x3,
-    /* WINED3DSIH_TEXM3x3DIFF           */ NULL,
-    /* WINED3DSIH_TEXM3x3PAD            */ pshader_hw_texm3x3pad,
-    /* WINED3DSIH_TEXM3x3SPEC           */ pshader_hw_texm3x3spec,
-    /* WINED3DSIH_TEXM3x3TEX            */ pshader_hw_texm3x3tex,
-    /* WINED3DSIH_TEXM3x3VSPEC          */ pshader_hw_texm3x3vspec,
-    /* WINED3DSIH_TEXREG2AR             */ pshader_hw_texreg2ar,
-    /* WINED3DSIH_TEXREG2GB             */ pshader_hw_texreg2gb,
-    /* WINED3DSIH_TEXREG2RGB            */ pshader_hw_texreg2rgb,
-    /* WINED3DSIH_UDIV                  */ NULL,
-    /* WINED3DSIH_UGE                   */ NULL,
-    /* WINED3DSIH_USHR                  */ NULL,
-    /* WINED3DSIH_UTOF                  */ NULL,
-    /* WINED3DSIH_XOR                   */ NULL,
+    /* WINED3DSIH_ABS                           */ shader_hw_map2gl,
+    /* WINED3DSIH_ADD                           */ shader_hw_map2gl,
+    /* WINED3DSIH_AND                           */ NULL,
+    /* WINED3DSIH_BEM                           */ pshader_hw_bem,
+    /* WINED3DSIH_BREAK                         */ shader_hw_break,
+    /* WINED3DSIH_BREAKC                        */ shader_hw_breakc,
+    /* WINED3DSIH_BREAKP                        */ NULL,
+    /* WINED3DSIH_CALL                          */ shader_hw_call,
+    /* WINED3DSIH_CALLNZ                        */ NULL,
+    /* WINED3DSIH_CMP                           */ pshader_hw_cmp,
+    /* WINED3DSIH_CND                           */ pshader_hw_cnd,
+    /* WINED3DSIH_CRS                           */ shader_hw_map2gl,
+    /* WINED3DSIH_CUT                           */ NULL,
+    /* WINED3DSIH_DCL                           */ shader_hw_nop,
+    /* WINED3DSIH_DCL_CONSTANT_BUFFER           */ shader_hw_nop,
+    /* WINED3DSIH_DCL_IMMEDIATE_CONSTANT_BUFFER */ NULL,
+    /* WINED3DSIH_DCL_INPUT_PRIMITIVE           */ shader_hw_nop,
+    /* WINED3DSIH_DCL_OUTPUT_TOPOLOGY           */ shader_hw_nop,
+    /* WINED3DSIH_DCL_TEMPS                     */ NULL,
+    /* WINED3DSIH_DCL_VERTICES_OUT              */ shader_hw_nop,
+    /* WINED3DSIH_DEF                           */ shader_hw_nop,
+    /* WINED3DSIH_DEFB                          */ shader_hw_nop,
+    /* WINED3DSIH_DEFI                          */ shader_hw_nop,
+    /* WINED3DSIH_DIV                           */ NULL,
+    /* WINED3DSIH_DP2                           */ NULL,
+    /* WINED3DSIH_DP2ADD                        */ pshader_hw_dp2add,
+    /* WINED3DSIH_DP3                           */ shader_hw_map2gl,
+    /* WINED3DSIH_DP4                           */ shader_hw_map2gl,
+    /* WINED3DSIH_DST                           */ shader_hw_map2gl,
+    /* WINED3DSIH_DSX                           */ shader_hw_map2gl,
+    /* WINED3DSIH_DSY                           */ shader_hw_dsy,
+    /* WINED3DSIH_ELSE                          */ shader_hw_else,
+    /* WINED3DSIH_EMIT                          */ NULL,
+    /* WINED3DSIH_ENDIF                         */ shader_hw_endif,
+    /* WINED3DSIH_ENDLOOP                       */ shader_hw_endloop,
+    /* WINED3DSIH_ENDREP                        */ shader_hw_endrep,
+    /* WINED3DSIH_EQ                            */ NULL,
+    /* WINED3DSIH_EXP                           */ shader_hw_scalar_op,
+    /* WINED3DSIH_EXPP                          */ shader_hw_scalar_op,
+    /* WINED3DSIH_FRC                           */ shader_hw_map2gl,
+    /* WINED3DSIH_FTOI                          */ NULL,
+    /* WINED3DSIH_FTOU                          */ NULL,
+    /* WINED3DSIH_GE                            */ NULL,
+    /* WINED3DSIH_IADD                          */ NULL,
+    /* WINED3DSIH_IEQ                           */ NULL,
+    /* WINED3DSIH_IF                            */ NULL /* Hardcoded into the shader */,
+    /* WINED3DSIH_IFC                           */ shader_hw_ifc,
+    /* WINED3DSIH_IGE                           */ NULL,
+    /* WINED3DSIH_ILT                           */ NULL,
+    /* WINED3DSIH_IMAD                          */ NULL,
+    /* WINED3DSIH_IMAX                          */ NULL,
+    /* WINED3DSIH_IMIN                          */ NULL,
+    /* WINED3DSIH_IMUL                          */ NULL,
+    /* WINED3DSIH_INE                           */ NULL,
+    /* WINED3DSIH_INEG                          */ NULL,
+    /* WINED3DSIH_ISHL                          */ NULL,
+    /* WINED3DSIH_ITOF                          */ NULL,
+    /* WINED3DSIH_LABEL                         */ shader_hw_label,
+    /* WINED3DSIH_LD                            */ NULL,
+    /* WINED3DSIH_LIT                           */ shader_hw_map2gl,
+    /* WINED3DSIH_LOG                           */ shader_hw_scalar_op,
+    /* WINED3DSIH_LOGP                          */ shader_hw_scalar_op,
+    /* WINED3DSIH_LOOP                          */ shader_hw_loop,
+    /* WINED3DSIH_LRP                           */ shader_hw_lrp,
+    /* WINED3DSIH_LT                            */ NULL,
+    /* WINED3DSIH_M3x2                          */ shader_hw_mnxn,
+    /* WINED3DSIH_M3x3                          */ shader_hw_mnxn,
+    /* WINED3DSIH_M3x4                          */ shader_hw_mnxn,
+    /* WINED3DSIH_M4x3                          */ shader_hw_mnxn,
+    /* WINED3DSIH_M4x4                          */ shader_hw_mnxn,
+    /* WINED3DSIH_MAD                           */ shader_hw_map2gl,
+    /* WINED3DSIH_MAX                           */ shader_hw_map2gl,
+    /* WINED3DSIH_MIN                           */ shader_hw_map2gl,
+    /* WINED3DSIH_MOV                           */ shader_hw_mov,
+    /* WINED3DSIH_MOVA                          */ shader_hw_mov,
+    /* WINED3DSIH_MOVC                          */ NULL,
+    /* WINED3DSIH_MUL                           */ shader_hw_map2gl,
+    /* WINED3DSIH_NE                            */ NULL,
+    /* WINED3DSIH_NOP                           */ shader_hw_nop,
+    /* WINED3DSIH_NOT                           */ NULL,
+    /* WINED3DSIH_NRM                           */ shader_hw_nrm,
+    /* WINED3DSIH_OR                            */ NULL,
+    /* WINED3DSIH_PHASE                         */ shader_hw_nop,
+    /* 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_ROUND_PI                      */ NULL,
+    /* WINED3DSIH_ROUND_Z                       */ NULL,
+    /* WINED3DSIH_RSQ                           */ shader_hw_scalar_op,
+    /* WINED3DSIH_SAMPLE                        */ NULL,
+    /* WINED3DSIH_SAMPLE_B                      */ NULL,
+    /* WINED3DSIH_SAMPLE_C_LZ                   */ NULL,
+    /* WINED3DSIH_SAMPLE_GRAD                   */ NULL,
+    /* WINED3DSIH_SAMPLE_LOD                    */ NULL,
+    /* WINED3DSIH_SETP                          */ NULL,
+    /* WINED3DSIH_SGE                           */ shader_hw_map2gl,
+    /* WINED3DSIH_SGN                           */ shader_hw_sgn,
+    /* WINED3DSIH_SINCOS                        */ shader_hw_sincos,
+    /* WINED3DSIH_SLT                           */ shader_hw_map2gl,
+    /* WINED3DSIH_SQRT                          */ NULL,
+    /* WINED3DSIH_SUB                           */ shader_hw_map2gl,
+    /* WINED3DSIH_TEX                           */ pshader_hw_tex,
+    /* WINED3DSIH_TEXBEM                        */ pshader_hw_texbem,
+    /* WINED3DSIH_TEXBEML                       */ pshader_hw_texbem,
+    /* WINED3DSIH_TEXCOORD                      */ pshader_hw_texcoord,
+    /* WINED3DSIH_TEXDEPTH                      */ pshader_hw_texdepth,
+    /* WINED3DSIH_TEXDP3                        */ pshader_hw_texdp3,
+    /* WINED3DSIH_TEXDP3TEX                     */ pshader_hw_texdp3tex,
+    /* WINED3DSIH_TEXKILL                       */ pshader_hw_texkill,
+    /* WINED3DSIH_TEXLDD                        */ shader_hw_texldd,
+    /* WINED3DSIH_TEXLDL                        */ shader_hw_texldl,
+    /* WINED3DSIH_TEXM3x2DEPTH                  */ pshader_hw_texm3x2depth,
+    /* WINED3DSIH_TEXM3x2PAD                    */ pshader_hw_texm3x2pad,
+    /* WINED3DSIH_TEXM3x2TEX                    */ pshader_hw_texm3x2tex,
+    /* WINED3DSIH_TEXM3x3                       */ pshader_hw_texm3x3,
+    /* WINED3DSIH_TEXM3x3DIFF                   */ NULL,
+    /* WINED3DSIH_TEXM3x3PAD                    */ pshader_hw_texm3x3pad,
+    /* WINED3DSIH_TEXM3x3SPEC                   */ pshader_hw_texm3x3spec,
+    /* WINED3DSIH_TEXM3x3TEX                    */ pshader_hw_texm3x3tex,
+    /* WINED3DSIH_TEXM3x3VSPEC                  */ pshader_hw_texm3x3vspec,
+    /* WINED3DSIH_TEXREG2AR                     */ pshader_hw_texreg2ar,
+    /* WINED3DSIH_TEXREG2GB                     */ pshader_hw_texreg2gb,
+    /* WINED3DSIH_TEXREG2RGB                    */ pshader_hw_texreg2rgb,
+    /* WINED3DSIH_UDIV                          */ NULL,
+    /* WINED3DSIH_UGE                           */ NULL,
+    /* WINED3DSIH_USHR                          */ NULL,
+    /* WINED3DSIH_UTOF                          */ NULL,
+    /* WINED3DSIH_XOR                           */ NULL,
 };
 
 static BOOL get_bool_const(const struct wined3d_shader_instruction *ins,
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 5e983f9..62476fe 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -7988,136 +7988,137 @@ static BOOL shader_glsl_color_fixup_supported(struct color_fixup_desc fixup)
 
 static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TABLE_SIZE] =
 {
-    /* WINED3DSIH_ABS                   */ shader_glsl_map2gl,
-    /* WINED3DSIH_ADD                   */ shader_glsl_binop,
-    /* WINED3DSIH_AND                   */ shader_glsl_binop,
-    /* WINED3DSIH_BEM                   */ shader_glsl_bem,
-    /* WINED3DSIH_BREAK                 */ shader_glsl_break,
-    /* WINED3DSIH_BREAKC                */ shader_glsl_breakc,
-    /* WINED3DSIH_BREAKP                */ shader_glsl_breakp,
-    /* WINED3DSIH_CALL                  */ shader_glsl_call,
-    /* WINED3DSIH_CALLNZ                */ shader_glsl_callnz,
-    /* WINED3DSIH_CMP                   */ shader_glsl_conditional_move,
-    /* WINED3DSIH_CND                   */ shader_glsl_cnd,
-    /* WINED3DSIH_CRS                   */ shader_glsl_cross,
-    /* WINED3DSIH_CUT                   */ shader_glsl_cut,
-    /* WINED3DSIH_DCL                   */ shader_glsl_nop,
-    /* WINED3DSIH_DCL_CONSTANT_BUFFER   */ shader_glsl_nop,
-    /* WINED3DSIH_DCL_INPUT_PRIMITIVE   */ shader_glsl_nop,
-    /* WINED3DSIH_DCL_OUTPUT_TOPOLOGY   */ shader_glsl_nop,
-    /* WINED3DSIH_DCL_TEMPS             */ shader_glsl_nop,
-    /* WINED3DSIH_DCL_VERTICES_OUT      */ shader_glsl_nop,
-    /* WINED3DSIH_DEF                   */ shader_glsl_nop,
-    /* WINED3DSIH_DEFB                  */ shader_glsl_nop,
-    /* WINED3DSIH_DEFI                  */ shader_glsl_nop,
-    /* WINED3DSIH_DIV                   */ shader_glsl_binop,
-    /* WINED3DSIH_DP2                   */ shader_glsl_dot,
-    /* WINED3DSIH_DP2ADD                */ shader_glsl_dp2add,
-    /* WINED3DSIH_DP3                   */ shader_glsl_dot,
-    /* WINED3DSIH_DP4                   */ shader_glsl_dot,
-    /* WINED3DSIH_DST                   */ shader_glsl_dst,
-    /* WINED3DSIH_DSX                   */ shader_glsl_map2gl,
-    /* WINED3DSIH_DSY                   */ shader_glsl_map2gl,
-    /* WINED3DSIH_ELSE                  */ shader_glsl_else,
-    /* WINED3DSIH_EMIT                  */ shader_glsl_emit,
-    /* WINED3DSIH_ENDIF                 */ shader_glsl_end,
-    /* WINED3DSIH_ENDLOOP               */ shader_glsl_end,
-    /* WINED3DSIH_ENDREP                */ shader_glsl_end,
-    /* WINED3DSIH_EQ                    */ shader_glsl_relop,
-    /* WINED3DSIH_EXP                   */ shader_glsl_scalar_op,
-    /* WINED3DSIH_EXPP                  */ shader_glsl_expp,
-    /* WINED3DSIH_FRC                   */ shader_glsl_map2gl,
-    /* WINED3DSIH_FTOI                  */ shader_glsl_to_int,
-    /* WINED3DSIH_FTOU                  */ shader_glsl_to_uint,
-    /* WINED3DSIH_GE                    */ shader_glsl_relop,
-    /* WINED3DSIH_IADD                  */ shader_glsl_binop,
-    /* WINED3DSIH_IEQ                   */ shader_glsl_relop,
-    /* WINED3DSIH_IF                    */ shader_glsl_if,
-    /* WINED3DSIH_IFC                   */ shader_glsl_ifc,
-    /* WINED3DSIH_IGE                   */ shader_glsl_relop,
-    /* WINED3DSIH_ILT                   */ shader_glsl_relop,
-    /* WINED3DSIH_IMAD                  */ shader_glsl_mad,
-    /* WINED3DSIH_IMAX                  */ shader_glsl_map2gl,
-    /* WINED3DSIH_IMIN                  */ shader_glsl_map2gl,
-    /* WINED3DSIH_IMUL                  */ shader_glsl_imul,
-    /* WINED3DSIH_INE                   */ shader_glsl_relop,
-    /* WINED3DSIH_INEG                  */ shader_glsl_unary_op,
-    /* WINED3DSIH_ISHL                  */ shader_glsl_binop,
-    /* WINED3DSIH_ITOF                  */ shader_glsl_to_float,
-    /* WINED3DSIH_LABEL                 */ shader_glsl_label,
-    /* WINED3DSIH_LD                    */ shader_glsl_ld,
-    /* WINED3DSIH_LIT                   */ shader_glsl_lit,
-    /* WINED3DSIH_LOG                   */ shader_glsl_scalar_op,
-    /* WINED3DSIH_LOGP                  */ shader_glsl_scalar_op,
-    /* WINED3DSIH_LOOP                  */ shader_glsl_loop,
-    /* WINED3DSIH_LRP                   */ shader_glsl_lrp,
-    /* WINED3DSIH_LT                    */ shader_glsl_relop,
-    /* WINED3DSIH_M3x2                  */ shader_glsl_mnxn,
-    /* WINED3DSIH_M3x3                  */ shader_glsl_mnxn,
-    /* WINED3DSIH_M3x4                  */ shader_glsl_mnxn,
-    /* WINED3DSIH_M4x3                  */ shader_glsl_mnxn,
-    /* WINED3DSIH_M4x4                  */ shader_glsl_mnxn,
-    /* WINED3DSIH_MAD                   */ shader_glsl_mad,
-    /* WINED3DSIH_MAX                   */ shader_glsl_map2gl,
-    /* WINED3DSIH_MIN                   */ shader_glsl_map2gl,
-    /* WINED3DSIH_MOV                   */ shader_glsl_mov,
-    /* WINED3DSIH_MOVA                  */ shader_glsl_mov,
-    /* WINED3DSIH_MOVC                  */ shader_glsl_conditional_move,
-    /* WINED3DSIH_MUL                   */ shader_glsl_binop,
-    /* WINED3DSIH_NE                    */ shader_glsl_relop,
-    /* WINED3DSIH_NOP                   */ shader_glsl_nop,
-    /* WINED3DSIH_NOT                   */ shader_glsl_unary_op,
-    /* WINED3DSIH_NRM                   */ shader_glsl_nrm,
-    /* WINED3DSIH_OR                    */ shader_glsl_binop,
-    /* WINED3DSIH_PHASE                 */ shader_glsl_nop,
-    /* WINED3DSIH_POW                   */ shader_glsl_pow,
-    /* WINED3DSIH_RCP                   */ shader_glsl_scalar_op,
-    /* WINED3DSIH_REP                   */ shader_glsl_rep,
-    /* WINED3DSIH_RESINFO               */ shader_glsl_resinfo,
-    /* WINED3DSIH_RET                   */ shader_glsl_ret,
-    /* WINED3DSIH_ROUND_NI              */ shader_glsl_map2gl,
-    /* WINED3DSIH_ROUND_PI              */ shader_glsl_map2gl,
-    /* WINED3DSIH_ROUND_Z               */ shader_glsl_map2gl,
-    /* WINED3DSIH_RSQ                   */ shader_glsl_scalar_op,
-    /* WINED3DSIH_SAMPLE                */ shader_glsl_sample,
-    /* WINED3DSIH_SAMPLE_B              */ NULL,
-    /* WINED3DSIH_SAMPLE_C_LZ           */ NULL,
-    /* WINED3DSIH_SAMPLE_GRAD           */ NULL,
-    /* WINED3DSIH_SAMPLE_LOD            */ shader_glsl_sample_lod,
-    /* WINED3DSIH_SETP                  */ NULL,
-    /* WINED3DSIH_SGE                   */ shader_glsl_compare,
-    /* WINED3DSIH_SGN                   */ shader_glsl_sgn,
-    /* WINED3DSIH_SINCOS                */ shader_glsl_sincos,
-    /* WINED3DSIH_SLT                   */ shader_glsl_compare,
-    /* WINED3DSIH_SQRT                  */ shader_glsl_map2gl,
-    /* WINED3DSIH_SUB                   */ shader_glsl_binop,
-    /* WINED3DSIH_TEX                   */ shader_glsl_tex,
-    /* WINED3DSIH_TEXBEM                */ shader_glsl_texbem,
-    /* WINED3DSIH_TEXBEML               */ shader_glsl_texbem,
-    /* WINED3DSIH_TEXCOORD              */ shader_glsl_texcoord,
-    /* WINED3DSIH_TEXDEPTH              */ shader_glsl_texdepth,
-    /* WINED3DSIH_TEXDP3                */ shader_glsl_texdp3,
-    /* WINED3DSIH_TEXDP3TEX             */ shader_glsl_texdp3tex,
-    /* WINED3DSIH_TEXKILL               */ shader_glsl_texkill,
-    /* WINED3DSIH_TEXLDD                */ shader_glsl_texldd,
-    /* WINED3DSIH_TEXLDL                */ shader_glsl_texldl,
-    /* WINED3DSIH_TEXM3x2DEPTH          */ shader_glsl_texm3x2depth,
-    /* WINED3DSIH_TEXM3x2PAD            */ shader_glsl_texm3x2pad,
-    /* WINED3DSIH_TEXM3x2TEX            */ shader_glsl_texm3x2tex,
-    /* WINED3DSIH_TEXM3x3               */ shader_glsl_texm3x3,
-    /* WINED3DSIH_TEXM3x3DIFF           */ NULL,
-    /* WINED3DSIH_TEXM3x3PAD            */ shader_glsl_texm3x3pad,
-    /* WINED3DSIH_TEXM3x3SPEC           */ shader_glsl_texm3x3spec,
-    /* WINED3DSIH_TEXM3x3TEX            */ shader_glsl_texm3x3tex,
-    /* WINED3DSIH_TEXM3x3VSPEC          */ shader_glsl_texm3x3vspec,
-    /* WINED3DSIH_TEXREG2AR             */ shader_glsl_texreg2ar,
-    /* WINED3DSIH_TEXREG2GB             */ shader_glsl_texreg2gb,
-    /* WINED3DSIH_TEXREG2RGB            */ shader_glsl_texreg2rgb,
-    /* WINED3DSIH_UDIV                  */ shader_glsl_udiv,
-    /* WINED3DSIH_UGE                   */ shader_glsl_relop,
-    /* WINED3DSIH_USHR                  */ shader_glsl_binop,
-    /* WINED3DSIH_UTOF                  */ shader_glsl_to_float,
-    /* WINED3DSIH_XOR                   */ shader_glsl_binop,
+    /* WINED3DSIH_ABS                           */ shader_glsl_map2gl,
+    /* WINED3DSIH_ADD                           */ shader_glsl_binop,
+    /* WINED3DSIH_AND                           */ shader_glsl_binop,
+    /* WINED3DSIH_BEM                           */ shader_glsl_bem,
+    /* WINED3DSIH_BREAK                         */ shader_glsl_break,
+    /* WINED3DSIH_BREAKC                        */ shader_glsl_breakc,
+    /* WINED3DSIH_BREAKP                        */ shader_glsl_breakp,
+    /* WINED3DSIH_CALL                          */ shader_glsl_call,
+    /* WINED3DSIH_CALLNZ                        */ shader_glsl_callnz,
+    /* WINED3DSIH_CMP                           */ shader_glsl_conditional_move,
+    /* WINED3DSIH_CND                           */ shader_glsl_cnd,
+    /* WINED3DSIH_CRS                           */ shader_glsl_cross,
+    /* WINED3DSIH_CUT                           */ shader_glsl_cut,
+    /* WINED3DSIH_DCL                           */ shader_glsl_nop,
+    /* WINED3DSIH_DCL_CONSTANT_BUFFER           */ shader_glsl_nop,
+    /* WINED3DSIH_DCL_IMMEDIATE_CONSTANT_BUFFER */ NULL,
+    /* WINED3DSIH_DCL_INPUT_PRIMITIVE           */ shader_glsl_nop,
+    /* WINED3DSIH_DCL_OUTPUT_TOPOLOGY           */ shader_glsl_nop,
+    /* WINED3DSIH_DCL_TEMPS                     */ shader_glsl_nop,
+    /* WINED3DSIH_DCL_VERTICES_OUT              */ shader_glsl_nop,
+    /* WINED3DSIH_DEF                           */ shader_glsl_nop,
+    /* WINED3DSIH_DEFB                          */ shader_glsl_nop,
+    /* WINED3DSIH_DEFI                          */ shader_glsl_nop,
+    /* WINED3DSIH_DIV                           */ shader_glsl_binop,
+    /* WINED3DSIH_DP2                           */ shader_glsl_dot,
+    /* WINED3DSIH_DP2ADD                        */ shader_glsl_dp2add,
+    /* WINED3DSIH_DP3                           */ shader_glsl_dot,
+    /* WINED3DSIH_DP4                           */ shader_glsl_dot,
+    /* WINED3DSIH_DST                           */ shader_glsl_dst,
+    /* WINED3DSIH_DSX                           */ shader_glsl_map2gl,
+    /* WINED3DSIH_DSY                           */ shader_glsl_map2gl,
+    /* WINED3DSIH_ELSE                          */ shader_glsl_else,
+    /* WINED3DSIH_EMIT                          */ shader_glsl_emit,
+    /* WINED3DSIH_ENDIF                         */ shader_glsl_end,
+    /* WINED3DSIH_ENDLOOP                       */ shader_glsl_end,
+    /* WINED3DSIH_ENDREP                        */ shader_glsl_end,
+    /* WINED3DSIH_EQ                            */ shader_glsl_relop,
+    /* WINED3DSIH_EXP                           */ shader_glsl_scalar_op,
+    /* WINED3DSIH_EXPP                          */ shader_glsl_expp,
+    /* WINED3DSIH_FRC                           */ shader_glsl_map2gl,
+    /* WINED3DSIH_FTOI                          */ shader_glsl_to_int,
+    /* WINED3DSIH_FTOU                          */ shader_glsl_to_uint,
+    /* WINED3DSIH_GE                            */ shader_glsl_relop,
+    /* WINED3DSIH_IADD                          */ shader_glsl_binop,
+    /* WINED3DSIH_IEQ                           */ shader_glsl_relop,
+    /* WINED3DSIH_IF                            */ shader_glsl_if,
+    /* WINED3DSIH_IFC                           */ shader_glsl_ifc,
+    /* WINED3DSIH_IGE                           */ shader_glsl_relop,
+    /* WINED3DSIH_ILT                           */ shader_glsl_relop,
+    /* WINED3DSIH_IMAD                          */ shader_glsl_mad,
+    /* WINED3DSIH_IMAX                          */ shader_glsl_map2gl,
+    /* WINED3DSIH_IMIN                          */ shader_glsl_map2gl,
+    /* WINED3DSIH_IMUL                          */ shader_glsl_imul,
+    /* WINED3DSIH_INE                           */ shader_glsl_relop,
+    /* WINED3DSIH_INEG                          */ shader_glsl_unary_op,
+    /* WINED3DSIH_ISHL                          */ shader_glsl_binop,
+    /* WINED3DSIH_ITOF                          */ shader_glsl_to_float,
+    /* WINED3DSIH_LABEL                         */ shader_glsl_label,
+    /* WINED3DSIH_LD                            */ shader_glsl_ld,
+    /* WINED3DSIH_LIT                           */ shader_glsl_lit,
+    /* WINED3DSIH_LOG                           */ shader_glsl_scalar_op,
+    /* WINED3DSIH_LOGP                          */ shader_glsl_scalar_op,
+    /* WINED3DSIH_LOOP                          */ shader_glsl_loop,
+    /* WINED3DSIH_LRP                           */ shader_glsl_lrp,
+    /* WINED3DSIH_LT                            */ shader_glsl_relop,
+    /* WINED3DSIH_M3x2                          */ shader_glsl_mnxn,
+    /* WINED3DSIH_M3x3                          */ shader_glsl_mnxn,
+    /* WINED3DSIH_M3x4                          */ shader_glsl_mnxn,
+    /* WINED3DSIH_M4x3                          */ shader_glsl_mnxn,
+    /* WINED3DSIH_M4x4                          */ shader_glsl_mnxn,
+    /* WINED3DSIH_MAD                           */ shader_glsl_mad,
+    /* WINED3DSIH_MAX                           */ shader_glsl_map2gl,
+    /* WINED3DSIH_MIN                           */ shader_glsl_map2gl,
+    /* WINED3DSIH_MOV                           */ shader_glsl_mov,
+    /* WINED3DSIH_MOVA                          */ shader_glsl_mov,
+    /* WINED3DSIH_MOVC                          */ shader_glsl_conditional_move,
+    /* WINED3DSIH_MUL                           */ shader_glsl_binop,
+    /* WINED3DSIH_NE                            */ shader_glsl_relop,
+    /* WINED3DSIH_NOP                           */ shader_glsl_nop,
+    /* WINED3DSIH_NOT                           */ shader_glsl_unary_op,
+    /* WINED3DSIH_NRM                           */ shader_glsl_nrm,
+    /* WINED3DSIH_OR                            */ shader_glsl_binop,
+    /* WINED3DSIH_PHASE                         */ shader_glsl_nop,
+    /* WINED3DSIH_POW                           */ shader_glsl_pow,
+    /* WINED3DSIH_RCP                           */ shader_glsl_scalar_op,
+    /* WINED3DSIH_REP                           */ shader_glsl_rep,
+    /* WINED3DSIH_RESINFO                       */ shader_glsl_resinfo,
+    /* WINED3DSIH_RET                           */ shader_glsl_ret,
+    /* WINED3DSIH_ROUND_NI                      */ shader_glsl_map2gl,
+    /* WINED3DSIH_ROUND_PI                      */ shader_glsl_map2gl,
+    /* WINED3DSIH_ROUND_Z                       */ shader_glsl_map2gl,
+    /* WINED3DSIH_RSQ                           */ shader_glsl_scalar_op,
+    /* WINED3DSIH_SAMPLE                        */ shader_glsl_sample,
+    /* WINED3DSIH_SAMPLE_B                      */ NULL,
+    /* WINED3DSIH_SAMPLE_C_LZ                   */ NULL,
+    /* WINED3DSIH_SAMPLE_GRAD                   */ NULL,
+    /* WINED3DSIH_SAMPLE_LOD                    */ shader_glsl_sample_lod,
+    /* WINED3DSIH_SETP                          */ NULL,
+    /* WINED3DSIH_SGE                           */ shader_glsl_compare,
+    /* WINED3DSIH_SGN                           */ shader_glsl_sgn,
+    /* WINED3DSIH_SINCOS                        */ shader_glsl_sincos,
+    /* WINED3DSIH_SLT                           */ shader_glsl_compare,
+    /* WINED3DSIH_SQRT                          */ shader_glsl_map2gl,
+    /* WINED3DSIH_SUB                           */ shader_glsl_binop,
+    /* WINED3DSIH_TEX                           */ shader_glsl_tex,
+    /* WINED3DSIH_TEXBEM                        */ shader_glsl_texbem,
+    /* WINED3DSIH_TEXBEML                       */ shader_glsl_texbem,
+    /* WINED3DSIH_TEXCOORD                      */ shader_glsl_texcoord,
+    /* WINED3DSIH_TEXDEPTH                      */ shader_glsl_texdepth,
+    /* WINED3DSIH_TEXDP3                        */ shader_glsl_texdp3,
+    /* WINED3DSIH_TEXDP3TEX                     */ shader_glsl_texdp3tex,
+    /* WINED3DSIH_TEXKILL                       */ shader_glsl_texkill,
+    /* WINED3DSIH_TEXLDD                        */ shader_glsl_texldd,
+    /* WINED3DSIH_TEXLDL                        */ shader_glsl_texldl,
+    /* WINED3DSIH_TEXM3x2DEPTH                  */ shader_glsl_texm3x2depth,
+    /* WINED3DSIH_TEXM3x2PAD                    */ shader_glsl_texm3x2pad,
+    /* WINED3DSIH_TEXM3x2TEX                    */ shader_glsl_texm3x2tex,
+    /* WINED3DSIH_TEXM3x3                       */ shader_glsl_texm3x3,
+    /* WINED3DSIH_TEXM3x3DIFF                   */ NULL,
+    /* WINED3DSIH_TEXM3x3PAD                    */ shader_glsl_texm3x3pad,
+    /* WINED3DSIH_TEXM3x3SPEC                   */ shader_glsl_texm3x3spec,
+    /* WINED3DSIH_TEXM3x3TEX                    */ shader_glsl_texm3x3tex,
+    /* WINED3DSIH_TEXM3x3VSPEC                  */ shader_glsl_texm3x3vspec,
+    /* WINED3DSIH_TEXREG2AR                     */ shader_glsl_texreg2ar,
+    /* WINED3DSIH_TEXREG2GB                     */ shader_glsl_texreg2gb,
+    /* WINED3DSIH_TEXREG2RGB                    */ shader_glsl_texreg2rgb,
+    /* WINED3DSIH_UDIV                          */ shader_glsl_udiv,
+    /* WINED3DSIH_UGE                           */ shader_glsl_relop,
+    /* WINED3DSIH_USHR                          */ shader_glsl_binop,
+    /* WINED3DSIH_UTOF                          */ shader_glsl_to_float,
+    /* WINED3DSIH_XOR                           */ shader_glsl_binop,
 };
 
 static void shader_glsl_handle_instruction(const struct wined3d_shader_instruction *ins) {
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 4c42d2f..5eb3a3b 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -40,136 +40,137 @@ const float wined3d_srgb_const1[] = {0.0031308f, 0.0f, 0.0f, 0.0f};
 
 static const char * const shader_opcode_names[] =
 {
-    /* WINED3DSIH_ABS                   */ "abs",
-    /* WINED3DSIH_ADD                   */ "add",
-    /* WINED3DSIH_AND                   */ "and",
-    /* WINED3DSIH_BEM                   */ "bem",
-    /* WINED3DSIH_BREAK                 */ "break",
-    /* WINED3DSIH_BREAKC                */ "breakc",
-    /* WINED3DSIH_BREAKP                */ "breakp",
-    /* WINED3DSIH_CALL                  */ "call",
-    /* WINED3DSIH_CALLNZ                */ "callnz",
-    /* WINED3DSIH_CMP                   */ "cmp",
-    /* WINED3DSIH_CND                   */ "cnd",
-    /* WINED3DSIH_CRS                   */ "crs",
-    /* WINED3DSIH_CUT                   */ "cut",
-    /* WINED3DSIH_DCL                   */ "dcl",
-    /* WINED3DSIH_DCL_CONSTANT_BUFFER   */ "dcl_constantBuffer",
-    /* WINED3DSIH_DCL_INPUT_PRIMITIVE   */ "dcl_inputPrimitive",
-    /* WINED3DSIH_DCL_OUTPUT_TOPOLOGY   */ "dcl_outputTopology",
-    /* WINED3DSIH_DCL_TEMPS             */ "dcl_temps",
-    /* WINED3DSIH_DCL_VERTICES_OUT      */ "dcl_maxOutputVertexCount",
-    /* WINED3DSIH_DEF                   */ "def",
-    /* WINED3DSIH_DEFB                  */ "defb",
-    /* WINED3DSIH_DEFI                  */ "defi",
-    /* WINED3DSIH_DIV                   */ "div",
-    /* WINED3DSIH_DP2                   */ "dp2",
-    /* WINED3DSIH_DP2ADD                */ "dp2add",
-    /* WINED3DSIH_DP3                   */ "dp3",
-    /* WINED3DSIH_DP4                   */ "dp4",
-    /* WINED3DSIH_DST                   */ "dst",
-    /* WINED3DSIH_DSX                   */ "dsx",
-    /* WINED3DSIH_DSY                   */ "dsy",
-    /* WINED3DSIH_ELSE                  */ "else",
-    /* WINED3DSIH_EMIT                  */ "emit",
-    /* WINED3DSIH_ENDIF                 */ "endif",
-    /* WINED3DSIH_ENDLOOP               */ "endloop",
-    /* WINED3DSIH_ENDREP                */ "endrep",
-    /* WINED3DSIH_EQ                    */ "eq",
-    /* WINED3DSIH_EXP                   */ "exp",
-    /* WINED3DSIH_EXPP                  */ "expp",
-    /* WINED3DSIH_FRC                   */ "frc",
-    /* WINED3DSIH_FTOI                  */ "ftoi",
-    /* WINED3DSIH_FTOU                  */ "ftou",
-    /* WINED3DSIH_GE                    */ "ge",
-    /* WINED3DSIH_IADD                  */ "iadd",
-    /* WINED3DSIH_IEQ                   */ "ieq",
-    /* WINED3DSIH_IF                    */ "if",
-    /* WINED3DSIH_IFC                   */ "ifc",
-    /* WINED3DSIH_IGE                   */ "ige",
-    /* WINED3DSIH_ILT                   */ "ilt",
-    /* WINED3DSIH_IMAD                  */ "imad",
-    /* WINED3DSIH_IMAX                  */ "imax",
-    /* WINED3DSIH_IMIN                  */ "imin",
-    /* WINED3DSIH_IMUL                  */ "imul",
-    /* WINED3DSIH_INE                   */ "ine",
-    /* WINED3DSIH_INEG                  */ "ineg",
-    /* WINED3DSIH_ISHL                  */ "ishl",
-    /* WINED3DSIH_ITOF                  */ "itof",
-    /* WINED3DSIH_LABEL                 */ "label",
-    /* WINED3DSIH_LD                    */ "ld",
-    /* WINED3DSIH_LIT                   */ "lit",
-    /* WINED3DSIH_LOG                   */ "log",
-    /* WINED3DSIH_LOGP                  */ "logp",
-    /* WINED3DSIH_LOOP                  */ "loop",
-    /* WINED3DSIH_LRP                   */ "lrp",
-    /* WINED3DSIH_LT                    */ "lt",
-    /* WINED3DSIH_M3x2                  */ "m3x2",
-    /* WINED3DSIH_M3x3                  */ "m3x3",
-    /* WINED3DSIH_M3x4                  */ "m3x4",
-    /* WINED3DSIH_M4x3                  */ "m4x3",
-    /* WINED3DSIH_M4x4                  */ "m4x4",
-    /* WINED3DSIH_MAD                   */ "mad",
-    /* WINED3DSIH_MAX                   */ "max",
-    /* WINED3DSIH_MIN                   */ "min",
-    /* WINED3DSIH_MOV                   */ "mov",
-    /* WINED3DSIH_MOVA                  */ "mova",
-    /* WINED3DSIH_MOVC                  */ "movc",
-    /* WINED3DSIH_MUL                   */ "mul",
-    /* WINED3DSIH_NE                    */ "ne",
-    /* WINED3DSIH_NOP                   */ "nop",
-    /* WINED3DSIH_NOT                   */ "not",
-    /* WINED3DSIH_NRM                   */ "nrm",
-    /* WINED3DSIH_OR                    */ "or",
-    /* WINED3DSIH_PHASE                 */ "phase",
-    /* WINED3DSIH_POW                   */ "pow",
-    /* WINED3DSIH_RCP                   */ "rcp",
-    /* WINED3DSIH_REP                   */ "rep",
-    /* WINED3DSIH_RESINFO               */ "resinfo",
-    /* WINED3DSIH_RET                   */ "ret",
-    /* WINED3DSIH_ROUND_NI              */ "round_ni",
-    /* WINED3DSIH_ROUND_PI              */ "round_pi",
-    /* WINED3DSIH_ROUND_Z               */ "round_z",
-    /* WINED3DSIH_RSQ                   */ "rsq",
-    /* WINED3DSIH_SAMPLE                */ "sample",
-    /* WINED3DSIH_SAMPLE_B              */ "sample_b",
-    /* WINED3DSIH_SAMPLE_C_LZ           */ "sample_c_lz",
-    /* WINED3DSIH_SAMPLE_GRAD           */ "sample_d",
-    /* WINED3DSIH_SAMPLE_LOD            */ "sample_l",
-    /* WINED3DSIH_SETP                  */ "setp",
-    /* WINED3DSIH_SGE                   */ "sge",
-    /* WINED3DSIH_SGN                   */ "sgn",
-    /* WINED3DSIH_SINCOS                */ "sincos",
-    /* WINED3DSIH_SLT                   */ "slt",
-    /* WINED3DSIH_SQRT                  */ "sqrt",
-    /* WINED3DSIH_SUB                   */ "sub",
-    /* WINED3DSIH_TEX                   */ "texld",
-    /* WINED3DSIH_TEXBEM                */ "texbem",
-    /* WINED3DSIH_TEXBEML               */ "texbeml",
-    /* WINED3DSIH_TEXCOORD              */ "texcrd",
-    /* WINED3DSIH_TEXDEPTH              */ "texdepth",
-    /* WINED3DSIH_TEXDP3                */ "texdp3",
-    /* WINED3DSIH_TEXDP3TEX             */ "texdp3tex",
-    /* WINED3DSIH_TEXKILL               */ "texkill",
-    /* WINED3DSIH_TEXLDD                */ "texldd",
-    /* WINED3DSIH_TEXLDL                */ "texldl",
-    /* WINED3DSIH_TEXM3x2DEPTH          */ "texm3x2depth",
-    /* WINED3DSIH_TEXM3x2PAD            */ "texm3x2pad",
-    /* WINED3DSIH_TEXM3x2TEX            */ "texm3x2tex",
-    /* WINED3DSIH_TEXM3x3               */ "texm3x3",
-    /* WINED3DSIH_TEXM3x3DIFF           */ "texm3x3diff",
-    /* WINED3DSIH_TEXM3x3PAD            */ "texm3x3pad",
-    /* WINED3DSIH_TEXM3x3SPEC           */ "texm3x3spec",
-    /* WINED3DSIH_TEXM3x3TEX            */ "texm3x3tex",
-    /* WINED3DSIH_TEXM3x3VSPEC          */ "texm3x3vspec",
-    /* WINED3DSIH_TEXREG2AR             */ "texreg2ar",
-    /* WINED3DSIH_TEXREG2GB             */ "texreg2gb",
-    /* WINED3DSIH_TEXREG2RGB            */ "texreg2rgb",
-    /* WINED3DSIH_UDIV                  */ "udiv",
-    /* WINED3DSIH_UGE                   */ "uge",
-    /* WINED3DSIH_USHR                  */ "ushr",
-    /* WINED3DSIH_UTOF                  */ "utof",
-    /* WINED3DSIH_XOR                   */ "xor",
+    /* WINED3DSIH_ABS                           */ "abs",
+    /* WINED3DSIH_ADD                           */ "add",
+    /* WINED3DSIH_AND                           */ "and",
+    /* WINED3DSIH_BEM                           */ "bem",
+    /* WINED3DSIH_BREAK                         */ "break",
+    /* WINED3DSIH_BREAKC                        */ "breakc",
+    /* WINED3DSIH_BREAKP                        */ "breakp",
+    /* WINED3DSIH_CALL                          */ "call",
+    /* WINED3DSIH_CALLNZ                        */ "callnz",
+    /* WINED3DSIH_CMP                           */ "cmp",
+    /* WINED3DSIH_CND                           */ "cnd",
+    /* WINED3DSIH_CRS                           */ "crs",
+    /* WINED3DSIH_CUT                           */ "cut",
+    /* WINED3DSIH_DCL                           */ "dcl",
+    /* WINED3DSIH_DCL_CONSTANT_BUFFER           */ "dcl_constantBuffer",
+    /* WINED3DSIH_DCL_IMMEDIATE_CONSTANT_BUFFER */ "dcl_immediateConstantBuffer",
+    /* WINED3DSIH_DCL_INPUT_PRIMITIVE           */ "dcl_inputPrimitive",
+    /* WINED3DSIH_DCL_OUTPUT_TOPOLOGY           */ "dcl_outputTopology",
+    /* WINED3DSIH_DCL_TEMPS                     */ "dcl_temps",
+    /* WINED3DSIH_DCL_VERTICES_OUT              */ "dcl_maxOutputVertexCount",
+    /* WINED3DSIH_DEF                           */ "def",
+    /* WINED3DSIH_DEFB                          */ "defb",
+    /* WINED3DSIH_DEFI                          */ "defi",
+    /* WINED3DSIH_DIV                           */ "div",
+    /* WINED3DSIH_DP2                           */ "dp2",
+    /* WINED3DSIH_DP2ADD                        */ "dp2add",
+    /* WINED3DSIH_DP3                           */ "dp3",
+    /* WINED3DSIH_DP4                           */ "dp4",
+    /* WINED3DSIH_DST                           */ "dst",
+    /* WINED3DSIH_DSX                           */ "dsx",
+    /* WINED3DSIH_DSY                           */ "dsy",
+    /* WINED3DSIH_ELSE                          */ "else",
+    /* WINED3DSIH_EMIT                          */ "emit",
+    /* WINED3DSIH_ENDIF                         */ "endif",
+    /* WINED3DSIH_ENDLOOP                       */ "endloop",
+    /* WINED3DSIH_ENDREP                        */ "endrep",
+    /* WINED3DSIH_EQ                            */ "eq",
+    /* WINED3DSIH_EXP                           */ "exp",
+    /* WINED3DSIH_EXPP                          */ "expp",
+    /* WINED3DSIH_FRC                           */ "frc",
+    /* WINED3DSIH_FTOI                          */ "ftoi",
+    /* WINED3DSIH_FTOU                          */ "ftou",
+    /* WINED3DSIH_GE                            */ "ge",
+    /* WINED3DSIH_IADD                          */ "iadd",
+    /* WINED3DSIH_IEQ                           */ "ieq",
+    /* WINED3DSIH_IF                            */ "if",
+    /* WINED3DSIH_IFC                           */ "ifc",
+    /* WINED3DSIH_IGE                           */ "ige",
+    /* WINED3DSIH_ILT                           */ "ilt",
+    /* WINED3DSIH_IMAD                          */ "imad",
+    /* WINED3DSIH_IMAX                          */ "imax",
+    /* WINED3DSIH_IMIN                          */ "imin",
+    /* WINED3DSIH_IMUL                          */ "imul",
+    /* WINED3DSIH_INE                           */ "ine",
+    /* WINED3DSIH_INEG                          */ "ineg",
+    /* WINED3DSIH_ISHL                          */ "ishl",
+    /* WINED3DSIH_ITOF                          */ "itof",
+    /* WINED3DSIH_LABEL                         */ "label",
+    /* WINED3DSIH_LD                            */ "ld",
+    /* WINED3DSIH_LIT                           */ "lit",
+    /* WINED3DSIH_LOG                           */ "log",
+    /* WINED3DSIH_LOGP                          */ "logp",
+    /* WINED3DSIH_LOOP                          */ "loop",
+    /* WINED3DSIH_LRP                           */ "lrp",
+    /* WINED3DSIH_LT                            */ "lt",
+    /* WINED3DSIH_M3x2                          */ "m3x2",
+    /* WINED3DSIH_M3x3                          */ "m3x3",
+    /* WINED3DSIH_M3x4                          */ "m3x4",
+    /* WINED3DSIH_M4x3                          */ "m4x3",
+    /* WINED3DSIH_M4x4                          */ "m4x4",
+    /* WINED3DSIH_MAD                           */ "mad",
+    /* WINED3DSIH_MAX                           */ "max",
+    /* WINED3DSIH_MIN                           */ "min",
+    /* WINED3DSIH_MOV                           */ "mov",
+    /* WINED3DSIH_MOVA                          */ "mova",
+    /* WINED3DSIH_MOVC                          */ "movc",
+    /* WINED3DSIH_MUL                           */ "mul",
+    /* WINED3DSIH_NE                            */ "ne",
+    /* WINED3DSIH_NOP                           */ "nop",
+    /* WINED3DSIH_NOT                           */ "not",
+    /* WINED3DSIH_NRM                           */ "nrm",
+    /* WINED3DSIH_OR                            */ "or",
+    /* WINED3DSIH_PHASE                         */ "phase",
+    /* WINED3DSIH_POW                           */ "pow",
+    /* WINED3DSIH_RCP                           */ "rcp",
+    /* WINED3DSIH_REP                           */ "rep",
+    /* WINED3DSIH_RESINFO                       */ "resinfo",
+    /* WINED3DSIH_RET                           */ "ret",
+    /* WINED3DSIH_ROUND_NI                      */ "round_ni",
+    /* WINED3DSIH_ROUND_PI                      */ "round_pi",
+    /* WINED3DSIH_ROUND_Z                       */ "round_z",
+    /* WINED3DSIH_RSQ                           */ "rsq",
+    /* WINED3DSIH_SAMPLE                        */ "sample",
+    /* WINED3DSIH_SAMPLE_B                      */ "sample_b",
+    /* WINED3DSIH_SAMPLE_C_LZ                   */ "sample_c_lz",
+    /* WINED3DSIH_SAMPLE_GRAD                   */ "sample_d",
+    /* WINED3DSIH_SAMPLE_LOD                    */ "sample_l",
+    /* WINED3DSIH_SETP                          */ "setp",
+    /* WINED3DSIH_SGE                           */ "sge",
+    /* WINED3DSIH_SGN                           */ "sgn",
+    /* WINED3DSIH_SINCOS                        */ "sincos",
+    /* WINED3DSIH_SLT                           */ "slt",
+    /* WINED3DSIH_SQRT                          */ "sqrt",
+    /* WINED3DSIH_SUB                           */ "sub",
+    /* WINED3DSIH_TEX                           */ "texld",
+    /* WINED3DSIH_TEXBEM                        */ "texbem",
+    /* WINED3DSIH_TEXBEML                       */ "texbeml",
+    /* WINED3DSIH_TEXCOORD                      */ "texcrd",
+    /* WINED3DSIH_TEXDEPTH                      */ "texdepth",
+    /* WINED3DSIH_TEXDP3                        */ "texdp3",
+    /* WINED3DSIH_TEXDP3TEX                     */ "texdp3tex",
+    /* WINED3DSIH_TEXKILL                       */ "texkill",
+    /* WINED3DSIH_TEXLDD                        */ "texldd",
+    /* WINED3DSIH_TEXLDL                        */ "texldl",
+    /* WINED3DSIH_TEXM3x2DEPTH                  */ "texm3x2depth",
+    /* WINED3DSIH_TEXM3x2PAD                    */ "texm3x2pad",
+    /* WINED3DSIH_TEXM3x2TEX                    */ "texm3x2tex",
+    /* WINED3DSIH_TEXM3x3                       */ "texm3x3",
+    /* WINED3DSIH_TEXM3x3DIFF                   */ "texm3x3diff",
+    /* WINED3DSIH_TEXM3x3PAD                    */ "texm3x3pad",
+    /* WINED3DSIH_TEXM3x3SPEC                   */ "texm3x3spec",
+    /* WINED3DSIH_TEXM3x3TEX                    */ "texm3x3tex",
+    /* WINED3DSIH_TEXM3x3VSPEC                  */ "texm3x3vspec",
+    /* WINED3DSIH_TEXREG2AR                     */ "texreg2ar",
+    /* WINED3DSIH_TEXREG2GB                     */ "texreg2gb",
+    /* WINED3DSIH_TEXREG2RGB                    */ "texreg2rgb",
+    /* WINED3DSIH_UDIV                          */ "udiv",
+    /* WINED3DSIH_UGE                           */ "uge",
+    /* WINED3DSIH_USHR                          */ "ushr",
+    /* WINED3DSIH_UTOF                          */ "utof",
+    /* WINED3DSIH_XOR                           */ "xor",
 };
 
 static const char * const semantic_names[] =
@@ -811,6 +812,22 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
             else
                 reg_maps->cb_sizes[reg->idx[0].offset] = reg->idx[1].offset;
         }
+        else if (ins.handler_idx == WINED3DSIH_DCL_IMMEDIATE_CONSTANT_BUFFER)
+        {
+            struct wined3d_shader_immediate_constant_buffer *icb = ins.declaration.icb;
+            if (reg_maps->icb)
+            {
+                ERR("Multiple immediate constant buffers.\n");
+                HeapFree(GetProcessHeap(), 0, reg_maps->icb);
+            }
+            if (!(reg_maps->icb = HeapAlloc(GetProcessHeap(), 0, icb->element_count * sizeof(*icb->data))))
+            {
+                ERR("Failed to allocate immediate constant buffer.\n");
+                return E_OUTOFMEMORY;
+            }
+            memcpy(reg_maps->icb, icb->data, icb->element_count * sizeof(*icb->data));
+            reg_maps->icb_size = icb->element_count / 4;
+        }
         else if (ins.handler_idx == WINED3DSIH_DCL_INPUT_PRIMITIVE)
         {
             if (shader_version.type == WINED3D_SHADER_TYPE_GEOMETRY)
@@ -1818,6 +1835,19 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe
             shader_dump_src_param(&ins.declaration.src, &shader_version);
             TRACE(", %s", ins.flags & WINED3DSI_INDEXED_DYNAMIC ? "dynamicIndexed" : "immediateIndexed");
         }
+        else if (ins.handler_idx == WINED3DSIH_DCL_IMMEDIATE_CONSTANT_BUFFER)
+        {
+            TRACE("%s {\n", shader_opcode_names[ins.handler_idx]);
+            for (i = 0; i < ins.declaration.icb->element_count / 4; ++i)
+            {
+                TRACE("{ 0x%08x, 0x%08x, 0x%08x, 0x%08x },\n",
+                        ins.declaration.icb->data[4 * i + 0],
+                        ins.declaration.icb->data[4 * i + 1],
+                        ins.declaration.icb->data[4 * i + 2],
+                        ins.declaration.icb->data[4 * i + 3]);
+            }
+            TRACE("}");
+        }
         else if (ins.handler_idx == WINED3DSIH_DCL_INPUT_PRIMITIVE
                 || ins.handler_idx == WINED3DSIH_DCL_OUTPUT_TOPOLOGY)
         {
@@ -1920,6 +1950,7 @@ static void shader_cleanup(struct wined3d_shader *shader)
     HeapFree(GetProcessHeap(), 0, shader->signature_strings);
     shader->device->shader_backend->shader_destroy(shader);
     HeapFree(GetProcessHeap(), 0, shader->reg_maps.constf);
+    HeapFree(GetProcessHeap(), 0, shader->reg_maps.icb);
     HeapFree(GetProcessHeap(), 0, shader->reg_maps.sampler_map.entries);
     HeapFree(GetProcessHeap(), 0, shader->function);
     shader_delete_constant_list(&shader->constantsF);
diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c
index 11de59c..1299998 100644
--- a/dlls/wined3d/shader_sm4.c
+++ b/dlls/wined3d/shader_sm4.c
@@ -41,6 +41,9 @@ WINE_DECLARE_DEBUG_CHANNEL(d3d_bytecode);
 #define WINED3D_SM4_INDEX_TYPE_SHIFT            11
 #define WINED3D_SM4_INDEX_TYPE_MASK             (0x1u << WINED3D_SM4_INDEX_TYPE_SHIFT)
 
+#define WINED3D_SM4_SHADER_DATA_TYPE_SHIFT      11
+#define WINED3D_SM4_SHADER_DATA_TYPE_MASK       (0xfu << WINED3D_SM4_SHADER_DATA_TYPE_SHIFT)
+
 #define WINED3D_SM4_OPCODE_MASK                 0xff
 
 #define WINED3D_SM4_REGISTER_MODIFIER           (0x1u << 31)
@@ -121,6 +124,7 @@ enum wined3d_sm4_opcode
     WINED3D_SM4_OP_MAD                  = 0x32,
     WINED3D_SM4_OP_MIN                  = 0x33,
     WINED3D_SM4_OP_MAX                  = 0x34,
+    WINED3D_SM4_OP_SHADER_DATA          = 0x35,
     WINED3D_SM4_OP_MOV                  = 0x36,
     WINED3D_SM4_OP_MOVC                 = 0x37,
     WINED3D_SM4_OP_MUL                  = 0x38,
@@ -218,6 +222,12 @@ enum wined3d_sm4_data_type
     WINED3D_SM4_DATA_FLOAT  = 0x5,
 };
 
+enum wined3d_sm4_shader_data_type
+{
+    WINED3D_SM4_SHADER_DATA_IMMEDIATE_CONSTANT_BUFFER = 0x3,
+    WINED3D_SM4_SHADER_DATA_MESSAGE                   = 0x4,
+};
+
 struct wined3d_shader_src_param_entry
 {
     struct list entry;
@@ -239,6 +249,7 @@ struct wined3d_sm4_data
     struct wined3d_shader_dst_param dst_param[2];
     struct list src_free;
     struct list src;
+    struct wined3d_shader_immediate_constant_buffer icb;
 };
 
 struct wined3d_sm4_opcode_info
@@ -265,78 +276,79 @@ struct sysval_map
  */
 static const struct wined3d_sm4_opcode_info opcode_table[] =
 {
-    {WINED3D_SM4_OP_ADD,                    WINED3DSIH_ADD,                 "F",    "FF"},
-    {WINED3D_SM4_OP_AND,                    WINED3DSIH_AND,                 "U",    "UU"},
-    {WINED3D_SM4_OP_BREAK,                  WINED3DSIH_BREAK,               "",     ""},
-    {WINED3D_SM4_OP_BREAKC,                 WINED3DSIH_BREAKP,              "",     "U"},
-    {WINED3D_SM4_OP_CUT,                    WINED3DSIH_CUT,                 "",     ""},
-    {WINED3D_SM4_OP_DERIV_RTX,              WINED3DSIH_DSX,                 "F",    "F"},
-    {WINED3D_SM4_OP_DERIV_RTY,              WINED3DSIH_DSY,                 "F",    "F"},
-    {WINED3D_SM4_OP_DISCARD,                WINED3DSIH_TEXKILL,             "",     "U"},
-    {WINED3D_SM4_OP_DIV,                    WINED3DSIH_DIV,                 "F",    "FF"},
-    {WINED3D_SM4_OP_DP2,                    WINED3DSIH_DP2,                 "F",    "FF"},
-    {WINED3D_SM4_OP_DP3,                    WINED3DSIH_DP3,                 "F",    "FF"},
-    {WINED3D_SM4_OP_DP4,                    WINED3DSIH_DP4,                 "F",    "FF"},
-    {WINED3D_SM4_OP_ELSE,                   WINED3DSIH_ELSE,                "",     ""},
-    {WINED3D_SM4_OP_EMIT,                   WINED3DSIH_EMIT,                "",     ""},
-    {WINED3D_SM4_OP_ENDIF,                  WINED3DSIH_ENDIF,               "",     ""},
-    {WINED3D_SM4_OP_ENDLOOP,                WINED3DSIH_ENDLOOP,             "",     ""},
-    {WINED3D_SM4_OP_EQ,                     WINED3DSIH_EQ,                  "U",    "FF"},
-    {WINED3D_SM4_OP_EXP,                    WINED3DSIH_EXP,                 "F",    "F"},
-    {WINED3D_SM4_OP_FRC,                    WINED3DSIH_FRC,                 "F",    "F"},
-    {WINED3D_SM4_OP_FTOI,                   WINED3DSIH_FTOI,                "I",    "F"},
-    {WINED3D_SM4_OP_FTOU,                   WINED3DSIH_FTOU,                "U",    "F"},
-    {WINED3D_SM4_OP_GE,                     WINED3DSIH_GE,                  "U",    "FF"},
-    {WINED3D_SM4_OP_IADD,                   WINED3DSIH_IADD,                "I",    "II"},
-    {WINED3D_SM4_OP_IF,                     WINED3DSIH_IF,                  "",     "U"},
-    {WINED3D_SM4_OP_IEQ,                    WINED3DSIH_IEQ,                 "U",    "II"},
-    {WINED3D_SM4_OP_IGE,                    WINED3DSIH_IGE,                 "U",    "II"},
-    {WINED3D_SM4_OP_ILT,                    WINED3DSIH_ILT,                 "U",    "II"},
-    {WINED3D_SM4_OP_IMAD,                   WINED3DSIH_IMAD,                "I",    "III"},
-    {WINED3D_SM4_OP_IMAX,                   WINED3DSIH_IMAX,                "I",    "II"},
-    {WINED3D_SM4_OP_IMIN,                   WINED3DSIH_IMIN,                "I",    "II"},
-    {WINED3D_SM4_OP_IMUL,                   WINED3DSIH_IMUL,                "II",   "II"},
-    {WINED3D_SM4_OP_INE,                    WINED3DSIH_INE,                 "U",    "II"},
-    {WINED3D_SM4_OP_INEG,                   WINED3DSIH_INEG,                "I",    "I"},
-    {WINED3D_SM4_OP_ISHL,                   WINED3DSIH_ISHL,                "I",    "II"},
-    {WINED3D_SM4_OP_ITOF,                   WINED3DSIH_ITOF,                "F",    "I"},
-    {WINED3D_SM4_OP_LD,                     WINED3DSIH_LD,                  "U",    "IR"},
-    {WINED3D_SM4_OP_LOG,                    WINED3DSIH_LOG,                 "F",    "F"},
-    {WINED3D_SM4_OP_LOOP,                   WINED3DSIH_LOOP,                "",     ""},
-    {WINED3D_SM4_OP_LT,                     WINED3DSIH_LT,                  "U",    "FF"},
-    {WINED3D_SM4_OP_MAD,                    WINED3DSIH_MAD,                 "F",    "FFF"},
-    {WINED3D_SM4_OP_MIN,                    WINED3DSIH_MIN,                 "F",    "FF"},
-    {WINED3D_SM4_OP_MAX,                    WINED3DSIH_MAX,                 "F",    "FF"},
-    {WINED3D_SM4_OP_MOV,                    WINED3DSIH_MOV,                 "F",    "F"},
-    {WINED3D_SM4_OP_MOVC,                   WINED3DSIH_MOVC,                "F",    "UFF"},
-    {WINED3D_SM4_OP_MUL,                    WINED3DSIH_MUL,                 "F",    "FF"},
-    {WINED3D_SM4_OP_NE,                     WINED3DSIH_NE,                  "U",    "FF"},
-    {WINED3D_SM4_OP_NOT,                    WINED3DSIH_NOT,                 "U",    "U"},
-    {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_ROUND_PI,               WINED3DSIH_ROUND_PI,            "F",    "F"},
-    {WINED3D_SM4_OP_ROUND_Z,                WINED3DSIH_ROUND_Z,             "F",    "F"},
-    {WINED3D_SM4_OP_RSQ,                    WINED3DSIH_RSQ,                 "F",    "F"},
-    {WINED3D_SM4_OP_SAMPLE,                 WINED3DSIH_SAMPLE,              "U",    "FRS"},
-    {WINED3D_SM4_OP_SAMPLE_C_LZ,            WINED3DSIH_SAMPLE_C_LZ,         "F",    "FRSF"},
-    {WINED3D_SM4_OP_SAMPLE_LOD,             WINED3DSIH_SAMPLE_LOD,          "U",    "FRSF"},
-    {WINED3D_SM4_OP_SAMPLE_GRAD,            WINED3DSIH_SAMPLE_GRAD,         "U",    "FRSFF"},
-    {WINED3D_SM4_OP_SAMPLE_B,               WINED3DSIH_SAMPLE_B,            "U",    "FRSF"},
-    {WINED3D_SM4_OP_SQRT,                   WINED3DSIH_SQRT,                "F",    "F"},
-    {WINED3D_SM4_OP_SINCOS,                 WINED3DSIH_SINCOS,              "FF",   "F"},
-    {WINED3D_SM4_OP_UDIV,                   WINED3DSIH_UDIV,                "UU",   "UU"},
-    {WINED3D_SM4_OP_UGE,                    WINED3DSIH_UGE,                 "U",    "UU"},
-    {WINED3D_SM4_OP_USHR,                   WINED3DSIH_USHR,                "U",    "UU"},
-    {WINED3D_SM4_OP_UTOF,                   WINED3DSIH_UTOF,                "F",    "U"},
-    {WINED3D_SM4_OP_XOR,                    WINED3DSIH_XOR,                 "U",    "UU"},
-    {WINED3D_SM4_OP_DCL_RESOURCE,           WINED3DSIH_DCL,                 "R",    ""},
-    {WINED3D_SM4_OP_DCL_CONSTANT_BUFFER,    WINED3DSIH_DCL_CONSTANT_BUFFER, "",     ""},
-    {WINED3D_SM4_OP_DCL_OUTPUT_TOPOLOGY,    WINED3DSIH_DCL_OUTPUT_TOPOLOGY, "",     ""},
-    {WINED3D_SM4_OP_DCL_INPUT_PRIMITIVE,    WINED3DSIH_DCL_INPUT_PRIMITIVE, "",     ""},
-    {WINED3D_SM4_OP_DCL_VERTICES_OUT,       WINED3DSIH_DCL_VERTICES_OUT,    "",     ""},
-    {WINED3D_SM4_OP_DCL_TEMPS,              WINED3DSIH_DCL_TEMPS,           "",     ""},
+    {WINED3D_SM4_OP_ADD,                    WINED3DSIH_ADD,                           "F",    "FF"},
+    {WINED3D_SM4_OP_AND,                    WINED3DSIH_AND,                           "U",    "UU"},
+    {WINED3D_SM4_OP_BREAK,                  WINED3DSIH_BREAK,                         "",     ""},
+    {WINED3D_SM4_OP_BREAKC,                 WINED3DSIH_BREAKP,                        "",     "U"},
+    {WINED3D_SM4_OP_CUT,                    WINED3DSIH_CUT,                           "",     ""},
+    {WINED3D_SM4_OP_DERIV_RTX,              WINED3DSIH_DSX,                           "F",    "F"},
+    {WINED3D_SM4_OP_DERIV_RTY,              WINED3DSIH_DSY,                           "F",    "F"},
+    {WINED3D_SM4_OP_DISCARD,                WINED3DSIH_TEXKILL,                       "",     "U"},
+    {WINED3D_SM4_OP_DIV,                    WINED3DSIH_DIV,                           "F",    "FF"},
+    {WINED3D_SM4_OP_DP2,                    WINED3DSIH_DP2,                           "F",    "FF"},
+    {WINED3D_SM4_OP_DP3,                    WINED3DSIH_DP3,                           "F",    "FF"},
+    {WINED3D_SM4_OP_DP4,                    WINED3DSIH_DP4,                           "F",    "FF"},
+    {WINED3D_SM4_OP_ELSE,                   WINED3DSIH_ELSE,                          "",     ""},
+    {WINED3D_SM4_OP_EMIT,                   WINED3DSIH_EMIT,                          "",     ""},
+    {WINED3D_SM4_OP_ENDIF,                  WINED3DSIH_ENDIF,                         "",     ""},
+    {WINED3D_SM4_OP_ENDLOOP,                WINED3DSIH_ENDLOOP,                       "",     ""},
+    {WINED3D_SM4_OP_EQ,                     WINED3DSIH_EQ,                            "U",    "FF"},
+    {WINED3D_SM4_OP_EXP,                    WINED3DSIH_EXP,                           "F",    "F"},
+    {WINED3D_SM4_OP_FRC,                    WINED3DSIH_FRC,                           "F",    "F"},
+    {WINED3D_SM4_OP_FTOI,                   WINED3DSIH_FTOI,                          "I",    "F"},
+    {WINED3D_SM4_OP_FTOU,                   WINED3DSIH_FTOU,                          "U",    "F"},
+    {WINED3D_SM4_OP_GE,                     WINED3DSIH_GE,                            "U",    "FF"},
+    {WINED3D_SM4_OP_IADD,                   WINED3DSIH_IADD,                          "I",    "II"},
+    {WINED3D_SM4_OP_IF,                     WINED3DSIH_IF,                            "",     "U"},
+    {WINED3D_SM4_OP_IEQ,                    WINED3DSIH_IEQ,                           "U",    "II"},
+    {WINED3D_SM4_OP_IGE,                    WINED3DSIH_IGE,                           "U",    "II"},
+    {WINED3D_SM4_OP_ILT,                    WINED3DSIH_ILT,                           "U",    "II"},
+    {WINED3D_SM4_OP_IMAD,                   WINED3DSIH_IMAD,                          "I",    "III"},
+    {WINED3D_SM4_OP_IMAX,                   WINED3DSIH_IMAX,                          "I",    "II"},
+    {WINED3D_SM4_OP_IMIN,                   WINED3DSIH_IMIN,                          "I",    "II"},
+    {WINED3D_SM4_OP_IMUL,                   WINED3DSIH_IMUL,                          "II",   "II"},
+    {WINED3D_SM4_OP_INE,                    WINED3DSIH_INE,                           "U",    "II"},
+    {WINED3D_SM4_OP_INEG,                   WINED3DSIH_INEG,                          "I",    "I"},
+    {WINED3D_SM4_OP_ISHL,                   WINED3DSIH_ISHL,                          "I",    "II"},
+    {WINED3D_SM4_OP_ITOF,                   WINED3DSIH_ITOF,                          "F",    "I"},
+    {WINED3D_SM4_OP_LD,                     WINED3DSIH_LD,                            "U",    "IR"},
+    {WINED3D_SM4_OP_LOG,                    WINED3DSIH_LOG,                           "F",    "F"},
+    {WINED3D_SM4_OP_LOOP,                   WINED3DSIH_LOOP,                          "",     ""},
+    {WINED3D_SM4_OP_LT,                     WINED3DSIH_LT,                            "U",    "FF"},
+    {WINED3D_SM4_OP_MAD,                    WINED3DSIH_MAD,                           "F",    "FFF"},
+    {WINED3D_SM4_OP_MIN,                    WINED3DSIH_MIN,                           "F",    "FF"},
+    {WINED3D_SM4_OP_MAX,                    WINED3DSIH_MAX,                           "F",    "FF"},
+    {WINED3D_SM4_OP_SHADER_DATA,            WINED3DSIH_DCL_IMMEDIATE_CONSTANT_BUFFER, "",     ""},
+    {WINED3D_SM4_OP_MOV,                    WINED3DSIH_MOV,                           "F",    "F"},
+    {WINED3D_SM4_OP_MOVC,                   WINED3DSIH_MOVC,                          "F",    "UFF"},
+    {WINED3D_SM4_OP_MUL,                    WINED3DSIH_MUL,                           "F",    "FF"},
+    {WINED3D_SM4_OP_NE,                     WINED3DSIH_NE,                            "U",    "FF"},
+    {WINED3D_SM4_OP_NOT,                    WINED3DSIH_NOT,                           "U",    "U"},
+    {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_ROUND_PI,               WINED3DSIH_ROUND_PI,                      "F",    "F"},
+    {WINED3D_SM4_OP_ROUND_Z,                WINED3DSIH_ROUND_Z,                       "F",    "F"},
+    {WINED3D_SM4_OP_RSQ,                    WINED3DSIH_RSQ,                           "F",    "F"},
+    {WINED3D_SM4_OP_SAMPLE,                 WINED3DSIH_SAMPLE,                        "U",    "FRS"},
+    {WINED3D_SM4_OP_SAMPLE_C_LZ,            WINED3DSIH_SAMPLE_C_LZ,                   "F",    "FRSF"},
+    {WINED3D_SM4_OP_SAMPLE_LOD,             WINED3DSIH_SAMPLE_LOD,                    "U",    "FRSF"},
+    {WINED3D_SM4_OP_SAMPLE_GRAD,            WINED3DSIH_SAMPLE_GRAD,                   "U",    "FRSFF"},
+    {WINED3D_SM4_OP_SAMPLE_B,               WINED3DSIH_SAMPLE_B,                      "U",    "FRSF"},
+    {WINED3D_SM4_OP_SQRT,                   WINED3DSIH_SQRT,                          "F",    "F"},
+    {WINED3D_SM4_OP_SINCOS,                 WINED3DSIH_SINCOS,                        "FF",   "F"},
+    {WINED3D_SM4_OP_UDIV,                   WINED3DSIH_UDIV,                          "UU",   "UU"},
+    {WINED3D_SM4_OP_UGE,                    WINED3DSIH_UGE,                           "U",    "UU"},
+    {WINED3D_SM4_OP_USHR,                   WINED3DSIH_USHR,                          "U",    "UU"},
+    {WINED3D_SM4_OP_UTOF,                   WINED3DSIH_UTOF,                          "F",    "U"},
+    {WINED3D_SM4_OP_XOR,                    WINED3DSIH_XOR,                           "U",    "UU"},
+    {WINED3D_SM4_OP_DCL_RESOURCE,           WINED3DSIH_DCL,                           "R",    ""},
+    {WINED3D_SM4_OP_DCL_CONSTANT_BUFFER,    WINED3DSIH_DCL_CONSTANT_BUFFER,           "",     ""},
+    {WINED3D_SM4_OP_DCL_OUTPUT_TOPOLOGY,    WINED3DSIH_DCL_OUTPUT_TOPOLOGY,           "",     ""},
+    {WINED3D_SM4_OP_DCL_INPUT_PRIMITIVE,    WINED3DSIH_DCL_INPUT_PRIMITIVE,           "",     ""},
+    {WINED3D_SM4_OP_DCL_VERTICES_OUT,       WINED3DSIH_DCL_VERTICES_OUT,              "",     ""},
+    {WINED3D_SM4_OP_DCL_TEMPS,              WINED3DSIH_DCL_TEMPS,                     "",     ""},
 };
 
 static const enum wined3d_shader_register_type register_type_table[] =
@@ -803,7 +815,11 @@ static void shader_sm4_read_instruction(void *data, const DWORD **ptr, struct wi
 
     opcode_token = *(*ptr)++;
     opcode = opcode_token & WINED3D_SM4_OPCODE_MASK;
-    len = ((opcode_token & WINED3D_SM4_INSTRUCTION_LENGTH_MASK) >> WINED3D_SM4_INSTRUCTION_LENGTH_SHIFT) - 1;
+
+    len = ((opcode_token & WINED3D_SM4_INSTRUCTION_LENGTH_MASK) >> WINED3D_SM4_INSTRUCTION_LENGTH_SHIFT);
+    if (!len)
+        len = **ptr;
+    --len;
 
     if (TRACE_ON(d3d_bytecode))
     {
@@ -841,7 +857,33 @@ static void shader_sm4_read_instruction(void *data, const DWORD **ptr, struct wi
         FIXME("Skipping modifier 0x%08x.\n", modifier);
     }
 
-    if (opcode == WINED3D_SM4_OP_DCL_RESOURCE)
+    if (opcode == WINED3D_SM4_OP_SHADER_DATA)
+    {
+        unsigned int icb_size;
+        enum wined3d_sm4_shader_data_type type;
+
+        type = (opcode_token & WINED3D_SM4_SHADER_DATA_TYPE_MASK) >> WINED3D_SM4_SHADER_DATA_TYPE_SHIFT;
+        if (type != WINED3D_SM4_SHADER_DATA_IMMEDIATE_CONSTANT_BUFFER)
+        {
+            FIXME("Unhandled shader data type %#x.\n", type);
+            ins->handler_idx = WINED3DSIH_TABLE_SIZE;
+            return;
+        }
+
+        ++p;
+        icb_size = len - 1;
+        if (icb_size % 4 || icb_size > MAX_IMMEDIATE_CONSTANT_BUFFER_SIZE)
+        {
+            FIXME("Unexpected size of immediate constant buffer %u.\n", len);
+            ins->handler_idx = WINED3DSIH_TABLE_SIZE;
+            return;
+        }
+
+        ins->declaration.icb = &priv->icb;
+        ins->declaration.icb->element_count = len;
+        memcpy(ins->declaration.icb->data, p, sizeof(*p) * icb_size);
+    }
+    else if (opcode == WINED3D_SM4_OP_DCL_RESOURCE)
     {
         enum wined3d_sm4_resource_type resource_type;
         enum wined3d_sm4_data_type data_type;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 0287088..b8c453d 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -459,6 +459,8 @@ enum wined3d_shader_rel_op
  * Shader model 3 according to msdn (and for software shaders) */
 #define MAX_LABELS 16
 
+#define MAX_IMMEDIATE_CONSTANT_BUFFER_SIZE 4096
+
 struct wined3d_string_buffer
 {
     struct list entry;
@@ -484,6 +486,7 @@ enum WINED3D_SHADER_INSTRUCTION_HANDLER
     WINED3DSIH_CUT,
     WINED3DSIH_DCL,
     WINED3DSIH_DCL_CONSTANT_BUFFER,
+    WINED3DSIH_DCL_IMMEDIATE_CONSTANT_BUFFER,
     WINED3DSIH_DCL_INPUT_PRIMITIVE,
     WINED3DSIH_DCL_OUTPUT_TOPOLOGY,
     WINED3DSIH_DCL_TEMPS,
@@ -649,6 +652,8 @@ struct wined3d_shader_reg_maps
     WORD labels;                                    /* MAX_LABELS, 16 */
     DWORD temporary;                                /* MAX_REG_TEMP, 32 */
     DWORD *constf;                                  /* pixel, vertex */
+    DWORD *icb;
+    UINT icb_size;
     union
     {
         DWORD texcoord_mask[MAX_REG_TEXCRD];        /* vertex < 3.0 */
@@ -754,6 +759,12 @@ struct wined3d_shader_semantic
     struct wined3d_shader_dst_param reg;
 };
 
+struct wined3d_shader_immediate_constant_buffer
+{
+    UINT element_count;
+    DWORD data[MAX_IMMEDIATE_CONSTANT_BUFFER_SIZE];
+};
+
 struct wined3d_shader_instruction
 {
     const struct wined3d_shader_context *ctx;
@@ -771,6 +782,7 @@ struct wined3d_shader_instruction
         enum wined3d_primitive_type primitive_type;
         struct wined3d_shader_src_param src;
         UINT count;
+        struct wined3d_shader_immediate_constant_buffer *icb;
     } declaration;
 };
 
-- 
2.4.10




More information about the wine-patches mailing list