598 {
599
604
607
608 if (
step->vertexAttributes().size() +
step->instanceAttributes().size() >
610 SKGPU_LOG_W(
"Requested more than the supported number of vertex attributes");
611 return nullptr;
612 }
613
616 runtimeDict,
618 pipelineDesc.paintParamsID(),
619 useStorageBuffers,
620 renderPassDesc.fWriteSwizzle);
621 std::string& fsSkSL = fsSkSLInfo.fSkSL;
622 const bool localCoordsNeeded = fsSkSLInfo.fRequiresLocalCoords;
623
624 bool hasFragmentSkSL = !fsSkSL.empty();
625 std::string vsSPIRV, fsSPIRV;
627
628 if (hasFragmentSkSL) {
630 fsSkSL,
633 &fsSPIRV,
634 &fsInterface,
635 errorHandler)) {
636 return nullptr;
637 }
638
640 if (!fsModule) {
641 return nullptr;
642 }
643 }
644
647 useStorageBuffers,
648 localCoordsNeeded);
649 const std::string& vsSkSL = vsSkSLInfo.fSkSL;
651 vsSkSL,
654 &vsSPIRV,
655 &vsInterface,
656 errorHandler)) {
657 return nullptr;
658 }
659
661 if (!vsModule) {
662
664 return nullptr;
665 }
666
671 step->instanceAttributes(),
672 &vertexInputInfo,
673 &bindingDescs,
674 &attributeDescs);
675
678
681
684
687 &multisampleInfo);
688
689
693
695
697
700 vsModule,
701 &pipelineShaderStages[0]);
702 if (hasFragmentSkSL) {
704 fsModule,
705 &pipelineShaderStages[1]);
706 }
707
708
709
710
711
712
714 true,
715 !
step->uniforms().empty(),
716 fsSkSLInfo.fNumPaintUniforms,
717 fsSkSLInfo.fNumTexturesAndSamplers,
718 0);
721 return nullptr;
722 }
723
727
728 bool loadMsaaFromResolve = renderPassDesc.fColorResolveAttachment.fTextureInfo.isValid() &&
729 renderPassDesc.fColorResolveAttachment.fLoadOp ==
LoadOp::kLoad;
730
734 pipelineCreateInfo.
pNext =
nullptr;
735 pipelineCreateInfo.
flags = 0;
736 pipelineCreateInfo.
stageCount = hasFragmentSkSL ? 2 : 1;
737 pipelineCreateInfo.
pStages = &pipelineShaderStages[0];
747 pipelineCreateInfo.
layout = pipelineLayout;
748 pipelineCreateInfo.
renderPass = compatibleRenderPass->renderPass();
749 pipelineCreateInfo.
subpass = loadMsaaFromResolve ? 1 : 0;
752
753 VkPipeline vkPipeline;
755 {
760 pipelineCache,
761 1,
762 &pipelineCreateInfo,
763 nullptr,
764 &vkPipeline));
765 }
768 return nullptr;
769 }
770
771
773
774#if defined(GRAPHITE_TEST_UTILS)
775 GraphicsPipeline::PipelineInfo pipelineInfo = {pipelineDesc.renderStepID(),
776 pipelineDesc.paintParamsID(),
777 std::move(vsSkSL),
778 std::move(fsSkSL),
779 "SPIR-V disassembly not available",
780 "SPIR-V disassembly not available"};
781 GraphicsPipeline::PipelineInfo* pipelineInfoPtr = &pipelineInfo;
782#else
783 GraphicsPipeline::PipelineInfo* pipelineInfoPtr = nullptr;
784#endif
785
788 pipelineInfoPtr,
789 pipelineLayout,
790 vkPipeline,
791 fsSkSLInfo.fNumPaintUniforms > 0,
792 !
step->uniforms().empty(),
793 fsSkSLInfo.fNumTexturesAndSamplers,
794 true));
795}
static int step(int x, SkScalar min, SkScalar max)
#define SKGPU_LOG_W(fmt,...)
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
#define TRACE_EVENT0_ALWAYS(category_group, name)
#define VULKAN_CALL_RESULT(SHARED_CONTEXT, RESULT, X)
const ResourceBindingRequirements & resourceBindingRequirements() const
bool storageBufferPreferred() const
const RenderStep * lookup(uint32_t uniqueID) const
ShaderCodeDictionary * shaderCodeDictionary()
const RendererProvider * rendererProvider() const
static void setup_viewport_scissor_state(VkPipelineViewportStateCreateInfo *viewportInfo)
VertSkSLInfo BuildVertexSkSL(const ResourceBindingRequirements &bindingReqs, const RenderStep *step, bool useStorageBuffers, bool defineLocalCoordsVarying)
static void setup_depth_stencil_state(const DepthStencilSettings &stencilSettings, VkPipelineDepthStencilStateCreateInfo *stencilInfo)
static void setup_raster_state(bool isWireframe, VkPipelineRasterizationStateCreateInfo *rasterInfo)
static void setup_color_blend_state(const skgpu::BlendInfo &blendInfo, VkPipelineColorBlendStateCreateInfo *colorBlendInfo, VkPipelineColorBlendAttachmentState *attachmentState)
FragSkSLInfo BuildFragmentSkSL(const Caps *caps, const ShaderCodeDictionary *dict, const RuntimeEffectDictionary *rteDict, const RenderStep *step, UniquePaintParamsID paintID, bool useStorageBuffers, skgpu::Swizzle writeSwizzle)
static void setup_dynamic_state(VkPipelineDynamicStateCreateInfo *dynamicInfo, VkDynamicState *dynamicStates)
static void setup_vertex_input_state(const SkSpan< const Attribute > &vertexAttrs, const SkSpan< const Attribute > &instanceAttrs, VkPipelineVertexInputStateCreateInfo *vertexInputInfo, skia_private::STArray< 2, VkVertexInputBindingDescription, true > *bindingDescs, skia_private::STArray< 16, VkVertexInputAttributeDescription > *attributeDescs)
static void setup_input_assembly_state(PrimitiveType primitiveType, VkPipelineInputAssemblyStateCreateInfo *inputAssemblyInfo)
static void setup_multisample_state(int numSamples, VkPipelineMultisampleStateCreateInfo *multisampleInfo)
const VkPipelineTessellationStateCreateInfo * pTessellationState
const VkPipelineDepthStencilStateCreateInfo * pDepthStencilState
int32_t basePipelineIndex
const VkPipelineDynamicStateCreateInfo * pDynamicState
const VkPipelineColorBlendStateCreateInfo * pColorBlendState
VkPipelineCreateFlags flags
const VkPipelineInputAssemblyStateCreateInfo * pInputAssemblyState
const VkPipelineMultisampleStateCreateInfo * pMultisampleState
const VkPipelineVertexInputStateCreateInfo * pVertexInputState
const VkPipelineShaderStageCreateInfo * pStages
VkPipeline basePipelineHandle
const VkPipelineRasterizationStateCreateInfo * pRasterizationState
const VkPipelineViewportStateCreateInfo * pViewportState
@ VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO