summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIlia Mirkin <imirkin@alum.mit.edu>2019-02-12 21:32:27 -0500
committerIlia Mirkin <imirkin@alum.mit.edu>2019-02-18 12:13:54 -0500
commit070a5e5d9248a77aa84375f74fe48c5067362ea8 (patch)
treec24b06fe2bec5e2a636c54fff2bb6640d970c13b /src
parent47616810ed7cfce21d239391131ad9a5ef558b52 (diff)
mesa: add explicit enable for EXT_float_blend, and error condition
If EXT_float_blend is not supported, error out on blending of FP32 attachments in an ES2 context. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/draw_validate.c19
-rw-r--r--src/mesa/main/extensions_table.h2
-rw-r--r--src/mesa/main/fbobject.c4
-rw-r--r--src/mesa/main/mtypes.h2
4 files changed, 26 insertions, 1 deletions
diff --git a/src/mesa/main/draw_validate.c b/src/mesa/main/draw_validate.c
index b715a27f8b7..779cd1c12c7 100644
--- a/src/mesa/main/draw_validate.c
+++ b/src/mesa/main/draw_validate.c
@@ -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:
diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
index 0d6bb452ffa..b0492fed698 100644
--- a/src/mesa/main/extensions_table.h
+++ b/src/mesa/main/extensions_table.h
@@ -226,7 +226,7 @@ EXT(EXT_draw_buffers_indexed , ARB_draw_buffers_blend
EXT(EXT_draw_elements_base_vertex , ARB_draw_elements_base_vertex , x , x , x , ES2, 2014)
EXT(EXT_draw_instanced , ARB_draw_instanced , GLL, GLC, x , x , 2006)
EXT(EXT_draw_range_elements , dummy_true , GLL, x , x , x , 1997)
-EXT(EXT_float_blend , dummy_true , x , x , x , 30, 2015)
+EXT(EXT_float_blend , EXT_float_blend , x , x , x , 30, 2015)
EXT(EXT_fog_coord , dummy_true , GLL, x , x , x , 1999)
EXT(EXT_frag_depth , dummy_true , x , x , x , ES2, 2010)
EXT(EXT_framebuffer_blit , dummy_true , GLL, GLC, x , x , 2005)
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 341fd93efc6..1298e09e1b0 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1004,6 +1004,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
fb->_HasAttachments = true;
fb->_IntegerBuffers = 0;
fb->_RGBBuffers = 0;
+ fb->_FP32Buffers = 0;
/* Start at -2 to more easily loop over all attachment points.
* -2: depth buffer
@@ -1153,6 +1154,9 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
if (f == GL_RGB)
fb->_RGBBuffers |= (1 << i);
+ if (type == GL_FLOAT && _mesa_get_format_max_bits(attFormat) > 16)
+ fb->_FP32Buffers |= (1 << i);
+
fb->_AllColorBuffersFixedPoint =
fb->_AllColorBuffersFixedPoint &&
(type == GL_UNSIGNED_NORMALIZED || type == GL_SIGNED_NORMALIZED);
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index dda96cd2f19..ca00de7dc63 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3506,6 +3506,7 @@ struct gl_framebuffer
GLbitfield _IntegerBuffers; /**< Which color buffers are integer valued */
GLbitfield _RGBBuffers; /**< Which color buffers have baseformat == RGB */
+ GLbitfield _FP32Buffers; /**< Which color buffers are FP32 */
/* ARB_color_buffer_float */
GLboolean _AllColorBuffersFixedPoint; /* no integer, no float */
@@ -4248,6 +4249,7 @@ struct gl_extensions
GLboolean EXT_depth_bounds_test;
GLboolean EXT_disjoint_timer_query;
GLboolean EXT_draw_buffers2;
+ GLboolean EXT_float_blend;
GLboolean EXT_framebuffer_multisample;
GLboolean EXT_framebuffer_multisample_blit_scaled;
GLboolean EXT_framebuffer_sRGB;