зеркало из https://github.com/AvaloniaUI/angle.git
Rework compressed texture pixel unpack state handling.
Compressed images do not use the pixel unpack parameters. Instead of handling this in Context, move this to formatutils, where it's already handled for the 2D case. Also, update the test to generate an ASAN error if not ignored for the 2D case. Bug: chromium:1267496 Change-Id: Ib93bae00a2b0b75eafd74c267f737da225afd993 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3308825 Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Родитель
8f6f5a4bb2
Коммит
2d41e0f742
|
@ -1648,7 +1648,7 @@ bool InternalFormat::computeRowPitch(GLenum formatType,
|
|||
GLint rowLength,
|
||||
GLuint *resultOut) const
|
||||
{
|
||||
// Compressed images do not use pack/unpack parameters.
|
||||
// Compressed images do not use pack/unpack parameters (rowLength).
|
||||
if (compressed)
|
||||
{
|
||||
return computeCompressedImageSize(Extents(width, 1, 1), resultOut);
|
||||
|
@ -1668,8 +1668,10 @@ bool InternalFormat::computeDepthPitch(GLsizei height,
|
|||
GLuint rowPitch,
|
||||
GLuint *resultOut) const
|
||||
{
|
||||
CheckedNumeric<GLuint> pixelsHeight(imageHeight > 0 ? static_cast<GLuint>(imageHeight)
|
||||
: static_cast<GLuint>(height));
|
||||
// Compressed images do not use pack/unpack parameters (imageHeight).
|
||||
CheckedNumeric<GLuint> pixelsHeight(!compressed && (imageHeight > 0)
|
||||
? static_cast<GLuint>(imageHeight)
|
||||
: static_cast<GLuint>(height));
|
||||
|
||||
CheckedNumeric<GLuint> rowCount;
|
||||
if (compressed)
|
||||
|
|
|
@ -5949,11 +5949,11 @@ TEST_P(Texture2DTestES3, PixelUnpackStateTexImage)
|
|||
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_EXT_texture_compression_s3tc") &&
|
||||
!IsGLExtensionEnabled("GL_ANGLE_texture_compression_dxt3"));
|
||||
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 5);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 9);
|
||||
glBindTexture(GL_TEXTURE_2D, mTexture2D);
|
||||
|
||||
uint8_t data[16] = {0};
|
||||
glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, 4, 4, 0, 16, data);
|
||||
uint8_t data[64] = {0};
|
||||
glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, 8, 8, 0, 64, data);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
}
|
||||
|
||||
|
@ -5966,13 +5966,13 @@ TEST_P(Texture2DTestES3, PixelUnpackStateTexSubImage)
|
|||
|
||||
glBindTexture(GL_TEXTURE_2D, mTexture2D);
|
||||
|
||||
uint8_t data[16] = {0};
|
||||
glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, 4, 4, 0, 16, data);
|
||||
uint8_t data[64] = {0};
|
||||
glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, 8, 8, 0, 64, data);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 5);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 9);
|
||||
|
||||
glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, 16,
|
||||
glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 8, 8, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, 64,
|
||||
data);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче