summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2013-01-17 13:37:53 -0800
committerIan Romanick <[email protected]>2013-01-22 03:26:24 -0500
commit9cb64a4cb61ce6cef28ea8ecfedb89f756713e95 (patch)
tree799d4a85bfa592e20c8d9585bacb8aed36491d6b /src
parent85c2e99039394292474b1a84e3dcb2fee30a0836 (diff)
mesa: Don't allow blits to / from the same buffer in OpenGL ES 3.0
Fixes gles3conform test CoverageES30. It temporarily regresses some framebuffer_blit tests, but the failing subcases have been determined to be invalid for OpenGL ES 3.0. v2: Fix typo in depth (and stencil) RB checking. Noticed by Ken. Signed-off-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/fbobject.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 80d482611fc..23d6495c9d1 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -2885,6 +2885,23 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
if (!colorDrawRb)
continue;
+ /* Page 193 (page 205 of the PDF) in section 4.3.2 of the OpenGL
+ * ES 3.0.1 spec says:
+ *
+ * "If the source and destination buffers are identical, an
+ * INVALID_OPERATION error is generated. Different mipmap
+ * levels of a texture, different layers of a three-
+ * dimensional texture or two-dimensional array texture, and
+ * different faces of a cube map texture do not constitute
+ * identical buffers."
+ */
+ if (_mesa_is_gles3(ctx) && (colorDrawRb == colorReadRb)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBlitFramebuffer(source and destination color "
+ "buffer cannot be the same)");
+ return;
+ }
+
if (!compatible_color_datatypes(colorReadRb->Format,
colorDrawRb->Format)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
@@ -2934,6 +2951,13 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
else {
int read_z_bits, draw_z_bits;
+ if (_mesa_is_gles3(ctx) && (drawRb == readRb)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBlitFramebuffer(source and destination stencil "
+ "buffer cannot be the same)");
+ return;
+ }
+
if (_mesa_get_format_bits(readRb->Format, GL_STENCIL_BITS) !=
_mesa_get_format_bits(drawRb->Format, GL_STENCIL_BITS)) {
/* There is no need to check the stencil datatype here, because
@@ -2981,6 +3005,13 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
else {
int read_s_bit, draw_s_bit;
+ if (_mesa_is_gles3(ctx) && (drawRb == readRb)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBlitFramebuffer(source and destination depth "
+ "buffer cannot be the same)");
+ return;
+ }
+
if ((_mesa_get_format_bits(readRb->Format, GL_DEPTH_BITS) !=
_mesa_get_format_bits(drawRb->Format, GL_DEPTH_BITS)) ||
(_mesa_get_format_datatype(readRb->Format) !=