summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2011-01-05 17:02:08 -0800
committerEric Anholt <eric@anholt.net>2011-01-05 18:23:54 -0800
commit7ce6517f3ac41bf770ab39aba4509d4f535ef663 (patch)
tree3563dc5da10a71f71981a0ceb5fdbd00b37a1f79 /src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
parent01b70c06284f3a0ab2de61228b73c78ed00a1a14 (diff)
intel: Always allocate miptrees from level 0, not tObj->BaseLevel.
BaseLevel/MaxLevel are mostly used for two things: clamping texture access for FBO rendering, and limiting the used mipmap levels when incrementally loading textures. By restricting our mipmap trees to just the current BaseLevel/MaxLevel, we caused reallocation thrashing in the common case, for a theoretical win if someone really did want just levels 2..4 or whatever of their texture object. Bug #30366
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_wm_sampler_state.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_sampler_state.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
index 30672b4251..f830e25626 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
@@ -115,6 +115,7 @@ struct wm_sampler_key {
struct wm_sampler_entry {
GLenum tex_target;
GLenum wrap_r, wrap_s, wrap_t;
+ uint32_t base_level;
float maxlod, minlod;
float lod_bias;
float max_aniso;
@@ -243,14 +244,7 @@ static void brw_update_sampler_state(struct brw_context *brw,
sampler->ss0.lod_preclamp = 1; /* OpenGL mode */
sampler->ss0.default_color_mode = 0; /* OpenGL/DX10 mode */
- /* Set BaseMipLevel, MaxLOD, MinLOD:
- *
- * XXX: I don't think that using firstLevel, lastLevel works,
- * because we always setup the surface state as if firstLevel ==
- * level zero. Probably have to subtract firstLevel from each of
- * these:
- */
- sampler->ss0.base_level = U_FIXED(0, 1);
+ sampler->ss0.base_level = U_FIXED(key->base_level, 1);
sampler->ss1.max_lod = U_FIXED(CLAMP(key->maxlod, 0, 13), 6);
sampler->ss1.min_lod = U_FIXED(CLAMP(key->minlod, 0, 13), 6);
@@ -292,6 +286,7 @@ brw_wm_sampler_populate_key(struct brw_context *brw,
entry->wrap_s = texObj->WrapS;
entry->wrap_t = texObj->WrapT;
+ entry->base_level = texObj->BaseLevel;
entry->maxlod = texObj->MaxLod;
entry->minlod = texObj->MinLod;
entry->lod_bias = texUnit->LodBias + texObj->LodBias;