[04/49] wined3d: Fixup the write mask for gl_FogFragCoord and gl_PointSize

H. Verbeet hverbeet at gmail.com
Mon Jan 15 12:30:35 CST 2007


gl_FogFragCoord and gl_PointSize are floats rather than vec4s in GLSL,
so they shouldn't have a destination swizzle, and the write mask we
return should consist of only the first component.
-------------- next part --------------
---

 dlls/wined3d/glsl_shader.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 7d88e0e..51c7d32 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -725,12 +725,17 @@ static DWORD shader_glsl_get_write_mask(const DWORD param, char *write_mask) {
     char *ptr = write_mask;
     DWORD mask = param & WINED3DSP_WRITEMASK_ALL;
 
-    if (mask != WINED3DSP_WRITEMASK_ALL) {
-        *ptr++ = '.';
-        if (param & WINED3DSP_WRITEMASK_0) *ptr++ = 'x';
-        if (param & WINED3DSP_WRITEMASK_1) *ptr++ = 'y';
-        if (param & WINED3DSP_WRITEMASK_2) *ptr++ = 'z';
-        if (param & WINED3DSP_WRITEMASK_3) *ptr++ = 'w';
+    /* gl_FogFragCoord and glPointSize are floats, fixup the write mask. */
+    if ((shader_get_regtype(param) == WINED3DSPR_RASTOUT) && ((param & WINED3DSP_REGNUM_MASK) != 0)) {
+        mask = WINED3DSP_WRITEMASK_0;
+    } else {
+        if (mask != WINED3DSP_WRITEMASK_ALL) {
+            *ptr++ = '.';
+            if (param & WINED3DSP_WRITEMASK_0) *ptr++ = 'x';
+            if (param & WINED3DSP_WRITEMASK_1) *ptr++ = 'y';
+            if (param & WINED3DSP_WRITEMASK_2) *ptr++ = 'z';
+            if (param & WINED3DSP_WRITEMASK_3) *ptr++ = 'w';
+        }
     }
 
     *ptr = '\0';


More information about the wine-patches mailing list