Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
skgpu::graphite::VulkanGraphicsPipeline Class Referencefinal

#include <VulkanGraphicsPipeline.h>

Inheritance diagram for skgpu::graphite::VulkanGraphicsPipeline:
skgpu::graphite::GraphicsPipeline skgpu::graphite::Resource

Public Member Functions

 ~VulkanGraphicsPipeline () override
 
VkPipelineLayout layout () const
 
VkPipeline pipeline () const
 
bool hasFragmentUniforms () const
 
bool hasStepUniforms () const
 
int numTextureSamplers () const
 
- Public Member Functions inherited from skgpu::graphite::GraphicsPipeline
 ~GraphicsPipeline () override
 
const char * getResourceType () const override
 
- Public Member Functions inherited from skgpu::graphite::Resource
 Resource (const Resource &)=delete
 
 Resource (Resource &&)=delete
 
Resourceoperator= (const Resource &)=delete
 
Resourceoperator= (Resource &&)=delete
 
void ref () const
 
void unref () const
 
void refCommandBuffer () const
 
void unrefCommandBuffer () const
 
Ownership ownership () const
 
skgpu::Budgeted budgeted () const
 
size_t gpuMemorySize () const
 
UniqueID uniqueID () const
 
virtual const char * getResourceType () const =0
 
std::string getLabel () const
 
void setLabel (std::string_view label)
 
bool wasDestroyed () const
 
const GraphiteResourceKeykey () const
 
void setKey (const GraphiteResourceKey &key)
 
void dumpMemoryStatistics (SkTraceMemoryDump *traceMemoryDump) const
 
virtual void prepareForReturnToCache (const std::function< void()> &takeRef)
 

Static Public Member Functions

static sk_sp< VulkanGraphicsPipelineMake (const VulkanSharedContext *, const RuntimeEffectDictionary *, const GraphicsPipelineDesc &, const RenderPassDesc &, const sk_sp< VulkanRenderPass > &compatibleRenderPass, VkPipelineCache)
 
static sk_sp< VulkanGraphicsPipelineMakeLoadMSAAPipeline (const VulkanSharedContext *, VkShaderModule vsModule, VkShaderModule fsModule, VkPipelineShaderStageCreateInfo *pipelineShaderStages, VkPipelineLayout, sk_sp< VulkanRenderPass > compatibleRenderPass, VkPipelineCache, const TextureInfo &dstColorAttachmentTexInfo)
 
static bool InitializeMSAALoadPipelineStructs (const VulkanSharedContext *, VkShaderModule *outVertexShaderModule, VkShaderModule *outFragShaderModule, VkPipelineShaderStageCreateInfo *outShaderStageInfo, VkPipelineLayout *outPipelineLayout)
 

Static Public Attributes

static constexpr unsigned int kIntrinsicUniformBufferIndex = 0
 
static constexpr unsigned int kRenderStepUniformBufferIndex = 1
 
static constexpr unsigned int kPaintUniformBufferIndex = 2
 
static constexpr unsigned int kNumUniformBuffers = 3
 
static constexpr unsigned int kUniformBufferDescSetIndex = 0
 
static constexpr unsigned int kTextureBindDescSetIndex = 1
 
static constexpr unsigned int kInputAttachmentDescSetIndex = kUniformBufferDescSetIndex
 
static constexpr unsigned int kVertexBufferIndex = 0
 
static constexpr unsigned int kInstanceBufferIndex = 1
 
static constexpr unsigned int kNumInputBuffers = 2
 
static const DescriptorData kIntrinsicUniformBufferDescriptor
 
static const DescriptorData kRenderStepUniformDescriptor
 
static const DescriptorData kPaintUniformDescriptor
 
static constexpr unsigned int kInputAttachmentBindingIndex = 0
 
static const DescriptorData kInputAttachmentDescriptor
 

Additional Inherited Members

- Protected Member Functions inherited from skgpu::graphite::GraphicsPipeline
 GraphicsPipeline (const SharedContext *, PipelineInfo *)
 
