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 #define USE_SKSL 1 |
| 12 |
11 #include "GrGpu.h" | 13 #include "GrGpu.h" |
12 #include "GrGpuFactory.h" | 14 #include "GrGpuFactory.h" |
13 #include "vk/GrVkBackendContext.h" | 15 #include "vk/GrVkBackendContext.h" |
14 #include "GrVkCaps.h" | 16 #include "GrVkCaps.h" |
15 #include "GrVkIndexBuffer.h" | 17 #include "GrVkIndexBuffer.h" |
16 #include "GrVkMemory.h" | 18 #include "GrVkMemory.h" |
17 #include "GrVkResourceProvider.h" | 19 #include "GrVkResourceProvider.h" |
18 #include "GrVkVertexBuffer.h" | 20 #include "GrVkVertexBuffer.h" |
19 #include "GrVkUtil.h" | 21 #include "GrVkUtil.h" |
20 | 22 |
| 23 #if USE_SKSL |
| 24 namespace SkSL { |
| 25 class Compiler; |
| 26 } |
| 27 #else |
21 #include "shaderc/shaderc.h" | 28 #include "shaderc/shaderc.h" |
| 29 #endif |
| 30 |
22 #include "vk/GrVkDefines.h" | 31 #include "vk/GrVkDefines.h" |
23 | 32 |
24 class GrPipeline; | 33 class GrPipeline; |
25 class GrNonInstancedMesh; | 34 class GrNonInstancedMesh; |
26 | 35 |
27 class GrVkBufferImpl; | 36 class GrVkBufferImpl; |
28 class GrVkPipeline; | 37 class GrVkPipeline; |
29 class GrVkPipelineState; | 38 class GrVkPipelineState; |
30 class GrVkPrimaryCommandBuffer; | 39 class GrVkPrimaryCommandBuffer; |
31 class GrVkRenderPass; | 40 class GrVkRenderPass; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 VkMemoryBarrier* barrier) const; | 113 VkMemoryBarrier* barrier) const; |
105 void addBufferMemoryBarrier(VkPipelineStageFlags srcStageMask, | 114 void addBufferMemoryBarrier(VkPipelineStageFlags srcStageMask, |
106 VkPipelineStageFlags dstStageMask, | 115 VkPipelineStageFlags dstStageMask, |
107 bool byRegion, | 116 bool byRegion, |
108 VkBufferMemoryBarrier* barrier) const; | 117 VkBufferMemoryBarrier* barrier) const; |
109 void addImageMemoryBarrier(VkPipelineStageFlags srcStageMask, | 118 void addImageMemoryBarrier(VkPipelineStageFlags srcStageMask, |
110 VkPipelineStageFlags dstStageMask, | 119 VkPipelineStageFlags dstStageMask, |
111 bool byRegion, | 120 bool byRegion, |
112 VkImageMemoryBarrier* barrier) const; | 121 VkImageMemoryBarrier* barrier) const; |
113 | 122 |
| 123 #if USE_SKSL |
| 124 SkSL::Compiler* shaderCompiler() const { |
| 125 return fCompiler; |
| 126 } |
| 127 #else |
114 shaderc_compiler_t shadercCompiler() const { | 128 shaderc_compiler_t shadercCompiler() const { |
115 return fCompiler; | 129 return fCompiler; |
116 } | 130 } |
| 131 #endif |
117 | 132 |
118 void submitSecondaryCommandBuffer(const GrVkSecondaryCommandBuffer*, | 133 void submitSecondaryCommandBuffer(const GrVkSecondaryCommandBuffer*, |
119 const GrVkRenderPass*, | 134 const GrVkRenderPass*, |
120 const VkClearValue*, | 135 const VkClearValue*, |
121 GrVkRenderTarget*, | 136 GrVkRenderTarget*, |
122 const SkIRect& bounds); | 137 const SkIRect& bounds); |
123 | 138 |
124 void finishDrawTarget() override; | 139 void finishDrawTarget() override; |
125 | 140 |
126 void generateMipmap(GrVkTexture* tex) const; | 141 void generateMipmap(GrVkTexture* tex) const; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 GrVkPrimaryCommandBuffer* fCurrentCmdBuffer; | 248 GrVkPrimaryCommandBuffer* fCurrentCmdBuffer; |
234 VkPhysicalDeviceMemoryProperties fPhysDevMemProps; | 249 VkPhysicalDeviceMemoryProperties fPhysDevMemProps; |
235 | 250 |
236 SkAutoTDelete<GrVkHeap> fHeaps[kHeapCount]; | 251 SkAutoTDelete<GrVkHeap> fHeaps[kHeapCount]; |
237 | 252 |
238 #ifdef ENABLE_VK_LAYERS | 253 #ifdef ENABLE_VK_LAYERS |
239 // For reporting validation layer errors | 254 // For reporting validation layer errors |
240 VkDebugReportCallbackEXT fCallback; | 255 VkDebugReportCallbackEXT fCallback; |
241 #endif | 256 #endif |
242 | 257 |
| 258 #if USE_SKSL |
| 259 SkSL::Compiler* fCompiler; |
| 260 #else |
243 // Shaderc compiler used for compiling glsl in spirv. We only want to create
the compiler once | 261 // Shaderc compiler used for compiling glsl in spirv. We only want to create
the compiler once |
244 // since there is significant overhead to the first compile of any compiler. | 262 // since there is significant overhead to the first compile of any compiler. |
245 shaderc_compiler_t fCompiler; | 263 shaderc_compiler_t fCompiler; |
246 | 264 #endif |
247 | 265 |
248 typedef GrGpu INHERITED; | 266 typedef GrGpu INHERITED; |
249 }; | 267 }; |
250 | 268 |
251 #endif | 269 #endif |
OLD | NEW |