Make fragment stage optional in RenderPipeline

This CL makes fragment stage optional but still raises a validation
error if set to null in a RenderPipeline.

Bug: dawn:136
Change-Id: Ie900d2e768d251db1e0c4a90738f80b2de15dc2f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9641
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: François Beaufort <beaufort.francois@gmail.com>
This commit is contained in:
François Beaufort 2019-08-02 07:46:57 +00:00 committed by Commit Bot service account
parent c1583a558c
commit ae7e0026a5
2 changed files with 6 additions and 1 deletions

View File

@ -893,7 +893,7 @@
"members": [
{"name": "layout", "type": "pipeline layout"},
{"name": "vertex stage", "type": "pipeline stage descriptor", "annotation": "const*"},
{"name": "fragment stage", "type": "pipeline stage descriptor", "annotation": "const*"},
{"name": "fragment stage", "type": "pipeline stage descriptor", "annotation": "const*", "optional": true},
{"name": "vertex input", "type": "vertex input descriptor", "annotation": "const*"},
{"name": "primitive topology", "type": "primitive topology"},
{"name": "rasterization state", "type": "rasterization state descriptor", "annotation": "const*", "optional": true},

View File

@ -271,6 +271,11 @@ namespace dawn_native {
return DAWN_VALIDATION_ERROR("Input state must not be null");
}
// TODO(crbug.com/dawn/136): Support vertex-only pipelines.
if (descriptor->fragmentStage == nullptr) {
return DAWN_VALIDATION_ERROR("Null fragment stage is not supported (yet)");
}
std::bitset<kMaxVertexAttributes> attributesSetMask;
DAWN_TRY(ValidateVertexInputDescriptor(descriptor->vertexInput, &attributesSetMask));
DAWN_TRY(ValidatePrimitiveTopology(descriptor->primitiveTopology));