- Protected Member Functions inherited from skgpu::graphite::Resource
 Resource (const SharedContext *, Ownership, skgpu::Budgeted, size_t gpuMemorySize, bool commandBufferRefsAsUsageRefs=false)
 
virtual ~Resource ()
 
const SharedContextsharedContext () const
 
virtual void onDumpMemoryStatistics (SkTraceMemoryDump *traceMemoryDump, const char *dumpName) const
 
void setDeleteASAP ()
 

Detailed Description

Definition at line 33 of file VulkanGraphicsPipeline.h.

Constructor & Destructor Documentation

◆ ~VulkanGraphicsPipeline()

skgpu::graphite::VulkanGraphicsPipeline::~VulkanGraphicsPipeline ( )
inlineoverride

Definition at line 100 of file VulkanGraphicsPipeline.h.

100{}

Member Function Documentation

◆ hasFragmentUniforms()

bool skgpu::graphite::VulkanGraphicsPipeline::hasFragmentUniforms ( ) const
inline

Definition at line 112 of file VulkanGraphicsPipeline.h.

112{ return fHasFragmentUniforms; }

◆ hasStepUniforms()

bool skgpu::graphite::VulkanGraphicsPipeline::hasStepUniforms ( ) const
inline

Definition at line 113 of file VulkanGraphicsPipeline.h.

113{ return fHasStepUniforms; }

◆ InitializeMSAALoadPipelineStructs()

bool skgpu::graphite::VulkanGraphicsPipeline::InitializeMSAALoadPipelineStructs ( const VulkanSharedContext sharedContext,
VkShaderModule *  outVertexShaderModule,
VkShaderModule *  outFragShaderModule,
VkPipelineShaderStageCreateInfo outShaderStageInfo,
VkPipelineLayout *  outPipelineLayout 
)
static

Definition at line 797 of file VulkanGraphicsPipeline.cpp.

802 {
803 SkSL::Program::Interface vsInterface, fsInterface;
805 settings.fForceNoRTFlip = true;
806 std::string vsSPIRV, fsSPIRV;
807 ShaderErrorHandler* errorHandler = sharedContext->caps()->shaderErrorHandler();
808
809 std::string vertShaderText;
810 vertShaderText.append(
811 "// MSAA Load Program VS\n"
812 "layout(vulkan, location=0) in float2 ndc_position;"
813
814 "void main() {"
815 "sk_Position.xy = ndc_position;"
816 "sk_Position.zw = half2(0, 1);"
817 "}");
818
819 std::string fragShaderText;
820 fragShaderText.append(
821 "layout(vulkan, input_attachment_index=0, set=0, binding=0) subpassInput uInput;"
822
823 "// MSAA Load Program FS\n"
824 "void main() {"
825 "sk_FragColor = subpassLoad(uInput);"
826 "}");
827
829 vertShaderText,
831 settings,
832 &vsSPIRV,
833 &vsInterface,
834 errorHandler)) {
835 return false;
836 }
838 fragShaderText,
840 settings,
841 &fsSPIRV,
842 &fsInterface,
843 errorHandler)) {
844 return false;
845 }
846 *outFragShaderModule =
848 if (*outFragShaderModule == VK_NULL_HANDLE) {
849 return false;
850 }
851
852 *outVertexShaderModule =
854 if (*outVertexShaderModule == VK_NULL_HANDLE) {
856 return false;
857 }
858
860 *outVertexShaderModule,
861 &outShaderStageInfo[0]);
862
864 *outFragShaderModule,
865 &outShaderStageInfo[1]);
866
867 // The load msaa pipeline takes no step or paint uniforms and no instance attributes. It only
868 // references one input attachment texture (which does not require a sampler) and one vertex
869 // attribute (NDC position)
870 skia_private::TArray<DescriptorData> inputAttachmentDescriptors(1);
871 inputAttachmentDescriptors.push_back(VulkanGraphicsPipeline::kInputAttachmentDescriptor);
872 *outPipelineLayout = setup_pipeline_layout(sharedContext,
873 /*usesIntrinsicConstantUbo=*/false,
874 /*hasStepUniforms=*/false,
875 /*numPaintUniforms=*/0,
876 /*numTextureSamplers=*/0,
877 /*numInputAttachments=*/1);
878
879 if (*outPipelineLayout == VK_NULL_HANDLE) {
880 destroy_shader_modules(sharedContext, *outVertexShaderModule, *outFragShaderModule);
881 return false;
882 }
883 return true;
884}
skgpu::ShaderErrorHandler * shaderErrorHandler() const
Definition: Caps.h:273
const SkSL::ShaderCaps * shaderCaps() const
Definition: Caps.h:75
const SharedContext * sharedContext() const
Definition: Resource.h:189
const Caps * caps() const
Definition: SharedContext.h:39
static const DescriptorData kInputAttachmentDescriptor
static VkPipelineLayout setup_pipeline_layout(const VulkanSharedContext *sharedContext, bool usesIntrinsicConstantUbo, bool hasStepUniforms, int numPaintUniforms, int numTextureSamplers, int numInputAttachments)
VkShaderModule createVulkanShaderModule(const VulkanSharedContext *context, const std::string &spirv, VkShaderStageFlagBits stage)
static void destroy_shader_modules(const VulkanSharedContext *sharedContext, VkShaderModule vsModule, VkShaderModule fsModule)
static void setup_shader_stage_info(VkShaderStageFlagBits stage, VkShaderModule shaderModule, VkPipelineShaderStageCreateInfo *shaderStageInfo)
bool SkSLToSPIRV(const SkSL::ShaderCaps *caps, const std::string &sksl, SkSL::ProgramKind programKind, const SkSL::ProgramSettings &settings, std::string *spirv, SkSL::ProgramInterface *outInterface, ShaderErrorHandler *errorHandler)
@ VK_SHADER_STAGE_VERTEX_BIT
Definition: vulkan_core.h:2665
@ VK_SHADER_STAGE_FRAGMENT_BIT
Definition: vulkan_core.h:2669
#define VK_NULL_HANDLE
Definition: vulkan_core.h:46

