74 lines
2.8 KiB
C++
74 lines
2.8 KiB
C++
//* Copyright 2021 The Dawn Authors
|
|
//*
|
|
//* Licensed under the Apache License, Version 2.0 (the "License");
|
|
//* you may not use this file except in compliance with the License.
|
|
//* You may obtain a copy of the License at
|
|
//*
|
|
//* http://www.apache.org/licenses/LICENSE-2.0
|
|
//*
|
|
//* Unless required by applicable law or agreed to in writing, software
|
|
//* distributed under the License is distributed on an "AS IS" BASIS,
|
|
//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
//* See the License for the specific language governing permissions and
|
|
//* limitations under the License.
|
|
|
|
#ifndef DAWNNATIVE_DAWN_PLATFORM_AUTOGEN_H_
|
|
#define DAWNNATIVE_DAWN_PLATFORM_AUTOGEN_H_
|
|
|
|
#include "dawn/webgpu_cpp.h"
|
|
#include "dawn_native/Forward.h"
|
|
|
|
// Use our autogenerated version of the wgpu structures that point to dawn_native object types
|
|
// (wgpu::Buffer is dawn_native::BufferBase*)
|
|
#include <dawn_native/wgpu_structs_autogen.h>
|
|
|
|
namespace dawn_native {
|
|
|
|
{% for type in by_category["structure"] %}
|
|
inline const {{as_cType(type.name)}}* ToAPI(const {{as_cppType(type.name)}}* rhs) {
|
|
return reinterpret_cast<const {{as_cType(type.name)}}*>(rhs);
|
|
}
|
|
|
|
inline {{as_cType(type.name)}}* ToAPI({{as_cppType(type.name)}}* rhs) {
|
|
return reinterpret_cast<{{as_cType(type.name)}}*>(rhs);
|
|
}
|
|
|
|
inline const {{as_cppType(type.name)}}* FromAPI(const {{as_cType(type.name)}}* rhs) {
|
|
return reinterpret_cast<const {{as_cppType(type.name)}}*>(rhs);
|
|
}
|
|
|
|
inline {{as_cppType(type.name)}}* FromAPI({{as_cType(type.name)}}* rhs) {
|
|
return reinterpret_cast<{{as_cppType(type.name)}}*>(rhs);
|
|
}
|
|
{% endfor %}
|
|
|
|
{% for type in by_category["object"] %}
|
|
inline const {{as_cType(type.name)}}Impl* ToAPI(const {{as_cppType(type.name)}}Base* rhs) {
|
|
return reinterpret_cast<const {{as_cType(type.name)}}Impl*>(rhs);
|
|
}
|
|
|
|
inline {{as_cType(type.name)}}Impl* ToAPI({{as_cppType(type.name)}}Base* rhs) {
|
|
return reinterpret_cast<{{as_cType(type.name)}}Impl*>(rhs);
|
|
}
|
|
|
|
inline const {{as_cppType(type.name)}}Base* FromAPI(const {{as_cType(type.name)}}Impl* rhs) {
|
|
return reinterpret_cast<const {{as_cppType(type.name)}}Base*>(rhs);
|
|
}
|
|
|
|
inline {{as_cppType(type.name)}}Base* FromAPI({{as_cType(type.name)}}Impl* rhs) {
|
|
return reinterpret_cast<{{as_cppType(type.name)}}Base*>(rhs);
|
|
}
|
|
{% endfor %}
|
|
|
|
template <typename T>
|
|
struct EnumCount;
|
|
|
|
{% for e in by_category["enum"] if e.contiguousFromZero %}
|
|
template<>
|
|
struct EnumCount<wgpu::{{as_cppType(e.name)}}> {
|
|
static constexpr uint32_t value = {{len(e.values)}};
|
|
};
|
|
{% endfor %}
|
|
}
|
|
|
|
#endif // DAWNNATIVE_DAWN_PLATFORM_AUTOGEN_H_
|