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 |
(...skipping 19 matching lines...) Expand all Loading... |
30 kSampleRateShading_GrVkFeatureFlag = 0x0004, | 30 kSampleRateShading_GrVkFeatureFlag = 0x0004, |
31 }; | 31 }; |
32 | 32 |
33 // The BackendContext contains all of the base Vulkan objects needed by the GrVk
Gpu. The assumption | 33 // The BackendContext contains all of the base Vulkan objects needed by the GrVk
Gpu. The assumption |
34 // is that the client will set these up and pass them to the GrVkGpu constructor
. The VkDevice | 34 // is that the client will set these up and pass them to the GrVkGpu constructor
. The VkDevice |
35 // created must support at least one graphics queue, which is passed in as well.
| 35 // created must support at least one graphics queue, which is passed in as well.
|
36 // The QueueFamilyIndex must match the family of the given queue. It is needed f
or CommandPool | 36 // The QueueFamilyIndex must match the family of the given queue. It is needed f
or CommandPool |
37 // creation, and any GrBackendObjects handed to us (e.g., for wrapped textures)
need to be created | 37 // creation, and any GrBackendObjects handed to us (e.g., for wrapped textures)
need to be created |
38 // in or transitioned to that family. | 38 // in or transitioned to that family. |
39 struct GrVkBackendContext : public SkRefCnt { | 39 struct GrVkBackendContext : public SkRefCnt { |
40 VkInstance fInstance; | 40 VkInstance fInstance; |
41 VkPhysicalDevice fPhysicalDevice; | 41 VkPhysicalDevice fPhysicalDevice; |
42 VkDevice fDevice; | 42 VkDevice fDevice; |
43 VkQueue fQueue; | 43 VkQueue fQueue; |
44 uint32_t fGraphicsQueueIndex; | 44 uint32_t fGraphicsQueueIndex; |
45 uint32_t fMinAPIVersion; | 45 uint32_t fMinAPIVersion; |
46 uint32_t fExtensions; | 46 uint32_t fExtensions; |
47 uint32_t fFeatures; | 47 uint32_t fFeatures; |
48 SkAutoTUnref<const GrVkInterface> fInterface; | 48 sk_sp<const GrVkInterface> fInterface; |
49 | 49 |
50 using CanPresentFn = std::function<bool(VkInstance, VkPhysicalDevice, | 50 using CanPresentFn = std::function<bool(VkInstance, VkPhysicalDevice, |
51 uint32_t queueFamilyIndex)>; | 51 uint32_t queueFamilyIndex)>; |
52 | 52 |
53 // Helper function to create the default Vulkan objects needed by the GrVkGp
u object | 53 // Helper function to create the default Vulkan objects needed by the GrVkGp
u object |
54 // If presentQueueIndex is non-NULL, will try to set up presentQueue as part
of device | 54 // If presentQueueIndex is non-NULL, will try to set up presentQueue as part
of device |
55 // creation using the platform-specific canPresent() function. | 55 // creation using the platform-specific canPresent() function. |
56 static const GrVkBackendContext* Create(uint32_t* presentQueueIndex = nullpt
r, | 56 static const GrVkBackendContext* Create(uint32_t* presentQueueIndex = nullpt
r, |
57 CanPresentFn = CanPresentFn()); | 57 CanPresentFn = CanPresentFn()); |
58 | 58 |
59 ~GrVkBackendContext() override; | 59 ~GrVkBackendContext() override; |
60 }; | 60 }; |
61 | 61 |
62 #endif | 62 #endif |
OLD | NEW |