From c36a363a2d305a987ef2ea843fe9fc860b576eed Mon Sep 17 00:00:00 2001 From: Jordan Justen Date: Wed, 22 Jun 2016 17:34:08 +0000 Subject: [PATCH] i965: Preserve the internal format of the dri image MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Since the OpenGLES API is strict about the internal format matching the for many operations, we need to preserve it. See _mesa_es3_error_check_format_and_type in src/mesa/main/glformats.c. Fixes ES2-CTS.gtf.GL2ExtensionTests.egl_image.egl_image Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96351 Reported-by: Mark Janes Signed-off-by: Jordan Justen Cc: Kristian Høgsberg Cc: Chad Versace Cc: "12.0" Reviewed-by: Chad Versace --- src/mesa/drivers/dri/i965/intel_tex_image.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c b/src/mesa/drivers/dri/i965/intel_tex_image.c index 9cc426c7e9d..958f8bd5a5f 100644 --- a/src/mesa/drivers/dri/i965/intel_tex_image.c +++ b/src/mesa/drivers/dri/i965/intel_tex_image.c @@ -138,10 +138,10 @@ intelTexImage(struct gl_context * ctx, static void intel_set_texture_image_mt(struct brw_context *brw, struct gl_texture_image *image, + GLenum internal_format, struct intel_mipmap_tree *mt) { - const uint32_t internal_format = _mesa_get_format_base_format(mt->format); struct gl_texture_object *texobj = image->TexObject; struct intel_texture_object *intel_texobj = intel_texture_object(texobj); struct intel_texture_image *intel_image = intel_texture_image(image); @@ -264,6 +264,7 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, struct gl_texture_image *texImage; mesa_format texFormat = MESA_FORMAT_NONE; struct intel_mipmap_tree *mt; + GLenum internal_format = 0; texObj = _mesa_get_current_tex_object(ctx, target); @@ -283,12 +284,15 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, if (rb->mt->cpp == 4) { if (texture_format == __DRI_TEXTURE_FORMAT_RGB) { + internal_format = GL_RGB; texFormat = MESA_FORMAT_B8G8R8X8_UNORM; } else { + internal_format = GL_RGBA; texFormat = MESA_FORMAT_B8G8R8A8_UNORM; } } else if (rb->mt->cpp == 2) { + internal_format = GL_RGB; texFormat = MESA_FORMAT_B5G6R5_UNORM; } @@ -305,7 +309,7 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, _mesa_lock_texture(&brw->ctx, texObj); texImage = _mesa_get_tex_image(ctx, texObj, target, 0); - intel_set_texture_image_mt(brw, texImage, mt); + intel_set_texture_image_mt(brw, texImage, internal_format, mt); intel_miptree_release(&mt); _mesa_unlock_texture(&brw->ctx, texObj); } @@ -399,7 +403,10 @@ intel_image_target_texture_2d(struct gl_context *ctx, GLenum target, struct intel_texture_object *intel_texobj = intel_texture_object(texObj); intel_texobj->planar_format = image->planar_format; - intel_set_texture_image_mt(brw, texImage, mt); + const GLenum internal_format = + image->internal_format != 0 ? + image->internal_format : _mesa_get_format_base_format(mt->format); + intel_set_texture_image_mt(brw, texImage, internal_format, mt); intel_miptree_release(&mt); } -- 2.30.2