http://bugs.winehq.org/show_bug.cgi?id=14762
--- Comment #52 from Tobias Jakobi liquid.acid@gmx.net 2009-01-31 18:20:13 --- Hi there,
haven't yet managed to produce any working code for ARB mode, but I think I'm getting closer.
Like Stefan told me I should do the constant loading for texrect fixup similar to that of the bump env matrix.
What I have figured out so far:
(1) I have to change shader_arb_load_constants, checking there if there are any rect textures used in the shader and if yes, also check if fixup is possible (maybe we were already out of constants). If both checks pass I'll proceed with glProgramEnvParameter2fv to push the texture dimensions into the program.
PROBLEM: What's the easiest way to get access to the ps_compile_args structure inside shader_arb_load_constants. Wasn't a big thing with GLSL, but I'm not really sure which structure that is available from inside the function leads me to ps_compile_args.
(2) Change shader_generate_arb_declaration: Similar to bump env matrix loading I carefully check if we're not already out of free constants. If there are still constants free I proceed to add "PARAM textureRectFixup..." lines into the shader code.
Stefan already told me that all data inside an ARB program is of type vec4, so I should probably come up with a way to not burn a full vec4 PARAM for only one texture. So think about a good way of storing two fixup vec2s inside one PARAM.
(3) Change shader_hw_sample: Check whether we're sampling from RECT and if constants for this RECT could be loaded. If yes, then scale coords and so on.
(4) Not sure about this: gen_arbfp_ffp_shader. Since it contains texture sampling instructions that can encounter RECT types, it should probably be changed as well, right?
Upon finishing the fixup thing with ARB I'm going to move on to also fixing this for vertexshader-only setups (Stefan told me before that this could also be the case, and currently the whole fixup thing only works when pixelshaders are used).
Greets, Tobias