r300: export translateTexFormat function
authorMaciej Cencora <m.cencora@gmail.com>
Sat, 7 Nov 2009 21:48:23 +0000 (22:48 +0100)
committerMaciej Cencora <m.cencora@gmail.com>
Fri, 11 Dec 2009 23:52:51 +0000 (00:52 +0100)
src/mesa/drivers/dri/r300/r300_tex.h
src/mesa/drivers/dri/r300/r300_texstate.c

index 8a653ea2d11b0b186e384056141f63f9e751562a..beb10072e9c69470d48c2efbc6f9a700e4832e37 100644 (file)
@@ -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__ */
index 68b90d310631a7bef414b2383ccd0a76c49a5b2b..6db56ba618f801bab66f19f3eb9252a55ab6b50b 100644 (file)
@@ -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);
+                       }
                }
        }