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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 GrVkPrimaryCommandBuffer* fCurrentCmdBuffer; | 250 GrVkPrimaryCommandBuffer* fCurrentCmdBuffer; |
236 VkPhysicalDeviceMemoryProperties fPhysDevMemProps; | 251 VkPhysicalDeviceMemoryProperties fPhysDevMemProps; |
237 | 252 |
238 SkAutoTDelete<GrVkHeap> fHeaps[kHeapCount]; | 253 SkAutoTDelete<GrVkHeap> fHeaps[kHeapCount]; |
239 | 254 |
240 #ifdef ENABLE_VK_LAYERS | 255 #ifdef ENABLE_VK_LAYERS |
241 // For reporting validation layer errors | 256 // For reporting validation layer errors |
242 VkDebugReportCallbackEXT fCallback; | 257 VkDebugReportCallbackEXT fCallback; |
243 #endif | 258 #endif |
244 | 259 |
| 260 #if USE_SKSL |
| 261 SkSL::Compiler* fCompiler; |
| 262 #else |
245 // Shaderc compiler used for compiling glsl in spirv. We only want to create
the compiler once | 263 // Shaderc compiler used for compiling glsl in spirv. We only want to create
the compiler once |
246 // since there is significant overhead to the first compile of any compiler. | 264 // since there is significant overhead to the first compile of any compiler. |
247 shaderc_compiler_t fCompiler; | 265 shaderc_compiler_t fCompiler; |
248 | 266 #endif |
249 | 267 |
250 typedef GrGpu INHERITED; | 268 typedef GrGpu INHERITED; |
251 }; | 269 }; |
252 | 270 |
253 #endif | 271 #endif |
OLD | NEW |