| 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 GrVkDirectContext_DEFINED |
| 9 |
#define GrVkDirectContext_DEFINED |
| 10 |
|
| 11 |
#include "include/core/SkRefCnt.h" |
| 12 |
#include "include/private/base/SkAPI.h" |
| 13 |
|
| 14 |
class GrDirectContext; |
| 15 |
struct GrContextOptions; |
| 16 |
namespace skgpu { |
| 17 |
struct VulkanBackendContext; |
| 18 |
} |
| 19 |
|
| 20 |
namespace GrDirectContexts { |
| 21 |
/** |
| 22 |
* The Vulkan context (VkQueue, VkDevice, VkInstance) must be kept alive until the returned |
| 23 |
* GrDirectContext is destroyed. This also means that any objects created with this |
| 24 |
* GrDirectContext (e.g. SkSurfaces, SkImages, etc.) must also be released as they may hold |
| 25 |
* refs on the GrDirectContext. Once all these objects and the GrDirectContext are released, |
| 26 |
* then it is safe to delete the vulkan objects. |
| 27 |
*/ |
| 28 |
SK_API sk_sp<GrDirectContext> MakeVulkan(const skgpu::VulkanBackendContext&, |
| 29 |
const GrContextOptions&); |
| 30 |
SK_API sk_sp<GrDirectContext> MakeVulkan(const skgpu::VulkanBackendContext&); |
| 31 |
} |
| 32 |
|
| 33 |
#endif |