◆ layout()

VkPipelineLayout skgpu::graphite::VulkanGraphicsPipeline::layout ( ) const
inline

Definition at line 102 of file VulkanGraphicsPipeline.h.

102 {
103 SkASSERT(fPipelineLayout != VK_NULL_HANDLE);
104 return fPipelineLayout;
105 }
#define SkASSERT(cond)
Definition: SkAssert.h:116

◆ Make()

sk_sp< VulkanGraphicsPipeline > skgpu::graphite::VulkanGraphicsPipeline::Make ( const VulkanSharedContext sharedContext,
const RuntimeEffectDictionary runtimeDict,
const GraphicsPipelineDesc pipelineDesc,
const RenderPassDesc renderPassDesc,
const sk_sp< VulkanRenderPass > &  compatibleRenderPass,
VkPipelineCache  pipelineCache 
)
static

Definition at line 592 of file VulkanGraphicsPipeline.cpp.

598 {
599
600 SkSL::Program::Interface vsInterface, fsInterface;
602 settings.fForceNoRTFlip = true; // TODO: Confirm
603 ShaderErrorHandler* errorHandler = sharedContext->caps()->shaderErrorHandler();
604
605 const RenderStep* step = sharedContext->rendererProvider()->lookup(pipelineDesc.renderStepID());
606 const bool useStorageBuffers = sharedContext->caps()->storageBufferPreferred();
607
608 if (step->vertexAttributes().size() + step->instanceAttributes().size() >
609 sharedContext->vulkanCaps().maxVertexAttributes()) {
610 SKGPU_LOG_W("Requested more than the supported number of vertex attributes");
611 return nullptr;
612 }
613
614 FragSkSLInfo fsSkSLInfo = BuildFragmentSkSL(sharedContext->caps(),
616 runtimeDict,
617 step,
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;
626 VkShaderModule fsModule = VK_NULL_HANDLE, vsModule = VK_NULL_HANDLE;
627
628 if (hasFragmentSkSL) {
630 fsSkSL,
632 settings,
633 &fsSPIRV,
634 &fsInterface,
635 errorHandler)) {
636 return nullptr;
637 }
638
640 if (!fsModule) {
641 return nullptr;
642 }
643 }
644
645 VertSkSLInfo vsSkSLInfo = BuildVertexSkSL(sharedContext->caps()->resourceBindingRequirements(),
646 step,
647 useStorageBuffers,
648 localCoordsNeeded);
649 const std::string& vsSkSL = vsSkSLInfo.fSkSL;
651 vsSkSL,
653 settings,
654 &vsSPIRV,
655 &vsInterface,
656 errorHandler)) {
657 return nullptr;
658 }
659
661 if (!vsModule) {
662 // Clean up the other shader module before returning.
664 return nullptr;
665 }
666
670 setup_vertex_input_state(step->vertexAttributes(),
671 step->instanceAttributes(),
672 &vertexInputInfo,
673 &bindingDescs,
674 &attributeDescs);
675
677 setup_input_assembly_state(step->primitiveType(), &inputAssemblyInfo);
678
680 setup_depth_stencil_state(step->depthStencilSettings(), &depthStencilInfo);
681
683 setup_viewport_scissor_state(&viewportInfo);
684
686 setup_multisample_state(renderPassDesc.fColorAttachment.fTextureInfo.numSamples(),
687 &multisampleInfo);
688
689 // We will only have one color blend attachment per pipeline.
690 VkPipelineColorBlendAttachmentState attachmentStates[1];
692 setup_color_blend_state(fsSkSLInfo.fBlendInfo, &colorBlendInfo, attachmentStates);
693
695 // TODO: Check for wire frame mode once that is an available context option within graphite.
696 setup_raster_state(/*isWireframe=*/false, &rasterInfo);
697
698 VkPipelineShaderStageCreateInfo pipelineShaderStages[2];
700 vsModule,
701 &pipelineShaderStages[0]);
702 if (hasFragmentSkSL) {
704 fsModule,
705 &pipelineShaderStages[1]);
706 }
707
708 // TODO(b/347070730): Analyze fsSkSLInfo.fData to see if we have any immutable samplers which
709 // should be a part of the pipeline layout.
710
711 // TODO: Query RenderPassDesc for input attachment information. For now, we only use one for
712 // loading MSAA from resolve so we can simply pass in 0 when not doing that.
713 VkPipelineLayout pipelineLayout = setup_pipeline_layout(sharedContext,
714 /*usesIntrinsicConstantUbo=*/true,
715 !step->uniforms().empty(),
716 fsSkSLInfo.fNumPaintUniforms,
717 fsSkSLInfo.fNumTexturesAndSamplers,
718 /*numInputAttachments=*/0);
719 if (pipelineLayout == VK_NULL_HANDLE) {
720 destroy_shader_modules(sharedContext, vsModule, fsModule);
721 return nullptr;
722 }
723
724 VkDynamicState dynamicStates[3];
726 setup_dynamic_state(&dynamicInfo, dynamicStates);
727
728 bool loadMsaaFromResolve = renderPassDesc.fColorResolveAttachment.fTextureInfo.isValid() &&
729 renderPassDesc.fColorResolveAttachment.fLoadOp == LoadOp::kLoad;
730
731 VkGraphicsPipelineCreateInfo pipelineCreateInfo;
732 memset(&pipelineCreateInfo, 0, sizeof(VkGraphicsPipelineCreateInfo));
734 pipelineCreateInfo.pNext = nullptr;
735 pipelineCreateInfo.flags = 0;
736 pipelineCreateInfo.stageCount = hasFragmentSkSL ? 2 : 1;
737 pipelineCreateInfo.pStages = &pipelineShaderStages[0];
738 pipelineCreateInfo.pVertexInputState = &vertexInputInfo;
739 pipelineCreateInfo.pInputAssemblyState = &inputAssemblyInfo;
740 pipelineCreateInfo.pTessellationState = nullptr;
741 pipelineCreateInfo.pViewportState = &viewportInfo;
742 pipelineCreateInfo.pRasterizationState = &rasterInfo;
743 pipelineCreateInfo.pMultisampleState = &multisampleInfo;
744 pipelineCreateInfo.pDepthStencilState = &depthStencilInfo;
745 pipelineCreateInfo.pColorBlendState = &colorBlendInfo;
746 pipelineCreateInfo.pDynamicState = &dynamicInfo;
747 pipelineCreateInfo.layout = pipelineLayout;
748 pipelineCreateInfo.renderPass = compatibleRenderPass->renderPass();
749 pipelineCreateInfo.subpass = loadMsaaFromResolve ? 1 : 0;
750 pipelineCreateInfo.basePipelineHandle = VK_NULL_HANDLE;
751 pipelineCreateInfo.basePipelineIndex = -1;
752
753 VkPipeline vkPipeline;
755 {
756 TRACE_EVENT0_ALWAYS("skia.shaders", "VkCreateGraphicsPipeline");
758 result,
759 CreateGraphicsPipelines(sharedContext->device(),
760 pipelineCache,
761 /*createInfoCount=*/1,
762 &pipelineCreateInfo,
763 /*pAllocator=*/nullptr,
764 &vkPipeline));
765 }
766 if (result != VK_SUCCESS) {
767 SkDebugf("Failed to create pipeline. Error: %d\n", result);
768 return nullptr;
769 }
770
771 // After creating the pipeline object, we can clean up the VkShaderModule(s).
772 destroy_shader_modules(sharedContext, vsModule, fsModule);
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
787 new VulkanGraphicsPipeline(sharedContext,
788 pipelineInfoPtr,
789 pipelineLayout,
790 vkPipeline,
791 fsSkSLInfo.fNumPaintUniforms > 0,
792 !step->uniforms().empty(),
793 fsSkSLInfo.fNumTexturesAndSamplers,
794 /*ownsPipelineLayout=*/true));
795}
static int step(int x, SkScalar min, SkScalar max)
Definition: BlurTest.cpp:215
#define SKGPU_LOG_W(fmt,...)
Definition: Log.h:40
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
Definition: Caps.h:150
bool storageBufferPreferred() const
Definition: Caps.h:239
const RenderStep * lookup(uint32_t uniqueID) const
ShaderCodeDictionary * shaderCodeDictionary()
Definition: SharedContext.h:49
const RendererProvider * rendererProvider() const
Definition: SharedContext.h:47
GAsyncResult * result
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
Definition: vulkan_core.h:3674
const VkPipelineDepthStencilStateCreateInfo * pDepthStencilState
Definition: vulkan_core.h:3678
const VkPipelineDynamicStateCreateInfo * pDynamicState
Definition: vulkan_core.h:3680
const VkPipelineColorBlendStateCreateInfo * pColorBlendState
Definition: vulkan_core.h:3679
VkPipelineCreateFlags flags
Definition: vulkan_core.h:3669
const VkPipelineInputAssemblyStateCreateInfo * pInputAssemblyState
Definition: vulkan_core.h:3673
const VkPipelineMultisampleStateCreateInfo * pMultisampleState
Definition: vulkan_core.h:3677
const VkPipelineVertexInputStateCreateInfo * pVertexInputState
Definition: vulkan_core.h:3672
const VkPipelineShaderStageCreateInfo * pStages
Definition: vulkan_core.h:3671
const VkPipelineRasterizationStateCreateInfo * pRasterizationState
Definition: vulkan_core.h:3676
const VkPipelineViewportStateCreateInfo * pViewportState
Definition: vulkan_core.h:3675
VkDynamicState
Definition: vulkan_core.h:1930
VkResult
Definition: vulkan_core.h:140
@ VK_SUCCESS
Definition: vulkan_core.h:141
@ VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO
Definition: vulkan_core.h:230

