Currently, fog in vertex programs doesn't work when using per-vertex
fog, since the fog factor computation is not done in the tnl pipeline. I
think the most elegant solution to this problem would be to just move
the (slightly changed) fog pipeline stage to after the various vertex
prog extensions. Is it safe to move pipeline stages around? I think it
should be as long as a stage doesn't need the output of another one. It
seems to work (only tested with arb_vp), but I might miss some
pitfalls... (obviously, hw drivers using their own pipelines would need
to change the order too).

Roland

Index: t_pipeline.c
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/tnl/t_pipeline.c,v
retrieving revision 1.40
diff -u -r1.40 t_pipeline.c
--- t_pipeline.c        13 Jun 2006 03:29:02 -0000      1.40
+++ t_pipeline.c        24 Oct 2006 23:58:13 -0000
@@ -200,7 +200,6 @@
    &_tnl_vertex_transform_stage,
    &_tnl_normal_transform_stage,
    &_tnl_lighting_stage,
-   &_tnl_fog_coordinate_stage,
    &_tnl_texgen_stage,
    &_tnl_texture_transform_stage,
    &_tnl_point_attenuation_stage,
@@ -211,6 +210,7 @@
 #if FEATURE_ARB_vertex_shader
    &_tnl_arb_vertex_shader_stage,
 #endif
+   &_tnl_fog_coordinate_stage,
    &_tnl_render_stage,
    NULL 
 };
Index: t_vb_fog.c
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/tnl/t_vb_fog.c,v
retrieving revision 1.36
diff -u -r1.36 t_vb_fog.c
--- t_vb_fog.c  14 Jun 2006 04:05:17 -0000      1.36
+++ t_vb_fog.c  24 Oct 2006 23:58:13 -0000
@@ -148,14 +148,13 @@
    struct fog_stage_data *store = FOG_STAGE_DATA(stage);
    GLvector4f *input;
 
-   if (ctx->ShaderObjects._VertexShaderPresent)
-      return GL_TRUE;
-
-   if (!ctx->Fog.Enabled || ctx->VertexProgram._Enabled)
+   if (!ctx->Fog.Enabled)
       return GL_TRUE;
 
 
-   if (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT) {
+   if (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT &&
+      (!ctx->ShaderObjects._VertexShaderPresent ||
+       !ctx->VertexProgram._Enabled)) {
       /* Fog is computed from vertex or fragment Z values */
       /* source = VB->ObjPtr or VB->EyePtr coords */
       /* dest = VB->AttribPtr[_TNL_ATTRIB_FOG] = fog stage private storage */

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to