Am Donnerstag, 7. Juni 2007 23:52 schrieb H. Verbeet:
For pre-2.0 pixel shaders the stateblock is used to determine the sampler types, so we need to wait until CompileShader to do this. For ps_2_0 and higher there is no such requirement.
Changelog:
- For ps_2_0 and higher, call shader_get_registers_used() in
IWineD3DPixelShaderImpl_SetFunction
Are you going to compile >= 2.0 shaders in SetFunction? How would that work with other things that may need delayed compilation, like fog or (future) srgb write correction?
On 08/06/07, Stefan Dösinger stefandoesinger@gmx.at wrote:
Am Donnerstag, 7. Juni 2007 23:52 schrieb H. Verbeet:
For pre-2.0 pixel shaders the stateblock is used to determine the sampler types, so we need to wait until CompileShader to do this. For ps_2_0 and higher there is no such requirement.
Changelog:
- For ps_2_0 and higher, call shader_get_registers_used() in
IWineD3DPixelShaderImpl_SetFunction
Are you going to compile >= 2.0 shaders in SetFunction? How would that work with other things that may need delayed compilation, like fog or (future) srgb write correction?
No, just filling the register maps. The actual generation of the GL shader still happens in CompileShader. It's nothing really spectacular, but it still saves us making a pass over the d3d shader in CompileShader, which is typically called from inside draw calls.
No, just filling the register maps. The actual generation of the GL shader still happens in CompileShader. It's nothing really spectacular, but it still saves us making a pass over the d3d shader in CompileShader, which is typically called from inside draw calls.
Sounds good :-)
As some optimization somewhen we could try pre-generate most of the shader in SetFunction and just insert a few values based on the stateblock in CompileShader. Something like storing offsets / pointers into the char[] array which contains the glsl / arb string where a "1" / "2" / "3" or "cube" has to be inserted, or comment marks added / removed. The actual GL compilation still needs to be done during draw though.