bsalomon | 18a2f9d | 2016-05-11 10:09:18 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 Google Inc. |
| 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 VkTestContext_DEFINED |
| 9 | #define VkTestContext_DEFINED |
| 10 | |
| 11 | #include "TestContext.h" |
| 12 | |
| 13 | #ifdef SK_VULKAN |
| 14 | |
Greg Daniel | da16cce | 2018-08-01 09:23:57 -0400 | [diff] [blame] | 15 | #include "GrVulkanDefines.h" |
bsalomon | 18a2f9d | 2016-05-11 10:09:18 -0700 | [diff] [blame] | 16 | #include "vk/GrVkBackendContext.h" |
| 17 | |
| 18 | namespace sk_gpu_test { |
| 19 | class VkTestContext : public TestContext { |
| 20 | public: |
| 21 | virtual GrBackend backend() override { return kVulkan_GrBackend; } |
bsalomon | 18a2f9d | 2016-05-11 10:09:18 -0700 | [diff] [blame] | 22 | |
Greg Daniel | f730c18 | 2018-07-02 20:15:37 +0000 | [diff] [blame] | 23 | const GrVkBackendContext& getVkBackendContext() { |
Greg Daniel | 604b197 | 2017-05-15 13:50:35 -0400 | [diff] [blame] | 24 | return fVk; |
| 25 | } |
| 26 | |
bsalomon | 18a2f9d | 2016-05-11 10:09:18 -0700 | [diff] [blame] | 27 | protected: |
Greg Daniel | 37329b3 | 2018-07-02 20:16:44 +0000 | [diff] [blame] | 28 | VkTestContext(const GrVkBackendContext& vk, bool ownsContext, |
| 29 | VkDebugReportCallbackEXT debugCallback) |
| 30 | : fVk(vk), fOwnsContext(ownsContext), fDebugCallback(debugCallback) {} |
bsalomon | 18a2f9d | 2016-05-11 10:09:18 -0700 | [diff] [blame] | 31 | |
Greg Daniel | f730c18 | 2018-07-02 20:15:37 +0000 | [diff] [blame] | 32 | GrVkBackendContext fVk; |
| 33 | bool fOwnsContext; |
Greg Daniel | 37329b3 | 2018-07-02 20:16:44 +0000 | [diff] [blame] | 34 | VkDebugReportCallbackEXT fDebugCallback = VK_NULL_HANDLE; |
bsalomon | 18a2f9d | 2016-05-11 10:09:18 -0700 | [diff] [blame] | 35 | |
| 36 | private: |
| 37 | typedef TestContext INHERITED; |
| 38 | }; |
| 39 | |
| 40 | /** |
| 41 | * Creates Vk context object bound to the native Vk library. |
| 42 | */ |
Greg Daniel | 604b197 | 2017-05-15 13:50:35 -0400 | [diff] [blame] | 43 | VkTestContext* CreatePlatformVkTestContext(VkTestContext*); |
bsalomon | 18a2f9d | 2016-05-11 10:09:18 -0700 | [diff] [blame] | 44 | |
| 45 | } // namespace sk_gpu_test |
| 46 | |
| 47 | #endif |
| 48 | |
| 49 | #endif |