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 "GrVkDescriptorSetManager.h" |
14 #include "GrVkImage.h" | 14 #include "GrVkImage.h" |
15 #include "GrVkProgramDesc.h" | |
16 #include "GrVkPipelineStateDataManager.h" | 15 #include "GrVkPipelineStateDataManager.h" |
17 #include "glsl/GrGLSLProgramBuilder.h" | 16 #include "glsl/GrGLSLProgramBuilder.h" |
| 17 #include "glsl/GrGLSLProgramDesc.h" |
18 | 18 |
19 #include "vk/GrVkDefines.h" | 19 #include "vk/GrVkDefines.h" |
20 | 20 |
21 class GrPipeline; | 21 class GrPipeline; |
22 class GrVkCommandBuffer; | 22 class GrVkCommandBuffer; |
23 class GrVkDescriptorPool; | 23 class GrVkDescriptorPool; |
24 class GrVkDescriptorSet; | 24 class GrVkDescriptorSet; |
25 class GrVkGpu; | 25 class GrVkGpu; |
26 class GrVkImageView; | 26 class GrVkImageView; |
27 class GrVkPipeline; | 27 class GrVkPipeline; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // Part 2. | 65 // Part 2. |
66 kData_StateKeyOffset = kLength_StateKeyOffset + sizeof(uint32_t), | 66 kData_StateKeyOffset = kLength_StateKeyOffset + sizeof(uint32_t), |
67 }; | 67 }; |
68 static void BuildStateKey(const GrPipeline&, GrPrimitiveType primitiveType, | 68 static void BuildStateKey(const GrPipeline&, GrPrimitiveType primitiveType, |
69 SkTArray<unsigned char, true>* key); | 69 SkTArray<unsigned char, true>* key); |
70 | 70 |
71 /** | 71 /** |
72 * For Vulkan we want to cache the entire VkPipeline for reuse of draws. The
Desc here holds all | 72 * For Vulkan we want to cache the entire VkPipeline for reuse of draws. The
Desc here holds all |
73 * the information needed to differentiate one pipeline from another. | 73 * the information needed to differentiate one pipeline from another. |
74 * | 74 * |
75 * The GrVkProgramDesc contains all the information need to create the actua
l shaders for the | 75 * The GrGLSLProgramDesc contains all the information need to create the act
ual shaders for the |
76 * pipeline. | 76 * pipeline. |
77 * | 77 * |
78 * The fStateKey is used to store all the inputs for the rest of the state s
tored on the | 78 * The fStateKey is used to store all the inputs for the rest of the state s
tored on the |
79 * pipeline. This includes stencil settings, blending information, render pa
ss format, draw face | 79 * pipeline. This includes stencil settings, blending information, render pa
ss format, draw face |
80 * information, and primitive type. Note that some state is set dynamically
on the pipeline for | 80 * information, and primitive type. Note that some state is set dynamically
on the pipeline for |
81 * each draw and thus is not included in this descriptor. This includes the
viewport, scissor, | 81 * each draw and thus is not included in this descriptor. This includes the
viewport, scissor, |
82 * and blend constant. | 82 * and blend constant. |
83 * | 83 * |
84 * A checksum which includes the fProgramDesc and fStateKey is included at t
he top of the Desc | 84 * A checksum which includes the fProgramDesc and fStateKey is included at t
he top of the Desc |
85 * for caching purposes and faster equality checks. | 85 * for caching purposes and faster equality checks. |
86 */ | 86 */ |
87 struct Desc { | 87 struct Desc { |
88 uint32_t fChecksum; | 88 uint32_t fChecksum; |
89 GrVkProgramDesc fProgramDesc; | 89 GrGLSLProgramDesc fProgramDesc; |
90 | 90 |
91 enum { | 91 enum { |
92 kRenderPassKeyAlloc = 12, // This is typical color attachment with n
o stencil or msaa | 92 kRenderPassKeyAlloc = 12, // This is typical color attachment with n
o stencil or msaa |
93 kStencilKeyAlloc = sizeof(GrStencilSettings), | 93 kStencilKeyAlloc = sizeof(GrStencilSettings), |
94 kDrawFaceKeyAlloc = 4, | 94 kDrawFaceKeyAlloc = 4, |
95 kBlendingKeyAlloc = 4, | 95 kBlendingKeyAlloc = 4, |
96 kPrimitiveTypeKeyAlloc = 4, | 96 kPrimitiveTypeKeyAlloc = 4, |
97 kPreAllocSize = kData_StateKeyOffset + kRenderPassKeyAlloc + kStenci
lKeyAlloc + | 97 kPreAllocSize = kData_StateKeyOffset + kRenderPassKeyAlloc + kStenci
lKeyAlloc + |
98 kDrawFaceKeyAlloc + kBlendingKeyAlloc + kPrimitiveTy
peKeyAlloc, | 98 kDrawFaceKeyAlloc + kBlendingKeyAlloc + kPrimitiveTy
peKeyAlloc, |
99 }; | 99 }; |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 Desc fDesc; | 289 Desc fDesc; |
290 | 290 |
291 GrVkPipelineStateDataManager fDataManager; | 291 GrVkPipelineStateDataManager fDataManager; |
292 | 292 |
293 int fNumSamplers; | 293 int fNumSamplers; |
294 | 294 |
295 friend class GrVkPipelineStateBuilder; | 295 friend class GrVkPipelineStateBuilder; |
296 }; | 296 }; |
297 | 297 |
298 #endif | 298 #endif |
OLD | NEW |