Commit 680a7d3b by Shahbaz Youssefi Committed by Commit Bot

Vulkan: Add test that exposes sampler refactor bug

Bug: angleproject:4211 Change-Id: I9e9cdacd4f24131101029d17932625e2e3c7d7e0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1957836 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com>
parent 683dd1d6
...@@ -3038,6 +3038,32 @@ void main() ...@@ -3038,6 +3038,32 @@ void main()
EXPECT_EQ(GL_INVALID_INDEX, index); EXPECT_EQ(GL_INVALID_INDEX, index);
} }
// Test that inactive samplers in structs don't cause any errors.
TEST_P(GLSLTest_ES31, InactiveSamplersInStructCS)
{
// While the sampler is being extracted and declared outside of the struct, it's not removed
// from the struct definition. http://anglebug.com/4211
ANGLE_SKIP_TEST_IF(IsVulkan() || IsMetal());
constexpr char kCS[] = R"(#version 310 es
layout(local_size_x=1, local_size_y=1, local_size_z=1) in;
struct S
{
vec4 v;
sampler2D t[10];
};
uniform S s;
void main()
{
})";
ANGLE_GL_COMPUTE_PROGRAM(program, kCS);
glUseProgram(program.get());
glDispatchCompute(1, 1, 1);
EXPECT_GL_NO_ERROR();
}
// Test that array indices for arrays of arrays of basic types work as expected. // Test that array indices for arrays of arrays of basic types work as expected.
TEST_P(GLSLTest_ES31, ArraysOfArraysBasicType) TEST_P(GLSLTest_ES31, ArraysOfArraysBasicType)
{ {
...@@ -6644,6 +6670,34 @@ TEST_P(GLSLTest, MemoryExhaustedTest) ...@@ -6644,6 +6670,34 @@ TEST_P(GLSLTest, MemoryExhaustedTest)
EXPECT_NE(0u, program); EXPECT_NE(0u, program);
} }
// Test that inactive samplers in structs don't cause any errors.
TEST_P(GLSLTest, InactiveSamplersInStruct)
{
// While the sampler is being extracted and declared outside of the struct, it's not removed
// from the struct definition. http://anglebug.com/4211
ANGLE_SKIP_TEST_IF(IsVulkan() || IsMetal());
constexpr char kVS[] = R"(attribute vec4 a_position;
void main() {
gl_Position = a_position;
})";
constexpr char kFS[] = R"(precision highp float;
struct S
{
vec4 v;
sampler2D t[10];
};
uniform S s;
void main() {
gl_FragColor = s.v;
})";
ANGLE_GL_PROGRAM(program, kVS, kFS);
drawQuad(program, "a_position", 0.5f);
}
// Helper functions for MixedRowAndColumnMajorMatrices* tests // Helper functions for MixedRowAndColumnMajorMatrices* tests
// Round up to alignment, assuming it's a power of 2 // Round up to alignment, assuming it's a power of 2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment