Commit 849b16b8 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

wined3d: Implement SM4 retc instruction.

parent 14dd2026
......@@ -5195,6 +5195,7 @@ static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABL
/* WINED3DSIH_REP */ shader_hw_rep,
/* WINED3DSIH_RESINFO */ NULL,
/* WINED3DSIH_RET */ shader_hw_ret,
/* WINED3DSIH_RETP */ NULL,
/* WINED3DSIH_ROUND_NE */ NULL,
/* WINED3DSIH_ROUND_NI */ NULL,
/* WINED3DSIH_ROUND_PI */ NULL,
......
......@@ -5014,13 +5014,23 @@ static void shader_glsl_breakc(const struct wined3d_shader_instruction *ins)
src0_param.param_str, shader_glsl_get_rel_op(ins->flags), src1_param.param_str);
}
static void shader_glsl_breakp(const struct wined3d_shader_instruction *ins)
static void shader_glsl_conditional_op(const struct wined3d_shader_instruction *ins)
{
const char *condition = (ins->flags == WINED3D_SHADER_CONDITIONAL_OP_NZ) ? "bool" : "!bool";
struct glsl_src_param src_param;
const char *op;
switch (ins->handler_idx)
{
case WINED3DSIH_BREAKP: op = "break"; break;
case WINED3DSIH_RETP: op = "return"; break;
default:
ERR("Unhandled opcode %#x.\n", ins->handler_idx);
return;
}
shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_0, &src_param);
shader_addline(ins->ctx->buffer, "if (%s(%s)) break;\n", condition, src_param.param_str);
shader_addline(ins->ctx->buffer, "if (%s(%s)) %s;\n", condition, src_param.param_str, op);
}
static void shader_glsl_continue(const struct wined3d_shader_instruction *ins)
......@@ -9968,7 +9978,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB
/* WINED3DSIH_BFREV */ shader_glsl_map2gl,
/* WINED3DSIH_BREAK */ shader_glsl_break,
/* WINED3DSIH_BREAKC */ shader_glsl_breakc,
/* WINED3DSIH_BREAKP */ shader_glsl_breakp,
/* WINED3DSIH_BREAKP */ shader_glsl_conditional_op,
/* WINED3DSIH_BUFINFO */ shader_glsl_bufinfo,
/* WINED3DSIH_CALL */ shader_glsl_call,
/* WINED3DSIH_CALLNZ */ shader_glsl_callnz,
......@@ -10126,6 +10136,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB
/* WINED3DSIH_REP */ shader_glsl_rep,
/* WINED3DSIH_RESINFO */ shader_glsl_resinfo,
/* WINED3DSIH_RET */ shader_glsl_ret,
/* WINED3DSIH_RETP */ shader_glsl_conditional_op,
/* WINED3DSIH_ROUND_NE */ shader_glsl_map2gl,
/* WINED3DSIH_ROUND_NI */ shader_glsl_map2gl,
/* WINED3DSIH_ROUND_PI */ shader_glsl_map2gl,
......
......@@ -215,6 +215,7 @@ static const char * const shader_opcode_names[] =
/* WINED3DSIH_REP */ "rep",
/* WINED3DSIH_RESINFO */ "resinfo",
/* WINED3DSIH_RET */ "ret",
/* WINED3DSIH_RETP */ "retp",
/* WINED3DSIH_ROUND_NE */ "round_ne",
/* WINED3DSIH_ROUND_NI */ "round_ni",
/* WINED3DSIH_ROUND_PI */ "round_pi",
......@@ -2739,7 +2740,8 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe
shader_addline(&buffer, "%s", shader_opcode_names[ins.handler_idx]);
if (ins.handler_idx == WINED3DSIH_BREAKP
|| ins.handler_idx == WINED3DSIH_IF)
|| ins.handler_idx == WINED3DSIH_IF
|| ins.handler_idx == WINED3DSIH_RETP)
{
switch (ins.flags)
{
......
......@@ -174,6 +174,7 @@ enum wined3d_sm4_opcode
WINED3D_SM4_OP_OR = 0x3c,
WINED3D_SM4_OP_RESINFO = 0x3d,
WINED3D_SM4_OP_RET = 0x3e,
WINED3D_SM4_OP_RETC = 0x3f,
WINED3D_SM4_OP_ROUND_NE = 0x40,
WINED3D_SM4_OP_ROUND_NI = 0x41,
WINED3D_SM4_OP_ROUND_PI = 0x42,
......@@ -891,6 +892,8 @@ static const struct wined3d_sm4_opcode_info opcode_table[] =
{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_RETC, WINED3DSIH_RETP, "", "u",
shader_sm4_read_conditional_op},
{WINED3D_SM4_OP_ROUND_NE, WINED3DSIH_ROUND_NE, "f", "f"},
{WINED3D_SM4_OP_ROUND_NI, WINED3DSIH_ROUND_NI, "f", "f"},
{WINED3D_SM4_OP_ROUND_PI, WINED3DSIH_ROUND_PI, "f", "f"},
......
......@@ -831,6 +831,7 @@ enum WINED3D_SHADER_INSTRUCTION_HANDLER
WINED3DSIH_REP,
WINED3DSIH_RESINFO,
WINED3DSIH_RET,
WINED3DSIH_RETP,
WINED3DSIH_ROUND_NE,
WINED3DSIH_ROUND_NI,
WINED3DSIH_ROUND_PI,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment