| 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 GpuTools_DEFINED |
| 9 |
#define GpuTools_DEFINED |
| 10 |
|
| 11 |
#include "include/core/SkSurface.h" |
| 12 |
|
| 13 |
#if defined(SK_GANESH) |
| 14 |
#include "include/gpu/ganesh/SkSurfaceGanesh.h" |
| 15 |
#endif |
| 16 |
|
| 17 |
#if defined(SK_GRAPHITE) |
| 18 |
#include "src/gpu/graphite/Surface_Graphite.h" |
| 19 |
#endif |
| 20 |
|
| 21 |
namespace skgpu { |
| 22 |
// Flush any surface, even if we don't know what GPU backend it is for. This keeps the |
| 23 |
// comparisons between Ganesh and Graphite more fair as the latter can do more batching |
| 24 |
// unless we explicitly perform flushes. |
| 25 |
inline void Flush(SkSurface* surface) { |
| 26 |
#if defined(SK_GANESH) |
| 27 |
skgpu::ganesh::Flush(surface); |
| 28 |
#endif |
| 29 |
#if defined(SK_GRAPHITE) |
| 30 |
skgpu::graphite::Flush(surface); |
| 31 |
#endif |
| 32 |
} |
| 33 |
|
| 34 |
inline void FlushAndSubmit(SkSurface* surface) { |
| 35 |
#if defined(SK_GANESH) |
| 36 |
skgpu::ganesh::FlushAndSubmit(surface); |
| 37 |
#endif |
| 38 |
#if defined(SK_GRAPHITE) |
| 39 |
// Graphite doesn't have a "flush and submit" equivalent |
| 40 |
skgpu::graphite::Flush(surface); |
| 41 |
#endif |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
#endif |