summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2010-07-24 23:05:40 +0200
committerMarek Olšák <[email protected]>2010-07-25 10:25:21 +0200
commit49330fc5ac13e25cb201e62995329cffaf5046f0 (patch)
treee5cf700875018050f378a75cacc8b79cb3ae6e3e /src
parentc92d232061c1aef6f5f56cbd815625778db2fd8c (diff)
r300g: do not use TXPITCH_EN if the width is POT and the height is NPOT
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/r300/r300_context.h13
-rw-r--r--src/gallium/drivers/r300/r300_fs.c2
-rw-r--r--src/gallium/drivers/r300/r300_state.c2
-rw-r--r--src/gallium/drivers/r300/r300_state_derived.c2
-rw-r--r--src/gallium/drivers/r300/r300_texture.c3
-rw-r--r--src/gallium/drivers/r300/r300_texture_desc.c4
6 files changed, 15 insertions, 11 deletions
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index 06e4e12558f..b4256c62786 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -361,13 +361,12 @@ struct r300_texture_desc {
*/
unsigned stride_in_bytes_override;
- /* Whether this texture has non-power-of-two dimensions
- * or a user-specified stride.
- * It can be either a regular texture or a rectangle one.
- *
- * This flag says that hardware must use the stride for addressing
- * instead of the width.
- */
+ /* Whether this texture has non-power-of-two dimensions.
+ * It can be either a regular texture or a rectangle one. */
+ boolean is_npot;
+
+ /* This flag says that hardware must use the stride for addressing
+ * instead of the width. */
boolean uses_stride_addressing;
/* Whether CBZB fast color clear is allowed on the miplevel. */
diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c
index 6eac12bfb9f..db5269912e2 100644
--- a/src/gallium/drivers/r300/r300_fs.c
+++ b/src/gallium/drivers/r300/r300_fs.c
@@ -173,7 +173,7 @@ static void get_external_state(
t = (struct r300_texture*)texstate->sampler_views[i]->base.texture;
/* XXX this should probably take into account STR, not just S. */
- if (t->desc.uses_stride_addressing) {
+ if (t->desc.is_npot) {
switch (s->state.wrap_s) {
case PIPE_TEX_WRAP_REPEAT:
state->unit[i].wrap_mode = RC_WRAP_REPEAT;
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 6e2a6ca0e42..bbea7e1589e 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -1296,7 +1296,7 @@ static void r300_set_fragment_sampler_views(struct pipe_context* pipe,
/* Set the texrect factor in the fragment shader.
* Needed for RECT and NPOT fallback. */
texture = r300_texture(views[i]->texture);
- if (texture->desc.uses_stride_addressing) {
+ if (texture->desc.is_npot) {
r300->fs_rc_constant_state.dirty = TRUE;
}
diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
index e20d8d0fdf0..48912e1555c 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -583,7 +583,7 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300)
texstate->filter0 |= R300_TX_WRAP_T(R300_TX_CLAMP_TO_EDGE);
}
- if (tex->desc.uses_stride_addressing) {
+ if (tex->desc.is_npot) {
/* NPOT textures don't support mip filter, unfortunately.
* This prevents incorrect rendering. */
texstate->filter0 &= ~R300_TX_MIN_FILTER_MIP_MASK;
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index e99a4630ee4..f1118dfd7dd 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -552,7 +552,8 @@ static void r300_texture_setup_immutable_state(struct r300_screen* screen,
f->format0 |= R300_TX_PITCH_EN;
f->format2 = (tex->desc.stride_in_pixels[0] - 1) & 0x1fff;
} else {
- /* power of two textures (3D, mipmaps, and no pitch) */
+ /* Power of two textures (3D, mipmaps, and no pitch),
+ * also NPOT textures with a width being POT. */
f->format0 |= R300_TX_DEPTH(util_logbase2(pt->depth0) & 0xf);
}
diff --git a/src/gallium/drivers/r300/r300_texture_desc.c b/src/gallium/drivers/r300/r300_texture_desc.c
index becaa59bea3..02591aa01f1 100644
--- a/src/gallium/drivers/r300/r300_texture_desc.c
+++ b/src/gallium/drivers/r300/r300_texture_desc.c
@@ -272,6 +272,10 @@ static void r300_setup_flags(struct r300_texture_desc *desc)
(desc->stride_in_bytes_override &&
stride_to_width(desc->b.b.format,
desc->stride_in_bytes_override) != desc->b.b.width0);
+
+ desc->is_npot =
+ desc->uses_stride_addressing ||
+ !util_is_power_of_two(desc->b.b.height0);
}
static void r300_setup_cbzb_flags(struct r300_screen *rscreen,