mesa: replace _NEW_EVAL with vbo_exec_update_eval_maps
[mesa.git] / src / mesa / main / formatquery.c
index 1846fbc688cde926b139d05ac5a75ede4adbc7d3..3b0f6dafad7644835eae42fb6778b8bfba10635a 100644 (file)
@@ -501,8 +501,7 @@ _is_resource_supported(struct gl_context *ctx, GLenum target,
 
       /* additional checks for compressed textures */
       if (_mesa_is_compressed_format(ctx, internalformat) &&
-          (!_mesa_target_can_be_compressed(ctx, target, internalformat, NULL) ||
-           _mesa_format_no_online_compression(ctx, internalformat)))
+          !_mesa_target_can_be_compressed(ctx, target, internalformat, NULL))
          return false;
 
       break;
@@ -558,15 +557,29 @@ _is_internalformat_supported(struct gl_context *ctx, GLenum target,
     *         implementation accepts it for any texture specification commands, and
     *         - unsized or base internal format, if the implementation accepts
     *         it for texture or image specification.
+    *
+    * But also:
+    * "If the particualar <target> and <internalformat> combination do not make
+    * sense, or if a particular type of <target> is not supported by the
+    * implementation the "unsupported" answer should be given. This is not an
+    * error.
     */
    GLint buffer[1];
 
-   /* At this point an internalformat is valid if it is valid as a texture or
-    * as a renderbuffer format. The checks are different because those methods
-    * return different values when passing non supported internalformats */
-   if (_mesa_base_tex_format(ctx, internalformat) < 0 &&
-       _mesa_base_fbo_format(ctx, internalformat) == 0)
-      return false;
+   if (target == GL_RENDERBUFFER) {
+      if (_mesa_base_fbo_format(ctx, internalformat) == 0) {
+         return false;
+      }
+   } else if (target == GL_TEXTURE_BUFFER) {
+      if (_mesa_validate_texbuffer_format(ctx, internalformat) ==
+          MESA_FORMAT_NONE) {
+         return false;
+      }
+   } else {
+      if (_mesa_base_tex_format(ctx, internalformat) < 0) {
+         return false;
+      }
+   }
 
    /* Let the driver have the final word */
    ctx->Driver.QueryInternalFormat(ctx, target, internalformat,
@@ -946,9 +959,6 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
       mesa_format texformat;
 
       if (target != GL_RENDERBUFFER) {
-         if (!_mesa_legal_get_tex_level_parameter_target(ctx, target, true))
-            goto end;
-
          baseformat = _mesa_base_tex_format(ctx, internalformat);
       } else {
          baseformat = _mesa_base_fbo_format(ctx, internalformat);
@@ -969,10 +979,7 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
        * and glGetRenderbufferParameteriv functions.
        */
       if (pname == GL_INTERNALFORMAT_SHARED_SIZE) {
-         if (_mesa_has_EXT_texture_shared_exponent(ctx) &&
-             target != GL_TEXTURE_BUFFER &&
-             target != GL_RENDERBUFFER &&
-             texformat == MESA_FORMAT_R9G9B9E5_FLOAT) {
+         if (texformat == MESA_FORMAT_R9G9B9E5_FLOAT) {
             buffer[0] = 5;
          }
          goto end;
@@ -1234,7 +1241,7 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
       break;
 
    case GL_SRGB_WRITE:
-      if (!_mesa_has_EXT_framebuffer_sRGB(ctx) ||
+      if (!ctx->Extensions.EXT_sRGB ||
           !_mesa_is_color_format(internalformat)) {
          goto end;
       }