Mesa (master): r300g: is_npot -> uses_pitch

Marek Olšák mareko at kemper.freedesktop.org
Mon Apr 5 05:10:13 UTC 2010


Module: Mesa
Branch: master
Commit: 4e949271c25ccc5a06fbbbe912b0b43b75d1d169
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4e949271c25ccc5a06fbbbe912b0b43b75d1d169

Author: Marek Olšák <maraeo at gmail.com>
Date:   Sun Apr  4 16:09:59 2010 +0200

r300g: is_npot -> uses_pitch

---

 src/gallium/drivers/r300/r300_context.h       |    5 +++--
 src/gallium/drivers/r300/r300_state.c         |    2 +-
 src/gallium/drivers/r300/r300_state_derived.c |    2 +-
 src/gallium/drivers/r300/r300_texture.c       |    7 ++++---
 4 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index 0310923..4689701 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -250,10 +250,11 @@ struct r300_texture {
     /* Total size of this texture, in bytes. */
     unsigned size;
 
-    /* Whether this texture has non-power-of-two dimensions.
+    /* Whether this texture has non-power-of-two dimensions
+     * or a user-specified pitch.
      * It can be either a regular texture or a rectangle one.
      */
-    boolean is_npot;
+    boolean uses_pitch;
 
     /* Pipe buffer backing this texture. */
     struct r300_winsys_buffer *buffer;
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 2c0a7d8..dc94c95 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -969,7 +969,7 @@ static void r300_set_fragment_sampler_views(struct pipe_context* pipe,
 
             /* R300-specific - set the texrect factor in the fragment shader */
             texture = (struct r300_texture *)views[i]->texture;
-            if (!is_r500 && texture->is_npot) {
+            if (!is_r500 && texture->uses_pitch) {
                 /* XXX It would be nice to re-emit just 1 constant,
                  * XXX not all of them */
                 r300->dirty_state |= R300_NEW_FRAGMENT_SHADER_CONSTANTS;
diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
index bc5431c..47209dd 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -490,7 +490,7 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300)
                 texstate->filter[0] |= R300_TX_WRAP_T(R300_TX_CLAMP_TO_EDGE);
             }
 
-            if (tex->is_npot) {
+            if (tex->uses_pitch) {
                 /* NPOT textures don't support mip filter, unfortunately.
                  * This prevents incorrect rendering. */
                 texstate->filter[0] &= ~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 d03c28b..d1db672 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -521,7 +521,7 @@ static void r300_setup_texture_state(struct r300_screen* screen, struct r300_tex
     state->format0 = R300_TX_WIDTH((pt->width0 - 1) & 0x7ff) |
                      R300_TX_HEIGHT((pt->height0 - 1) & 0x7ff);
 
-    if (tex->is_npot || tex->stride_override) {
+    if (tex->uses_pitch) {
         /* rectangles love this */
         state->format0 |= R300_TX_PITCH_EN;
         state->format2 = (tex->pitch[0] - 1) & 0x1fff;
@@ -741,8 +741,9 @@ static void r300_setup_miptree(struct r300_screen* screen,
 
 static void r300_setup_flags(struct r300_texture* tex)
 {
-    tex->is_npot = !util_is_power_of_two(tex->tex.width0) ||
-                   !util_is_power_of_two(tex->tex.height0);
+    tex->uses_pitch = !util_is_power_of_two(tex->tex.width0) ||
+                      !util_is_power_of_two(tex->tex.height0) ||
+                      tex->stride_override;
 }
 
 static void r300_setup_tiling(struct pipe_screen *screen,




More information about the mesa-commit mailing list