mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-20 10:25:28 +00:00
generator: Add support for structure of non-object values
This commit is contained in:
committed by
Corentin Wallez
parent
2ee315ca64
commit
a6416543a4
@@ -30,6 +30,25 @@ namespace nxt {
|
||||
{% endfor %}
|
||||
|
||||
|
||||
{% for type in by_category["structure"] %}
|
||||
{% set CppType = as_cppType(type.name) %}
|
||||
{% set CType = as_cType(type.name) %}
|
||||
|
||||
static_assert(sizeof({{CppType}}) == sizeof({{CType}}), "sizeof mismatch for {{CppType}}");
|
||||
static_assert(alignof({{CppType}}) == alignof({{CType}}), "alignof mismatch for {{CppType}}");
|
||||
|
||||
{% if type.extensible %}
|
||||
static_assert(offsetof({{CppType}}, nextInChain) == offsetof({{CType}}, nextInChain),
|
||||
"offsetof mismatch for {{CppType}}::nextInChain");
|
||||
{% endif %}
|
||||
{% for member in type.members %}
|
||||
{% set memberName = member.name.camelCase() %}
|
||||
static_assert(offsetof({{CppType}}, {{memberName}}) == offsetof({{CType}}, {{memberName}}),
|
||||
"offsetof mismatch for {{CppType}}::{{memberName}}");
|
||||
{% endfor %}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
{% for type in by_category["object"] %}
|
||||
{% set CppType = as_cppType(type.name) %}
|
||||
{% set CType = as_cType(type.name) %}
|
||||
|
||||
Reference in New Issue
Block a user