Flutter Engine
The Flutter Engine
DawnErrorChecker.h
Go to the documentation of this file.
1/*
2 * Copyright 2023 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 skgpu_graphite_DawnErrorChecker_DEFINED
9#define skgpu_graphite_DawnErrorChecker_DEFINED
10
12
14
15#include "webgpu/webgpu_cpp.h" // NO_G3_REWRITE
16
17namespace skgpu::graphite {
18
19class DawnCaps;
20
21enum class DawnErrorType : uint32_t {
22 kNoError = 0b00000000,
23 kValidation = 0b00000001,
24 kOutOfMemory = 0b00000010,
25 kInternal = 0b00000100,
26};
28
29// DawnErrorChecker immediately pushes error scopes for all known Dawn error filter types
30// (Validation, OutOfMemory, Internal) upon construction and detects any errors that are
31// reported within those scopes. Errors can be detected synchronously by either
32//
33// 1. calling `check()`, which returns false if any errors were reported, or
34// 2. destroying the DawnErrorChecker instance, which asserts if any errors are reported
35// which weren't previously caught by calling `check()` directly.
36//
38public:
39 explicit DawnErrorChecker(const DawnSharedContext*);
41
43
44private:
45 bool fArmed = true;
46 const DawnSharedContext* fSharedContext;
47};
48
49} // namespace skgpu::graphite
50
51#endif // skgpu_graphite_DawnErrorChecker_DEFINED
DawnErrorChecker(const DawnSharedContext *)
SkEnumBitMask< DawnErrorType > popErrorScopes()
SK_MAKE_BITMASK_OPS(DawnErrorType)
const int kNoError