[Mesa-dev] [PATCH] mesa: Reject texture-only formats as renderbuffer formats in ES 3
Anuj Phogat
anuj.phogat at gmail.com
Mon Nov 26 16:14:44 PST 2012
On Mon, Nov 26, 2012 at 11:02 AM, Matt Turner <mattst88 at gmail.com> wrote:
> ES 3 specifies some formats as texture-only (i.e., not available for
> renderbuffers).
>
> See the "Required Texture Formats" section (pg 126) of the ES 3 spec.
>
> Fixes es3conform's color_buffer_unsupported_format test.
> ---
> I know Ken doesn't like this part of the spec, but here's the patch in the
> case that we decide to implement it.
>
> src/mesa/main/fbobject.c | 32 +++++++++++---------------------
> 1 files changed, 11 insertions(+), 21 deletions(-)
>
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index 804be0a..b4e8beb 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -1108,7 +1108,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
> case GL_RGB16:
> return _mesa_is_desktop_gl(ctx) ? GL_RGB : 0;
> case GL_SRGB8_EXT:
> - return _mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx) ? GL_RGB : 0;
> + return _mesa_is_desktop_gl(ctx) ? GL_RGB : 0;
> case GL_RGBA4:
> case GL_RGB5_A1:
> case GL_RGBA8:
> @@ -1168,32 +1168,28 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
> ? GL_RG : 0;
> /* signed normalized texture formats */
> case GL_R8_SNORM:
> - return ctx->Version >= 30
> - || (ctx->API == API_OPENGL && ctx->Extensions.EXT_texture_snorm)
> + return (ctx->API == API_OPENGL && ctx->Extensions.EXT_texture_snorm)
> ? GL_RED : 0;
> case GL_RED_SNORM:
> case GL_R16_SNORM:
> return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
> ? GL_RED : 0;
> case GL_RG8_SNORM:
> - return ctx->Version >= 30
> - || (ctx->API == API_OPENGL && ctx->Extensions.EXT_texture_snorm)
> + return (ctx->API == API_OPENGL && ctx->Extensions.EXT_texture_snorm)
> ? GL_RG : 0;
> case GL_RG_SNORM:
> case GL_RG16_SNORM:
> return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
> ? GL_RG : 0;
> case GL_RGB8_SNORM:
> - return ctx->Version >= 30
> - || (ctx->API == API_OPENGL && ctx->Extensions.EXT_texture_snorm)
> + return (ctx->API == API_OPENGL && ctx->Extensions.EXT_texture_snorm)
> ? GL_RGB : 0;
> case GL_RGB_SNORM:
> case GL_RGB16_SNORM:
> return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
> ? GL_RGB : 0;
> case GL_RGBA8_SNORM:
> - return ctx->Version >= 30
> - || (ctx->API == API_OPENGL && ctx->Extensions.EXT_texture_snorm)
> + return (ctx->API == API_OPENGL && ctx->Extensions.EXT_texture_snorm)
> ? GL_RGBA : 0;
> case GL_RGBA_SNORM:
> case GL_RGBA16_SNORM:
> @@ -1225,25 +1221,21 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
> ctx->Extensions.ARB_framebuffer_object ? GL_INTENSITY : 0;
> case GL_R16F:
> case GL_R32F:
> - return ctx->Version >= 30
> - || (ctx->API == API_OPENGL &&
> + return (ctx->API == API_OPENGL &&
> ctx->Extensions.ARB_texture_rg &&
> ctx->Extensions.ARB_texture_float) ? GL_RED : 0;
> case GL_RG16F:
> case GL_RG32F:
> - return ctx->Version >= 30
> - || (ctx->API == API_OPENGL &&
> + return (ctx->API == API_OPENGL &&
> ctx->Extensions.ARB_texture_rg &&
> ctx->Extensions.ARB_texture_float) ? GL_RG : 0;
> case GL_RGB16F:
> case GL_RGB32F:
> return (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_float)
> - || _mesa_is_gles3(ctx)
> ? GL_RGB : 0;
> case GL_RGBA16F:
> case GL_RGBA32F:
> return (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_float)
> - || _mesa_is_gles3(ctx)
> ? GL_RGBA : 0;
> case GL_ALPHA16F_ARB:
> case GL_ALPHA32F_ARB:
> @@ -1268,10 +1260,10 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
> case GL_RGB9_E5:
> return (_mesa_is_desktop_gl(ctx)
> && ctx->Extensions.EXT_texture_shared_exponent)
> - || _mesa_is_gles3(ctx) ? GL_RGB : 0;
> + ? GL_RGB : 0;
> case GL_R11F_G11F_B10F:
> return (_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_packed_float)
> - || _mesa_is_gles3(ctx) ? GL_RGB : 0;
> + ? GL_RGB : 0;
>
> case GL_RGBA8UI_EXT:
> case GL_RGBA16UI_EXT:
> @@ -1289,8 +1281,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
> case GL_RGB8I_EXT:
> case GL_RGB16I_EXT:
> case GL_RGB32I_EXT:
> - return ctx->Version >= 30
> - || (_mesa_is_desktop_gl(ctx) &&
> + return (_mesa_is_desktop_gl(ctx) &&
> ctx->Extensions.EXT_texture_integer) ? GL_RGB : 0;
>
> case GL_R8UI:
> @@ -1310,8 +1301,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
> case GL_RG16I:
> case GL_RG32UI:
> case GL_RG32I:
> - return ctx->Version >= 30
> - || (_mesa_is_desktop_gl(ctx) &&
> + return (_mesa_is_desktop_gl(ctx) &&
> ctx->Extensions.ARB_texture_rg &&
> ctx->Extensions.EXT_texture_integer) ? GL_RG : 0;
>
> --
> 1.7.8.6
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>
More information about the mesa-dev
mailing list