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

Unified Diff: src/gpu/vk/GrVkPipelineStateBuilder.cpp

Issue 1816153002: Set up cache in vulkan to reuse GrVkPrograms (aka VkPipelines) (Closed) Base URL: https://skia.googlesource.com/skia.git@progSamplers
Patch Set: rebase Created 4 years, 9 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/vk/GrVkPipelineStateBuilder.h ('k') | src/gpu/vk/GrVkPipelineStateCache.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/vk/GrVkPipelineStateBuilder.cpp
diff --git a/src/gpu/vk/GrVkProgramBuilder.cpp b/src/gpu/vk/GrVkPipelineStateBuilder.cpp
similarity index 80%
rename from src/gpu/vk/GrVkProgramBuilder.cpp
rename to src/gpu/vk/GrVkPipelineStateBuilder.cpp
index 9dbbbb848c89f5f19ab52a936f74f2a02ad7c1ec..3b077f0125c19307cd436a9679268f1a9d0e6337 100644
--- a/src/gpu/vk/GrVkProgramBuilder.cpp
+++ b/src/gpu/vk/GrVkPipelineStateBuilder.cpp
@@ -5,21 +5,21 @@
* found in the LICENSE file.
*/
-#include "vk/GrVkProgramBuilder.h"
+#include "vk/GrVkPipelineStateBuilder.h"
#include "vk/GrVkGpu.h"
#include "vk/GrVkRenderPass.h"
-#include "vk/GrVkProgram.h"
-
-GrVkProgram* GrVkProgramBuilder::CreateProgram(GrVkGpu* gpu,
- const GrPipeline& pipeline,
- const GrPrimitiveProcessor& primProc,
- GrPrimitiveType primitiveType,
- const GrVkProgramDesc& desc,
- const GrVkRenderPass& renderPass) {
+
+GrVkPipelineState* GrVkPipelineStateBuilder::CreatePipelineState(
+ GrVkGpu* gpu,
+ const GrPipeline& pipeline,
+ const GrPrimitiveProcessor& primProc,
+ GrPrimitiveType primitiveType,
+ const GrVkPipelineState::Desc& desc,
+ const GrVkRenderPass& renderPass) {
// create a builder. This will be handed off to effects so they can use it to add
// uniforms, varyings, textures, etc
- GrVkProgramBuilder builder(gpu, pipeline, primProc, desc);
+ GrVkPipelineStateBuilder builder(gpu, pipeline, primProc, desc.fProgramDesc);
GrGLSLExpr4 inputColor;
GrGLSLExpr4 inputCoverage;
@@ -29,27 +29,27 @@ GrVkProgram* GrVkProgramBuilder::CreateProgram(GrVkGpu* gpu,
return nullptr;
}
- return builder.finalize(primitiveType, renderPass);
+ return builder.finalize(primitiveType, renderPass, desc);
}
-GrVkProgramBuilder::GrVkProgramBuilder(GrVkGpu* gpu,
- const GrPipeline& pipeline,
- const GrPrimitiveProcessor& primProc,
- const GrVkProgramDesc& desc)
+GrVkPipelineStateBuilder::GrVkPipelineStateBuilder(GrVkGpu* gpu,
+ const GrPipeline& pipeline,
+ const GrPrimitiveProcessor& primProc,
+ const GrVkProgramDesc& desc)
: INHERITED(pipeline, primProc, desc)
, fGpu(gpu)
, fVaryingHandler(this)
, fUniformHandler(this) {
}
-const GrCaps* GrVkProgramBuilder::caps() const {
+const GrCaps* GrVkPipelineStateBuilder::caps() const {
return fGpu->caps();
}
-const GrGLSLCaps* GrVkProgramBuilder::glslCaps() const {
+const GrGLSLCaps* GrVkPipelineStateBuilder::glslCaps() const {
return fGpu->vkCaps().glslCaps();
}
-void GrVkProgramBuilder::finalizeFragmentOutputColor(GrGLSLShaderVar& outputColor) {
+void GrVkPipelineStateBuilder::finalizeFragmentOutputColor(GrGLSLShaderVar& outputColor) {
outputColor.setLayoutQualifier("location = 0");
}
@@ -76,11 +76,11 @@ shaderc_shader_kind vk_shader_stage_to_shaderc_kind(VkShaderStageFlagBits stage)
return shaderc_glsl_fragment_shader;
}
-bool GrVkProgramBuilder::CreateVkShaderModule(const GrVkGpu* gpu,
- VkShaderStageFlagBits stage,
- const GrGLSLShaderBuilder& builder,
- VkShaderModule* shaderModule,
- VkPipelineShaderStageCreateInfo* stageInfo) {
+bool GrVkPipelineStateBuilder::CreateVkShaderModule(const GrVkGpu* gpu,
+ VkShaderStageFlagBits stage,
+ const GrGLSLShaderBuilder& builder,
+ VkShaderModule* shaderModule,
+ VkPipelineShaderStageCreateInfo* stageInfo) {
SkString shaderString;
for (int i = 0; i < builder.fCompilerStrings.count(); ++i) {
if (builder.fCompilerStrings[i]) {
@@ -140,8 +140,9 @@ bool GrVkProgramBuilder::CreateVkShaderModule(const GrVkGpu* gpu,
return true;
}
-GrVkProgram* GrVkProgramBuilder::finalize(GrPrimitiveType primitiveType,
- const GrVkRenderPass& renderPass) {
+GrVkPipelineState* GrVkPipelineStateBuilder::finalize(GrPrimitiveType primitiveType,
+ const GrVkRenderPass& renderPass,
+ const GrVkPipelineState::Desc& desc) {
VkDescriptorSetLayout dsLayout[2];
VkPipelineLayout pipelineLayout;
VkShaderModule vertShaderModule;
@@ -272,16 +273,17 @@ GrVkProgram* GrVkProgramBuilder::finalize(GrPrimitiveType primitiveType,
return nullptr;
}
- return new GrVkProgram(fGpu,
- pipeline,
- pipelineLayout,
- dsLayout,
- fUniformHandles,
- fUniformHandler.fUniforms,
- fUniformHandler.fCurrentVertexUBOOffset,
- fUniformHandler.fCurrentFragmentUBOOffset,
- numSamplers,
- fGeometryProcessor,
- fXferProcessor,
- fFragmentProcessors);
+ return new GrVkPipelineState(fGpu,
+ desc,
+ pipeline,
+ pipelineLayout,
+ dsLayout,
+ fUniformHandles,
+ fUniformHandler.fUniforms,
+ fUniformHandler.fCurrentVertexUBOOffset,
+ fUniformHandler.fCurrentFragmentUBOOffset,
+ numSamplers,
+ fGeometryProcessor,
+ fXferProcessor,
+ fFragmentProcessors);
}
« 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