[WINED3D 1/3] Fix DEF instructions in GLSL for non-Nvidia platforms.

Jason Green jave27 at gmail.com
Mon Jun 19 16:53:13 CDT 2006


- NVidia allows "const vec4 = {1.0, 2.0, 3.0, 4.0};", even though
that's not part of the spec.
- It should be  "const vec4 = vecr4(1.0, 2.0, 3.0, 4.0);"
- This patch fixes this for D3DSIO_DEF and D3DSIO_DEFI
-------------- next part --------------
From nobody Mon Sep 17 00:00:00 2001
From: Jason <jason at jave02.(none)>
Date: Sat, 17 Jun 2006 15:57:41 -0400
Subject: [PATCH 1/4] Fix DEF instructions in GLSL for non-Nvidia platforms.

- NVidia allows "const vec4 = {1.0, 2.0, 3.0, 4.0};", even though that's not part of the spec.
- It should be  "const vec4 = vecr4(1.0, 2.0, 3.0, 4.0);"
- This patch fixes this for D3DSIO_DEF and D3DSIO_DEFI

---

 dlls/wined3d/glsl_shader.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

6f4ecd19237038a24986cca59ffe1d7ddc029ee8
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 75bd53d..ac1ddad 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -1061,7 +1061,7 @@ void shader_glsl_def(SHADER_OPCODE_ARG* 
     const char* prefix = pshader? "PC":"VC";
 
     shader_addline(arg->buffer, 
-                   "const vec4 %s%lu = { %f, %f, %f, %f };\n", prefix, reg,
+                   "const vec4 %s%lu = vec4(%f, %f, %f, %f);\n", prefix, reg,
                    *((const float *)(arg->src + 0)),
                    *((const float *)(arg->src + 1)),
                    *((const float *)(arg->src + 2)),
@@ -1077,7 +1077,7 @@ void shader_glsl_defi(SHADER_OPCODE_ARG*
     DWORD reg = arg->dst & D3DSP_REGNUM_MASK;
 
     shader_addline(arg->buffer, 
-                   "const ivec4 I%lu = { %ld, %ld, %ld, %ld };\n", reg,
+                   "const ivec4 I%lu = ivec4(%ld, %ld, %ld, %ld);\n", reg,
                    (long)arg->src[0], (long)arg->src[1],
                    (long)arg->src[2], (long)arg->src[3]);
 
-- 
1.3.3


More information about the wine-patches mailing list