◆ MakeLoadMSAAPipeline()

sk_sp< VulkanGraphicsPipeline > skgpu::graphite::VulkanGraphicsPipeline::MakeLoadMSAAPipeline ( const VulkanSharedContext sharedContext,
VkShaderModule  vsModule,
VkShaderModule  fsModule,
VkPipelineShaderStageCreateInfo pipelineShaderStages,
VkPipelineLayout  pipelineLayout,
sk_sp< VulkanRenderPass compatibleRenderPass,
VkPipelineCache  pipelineCache,
const TextureInfo dstColorAttachmentTexInfo 
)
static

Definition at line 886 of file VulkanGraphicsPipeline.cpp.

894 {
895
896 int numSamples = dstColorAttachmentTexInfo.numSamples();
897
898 // Create vertex attribute list
899 Attribute vertexAttrib[1] = {{"ndc_position", VertexAttribType::kFloat2, SkSLType::kFloat2}};
900 SkSpan<const Attribute> loadMSAAVertexAttribs = {vertexAttrib};
901
905 setup_vertex_input_state(loadMSAAVertexAttribs,
906 /*instanceAttrs=*/{}, // Load msaa pipeline takes no instance attribs
907 &vertexInputInfo,
908 &bindingDescs,
909 &attributeDescs);
910
913
915 setup_depth_stencil_state(/*stencilSettings=*/{}, &depthStencilInfo);
916
918 setup_viewport_scissor_state(&viewportInfo);
919
921 setup_multisample_state(numSamples, &multisampleInfo);
922
923 // We will only have one color blend attachment per pipeline.
924 VkPipelineColorBlendAttachmentState attachmentStates[1];
926 setup_color_blend_state({}, &colorBlendInfo, attachmentStates);
927
929 // TODO: Check for wire frame mode once that is an available context option within graphite.
930 setup_raster_state(/*isWireframe=*/false, &rasterInfo);
931
932 VkDynamicState dynamicStates[3];
934 setup_dynamic_state(&dynamicInfo, dynamicStates);
935
936 VkGraphicsPipelineCreateInfo pipelineCreateInfo;
937 memset(&pipelineCreateInfo, 0, sizeof(VkGraphicsPipelineCreateInfo));
939 pipelineCreateInfo.pNext = nullptr;
940 pipelineCreateInfo.flags = 0;
941 pipelineCreateInfo.stageCount = 2;
942 pipelineCreateInfo.pStages = pipelineShaderStages;
943 pipelineCreateInfo.pVertexInputState = &vertexInputInfo;
944 pipelineCreateInfo.pInputAssemblyState = &inputAssemblyInfo;
945 pipelineCreateInfo.pTessellationState = nullptr;
946 pipelineCreateInfo.pViewportState = &viewportInfo;
947 pipelineCreateInfo.pRasterizationState = &rasterInfo;
948 pipelineCreateInfo.pMultisampleState = &multisampleInfo;
949 pipelineCreateInfo.pDepthStencilState = &depthStencilInfo;
950 pipelineCreateInfo.pColorBlendState = &colorBlendInfo;
951 pipelineCreateInfo.pDynamicState = &dynamicInfo;
952 pipelineCreateInfo.layout = pipelineLayout;
953 pipelineCreateInfo.renderPass = compatibleRenderPass->renderPass();
954
955 VkPipeline vkPipeline;
957 {
958 TRACE_EVENT0_ALWAYS("skia.shaders", "CreateGraphicsPipeline");
959 SkASSERT(pipelineCache != VK_NULL_HANDLE);
961 result,
962 CreateGraphicsPipelines(sharedContext->device(),
963 pipelineCache,
964 /*createInfoCount=*/1,
965 &pipelineCreateInfo,
966 /*pAllocator=*/nullptr,
967 &vkPipeline));
968 }
969 if (result != VK_SUCCESS) {
970 SkDebugf("Failed to create pipeline. Error: %d\n", result);
971 return nullptr;
972 }
973
974 // TODO: If we want to track GraphicsPipeline::PipelineInfo in debug, we'll need to add
975 // PipelineDesc as an argument for this method. For now, just pass in nullptr.
977 new VulkanGraphicsPipeline(sharedContext,
978 /*pipelineInfo=*/nullptr,
979 pipelineLayout,
980 vkPipeline,
981 /*hasFragmentUniforms=*/false,
982 /*hasStepUniforms=*/false,
983 /*numTextureSamplers*/0,
984 /*ownsPipelineLayout=*/false));
985}

