Commit 80b5a55e by Jamie Madill

Fix compressed formats breaking swizzle bits checks.

We defautled to zero max bit depth, which breaks the swizzle format lookup. Change-Id: I4d1cd8bcfb79db3460950fa22630c259f90fa432 Reviewed-on: https://chromium-review.googlesource.com/181481Reviewed-by: 's avatarJamie Madill <jmadill@google.com> Commit-Queue: Jamie Madill <jmadill@google.com> Reviewed-by: 's avatarShannon Woods <shannonwoods@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 44cc79f6
......@@ -789,13 +789,23 @@ static const SwizzleInfoMap &GetSwizzleInfoMap()
static const SwizzleFormatInfo GetSwizzleFormatInfo(GLint internalFormat, GLuint clientVersion)
{
// Get the maximum sized component
unsigned int maxBits = 0;
maxBits = std::max(maxBits, gl::GetAlphaBits( internalFormat, clientVersion));
maxBits = std::max(maxBits, gl::GetRedBits( internalFormat, clientVersion));
maxBits = std::max(maxBits, gl::GetGreenBits( internalFormat, clientVersion));
maxBits = std::max(maxBits, gl::GetBlueBits( internalFormat, clientVersion));
maxBits = std::max(maxBits, gl::GetLuminanceBits(internalFormat, clientVersion));
maxBits = std::max(maxBits, gl::GetDepthBits( internalFormat, clientVersion));
unsigned int maxBits = 1;
if (gl::IsFormatCompressed(internalFormat, clientVersion))
{
maxBits = (gl::GetCompressedBlockWidth(internalFormat, clientVersion) * gl::GetCompressedBlockHeight(internalFormat, clientVersion)) /
(gl::GetPixelBytes(internalFormat, clientVersion) * 8);
}
else
{
maxBits = std::max(maxBits, gl::GetAlphaBits( internalFormat, clientVersion));
maxBits = std::max(maxBits, gl::GetRedBits( internalFormat, clientVersion));
maxBits = std::max(maxBits, gl::GetGreenBits( internalFormat, clientVersion));
maxBits = std::max(maxBits, gl::GetBlueBits( internalFormat, clientVersion));
maxBits = std::max(maxBits, gl::GetLuminanceBits(internalFormat, clientVersion));
maxBits = std::max(maxBits, gl::GetDepthBits( internalFormat, clientVersion));
}
maxBits = roundUp(maxBits, 8U);
GLenum componentType = gl::GetComponentType(internalFormat, clientVersion);
......
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