Replace uses of deprecated dawn_native::BackendType
Bug: dawn:824 Change-Id: I261c3329e53de62df83b4cca10aa9e909dd293df Reviewed-on: https://skia-review.googlesource.com/c/skia/+/492456 Auto-Submit: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Stephen White <senorblanco@google.com> Commit-Queue: Stephen White <senorblanco@google.com>
This commit is contained in:
parent
e3b935b0bf
commit
41e994f735
@ -84,13 +84,15 @@ static void PrintDeviceError(WGPUErrorType, const char* message, void*) {
|
||||
class DawnTestContextImpl : public sk_gpu_test::DawnTestContext {
|
||||
public:
|
||||
static wgpu::Device createDevice(const dawn_native::Instance& instance,
|
||||
dawn_native::BackendType type) {
|
||||
wgpu::BackendType type) {
|
||||
DawnProcTable backendProcs = dawn_native::GetProcs();
|
||||
dawnProcSetProcs(&backendProcs);
|
||||
|
||||
std::vector<dawn_native::Adapter> adapters = instance.GetAdapters();
|
||||
for (dawn_native::Adapter adapter : adapters) {
|
||||
if (adapter.GetBackendType() == type) {
|
||||
wgpu::AdapterProperties properties;
|
||||
adapter.GetProperties(&properties);
|
||||
if (properties.backendType == type) {
|
||||
return wgpu::Device::Acquire(adapter.CreateDevice());
|
||||
}
|
||||
}
|
||||
@ -103,7 +105,7 @@ public:
|
||||
if (sharedContext) {
|
||||
device = sharedContext->getDevice();
|
||||
} else {
|
||||
dawn_native::BackendType type;
|
||||
wgpu::BackendType type;
|
||||
#if USE_OPENGL_BACKEND
|
||||
dawn_native::opengl::AdapterDiscoveryOptions adapterOptions;
|
||||
adapterOptions.getProc = reinterpret_cast<void*(*)(const char*)>(
|
||||
@ -116,15 +118,15 @@ public:
|
||||
#endif
|
||||
);
|
||||
instance->DiscoverAdapters(&adapterOptions);
|
||||
type = dawn_native::BackendType::OpenGL;
|
||||
type = wgpu::BackendType::OpenGL;
|
||||
#else
|
||||
instance->DiscoverDefaultAdapters();
|
||||
#if defined(SK_BUILD_FOR_MAC)
|
||||
type = dawn_native::BackendType::Metal;
|
||||
type = wgpu::BackendType::Metal;
|
||||
#elif defined(SK_BUILD_FOR_WIN)
|
||||
type = dawn_native::BackendType::D3D12;
|
||||
type = wgpu::BackendType::D3D12;
|
||||
#elif defined(SK_BUILD_FOR_UNIX)
|
||||
type = dawn_native::BackendType::Vulkan;
|
||||
type = wgpu::BackendType::Vulkan;
|
||||
#endif
|
||||
#endif
|
||||
device = createDevice(*instance, type);
|
||||
|
@ -106,14 +106,16 @@ void DawnWindowContext::setDisplayParams(const DisplayParams& params) {
|
||||
fDisplayParams = params;
|
||||
}
|
||||
|
||||
wgpu::Device DawnWindowContext::createDevice(dawn_native::BackendType type) {
|
||||
wgpu::Device DawnWindowContext::createDevice(wgpu::BackendType type) {
|
||||
fInstance->DiscoverDefaultAdapters();
|
||||
DawnProcTable backendProcs = dawn_native::GetProcs();
|
||||
dawnProcSetProcs(&backendProcs);
|
||||
|
||||
std::vector<dawn_native::Adapter> adapters = fInstance->GetAdapters();
|
||||
for (dawn_native::Adapter adapter : adapters) {
|
||||
if (adapter.GetBackendType() == type) {
|
||||
wgpu::AdapterProperties properties;
|
||||
adapter.GetProperties(&properties);
|
||||
if (properties.backendType == type) {
|
||||
return adapter.CreateDevice();
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
protected:
|
||||
bool isGpuContext() override { return true; }
|
||||
void initializeContext(int width, int height);
|
||||
wgpu::Device createDevice(dawn_native::BackendType type);
|
||||
wgpu::Device createDevice(wgpu::BackendType type);
|
||||
virtual wgpu::Device onInitializeContext() = 0;
|
||||
virtual void onDestroyContext() = 0;
|
||||
virtual void onSwapBuffers() = 0;
|
||||
|
@ -119,7 +119,7 @@ DawnSwapChainImplementation DawnMTLWindowContext::createSwapChainImplementation(
|
||||
}
|
||||
|
||||
wgpu::Device DawnMTLWindowContext::onInitializeContext() {
|
||||
wgpu::Device device = this->createDevice(dawn_native::BackendType::Metal);
|
||||
wgpu::Device device = this->createDevice(wgpu::BackendType::Metal);
|
||||
if (!device) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ DawnSwapChainImplementation DawnVulkanWindowContext_xlib::createSwapChainImpleme
|
||||
}
|
||||
|
||||
wgpu::Device DawnVulkanWindowContext_xlib::onInitializeContext() {
|
||||
wgpu::Device device = this->createDevice(dawn_native::BackendType::Vulkan);
|
||||
wgpu::Device device = this->createDevice(wgpu::BackendType::Vulkan);
|
||||
if (!device) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ DawnSwapChainImplementation DawnD3D12WindowContext::createSwapChainImplementatio
|
||||
}
|
||||
|
||||
wgpu::Device DawnD3D12WindowContext::onInitializeContext() {
|
||||
return this->createDevice(dawn_native::BackendType::D3D12);
|
||||
return this->createDevice(wgpu::BackendType::D3D12);
|
||||
}
|
||||
|
||||
void DawnD3D12WindowContext::onDestroyContext() {
|
||||
|
Loading…
Reference in New Issue
Block a user