mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
* chore: cherry-pick fix for 1234829 from angle * chore: update patches Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
91 lines
3.6 KiB
Diff
91 lines
3.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Alexey Knyazev <lexa.knyazev@gmail.com>
|
|
Date: Tue, 3 Aug 2021 01:57:49 +0400
|
|
Subject: Validate texStorage dimensions with compressed formats
|
|
|
|
Bug: angleproject:6230
|
|
Change-Id: I501ec1e6974bdc7e6731dcb88045edb0aa22b888
|
|
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3067329
|
|
Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
|
|
Reviewed-by: Kenneth Russell <kbr@chromium.org>
|
|
Reviewed-by: Jamie Madill <jmadill@chromium.org>
|
|
|
|
diff --git a/src/libANGLE/validationES3.cpp b/src/libANGLE/validationES3.cpp
|
|
index 1d93a066580818c7616fa66252e6465f6137aceb..3935c52a894c5584eef66bea34a8684176909358 100644
|
|
--- a/src/libANGLE/validationES3.cpp
|
|
+++ b/src/libANGLE/validationES3.cpp
|
|
@@ -1339,17 +1339,26 @@ bool ValidateES3TexStorageParametersBase(const Context *context,
|
|
return false;
|
|
}
|
|
|
|
- if (formatInfo.compressed && target == TextureType::Rectangle)
|
|
+ if (formatInfo.compressed)
|
|
{
|
|
- context->validationError(GL_INVALID_ENUM, kRectangleTextureCompressed);
|
|
- return false;
|
|
- }
|
|
+ if (target == TextureType::Rectangle)
|
|
+ {
|
|
+ context->validationError(GL_INVALID_ENUM, kRectangleTextureCompressed);
|
|
+ return false;
|
|
+ }
|
|
|
|
- if (formatInfo.compressed && target == TextureType::_3D)
|
|
- {
|
|
- if (!ValidateES3CompressedFormatForTexture3D(context, formatInfo.internalFormat))
|
|
+ if (target == TextureType::_3D)
|
|
{
|
|
- // Error already generated.
|
|
+ if (!ValidateES3CompressedFormatForTexture3D(context, formatInfo.internalFormat))
|
|
+ {
|
|
+ // Error already generated.
|
|
+ return false;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ if (!ValidCompressedImageSize(context, formatInfo.internalFormat, 0, width, height, depth))
|
|
+ {
|
|
+ context->validationError(GL_INVALID_OPERATION, kInvalidCompressedImageSize);
|
|
return false;
|
|
}
|
|
}
|
|
diff --git a/src/tests/gl_tests/SRGBTextureTest.cpp b/src/tests/gl_tests/SRGBTextureTest.cpp
|
|
index 68fd9f7165ff237ed3c86a42be0b2a24dd9819c7..6c65740cb406e1c598dc41ff0e8998230a926883 100644
|
|
--- a/src/tests/gl_tests/SRGBTextureTest.cpp
|
|
+++ b/src/tests/gl_tests/SRGBTextureTest.cpp
|
|
@@ -340,7 +340,7 @@ TEST_P(SRGBTextureTestES3, SRGBOverrideFormats)
|
|
{
|
|
GLTexture tex;
|
|
glBindTexture(GL_TEXTURE_2D, tex.get());
|
|
- glTexStorage2D(GL_TEXTURE_2D, 1, format, 1, 1);
|
|
+ glTexStorage2D(GL_TEXTURE_2D, 1, format, 4, 4);
|
|
GLenum error = glGetError();
|
|
if (error == GL_INVALID_ENUM)
|
|
{
|
|
diff --git a/src/tests/gl_tests/WebGLCompatibilityTest.cpp b/src/tests/gl_tests/WebGLCompatibilityTest.cpp
|
|
index 89eb4d639a3853636524ad112a24f15d46fa1119..b9380bb10ad434acfc858c08db8a629db0bfaecf 100644
|
|
--- a/src/tests/gl_tests/WebGLCompatibilityTest.cpp
|
|
+++ b/src/tests/gl_tests/WebGLCompatibilityTest.cpp
|
|
@@ -5023,6 +5023,21 @@ void WebGLCompatibilityTest::testCompressedTexLevelDimension(GLenum format,
|
|
{
|
|
EXPECT_GL_ERROR(expectedError) << explanation;
|
|
}
|
|
+
|
|
+ if (level == 0 && width > 0 && getClientMajorVersion() >= 3)
|
|
+ {
|
|
+ GLTexture sourceTextureStorage;
|
|
+ glBindTexture(GL_TEXTURE_2D, sourceTextureStorage);
|
|
+ glTexStorage2D(GL_TEXTURE_2D, 1, format, width, height);
|
|
+ if (expectedError == 0)
|
|
+ {
|
|
+ EXPECT_GL_NO_ERROR() << explanation << " (texStorage)";
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ EXPECT_GL_ERROR(expectedError) << explanation << " (texStorage)";
|
|
+ }
|
|
+ }
|
|
}
|
|
|
|
void WebGLCompatibilityTest::testCompressedTexImage(GLenum format)
|