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

2007-04-12 Thread Ivan Gyurdiev

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).


Ivan











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

2007-04-12 Thread Ivan Gyurdiev
Here is how this was meant to work at some point [ since I see all kinds 
of incorrect things being done ]:


  Entry point Code generation
  ==

  Pixelshader  Baseshader --- ARB backend
  Vertexshader ---  --- GLSL backend

  Code should be moving towards the center from both directions.
  Vertex and pixelshader: Should contain minimum amount of things
  Baseshader: Should contain anything backend [ and frontend ] 
independent. I think it's acceptable to put some things that are 
frontend-dependent in baseshader, as long as they can be written in a 
generic way, without tons of (if (pshader) do_x else if (vshader) do_y 
statements).


  Pass 0: Tracing: 100% done in baseshader.

  Pass 1: Register tracking: 100% done in baseshader.

  Pass 2: Backend independent gen code: In baseshader
 [ this includes the opcode loop, and all parsing of the shader asm ]

  Pass 2: Backend dependent gen code: In ARB or GLSL files
 [ ideally should work with pre-processed shader asm, and broken 
out tokens

   - a sort of an intermediate representation if you prefer ]





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

2007-04-12 Thread H. Verbeet

On 12/04/07, Ivan Gyurdiev [EMAIL PROTECTED] wrote:

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.


It should probably go into shader_get_registers_used() in
baseshader.c, where we fill semantics_out, around line 255.