aboutsummaryrefslogtreecommitdiff
path: root/src/tests/gl_tests/GLSLTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/gl_tests/GLSLTest.cpp')
-rw-r--r--src/tests/gl_tests/GLSLTest.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/tests/gl_tests/GLSLTest.cpp b/src/tests/gl_tests/GLSLTest.cpp
index 7b6e70d168..b34db39c4a 100644
--- a/src/tests/gl_tests/GLSLTest.cpp
+++ b/src/tests/gl_tests/GLSLTest.cpp
@@ -9094,6 +9094,45 @@ void main()
EXPECT_NE(compileResult, 0);
}
+// Test that packing of excessive 3-column variables does not overflow the count of 3-column
+// variables in VariablePacker
+TEST_P(WebGL2GLSLTest, ExcessiveMat3UniformPacking)
+{
+ std::ostringstream srcStream;
+
+ srcStream << "#version 300 es\n";
+ srcStream << "precision mediump float;\n";
+ srcStream << "out vec4 finalColor;\n";
+ srcStream << "in vec4 color;\n";
+ srcStream << "uniform mat4 r[254];\n";
+
+ srcStream << "uniform mat3 ";
+ constexpr size_t kNumUniforms = 10000;
+ for (size_t i = 0; i < kNumUniforms; ++i)
+ {
+ if (i > 0)
+ {
+ srcStream << ", ";
+ }
+ srcStream << "m3a_" << i << "[256]";
+ }
+ srcStream << ";\n";
+
+ srcStream << "void main(void) { finalColor = color; }\n";
+ std::string src = std::move(srcStream).str();
+
+ GLuint shader = glCreateShader(GL_VERTEX_SHADER);
+
+ const char *sourceArray[1] = {src.c_str()};
+ GLint lengths[1] = {static_cast<GLint>(src.length())};
+ glShaderSource(shader, 1, sourceArray, lengths);
+ glCompileShader(shader);
+
+ GLint compileResult;
+ glGetShaderiv(shader, GL_COMPILE_STATUS, &compileResult);
+ EXPECT_EQ(compileResult, 0);
+}
+
// Test that a varying with a flat qualifier that is used as an operand of a folded ternary operator
// is handled correctly.
TEST_P(GLSLTest_ES3, FlatVaryingUsedInFoldedTernary)