}
static unsigned
-get_fog_source(unsigned source)
+get_fog_source(unsigned source, unsigned distance_mode)
{
switch (source) {
case GL_FOG_COORDINATE_EXT:
return NV10_3D_FOG_COORD_FOG;
case GL_FRAGMENT_DEPTH_EXT:
- return NV10_3D_FOG_COORD_DIST_ORTHOGONAL_ABS;
+ switch (distance_mode) {
+ case GL_EYE_PLANE_ABSOLUTE_NV:
+ return NV10_3D_FOG_COORD_DIST_ORTHOGONAL_ABS;
+ case GL_EYE_PLANE:
+ return NV10_3D_FOG_COORD_DIST_ORTHOGONAL;
+ case GL_EYE_RADIAL_NV:
+ return NV10_3D_FOG_COORD_DIST_RADIAL;
+ default:
+ assert(0);
+ }
default:
assert(0);
}
BEGIN_RING(chan, celsius, NV10_3D_FOG_MODE, 4);
OUT_RING(chan, get_fog_mode(f->Mode));
- OUT_RING(chan, get_fog_source(source));
+ OUT_RING(chan, get_fog_source(source, f->FogDistanceMode));
OUT_RINGb(chan, f->Enabled);
OUT_RING(chan, pack_rgba_f(MESA_FORMAT_RGBA8888_REV, f->Color));
}
static unsigned
-get_fog_source(unsigned source)
+get_fog_source(unsigned source, unsigned distance_mode)
{
switch (source) {
case GL_FOG_COORDINATE_EXT:
return NV20_3D_FOG_COORD_FOG;
case GL_FRAGMENT_DEPTH_EXT:
- return NV20_3D_FOG_COORD_DIST_ORTHOGONAL_ABS;
+ switch (distance_mode) {
+ case GL_EYE_PLANE_ABSOLUTE_NV:
+ return NV20_3D_FOG_COORD_DIST_ORTHOGONAL_ABS;
+ case GL_EYE_PLANE:
+ return NV20_3D_FOG_COORD_DIST_ORTHOGONAL;
+ case GL_EYE_RADIAL_NV:
+ return NV20_3D_FOG_COORD_DIST_RADIAL;
+ default:
+ assert(0);
+ }
default:
assert(0);
}
nv10_get_fog_coeff(ctx, k);
BEGIN_RING(chan, kelvin, NV20_3D_FOG_MODE, 4);
- OUT_RING(chan, (source == GL_FOG_COORDINATE_EXT ?
- get_fog_mode_signed(f->Mode) :
- get_fog_mode_unsigned(f->Mode)));
- OUT_RING(chan, get_fog_source(source));
+ OUT_RING(chan, ((source == GL_FRAGMENT_DEPTH_EXT &&
+ f->FogDistanceMode == GL_EYE_PLANE_ABSOLUTE_NV) ?
+ get_fog_mode_unsigned(f->Mode) :
+ get_fog_mode_signed(f->Mode)));
+ OUT_RING(chan, get_fog_source(source, f->FogDistanceMode));
OUT_RINGb(chan, f->Enabled);
OUT_RING(chan, pack_rgba_f(MESA_FORMAT_RGBA8888_REV, f->Color));