Support chained extension structs on the wire

This CL also adds a couple of dummy extensions in dawn.json so that
the serialization/deserialization in the wire can be tested.

Bug: dawn:369
Change-Id: I5ec3853c286f45d9b04e8bf9d04ebd9176dc917b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18520
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
Austin Eng
2020-04-03 17:37:48 +00:00
committed by Commit Bot service account
parent 2479860e4b
commit 76a8d0b92f
9 changed files with 441 additions and 23 deletions

View File

@@ -204,7 +204,13 @@ namespace wgpu {
ChainedStruct const * nextInChain = nullptr;
{% endif %}
{% for member in type.members %}
{{as_annotated_cppType(member)}}{{render_cpp_default_value(member)}};
{% set member_declaration = as_annotated_cppType(member) + render_cpp_default_value(member) %}
{% if type.chained and loop.first %}
//* Align the first member to ChainedStruct to match the C struct layout.
alignas(ChainedStruct) {{member_declaration}};
{% else %}
{{member_declaration}};
{% endif %}
{% endfor %}
};