mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-07-04 12:16:10 +00:00
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": "fragment stage", "type": "pipeline stage descriptor", "annotation": "const*"},
|
||||||
{"name": "vertex input", "type": "vertex input descriptor", "annotation": "const*"},
|
{"name": "vertex input", "type": "vertex input descriptor", "annotation": "const*"},
|
||||||
{"name": "primitive topology", "type": "primitive topology"},
|
{"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": "sample count", "type": "uint32_t", "default": "1"},
|
||||||
{"name": "depth stencil state", "type": "depth stencil state descriptor", "annotation": "const*", "optional": true},
|
{"name": "depth stencil state", "type": "depth stencil state descriptor", "annotation": "const*", "optional": true},
|
||||||
{"name": "color state count", "type": "uint32_t"},
|
{"name": "color state count", "type": "uint32_t"},
|
||||||
|
@ -20,13 +20,25 @@
|
|||||||
|
|
||||||
namespace dawn_native {
|
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"] %}
|
{% for type in by_category["structure"] %}
|
||||||
struct {{as_cppType(type.name)}} {
|
struct {{as_cppType(type.name)}} {
|
||||||
{% if type.extensible %}
|
{% if type.extensible %}
|
||||||
const void* nextInChain = nullptr;
|
const void* nextInChain = nullptr;
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% for member in type.members %}
|
{% for member in type.members %}
|
||||||
{{as_annotated_frontendType(member)}};
|
{{as_annotated_frontendType(member)}} {{render_cpp_default_value(member)}};
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -277,7 +277,10 @@ namespace dawn_native {
|
|||||||
descriptor->layout, ShaderStage::Vertex));
|
descriptor->layout, ShaderStage::Vertex));
|
||||||
DAWN_TRY(ValidatePipelineStageDescriptor(device, descriptor->fragmentStage,
|
DAWN_TRY(ValidatePipelineStageDescriptor(device, descriptor->fragmentStage,
|
||||||
descriptor->layout, ShaderStage::Fragment));
|
descriptor->layout, ShaderStage::Fragment));
|
||||||
DAWN_TRY(ValidateRasterizationStateDescriptor(descriptor->rasterizationState));
|
|
||||||
|
if (descriptor->rasterizationState) {
|
||||||
|
DAWN_TRY(ValidateRasterizationStateDescriptor(descriptor->rasterizationState));
|
||||||
|
}
|
||||||
|
|
||||||
if ((descriptor->vertexStage->module->GetUsedVertexAttributes() & ~attributesSetMask)
|
if ((descriptor->vertexStage->module->GetUsedVertexAttributes() & ~attributesSetMask)
|
||||||
.any()) {
|
.any()) {
|
||||||
@ -347,7 +350,6 @@ namespace dawn_native {
|
|||||||
mVertexInput(*descriptor->vertexInput),
|
mVertexInput(*descriptor->vertexInput),
|
||||||
mHasDepthStencilAttachment(descriptor->depthStencilState != nullptr),
|
mHasDepthStencilAttachment(descriptor->depthStencilState != nullptr),
|
||||||
mPrimitiveTopology(descriptor->primitiveTopology),
|
mPrimitiveTopology(descriptor->primitiveTopology),
|
||||||
mRasterizationState(*descriptor->rasterizationState),
|
|
||||||
mSampleCount(descriptor->sampleCount),
|
mSampleCount(descriptor->sampleCount),
|
||||||
mSampleMask(descriptor->sampleMask),
|
mSampleMask(descriptor->sampleMask),
|
||||||
mAlphaToCoverageEnabled(descriptor->alphaToCoverageEnabled),
|
mAlphaToCoverageEnabled(descriptor->alphaToCoverageEnabled),
|
||||||
@ -376,6 +378,12 @@ namespace dawn_native {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (descriptor->rasterizationState != nullptr) {
|
||||||
|
mRasterizationState = *descriptor->rasterizationState;
|
||||||
|
} else {
|
||||||
|
mRasterizationState = RasterizationStateDescriptor();
|
||||||
|
}
|
||||||
|
|
||||||
if (mHasDepthStencilAttachment) {
|
if (mHasDepthStencilAttachment) {
|
||||||
mDepthStencilState = *descriptor->depthStencilState;
|
mDepthStencilState = *descriptor->depthStencilState;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user