From: Józef Kucia Subject: [PATCH 4/8] wined3d: Handle SM4 breakc instruction modifiers. Message-Id: <1464166285-21332-4-git-send-email-jkucia@codeweavers.com> Date: Wed, 25 May 2016 10:51:21 +0200 In-Reply-To: <1464166285-21332-1-git-send-email-jkucia@codeweavers.com> References: <1464166285-21332-1-git-send-email-jkucia@codeweavers.com> Signed-off-by: Józef Kucia --- dlls/wined3d/glsl_shader.c | 3 ++- dlls/wined3d/shader.c | 3 ++- dlls/wined3d/shader_sm4.c | 7 ++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 98d179e..898cabf 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -4207,10 +4207,11 @@ static void shader_glsl_breakc(const struct wined3d_shader_instruction *ins) static void shader_glsl_breakp(const struct wined3d_shader_instruction *ins) { + const char *condition = (ins->flags == WINED3D_SHADER_CONDITIONAL_OP_NZ) ? "bool" : "!bool"; struct glsl_src_param src_param; shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_0, &src_param); - shader_addline(ins->ctx->buffer, "if (bool(%s)) break;\n", src_param.param_str); + shader_addline(ins->ctx->buffer, "if (%s(%s)) break;\n", condition, src_param.param_str); } static void shader_glsl_label(const struct wined3d_shader_instruction *ins) diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index b410277..ef2f70b 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -2259,7 +2259,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_IF) + if (ins.handler_idx == WINED3DSIH_BREAKP + || ins.handler_idx == WINED3DSIH_IF) { switch (ins.flags) { diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c index 96ea274..eb8e4e5 100644 --- a/dlls/wined3d/shader_sm4.c +++ b/dlls/wined3d/shader_sm4.c @@ -381,7 +381,7 @@ static BOOL shader_sm4_read_src_param(struct wined3d_sm4_data *priv, const DWORD static BOOL shader_sm4_read_dst_param(struct wined3d_sm4_data *priv, const DWORD **ptr, enum wined3d_data_type data_type, struct wined3d_shader_dst_param *dst_param); -static void shader_sm4_read_if(struct wined3d_shader_instruction *ins, +static void shader_sm4_read_conditional_op(struct wined3d_shader_instruction *ins, DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count, struct wined3d_sm4_data *priv) { @@ -618,7 +618,8 @@ 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_BREAKC, WINED3DSIH_BREAKP, "", "u", + shader_sm4_read_conditional_op}, {WINED3D_SM4_OP_CUT, WINED3DSIH_CUT, "", ""}, {WINED3D_SM4_OP_DERIV_RTX, WINED3DSIH_DSX, "f", "f"}, {WINED3D_SM4_OP_DERIV_RTY, WINED3DSIH_DSY, "f", "f"}, @@ -639,7 +640,7 @@ static const struct wined3d_sm4_opcode_info opcode_table[] = {WINED3D_SM4_OP_GE, WINED3DSIH_GE, "u", "ff"}, {WINED3D_SM4_OP_IADD, WINED3DSIH_IADD, "i", "ii"}, {WINED3D_SM4_OP_IF, WINED3DSIH_IF, "", "u", - shader_sm4_read_if}, + shader_sm4_read_conditional_op}, {WINED3D_SM4_OP_IEQ, WINED3DSIH_IEQ, "u", "ii"}, {WINED3D_SM4_OP_IGE, WINED3DSIH_IGE, "u", "ii"}, {WINED3D_SM4_OP_ILT, WINED3DSIH_ILT, "u", "ii"}, -- 2.7.3