Reduce the amount of debug output, while still printing important messages.
authorVladimir Dergachev <volodya@freedesktop.org>
Wed, 5 Jan 2005 04:56:23 +0000 (04:56 +0000)
committerVladimir Dergachev <volodya@freedesktop.org>
Wed, 5 Jan 2005 04:56:23 +0000 (04:56 +0000)
Make guessing texture formats easier.

src/mesa/drivers/dri/r300/r300_render.c
src/mesa/drivers/dri/r300/r300_state.c

index 5b4d94e796996a48e3c6f08347682978954483ba..fb2c759b01a9393b50e2752bef20ffabcb739f31 100644 (file)
@@ -127,7 +127,9 @@ static int r300_get_primitive_type(r300ContextPtr rmesa,
                min_vertices=4;
                break;
        default:
-               fprintf(stderr, "Cannot handle primitive %02x ", prim & PRIM_MODE_MASK);
+               fprintf(stderr, "%s:%s Do not know how to handle primitive %02x - help me !\n",
+                       __FILE__, __FUNCTION__,
+                       prim & PRIM_MODE_MASK);
                return -1;
                break;
        }
@@ -135,7 +137,13 @@ static int r300_get_primitive_type(r300ContextPtr rmesa,
    fprintf(stderr, "[%d-%d]%s ", start, end, name);
    #endif
    if(start+min_vertices>=end){
-       fprintf(stderr, "Not enough vertices\n");
+       static int warn_once=1;
+       if(warn_once){
+               fprintf(stderr, "%s:%s Not enough vertices to draw primitive %02x - help me !\n",
+                               __FILE__, __FUNCTION__,
+                               prim & PRIM_MODE_MASK);
+                       warn_once=0;
+                       }
        return -1;
        }
    return type;
index 023e22f15669bd6ee10b851ca988b61b67229e25..c0257c87975657c4bfa4b5b50ea5a7897f55716a 100644 (file)
@@ -761,6 +761,28 @@ static r300TexObj default_tex_obj={
        unknown5: 0x0
        };
 
+       /* there is probably a system to these value, but, for now, 
+          we just try by hand */
+static GLuint translate_texture_format(GLuint format)
+{
+       switch(format){
+       case 0x88047:
+       case 0x55047:
+               return 0x53a0c;
+       default:
+               {
+               static int warn_once=1;
+               if(warn_once){
+                       fprintf(stderr, "%s:%s Do not know how to translate texture format %08x - help me !\n",
+                               __FILE__, __FUNCTION__,
+                               format);
+                       warn_once=0;
+                       }
+               }
+               return 0;
+       }
+}
+       
 void r300_setup_textures(GLcontext *ctx)
 {
        int i, mtu;
@@ -813,33 +835,33 @@ void r300_setup_textures(GLcontext *ctx)
                        r300->hw.tex.unknown5.cmd[R300_TEX_VALUE_0+i]=0x0;
                        
                        
-                       fprintf(stderr, "Want to set format %08x\n", t->format);
                        /* We don't know how to set this yet */
-                       r300->hw.tex.format.cmd[R300_TEX_VALUE_0+i]=0x88a0c;
-                       r300->hw.tex.format.cmd[R300_TEX_VALUE_0+i]=0x88013;
+                       //value from r300_lib.c for RGB24
+                       //r300->hw.tex.format.cmd[R300_TEX_VALUE_0+i]=0x88a0c; 
+                       r300->hw.tex.format.cmd[R300_TEX_VALUE_0+i]=translate_texture_format(t->format);
                        /* Use the code below to quickly find matching texture
                           formats. Requires an app that displays the same texture
                           repeatedly  */
-                             #if 0
-                               { 
-                               static int fmt=0;
-                               static int k=0;
-                               k++;
-                               if(k>400){
-                                       k=0;
-                                       fmt++;
-                                       if(fmt>0xff){
-                                               exit(-1);
-                                               fmt=0;
+                             #if 1
+                               if(r300->hw.tex.format.cmd[R300_TEX_VALUE_0+i]==0){ 
+                                       static int fmt=0;
+                                       static int k=0;
+                                       k++;
+                                       if(k>200){
+                                               k=0;
+                                               fmt++;
+                                               fprintf(stderr, "Want to set format %08x\n", t->format);
+                                               if(fmt>0xff){
+                                                       //exit(-1);
+                                                       fmt=0;
+                                                       }
+                                               //sleep(1);
+                                               fprintf(stderr, "Instead trying format %08x\n", 
+                                                       0x00a0c | (fmt<<12));
                                                }
-                                       //sleep(1);
+                                       r300->hw.tex.format.cmd[R300_TEX_VALUE_0+i]=0x00a0c | (fmt<<12);
                                        }
-                               r300->hw.tex.format.cmd[R300_TEX_VALUE_0+i]=0x00a0c | (fmt<<12);
-                               }
                              #endif
-                       r300->hw.tex.format.cmd[R300_TEX_VALUE_0+i]=0x53a0c;
-                       fprintf(stderr, "Instead setting format %08x\n", r300->hw.tex.format.cmd[R300_TEX_VALUE_0+i]);
-
                        
                        }