http://bugs.winehq.org/show_bug.cgi?id=14762
--- Comment #28 from Stefan Dösinger stefandoesinger@gmx.at 2008-12-01 10:46:03 ---
What I have understood so far:
- Add new BOOL texrect_fixup to ps_compile_args (in wined3d_private.h) so we
can device whether fixup is needed or not.
Question: Where do I "configure" / initialize the ps_compile_args structure?
In pixelshader.c, find_ps_args(), or similar
- Add code to sampler() (in state.c) to trigger fixup uniform reloading when
pshaders and rect textures are used.
So I think this is the correct check: use_ps(stateblock->wineD3DDevice) && IWineD3DBaseTexture_GetTextureDimensions(stateblock->textures[sampler]) == GL_TEXTURE_RECTANGLE_ARB)
Correct
Question: What do I call then? I don't think I can simply call a method from glsl_shader.c since in the end this whole fix should also kill the issue when ARB mode is used (and not GLSL).
Correct, you have to use the shader_backend structure
I suspect I should call shader_backend->load_constants there? However isn't that call kinda "heavy"? (since I "only" wanna reload the fixup uniforms).
shader_backend->load_constants is ok for the start. In ARB you can't avoid that because you have to prevent the normal constants from overwriting your fixup constants(or better: place the fixup constants in a place not used by the shader). In GLSL a separate function could do this, but that won't work with ARB
- For each sampler2DRect also generate a vec2 uniform containing the texture
dimensions. This is probably going into shader_generate_glsl_declarations (glsl_shader.c)
Question: Currently I have put this into the texture samplers declaration, but from the discussion on IRC I assume this has to move into a separate loop.
No, I think that place is ok. I'm not 100% sure though, put it anywhere where you feel its ok
- Disable the (now) superfluous texcoord fixup in transform_texture()
(state.c) in case pshaders are used.
Yep
What's also a mystery to me is the "register a handler for STATE_SAMPLER(0-16)" thing, which supposedly located in state.c and arb_program_shader.c. I don't think that kind of code is found somewhere in sampler() (state.c)
I was wrong there, since this is better handled in sampler() in step (2)
Does this "register"-thing mean adding stuff to the large xxx_template structures?
Yes(although you don't need it, as said above)
Sorry if I'm asking dumb question :(
No worries. The questions aren't dumb really :-)