summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorJordan Justen <[email protected]>2016-06-22 17:34:08 +0000
committerJordan Justen <[email protected]>2016-06-23 20:44:00 -0700
commitc36a363a2d305a987ef2ea843fe9fc860b576eed (patch)
tree792feb0645bbba639b5e2b6058fc435ee7e6d714 /src/mesa/drivers/dri
parenta0f3c3c9d4002ffc1dd987c816a1462e4a91a5f4 (diff)
i965: Preserve the internal format of the dri image
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 <[email protected]> Signed-off-by: Jordan Justen <[email protected]> Cc: Kristian Høgsberg <[email protected]> Cc: Chad Versace <[email protected]> Cc: "12.0" <[email protected]> Reviewed-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/i965/intel_tex_image.c13
1 files 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);
}