mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-08 21:17:45 +00:00
Add WGPUAdapterProperties and expose it in DawnNative
The dawn_native::Adapter::GetPCIInfo/GetBackendType/GetDeviceType methods are now deprecated in favor of a method returning a webgpu.h AdapterProperties structure. Deprecated function are still available to avoid breaking Chromium or Skia compilation. This reduces the difference between dawn.json and webgpu.h BUG=dawn:160 Change-Id: Ib68fe1c4d1d87676c01c212c91f80fdd26056c56 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14541 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
5fc2c82c11
commit
f12c9dba6d
@@ -65,13 +65,13 @@ enum class CmdBufType {
|
||||
// Default to D3D12, Metal, Vulkan, OpenGL in that order as D3D12 and Metal are the preferred on
|
||||
// their respective platforms, and Vulkan is preferred to OpenGL
|
||||
#if defined(DAWN_ENABLE_BACKEND_D3D12)
|
||||
static dawn_native::BackendType backendType = dawn_native::BackendType::D3D12;
|
||||
static wgpu::BackendType backendType = wgpu::BackendType::D3D12;
|
||||
#elif defined(DAWN_ENABLE_BACKEND_METAL)
|
||||
static dawn_native::BackendType backendType = dawn_native::BackendType::Metal;
|
||||
#elif defined(DAWN_ENABLE_BACKEND_OPENGL)
|
||||
static dawn_native::BackendType backendType = dawn_native::BackendType::OpenGL;
|
||||
static wgpu::BackendType backendType = wgpu::BackendType::Metal;
|
||||
#elif defined(DAWN_ENABLE_BACKEND_VULKAN)
|
||||
static dawn_native::BackendType backendType = dawn_native::BackendType::Vulkan;
|
||||
static wgpu::BackendType backendType = wgpu::BackendType::Vulkan;
|
||||
#elif defined(DAWN_ENABLE_BACKEND_OPENGL)
|
||||
static wgpu::BackendType backendType = wgpu::BackendType::OpenGL;
|
||||
#else
|
||||
#error
|
||||
#endif
|
||||
@@ -109,8 +109,10 @@ wgpu::Device CreateCppDawnDevice() {
|
||||
std::vector<dawn_native::Adapter> adapters = instance->GetAdapters();
|
||||
auto adapterIt = std::find_if(adapters.begin(), adapters.end(),
|
||||
[](const dawn_native::Adapter adapter) -> bool {
|
||||
return adapter.GetBackendType() == backendType;
|
||||
});
|
||||
wgpu::AdapterProperties properties;
|
||||
adapter.GetProperties(&properties);
|
||||
return properties.backendType == backendType;
|
||||
});
|
||||
ASSERT(adapterIt != adapters.end());
|
||||
backendAdapter = *adapterIt;
|
||||
}
|
||||
@@ -200,23 +202,23 @@ bool InitSample(int argc, const char** argv) {
|
||||
if (std::string("-b") == argv[i] || std::string("--backend") == argv[i]) {
|
||||
i++;
|
||||
if (i < argc && std::string("d3d12") == argv[i]) {
|
||||
backendType = dawn_native::BackendType::D3D12;
|
||||
backendType = wgpu::BackendType::D3D12;
|
||||
continue;
|
||||
}
|
||||
if (i < argc && std::string("metal") == argv[i]) {
|
||||
backendType = dawn_native::BackendType::Metal;
|
||||
backendType = wgpu::BackendType::Metal;
|
||||
continue;
|
||||
}
|
||||
if (i < argc && std::string("null") == argv[i]) {
|
||||
backendType = dawn_native::BackendType::Null;
|
||||
backendType = wgpu::BackendType::Null;
|
||||
continue;
|
||||
}
|
||||
if (i < argc && std::string("opengl") == argv[i]) {
|
||||
backendType = dawn_native::BackendType::OpenGL;
|
||||
backendType = wgpu::BackendType::OpenGL;
|
||||
continue;
|
||||
}
|
||||
if (i < argc && std::string("vulkan") == argv[i]) {
|
||||
backendType = dawn_native::BackendType::Vulkan;
|
||||
backendType = wgpu::BackendType::Vulkan;
|
||||
continue;
|
||||
}
|
||||
fprintf(stderr, "--backend expects a backend name (opengl, metal, d3d12, null, vulkan)\n");
|
||||
|
||||
Reference in New Issue
Block a user