Mesa (master): r300: fix regression introduced by da73c1ed

Maciej Cencora osiris at kemper.freedesktop.org
Sun Dec 13 08:24:43 PST 2009


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

Author: Maciej Cencora <m.cencora at gmail.com>
Date:   Sun Dec 13 17:18:50 2009 +0100

r300: fix regression introduced by da73c1ed

The 0 value is correct for I8 format.

---

 src/mesa/drivers/dri/r300/r300_blit.c     |    2 +-
 src/mesa/drivers/dri/r300/r300_tex.h      |    2 +-
 src/mesa/drivers/dri/r300/r300_texstate.c |    9 +++++----
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/r300/r300_blit.c b/src/mesa/drivers/dri/r300/r300_blit.c
index ff678ba..3523c27 100644
--- a/src/mesa/drivers/dri/r300/r300_blit.c
+++ b/src/mesa/drivers/dri/r300/r300_blit.c
@@ -141,7 +141,7 @@ static void r300_emit_tx_setup(struct r300_context *r300,
 
     assert(width <= 2048);
     assert(height <= 2048);
-    assert(r300TranslateTexFormat(mesa_format) != 0);
+    assert(r300TranslateTexFormat(mesa_format) >= 0);
     assert(offset % 32 == 0);
 
     BEGIN_BATCH(17);
diff --git a/src/mesa/drivers/dri/r300/r300_tex.h b/src/mesa/drivers/dri/r300/r300_tex.h
index beb1007..6ede0fe 100644
--- a/src/mesa/drivers/dri/r300/r300_tex.h
+++ b/src/mesa/drivers/dri/r300/r300_tex.h
@@ -51,6 +51,6 @@ extern GLboolean r300ValidateBuffers(GLcontext * ctx);
 
 extern void r300InitTextureFuncs(struct dd_function_table *functions);
 
-uint32_t r300TranslateTexFormat(gl_format mesaFormat);
+int32_t r300TranslateTexFormat(gl_format mesaFormat);
 
 #endif				/* __r300_TEX_H__ */
diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c
index 6db56ba..d4a7283 100644
--- a/src/mesa/drivers/dri/r300/r300_texstate.c
+++ b/src/mesa/drivers/dri/r300/r300_texstate.c
@@ -59,7 +59,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  * identically.  -- paulus
  */
 
-uint32_t r300TranslateTexFormat(gl_format mesaFormat)
+int32_t r300TranslateTexFormat(gl_format mesaFormat)
 {
 	switch (mesaFormat)
 	{
@@ -168,7 +168,7 @@ uint32_t r300TranslateTexFormat(gl_format mesaFormat)
 		case MESA_FORMAT_SRGBA_DXT5:
 			return R300_EASY_TX_FORMAT(Y, Z, W, X, DXT5) | R300_TX_FORMAT_GAMMA;
 		default:
-			return 0;
+			return -1;
 	}
 };
 
@@ -252,12 +252,13 @@ static void setup_hardware_state(r300ContextPtr rmesa, radeonTexObj *t)
 		if (firstImage->_BaseFormat == GL_DEPTH_COMPONENT) {
 			r300SetDepthTexMode(&t->base);
 		} else {
-			t->pp_txformat = r300TranslateTexFormat(firstImage->TexFormat);
-			if (t->pp_txformat == 0) {
+			int32_t txformat = r300TranslateTexFormat(firstImage->TexFormat);
+			if (txformat < 0) {
 				_mesa_problem(rmesa->radeon.glCtx, "%s: Invalid format %s",
 							  __FUNCTION__, _mesa_get_format_name(firstImage->TexFormat));
 				_mesa_exit(1);
 			}
+			t->pp_txformat = (uint32_t) txformat;
 		}
 	}
 



More information about the mesa-commit mailing list