From ba60b0f59a8a2e7e3e444f7032d51a437b096bd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Fri, 3 Jun 2016 11:33:03 +0200 Subject: [PATCH] wined3d: Implement SM4 switch 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 7b395e93a31..53b8f2cef74 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -5345,6 +5345,7 @@ static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABL /* WINED3DSIH_SQRT */ NULL, /* WINED3DSIH_STORE_UAV_TYPED */ NULL, /* WINED3DSIH_SUB */ shader_hw_map2gl, + /* WINED3DSIH_SWITCH */ NULL, /* WINED3DSIH_TEX */ pshader_hw_tex, /* WINED3DSIH_TEXBEM */ pshader_hw_texbem, /* WINED3DSIH_TEXBEML */ pshader_hw_texbem, diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 517435de7dd..69ff2bcca12 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -4228,6 +4228,14 @@ static void shader_glsl_rep(const struct wined3d_shader_instruction *ins) ++loop_state->current_depth; } +static void shader_glsl_switch(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, "switch (%s)\n{\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"; @@ -8658,6 +8666,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB /* WINED3DSIH_SQRT */ shader_glsl_map2gl, /* WINED3DSIH_STORE_UAV_TYPED */ NULL, /* WINED3DSIH_SUB */ shader_glsl_binop, + /* WINED3DSIH_SWITCH */ shader_glsl_switch, /* WINED3DSIH_TEX */ shader_glsl_tex, /* WINED3DSIH_TEXBEM */ shader_glsl_texbem, /* WINED3DSIH_TEXBEML */ shader_glsl_texbem, diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index 8c41afb5b80..be124323e93 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -177,6 +177,7 @@ static const char * const shader_opcode_names[] = /* WINED3DSIH_SQRT */ "sqrt", /* WINED3DSIH_STORE_UAV_TYPED */ "store_uav_typed", /* WINED3DSIH_SUB */ "sub", + /* WINED3DSIH_SWITCH */ "switch", /* WINED3DSIH_TEX */ "texld", /* WINED3DSIH_TEXBEM */ "texbem", /* WINED3DSIH_TEXBEML */ "texbeml", diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c index 62b5d656651..ab39bf888d2 100644 --- a/dlls/wined3d/shader_sm4.c +++ b/dlls/wined3d/shader_sm4.c @@ -172,6 +172,7 @@ enum wined3d_sm4_opcode WINED3D_SM4_OP_SAMPLE_GRAD = 0x49, WINED3D_SM4_OP_SAMPLE_B = 0x4a, WINED3D_SM4_OP_SQRT = 0x4b, + WINED3D_SM4_OP_SWITCH = 0x4c, WINED3D_SM4_OP_SINCOS = 0x4d, WINED3D_SM4_OP_UDIV = 0x4e, WINED3D_SM4_OP_ULT = 0x4f, @@ -685,6 +686,7 @@ static const struct wined3d_sm4_opcode_info opcode_table[] = {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_SWITCH, WINED3DSIH_SWITCH, "", "u"}, {WINED3D_SM4_OP_SINCOS, WINED3DSIH_SINCOS, "ff", "f"}, {WINED3D_SM4_OP_UDIV, WINED3DSIH_UDIV, "uu", "uu"}, {WINED3D_SM4_OP_ULT, WINED3DSIH_ULT, "u", "uu"}, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 473a4b8ea9c..255dbd5d544 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -684,6 +684,7 @@ enum WINED3D_SHADER_INSTRUCTION_HANDLER WINED3DSIH_SQRT, WINED3DSIH_STORE_UAV_TYPED, WINED3DSIH_SUB, + WINED3DSIH_SWITCH, WINED3DSIH_TEX, WINED3DSIH_TEXBEM, WINED3DSIH_TEXBEML,