Fixed format validations Format validations were failing if the exact same format wasn't used between different texture related calls to the same texture, even when the formats were equivalent, so I added a GetSizedInternalFormat function based on a format map (courtesy of Angle). The validation checks were also unified in utilities.cpp and used wherever texture formats were used, to make sure Image objects used in Texture objects always use the sized format, so that format comparisons work properly. Change-Id: I72fc8fb1b0f135ac679c274866e5b8e223541e7f Reviewed-on: https://swiftshader-review.googlesource.com/4082 Tested-by: Alexis Hétu <sugoi@google.com> Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/OpenGL/common/Image.cpp b/src/OpenGL/common/Image.cpp index 32c3744..9799f98 100644 --- a/src/OpenGL/common/Image.cpp +++ b/src/OpenGL/common/Image.cpp
@@ -468,6 +468,7 @@ } break; case GL_BGRA_EXT: + case GL_BGRA8_EXT: switch(type) { case GL_UNSIGNED_BYTE: return sw::FORMAT_A8R8G8B8; @@ -735,6 +736,7 @@ case GL_RGBA_INTEGER: return sw::FORMAT_A8B8G8R8UI; case GL_BGRA_EXT: + case GL_BGRA8_EXT: return sw::FORMAT_A8R8G8B8; case GL_ALPHA: case GL_ALPHA8_EXT: @@ -923,7 +925,8 @@ case GL_SRGB8_ALPHA8: case GL_RGBA: return sizeof(unsigned char) * 4; case GL_RGBA_INTEGER: return sizeof(unsigned char) * 4; - case GL_BGRA_EXT: return sizeof(unsigned char) * 4; + case GL_BGRA_EXT: + case GL_BGRA8_EXT: return sizeof(unsigned char)* 4; default: UNREACHABLE(format); } break; @@ -1226,6 +1229,7 @@ case GL_RGBA: case GL_RGBA_INTEGER: case GL_BGRA_EXT: + case GL_BGRA8_EXT: LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); break; default: UNREACHABLE(format); @@ -1267,6 +1271,7 @@ case GL_RGBA: case GL_RGBA_INTEGER: case GL_BGRA_EXT: + case GL_BGRA8_EXT: LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); break; case GL_SRGB8: @@ -1441,6 +1446,7 @@ case GL_RGBA: case GL_RGBA_INTEGER: case GL_BGRA_EXT: + case GL_BGRA8_EXT: LoadImageData<Bytes_8>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); break; default: UNREACHABLE(format); @@ -1471,6 +1477,7 @@ case GL_RGBA: case GL_RGBA_INTEGER: case GL_BGRA_EXT: + case GL_BGRA8_EXT: LoadImageData<Bytes_8>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); break; case GL_DEPTH_COMPONENT: @@ -1505,6 +1512,7 @@ case GL_RGBA: case GL_RGBA_INTEGER: case GL_BGRA_EXT: + case GL_BGRA8_EXT: LoadImageData<Bytes_16>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); break; default: UNREACHABLE(format); @@ -1535,6 +1543,7 @@ case GL_RGBA: case GL_RGBA_INTEGER: case GL_BGRA_EXT: + case GL_BGRA8_EXT: LoadImageData<Bytes_8>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); break; case GL_DEPTH_COMPONENT16: