Reland "Cleanup program building a bit"
This reverts commit 77fdf66946d2a498945394fe0b7cb06e3895aa5f.
Reason for revert: Skia-Dawn breakage should not be a tree closer.
Original change's description:
> Revert "Cleanup program building a bit"
>
> This reverts commit 4777e3addec478786dcbb68035c5e11c82479b9f.
>
> Reason for revert: This CL is breaking the build on Linux FYI SkiaRenderer Dawn Release
>
> Original change's description:
> > Cleanup program building a bit
> >
> > This CL:
> > now passes the GrProgramDesc as a const&
> > returns GrGLProgram as an sk_sp
> > makes the parameter ordering more consistent
> > makes GrVkPipelineState no longer ref-counted
> >
> > This is pulled out of the DDL pre-compile CL which touches this portion of the code.
> >
> > Bug: skia:9455
> > Change-Id: Id4d06f93450e276de5a2662be330ae9523026244
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268777
> > Reviewed-by: Greg Daniel <egdaniel@google.com>
> > Commit-Queue: Robert Phillips <robertphillips@google.com>
>
> TBR=egdaniel@google.com,robertphillips@google.com
>
> # Not skipping CQ checks because original CL landed > 1 day ago.
>
> Bug: skia:9455
> Change-Id: I7019d9876b68576274e87c3b2e6bbbf9695522ba
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269261
> Reviewed-by: Austin Eng <enga@google.com>
> Reviewed-by: Kenneth Russell <kbr@google.com>
> Reviewed-by: Stephen White <senorblanco@chromium.org>
> Commit-Queue: Stephen White <senorblanco@chromium.org>
> Auto-Submit: Austin Eng <enga@google.com>
TBR=egdaniel@google.com,robertphillips@google.com,senorblanco@chromium.org,kbr@google.com,enga@google.com
Change-Id: I62f6d38a8ac351e411f4605425caec3b4783fd70
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9455
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269358
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
diff --git a/src/gpu/vk/GrVkPipelineStateBuilder.cpp b/src/gpu/vk/GrVkPipelineStateBuilder.cpp
index 41dca29..aee60b8 100644
--- a/src/gpu/vk/GrVkPipelineStateBuilder.cpp
+++ b/src/gpu/vk/GrVkPipelineStateBuilder.cpp
@@ -23,28 +23,28 @@
GrVkPipelineState* GrVkPipelineStateBuilder::CreatePipelineState(
GrVkGpu* gpu,
GrRenderTarget* renderTarget,
+ const GrProgramDesc& desc,
const GrProgramInfo& programInfo,
- GrProgramDesc* desc,
VkRenderPass compatibleRenderPass) {
// ensure that we use "." as a decimal separator when creating SkSL code
GrAutoLocaleSetter als("C");
// create a builder. This will be handed off to effects so they can use it to add
// uniforms, varyings, textures, etc
- GrVkPipelineStateBuilder builder(gpu, renderTarget, programInfo, desc);
+ GrVkPipelineStateBuilder builder(gpu, renderTarget, desc, programInfo);
if (!builder.emitAndInstallProcs()) {
return nullptr;
}
- return builder.finalize(compatibleRenderPass, desc);
+ return builder.finalize(desc, compatibleRenderPass);
}
GrVkPipelineStateBuilder::GrVkPipelineStateBuilder(GrVkGpu* gpu,
GrRenderTarget* renderTarget,
- const GrProgramInfo& programInfo,
- GrProgramDesc* desc)
- : INHERITED(renderTarget, programInfo, desc)
+ const GrProgramDesc& desc,
+ const GrProgramInfo& programInfo)
+ : INHERITED(renderTarget, desc, programInfo)
, fGpu(gpu)
, fVaryingHandler(this)
, fUniformHandler(this) {}
@@ -66,7 +66,6 @@
VkShaderModule* shaderModule,
VkPipelineShaderStageCreateInfo* stageInfo,
const SkSL::Program::Settings& settings,
- GrProgramDesc* desc,
SkSL::String* outSPIRV,
SkSL::Program::Inputs* outInputs) {
if (!GrCompileVkShaderModule(fGpu, sksl, stage, shaderModule,
@@ -140,8 +139,8 @@
// program, and that only depends on the base GrProgramDesc data.
// The +4 is to include the kShader_PersistentCacheKeyType code the Vulkan backend adds
// to the key right after the base key.
- sk_sp<SkData> key = SkData::MakeWithoutCopy(this->desc()->asKey(),
- this->desc()->initialKeyLength()+4);
+ sk_sp<SkData> key = SkData::MakeWithoutCopy(this->desc().asKey(),
+ this->desc().initialKeyLength()+4);
sk_sp<SkData> data = GrPersistentCacheUtils::PackCachedShaders(isSkSL ? kSKSL_Tag : kSPIRV_Tag,
shaders,
@@ -149,8 +148,8 @@
this->gpu()->getContext()->priv().getPersistentCache()->store(*key, *data);
}
-GrVkPipelineState* GrVkPipelineStateBuilder::finalize(VkRenderPass compatibleRenderPass,
- GrProgramDesc* desc) {
+GrVkPipelineState* GrVkPipelineStateBuilder::finalize(const GrProgramDesc& desc,
+ VkRenderPass compatibleRenderPass) {
VkDescriptorSetLayout dsLayout[2];
VkPipelineLayout pipelineLayout;
VkShaderModule shaderModules[kGrShaderTypeCount] = { VK_NULL_HANDLE,
@@ -214,7 +213,7 @@
// program, and that only depends on the base GrProgramDesc data.
// The +4 is to include the kShader_PersistentCacheKeyType code the Vulkan backend adds
// to the key right after the base key.
- sk_sp<SkData> key = SkData::MakeWithoutCopy(desc->asKey(), desc->initialKeyLength()+4);
+ sk_sp<SkData> key = SkData::MakeWithoutCopy(desc.asKey(), desc.initialKeyLength()+4);
cached = persistentCache->load(*key);
if (cached) {
reader.setMemory(cached->data(), cached->size());
@@ -249,7 +248,6 @@
&shaderModules[kVertex_GrShaderType],
&shaderStageInfo[0],
settings,
- desc,
&shaders[kVertex_GrShaderType],
&inputs[kVertex_GrShaderType]);
@@ -258,7 +256,6 @@
&shaderModules[kFragment_GrShaderType],
&shaderStageInfo[1],
settings,
- desc,
&shaders[kFragment_GrShaderType],
&inputs[kFragment_GrShaderType]);
@@ -268,7 +265,6 @@
&shaderModules[kGeometry_GrShaderType],
&shaderStageInfo[2],
settings,
- desc,
&shaders[kGeometry_GrShaderType],
&inputs[kGeometry_GrShaderType]);
++numShaderStages;