Declare nextInChain as ChainedStructOut when extensible is out

This patch changes the type of the structure member nextInChain in
AdapterProperties and SupportedLimits as "ChainedStructOut *" instead
of "ChainedStruct * const" as all members of these structures should
be writable when they are used as the outputs of Dawn APIs.

Bug: dawn:1516
Change-Id: I185a0b5846ac6009717ac722df67bf7170354947
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101802
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Jiawei Shao 2022-09-10 01:38:59 +00:00 committed by Dawn LUCI CQ
parent 278f071c68
commit 1b02102e2b
1 changed files with 9 additions and 2 deletions

View File

@ -49,9 +49,15 @@ namespace {{native_namespace}} {
{{namespace}}::SType sType = {{namespace}}::SType::Invalid;
};
struct ChainedStructOut {
ChainedStructOut * nextInChain = nullptr;
{{namespace}}::SType sType = {{namespace}}::SType::Invalid;
};
{% for type in by_category["structure"] %}
{% if type.chained %}
struct {{as_cppType(type.name)}} : ChainedStruct {
{% set chainedStructType = "ChainedStructOut" if type.chained == "out" else "ChainedStruct" %}
struct {{as_cppType(type.name)}} : {{chainedStructType}} {
{{as_cppType(type.name)}}() {
sType = {{namespace}}::SType::{{type.name.CamelCase()}};
}
@ -59,7 +65,8 @@ namespace {{native_namespace}} {
struct {{as_cppType(type.name)}} {
{% endif %}
{% if type.extensible %}
ChainedStruct const * nextInChain = nullptr;
{% set chainedStructType = "ChainedStructOut" if type.output else "ChainedStruct const" %}
{{chainedStructType}} * nextInChain = nullptr;
{% endif %}
{% for member in type.members %}
{% set member_declaration = as_annotated_frontendType(member) + render_cpp_default_value(member) %}