Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: src/gpu/vk/GrVkPipelineStateBuilder.cpp

Issue 2468653002: Remove GrStencilSettings from GrPipeline (Closed)
Patch Set: Remove GrStencilSettings from GrPipeline Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/vk/GrVkPipelineStateBuilder.h ('k') | src/gpu/vk/GrVkPipelineStateCache.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "vk/GrVkPipelineStateBuilder.h" 8 #include "vk/GrVkPipelineStateBuilder.h"
9 9
10 #include "vk/GrVkDescriptorSetManager.h" 10 #include "vk/GrVkDescriptorSetManager.h"
11 #include "vk/GrVkGpu.h" 11 #include "vk/GrVkGpu.h"
12 #include "vk/GrVkRenderPass.h" 12 #include "vk/GrVkRenderPass.h"
13 13
14 GrVkPipelineState* GrVkPipelineStateBuilder::CreatePipelineState( 14 GrVkPipelineState* GrVkPipelineStateBuilder::CreatePipelineState(
15 GrVkGpu* gpu, 15 GrVkGpu* gpu,
16 const GrPipeline& pipeline, 16 const GrPipeline& pipeline,
17 const GrStencilSe ttings& stencil,
17 const GrPrimitive Processor& primProc, 18 const GrPrimitive Processor& primProc,
18 GrPrimitiveType p rimitiveType, 19 GrPrimitiveType p rimitiveType,
19 const GrVkPipelin eState::Desc& desc, 20 const GrVkPipelin eState::Desc& desc,
20 const GrVkRenderP ass& renderPass) { 21 const GrVkRenderP ass& renderPass) {
21 // create a builder. This will be handed off to effects so they can use it to add 22 // create a builder. This will be handed off to effects so they can use it to add
22 // uniforms, varyings, textures, etc 23 // uniforms, varyings, textures, etc
23 GrVkPipelineStateBuilder builder(gpu, pipeline, primProc, desc); 24 GrVkPipelineStateBuilder builder(gpu, pipeline, primProc, desc);
24 25
25 GrGLSLExpr4 inputColor; 26 GrGLSLExpr4 inputColor;
26 GrGLSLExpr4 inputCoverage; 27 GrGLSLExpr4 inputCoverage;
27 28
28 if (!builder.emitAndInstallProcs(&inputColor, &inputCoverage)) { 29 if (!builder.emitAndInstallProcs(&inputColor, &inputCoverage)) {
29 builder.cleanupFragmentProcessors(); 30 builder.cleanupFragmentProcessors();
30 return nullptr; 31 return nullptr;
31 } 32 }
32 33
33 return builder.finalize(primitiveType, renderPass, desc); 34 return builder.finalize(stencil, primitiveType, renderPass, desc);
34 } 35 }
35 36
36 GrVkPipelineStateBuilder::GrVkPipelineStateBuilder(GrVkGpu* gpu, 37 GrVkPipelineStateBuilder::GrVkPipelineStateBuilder(GrVkGpu* gpu,
37 const GrPipeline& pipeline, 38 const GrPipeline& pipeline,
38 const GrPrimitiveProcessor& p rimProc, 39 const GrPrimitiveProcessor& p rimProc,
39 const GrProgramDesc& desc) 40 const GrProgramDesc& desc)
40 : INHERITED(pipeline, primProc, desc) 41 : INHERITED(pipeline, primProc, desc)
41 , fGpu(gpu) 42 , fGpu(gpu)
42 , fVaryingHandler(this) 43 , fVaryingHandler(this)
43 , fUniformHandler(this) { 44 , fUniformHandler(this) {
(...skipping 22 matching lines...) Expand all
66 SkString shaderString; 67 SkString shaderString;
67 for (int i = 0; i < builder.fCompilerStrings.count(); ++i) { 68 for (int i = 0; i < builder.fCompilerStrings.count(); ++i) {
68 if (builder.fCompilerStrings[i]) { 69 if (builder.fCompilerStrings[i]) {
69 shaderString.append(builder.fCompilerStrings[i]); 70 shaderString.append(builder.fCompilerStrings[i]);
70 shaderString.append("\n"); 71 shaderString.append("\n");
71 } 72 }
72 } 73 }
73 return GrCompileVkShaderModule(gpu, shaderString.c_str(), stage, shaderModul e, stageInfo); 74 return GrCompileVkShaderModule(gpu, shaderString.c_str(), stage, shaderModul e, stageInfo);
74 } 75 }
75 76
76 GrVkPipelineState* GrVkPipelineStateBuilder::finalize(GrPrimitiveType primitiveT ype, 77 GrVkPipelineState* GrVkPipelineStateBuilder::finalize(const GrStencilSettings& s tencil,
78 GrPrimitiveType primitiveT ype,
77 const GrVkRenderPass& rend erPass, 79 const GrVkRenderPass& rend erPass,
78 const GrVkPipelineState::D esc& desc) { 80 const GrVkPipelineState::D esc& desc) {
79 VkDescriptorSetLayout dsLayout[2]; 81 VkDescriptorSetLayout dsLayout[2];
80 VkPipelineLayout pipelineLayout; 82 VkPipelineLayout pipelineLayout;
81 VkShaderModule vertShaderModule; 83 VkShaderModule vertShaderModule;
82 VkShaderModule fragShaderModule; 84 VkShaderModule fragShaderModule;
83 85
84 GrVkResourceProvider& resourceProvider = fGpu->resourceProvider(); 86 GrVkResourceProvider& resourceProvider = fGpu->resourceProvider();
85 // This layout is not owned by the PipelineStateBuilder and thus should no b e destroyed 87 // This layout is not owned by the PipelineStateBuilder and thus should no b e destroyed
86 dsLayout[GrVkUniformHandler::kUniformBufferDescSet] = resourceProvider.getUn iformDSLayout(); 88 dsLayout[GrVkUniformHandler::kUniformBufferDescSet] = resourceProvider.getUn iformDSLayout();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 &vertShaderModule, 124 &vertShaderModule,
123 &shaderStageInfo[0])); 125 &shaderStageInfo[0]));
124 126
125 SkAssertResult(CreateVkShaderModule(fGpu, 127 SkAssertResult(CreateVkShaderModule(fGpu,
126 VK_SHADER_STAGE_FRAGMENT_BIT, 128 VK_SHADER_STAGE_FRAGMENT_BIT,
127 fFS, 129 fFS,
128 &fragShaderModule, 130 &fragShaderModule,
129 &shaderStageInfo[1])); 131 &shaderStageInfo[1]));
130 132
131 GrVkPipeline* pipeline = resourceProvider.createPipeline(fPipeline, 133 GrVkPipeline* pipeline = resourceProvider.createPipeline(fPipeline,
134 stencil,
132 fPrimProc, 135 fPrimProc,
133 shaderStageInfo, 136 shaderStageInfo,
134 2, 137 2,
135 primitiveType, 138 primitiveType,
136 renderPass, 139 renderPass,
137 pipelineLayout); 140 pipelineLayout);
138 GR_VK_CALL(fGpu->vkInterface(), DestroyShaderModule(fGpu->device(), vertShad erModule, 141 GR_VK_CALL(fGpu->vkInterface(), DestroyShaderModule(fGpu->device(), vertShad erModule,
139 nullptr)); 142 nullptr));
140 GR_VK_CALL(fGpu->vkInterface(), DestroyShaderModule(fGpu->device(), fragShad erModule, 143 GR_VK_CALL(fGpu->vkInterface(), DestroyShaderModule(fGpu->device(), fragShad erModule,
141 nullptr)); 144 nullptr));
(...skipping 18 matching lines...) Expand all
160 fUniformHandles, 163 fUniformHandles,
161 fUniformHandler.fUniforms, 164 fUniformHandler.fUniforms,
162 fUniformHandler.fCurrentVertexUBOOffset, 165 fUniformHandler.fCurrentVertexUBOOffset,
163 fUniformHandler.fCurrentFragmentUBOOffset, 166 fUniformHandler.fCurrentFragmentUBOOffset,
164 (uint32_t)fUniformHandler.numSamplers(), 167 (uint32_t)fUniformHandler.numSamplers(),
165 fGeometryProcessor, 168 fGeometryProcessor,
166 fXferProcessor, 169 fXferProcessor,
167 fFragmentProcessors); 170 fFragmentProcessors);
168 } 171 }
169 172
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkPipelineStateBuilder.h ('k') | src/gpu/vk/GrVkPipelineStateCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698