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 | f730c18 | 2018-07-02 20:15:37 +0000 | [diff] [blame^] | 22 | const GrVkBackendContext& getVkBackendContext() { |
Greg Daniel | 604b197 | 2017-05-15 13:50:35 -0400 | [diff] [blame] | 23 | return fVk; |
| 24 | } |
| 25 | |
Greg Daniel | f730c18 | 2018-07-02 20:15:37 +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 | f730c18 | 2018-07-02 20:15:37 +0000 | [diff] [blame^] | 29 | VkTestContext(const GrVkBackendContext& vk, bool ownsContext) |
| 30 | : fVk(vk), fOwnsContext(ownsContext) {} |
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; |
bsalomon | 18a2f9d | 2016-05-11 10:09:18 -0700 | [diff] [blame] | 34 | |
| 35 | private: |
| 36 | typedef TestContext INHERITED; |
| 37 | }; |
| 38 | |
| 39 | /** |
| 40 | * Creates Vk context object bound to the native Vk library. |
| 41 | */ |
Greg Daniel | 604b197 | 2017-05-15 13:50:35 -0400 | [diff] [blame] | 42 | VkTestContext* CreatePlatformVkTestContext(VkTestContext*); |
bsalomon | 18a2f9d | 2016-05-11 10:09:18 -0700 | [diff] [blame] | 43 | |
| 44 | } // namespace sk_gpu_test |
| 45 | |
| 46 | #endif |
| 47 | |
| 48 | #endif |