Commit 76287680 by Corentin Wallez Committed by Commit Bot

Fix the CopyTex validation logic for sized types

Previously we allowed copies to a sized format only if the depth of each component matched (including 0 depth). Now we require that the bit depth of non-empty component matches. BUG=605775 Change-Id: If8abab886b0da5a1c8e89adabf3809f928dcedce Reviewed-on: https://chromium-review.googlesource.com/340382Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
parent a314b61c
...@@ -728,6 +728,11 @@ static CopyConversionSet BuildValidES3CopyTexImageCombinations() ...@@ -728,6 +728,11 @@ static CopyConversionSet BuildValidES3CopyTexImageCombinations()
return set; return set;
} }
static bool EqualOrFirstZero(GLuint first, GLuint second)
{
return first == 0 || first == second;
}
static bool IsValidES3CopyTexImageCombination(GLenum textureInternalFormat, GLenum frameBufferInternalFormat, GLuint readBufferHandle) static bool IsValidES3CopyTexImageCombination(GLenum textureInternalFormat, GLenum frameBufferInternalFormat, GLuint readBufferHandle)
{ {
const InternalFormat &textureInternalFormatInfo = GetInternalFormatInfo(textureInternalFormat); const InternalFormat &textureInternalFormatInfo = GetInternalFormatInfo(textureInternalFormat);
...@@ -832,12 +837,17 @@ static bool IsValidES3CopyTexImageCombination(GLenum textureInternalFormat, GLen ...@@ -832,12 +837,17 @@ static bool IsValidES3CopyTexImageCombination(GLenum textureInternalFormat, GLen
if (textureInternalFormatInfo.pixelBytes > 0) if (textureInternalFormatInfo.pixelBytes > 0)
{ {
// Section 3.8.5 of the GLES 3.0.3 spec, pg 139, requires that, if the destination format is sized, // Section 3.8.5 of the GLES 3.0.3 spec, pg 139, requires that, if the destination
// component sizes of the source and destination formats must exactly match // format is sized, component sizes of the source and destination formats must exactly
if (textureInternalFormatInfo.redBits != sourceEffectiveFormat->redBits || // match if the destination format exists.
textureInternalFormatInfo.greenBits != sourceEffectiveFormat->greenBits || if (!EqualOrFirstZero(textureInternalFormatInfo.redBits,
textureInternalFormatInfo.blueBits != sourceEffectiveFormat->blueBits || sourceEffectiveFormat->redBits) ||
textureInternalFormatInfo.alphaBits != sourceEffectiveFormat->alphaBits) !EqualOrFirstZero(textureInternalFormatInfo.greenBits,
sourceEffectiveFormat->greenBits) ||
!EqualOrFirstZero(textureInternalFormatInfo.blueBits,
sourceEffectiveFormat->blueBits) ||
!EqualOrFirstZero(textureInternalFormatInfo.alphaBits,
sourceEffectiveFormat->alphaBits))
{ {
return false; return false;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment