Make rasterization state descriptor optional
Following WebGPU spec change at https://github.com/gpuweb/gpuweb/issues/347, the rasterizationState from GPURenderPipelineDescriptor should not be required anymore. BUG=dawn:22 Change-Id: Ic458396665a7e2fbd942aa7f50138cc96497ff33 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9000 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:
parent
d3e7f944ab
commit
4af9808400
|
@ -905,7 +905,7 @@
|
|||
{"name": "fragment stage", "type": "pipeline stage descriptor", "annotation": "const*"},
|
||||
{"name": "vertex input", "type": "vertex input descriptor", "annotation": "const*"},
|
||||
{"name": "primitive topology", "type": "primitive topology"},
|
||||
{"name": "rasterization state", "type": "rasterization state descriptor", "annotation": "const*"},
|
||||
{"name": "rasterization state", "type": "rasterization state descriptor", "annotation": "const*", "optional": true},
|
||||
{"name": "sample count", "type": "uint32_t", "default": "1"},
|
||||
{"name": "depth stencil state", "type": "depth stencil state descriptor", "annotation": "const*", "optional": true},
|
||||
{"name": "color state count", "type": "uint32_t"},
|
||||
|
|
|
@ -20,13 +20,25 @@
|
|||
|
||||
namespace dawn_native {
|
||||
|
||||
{% macro render_cpp_default_value(member) -%}
|
||||
{%- if member.annotation in ["*", "const*", "const*const*"] and member.optional -%}
|
||||
{{" "}}= nullptr
|
||||
{%- elif member.type.category in ["enum", "bitmask"] and member.default_value != None -%}
|
||||
{{" "}}= dawn::{{as_cppType(member.type.name)}}::{{as_cppEnum(Name(member.default_value))}}
|
||||
{%- elif member.type.category == "native" and member.default_value != None -%}
|
||||
{{" "}}= {{member.default_value}}
|
||||
{%- else -%}
|
||||
{{assert(member.default_value == None)}}
|
||||
{%- endif -%}
|
||||
{%- endmacro %}
|
||||
|
||||
{% for type in by_category["structure"] %}
|
||||
struct {{as_cppType(type.name)}} {
|
||||
{% if type.extensible %}
|
||||
const void* nextInChain = nullptr;
|
||||
{% endif %}
|
||||
{% for member in type.members %}
|
||||
{{as_annotated_frontendType(member)}};
|
||||
{{as_annotated_frontendType(member)}} {{render_cpp_default_value(member)}};
|
||||
{% endfor %}
|
||||
};
|
||||
|
||||
|
|
|
@ -277,7 +277,10 @@ namespace dawn_native {
|
|||
descriptor->layout, ShaderStage::Vertex));
|
||||
DAWN_TRY(ValidatePipelineStageDescriptor(device, descriptor->fragmentStage,
|
||||
descriptor->layout, ShaderStage::Fragment));
|
||||
|
||||
if (descriptor->rasterizationState) {
|
||||
DAWN_TRY(ValidateRasterizationStateDescriptor(descriptor->rasterizationState));
|
||||
}
|
||||
|
||||
if ((descriptor->vertexStage->module->GetUsedVertexAttributes() & ~attributesSetMask)
|
||||
.any()) {
|
||||
|
@ -347,7 +350,6 @@ namespace dawn_native {
|
|||
mVertexInput(*descriptor->vertexInput),
|
||||
mHasDepthStencilAttachment(descriptor->depthStencilState != nullptr),
|
||||
mPrimitiveTopology(descriptor->primitiveTopology),
|
||||
mRasterizationState(*descriptor->rasterizationState),
|
||||
mSampleCount(descriptor->sampleCount),
|
||||
mSampleMask(descriptor->sampleMask),
|
||||
mAlphaToCoverageEnabled(descriptor->alphaToCoverageEnabled),
|
||||
|
@ -376,6 +378,12 @@ namespace dawn_native {
|
|||
}
|
||||
}
|
||||
|
||||
if (descriptor->rasterizationState != nullptr) {
|
||||
mRasterizationState = *descriptor->rasterizationState;
|
||||
} else {
|
||||
mRasterizationState = RasterizationStateDescriptor();
|
||||
}
|
||||
|
||||
if (mHasDepthStencilAttachment) {
|
||||
mDepthStencilState = *descriptor->depthStencilState;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue