mesa: add explicit enable for EXT_float_blend, and error condition
[mesa.git] / src / mesa / main / draw_validate.c
index b715a27f8b78c498676b875eb2bdbf5c556dd8e3..779cd1c12c74d9146850d937fa34d74e073e9737 100644 (file)
@@ -304,6 +304,25 @@ check_valid_to_render(struct gl_context *ctx, const char *function)
                      "%s(tess ctrl shader is missing)", function);
          return false;
       }
+
+      /* From GL_EXT_color_buffer_float:
+       *
+       *     "Blending applies only if the color buffer has a fixed-point or
+       *     or floating-point format. If the color buffer has an integer
+       *     format, proceed to the next operation.  Furthermore, an
+       *     INVALID_OPERATION error is generated by DrawArrays and the other
+       *     drawing commands defined in section 2.8.3 (10.5 in ES 3.1) if
+       *     blending is enabled (see below) and any draw buffer has 32-bit
+       *     floating-point format components."
+       *
+       * However GL_EXT_float_blend removes this text.
+       */
+      if (!ctx->Extensions.EXT_float_blend &&
+          (ctx->DrawBuffer->_FP32Buffers & ctx->Color.BlendEnabled)) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "%s(32-bit float output + blending)", function);
+         return false;
+      }
       break;
 
    case API_OPENGL_CORE: