| 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 GrVkBackendContext_DEFINED | 8 #ifndef GrVkBackendContext_DEFINED |
| 9 #define GrVkBackendContext_DEFINED | 9 #define GrVkBackendContext_DEFINED |
| 10 | 10 |
| 11 #include "SkRefCnt.h" | 11 #include "SkRefCnt.h" |
| 12 | 12 |
| 13 #include "vulkan/vulkan.h" | 13 #include "vulkan/vulkan.h" |
| 14 | 14 |
| 15 #ifdef SK_DEBUG | 15 #ifdef SK_DEBUG |
| 16 #define ENABLE_VK_LAYERS | 16 #define ENABLE_VK_LAYERS |
| 17 #endif | 17 #endif |
| 18 | 18 |
| 19 struct GrVkInterface; | 19 struct GrVkInterface; |
| 20 | 20 |
| 21 enum GrVkExtensionFlags { |
| 22 kEXT_debug_report_GrVkExtensionFlag = 0x0001, |
| 23 kNV_glsl_shader_GrVkExtensionFlag = 0x0002, |
| 24 }; |
| 25 |
| 26 enum GrVkFeatureFlags { |
| 27 kGeometryShader_GrVkFeatureFlag = 0x0001, |
| 28 kDualSrcBlend_GrVkFeatureFlag = 0x0002, |
| 29 kSampleRateShading_GrVkFeatureFlag = 0x0004, |
| 30 }; |
| 31 |
| 21 // The BackendContext contains all of the base Vulkan objects needed by the GrVk
Gpu. The assumption | 32 // The BackendContext contains all of the base Vulkan objects needed by the GrVk
Gpu. The assumption |
| 22 // is that the client will set these up and pass them to the GrVkGpu constructor
. The VkDevice | 33 // is that the client will set these up and pass them to the GrVkGpu constructor
. The VkDevice |
| 23 // created must support at least one graphics queue, which is passed in as well.
| 34 // created must support at least one graphics queue, which is passed in as well.
|
| 24 // The QueueFamilyIndex must match the family of the given queue. It is needed f
or CommandPool | 35 // The QueueFamilyIndex must match the family of the given queue. It is needed f
or CommandPool |
| 25 // creation, and any GrBackendObjects handed to us (e.g., for wrapped textures)
need to be created | 36 // creation, and any GrBackendObjects handed to us (e.g., for wrapped textures)
need to be created |
| 26 // in or transitioned to that family. | 37 // in or transitioned to that family. |
| 27 struct GrVkBackendContext : public SkRefCnt { | 38 struct GrVkBackendContext : public SkRefCnt { |
| 28 VkInstance fInstance; | 39 VkInstance fInstance; |
| 29 VkPhysicalDevice fPhysicalDevice; | 40 VkPhysicalDevice fPhysicalDevice; |
| 30 VkDevice fDevice; | 41 VkDevice fDevice; |
| 31 VkQueue fQueue; | 42 VkQueue fQueue; |
| 32 uint32_t fQueueFamilyIndex; | 43 uint32_t fQueueFamilyIndex; |
| 44 uint32_t fMinAPIVersion; |
| 45 uint32_t fExtensions; |
| 46 uint32_t fFeatures; |
| 33 SkAutoTUnref<const GrVkInterface> fInterface; | 47 SkAutoTUnref<const GrVkInterface> fInterface; |
| 34 | 48 |
| 35 // Helper function to create the default Vulkan objects needed by the GrVkGp
u object | 49 // Helper function to create the default Vulkan objects needed by the GrVkGp
u object |
| 36 static const GrVkBackendContext* Create(); | 50 static const GrVkBackendContext* Create(); |
| 37 | 51 |
| 38 ~GrVkBackendContext() override; | 52 ~GrVkBackendContext() override; |
| 39 }; | 53 }; |
| 40 | 54 |
| 41 #endif | 55 #endif |
| OLD | NEW |