◆ numTextureSamplers()

int skgpu::graphite::VulkanGraphicsPipeline::numTextureSamplers ( ) const
inline

Definition at line 114 of file VulkanGraphicsPipeline.h.

114{ return fNumTextureSamplers; }

◆ pipeline()

VkPipeline skgpu::graphite::VulkanGraphicsPipeline::pipeline ( ) const
inline

Definition at line 107 of file VulkanGraphicsPipeline.h.

107 {
108 SkASSERT(fPipeline != VK_NULL_HANDLE);
109 return fPipeline;
110 }

Member Data Documentation

◆ kInputAttachmentBindingIndex

constexpr unsigned int skgpu::graphite::VulkanGraphicsPipeline::kInputAttachmentBindingIndex = 0
inlinestaticconstexpr

Definition at line 70 of file VulkanGraphicsPipeline.h.

◆ kInputAttachmentDescriptor

const DescriptorData skgpu::graphite::VulkanGraphicsPipeline::kInputAttachmentDescriptor
inlinestatic

◆ kInputAttachmentDescSetIndex

constexpr unsigned int skgpu::graphite::VulkanGraphicsPipeline::kInputAttachmentDescSetIndex = kUniformBufferDescSetIndex
inlinestaticconstexpr

Definition at line 47 of file VulkanGraphicsPipeline.h.

