OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 GrVkGpu_DEFINED | 8 #ifndef GrVkGpu_DEFINED |
9 #define GrVkGpu_DEFINED | 9 #define GrVkGpu_DEFINED |
10 | 10 |
11 #include "GrGpu.h" | 11 #include "GrGpu.h" |
12 #include "GrGpuFactory.h" | 12 #include "GrGpuFactory.h" |
13 #include "vk/GrVkBackendContext.h" | 13 #include "vk/GrVkBackendContext.h" |
14 #include "GrVkCaps.h" | 14 #include "GrVkCaps.h" |
15 #include "GrVkIndexBuffer.h" | 15 #include "GrVkIndexBuffer.h" |
16 #include "GrVkMemory.h" | |
16 #include "GrVkResourceProvider.h" | 17 #include "GrVkResourceProvider.h" |
17 #include "GrVkVertexBuffer.h" | 18 #include "GrVkVertexBuffer.h" |
18 #include "GrVkUtil.h" | 19 #include "GrVkUtil.h" |
19 | 20 |
20 #include "shaderc/shaderc.h" | 21 #include "shaderc/shaderc.h" |
21 #include "vk/GrVkDefines.h" | 22 #include "vk/GrVkDefines.h" |
22 | 23 |
23 class GrPipeline; | 24 class GrPipeline; |
24 class GrNonInstancedMesh; | 25 class GrNonInstancedMesh; |
25 | 26 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 shaderc_compiler_t shadercCompiler() const { | 116 shaderc_compiler_t shadercCompiler() const { |
116 return fCompiler; | 117 return fCompiler; |
117 } | 118 } |
118 | 119 |
119 void submitSecondaryCommandBuffer(const GrVkSecondaryCommandBuffer*); | 120 void submitSecondaryCommandBuffer(const GrVkSecondaryCommandBuffer*); |
120 | 121 |
121 void finishDrawTarget() override; | 122 void finishDrawTarget() override; |
122 | 123 |
123 void generateMipmap(GrVkTexture* tex) const; | 124 void generateMipmap(GrVkTexture* tex) const; |
124 | 125 |
126 // Heaps | |
127 enum Heap { | |
128 kLinearImage_Heap = 0, | |
129 kOptimalImage_Heap, | |
130 kSmallOptimalImage_Heap, | |
131 kVertexBuffer_Heap, | |
bsalomon
2016/06/10 15:14:53
Why separate index and vertex heaps? What's the op
jvanverth1
2016/06/10 15:41:20
I'll add some comments. In Vulkan, the index of th
jvanverth1
2016/06/10 18:31:55
As a side note, I'd like to incorporate the small-
jvanverth1
2016/06/13 19:59:22
Done.
| |
132 kIndexBuffer_Heap, | |
133 kUniformBuffer_Heap, | |
134 kCopyReadBuffer_Heap, | |
135 kCopyWriteBuffer_Heap, | |
136 | |
137 kLastHeap = kCopyWriteBuffer_Heap | |
138 }; | |
139 static const int kHeapCount = kLastHeap + 1; | |
140 | |
141 GrVkHeap* getHeap(Heap heap) const { return fHeaps[heap]; } | |
142 | |
125 private: | 143 private: |
126 GrVkGpu(GrContext* context, const GrContextOptions& options, | 144 GrVkGpu(GrContext* context, const GrContextOptions& options, |
127 const GrVkBackendContext* backendContext); | 145 const GrVkBackendContext* backendContext); |
128 | 146 |
129 void onResetContext(uint32_t resetBits) override {} | 147 void onResetContext(uint32_t resetBits) override {} |
130 | 148 |
131 GrTexture* onCreateTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, | 149 GrTexture* onCreateTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, |
132 const SkTArray<GrMipLevel>&) override; | 150 const SkTArray<GrMipLevel>&) override; |
133 | 151 |
134 GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, SkBudgeted, | 152 GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, SkBudgeted, |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
219 // They're copied here for convenient access. | 237 // They're copied here for convenient access. |
220 VkDevice fDevice; | 238 VkDevice fDevice; |
221 VkQueue fQueue; // Must be Graphics queue | 239 VkQueue fQueue; // Must be Graphics queue |
222 | 240 |
223 // Created by GrVkGpu | 241 // Created by GrVkGpu |
224 GrVkResourceProvider fResourceProvider; | 242 GrVkResourceProvider fResourceProvider; |
225 VkCommandPool fCmdPool; | 243 VkCommandPool fCmdPool; |
226 GrVkPrimaryCommandBuffer* fCurrentCmdBuffer; | 244 GrVkPrimaryCommandBuffer* fCurrentCmdBuffer; |
227 VkPhysicalDeviceMemoryProperties fPhysDevMemProps; | 245 VkPhysicalDeviceMemoryProperties fPhysDevMemProps; |
228 | 246 |
247 GrVkHeap* fHeaps[kHeapCount]; | |
248 | |
229 #ifdef ENABLE_VK_LAYERS | 249 #ifdef ENABLE_VK_LAYERS |
230 // For reporting validation layer errors | 250 // For reporting validation layer errors |
231 VkDebugReportCallbackEXT fCallback; | 251 VkDebugReportCallbackEXT fCallback; |
232 #endif | 252 #endif |
233 | 253 |
234 // Shaderc compiler used for compiling glsl in spirv. We only want to create the compiler once | 254 // Shaderc compiler used for compiling glsl in spirv. We only want to create the compiler once |
235 // since there is significant overhead to the first compile of any compiler. | 255 // since there is significant overhead to the first compile of any compiler. |
236 shaderc_compiler_t fCompiler; | 256 shaderc_compiler_t fCompiler; |
237 | 257 |
238 | 258 |
239 typedef GrGpu INHERITED; | 259 typedef GrGpu INHERITED; |
240 }; | 260 }; |
241 | 261 |
242 #endif | 262 #endif |
OLD | NEW |