i965: Check base format to determine whether to use tiled memcpy

The tiled memcpy doesn't work for copying from RGBX to RGBA because it
doesn't override the alpha component to 1.0. Commit 2cebaac479 added
a check to disable it for RGBX formats by looking at the TexFormat.
However a lot of the rest of the code base is written with the
assumption that an RGBA texture can be used internally to implement a
GL_RGB texture. If that is done then this check breaks. This patch
makes it instead check the base format of the texture which I think
more directly matches the intention.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
This commit is contained in:
Neil Roberts 2015-11-19 15:06:08 +01:00
parent 9a31d9870b
commit 3f10774cba
2 changed files with 8 additions and 6 deletions

View file

@ -134,10 +134,11 @@ intel_readpixels_tiled_memcpy(struct gl_context * ctx,
return false;
/* We can't handle copying from RGBX or BGRX because the tiled_memcpy
* function doesn't set the last channel to 1.
* function doesn't set the last channel to 1. Note this checks BaseFormat
* rather than TexFormat in case the RGBX format is being simulated with an
* RGBA format.
*/
if (rb->Format == MESA_FORMAT_B8G8R8X8_UNORM ||
rb->Format == MESA_FORMAT_R8G8B8X8_UNORM)
if (rb->_BaseFormat == GL_RGB)
return false;
if (!intel_get_memcpy(rb->Format, format, type, &mem_copy, &cpp,

View file

@ -398,10 +398,11 @@ intel_gettexsubimage_tiled_memcpy(struct gl_context *ctx,
return false;
/* We can't handle copying from RGBX or BGRX because the tiled_memcpy
* function doesn't set the last channel to 1.
* function doesn't set the last channel to 1. Note this checks BaseFormat
* rather than TexFormat in case the RGBX format is being simulated with an
* RGBA format.
*/
if (texImage->TexFormat == MESA_FORMAT_B8G8R8X8_UNORM ||
texImage->TexFormat == MESA_FORMAT_R8G8B8X8_UNORM)
if (texImage->_BaseFormat == GL_RGB)
return false;
if (!intel_get_memcpy(texImage->TexFormat, format, type, &mem_copy, &cpp,