Commit 45f54928 by Xinyi He Committed by Commit Bot

Vulkan: Fix capturing arrays using VK_EXT_transform_feedback

Vulkan is able to capture the whole array when using transform feedback extension. Add a new end2end test for it. Due to the outdated nv bots, khr_gles31 tests are faild. Add these suppressions in the khr_gles31 expectations file in order to unblock the commit. Bug: angleproject:4723 Change-Id: I929f99544a01cf5fc781dc31c2c041c851976676 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2247952 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org>
parent 349b661d
...@@ -684,11 +684,12 @@ void AssignTransformFeedbackExtensionQualifiers(const gl::ProgramExecutable &pro ...@@ -684,11 +684,12 @@ void AssignTransformFeedbackExtensionQualifiers(const gl::ProgramExecutable &pro
SetXfbInfo(variableInfoMapOut, xfbVaryingName, bufferIndex, currentOffset, SetXfbInfo(variableInfoMapOut, xfbVaryingName, bufferIndex, currentOffset,
currentStride); currentStride);
} }
else if (!tfVarying.isArray() || tfVarying.arrayIndex == 0) else if (!tfVarying.isArray() || tfVarying.arrayIndex == GL_INVALID_INDEX)
{ {
// Note: capturing individual array elements using the Vulkan transform feedback // Note: capturing individual array elements using the Vulkan transform feedback
// extension is not supported, and it unlikely to be ever supported (on the contrary, it // extension is not supported, and it unlikely to be ever supported (on the contrary, it
// may be removed from the GLES spec). http://anglebug.com/4140 // may be removed from the GLES spec). http://anglebug.com/4140
// ANGLE should support capturing the whole array.
// Find the varying with this name. If a struct is captured, we would be iterating over // Find the varying with this name. If a struct is captured, we would be iterating over
// its fields, and the name of the varying is found through parentStructMappedName. Not // its fields, and the name of the varying is found through parentStructMappedName. Not
......
...@@ -529,8 +529,6 @@ ...@@ -529,8 +529,6 @@
// Transform Feedback // Transform Feedback
4666 VULKAN NVIDIA : dEQP-GLES3.functional.transform_feedback.array_element.interleaved.* = SKIP 4666 VULKAN NVIDIA : dEQP-GLES3.functional.transform_feedback.array_element.interleaved.* = SKIP
4666 VULKAN NVIDIA : dEQP-GLES3.functional.transform_feedback.array_element.separate.* = SKIP 4666 VULKAN NVIDIA : dEQP-GLES3.functional.transform_feedback.array_element.separate.* = SKIP
4666 VULKAN NVIDIA : dEQP-GLES3.functional.transform_feedback.array.interleaved.* = SKIP
4666 VULKAN NVIDIA : dEQP-GLES3.functional.transform_feedback.array.separate.* = SKIP
4666 VULKAN NVIDIA : dEQP-GLES3.functional.transform_feedback.random.* = SKIP 4666 VULKAN NVIDIA : dEQP-GLES3.functional.transform_feedback.random.* = SKIP
// Flat shading: // Flat shading:
......
...@@ -42,6 +42,29 @@ ...@@ -42,6 +42,29 @@
4194 VULKAN PIXEL2ORXL : KHR-GLES31.core.compute_shader.resource-ubo = FAIL 4194 VULKAN PIXEL2ORXL : KHR-GLES31.core.compute_shader.resource-ubo = FAIL
4194 VULKAN PIXEL2ORXL : KHR-GLES31.core.compute_shader.built-in-variables = FAIL 4194 VULKAN PIXEL2ORXL : KHR-GLES31.core.compute_shader.built-in-variables = FAIL
// XFB array elements capture:
// These tests only fail with VK_EXT_transform_feedback
4723 VULKAN NVIDIA : KHR-GLES31.core.vertex_attrib_binding.basic-input-case1 = SKIP
4723 VULKAN NVIDIA : KHR-GLES31.core.vertex_attrib_binding.basic-input-case2 = SKIP
4723 VULKAN NVIDIA : KHR-GLES31.core.vertex_attrib_binding.basic-input-case3 = SKIP
4723 VULKAN NVIDIA : KHR-GLES31.core.vertex_attrib_binding.basic-input-case4 = SKIP
4723 VULKAN NVIDIA : KHR-GLES31.core.vertex_attrib_binding.basic-input-case5 = SKIP
4723 VULKAN NVIDIA : KHR-GLES31.core.vertex_attrib_binding.basic-input-case6 = SKIP
4723 VULKAN NVIDIA : KHR-GLES31.core.vertex_attrib_binding.basic-input-case8 = SKIP
4723 VULKAN NVIDIA : KHR-GLES31.core.vertex_attrib_binding.basic-input-case9 = SKIP
4723 VULKAN NVIDIA : KHR-GLES31.core.vertex_attrib_binding.basic-input-case11 = SKIP
4723 VULKAN NVIDIA : KHR-GLES31.core.vertex_attrib_binding.basic-input-case12 = SKIP
4723 VULKAN NVIDIA : KHR-GLES31.core.vertex_attrib_binding.basic-inputI-case1 = SKIP
4723 VULKAN NVIDIA : KHR-GLES31.core.vertex_attrib_binding.basic-inputI-case2 = SKIP
4723 VULKAN NVIDIA : KHR-GLES31.core.vertex_attrib_binding.basic-inputI-case3 = SKIP
4723 VULKAN NVIDIA : KHR-GLES31.core.shader_image_size.basic-nonMS-vs-float = SKIP
4723 VULKAN NVIDIA : KHR-GLES31.core.shader_image_size.basic-nonMS-vs-int = SKIP
4723 VULKAN NVIDIA : KHR-GLES31.core.shader_image_size.basic-nonMS-vs-uint = SKIP
4723 VULKAN NVIDIA : KHR-GLES31.core.shader_image_size.advanced-nonMS-vs-float = SKIP
4723 VULKAN NVIDIA : KHR-GLES31.core.shader_image_size.advanced-nonMS-vs-int = SKIP
4723 VULKAN NVIDIA : KHR-GLES31.core.shader_image_size.advanced-nonMS-vs-uint = SKIP
4723 VULKAN NVIDIA : KHR-GLES31.core.program_interface_query.transform-feedback-types = SKIP
//// ////
//// Desktop Vulkan expectations //// Desktop Vulkan expectations
//// ////
......
...@@ -1404,6 +1404,88 @@ void main() { ...@@ -1404,6 +1404,88 @@ void main() {
ASSERT_EQ(0u, mProgram); ASSERT_EQ(0u, mProgram);
} }
// Test transform feedback can capture the whole array
TEST_P(TransformFeedbackTestES31, CaptureArray)
{
constexpr char kVS[] = R"(#version 310 es
in vec4 a_position;
in float a_varA;
in float a_varB1;
in float a_varB2;
out float v_varA[1];
out float v_varB[2];
void main()
{
gl_Position = a_position;
gl_PointSize = 1.0;
v_varA[0] = a_varA;
v_varB[0] = a_varB1;
v_varB[1] = a_varB2;
})";
constexpr char kFS[] = R"(#version 310 es
precision mediump float;
in float v_varA[1];
in float v_varB[2];
out vec4 fragColor;
void main()
{
vec4 res = vec4(0.0);
res += vec4(v_varA[0]);
res += vec4(v_varB[0]);
res += vec4(v_varB[1]);
fragColor = res;
})";
std::vector<std::string> tfVaryings;
tfVaryings.push_back("v_varA");
tfVaryings.push_back("v_varB");
mProgram = CompileProgramWithTransformFeedback(kVS, kFS, tfVaryings, GL_INTERLEAVED_ATTRIBS);
ASSERT_NE(0u, mProgram);
glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, mTransformFeedbackBuffer);
glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, sizeof(float) * 3 * 6, nullptr, GL_STREAM_DRAW);
glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, mTransformFeedback);
glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, mTransformFeedbackBuffer);
GLint varA = glGetAttribLocation(mProgram, "a_varA");
ASSERT_NE(-1, varA);
GLint varB1 = glGetAttribLocation(mProgram, "a_varB1");
ASSERT_NE(-1, varB1);
GLint varB2 = glGetAttribLocation(mProgram, "a_varB2");
ASSERT_NE(-1, varB2);
std::array<float, 3> data = {24.0f, 48.0f, 128.0f};
glVertexAttribPointer(varA, 1, GL_FLOAT, GL_FALSE, 0, &data[0]);
glEnableVertexAttribArray(varA);
glVertexAttribPointer(varB1, 1, GL_FLOAT, GL_FALSE, 0, &data[1]);
glEnableVertexAttribArray(varB1);
glVertexAttribPointer(varB2, 1, GL_FLOAT, GL_FALSE, 0, &data[2]);
glEnableVertexAttribArray(varB2);
glUseProgram(mProgram);
glBeginTransformFeedback(GL_TRIANGLES);
drawQuad(mProgram, "a_position", 0.5f);
glEndTransformFeedback();
glUseProgram(0);
ASSERT_GL_NO_ERROR();
void *mappedBuffer =
glMapBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, 0, sizeof(float) * 3 * 6, GL_MAP_READ_BIT);
ASSERT_NE(nullptr, mappedBuffer);
float *mappedFloats = static_cast<float *>(mappedBuffer);
std::array<float, 3> mappedData = {mappedFloats[0], mappedFloats[1], mappedFloats[2]};
EXPECT_EQ(data, mappedData);
glUnmapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER);
ASSERT_GL_NO_ERROR();
}
// Test that nonexistent transform feedback varyings don't assert when linking. // Test that nonexistent transform feedback varyings don't assert when linking.
TEST_P(TransformFeedbackTest, NonExistentTransformFeedbackVarying) TEST_P(TransformFeedbackTest, NonExistentTransformFeedbackVarying)
{ {
......
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