Mesa (master): r300: export translateTexFormat function

Maciej Cencora osiris at kemper.freedesktop.org
Fri Dec 11 16:01:10 PST 2009


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

Author: Maciej Cencora <m.cencora at gmail.com>
Date:   Sat Nov  7 22:48:23 2009 +0100

r300: export translateTexFormat function

---

 src/mesa/drivers/dri/r300/r300_tex.h      |    2 ++
 src/mesa/drivers/dri/r300/r300_texstate.c |   11 +++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/r300/r300_tex.h b/src/mesa/drivers/dri/r300/r300_tex.h
index 8a653ea..beb1007 100644
--- a/src/mesa/drivers/dri/r300/r300_tex.h
+++ b/src/mesa/drivers/dri/r300/r300_tex.h
@@ -51,4 +51,6 @@ extern GLboolean r300ValidateBuffers(GLcontext * ctx);
 
 extern void r300InitTextureFuncs(struct dd_function_table *functions);
 
+uint32_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 68b90d3..6db56ba 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
  */
 
-static uint32_t translateTexFormat(gl_format mesaFormat)
+uint32_t r300TranslateTexFormat(gl_format mesaFormat)
 {
 	switch (mesaFormat)
 	{
@@ -168,8 +168,6 @@ static uint32_t translateTexFormat(gl_format mesaFormat)
 		case MESA_FORMAT_SRGBA_DXT5:
 			return R300_EASY_TX_FORMAT(Y, Z, W, X, DXT5) | R300_TX_FORMAT_GAMMA;
 		default:
-			fprintf(stderr, "%s: Invalid format %s", __FUNCTION__, _mesa_get_format_name(mesaFormat));
-			assert(0);
 			return 0;
 	}
 };
@@ -254,7 +252,12 @@ static void setup_hardware_state(r300ContextPtr rmesa, radeonTexObj *t)
 		if (firstImage->_BaseFormat == GL_DEPTH_COMPONENT) {
 			r300SetDepthTexMode(&t->base);
 		} else {
-			t->pp_txformat = translateTexFormat(firstImage->TexFormat);
+			t->pp_txformat = r300TranslateTexFormat(firstImage->TexFormat);
+			if (t->pp_txformat == 0) {
+				_mesa_problem(rmesa->radeon.glCtx, "%s: Invalid format %s",
+							  __FUNCTION__, _mesa_get_format_name(firstImage->TexFormat));
+				_mesa_exit(1);
+			}
 		}
 	}
 



More information about the mesa-commit mailing list