r300g: do not use TXPITCH_EN if the width is POT and the height is NPOT

This commit is contained in:
Marek Olšák
2010-07-24 23:05:40 +02:00
parent c92d232061
commit 49330fc5ac
6 changed files with 15 additions and 11 deletions
+6 -7
View File
@@ -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. */
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;
}
@@ -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;
+2 -1
View File
@@ -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);
}
@@ -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,