summaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe/i915simple
diff options
context:
space:
mode:
authorBrian <[email protected]>2008-02-12 14:53:25 -0700
committerBrian <[email protected]>2008-02-12 14:53:25 -0700
commit4da1cdf78fa3b954840650fa46cf72da5daf149f (patch)
tree0496f6f4364e3608f7bb7af2a549a9ba3a898252 /src/mesa/pipe/i915simple
parentb61b1a295b13a0ff2cf98c8d07e62147d71c08b9 (diff)
gallium: clean-up, simplification of mipmapped textures
Remove pipe_texture->first_level (always implicitly zero). This means there's never any unused mipmap levels at the top. In the state tracker, we no longer re-layout mipmapped textures if the MinLod/MaxLod texture parameters change. It's up to the driver to obey the pipe_sampler->min/max_lod clamps.
Diffstat (limited to 'src/mesa/pipe/i915simple')
-rw-r--r--src/mesa/pipe/i915simple/i915_state.c7
-rw-r--r--src/mesa/pipe/i915simple/i915_state_sampler.c2
-rw-r--r--src/mesa/pipe/i915simple/i915_texture.c30
3 files changed, 23 insertions, 16 deletions
diff --git a/src/mesa/pipe/i915simple/i915_state.c b/src/mesa/pipe/i915simple/i915_state.c
index 950ea52d601..abd5571b885 100644
--- a/src/mesa/pipe/i915simple/i915_state.c
+++ b/src/mesa/pipe/i915simple/i915_state.c
@@ -250,6 +250,13 @@ i915_create_sampler_state(struct pipe_context *pipe,
if (sampler->normalized_coords)
cso->state[1] |= SS3_NORMALIZED_COORDS;
+ if (0) /* XXX not tested yet */
+ {
+ int minlod = (int) (16.0 * sampler->min_lod);
+ minlod = CLAMP(minlod, 0, 16 * 11);
+ cso->state[1] |= (minlod << SS3_MIN_LOD_SHIFT);
+ }
+
{
ubyte r = float_to_ubyte(sampler->border_color[0]);
ubyte g = float_to_ubyte(sampler->border_color[1]);
diff --git a/src/mesa/pipe/i915simple/i915_state_sampler.c b/src/mesa/pipe/i915simple/i915_state_sampler.c
index 0dbbc5241d5..9c1a5bbbd65 100644
--- a/src/mesa/pipe/i915simple/i915_state_sampler.c
+++ b/src/mesa/pipe/i915simple/i915_state_sampler.c
@@ -185,7 +185,7 @@ i915_update_texture(struct i915_context *i915, uint unit,
const struct pipe_texture *pt = &tex->base;
uint format, pitch;
const uint width = pt->width[0], height = pt->height[0], depth = pt->depth[0];
- const uint num_levels = pt->last_level - pt->first_level;
+ const uint num_levels = pt->last_level;
assert(tex);
assert(width);
diff --git a/src/mesa/pipe/i915simple/i915_texture.c b/src/mesa/pipe/i915simple/i915_texture.c
index 6faeab134ab..6d37ae3d747 100644
--- a/src/mesa/pipe/i915simple/i915_texture.c
+++ b/src/mesa/pipe/i915simple/i915_texture.c
@@ -118,11 +118,11 @@ i945_miptree_layout_2d( struct i915_texture *tex )
tex->pitch = pt->width[0];
/* May need to adjust pitch to accomodate the placement of
- * the 2nd mipmap. This occurs when the alignment
+ * the 2nd mipmap level. This occurs when the alignment
* constraints of mipmap placement push the right edge of the
- * 2nd mipmap out past the width of its parent.
+ * 2nd mipmap level out past the width of its parent.
*/
- if (pt->first_level != pt->last_level) {
+ if (pt->last_level > 0) {
unsigned mip1_width = align_int(minify(pt->width[0]), align_w)
+ minify(minify(pt->width[0]));
@@ -136,7 +136,7 @@ i945_miptree_layout_2d( struct i915_texture *tex )
tex->pitch = align_int(tex->pitch * pt->cpp, 4) / pt->cpp;
tex->total_height = 0;
- for ( level = pt->first_level ; level <= pt->last_level ; level++ ) {
+ for (level = 0; level <= pt->last_level; level++) {
unsigned img_height;
i915_miptree_set_level_info(tex, level, 1, x, y, width, height, 1);
@@ -152,9 +152,9 @@ i945_miptree_layout_2d( struct i915_texture *tex )
*/
tex->total_height = MAX2(tex->total_height, y + img_height);
- /* Layout_below: step right after second mipmap.
+ /* Layout_below: step right after second mipmap level.
*/
- if (level == pt->first_level + 1) {
+ if (level == 1) {
x += align_int(width, align_w);
}
else {
@@ -204,7 +204,7 @@ i915_miptree_layout(struct pipe_context *pipe, struct i915_texture * tex)
tex->pitch = ((dim * pt->cpp * 2 + 3) & ~3) / pt->cpp;
tex->total_height = dim * 4;
- for (level = pt->first_level; level <= pt->last_level; level++) {
+ for (level = 0; level <= pt->last_level; level++) {
i915_miptree_set_level_info(tex, level, 6,
0, 0,
/*OLD: tex->pitch, tex->total_height,*/
@@ -219,7 +219,7 @@ i915_miptree_layout(struct pipe_context *pipe, struct i915_texture * tex)
unsigned y = initial_offsets[face][1] * dim;
unsigned d = dim;
- for (level = pt->first_level; level <= pt->last_level; level++) {
+ for (level = 0; level <= pt->last_level; level++) {
i915_miptree_set_image_offset(tex, level, face, x, y);
d >>= 1;
x += step_offsets[face][0] * d;
@@ -240,7 +240,7 @@ i915_miptree_layout(struct pipe_context *pipe, struct i915_texture * tex)
/* XXX: hardware expects/requires 9 levels at minimum.
*/
- for (level = pt->first_level; level <= MAX2(8, pt->last_level);
+ for (level = 0; level <= MAX2(8, pt->last_level);
level++) {
i915_miptree_set_level_info(tex, level, depth, 0, tex->total_height,
width, height, depth);
@@ -256,7 +256,7 @@ i915_miptree_layout(struct pipe_context *pipe, struct i915_texture * tex)
/* Fixup depth image_offsets:
*/
depth = pt->depth[0];
- for (level = pt->first_level; level <= pt->last_level; level++) {
+ for (level = 0; level <= pt->last_level; level++) {
unsigned i;
for (i = 0; i < depth; i++)
i915_miptree_set_image_offset(tex, level, i,
@@ -282,7 +282,7 @@ i915_miptree_layout(struct pipe_context *pipe, struct i915_texture * tex)
tex->pitch = ((pt->width[0] * pt->cpp + 3) & ~3) / pt->cpp;
tex->total_height = 0;
- for (level = pt->first_level; level <= pt->last_level; level++) {
+ for (level = 0; level <= pt->last_level; level++) {
i915_miptree_set_level_info(tex, level, 1,
0, tex->total_height,
width, height, 1);
@@ -337,7 +337,7 @@ i945_miptree_layout(struct pipe_context *pipe, struct i915_texture * tex)
/* Set all the levels to effectively occupy the whole rectangular region.
*/
- for (level = pt->first_level; level <= pt->last_level; level++) {
+ for (level = 0; level <= pt->last_level; level++) {
i915_miptree_set_level_info(tex, level, 6,
0, 0,
lvlWidth, lvlHeight, 1);
@@ -355,12 +355,12 @@ i945_miptree_layout(struct pipe_context *pipe, struct i915_texture * tex)
y = tex->total_height - 4;
x = (face - 4) * 8;
}
- else if (dim < 4 && (face > 0 || pt->first_level > 0)) {
+ else if (dim < 4 && (face > 0)) {
y = tex->total_height - 4;
x = face * 8;
}
- for (level = pt->first_level; level <= pt->last_level; level++) {
+ for (level = 0; level <= pt->last_level; level++) {
i915_miptree_set_image_offset(tex, level, face, x, y);
d >>= 1;
@@ -418,7 +418,7 @@ i945_miptree_layout(struct pipe_context *pipe, struct i915_texture * tex)
pack_x_pitch = tex->pitch;
pack_x_nr = 1;
- for (level = pt->first_level; level <= pt->last_level; level++) {
+ for (level = 0; level <= pt->last_level; level++) {
unsigned nr_images = pt->target == PIPE_TEXTURE_3D ? depth : 6;
int x = 0;
int y = 0;