From: Ian Romanick ian.d.roman...@intel.com
None of this ever gets used. Fog is always calculated by a fragment
program. Even though the fixed-function fog unit is never used, state
updates are still sent to the hardware. Removing those spurious state
updates can't hurt performance.
---
src/mesa/drivers/dri/i915/i915_context.c |8 ++-
src/mesa/drivers/dri/i915/i915_context.h | 10
src/mesa/drivers/dri/i915/i915_state.c | 86 ++---
src/mesa/drivers/dri/i915/i915_vtbl.c|9 ---
4 files changed, 12 insertions(+), 101 deletions(-)
diff --git a/src/mesa/drivers/dri/i915/i915_context.c
b/src/mesa/drivers/dri/i915/i915_context.c
index 7389a1d..f02f2d7 100644
--- a/src/mesa/drivers/dri/i915/i915_context.c
+++ b/src/mesa/drivers/dri/i915/i915_context.c
@@ -69,8 +69,6 @@ i915InvalidateState(struct gl_context * ctx, GLuint new_state)
p-params_uptodate = 0;
}
- if (new_state (_NEW_FOG | _NEW_HINT | _NEW_PROGRAM |
_NEW_PROGRAM_CONSTANTS))
- i915_update_fog(ctx);
if (new_state (_NEW_STENCIL | _NEW_BUFFERS | _NEW_POLYGON))
i915_update_stencil(ctx);
if (new_state (_NEW_LIGHT))
@@ -209,5 +207,11 @@ i915CreateContext(int api,
i915InitState(i915);
+ /* Always enable pixel fog. Vertex fog using fog coord will conflict
+* with fog code appended onto fragment program.
+*/
+ _tnl_allow_vertex_fog(ctx, 0);
+ _tnl_allow_pixel_fog(ctx, 1);
+
return GL_TRUE;
}
diff --git a/src/mesa/drivers/dri/i915/i915_context.h
b/src/mesa/drivers/dri/i915/i915_context.h
index 9a09f0a..577a01e 100644
--- a/src/mesa/drivers/dri/i915/i915_context.h
+++ b/src/mesa/drivers/dri/i915/i915_context.h
@@ -46,7 +46,6 @@
#define I915_UPLOAD_STIPPLE 0x4
#define I915_UPLOAD_PROGRAM 0x8
#define I915_UPLOAD_CONSTANTS0x10
-#define I915_UPLOAD_FOG 0x20
#define I915_UPLOAD_INVARIENT0x40
#define I915_UPLOAD_DEFAULTS 0x80
#define I915_UPLOAD_RASTER_RULES 0x100
@@ -91,13 +90,6 @@
#define I915_BLENDREG_BLENDCOLOR1 2
#define I915_BLEND_SETUP_SIZE 3
-#define I915_FOGREG_COLOR 0
-#define I915_FOGREG_MODE0 1
-#define I915_FOGREG_MODE1 2
-#define I915_FOGREG_MODE2 3
-#define I915_FOGREG_MODE3 4
-#define I915_FOG_SETUP_SIZE5
-
#define I915_STPREG_ST00
#define I915_STPREG_ST11
#define I915_STP_SETUP_SIZE2
@@ -227,7 +219,6 @@ struct i915_hw_state
GLuint Blend[I915_BLEND_SETUP_SIZE];
GLuint Buffer[I915_DEST_SETUP_SIZE];
GLuint Stipple[I915_STP_SETUP_SIZE];
- GLuint Fog[I915_FOG_SETUP_SIZE];
GLuint Defaults[I915_DEF_SETUP_SIZE];
GLuint RasterRules[I915_RASTER_RULES_SETUP_SIZE];
GLuint Tex[I915_TEX_UNITS][I915_TEX_SETUP_SIZE];
@@ -345,7 +336,6 @@ extern void i915_print_ureg(const char *msg, GLuint ureg);
*/
extern void i915InitStateFunctions(struct dd_function_table *functions);
extern void i915InitState(struct i915_context *i915);
-extern void i915_update_fog(struct gl_context * ctx);
extern void i915_update_stencil(struct gl_context * ctx);
extern void i915_update_provoking_vertex(struct gl_context *ctx);
diff --git a/src/mesa/drivers/dri/i915/i915_state.c
b/src/mesa/drivers/dri/i915/i915_state.c
index d027426..5e222bd 100644
--- a/src/mesa/drivers/dri/i915/i915_state.c
+++ b/src/mesa/drivers/dri/i915/i915_state.c
@@ -725,78 +725,20 @@ i915ShadeModel(struct gl_context * ctx, GLenum mode)
/* =
* Fog
*/
-void
-i915_update_fog(struct gl_context * ctx)
-{
- struct i915_context *i915 = I915_CONTEXT(ctx);
- GLuint dw;
-
- assert(ctx-FragmentProgram._Current);
-
- I915_ACTIVESTATE(i915, I915_UPLOAD_FOG, 0);
- dw = i915-state.Ctx[I915_CTXREG_LIS5] ~S5_FOG_ENABLE;
-
- if (dw != i915-state.Ctx[I915_CTXREG_LIS5]) {
- i915-state.Ctx[I915_CTXREG_LIS5] = dw;
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- }
-
- /* Always enable pixel fog. Vertex fog using fog coord will conflict
-* with fog code appended onto fragment program.
-*/
-_tnl_allow_vertex_fog( ctx, 0 );
-_tnl_allow_pixel_fog( ctx, 1 );
-}
-
static void
i915Fogfv(struct gl_context * ctx, GLenum pname, const GLfloat * param)
{
- struct i915_context *i915 = I915_CONTEXT(ctx);
-
- switch (pname) {
- case GL_FOG_COORDINATE_SOURCE_EXT:
- case GL_FOG_MODE:
- case GL_FOG_START:
- case GL_FOG_END:
- break;
-
- case GL_FOG_DENSITY:
- I915_STATECHANGE(i915, I915_UPLOAD_FOG);
-
- if (i915-state.Fog[I915_FOGREG_MODE1] FMC1_FOGINDEX_Z) {
- i915-state.Fog[I915_FOGREG_MODE3] =
-(GLuint) (ctx-Fog.Density * FMC3_D_ONE);
- }
- else {
- fi_type fi;
- fi.f = ctx-Fog.Density;
- i915-state.Fog[I915_FOGREG_MODE3] = fi.i;
- }
- break;
-
- case GL_FOG_COLOR:
- I915_STATECHANGE(i915, I915_UPLOAD_FOG);
-