[Mesa-dev] [PATCH 05/23] fbobject: add additional fbo completeness checks for GLES
Ian Romanick
idr at freedesktop.org
Mon Jan 7 10:26:26 PST 2013
On 01/04/2013 06:41 PM, Jordan Justen wrote:
> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> ---
> src/mesa/main/fbobject.c | 57 +++++++++++++++++++++++++++++++++++++++++++---
> 1 file changed, 54 insertions(+), 3 deletions(-)
>
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index f1cf700..097e0e2 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -503,6 +503,57 @@ _mesa_is_legal_color_format(const struct gl_context *ctx, GLenum baseFormat)
>
>
> /**
> + * Is the given base format a legal format for a color renderbuffer?
> + */
> +static GLboolean
> +is_format_color_renderable(const struct gl_context *ctx, gl_format format, GLenum internalFormat)
> +{
> + const GLenum baseFormat =
> + _mesa_get_format_base_format(format);
> + GLboolean valid;
> +
> + valid = _mesa_is_legal_color_format(ctx, baseFormat);
> + if (!valid || _mesa_is_desktop_gl(ctx)) {
> + return valid;
> + }
> +
> + /* Reject additional cases for GLES */
> + switch (internalFormat) {
> + case GL_RGBA32F:
> + case GL_RGBA16F:
> + case GL_RGBA8_SNORM:
> + case GL_RGB32F:
> + case GL_RGB32I:
> + case GL_RGB32UI:
> + case GL_RGB16F:
> + case GL_RGB16I:
> + case GL_RGB16UI:
> + case GL_RGB8_SNORM:
> + case GL_RGB8I:
> + case GL_RGB8UI:
> + case GL_SRGB8:
> + case GL_R11F_G11F_B10F:
> + case GL_RGB9_E5:
> + case GL_RG32F:
> + case GL_RG16F:
> + case GL_RG8_SNORM:
> + case GL_R32F:
> + case GL_R16F:
> + case GL_R8_SNORM:
This should be unnecessary. My patches that already take care of the
SNORM cases have landed. For the float formats, we should just enable
EXT_color_buffer_float (or whatever it is). I don't think RGB9_E5
should be renderable even on desktop... can any hardware do that?
> + return GL_FALSE;
> + default:
> + break;
> + }
> +
> + if (format == MESA_FORMAT_ARGB2101010 && internalFormat != GL_RGB10_A2) {
> + return GL_FALSE;
> + }
> +
> + return GL_TRUE;
> +}
> +
> +
> +/**
> * Is the given base format a legal format for a depth/stencil renderbuffer?
> */
> static GLboolean
> @@ -567,7 +618,7 @@ test_attachment_completeness(const struct gl_context *ctx, GLenum format,
> baseFormat = _mesa_get_format_base_format(texImage->TexFormat);
>
> if (format == GL_COLOR) {
> - if (!_mesa_is_legal_color_format(ctx, baseFormat)) {
> + if (!is_format_color_renderable(ctx, texImage->TexFormat, texImage->InternalFormat)) {
> att_incomplete("bad format");
> att->Complete = GL_FALSE;
> return;
> @@ -621,7 +672,7 @@ test_attachment_completeness(const struct gl_context *ctx, GLenum format,
> return;
> }
> if (format == GL_COLOR) {
> - if (!_mesa_is_legal_color_format(ctx, baseFormat)) {
> + if (!is_format_color_renderable(ctx, att->Renderbuffer->Format, att->Renderbuffer->InternalFormat)) {
> att_incomplete("bad renderbuffer color format");
> att->Complete = GL_FALSE;
> return;
> @@ -750,7 +801,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
> f = texImg->_BaseFormat;
> attFormat = texImg->TexFormat;
> numImages++;
> - if (!_mesa_is_legal_color_format(ctx, f) &&
> + if (!is_format_color_renderable(ctx, attFormat, texImg->InternalFormat) &&
> !is_legal_depth_format(ctx, f)) {
> fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT;
> fbo_incomplete("texture attachment incomplete", -1);
>
More information about the mesa-dev
mailing list