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 | 8 |
9 #ifndef GrVkPipelineState_DEFINED | 9 #ifndef GrVkPipelineState_DEFINED |
10 #define GrVkPipelineState_DEFINED | 10 #define GrVkPipelineState_DEFINED |
11 | 11 |
12 #include "GrStencilSettings.h" | 12 #include "GrStencilSettings.h" |
| 13 #include "GrVkDescriptorSetManager.h" |
13 #include "GrVkImage.h" | 14 #include "GrVkImage.h" |
14 #include "GrVkProgramDesc.h" | 15 #include "GrVkProgramDesc.h" |
15 #include "GrVkPipelineStateDataManager.h" | 16 #include "GrVkPipelineStateDataManager.h" |
16 #include "glsl/GrGLSLProgramBuilder.h" | 17 #include "glsl/GrGLSLProgramBuilder.h" |
17 | 18 |
18 #include "vk/GrVkDefines.h" | 19 #include "vk/GrVkDefines.h" |
19 | 20 |
20 class GrPipeline; | 21 class GrPipeline; |
21 class GrVkCommandBuffer; | 22 class GrVkCommandBuffer; |
22 class GrVkDescriptorPool; | 23 class GrVkDescriptorPool; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 const Desc& getDesc() { return fDesc; } | 145 const Desc& getDesc() { return fDesc; } |
145 | 146 |
146 private: | 147 private: |
147 typedef GrVkPipelineStateDataManager::UniformInfoArray UniformInfoArray; | 148 typedef GrVkPipelineStateDataManager::UniformInfoArray UniformInfoArray; |
148 typedef GrGLSLProgramDataManager::UniformHandle UniformHandle; | 149 typedef GrGLSLProgramDataManager::UniformHandle UniformHandle; |
149 | 150 |
150 GrVkPipelineState(GrVkGpu* gpu, | 151 GrVkPipelineState(GrVkGpu* gpu, |
151 const GrVkPipelineState::Desc&, | 152 const GrVkPipelineState::Desc&, |
152 GrVkPipeline* pipeline, | 153 GrVkPipeline* pipeline, |
153 VkPipelineLayout layout, | 154 VkPipelineLayout layout, |
154 VkDescriptorSetLayout dsSamplerLayout, | 155 const GrVkDescriptorSetManager::Handle& samplerDSHandle, |
155 const BuiltinUniformHandles& builtinUniformHandles, | 156 const BuiltinUniformHandles& builtinUniformHandles, |
156 const UniformInfoArray& uniforms, | 157 const UniformInfoArray& uniforms, |
157 uint32_t vertexUniformSize, | 158 uint32_t vertexUniformSize, |
158 uint32_t fragmentUniformSize, | 159 uint32_t fragmentUniformSize, |
159 uint32_t numSamplers, | 160 uint32_t numSamplers, |
160 GrGLSLPrimitiveProcessor* geometryProcessor, | 161 GrGLSLPrimitiveProcessor* geometryProcessor, |
161 GrGLSLXferProcessor* xferProcessor, | 162 GrGLSLXferProcessor* xferProcessor, |
162 const GrGLSLFragProcs& fragmentProcessors); | 163 const GrGLSLFragProcs& fragmentProcessors); |
163 | 164 |
164 // Each pool will manage one type of descriptor. Thus each descriptor set we
use will all be of | 165 // Each pool will manage one type of descriptor. Thus each descriptor set we
use will all be of |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 // The DescriptorSets need to survive until the gpu has finished all draws t
hat use them. | 254 // The DescriptorSets need to survive until the gpu has finished all draws t
hat use them. |
254 // However, they will only be freed by the descriptor pool. Thus by simply k
eeping the | 255 // However, they will only be freed by the descriptor pool. Thus by simply k
eeping the |
255 // descriptor pool alive through the draw, the descritor sets will also stay
alive. Thus we do | 256 // descriptor pool alive through the draw, the descritor sets will also stay
alive. Thus we do |
256 // not need a GrVkResource versions of VkDescriptorSet. We hold on to these
in the | 257 // not need a GrVkResource versions of VkDescriptorSet. We hold on to these
in the |
257 // GrVkPipelineState since we update the descriptor sets and bind them at se
parate times; | 258 // GrVkPipelineState since we update the descriptor sets and bind them at se
parate times; |
258 VkDescriptorSet fDescriptorSets[2]; | 259 VkDescriptorSet fDescriptorSets[2]; |
259 | 260 |
260 // Once we move samplers over to use the resource provider for descriptor se
ts we will not need | 261 // Once we move samplers over to use the resource provider for descriptor se
ts we will not need |
261 // the above array and instead just use GrVkDescriptorSet like the uniform o
ne here. | 262 // the above array and instead just use GrVkDescriptorSet like the uniform o
ne here. |
262 const GrVkDescriptorSet* fUniformDescriptorSet; | 263 const GrVkDescriptorSet* fUniformDescriptorSet; |
| 264 const GrVkDescriptorSet* fSamplerDescriptorSet; |
| 265 |
| 266 const GrVkDescriptorSetManager::Handle fSamplerDSHandle; |
263 | 267 |
264 // Meta data so we know which descriptor sets we are using and need to bind. | 268 // Meta data so we know which descriptor sets we are using and need to bind. |
265 int fStartDS; | 269 int fStartDS; |
266 int fDSCount; | 270 int fDSCount; |
267 | 271 |
268 SkAutoTDelete<GrVkUniformBuffer> fVertexUniformBuffer; | 272 SkAutoTDelete<GrVkUniformBuffer> fVertexUniformBuffer; |
269 SkAutoTDelete<GrVkUniformBuffer> fFragmentUniformBuffer; | 273 SkAutoTDelete<GrVkUniformBuffer> fFragmentUniformBuffer; |
270 | 274 |
271 // GrVkResources used for sampling textures | 275 // GrVkResources used for sampling textures |
272 SkTDArray<GrVkSampler*> fSamplers; | 276 SkTDArray<GrVkSampler*> fSamplers; |
273 SkTDArray<const GrVkImageView*> fTextureViews; | 277 SkTDArray<const GrVkImageView*> fTextureViews; |
274 SkTDArray<const GrVkResource*> fTextures; | 278 SkTDArray<const GrVkResource*> fTextures; |
275 | 279 |
276 // Tracks the current render target uniforms stored in the vertex buffer. | 280 // Tracks the current render target uniforms stored in the vertex buffer. |
277 RenderTargetState fRenderTargetState; | 281 RenderTargetState fRenderTargetState; |
278 BuiltinUniformHandles fBuiltinUniformHandles; | 282 BuiltinUniformHandles fBuiltinUniformHandles; |
279 | 283 |
280 // Processors in the GrVkPipelineState | 284 // Processors in the GrVkPipelineState |
281 SkAutoTDelete<GrGLSLPrimitiveProcessor> fGeometryProcessor; | 285 SkAutoTDelete<GrGLSLPrimitiveProcessor> fGeometryProcessor; |
282 SkAutoTDelete<GrGLSLXferProcessor> fXferProcessor; | 286 SkAutoTDelete<GrGLSLXferProcessor> fXferProcessor; |
283 GrGLSLFragProcs fFragmentProcessors; | 287 GrGLSLFragProcs fFragmentProcessors; |
284 | 288 |
285 Desc fDesc; | 289 Desc fDesc; |
286 | 290 |
287 GrVkPipelineStateDataManager fDataManager; | 291 GrVkPipelineStateDataManager fDataManager; |
288 | 292 |
289 DescriptorPoolManager fSamplerPoolManager; | |
290 | |
291 int fNumSamplers; | 293 int fNumSamplers; |
292 | 294 |
293 friend class GrVkPipelineStateBuilder; | 295 friend class GrVkPipelineStateBuilder; |
294 }; | 296 }; |
295 | 297 |
296 #endif | 298 #endif |
OLD | NEW |