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 | |
Greg Daniel | 98bffae | 2018-08-01 13:25:41 -0400 | [diff] [blame^] | 18 | class GrVkExtensions; |
| 19 | |
bsalomon | 18a2f9d | 2016-05-11 10:09:18 -0700 | [diff] [blame] | 20 | namespace sk_gpu_test { |
| 21 | class VkTestContext : public TestContext { |
| 22 | public: |
| 23 | virtual GrBackend backend() override { return kVulkan_GrBackend; } |
bsalomon | 18a2f9d | 2016-05-11 10:09:18 -0700 | [diff] [blame] | 24 | |
Greg Daniel | 98bffae | 2018-08-01 13:25:41 -0400 | [diff] [blame^] | 25 | const GrVkBackendContext& getVkBackendContext() const { |
Greg Daniel | 604b197 | 2017-05-15 13:50:35 -0400 | [diff] [blame] | 26 | return fVk; |
| 27 | } |
| 28 | |
Greg Daniel | 98bffae | 2018-08-01 13:25:41 -0400 | [diff] [blame^] | 29 | const GrVkExtensions* getVkExtensions() const { |
| 30 | return fExtensions; |
| 31 | } |
bsalomon | 18a2f9d | 2016-05-11 10:09:18 -0700 | [diff] [blame] | 32 | |
Greg Daniel | 98bffae | 2018-08-01 13:25:41 -0400 | [diff] [blame^] | 33 | protected: |
| 34 | VkTestContext(const GrVkBackendContext& vk, const GrVkExtensions* extensions, bool ownsContext, |
| 35 | VkDebugReportCallbackEXT debugCallback) |
| 36 | : fVk(vk) |
| 37 | , fExtensions(extensions) |
| 38 | , fOwnsContext(ownsContext) |
| 39 | , fDebugCallback(debugCallback) {} |
| 40 | |
| 41 | GrVkBackendContext fVk; |
| 42 | const GrVkExtensions* fExtensions; |
| 43 | bool fOwnsContext; |
Greg Daniel | 37329b3 | 2018-07-02 20:16:44 +0000 | [diff] [blame] | 44 | VkDebugReportCallbackEXT fDebugCallback = VK_NULL_HANDLE; |
bsalomon | 18a2f9d | 2016-05-11 10:09:18 -0700 | [diff] [blame] | 45 | |
| 46 | private: |
| 47 | typedef TestContext INHERITED; |
| 48 | }; |
| 49 | |
| 50 | /** |
| 51 | * Creates Vk context object bound to the native Vk library. |
| 52 | */ |
Greg Daniel | 604b197 | 2017-05-15 13:50:35 -0400 | [diff] [blame] | 53 | VkTestContext* CreatePlatformVkTestContext(VkTestContext*); |
bsalomon | 18a2f9d | 2016-05-11 10:09:18 -0700 | [diff] [blame] | 54 | |
| 55 | } // namespace sk_gpu_test |
| 56 | |
| 57 | #endif |
| 58 | |
| 59 | #endif |