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 0 | |
djsollen
2016/06/10 14:07:25
shouldn't this be 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 "GrVkResourceProvider.h" | 18 #include "GrVkResourceProvider.h" |
17 #include "GrVkVertexBuffer.h" | 19 #include "GrVkVertexBuffer.h" |
18 #include "GrVkUtil.h" | 20 #include "GrVkUtil.h" |
19 | 21 |
22 #if USE_SKSL | |
23 namespace SkSL { | |
24 class Compiler; | |
25 } | |
26 #else | |
20 #include "shaderc/shaderc.h" | 27 #include "shaderc/shaderc.h" |
28 #endif | |
29 | |
21 #include "vk/GrVkDefines.h" | 30 #include "vk/GrVkDefines.h" |
22 | 31 |
23 class GrPipeline; | 32 class GrPipeline; |
24 class GrNonInstancedMesh; | 33 class GrNonInstancedMesh; |
25 | 34 |
26 class GrVkBufferImpl; | 35 class GrVkBufferImpl; |
27 class GrVkCommandBuffer; | 36 class GrVkCommandBuffer; |
28 class GrVkPipeline; | 37 class GrVkPipeline; |
29 class GrVkPipelineState; | 38 class GrVkPipelineState; |
30 class GrVkRenderPass; | 39 class GrVkRenderPass; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
98 VkMemoryBarrier* barrier) const; | 107 VkMemoryBarrier* barrier) const; |
99 void addBufferMemoryBarrier(VkPipelineStageFlags srcStageMask, | 108 void addBufferMemoryBarrier(VkPipelineStageFlags srcStageMask, |
100 VkPipelineStageFlags dstStageMask, | 109 VkPipelineStageFlags dstStageMask, |
101 bool byRegion, | 110 bool byRegion, |
102 VkBufferMemoryBarrier* barrier) const; | 111 VkBufferMemoryBarrier* barrier) const; |
103 void addImageMemoryBarrier(VkPipelineStageFlags srcStageMask, | 112 void addImageMemoryBarrier(VkPipelineStageFlags srcStageMask, |
104 VkPipelineStageFlags dstStageMask, | 113 VkPipelineStageFlags dstStageMask, |
105 bool byRegion, | 114 bool byRegion, |
106 VkImageMemoryBarrier* barrier) const; | 115 VkImageMemoryBarrier* barrier) const; |
107 | 116 |
117 #if USE_SKSL | |
118 SkSL::Compiler* shaderCompiler() const { | |
119 return fCompiler; | |
120 } | |
121 #else | |
108 shaderc_compiler_t shadercCompiler() const { | 122 shaderc_compiler_t shadercCompiler() const { |
109 return fCompiler; | 123 return fCompiler; |
110 } | 124 } |
125 #endif | |
111 | 126 |
112 void finishDrawTarget() override; | 127 void finishDrawTarget() override; |
113 | 128 |
114 void generateMipmap(GrVkTexture* tex) const; | 129 void generateMipmap(GrVkTexture* tex) const; |
115 | 130 |
116 private: | 131 private: |
117 GrVkGpu(GrContext* context, const GrContextOptions& options, | 132 GrVkGpu(GrContext* context, const GrContextOptions& options, |
118 const GrVkBackendContext* backendContext); | 133 const GrVkBackendContext* backendContext); |
119 | 134 |
120 void onResetContext(uint32_t resetBits) override {} | 135 void onResetContext(uint32_t resetBits) override {} |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
215 GrVkResourceProvider fResourceProvider; | 230 GrVkResourceProvider fResourceProvider; |
216 VkCommandPool fCmdPool; | 231 VkCommandPool fCmdPool; |
217 GrVkCommandBuffer* fCurrentCmdBuffer; | 232 GrVkCommandBuffer* fCurrentCmdBuffer; |
218 VkPhysicalDeviceMemoryProperties fPhysDevMemProps; | 233 VkPhysicalDeviceMemoryProperties fPhysDevMemProps; |
219 | 234 |
220 #ifdef ENABLE_VK_LAYERS | 235 #ifdef ENABLE_VK_LAYERS |
221 // For reporting validation layer errors | 236 // For reporting validation layer errors |
222 VkDebugReportCallbackEXT fCallback; | 237 VkDebugReportCallbackEXT fCallback; |
223 #endif | 238 #endif |
224 | 239 |
240 #if USE_SKSL | |
241 SkSL::Compiler* fCompiler; | |
242 #else | |
225 // Shaderc compiler used for compiling glsl in spirv. We only want to create the compiler once | 243 // Shaderc compiler used for compiling glsl in spirv. We only want to create the compiler once |
226 // since there is significant overhead to the first compile of any compiler. | 244 // since there is significant overhead to the first compile of any compiler. |
227 shaderc_compiler_t fCompiler; | 245 shaderc_compiler_t fCompiler; |
228 | 246 #endif |
229 | 247 |
230 typedef GrGpu INHERITED; | 248 typedef GrGpu INHERITED; |
231 }; | 249 }; |
232 | 250 |
233 #endif | 251 #endif |
OLD | NEW |