wined3d: Mark vertex shader 3.0 as foggy shaders if they write out the fog coord

Ivan Gyurdiev ivg231 at
Thu Apr 12 11:38:27 CDT 2007

Fabian Bieler wrote:
> Vertex shaders are marked as 'foggy shaders' in wined3d if they write out the 
> fog coord. Previously this was not done for vertex shaders 3.0. This patch 
> corrects this problem.
Please don't do that - the design is flawed enough as it is (GLSL being 
invoked from vertexshader and such..).

The reg_maps was meant to be:
- computed in shader pass 1 [ register tracking ]
- used in shader pass 2 [ code generation ].

Here you're doing this:
- computing reg_maps at the very end of shader pass 2 [ unpack stage ]
- using this right afterwards in the calling function to set yet another 
flag (This->usesFog).

I'm not sure what needs to be done instead, since it all looks so broken...

- I would say this type of analysis about shader usage needs to go into 
pass 1 (baseshader), since it is backend independent. It's kind of 
vertex-shader specific, but we're trying to merge vertex and pixel 
shaders, and remove code from these two files, not add more of it.

- The usesFog looks like it's trying to persist information about 
register usage after the shader has been compiled for optimization 
purposes...except that this information is already persisted - if you 
look in baseshader, you will see the entire reg_maps structure is kept 
in there, exactly for that purpose [ was done for software shaders 
actually, but that never happened ].

- Also, other code outside the shaders should not be accessing these 
flags directly - there should be a function which looks inside the 
reg_maps, and code from other file should call that function (we are 
emulating OOP programming in C, so we should try to use encapsulation).


More information about the wine-devel mailing list