wined3d: Avoid using an implicit value to set fogcoord to 0.0.

Francois Gouget fgouget at
Thu Apr 23 09:03:12 CDT 2009

This gets FlatOut2 to start on my Intel 945GME card and fixes bug 17528.

This patch was suggested by Stefan Doesinger:

Probably we stepped on the driver's toe and forced it to use a shader 
constant for its own use. The only line I can imagine is this one:

shader_addline(buffer, "MOV result.fogcoord, 0.0;\n");

0.0 may require a constant to load the immediate value. What happens if 
you comment out this line? There are alternative ways to say "0.0" that 
doesn't need an implicit value, for example

shader_addline(buffer, MOV result.fogcoord, helper_const.w;\n");

Since helper_const = { 2.0, -1.0, XX.0, 0.0 }

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

diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 9b56958..06a2ebc 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -2125,7 +2125,7 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShader *iface, SHADER_BU
     if(args->fog_src == VS_FOG_Z) {
         shader_addline(buffer, "MOV result.fogcoord, TMP_OUT.z;\n");
     } else if (!reg_maps->fog) {
-        shader_addline(buffer, "MOV result.fogcoord, 0.0;\n");
+        shader_addline(buffer, "MOV result.fogcoord, helper_const.w;\n");
     /* Write the final position.

More information about the wine-patches mailing list