Commit 02114ac2 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: The D3DSI_COISSUE flag changes the behavior of cnd.

parent 8273cfdf
......@@ -572,6 +572,7 @@ void pshader_hw_bem(SHADER_OPCODE_ARG* arg) {
void pshader_hw_cnd(SHADER_OPCODE_ARG* arg) {
IWineD3DBaseShaderImpl* shader = (IWineD3DBaseShaderImpl*) arg->shader;
SHADER_BUFFER* buffer = arg->buffer;
char dst_wmask[20];
char dst_name[50];
......@@ -589,8 +590,14 @@ void pshader_hw_cnd(SHADER_OPCODE_ARG* arg) {
pshader_gen_input_modifier_line(buffer, arg->src[1], 1, src_name[1]);
pshader_gen_input_modifier_line(buffer, arg->src[2], 2, src_name[2]);
shader_addline(buffer, "ADD TMP, -%s, coefdiv.x;\n", src_name[0]);
shader_addline(buffer, "CMP %s, TMP, %s, %s;\n", dst_name, src_name[1], src_name[2]);
/* The coissue flag changes the semantic of the cnd instruction in <= 1.3 shaders */
if (shader->baseShader.hex_version <= WINED3DPS_VERSION(1, 3) &&
arg->opcode_token & WINED3DSI_COISSUE) {
shader_addline(buffer, "MOV %s, %s;\n", dst_name, src_name[1]);
} else {
shader_addline(buffer, "ADD TMP, -%s, coefdiv.x;\n", src_name[0]);
shader_addline(buffer, "CMP %s, TMP, %s, %s;\n", dst_name, src_name[1], src_name[2]);
}
}
void pshader_hw_cmp(SHADER_OPCODE_ARG* arg) {
......
......@@ -949,6 +949,10 @@ void shader_trace_init(
shader_dump_param(iface, *(pToken + 2), 0, 1);
TRACE(") ");
}
if (opcode_token & WINED3DSI_COISSUE) {
/* PixWin marks instructions with the coissue flag with a '+' */
TRACE("+");
}
TRACE("%s", curOpcode->name);
......
......@@ -1303,8 +1303,14 @@ void shader_glsl_cnd(SHADER_OPCODE_ARG* arg) {
shader_glsl_add_src_param(arg, arg->src[0], arg->src_addr[0], WINED3DSP_WRITEMASK_0, &src0_param);
shader_glsl_add_src_param(arg, arg->src[1], arg->src_addr[1], write_mask, &src1_param);
shader_glsl_add_src_param(arg, arg->src[2], arg->src_addr[2], write_mask, &src2_param);
shader_addline(arg->buffer, "%s > 0.5 ? %s : %s);\n",
src0_param.param_str, src1_param.param_str, src2_param.param_str);
/* Fun: The D3DSI_COISSUE flag changes the semantic of the cnd instruction for < 1.4 shaders */
if(arg->opcode_token & WINED3DSI_COISSUE) {
shader_addline(arg->buffer, "%s /* COISSUE! */);\n", src1_param.param_str);
} else {
shader_addline(arg->buffer, "%s > 0.5 ? %s : %s);\n",
src0_param.param_str, src1_param.param_str, src2_param.param_str);
}
return;
}
/* Cycle through all source0 channels */
......
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