2019-07-18 15:43:45 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2019 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef DawnTestContext_DEFINED
|
|
|
|
#define DawnTestContext_DEFINED
|
|
|
|
|
|
|
|
#include "tools/gpu/TestContext.h"
|
2022-03-07 14:00:50 +00:00
|
|
|
#include <dawn/native/DawnNative.h>
|
2019-07-18 15:43:45 +00:00
|
|
|
|
|
|
|
#ifdef SK_DAWN
|
|
|
|
|
|
|
|
namespace sk_gpu_test {
|
|
|
|
class DawnTestContext : public TestContext {
|
|
|
|
public:
|
|
|
|
virtual GrBackend backend() override { return GrBackendApi::kDawn; }
|
|
|
|
|
2019-10-30 13:56:23 +00:00
|
|
|
const wgpu::Device& getDevice() {
|
2019-07-18 15:43:45 +00:00
|
|
|
return fDevice;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2022-03-07 14:00:50 +00:00
|
|
|
DawnTestContext(std::unique_ptr<dawn::native::Instance> instance, const wgpu::Device& device)
|
2020-06-03 18:05:48 +00:00
|
|
|
: fInstance(std::move(instance)), fDevice(device) {}
|
2019-07-18 15:43:45 +00:00
|
|
|
|
2022-03-07 14:00:50 +00:00
|
|
|
std::unique_ptr<dawn::native::Instance> fInstance;
|
2019-10-30 13:56:23 +00:00
|
|
|
wgpu::Device fDevice;
|
2019-07-18 15:43:45 +00:00
|
|
|
|
|
|
|
private:
|
2020-09-03 02:42:33 +00:00
|
|
|
using INHERITED = TestContext;
|
2019-07-18 15:43:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates Dawn context object bound to the Dawn library.
|
|
|
|
*/
|
|
|
|
DawnTestContext* CreatePlatformDawnTestContext(DawnTestContext*);
|
|
|
|
|
|
|
|
} // namespace sk_gpu_test
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|