Commit a79654d3 authored by H. Verbeet's avatar H. Verbeet Committed by Alexandre Julliard

wined3d: Fix some swizzles on scalars.

parent 5c19285d
...@@ -703,11 +703,8 @@ static void shader_glsl_get_register_name( ...@@ -703,11 +703,8 @@ static void shader_glsl_get_register_name(
static DWORD shader_glsl_get_write_mask(const DWORD param, char *write_mask) { static DWORD shader_glsl_get_write_mask(const DWORD param, char *write_mask) {
char *ptr = write_mask; char *ptr = write_mask;
DWORD mask = param & WINED3DSP_WRITEMASK_ALL; DWORD mask = param & WINED3DSP_WRITEMASK_ALL;
DWORD reg_type = shader_get_regtype(param);
/* gl_FogFragCoord, gl_PointSize and gl_FragDepth are floats, fixup the write mask. */ if (shader_is_scalar(param)) {
if (((reg_type == WINED3DSPR_RASTOUT) && ((param & WINED3DSP_REGNUM_MASK) != 0))
|| reg_type == WINED3DSPR_DEPTHOUT) {
mask = WINED3DSP_WRITEMASK_0; mask = WINED3DSP_WRITEMASK_0;
} else { } else {
*ptr++ = '.'; *ptr++ = '.';
...@@ -741,12 +738,14 @@ static void shader_glsl_get_swizzle(const DWORD param, BOOL fixup, DWORD mask, c ...@@ -741,12 +738,14 @@ static void shader_glsl_get_swizzle(const DWORD param, BOOL fixup, DWORD mask, c
const char *swizzle_chars = fixup ? "zyxw" : "xyzw"; const char *swizzle_chars = fixup ? "zyxw" : "xyzw";
char *ptr = swizzle_str; char *ptr = swizzle_str;
*ptr++ = '.'; if (!shader_is_scalar(param)) {
/* swizzle bits fields: wwzzyyxx */ *ptr++ = '.';
if (mask & WINED3DSP_WRITEMASK_0) *ptr++ = swizzle_chars[swizzle & 0x03]; /* swizzle bits fields: wwzzyyxx */
if (mask & WINED3DSP_WRITEMASK_1) *ptr++ = swizzle_chars[(swizzle >> 2) & 0x03]; if (mask & WINED3DSP_WRITEMASK_0) *ptr++ = swizzle_chars[swizzle & 0x03];
if (mask & WINED3DSP_WRITEMASK_2) *ptr++ = swizzle_chars[(swizzle >> 4) & 0x03]; if (mask & WINED3DSP_WRITEMASK_1) *ptr++ = swizzle_chars[(swizzle >> 2) & 0x03];
if (mask & WINED3DSP_WRITEMASK_3) *ptr++ = swizzle_chars[(swizzle >> 6) & 0x03]; if (mask & WINED3DSP_WRITEMASK_2) *ptr++ = swizzle_chars[(swizzle >> 4) & 0x03];
if (mask & WINED3DSP_WRITEMASK_3) *ptr++ = swizzle_chars[(swizzle >> 6) & 0x03];
}
*ptr = '\0'; *ptr = '\0';
} }
......
...@@ -1847,6 +1847,30 @@ static inline BOOL shader_is_comment(DWORD token) { ...@@ -1847,6 +1847,30 @@ static inline BOOL shader_is_comment(DWORD token) {
return WINED3DSIO_COMMENT == (token & WINED3DSI_OPCODE_MASK); return WINED3DSIO_COMMENT == (token & WINED3DSI_OPCODE_MASK);
} }
/* TODO: vFace (ps_3_0) */
static inline BOOL shader_is_scalar(DWORD param) {
DWORD reg_type = shader_get_regtype(param);
switch (reg_type) {
case WINED3DSPR_RASTOUT:
if ((param & WINED3DSP_REGNUM_MASK) != 0) {
/* oFog & oPts */
return TRUE;
}
/* oPos */
return FALSE;
case WINED3DSPR_DEPTHOUT: /* oDepth */
case WINED3DSPR_CONSTBOOL: /* b# */
case WINED3DSPR_LOOP: /* aL */
case WINED3DSPR_PREDICATE: /* p0 */
return TRUE;
default:
return FALSE;
}
}
/* Internally used shader constants. Applications can use constants 0 to GL_LIMITS(vshader_constantsF) - 1, /* Internally used shader constants. Applications can use constants 0 to GL_LIMITS(vshader_constantsF) - 1,
* so upload them above that * so upload them above that
*/ */
......
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