r600: fail to validate unsupported texture formats
authorKlaus Schnass <klaus.schnass@student.tuwien.ac.at>
Fri, 26 Feb 2010 20:09:50 +0000 (15:09 -0500)
committerAlex Deucher <alexdeucher@gmail.com>
Fri, 26 Feb 2010 20:26:51 +0000 (15:26 -0500)
src/mesa/drivers/dri/r600/r600_texstate.c

index dd33ef3c6a2bd880096cfb33ee6d31d29adb07e6..1600033b9bd17e38430e8c5abd258141bd014b01 100644 (file)
@@ -373,17 +373,11 @@ static GLboolean r600GetTexFormat(struct gl_texture_object *tObj, gl_format mesa
                  break;
                */
        case MESA_FORMAT_RGB_DXT1: /* not supported yet */
-
-               break;
        case MESA_FORMAT_RGBA_DXT1: /* not supported yet */
-
-               break;
        case MESA_FORMAT_RGBA_DXT3: /* not supported yet */
-
-               break;
        case MESA_FORMAT_RGBA_DXT5: /* not supported yet */
+               return GL_FALSE;
 
-               break;
        case MESA_FORMAT_RGBA_FLOAT32:
                SETfield(t->SQ_TEX_RESOURCE1, FMT_32_32_32_32_FLOAT,
                         SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask);
@@ -701,8 +695,8 @@ void r600SetDepthTexMode(struct gl_texture_object *tObj)
 
        t = radeon_tex_obj(tObj);
 
-       r600GetTexFormat(tObj, tObj->Image[0][tObj->BaseLevel]->TexFormat);
-
+       if(!r600GetTexFormat(tObj, tObj->Image[0][tObj->BaseLevel]->TexFormat))
+         t->validated = GL_FALSE;
 }
 
 /**
@@ -711,7 +705,7 @@ void r600SetDepthTexMode(struct gl_texture_object *tObj)
  * \param rmesa Context pointer
  * \param t the r300 texture object
  */
-static void setup_hardware_state(GLcontext * ctx, struct gl_texture_object *texObj, int unit)
+static GLboolean setup_hardware_state(GLcontext * ctx, struct gl_texture_object *texObj, int unit)
 {
        context_t *rmesa = R700_CONTEXT(ctx);
        radeonTexObj *t = radeon_tex_obj(texObj);
@@ -721,15 +715,15 @@ static void setup_hardware_state(GLcontext * ctx, struct gl_texture_object *texO
        if (rmesa->radeon.radeonScreen->driScreen->dri2.enabled &&
            t->image_override &&
            t->bo)
-               return;
+               return GL_TRUE;
 
        firstImage = t->base.Image[0][t->minLod];
 
        if (!t->image_override) {
                if (!r600GetTexFormat(texObj, firstImage->TexFormat)) {
-                       radeon_error("unexpected texture format in %s\n",
-                                     __FUNCTION__);
-                       return;
+                       radeon_warning("unsupported texture format in %s\n",
+                                      __FUNCTION__);
+                       return GL_FALSE;
                }
        }
 
@@ -754,7 +748,7 @@ static void setup_hardware_state(GLcontext * ctx, struct gl_texture_object *texO
                break;
         default:
                radeon_error("unexpected texture target type in %s\n", __FUNCTION__);
-               return;
+               return GL_FALSE;
        }
 
        row_align = rmesa->radeon.texture_row_align - 1;
@@ -799,6 +793,7 @@ static void setup_hardware_state(GLcontext * ctx, struct gl_texture_object *texO
                CLEARfield(t->SQ_TEX_SAMPLER0, DEPTH_COMPARE_FUNCTION_mask);
        }
 
+       return GL_TRUE;
 }
 
 /**
@@ -815,7 +810,8 @@ static GLboolean r600_validate_texture(GLcontext * ctx, struct gl_texture_object
 
        /* Configure the hardware registers (more precisely, the cached version
         * of the hardware registers). */
-       setup_hardware_state(ctx, texObj, unit);
+       if (!setup_hardware_state(ctx, texObj, unit))
+               return GL_FALSE;
 
        t->validated = GL_TRUE;
        return GL_TRUE;