Update VertexInput (InputState) to match the spec - Part 4

This patch added support for null vertex buffer(s).

BUG=dawn:80, dawn:107

Change-Id: I3fb9427fcd4323c6df441be7011223088b40ec53
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7900
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
This commit is contained in:
Yunchao He
2019-06-11 16:45:04 +00:00
committed by Commit Bot service account
parent 903fc2b049
commit 29f3de54a5
5 changed files with 58 additions and 15 deletions

View File

@@ -58,6 +58,50 @@ TEST_F(VertexInputTest, EmptyIsOk) {
)");
}
// Check null buffer is valid
TEST_F(VertexInputTest, NullBufferIsOk) {
utils::ComboVertexInputDescriptor state;
// One null buffer (buffer[0]) is OK
state.bufferCount = 1;
state.cBuffers[0].stride = 0;
state.cBuffers[0].attributeCount = 0;
state.cBuffers[0].attributes = nullptr;
CreatePipeline(true, state, R"(
#version 450
void main() {
gl_Position = vec4(0.0);
}
)");
// One null buffer (buffer[0]) followed by a buffer (buffer[1]) is OK
state.bufferCount = 2;
state.cBuffers[1].stride = 0;
state.cBuffers[1].attributeCount = 1;
state.cBuffers[1].attributes = &state.cAttributes[0];
state.cAttributes[0].shaderLocation = 0;
CreatePipeline(true, state, R"(
#version 450
void main() {
gl_Position = vec4(0.0);
}
)");
// Null buffer (buffer[2]) sitting between buffers (buffer[1] and buffer[3]) is OK
state.bufferCount = 4;
state.cBuffers[2].attributeCount = 0;
state.cBuffers[2].attributes = nullptr;
state.cBuffers[3].attributeCount = 1;
state.cBuffers[3].attributes = &state.cAttributes[1];
state.cAttributes[1].shaderLocation = 1;
CreatePipeline(true, state, R"(
#version 450
void main() {
gl_Position = vec4(0.0);
}
)");
}
// Check validation that pipeline vertex buffers are backed by attributes in the vertex input
// Check validation that pipeline vertex buffers are backed by attributes in the vertex input
TEST_F(VertexInputTest, PipelineCompatibility) {
utils::ComboVertexInputDescriptor state;