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 | |
| 15 | #include "vk/GrVkBackendContext.h" |
| 16 | |
| 17 | namespace sk_gpu_test { |
| 18 | class VkTestContext : public TestContext { |
| 19 | public: |
| 20 | virtual GrBackend backend() override { return kVulkan_GrBackend; } |
bsalomon | 18a2f9d | 2016-05-11 10:09:18 -0700 | [diff] [blame] | 21 | |
Greg Daniel | 007267b | 2018-06-28 23:31:00 +0000 | [diff] [blame] | 22 | sk_sp<const GrVkBackendContext> getVkBackendContext() { |
Greg Daniel | 604b197 | 2017-05-15 13:50:35 -0400 | [diff] [blame] | 23 | return fVk; |
| 24 | } |
| 25 | |
Greg Daniel | 007267b | 2018-06-28 23:31:00 +0000 | [diff] [blame] | 26 | const GrVkInterface* vk() const { return fVk->fInterface.get(); } |
bsalomon | 18a2f9d | 2016-05-11 10:09:18 -0700 | [diff] [blame] | 27 | |
| 28 | protected: |
Greg Daniel | 007267b | 2018-06-28 23:31:00 +0000 | [diff] [blame] | 29 | VkTestContext(sk_sp<const GrVkBackendContext> vk) : fVk(std::move(vk)) {} |
bsalomon | 18a2f9d | 2016-05-11 10:09:18 -0700 | [diff] [blame] | 30 | |
Greg Daniel | 007267b | 2018-06-28 23:31:00 +0000 | [diff] [blame] | 31 | sk_sp<const GrVkBackendContext> fVk; |
bsalomon | 18a2f9d | 2016-05-11 10:09:18 -0700 | [diff] [blame] | 32 | |
| 33 | private: |
| 34 | typedef TestContext INHERITED; |
| 35 | }; |
| 36 | |
| 37 | /** |
| 38 | * Creates Vk context object bound to the native Vk library. |
| 39 | */ |
Greg Daniel | 604b197 | 2017-05-15 13:50:35 -0400 | [diff] [blame] | 40 | VkTestContext* CreatePlatformVkTestContext(VkTestContext*); |
bsalomon | 18a2f9d | 2016-05-11 10:09:18 -0700 | [diff] [blame] | 41 | |
| 42 | } // namespace sk_gpu_test |
| 43 | |
| 44 | #endif |
| 45 | |
| 46 | #endif |