i965: Ensure that all 2101010 image imports can pass framebuffer completeness.
authorMiguel Casas-Sanchez <miguelecasassanchez@gmail.com>
Tue, 19 Nov 2019 02:21:12 +0000 (02:21 +0000)
committerEric Anholt <eric@anholt.net>
Tue, 19 Nov 2019 02:21:12 +0000 (02:21 +0000)
Chrome OS would like to import and render to any supported format that has
a corresponding display plane format, and this prevents throwing
framebuffer incomplete for FBOs using these textures.

See: crbug.com/949260

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/dri/i965/intel_tex_image.c

index 95c44a0313ac16ed9ce2e02ed4f101d2676b3aea..bcc0853018be46b409d1d6d5e36dc51a5f26ea1f 100644 (file)
@@ -637,10 +637,14 @@ intel_image_target_texture_2d(struct gl_context *ctx, GLenum target,
       image->internal_format != 0 ?
       image->internal_format : _mesa_get_format_base_format(mt->format);
 
-   /* Setup a sized internal format for MESA_FORMAT_R10G10B10[X2|A2]_UNORM. */
+   /* Fix the internal format when _mesa_get_format_base_format(mt->format)
+    * isn't a valid one for that particular format.
+    */
    if (brw->mesa_format_supports_render[image->format]) {
       if (image->format == MESA_FORMAT_R10G10B10A2_UNORM ||
-          image->format == MESA_FORMAT_R10G10B10X2_UNORM)
+          image->format == MESA_FORMAT_R10G10B10X2_UNORM ||
+          image->format == MESA_FORMAT_B10G10R10A2_UNORM ||
+          image->format == MESA_FORMAT_B10G10R10X2_UNORM)
          internal_format = GL_RGB10_A2;
    }