wined3d: Store the write mask in struct wined3d_shader_dst_param.

This commit is contained in:
Henri Verbeet 2009-04-07 11:09:11 +02:00 committed by Alexandre Julliard
parent 215fd0b813
commit 6f66c1ddbd
4 changed files with 13 additions and 9 deletions

View File

@ -688,7 +688,7 @@ static void shader_hw_sample(const struct wined3d_shader_instruction *ins, DWORD
if (shader_is_pshader_version(ins->reg_maps->shader_version)) if (shader_is_pshader_version(ins->reg_maps->shader_version))
{ {
IWineD3DPixelShaderImpl *ps = (IWineD3DPixelShaderImpl *)ins->shader; IWineD3DPixelShaderImpl *ps = (IWineD3DPixelShaderImpl *)ins->shader;
gen_color_correction(buffer, dst_str, ins->dst[0].token & WINED3DSP_WRITEMASK_ALL, gen_color_correction(buffer, dst_str, ins->dst[0].write_mask,
"one", "coefmul.x", ps->cur_args->color_fixup[sampler_idx]); "one", "coefmul.x", ps->cur_args->color_fixup[sampler_idx]);
} }
} }
@ -1584,10 +1584,10 @@ static void shader_hw_mnxn(const struct wined3d_shader_instruction *ins)
break; break;
} }
tmp_dst = ins->dst[0];
for (i = 0; i < nComponents; i++) { for (i = 0; i < nComponents; i++) {
tmp_dst.register_idx = ins->dst[0].register_idx; tmp_dst.write_mask = WINED3DSP_WRITEMASK_0 << i;
tmp_dst.modifiers = ins->dst[0].modifiers; tmp_dst.token = (tmp_dst.token & ~WINED3DSP_WRITEMASK_ALL) | tmp_dst.write_mask;
tmp_dst.token = ((ins->dst[0].token) & ~WINED3DSP_WRITEMASK_ALL) | (WINED3DSP_WRITEMASK_0 << i);
tmp_ins.src[1] = ins->src[1]+i; tmp_ins.src[1] = ins->src[1]+i;
shader_hw_map2gl(&tmp_ins); shader_hw_map2gl(&tmp_ins);
} }

View File

@ -851,6 +851,7 @@ void shader_generate_main(IWineD3DBaseShader *iface, SHADER_BUFFER* buffer,
dst_param.addr_token = 0; dst_param.addr_token = 0;
pToken += shader_get_param(pToken, shader_version, &dst_param.token, &dst_param.addr_token); pToken += shader_get_param(pToken, shader_version, &dst_param.token, &dst_param.addr_token);
dst_param.register_idx = dst_param.token & WINED3DSP_REGNUM_MASK; dst_param.register_idx = dst_param.token & WINED3DSP_REGNUM_MASK;
dst_param.write_mask = dst_param.token & WINED3DSP_WRITEMASK_ALL;
dst_param.modifiers = dst_param.token & WINED3DSP_DSTMOD_MASK; dst_param.modifiers = dst_param.token & WINED3DSP_DSTMOD_MASK;
} }

View File

@ -1446,7 +1446,7 @@ static void shader_glsl_color_correction(const struct wined3d_shader_instruction
if (fixup.y_sign_fixup || fixup.y_source != CHANNEL_SOURCE_Y) mask |= WINED3DSP_WRITEMASK_1; if (fixup.y_sign_fixup || fixup.y_source != CHANNEL_SOURCE_Y) mask |= WINED3DSP_WRITEMASK_1;
if (fixup.z_sign_fixup || fixup.z_source != CHANNEL_SOURCE_Z) mask |= WINED3DSP_WRITEMASK_2; if (fixup.z_sign_fixup || fixup.z_source != CHANNEL_SOURCE_Z) mask |= WINED3DSP_WRITEMASK_2;
if (fixup.w_sign_fixup || fixup.w_source != CHANNEL_SOURCE_W) mask |= WINED3DSP_WRITEMASK_3; if (fixup.w_sign_fixup || fixup.w_source != CHANNEL_SOURCE_W) mask |= WINED3DSP_WRITEMASK_3;
mask &= ins->dst[0].token; mask &= ins->dst[0].write_mask;
if (!mask) return; /* Nothing to do */ if (!mask) return; /* Nothing to do */
@ -1509,7 +1509,7 @@ static void PRINTF_ATTR(6, 7) shader_glsl_gen_sample_code(const struct wined3d_s
BOOL rect_fixup = FALSE; BOOL rect_fixup = FALSE;
va_list args; va_list args;
shader_glsl_get_swizzle(swizzle, FALSE, ins->dst[0].token, dst_swizzle); shader_glsl_get_swizzle(swizzle, FALSE, ins->dst[0].write_mask, dst_swizzle);
if (shader_is_pshader_version(ins->reg_maps->shader_version)) if (shader_is_pshader_version(ins->reg_maps->shader_version))
{ {
@ -1947,6 +1947,7 @@ static void shader_glsl_cmp(const struct wined3d_shader_instruction *ins)
temp_destination = TRUE; temp_destination = TRUE;
} else { } else {
struct wined3d_shader_dst_param dst = ins->dst[0]; struct wined3d_shader_dst_param dst = ins->dst[0];
dst.write_mask &= write_mask;
dst.token &= ~WINED3DSP_WRITEMASK_ALL | write_mask; dst.token &= ~WINED3DSP_WRITEMASK_ALL | write_mask;
write_mask = shader_glsl_append_dst_ext(ins->buffer, ins, &dst); write_mask = shader_glsl_append_dst_ext(ins->buffer, ins, &dst);
if (!write_mask) continue; if (!write_mask) continue;
@ -2010,6 +2011,7 @@ static void shader_glsl_cnd(const struct wined3d_shader_instruction *ins)
} }
} }
dst = ins->dst[0]; dst = ins->dst[0];
dst.write_mask &= write_mask;
dst.token &= ~WINED3DSP_WRITEMASK_ALL | write_mask; dst.token &= ~WINED3DSP_WRITEMASK_ALL | write_mask;
write_mask = shader_glsl_append_dst_ext(ins->buffer, ins, &dst); write_mask = shader_glsl_append_dst_ext(ins->buffer, ins, &dst);
if (!write_mask) continue; if (!write_mask) continue;
@ -2087,11 +2089,11 @@ static void shader_glsl_mnxn(const struct wined3d_shader_instruction *ins)
break; break;
} }
tmp_dst = ins->dst[0];
for (i = 0; i < nComponents; ++i) for (i = 0; i < nComponents; ++i)
{ {
tmp_dst.register_idx = ins->dst[0].register_idx; tmp_dst.write_mask = WINED3DSP_WRITEMASK_0 << i;
tmp_dst.modifiers = ins->dst[0].modifiers; tmp_dst.token = (tmp_dst.token & ~WINED3DSP_WRITEMASK_ALL) | tmp_dst.write_mask;
tmp_dst.token = ((ins->dst[0].token) & ~WINED3DSP_WRITEMASK_ALL) | (WINED3DSP_WRITEMASK_0 << i);
tmp_ins.src[1] = ins->src[1] + i; tmp_ins.src[1] = ins->src[1] + i;
shader_glsl_dot(&tmp_ins); shader_glsl_dot(&tmp_ins);
} }

View File

@ -453,6 +453,7 @@ typedef struct SHADER_OPCODE
struct wined3d_shader_dst_param struct wined3d_shader_dst_param
{ {
UINT register_idx; UINT register_idx;
DWORD write_mask;
DWORD modifiers; DWORD modifiers;
DWORD token; DWORD token;
DWORD addr_token; DWORD addr_token;