Commit d7475437 by Shahbaz Youssefi Committed by Commit Bot

Vulkan: Support vertex attribute aliasing for matrix types

This change builds on vertex attribute aliasing SPIR-V tranformation for non-matrix types to add support for matrix attribute types. This is done by turning every matrix attribute declaration into multiple vector attribute declarations, and reusing the same mechanism for resolving aliasing between non-matrix types. Take the following example: attribute mat4 a; // location 0 attribute vec3 b; // location 1 attribute mat3 c; // location 1 attribute vec4 d; // location 2 The shader is modified as such: attribute vec4 a_0; // location 0 attribute vec4 a_1; // location 1 attribute vec4 a_2; // location 2 attribute vec4 a_3; // location 3 attribute vec3 c_0; // location 4 attribute vec4 d; // location 5 attribute vec3 c_2; // location 6 mat4 a; mat3 c; and in the beginning of main(), the following code is inserted: a = mat4(a_0, a_1, a_2, a_3); c = mat3(c_0, d.xyz, c_2); The shader continues to use a and c as before. Bug: angleproject:4249 Change-Id: Idfcb8c6037ca0c1f21de8203d7e2a1b66fed6e7e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2488128 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarCharlie Lao <cclao@google.com> Reviewed-by: 's avatarCourtney Goeltzenleuchter <courtneygo@google.com>
parent 2e1091e0
......@@ -88,13 +88,10 @@ struct ShaderInterfaceVariableInfo
bool useRelaxedPrecision = false;
// Indicate if varying is input or output
bool varyingIsOutput = false;
// For vertex attributes, this is the number of components. This is used by the vertex
// attribute aliasing transformation only.
// For vertex attributes, this is the number of components / locations. These are used by the
// vertex attribute aliasing transformation only.
uint8_t attributeComponentCount = 0;
// Indicate whether this is a vertex attribute of matrix type. This is temporarily used to
// avoid handling aliasing matrix vertex attributes as they are currently not supported.
// TODO: remove when support for aliasing matrix attributes is added. http://anglebug.com/4249
bool isMatrixAttribute = false;
uint8_t attributeLocationCount = 0;
};
// TODO: http://anglebug.com/4524: Need a different hash key than a string, since
......
......@@ -226,7 +226,7 @@ std::unique_ptr<rx::LinkEvent> ProgramExecutableVk::load(gl::BinaryInputStream *
info->useRelaxedPrecision = stream->readBool();
info->varyingIsOutput = stream->readBool();
info->attributeComponentCount = stream->readInt<uint8_t>();
info->isMatrixAttribute = stream->readBool();
info->attributeLocationCount = stream->readInt<uint8_t>();
}
}
......@@ -253,7 +253,7 @@ void ProgramExecutableVk::save(gl::BinaryOutputStream *stream)
stream->writeInt<uint8_t>(it.second.useRelaxedPrecision);
stream->writeInt<uint8_t>(it.second.varyingIsOutput);
stream->writeInt<uint8_t>(it.second.attributeComponentCount);
stream->writeInt<uint8_t>(it.second.isMatrixAttribute);
stream->writeInt<uint8_t>(it.second.attributeLocationCount);
}
}
}
......
......@@ -427,9 +427,6 @@
// Fails on 431.02 NVIDIA driver
3748 VULKAN WIN NVIDIA : dEQP-GLES2.functional.fbo.render.repeated_clear.* = FAIL
// Vertex attribute aliasing generates invalid SPIRV
4249 VULKAN : dEQP-GLES2.functional.attribute_location.bind_aliasing.*mat* = SKIP
// Fails on Metal, some of filtering tests fail when MSAA is off and pass when MSAA is on. Some
// tests are opposite. The filtering tests mostly fail on a few pixels.
4235 METAL AMD : dEQP-GLES2.functional.shaders.texture_functions.vertex.texturecubelod = FAIL
......@@ -501,9 +498,6 @@
// Line loop emulation bug, suspected to be caused by wrong segment order
4853 METAL AMD : dEQP-GLES2.functional.draw.draw_arrays.line_loop.multiple_attributes = FAIL
// Vertex attribute aliasing generates invalid SPIRV
4249 METAL : dEQP-GLES2.functional.attribute_location.bind_aliasing.*mat* = SKIP
// Globally disable Metal testing on Intel & NVIDIA for now
4235 METAL INTEL : dEQP-GLES2.* = SKIP
4235 METAL NVIDIA : dEQP-GLES2.* = SKIP
......
......@@ -3202,11 +3202,6 @@ void main()
// don't allow vertex attribute aliasing. This test includes matrix types.
TEST_P(VertexAttributeTest, AliasingMatrixAttribLocations)
{
// TODO(syoussefi): Support vertex attribute aliasing on Vulkan. The metal backend will
// automatically be fixed in the process. http://anglebug.com/4249
ANGLE_SKIP_TEST_IF(IsVulkan());
ANGLE_SKIP_TEST_IF(IsMetal());
// http://anglebug.com/5180
ANGLE_SKIP_TEST_IF(IsAndroid() && IsOpenGL());
......
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