◆ kInstanceBufferIndex

constexpr unsigned int skgpu::graphite::VulkanGraphicsPipeline::kInstanceBufferIndex = 1
inlinestaticconstexpr

Definition at line 50 of file VulkanGraphicsPipeline.h.

◆ kIntrinsicUniformBufferDescriptor

const DescriptorData skgpu::graphite::VulkanGraphicsPipeline::kIntrinsicUniformBufferDescriptor
inlinestatic

◆ kIntrinsicUniformBufferIndex

constexpr unsigned int skgpu::graphite::VulkanGraphicsPipeline::kIntrinsicUniformBufferIndex = 0
inlinestaticconstexpr

Definition at line 35 of file VulkanGraphicsPipeline.h.

◆ kNumInputBuffers

constexpr unsigned int skgpu::graphite::VulkanGraphicsPipeline::kNumInputBuffers = 2
inlinestaticconstexpr

Definition at line 51 of file VulkanGraphicsPipeline.h.

◆ kNumUniformBuffers

constexpr unsigned int skgpu::graphite::VulkanGraphicsPipeline::kNumUniformBuffers = 3
inlinestaticconstexpr

Definition at line 38 of file VulkanGraphicsPipeline.h.

◆ kPaintUniformBufferIndex

constexpr unsigned int skgpu::graphite::VulkanGraphicsPipeline::kPaintUniformBufferIndex = 2
inlinestaticconstexpr

