Commit db5ab971 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Store the source swizzle in struct wined3d_shader_src_param.

parent 7f58b906
...@@ -1075,9 +1075,9 @@ static void shader_hw_mov(const struct wined3d_shader_instruction *ins) ...@@ -1075,9 +1075,9 @@ static void shader_hw_mov(const struct wined3d_shader_instruction *ins)
* with more than one component. Thus replicate the first source argument over all * with more than one component. Thus replicate the first source argument over all
* 4 components. For example, .xyzw -> .x (or better: .xxxx), .zwxy -> .z, etc) */ * 4 components. For example, .xyzw -> .x (or better: .xxxx), .zwxy -> .z, etc) */
struct wined3d_shader_src_param tmp_src = ins->src[0]; struct wined3d_shader_src_param tmp_src = ins->src[0];
tmp_src.token &= ~WINED3DSP_SWIZZLE_MASK; tmp_src.swizzle = ((ins->src[0].swizzle >> WINED3DSP_SWIZZLE_SHIFT) & 0x3)
tmp_src.token |= ((ins->src[0].token >> WINED3DSP_SWIZZLE_SHIFT) & 0x3)
* (0x55 << WINED3DSP_SWIZZLE_SHIFT); * (0x55 << WINED3DSP_SWIZZLE_SHIFT);
tmp_src.token = (tmp_src.token & ~WINED3DSP_SWIZZLE_MASK) | tmp_src.swizzle;
shader_arb_add_src_param(ins, &tmp_src, src0_param); shader_arb_add_src_param(ins, &tmp_src, src0_param);
shader_addline(buffer, "ARL A0.x, %s;\n", src0_param); shader_addline(buffer, "ARL A0.x, %s;\n", src0_param);
} }
...@@ -1633,7 +1633,6 @@ static void shader_hw_mnxn(const struct wined3d_shader_instruction *ins) ...@@ -1633,7 +1633,6 @@ static void shader_hw_mnxn(const struct wined3d_shader_instruction *ins)
static void vshader_hw_rsq_rcp(const struct wined3d_shader_instruction *ins) static void vshader_hw_rsq_rcp(const struct wined3d_shader_instruction *ins)
{ {
SHADER_BUFFER *buffer = ins->ctx->buffer; SHADER_BUFFER *buffer = ins->ctx->buffer;
DWORD swizzle = (ins->src[0].token & WINED3DSP_SWIZZLE_MASK) >> WINED3DSP_SWIZZLE_SHIFT;
const char *instruction; const char *instruction;
char tmpLine[256]; char tmpLine[256];
...@@ -1651,7 +1650,8 @@ static void vshader_hw_rsq_rcp(const struct wined3d_shader_instruction *ins) ...@@ -1651,7 +1650,8 @@ static void vshader_hw_rsq_rcp(const struct wined3d_shader_instruction *ins)
shader_arb_add_dst_param(ins, &ins->dst[0], tmpLine); /* Destination */ shader_arb_add_dst_param(ins, &ins->dst[0], tmpLine); /* Destination */
strcat(tmpLine, ","); strcat(tmpLine, ",");
shader_arb_add_src_param(ins, &ins->src[0], tmpLine); shader_arb_add_src_param(ins, &ins->src[0], tmpLine);
if ((WINED3DSP_NOSWIZZLE >> WINED3DSP_SWIZZLE_SHIFT) == swizzle) { if (ins->src[0].swizzle == WINED3DSP_NOSWIZZLE)
{
/* Dx sdk says .x is used if no swizzle is given, but our test shows that /* Dx sdk says .x is used if no swizzle is given, but our test shows that
* .w is used * .w is used
*/ */
......
...@@ -245,6 +245,7 @@ static void shader_parse_src_param(DWORD param, const struct wined3d_shader_src_ ...@@ -245,6 +245,7 @@ static void shader_parse_src_param(DWORD param, const struct wined3d_shader_src_
src->register_type = ((param & WINED3DSP_REGTYPE_MASK) >> WINED3DSP_REGTYPE_SHIFT) src->register_type = ((param & WINED3DSP_REGTYPE_MASK) >> WINED3DSP_REGTYPE_SHIFT)
| ((param & WINED3DSP_REGTYPE_MASK2) >> WINED3DSP_REGTYPE_SHIFT2); | ((param & WINED3DSP_REGTYPE_MASK2) >> WINED3DSP_REGTYPE_SHIFT2);
src->register_idx = param & WINED3DSP_REGNUM_MASK; src->register_idx = param & WINED3DSP_REGNUM_MASK;
src->swizzle = param & WINED3DSP_SWIZZLE_MASK;
src->modifiers = param & WINED3DSP_SRCMOD_MASK; src->modifiers = param & WINED3DSP_SRCMOD_MASK;
src->rel_addr = rel_addr; src->rel_addr = rel_addr;
src->token = param; src->token = param;
......
...@@ -1946,7 +1946,7 @@ static void shader_glsl_cmp(const struct wined3d_shader_instruction *ins) ...@@ -1946,7 +1946,7 @@ static void shader_glsl_cmp(const struct wined3d_shader_instruction *ins)
write_mask = 0; write_mask = 0;
/* Find the destination channels which use the current source0 channel */ /* Find the destination channels which use the current source0 channel */
for (j=0; j<4; j++) { for (j=0; j<4; j++) {
if (((ins->src[0].token >> (WINED3DSP_SWIZZLE_SHIFT + 2 * j)) & 0x3) == i) if (((ins->src[0].swizzle >> (WINED3DSP_SWIZZLE_SHIFT + 2 * j)) & 0x3) == i)
{ {
write_mask |= WINED3DSP_WRITEMASK_0 << j; write_mask |= WINED3DSP_WRITEMASK_0 << j;
cmp_channel = WINED3DSP_WRITEMASK_0 << j; cmp_channel = WINED3DSP_WRITEMASK_0 << j;
...@@ -2028,7 +2028,7 @@ static void shader_glsl_cnd(const struct wined3d_shader_instruction *ins) ...@@ -2028,7 +2028,7 @@ static void shader_glsl_cnd(const struct wined3d_shader_instruction *ins)
write_mask = 0; write_mask = 0;
/* Find the destination channels which use the current source0 channel */ /* Find the destination channels which use the current source0 channel */
for (j=0; j<4; j++) { for (j=0; j<4; j++) {
if (((ins->src[0].token >> (WINED3DSP_SWIZZLE_SHIFT + 2 * j)) & 0x3) == i) if (((ins->src[0].swizzle >> (WINED3DSP_SWIZZLE_SHIFT + 2 * j)) & 0x3) == i)
{ {
write_mask |= WINED3DSP_WRITEMASK_0 << j; write_mask |= WINED3DSP_WRITEMASK_0 << j;
cmp_channel = WINED3DSP_WRITEMASK_0 << j; cmp_channel = WINED3DSP_WRITEMASK_0 << j;
...@@ -2469,7 +2469,7 @@ static void pshader_glsl_tex(const struct wined3d_shader_instruction *ins) ...@@ -2469,7 +2469,7 @@ static void pshader_glsl_tex(const struct wined3d_shader_instruction *ins)
mask |= sample_function.coord_mask; mask |= sample_function.coord_mask;
if (shader_version < WINED3DPS_VERSION(2,0)) swizzle = WINED3DVS_NOSWIZZLE; if (shader_version < WINED3DPS_VERSION(2,0)) swizzle = WINED3DVS_NOSWIZZLE;
else swizzle = ins->src[1].token & WINED3DSP_SWIZZLE_MASK; else swizzle = ins->src[1].swizzle;
/* 1.0-1.3: Use destination register as coordinate source. /* 1.0-1.3: Use destination register as coordinate source.
1.4+: Use provided coordinate source register. */ 1.4+: Use provided coordinate source register. */
...@@ -2504,7 +2504,7 @@ static void shader_glsl_texldl(const struct wined3d_shader_instruction *ins) ...@@ -2504,7 +2504,7 @@ static void shader_glsl_texldl(const struct wined3d_shader_instruction *ins)
DWORD sample_flags = WINED3D_GLSL_SAMPLE_LOD; DWORD sample_flags = WINED3D_GLSL_SAMPLE_LOD;
DWORD sampler_type; DWORD sampler_type;
DWORD sampler_idx; DWORD sampler_idx;
DWORD swizzle = ins->src[1].token & WINED3DSP_SWIZZLE_MASK; DWORD swizzle = ins->src[1].swizzle;
sampler_idx = ins->src[1].register_idx; sampler_idx = ins->src[1].register_idx;
sampler_type = ins->ctx->reg_maps->samplers[sampler_idx] & WINED3DSP_TEXTURETYPE_MASK; sampler_type = ins->ctx->reg_maps->samplers[sampler_idx] & WINED3DSP_TEXTURETYPE_MASK;
......
...@@ -465,6 +465,7 @@ struct wined3d_shader_src_param ...@@ -465,6 +465,7 @@ struct wined3d_shader_src_param
{ {
WINED3DSHADER_PARAM_REGISTER_TYPE register_type; WINED3DSHADER_PARAM_REGISTER_TYPE register_type;
UINT register_idx; UINT register_idx;
DWORD swizzle;
DWORD modifiers; DWORD modifiers;
const struct wined3d_shader_src_param *rel_addr; const struct wined3d_shader_src_param *rel_addr;
DWORD token; DWORD token;
......
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