ARB VP/FP with builtin fog broken on ATI (sometimes?)

I have two programs (1 ARB VP, 1 ARB FP) where I am writting the fogcoord in the vetex program and using the OPTION ARB_fog_exp2 in the fragment program. (with supplying the fixed function values)

I am having trouble on ATI (X800 Cat 5.5 on winXP) in a large program where the fog was not showing up. I tracked this down, and found that if I enabled fixed function fog before I compile the vertex program, it works.

I an guessing that perhaps the ATI driver is seeing that the fog coordinate is not used when compiled (as fog is not enabled and no fragment program is enabled) and it is optimizing it out.

However, I am having trouble creating a stand alone test app with the same problems. I am just wondering if anyone else has the same issue?

I know that fog is broken with GLSL, but works fine with ARB vp/fp.

Only thing is to compute the fog coordinates in the vertex program

and write a lerp in your fragment program.

PARAM fogColor = state.fog.color;
ATTRIB fogCoord = fragment.fogcoord;
LRP_SAT oC0, fogCoord.x, fogColor, r0;

at the end of the fp program.

At worst, if the fragment.fogcoord is broken, uses a spare texture coordinate, and emulate the whole thing.

I had similiar problem on Radeon 9800 Pro with 4.10 drivers when using combination of ARB vp and ARB fp. In my case the fragment program was using OPTION ARB_fog_linear. The fog was working however all changes to fog distance parameters made after vertex program was bound were ignored.
The distance changes were applied if program was bound again or if I have called

glDisable( GL_VERTEX_PROGRAM_ARB ) ;
glEnable( GL_VERTEX_PROGRAM_ARB ) ;

It seems to me that driver baked that parameters into vertex program and forgot to update them when parameters were changed.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.