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 GrVkResourceProvider_DEFINED | 8 #ifndef GrVkResourceProvider_DEFINED |
9 #define GrVkResourceProvider_DEFINED | 9 #define GrVkResourceProvider_DEFINED |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 class GrVkGpu; | 21 class GrVkGpu; |
22 class GrVkPipeline; | 22 class GrVkPipeline; |
23 class GrVkRenderPass; | 23 class GrVkRenderPass; |
24 class GrVkRenderTarget; | 24 class GrVkRenderTarget; |
25 | 25 |
26 class GrVkResourceProvider { | 26 class GrVkResourceProvider { |
27 public: | 27 public: |
28 GrVkResourceProvider(GrVkGpu* gpu); | 28 GrVkResourceProvider(GrVkGpu* gpu); |
29 ~GrVkResourceProvider(); | 29 ~GrVkResourceProvider(); |
30 | 30 |
| 31 // Set up any initial vk objects |
| 32 void init(); |
| 33 |
31 GrVkPipeline* createPipeline(const GrPipeline& pipeline, | 34 GrVkPipeline* createPipeline(const GrPipeline& pipeline, |
32 const GrPrimitiveProcessor& primProc, | 35 const GrPrimitiveProcessor& primProc, |
33 VkPipelineShaderStageCreateInfo* shaderStageInf
o, | 36 VkPipelineShaderStageCreateInfo* shaderStageInf
o, |
34 int shaderStageCount, | 37 int shaderStageCount, |
35 GrPrimitiveType primitiveType, | 38 GrPrimitiveType primitiveType, |
36 const GrVkRenderPass& renderPass, | 39 const GrVkRenderPass& renderPass, |
37 VkPipelineLayout layout); | 40 VkPipelineLayout layout); |
38 | 41 |
39 // Finds or creates a simple render pass that matches the target, increments
the refcount, | 42 // Finds or creates a simple render pass that matches the target, increments
the refcount, |
40 // and returns. | 43 // and returns. |
(...skipping 18 matching lines...) Expand all Loading... |
59 void destroyResources(); | 62 void destroyResources(); |
60 | 63 |
61 // Abandon any cached resources. To be used when the context/VkDevice is los
t. | 64 // Abandon any cached resources. To be used when the context/VkDevice is los
t. |
62 // For resource tracing to work properly, this should be called after unrefi
ng all other | 65 // For resource tracing to work properly, this should be called after unrefi
ng all other |
63 // resource usages. | 66 // resource usages. |
64 void abandonResources(); | 67 void abandonResources(); |
65 | 68 |
66 private: | 69 private: |
67 GrVkGpu* fGpu; | 70 GrVkGpu* fGpu; |
68 | 71 |
| 72 // Central cache for creating pipelines |
| 73 VkPipelineCache fPipelineCache; |
| 74 |
69 // Array of RenderPasses that only have a single color attachment, optional
stencil attachment, | 75 // Array of RenderPasses that only have a single color attachment, optional
stencil attachment, |
70 // optional resolve attachment, and only one subpass | 76 // optional resolve attachment, and only one subpass |
71 SkSTArray<4, GrVkRenderPass*> fSimpleRenderPasses; | 77 SkSTArray<4, GrVkRenderPass*> fSimpleRenderPasses; |
72 | 78 |
73 // Array of CommandBuffers that are currently in flight | 79 // Array of CommandBuffers that are currently in flight |
74 SkSTArray<4, GrVkCommandBuffer*> fActiveCommandBuffers; | 80 SkSTArray<4, GrVkCommandBuffer*> fActiveCommandBuffers; |
75 }; | 81 }; |
76 | 82 |
77 #endif | 83 #endif |
OLD | NEW |