mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-20 10:25:28 +00:00
webgpu.h introduce a base struct for extension structures.
struct WGPUChainedStruct {
WGPUChainedStruct const * nextInChain;
WGPUSType sType;
};
And changes all the nextInChain to point to such structures. This adds
more type safety to extension structs and requires less casting to check
sTypes and friends.
Bug: dawn:269
Change-Id: I443f363cdb55dbec7c7f6e897245d4a7ea0ebe70
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15080
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
7f078e7ebe
commit
2b24c3d92d
@@ -186,10 +186,22 @@ namespace wgpu {
|
||||
Instance CreateInstance(InstanceDescriptor const * descriptor = nullptr);
|
||||
Proc GetProcAddress(Device const& device, const char* procName);
|
||||
|
||||
struct ChainedStruct {
|
||||
ChainedStruct const * nextInChain = nullptr;
|
||||
SType sType = SType::Invalid;
|
||||
};
|
||||
|
||||
{% for type in by_category["structure"] %}
|
||||
struct {{as_cppType(type.name)}} {
|
||||
{% if type.chained %}
|
||||
struct {{as_cppType(type.name)}} : ChainedStruct {
|
||||
{{as_cppType(type.name)}}() {
|
||||
sType = SType::{{type.name.CamelCase()}};
|
||||
}
|
||||
{% else %}
|
||||
struct {{as_cppType(type.name)}} {
|
||||
{% endif %}
|
||||
{% if type.extensible %}
|
||||
const void* nextInChain = nullptr;
|
||||
ChainedStruct const * nextInChain = nullptr;
|
||||
{% endif %}
|
||||
{% for member in type.members %}
|
||||
{{as_annotated_cppType(member)}}{{render_cpp_default_value(member)}};
|
||||
|
||||
Reference in New Issue
Block a user