Commit a62ee4d1 by Mohan Maiya Committed by Commit Bot

Vulkan: Add test for Pixel bug with passthrough GLSL function

Passing in a sampler2D's values using texture2D through a function generates unexpected results on a Pixel device with the Vulkan backend. 1. SamplerPassthroughFailedLink - program fails to link. 2. SamplerPassthroughIncorrectColor - output color is incorrect. These tests have no issues with SwiftShader ICD. Tests: angle_end2end_tests --gtest_filter=*SamplerPassthrough*Vulkan* Bug: angleproject:5457 Change-Id: I9c43062e98c7b3637bb8a2b00a957141da821f0a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2586059 Commit-Queue: Cody Northrop <cnorthrop@google.com> Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org>
parent a64e86c5
......@@ -5081,6 +5081,92 @@ TEST_P(GLSLTest_ES3, VaryingStructUsedInFragmentShader)
EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::green);
}
// This test demonstrates an issue with shaders on the Pixel device's vulkan backend.
// This test should render a red quad without issues but on a Pixel4XL this test causes
// vkCreateGraphicPipelines to return VK_INCOMPLETE. logcat shows these messages:
// > Adreno : Failed to link shaders.
// > Internal Vulkan error: A return array was too small for the result
TEST_P(GLSLTest_ES31, SamplerPassthroughFailedLink)
{
// TODO: (anglebug.com/5457)
ANGLE_SKIP_TEST_IF(IsAndroid() && (IsPixel2() || IsPixel2XL()) && IsVulkan());
constexpr char kVS[] =
"precision mediump float;\n"
"attribute vec4 inputAttribute;\n"
"varying mediump vec2 texCoord;\n"
"void main() {\n"
" texCoord = inputAttribute.xy;\n"
" gl_Position = vec4(inputAttribute.x, inputAttribute.y, 0.0, 1.0);\n"
"}\n";
constexpr char kFS[] =
"precision mediump float;\n"
"varying mediump vec2 texCoord;\n"
"uniform sampler2D testSampler;\n"
"vec3 passthrough(vec3 c) {\n"
" return c;\n"
"}\n"
"void main() {\n"
" gl_FragColor = vec4(passthrough(texture2D(testSampler, texCoord).rgb), 1.0);\n"
"}\n";
ANGLE_GL_PROGRAM(program, kVS, kFS);
// Initialize basic red texture.
GLTexture texture;
glBindTexture(GL_TEXTURE_2D, texture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
GLColor::red.data());
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
ASSERT_GL_NO_ERROR();
drawQuad(program.get(), "inputAttribute", 0.5f);
ASSERT_GL_NO_ERROR();
EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::red);
}
// This test demonstrates issues with shaders on the Pixel device's vulkan backend.
// This test should render a red quad without issues but on a Pixel4XL it renders
// a black quad
TEST_P(GLSLTest_ES31, SamplerPassthroughIncorrectColor)
{
// TODO: (anglebug.com/5457)
ANGLE_SKIP_TEST_IF(IsAndroid() && (IsPixel2() || IsPixel2XL()) && IsVulkan());
constexpr char kVS[] =
"precision mediump float;\n"
"attribute vec4 inputAttribute;\n"
"varying mediump vec2 texCoord;\n"
"void main() {\n"
" texCoord = inputAttribute.xy;\n"
" gl_Position = vec4(inputAttribute.x, inputAttribute.y, 0.0, 1.0);\n"
"}\n";
constexpr char kFS[] =
"precision mediump float;\n"
"varying mediump vec2 texCoord;\n"
"uniform sampler2D testSampler;\n"
"vec4 passthrough(vec4 c) {\n"
" return c;\n"
"}\n"
"void main() {\n"
" gl_FragColor = vec4(passthrough(texture2D(testSampler, texCoord)));\n"
"}\n";
ANGLE_GL_PROGRAM(program, kVS, kFS);
// Initialize basic red texture.
GLTexture texture;
glBindTexture(GL_TEXTURE_2D, texture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
GLColor::red.data());
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
ASSERT_GL_NO_ERROR();
drawQuad(program.get(), "inputAttribute", 0.5f);
ASSERT_GL_NO_ERROR();
EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::red);
}
// Test that multiple multi-field varying structs that get used in the fragment shader work.
TEST_P(GLSLTest_ES3, ComplexVaryingStructsUsedInFragmentShader)
{
......
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