aboutsummaryrefslogtreecommitdiff
path: root/tests/compiler_tests/ShaderVariable_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/compiler_tests/ShaderVariable_test.cpp')
-rw-r--r--tests/compiler_tests/ShaderVariable_test.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/compiler_tests/ShaderVariable_test.cpp b/tests/compiler_tests/ShaderVariable_test.cpp
index b642260f..7fda29e7 100644
--- a/tests/compiler_tests/ShaderVariable_test.cpp
+++ b/tests/compiler_tests/ShaderVariable_test.cpp
@@ -218,4 +218,29 @@ TEST(ShaderVariableTest, IsSameVaryingWithDifferentInvariance)
EXPECT_TRUE(vx.isSameVaryingAtLinkTime(fx));
}
+// Test that using invariant varyings doesn't trigger a double delete.
+TEST(ShaderVariableTest, InvariantDoubleDeleteBug)
+{
+ ShBuiltInResources resources;
+ ShInitBuiltInResources(&resources);
+
+ ShHandle compiler = ShConstructCompiler(GL_VERTEX_SHADER, SH_GLES2_SPEC, SH_GLSL_OUTPUT, &resources);
+ EXPECT_NE(static_cast<ShHandle>(0), compiler);
+
+ const char *program[] =
+ {
+ "attribute vec4 position;\n"
+ "varying float v;\n"
+ "invariant v;\n"
+ "void main() {\n"
+ " v = 1.0;\n"
+ " gl_Position = position;\n"
+ "}"
+ };
+
+ EXPECT_TRUE(ShCompile(compiler, program, 1, SH_OBJECT_CODE));
+ EXPECT_TRUE(ShCompile(compiler, program, 1, SH_OBJECT_CODE));
+ ShDestruct(compiler);
+}
+
} // namespace sh