From 7929895029e994595535df705cb28335fa46732e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Fri, 3 Jun 2016 11:33:04 +0200 Subject: [PATCH] wined3d: Implement SM4 case instruction. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/arb_program_shader.c | 1 + dlls/wined3d/glsl_shader.c | 9 +++++++++ dlls/wined3d/shader.c | 1 + dlls/wined3d/shader_sm4.c | 2 ++ dlls/wined3d/wined3d_private.h | 1 + 5 files changed, 14 insertions(+) diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index 53b8f2cef74..7ecf1931eb4 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -5217,6 +5217,7 @@ static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABL /* WINED3DSIH_BREAKP */ NULL, /* WINED3DSIH_CALL */ shader_hw_call, /* WINED3DSIH_CALLNZ */ NULL, + /* WINED3DSIH_CASE */ NULL, /* WINED3DSIH_CMP */ pshader_hw_cmp, /* WINED3DSIH_CND */ pshader_hw_cnd, /* WINED3DSIH_CRS */ shader_hw_map2gl, diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 69ff2bcca12..cfd0cfd6b6a 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -4236,6 +4236,14 @@ static void shader_glsl_switch(const struct wined3d_shader_instruction *ins) shader_addline(ins->ctx->buffer, "switch (%s)\n{\n", src0_param.param_str); } +static void shader_glsl_case(const struct wined3d_shader_instruction *ins) +{ + struct glsl_src_param src0_param; + + shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_0, &src0_param); + shader_addline(ins->ctx->buffer, "case %s:\n", src0_param.param_str); +} + static void shader_glsl_if(const struct wined3d_shader_instruction *ins) { const char *condition = (ins->flags == WINED3D_SHADER_CONDITIONAL_OP_NZ) ? "bool" : "!bool"; @@ -8538,6 +8546,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB /* WINED3DSIH_BREAKP */ shader_glsl_breakp, /* WINED3DSIH_CALL */ shader_glsl_call, /* WINED3DSIH_CALLNZ */ shader_glsl_callnz, + /* WINED3DSIH_CASE */ shader_glsl_case, /* WINED3DSIH_CMP */ shader_glsl_conditional_move, /* WINED3DSIH_CND */ shader_glsl_cnd, /* WINED3DSIH_CRS */ shader_glsl_cross, diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index be124323e93..bf67dbe140d 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -49,6 +49,7 @@ static const char * const shader_opcode_names[] = /* WINED3DSIH_BREAKP */ "breakp", /* WINED3DSIH_CALL */ "call", /* WINED3DSIH_CALLNZ */ "callnz", + /* WINED3DSIH_CASE */ "case", /* WINED3DSIH_CMP */ "cmp", /* WINED3DSIH_CND */ "cnd", /* WINED3DSIH_CRS */ "crs", diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c index ab39bf888d2..247f9b00911 100644 --- a/dlls/wined3d/shader_sm4.c +++ b/dlls/wined3d/shader_sm4.c @@ -111,6 +111,7 @@ enum wined3d_sm4_opcode WINED3D_SM4_OP_AND = 0x01, WINED3D_SM4_OP_BREAK = 0x02, WINED3D_SM4_OP_BREAKC = 0x03, + WINED3D_SM4_OP_CASE = 0x06, WINED3D_SM4_OP_CUT = 0x09, WINED3D_SM4_OP_DERIV_RTX = 0x0b, WINED3D_SM4_OP_DERIV_RTY = 0x0c, @@ -623,6 +624,7 @@ static const struct wined3d_sm4_opcode_info opcode_table[] = {WINED3D_SM4_OP_BREAK, WINED3DSIH_BREAK, "", ""}, {WINED3D_SM4_OP_BREAKC, WINED3DSIH_BREAKP, "", "u", shader_sm4_read_conditional_op}, + {WINED3D_SM4_OP_CASE, WINED3DSIH_CASE, "", "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"}, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 255dbd5d544..e9d5a586a48 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -556,6 +556,7 @@ enum WINED3D_SHADER_INSTRUCTION_HANDLER WINED3DSIH_BREAKP, WINED3DSIH_CALL, WINED3DSIH_CALLNZ, + WINED3DSIH_CASE, WINED3DSIH_CMP, WINED3DSIH_CND, WINED3DSIH_CRS,