| 1 |
/* |
| 2 |
* Copyright 2022 Google LLC |
| 3 |
* |
| 4 |
* Use of this source code is governed by a BSD-style license that can be |
| 5 |
* found in the LICENSE file. |
| 6 |
*/ |
| 7 |
|
| 8 |
#ifndef skiatest_graphite_DawnTestContext_DEFINED |
| 9 |
#define skiatest_graphite_DawnTestContext_DEFINED |
| 10 |
|
| 11 |
#include "tools/graphite/GraphiteTestContext.h" |
| 12 |
|
| 13 |
#include "include/gpu/graphite/dawn/DawnBackendContext.h" |
| 14 |
|
| 15 |
#include <optional> |
| 16 |
|
| 17 |
#include "webgpu/webgpu_cpp.h" // NO_G3_REWRITE |
| 18 |
#include "dawn/native/DawnNative.h" |
| 19 |
|
| 20 |
namespace skiatest::graphite { |
| 21 |
|
| 22 |
class DawnTestContext : public GraphiteTestContext { |
| 23 |
public: |
| 24 |
~DawnTestContext() override; |
| 25 |
|
| 26 |
static std::unique_ptr<GraphiteTestContext> Make(wgpu::BackendType backend); |
| 27 |
|
| 28 |
skgpu::BackendApi backend() override { return skgpu::BackendApi::kDawn; } |
| 29 |
|
| 30 |
skgpu::ContextType contextType() override; |
| 31 |
|
| 32 |
std::unique_ptr<skgpu::graphite::Context> makeContext(const TestOptions&) override; |
| 33 |
|
| 34 |
const skgpu::graphite::DawnBackendContext& getBackendContext() const { |
| 35 |
return fBackendContext; |
| 36 |
} |
| 37 |
|
| 38 |
void tick() override; |
| 39 |
|
| 40 |
protected: |
| 41 |
DawnTestContext(const skgpu::graphite::DawnBackendContext& backendContext) |
| 42 |
: fBackendContext(backendContext) {} |
| 43 |
|
| 44 |
skgpu::graphite::DawnBackendContext fBackendContext; |
| 45 |
}; |
| 46 |
|
| 47 |
} // namespace skiatest::graphite |
| 48 |
|
| 49 |
#endif // skiatest_graphite_DawnTestContext_DEFINED |