OSDN Git Service

GLES: Add tests to exersise sparse labels.
authorBen Clayton <bclayton@google.com>
Thu, 21 Feb 2019 12:37:53 +0000 (12:37 +0000)
committerBen Clayton <bclayton@google.com>
Thu, 21 Feb 2019 14:40:24 +0000 (14:40 +0000)
Reproduces the issues reported by b/125183107.

Bug: b/125183107
Change-Id: If0f2ab3fcc8c065409fdbbc6df670f78a78fa3f7
Reviewed-on: https://swiftshader-review.googlesource.com/c/25169
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
tests/GLESUnitTests/unittests.cpp

index 55813b3..33fbaf6 100644 (file)
@@ -1578,6 +1578,22 @@ TEST_F(SwiftShaderTest, CompilerLimits_DeepNestedCallsInUnusedFunction)
        );
 }
 
+// Test that the compiler correctly handles functions being stripped.
+// The frontend will strip the Dead functions, but may keep the their function
+// labels reserved. This produces labels that are greater than the number of
+// live functions.
+TEST_F(SwiftShaderTest, CompilerLimits_SparseLabels)
+{
+       checkCompiles(
+               "void Dead1() {}\n"
+               "void Dead2() {}\n"
+               "void Dead3() {}\n"
+               "void Dead4() {}\n"
+               "void Dead5() { Dead1(); Dead2(); Dead3(); Dead4(); }\n"
+               "float F(float f) { for(int i = 0; i < -1; ++i) { Dead5(); } return f; }\n"
+       );
+}
+
 #ifndef EGL_ANGLE_iosurface_client_buffer
 #define EGL_ANGLE_iosurface_client_buffer 1
 #define EGL_IOSURFACE_ANGLE 0x3454