summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorXiang, Haihao <[email protected]>2008-03-31 13:45:06 +0800
committerXiang, Haihao <[email protected]>2008-03-31 13:45:06 +0800
commitd30d9e42b758db452bfdb482b619a5f4c6d01037 (patch)
tree4b4ba704779ca8509f82c6ecd93872897425b345 /src/mesa
parentd9367842e54a234ee00ea100de45480527de5693 (diff)
i915: texture object's lod bias. fix bug #15192
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i915/i830_tex.c2
-rw-r--r--src/mesa/drivers/dri/i915/i830_texstate.c14
-rw-r--r--src/mesa/drivers/dri/i915/i915_tex.c2
-rw-r--r--src/mesa/drivers/dri/i915/i915_texstate.c12
4 files changed, 25 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/i915/i830_tex.c b/src/mesa/drivers/dri/i915/i830_tex.c
index fed464d1aac..79b0fcf596f 100644
--- a/src/mesa/drivers/dri/i915/i830_tex.c
+++ b/src/mesa/drivers/dri/i915/i830_tex.c
@@ -96,5 +96,7 @@ i830TexEnv(GLcontext * ctx, GLenum target,
void
i830InitTextureFuncs(struct dd_function_table *functions)
{
+/*
functions->TexEnv = i830TexEnv;
+*/
}
diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c b/src/mesa/drivers/dri/i915/i830_texstate.c
index 7613b9d2a6f..4e9b022eaeb 100644
--- a/src/mesa/drivers/dri/i915/i830_texstate.c
+++ b/src/mesa/drivers/dri/i915/i830_texstate.c
@@ -114,10 +114,12 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
{
GLcontext *ctx = &intel->ctx;
struct i830_context *i830 = i830_context(ctx);
- struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
+ struct gl_texture_unit *tUnit = &ctx->Texture.Unit[unit];
+ struct gl_texture_object *tObj = tUnit->_Current;
struct intel_texture_object *intelObj = intel_texture_object(tObj);
struct gl_texture_image *firstImage;
GLuint *state = i830->state.Tex[unit], format, pitch;
+ GLint lodbias;
memset(state, 0, sizeof(state));
@@ -243,8 +245,14 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
}
}
- state[I830_TEXREG_TM0S3] = i830->lodbias_tm0s3[unit];
-
+ lodbias = (int) ((tUnit->LodBias + tObj->LodBias) * 16.0);
+ if (lodbias < -64)
+ lodbias = -64;
+ if (lodbias > 63)
+ lodbias = 63;
+
+ state[I830_TEXREG_TM0S3] = ((lodbias << TM0S3_LOD_BIAS_SHIFT) &
+ TM0S3_LOD_BIAS_MASK);
#if 0
/* YUV conversion:
*/
diff --git a/src/mesa/drivers/dri/i915/i915_tex.c b/src/mesa/drivers/dri/i915/i915_tex.c
index 59e148ca04e..386617a1ff1 100644
--- a/src/mesa/drivers/dri/i915/i915_tex.c
+++ b/src/mesa/drivers/dri/i915/i915_tex.c
@@ -74,5 +74,7 @@ i915TexEnv(GLcontext * ctx, GLenum target,
void
i915InitTextureFuncs(struct dd_function_table *functions)
{
+/*
functions->TexEnv = i915TexEnv;
+*/
}
diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c
index e489d25ae82..987c6c0454c 100644
--- a/src/mesa/drivers/dri/i915/i915_texstate.c
+++ b/src/mesa/drivers/dri/i915/i915_texstate.c
@@ -119,10 +119,12 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
{
GLcontext *ctx = &intel->ctx;
struct i915_context *i915 = i915_context(ctx);
- struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
+ struct gl_texture_unit *tUnit = &ctx->Texture.Unit[unit];
+ struct gl_texture_object *tObj = tUnit->_Current;
struct intel_texture_object *intelObj = intel_texture_object(tObj);
struct gl_texture_image *firstImage;
GLuint *state = i915->state.Tex[unit], format, pitch;
+ GLint lodbias;
memset(state, 0, sizeof(state));
@@ -232,7 +234,13 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
}
}
- state[I915_TEXREG_SS2] = i915->lodbias_ss2[unit];
+ lodbias = (int) ((tUnit->LodBias + tObj->LodBias) * 16.0);
+ if (lodbias < -256)
+ lodbias = -256;
+ if (lodbias > 255)
+ lodbias = 255;
+ state[I915_TEXREG_SS2] = ((lodbias << SS2_LOD_BIAS_SHIFT) &
+ SS2_LOD_BIAS_MASK);
/* YUV conversion:
*/