[Mesa-dev] [PATCH] mesa: Don't allow blits to / from the same buffer in OpenGL ES 3.0
Kenneth Graunke
kenneth at whitecape.org
Fri Jan 18 11:16:13 PST 2013
On 01/18/2013 10:54 AM, Ian Romanick wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> 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.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
> src/mesa/main/fbobject.c | 31 +++++++++++++++++++++++++++++++
> 1 file changed, 31 insertions(+)
>
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index 9db5035..721ecea 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -2856,6 +2856,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,
> @@ -2905,6 +2922,13 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
> else {
> int read_z_bits, draw_z_bits;
>
> + if (_mesa_is_gles3(ctx) && (drawFb == readFb)) {
Don't you want drawRb == readRb here?
> + _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
> @@ -2952,6 +2976,13 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
> else {
> int read_s_bit, draw_s_bit;
>
> + if (_mesa_is_gles3(ctx) && (drawFb == readFb)) {
Ditto.
> + _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) !=
More information about the mesa-dev
mailing list