wined3d: Implement SM4 case instruction.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2016-06-03 11:33:04 +02:00 committed by Alexandre Julliard
parent ba60b0f59a
commit 7929895029
5 changed files with 14 additions and 0 deletions

View File

@ -5217,6 +5217,7 @@ static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABL
/* WINED3DSIH_BREAKP */ NULL, /* WINED3DSIH_BREAKP */ NULL,
/* WINED3DSIH_CALL */ shader_hw_call, /* WINED3DSIH_CALL */ shader_hw_call,
/* WINED3DSIH_CALLNZ */ NULL, /* WINED3DSIH_CALLNZ */ NULL,
/* WINED3DSIH_CASE */ NULL,
/* WINED3DSIH_CMP */ pshader_hw_cmp, /* WINED3DSIH_CMP */ pshader_hw_cmp,
/* WINED3DSIH_CND */ pshader_hw_cnd, /* WINED3DSIH_CND */ pshader_hw_cnd,
/* WINED3DSIH_CRS */ shader_hw_map2gl, /* WINED3DSIH_CRS */ shader_hw_map2gl,

View File

@ -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); 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) static void shader_glsl_if(const struct wined3d_shader_instruction *ins)
{ {
const char *condition = (ins->flags == WINED3D_SHADER_CONDITIONAL_OP_NZ) ? "bool" : "!bool"; 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_BREAKP */ shader_glsl_breakp,
/* WINED3DSIH_CALL */ shader_glsl_call, /* WINED3DSIH_CALL */ shader_glsl_call,
/* WINED3DSIH_CALLNZ */ shader_glsl_callnz, /* WINED3DSIH_CALLNZ */ shader_glsl_callnz,
/* WINED3DSIH_CASE */ shader_glsl_case,
/* WINED3DSIH_CMP */ shader_glsl_conditional_move, /* WINED3DSIH_CMP */ shader_glsl_conditional_move,
/* WINED3DSIH_CND */ shader_glsl_cnd, /* WINED3DSIH_CND */ shader_glsl_cnd,
/* WINED3DSIH_CRS */ shader_glsl_cross, /* WINED3DSIH_CRS */ shader_glsl_cross,

View File

@ -49,6 +49,7 @@ static const char * const shader_opcode_names[] =
/* WINED3DSIH_BREAKP */ "breakp", /* WINED3DSIH_BREAKP */ "breakp",
/* WINED3DSIH_CALL */ "call", /* WINED3DSIH_CALL */ "call",
/* WINED3DSIH_CALLNZ */ "callnz", /* WINED3DSIH_CALLNZ */ "callnz",
/* WINED3DSIH_CASE */ "case",
/* WINED3DSIH_CMP */ "cmp", /* WINED3DSIH_CMP */ "cmp",
/* WINED3DSIH_CND */ "cnd", /* WINED3DSIH_CND */ "cnd",
/* WINED3DSIH_CRS */ "crs", /* WINED3DSIH_CRS */ "crs",

View File

@ -111,6 +111,7 @@ enum wined3d_sm4_opcode
WINED3D_SM4_OP_AND = 0x01, WINED3D_SM4_OP_AND = 0x01,
WINED3D_SM4_OP_BREAK = 0x02, WINED3D_SM4_OP_BREAK = 0x02,
WINED3D_SM4_OP_BREAKC = 0x03, WINED3D_SM4_OP_BREAKC = 0x03,
WINED3D_SM4_OP_CASE = 0x06,
WINED3D_SM4_OP_CUT = 0x09, WINED3D_SM4_OP_CUT = 0x09,
WINED3D_SM4_OP_DERIV_RTX = 0x0b, WINED3D_SM4_OP_DERIV_RTX = 0x0b,
WINED3D_SM4_OP_DERIV_RTY = 0x0c, 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_BREAK, WINED3DSIH_BREAK, "", ""},
{WINED3D_SM4_OP_BREAKC, WINED3DSIH_BREAKP, "", "u", {WINED3D_SM4_OP_BREAKC, WINED3DSIH_BREAKP, "", "u",
shader_sm4_read_conditional_op}, shader_sm4_read_conditional_op},
{WINED3D_SM4_OP_CASE, WINED3DSIH_CASE, "", "u"},
{WINED3D_SM4_OP_CUT, WINED3DSIH_CUT, "", ""}, {WINED3D_SM4_OP_CUT, WINED3DSIH_CUT, "", ""},
{WINED3D_SM4_OP_DERIV_RTX, WINED3DSIH_DSX, "f", "f"}, {WINED3D_SM4_OP_DERIV_RTX, WINED3DSIH_DSX, "f", "f"},
{WINED3D_SM4_OP_DERIV_RTY, WINED3DSIH_DSY, "f", "f"}, {WINED3D_SM4_OP_DERIV_RTY, WINED3DSIH_DSY, "f", "f"},

View File

@ -556,6 +556,7 @@ enum WINED3D_SHADER_INSTRUCTION_HANDLER
WINED3DSIH_BREAKP, WINED3DSIH_BREAKP,
WINED3DSIH_CALL, WINED3DSIH_CALL,
WINED3DSIH_CALLNZ, WINED3DSIH_CALLNZ,
WINED3DSIH_CASE,
WINED3DSIH_CMP, WINED3DSIH_CMP,
WINED3DSIH_CND, WINED3DSIH_CND,
WINED3DSIH_CRS, WINED3DSIH_CRS,