Signed-off-by: Jordan Justen <jordan.l.jus...@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: + 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); -- 1.7.10.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev