H. Verbeet : wined3d: Fix some swizzles on scalars.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Apr 13 06:50:16 CDT 2007
Module: wine
Branch: master
Commit: a79654d339fa2482ccdc121dfb5960e8e600a128
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a79654d339fa2482ccdc121dfb5960e8e600a128
Author: H. Verbeet <hverbeet at gmail.com>
Date: Thu Apr 12 23:55:31 2007 +0200
wined3d: Fix some swizzles on scalars.
---
dlls/wined3d/glsl_shader.c | 19 +++++++++----------
dlls/wined3d/wined3d_private.h | 24 ++++++++++++++++++++++++
2 files changed, 33 insertions(+), 10 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 5700902..f6d55d1 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -703,11 +703,8 @@ static void shader_glsl_get_register_name(
static DWORD shader_glsl_get_write_mask(const DWORD param, char *write_mask) {
char *ptr = write_mask;
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 (((reg_type == WINED3DSPR_RASTOUT) && ((param & WINED3DSP_REGNUM_MASK) != 0))
- || reg_type == WINED3DSPR_DEPTHOUT) {
+ if (shader_is_scalar(param)) {
mask = WINED3DSP_WRITEMASK_0;
} else {
*ptr++ = '.';
@@ -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";
char *ptr = swizzle_str;
- *ptr++ = '.';
- /* swizzle bits fields: wwzzyyxx */
- if (mask & WINED3DSP_WRITEMASK_0) *ptr++ = swizzle_chars[swizzle & 0x03];
- if (mask & WINED3DSP_WRITEMASK_1) *ptr++ = swizzle_chars[(swizzle >> 2) & 0x03];
- if (mask & WINED3DSP_WRITEMASK_2) *ptr++ = swizzle_chars[(swizzle >> 4) & 0x03];
- if (mask & WINED3DSP_WRITEMASK_3) *ptr++ = swizzle_chars[(swizzle >> 6) & 0x03];
+ if (!shader_is_scalar(param)) {
+ *ptr++ = '.';
+ /* swizzle bits fields: wwzzyyxx */
+ if (mask & WINED3DSP_WRITEMASK_0) *ptr++ = swizzle_chars[swizzle & 0x03];
+ if (mask & WINED3DSP_WRITEMASK_1) *ptr++ = swizzle_chars[(swizzle >> 2) & 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';
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index d0da532..0d3ef84 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1847,6 +1847,30 @@ static inline BOOL shader_is_comment(DWORD token) {
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,
* so upload them above that
*/
More information about the wine-cvs
mailing list