From a0d546063bf2ad59187be57e33dcc384024433c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tapani=20P=C3=A4lli?= Date: Mon, 20 Nov 2017 15:00:19 +0200 Subject: [PATCH] mesa/gles: adjust internal format given for texsubimage2d MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tapani Pälli Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103227 --- src/mesa/main/teximage.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 4ec6148bf4..6faf77d307 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -122,6 +122,51 @@ adjust_for_oes_float_texture(const struct gl_context *ctx, return format; } +/** + * Returns a corresponding base format for a given internal floatin point + * format as specifed by OES_texture_float. + */ +static GLenum +gles_internal_format(GLenum type, GLenum format) +{ + switch (type) { + case GL_FLOAT: + switch (format) { + case GL_RGBA32F: + return GL_RGBA; + case GL_RGB32F: + return GL_RGB; + case GL_ALPHA32F_ARB: + return GL_ALPHA; + case GL_LUMINANCE32F_ARB: + return GL_LUMINANCE; + case GL_LUMINANCE_ALPHA32F_ARB: + return GL_LUMINANCE_ALPHA; + default: + break; + } + break; + + case GL_HALF_FLOAT_OES: + switch (format) { + case GL_RGBA16F: + return GL_RGBA; + case GL_RGB16F: + return GL_RGB; + case GL_ALPHA16F_ARB: + return GL_ALPHA; + case GL_LUMINANCE16F_ARB: + return GL_LUMINANCE; + case GL_LUMINANCE_ALPHA16F_ARB: + return GL_LUMINANCE_ALPHA; + default: + break; + } + break; + } + return format; +} + /** * Install gl_texture_image in a gl_texture_object according to the target @@ -2162,7 +2207,7 @@ texsubimage_error_check(struct gl_context *ctx, GLuint dimensions, */ if (_mesa_is_gles(ctx) && texture_format_error_check_gles(ctx, format, type, - texImage->InternalFormat, + gles_internal_format(type, texImage->InternalFormat), dimensions, callerName)) { return GL_TRUE; } -- 2.14.3