Definition at line 37 of file VulkanGraphicsPipeline.h.

◆ kPaintUniformDescriptor

const DescriptorData skgpu::graphite::VulkanGraphicsPipeline::kPaintUniformDescriptor
inlinestatic

◆ kRenderStepUniformBufferIndex

constexpr unsigned int skgpu::graphite::VulkanGraphicsPipeline::kRenderStepUniformBufferIndex = 1
inlinestaticconstexpr

Definition at line 36 of file VulkanGraphicsPipeline.h.

◆ kRenderStepUniformDescriptor

const DescriptorData skgpu::graphite::VulkanGraphicsPipeline::kRenderStepUniformDescriptor
inlinestatic

◆ kTextureBindDescSetIndex

constexpr unsigned int skgpu::graphite::VulkanGraphicsPipeline::kTextureBindDescSetIndex = 1
inlinestaticconstexpr

Definition at line 44 of file VulkanGraphicsPipeline.h.

◆ kUniformBufferDescSetIndex

constexpr unsigned int skgpu::graphite::VulkanGraphicsPipeline::kUniformBufferDescSetIndex = 0
inlinestaticconstexpr

Definition at line 43 of file VulkanGraphicsPipeline.h.

◆ kVertexBufferIndex

constexpr unsigned int skgpu::graphite::VulkanGraphicsPipeline::kVertexBufferIndex = 0
inlinestaticconstexpr

Definition at line 49 of file VulkanGraphicsPipeline.h.


The documentation for this class was generated from the following files: