WineD3D: Sample from the correct source when using older pixel shaders

Ivan Gyurdiev ivg231 at
Sat Aug 26 21:29:20 CDT 2006

Stefan Dösinger wrote:

> Pre 2.0 pixel shaders do not contain a tag for the texture type to sample 
> from. Wine had 2D textures hardcoded, this patch checks the bound texture 
> type to decide from which texture to sample from. For >= 2.0 shaders the 
> shader tag is still used.
Why can't this be done in a much cleaner way where the sampler is 
initialized (2nd pass, baseshader, get_registers_used)? Then you don't 
have to copy and paste the same thing in many places - there's 10 
texture instructions or something like that for pixel shaders alone.

Also, maybe the stateblock should be passed as an argument to all 
functions that use its states. I don't like walking up the tree to find 
what you need (this->wineD3Ddevice) - it's a hidden dependency on device 
state, which isn't even all the time - that's why you had to move the 
point where the shader is compiled [ this needs better documentation ].

Similarly, I think the code would be cleaner if projected sampling vs 
regular was retrieved from the stateblock, and stored somewhere else, at 
the point when the sampler is initialized.

More information about the wine-devel mailing list