mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-13 10:51:35 +00:00
Change backend connection in Instance.cpp to store a bitset of backends that have been connected. This lets us only connect to a single backend if AdapterDiscoveryOptions are passed explicitly, and track which connections have/have not been made. Later, we can connect to the rest of the backends if more are requested. This is part of some improvements to the existing code so we can selectively discover adapters and control discovery of the high-performance, low-power, and fallback WebGPU adapters. Bug: chromium:1266550 Change-Id: Iceb0d3f71751f5aac6218996ace3cf89deda8a29 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/69521 Commit-Queue: Austin Eng <enga@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
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_
|