Commit 422c94bd by Shahbaz Youssefi Committed by Commit Bot

Vulkan: Enable ES3 fragment output attribute locations

GLSLTest_ES3 end2end tests are enabled for Vulkan, though with suppressions for other features that are missing. Bug: angleproject:3199 Change-Id: Ie744e160eab2df9a5a4f2c67ea5acf4b865ea5bf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1565058 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 2a7de6b7
...@@ -156,7 +156,6 @@ void GlslangWrapper::GetShaderSource(const gl::ProgramState &programState, ...@@ -156,7 +156,6 @@ void GlslangWrapper::GetShaderSource(const gl::ProgramState &programState,
// Parse attribute locations and replace them in the vertex shader. // Parse attribute locations and replace them in the vertex shader.
// See corresponding code in OutputVulkanGLSL.cpp. // See corresponding code in OutputVulkanGLSL.cpp.
// TODO(jmadill): Also do the same for ESSL 3 fragment outputs.
for (const sh::Attribute &attribute : programState.getAttributes()) for (const sh::Attribute &attribute : programState.getAttributes())
{ {
// Warning: If we endup supporting ES 3.0 shaders and up, Program::linkAttributes is going // Warning: If we endup supporting ES 3.0 shaders and up, Program::linkAttributes is going
...@@ -182,6 +181,34 @@ void GlslangWrapper::GetShaderSource(const gl::ProgramState &programState, ...@@ -182,6 +181,34 @@ void GlslangWrapper::GetShaderSource(const gl::ProgramState &programState,
InsertQualifierSpecifierString(&vertexSource, attribute.name, ""); InsertQualifierSpecifierString(&vertexSource, attribute.name, "");
} }
// Parse output locations and replace them in the fragment shader.
// See corresponding code in OutputVulkanGLSL.cpp.
// TODO(syoussefi): Add support for EXT_blend_func_extended. http://anglebug.com/3385
const auto &outputLocations = programState.getOutputLocations();
const auto &outputVariables = programState.getOutputVariables();
for (const gl::VariableLocation &outputLocation : outputLocations)
{
if (outputLocation.arrayIndex == 0 && outputLocation.used() && !outputLocation.ignored)
{
const sh::OutputVariable &outputVar = outputVariables[outputLocation.index];
std::string locationString;
if (outputVar.location != -1)
{
locationString = "location = " + Str(outputVar.location);
}
else
{
// If there is only one output, it is allowed not to have a location qualifier, in
// which case it defaults to 0. GLSL ES 3.00 spec, section 4.3.8.2.
ASSERT(outputVariables.size() == 1);
locationString = "location = 0";
}
InsertLayoutSpecifierString(&fragmentSource, outputVar.name, locationString);
}
}
// Assign varying locations. // Assign varying locations.
for (const gl::PackedVaryingRegister &varyingReg : resources.varyingPacking.getRegisterList()) for (const gl::PackedVaryingRegister &varyingReg : resources.varyingPacking.getRegisterList())
{ {
......
...@@ -612,6 +612,9 @@ void main() ...@@ -612,6 +612,9 @@ void main()
// Draw an array of points with the first vertex offset at 0 using gl_VertexID // Draw an array of points with the first vertex offset at 0 using gl_VertexID
TEST_P(GLSLTest_ES3, GLVertexIDOffsetZeroDrawArray) TEST_P(GLSLTest_ES3, GLVertexIDOffsetZeroDrawArray)
{ {
// TODO(syoussefi): missing ES3 shader feature support. http://anglebug.com/3221
ANGLE_SKIP_TEST_IF(IsVulkan());
constexpr int kStartIndex = 0; constexpr int kStartIndex = 0;
constexpr int kArrayLength = 5; constexpr int kArrayLength = 5;
constexpr char kVS[] = R"(#version 300 es constexpr char kVS[] = R"(#version 300 es
...@@ -674,6 +677,9 @@ void GLVertexIDIntegerTextureDrawArrays_helper(int first, int count, GLenum err) ...@@ -674,6 +677,9 @@ void GLVertexIDIntegerTextureDrawArrays_helper(int first, int count, GLenum err)
// https://github.com/KhronosGroup/WebGL/blob/master/sdk/tests/conformance2/rendering/vertex-id.html // https://github.com/KhronosGroup/WebGL/blob/master/sdk/tests/conformance2/rendering/vertex-id.html
TEST_P(GLSLTest_ES3, GLVertexIDIntegerTextureDrawArrays) TEST_P(GLSLTest_ES3, GLVertexIDIntegerTextureDrawArrays)
{ {
// TODO(syoussefi): missing ES3 shader feature support. http://anglebug.com/3221
ANGLE_SKIP_TEST_IF(IsVulkan());
// Have to set a large point size because the window size is much larger than the texture // Have to set a large point size because the window size is much larger than the texture
constexpr char kVS[] = R"(#version 300 es constexpr char kVS[] = R"(#version 300 es
flat out highp int vVertexID; flat out highp int vVertexID;
...@@ -732,6 +738,9 @@ TEST_P(GLSLTest_ES3, GLVertexIDOffsetFiveDrawArray) ...@@ -732,6 +738,9 @@ TEST_P(GLSLTest_ES3, GLVertexIDOffsetFiveDrawArray)
// Bug in Nexus drivers, offset does not work. (anglebug.com/3264) // Bug in Nexus drivers, offset does not work. (anglebug.com/3264)
ANGLE_SKIP_TEST_IF((IsNexus5X() || IsNexus6P()) && IsOpenGLES()); ANGLE_SKIP_TEST_IF((IsNexus5X() || IsNexus6P()) && IsOpenGLES());
// TODO(syoussefi): missing ES3 shader feature support. http://anglebug.com/3221
ANGLE_SKIP_TEST_IF(IsVulkan());
constexpr int kStartIndex = 5; constexpr int kStartIndex = 5;
constexpr int kArrayLength = 5; constexpr int kArrayLength = 5;
constexpr char kVS[] = R"(#version 300 es constexpr char kVS[] = R"(#version 300 es
...@@ -2391,6 +2400,10 @@ TEST_P(GLSLTest_ES3, UnaryMinusOperatorSignedInt) ...@@ -2391,6 +2400,10 @@ TEST_P(GLSLTest_ES3, UnaryMinusOperatorSignedInt)
// Convers a bug with the unary minus operator on unsigned integer workaround. // Convers a bug with the unary minus operator on unsigned integer workaround.
TEST_P(GLSLTest_ES3, UnaryMinusOperatorUnsignedInt) TEST_P(GLSLTest_ES3, UnaryMinusOperatorUnsignedInt)
{ {
// TODO(syoussefi): missing [gs]etUniform support with unsigned formats.
// http://anglebug.com/2392
ANGLE_SKIP_TEST_IF(IsVulkan());
constexpr char kVS[] = constexpr char kVS[] =
"#version 300 es\n" "#version 300 es\n"
"in highp vec4 position;\n" "in highp vec4 position;\n"
...@@ -3329,6 +3342,10 @@ TEST_P(GLSLTest_ES3, VaryingStructNotDeclaredInFragmentShader) ...@@ -3329,6 +3342,10 @@ TEST_P(GLSLTest_ES3, VaryingStructNotDeclaredInFragmentShader)
// Test that a varying struct that gets used in the fragment shader works. // Test that a varying struct that gets used in the fragment shader works.
TEST_P(GLSLTest_ES3, VaryingStructUsedInFragmentShader) TEST_P(GLSLTest_ES3, VaryingStructUsedInFragmentShader)
{ {
// TODO(syoussefi): missing ES3 shader feature support.
// http://anglebug.com/3199
ANGLE_SKIP_TEST_IF(IsVulkan());
constexpr char kVS[] = constexpr char kVS[] =
"#version 300 es\n" "#version 300 es\n"
"in vec4 inputAttribute;\n" "in vec4 inputAttribute;\n"
...@@ -4183,6 +4200,10 @@ void main() ...@@ -4183,6 +4200,10 @@ void main()
// Test that a varying struct that's defined as a part of the declaration is handled correctly. // Test that a varying struct that's defined as a part of the declaration is handled correctly.
TEST_P(GLSLTest_ES3, VaryingStructWithInlineDefinition) TEST_P(GLSLTest_ES3, VaryingStructWithInlineDefinition)
{ {
// TODO(syoussefi): missing ES3 shader feature support.
// http://anglebug.com/3199
ANGLE_SKIP_TEST_IF(IsVulkan());
constexpr char kVS[] = R"(#version 300 es constexpr char kVS[] = R"(#version 300 es
in vec4 inputAttribute; in vec4 inputAttribute;
...@@ -4279,6 +4300,10 @@ void main() { ...@@ -4279,6 +4300,10 @@ void main() {
// is handled correctly. // is handled correctly.
TEST_P(GLSLTest_ES3, FlatVaryingUsedInFoldedTernary) TEST_P(GLSLTest_ES3, FlatVaryingUsedInFoldedTernary)
{ {
// TODO(syoussefi): missing ES3 shader feature support.
// http://anglebug.com/3219
ANGLE_SKIP_TEST_IF(IsVulkan());
constexpr char kVS[] = R"(#version 300 es constexpr char kVS[] = R"(#version 300 es
in vec4 inputAttribute; in vec4 inputAttribute;
...@@ -4498,6 +4523,10 @@ void main() ...@@ -4498,6 +4523,10 @@ void main()
// field. // field.
TEST_P(GLSLTest_ES3, ErrorMessageOfLinkInterfaceBlockFieldMismatch) TEST_P(GLSLTest_ES3, ErrorMessageOfLinkInterfaceBlockFieldMismatch)
{ {
// TODO(syoussefi): missing ES3 shader feature support.
// http://anglebug.com/3199
ANGLE_SKIP_TEST_IF(IsVulkan());
constexpr char kVS[] = R"(#version 300 es constexpr char kVS[] = R"(#version 300 es
uniform S { uniform S {
vec2 val1; vec2 val1;
...@@ -4533,6 +4562,10 @@ void main() ...@@ -4533,6 +4562,10 @@ void main()
// struct field. // struct field.
TEST_P(GLSLTest_ES3, ErrorMessageOfLinkInterfaceBlockStructFieldMismatch) TEST_P(GLSLTest_ES3, ErrorMessageOfLinkInterfaceBlockStructFieldMismatch)
{ {
// TODO(syoussefi): missing ES3 shader feature support.
// http://anglebug.com/3199
ANGLE_SKIP_TEST_IF(IsVulkan());
constexpr char kVS[] = R"(#version 300 es constexpr char kVS[] = R"(#version 300 es
struct T struct T
{ {
...@@ -5304,7 +5337,7 @@ ANGLE_INSTANTIATE_TEST(GLSLTestNoValidation, ...@@ -5304,7 +5337,7 @@ ANGLE_INSTANTIATE_TEST(GLSLTestNoValidation,
// Use this to select which configurations (e.g. which renderer, which GLES major version) these // Use this to select which configurations (e.g. which renderer, which GLES major version) these
// tests should be run against. // tests should be run against.
ANGLE_INSTANTIATE_TEST(GLSLTest_ES3, ES3_D3D11(), ES3_OPENGL(), ES3_OPENGLES()); ANGLE_INSTANTIATE_TEST(GLSLTest_ES3, ES3_D3D11(), ES3_OPENGL(), ES3_OPENGLES(), ES3_VULKAN());
ANGLE_INSTANTIATE_TEST(WebGLGLSLTest, ES2_D3D11(), ES2_OPENGL(), ES2_OPENGLES(), ES2_VULKAN()); ANGLE_INSTANTIATE_TEST(WebGLGLSLTest, ES2_D3D11(), ES2_OPENGL(), ES2_OPENGLES(), ES2_VULKAN());
......
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