mesa: avoid valgrind warning due to opaque only being set sometimes
[mesa.git] / src / mesa / main / teximage.c
index 10232d65658797345088f6842ec0418b8cfa561a..8869b3db38959dfa8572d05ac604144d9825cc28 100644 (file)
@@ -1271,8 +1271,6 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target,
 {
    uint64_t bytes, mbytes;
 
-   assert(numSamples > 0);
-
    if (numLevels > 0) {
       /* Compute total memory for a whole mipmap.  This is the path
        * taken for glTexStorage(GL_PROXY_TEXTURE_x).
@@ -1306,7 +1304,7 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target,
    }
 
    bytes *= _mesa_num_tex_faces(target);
-   bytes *= numSamples;
+   bytes *= MAX2(1, numSamples);
 
    mbytes = bytes / (1024 * 1024); /* convert to MB */
 
@@ -1449,11 +1447,12 @@ _mesa_target_can_be_compressed(const struct gl_context *ctx, GLenum target,
          break;
       case MESA_FORMAT_LAYOUT_ASTC:
          target_can_be_compresed =
-                             ctx->Extensions.KHR_texture_compression_astc_hdr;
+            ctx->Extensions.KHR_texture_compression_astc_hdr ||
+            ctx->Extensions.KHR_texture_compression_astc_sliced_3d;
 
          /* Throw an INVALID_OPERATION error if the target is TEXTURE_3D and
-          * and the hdr extension is not supported.
-          * See comment in switch case GL_TEXTURE_CUBE_MAP_ARRAY for more info.
+          * neither of the above extensions are supported. See comment in
+          * switch case GL_TEXTURE_CUBE_MAP_ARRAY for more info.
           */
          if (!target_can_be_compresed)
             return write_error(error, GL_INVALID_OPERATION);