| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef VkTestContext_DEFINED | 8 #ifndef VkTestContext_DEFINED |
| 9 #define VkTestContext_DEFINED | 9 #define VkTestContext_DEFINED |
| 10 | 10 |
| 11 #include "TestContext.h" | 11 #include "TestContext.h" |
| 12 | 12 |
| 13 #ifdef SK_VULKAN | 13 #ifdef SK_VULKAN |
| 14 | 14 |
| 15 #include "vk/GrVkBackendContext.h" | 15 #include "vk/GrVkBackendContext.h" |
| 16 | 16 |
| 17 namespace sk_gpu_test { | 17 namespace sk_gpu_test { |
| 18 class VkTestContext : public TestContext { | 18 class VkTestContext : public TestContext { |
| 19 public: | 19 public: |
| 20 virtual GrBackend backend() override { return kVulkan_GrBackend; } | 20 virtual GrBackend backend() override { return kVulkan_GrBackend; } |
| 21 virtual GrBackendContext backendContext() override { | 21 virtual GrBackendContext backendContext() override { |
| 22 return reinterpret_cast<GrBackendContext>(fVk.get()); | 22 return reinterpret_cast<GrBackendContext>(fVk.get()); |
| 23 } | 23 } |
| 24 | 24 |
| 25 bool isValid() const override { return NULL != this->vk(); } | 25 bool isValid() const override { return NULL != this->vk(); } |
| 26 | 26 |
| 27 const GrVkInterface* vk() const { return fVk->fInterface; } | 27 const GrVkInterface* vk() const { return fVk->fInterface.get(); } |
| 28 | 28 |
| 29 protected: | 29 protected: |
| 30 VkTestContext(sk_sp<const GrVkBackendContext> vk) : fVk(std::move(vk)) {} | 30 VkTestContext(sk_sp<const GrVkBackendContext> vk) : fVk(std::move(vk)) {} |
| 31 | 31 |
| 32 sk_sp<const GrVkBackendContext> fVk; | 32 sk_sp<const GrVkBackendContext> fVk; |
| 33 | 33 |
| 34 private: | 34 private: |
| 35 typedef TestContext INHERITED; | 35 typedef TestContext INHERITED; |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 /** | 38 /** |
| 39 * Creates Vk context object bound to the native Vk library. | 39 * Creates Vk context object bound to the native Vk library. |
| 40 */ | 40 */ |
| 41 VkTestContext* CreatePlatformVkTestContext(); | 41 VkTestContext* CreatePlatformVkTestContext(); |
| 42 | 42 |
| 43 } // namespace sk_gpu_test | 43 } // namespace sk_gpu_test |
| 44 | 44 |
| 45 #endif | 45 #endif |
| 46 | 46 |
| 47 #endif | 47 #endif |
| OLD | NEW |