22#if defined(SK_ENABLE_SCOPED_LSAN_SUPPRESSIONS)
23#include <sanitizer/lsan_interface.h>
81 SK_ABORT(
"Unknown vertex attrib type");
90 int vaCount = vertexAttribs.
count();
91 int iaCount = instanceAttribs.
count();
93 uint32_t vertexBinding = 0, instanceBinding = 0;
95 int nextBinding = bindingDescs->
size();
97 vertexBinding = nextBinding++;
101 instanceBinding = nextBinding;
106 for (
auto attrib : vertexAttribs) {
109 vkAttrib.
binding = vertexBinding;
111 vkAttrib.
offset = *attrib.offset();
114 for (
auto attrib : instanceAttribs) {
117 vkAttrib.
binding = instanceBinding;
119 vkAttrib.
offset = *attrib.offset();
125 (uint32_t) vertexAttribs.
stride(),
132 (uint32_t) instanceAttribs.
stride(),
139 vertexInputInfo->
pNext =
nullptr;
140 vertexInputInfo->
flags = 0;
148 switch (primitiveType) {
167 inputAssemblyInfo->
pNext =
nullptr;
168 inputAssemblyInfo->
flags = 0;
194 return gTable[(
int)op];
240 stencilInfo->
pNext =
nullptr;
241 stencilInfo->
flags = 0;
264 viewportInfo->
pNext =
nullptr;
265 viewportInfo->
flags = 0;
281 multisampleInfo->
pNext =
nullptr;
282 multisampleInfo->
flags = 0;
380 return gTable[(
int)equation];
411 colorBlendInfo->
pNext =
nullptr;
412 colorBlendInfo->
flags = 0;
424 rasterInfo->
pNext =
nullptr;
425 rasterInfo->
flags = 0;
441 memset(conservativeRasterInfo, 0,
443 conservativeRasterInfo->
sType =
445 conservativeRasterInfo->
pNext =
nullptr;
446 conservativeRasterInfo->
flags = 0;
457 dynamicInfo->
flags = 0;
472 bool isHWAntialiasState,
475 bool useConservativeRaster,
478 int shaderStageCount,
479 VkRenderPass compatibleRenderPass,
480 VkPipelineLayout layout,
482 VkPipelineCache
cache) {
486 int totalAttributeCnt = vertexAttribs.
count() + instanceAttribs.
count();
487 SkASSERT(totalAttributeCnt <= gpu->vkCaps().maxVertexAttributes());
513 if (useConservativeRaster) {
516 conservativeRasterInfo.
pNext = rasterInfo.
pNext;
517 rasterInfo.
pNext = &conservativeRasterInfo;
527 pipelineCreateInfo.
pNext =
nullptr;
528 pipelineCreateInfo.
flags = 0;
529 pipelineCreateInfo.
stageCount = shaderStageCount;
530 pipelineCreateInfo.
pStages = shaderStageInfo;
541 pipelineCreateInfo.
renderPass = compatibleRenderPass;
542 pipelineCreateInfo.
subpass = subpass;
546 VkPipeline vkPipeline;
550#if defined(SK_ENABLE_SCOPED_LSAN_SUPPRESSIONS)
552 __lsan::ScopedDisabler lsanDisabler;
555 &pipelineCreateInfo,
nullptr,
559 SkDebugf(
"Failed to create pipeline. Error: %d\n", err);
572 int shaderStageCount,
573 VkRenderPass compatibleRenderPass,
574 VkPipelineLayout layout,
575 VkPipelineCache
cache,
588 pipeline.getXferProcessor().getBlendInfo(),
594 compatibleRenderPass,
600void GrVkPipeline::freeGPUData()
const {
610 SkISize colorAttachmentDimensions,
634 SkISize colorAttachmentDimensions) {
653 float floatColors[4];
657 floatColors[0] = blendConst.
fR;
658 floatColors[1] = blendConst.
fG;
659 floatColors[2] = blendConst.
fB;
660 floatColors[3] = blendConst.
fA;
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
static constexpr int kGrStencilTestCount
static constexpr int kGrStencilOpCount
@ kUShort_norm_GrVertexAttribType
@ kFloat2_GrVertexAttribType
@ kUShort2_GrVertexAttribType
@ kUInt_GrVertexAttribType
@ kUByte4_norm_GrVertexAttribType
@ kUByte_GrVertexAttribType
@ kShort2_GrVertexAttribType
@ kUShort4_norm_GrVertexAttribType
@ kInt_GrVertexAttribType
@ kByte_GrVertexAttribType
@ kByte4_GrVertexAttribType
@ kFloat3_GrVertexAttribType
@ kFloat_GrVertexAttribType
@ kByte2_GrVertexAttribType
@ kFloat4_GrVertexAttribType
@ kShort4_GrVertexAttribType
@ kUShort2_norm_GrVertexAttribType
@ kInt3_GrVertexAttribType
@ kHalf2_GrVertexAttribType
@ kHalf4_GrVertexAttribType
@ kUByte4_GrVertexAttribType
@ kUByte2_GrVertexAttribType
@ kInt4_GrVertexAttribType
@ kUByte_norm_GrVertexAttribType
@ kInt2_GrVertexAttribType
@ kHalf_GrVertexAttribType
@ kBottomLeft_GrSurfaceOrigin
@ kTopLeft_GrSurfaceOrigin
static VkBlendFactor blend_coeff_to_vk_blend(skgpu::BlendCoeff coeff)
static void setup_multisample_state(int numSamples, const GrCaps *caps, VkPipelineMultisampleStateCreateInfo *multisampleInfo)
static VkBlendOp blend_equation_to_vk_blend_op(skgpu::BlendEquation equation)
static VkStencilOp stencil_op_to_vk_stencil_op(GrStencilOp op)
static void setup_stencil_op_state(VkStencilOpState *opState, const GrStencilSettings::Face &stencilFace)
static void setup_vertex_input_state(const GrGeometryProcessor::AttributeSet &vertexAttribs, const GrGeometryProcessor::AttributeSet &instanceAttribs, VkPipelineVertexInputStateCreateInfo *vertexInputInfo, STArray< 2, VkVertexInputBindingDescription, true > *bindingDescs, VkVertexInputAttributeDescription *attributeDesc)
static void setup_conservative_raster_info(VkPipelineRasterizationConservativeStateCreateInfoEXT *conservativeRasterInfo)
static void setup_input_assembly_state(GrPrimitiveType primitiveType, VkPipelineInputAssemblyStateCreateInfo *inputAssemblyInfo)
static VkFormat attrib_type_to_vkformat(GrVertexAttribType type)
static void setup_viewport_scissor_state(VkPipelineViewportStateCreateInfo *viewportInfo)
static VkPrimitiveTopology gr_primitive_type_to_vk_topology(GrPrimitiveType primitiveType)
static void setup_raster_state(bool isWireframe, const GrCaps *caps, VkPipelineRasterizationStateCreateInfo *rasterInfo)
static void setup_color_blend_state(const skgpu::BlendInfo &blendInfo, VkPipelineColorBlendStateCreateInfo *colorBlendInfo, VkPipelineColorBlendAttachmentState *attachmentState)
static void setup_dynamic_state(VkPipelineDynamicStateCreateInfo *dynamicInfo, VkDynamicState *dynamicStates)
static VkCompareOp stencil_func_to_vk_compare_op(GrStencilTest test)
static void setup_depth_stencil_state(const GrStencilSettings &stencilSettings, GrSurfaceOrigin origin, VkPipelineDepthStencilStateCreateInfo *stencilInfo)
#define GR_VK_CALL(IFACE, X)
#define GR_VK_CALL_RESULT(GPU, RESULT, X)
#define SK_ABORT(message,...)
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
#define TRACE_EVENT0_ALWAYS(category_group, name)
bool conservativeRasterSupport() const
bool wireframeMode() const
const AttributeSet & vertexAttributes() const
const AttributeSet & instanceAttributes() const
const GrCaps * caps() const
GrSurfaceOrigin origin() const
GrPrimitiveType primitiveType() const
const GrPipeline & pipeline() const
const GrGeometryProcessor & geomProc() const
GrStencilSettings nonGLStencilSettings() const
const Face & postOriginCCWFace(GrSurfaceOrigin origin) const
const Face & singleSidedFace() const
const Face & postOriginCWFace(GrSurfaceOrigin origin) const
void setBlendConstants(const GrVkGpu *gpu, const float blendConstants[4])
void setViewport(const GrVkGpu *gpu, uint32_t firstViewport, uint32_t viewportCount, const VkViewport *viewports)
void setScissor(const GrVkGpu *gpu, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D *scissors)
const skgpu::VulkanInterface * vkInterface() const
static void SetDynamicScissorRectState(GrVkGpu *, GrVkCommandBuffer *, SkISize colorAttachmentDimensions, GrSurfaceOrigin, const SkIRect &scissorRect)
VkPipelineLayout layout() const
static void SetDynamicBlendConstantState(GrVkGpu *, GrVkCommandBuffer *, const skgpu::Swizzle &writeSwizzle, const GrXferProcessor &)
static sk_sp< GrVkPipeline > Make(GrVkGpu *, const GrGeometryProcessor::AttributeSet &vertexAttribs, const GrGeometryProcessor::AttributeSet &instanceAttribs, GrPrimitiveType, GrSurfaceOrigin, const GrStencilSettings &, int numSamples, bool isHWAntialiasState, const skgpu::BlendInfo &, bool isWireframe, bool useConservativeRaster, uint32_t subpass, VkPipelineShaderStageCreateInfo *shaderStageInfo, int shaderStageCount, VkRenderPass compatibleRenderPass, VkPipelineLayout layout, bool ownsLayout, VkPipelineCache cache)
VkPipelineLayout fPipelineLayout
VkPipeline pipeline() const
GrVkPipeline(const GrVkGpu *gpu, VkPipeline pipeline, VkPipelineLayout layout)
static void SetDynamicViewportState(GrVkGpu *, GrVkCommandBuffer *, SkISize colorAttachmentDimensions)
skgpu::BlendInfo getBlendInfo() const
constexpr std::array< float, 4 > applyTo(std::array< float, 4 > color) const
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets Path to the Flutter assets directory enable service port Allow the VM service to fallback to automatic port selection if binding to a specified port fails trace Trace early application lifecycle Automatically switches to an endless trace buffer trace skia Filters out all Skia trace event categories except those that are specified in this comma separated list dump skp on shader Automatically dump the skp that triggers new shader compilations This is useful for writing custom ShaderWarmUp to reduce jank By this is not enabled to reduce the overhead purge persistent cache
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
static constexpr bool BlendCoeffRefsConstant(const BlendCoeff coeff)
static constexpr bool BlendShouldDisable(BlendEquation equation, BlendCoeff srcCoeff, BlendCoeff dstCoeff)
static const int kBlendEquationCnt
static constexpr bool SampleCountToVkSampleCount(uint32_t samples, VkSampleCountFlagBits *vkSamples)
int32_t fBottom
larger y-axis bounds
constexpr int32_t height() const
int32_t fTop
smaller y-axis bounds
static constexpr SkIRect MakeSize(const SkISize &size)
constexpr int32_t width() const
int32_t fLeft
smaller x-axis bounds
bool contains(int32_t x, int32_t y) const
constexpr int32_t width() const
constexpr int32_t height() const
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
VkBlendFactor dstColorBlendFactor
VkBlendFactor dstAlphaBlendFactor
VkBlendFactor srcAlphaBlendFactor
VkBlendFactor srcColorBlendFactor
VkColorComponentFlags colorWriteMask
VkPipelineColorBlendStateCreateFlags flags
const VkPipelineColorBlendAttachmentState * pAttachments
VkPipelineDepthStencilStateCreateFlags flags
VkCompareOp depthCompareOp
VkBool32 depthWriteEnable
VkBool32 stencilTestEnable
VkBool32 depthBoundsTestEnable
VkPipelineDynamicStateCreateFlags flags
const VkDynamicState * pDynamicStates
uint32_t dynamicStateCount
VkPipelineMultisampleStateCreateFlags flags
VkBool32 sampleShadingEnable
VkSampleCountFlagBits rasterizationSamples
VkBool32 alphaToOneEnable
const VkSampleMask * pSampleMask
VkBool32 alphaToCoverageEnable
float extraPrimitiveOverestimationSize
VkConservativeRasterizationModeEXT conservativeRasterizationMode
VkPipelineRasterizationConservativeStateCreateFlagsEXT flags
VkBool32 rasterizerDiscardEnable
float depthBiasConstantFactor
VkBool32 depthClampEnable
VkPolygonMode polygonMode
float depthBiasSlopeFactor
VkPipelineRasterizationStateCreateFlags flags
const VkViewport * pViewports
const VkRect2D * pScissors
VkPipelineViewportStateCreateFlags flags
skgpu::BlendCoeff fDstBlend
SkPMColor4f fBlendConstant
skgpu::BlendCoeff fSrcBlend
@ VK_DYNAMIC_STATE_BLEND_CONSTANTS
@ VK_DYNAMIC_STATE_VIEWPORT
@ VK_DYNAMIC_STATE_SCISSOR
@ VK_STENCIL_OP_INCREMENT_AND_CLAMP
@ VK_STENCIL_OP_DECREMENT_AND_CLAMP
@ VK_STENCIL_OP_INCREMENT_AND_WRAP
@ VK_STENCIL_OP_DECREMENT_AND_WRAP
@ VK_CONSERVATIVE_RASTERIZATION_MODE_OVERESTIMATE_EXT
@ VK_COMPARE_OP_LESS_OR_EQUAL
@ VK_COMPARE_OP_NOT_EQUAL
@ VK_COMPARE_OP_GREATER_OR_EQUAL
@ VK_BLEND_OP_MULTIPLY_EXT
@ VK_BLEND_OP_HARDLIGHT_EXT
@ VK_BLEND_OP_OVERLAY_EXT
@ VK_BLEND_OP_COLORDODGE_EXT
@ VK_BLEND_OP_HSL_COLOR_EXT
@ VK_BLEND_OP_SOFTLIGHT_EXT
@ VK_BLEND_OP_LIGHTEN_EXT
@ VK_BLEND_OP_HSL_HUE_EXT
@ VK_BLEND_OP_HSL_SATURATION_EXT
@ VK_BLEND_OP_HSL_LUMINOSITY_EXT
@ VK_BLEND_OP_EXCLUSION_EXT
@ VK_BLEND_OP_COLORBURN_EXT
@ VK_BLEND_OP_DIFFERENCE_EXT
@ VK_BLEND_OP_REVERSE_SUBTRACT
@ VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST
@ VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP
@ VK_PRIMITIVE_TOPOLOGY_POINT_LIST
@ VK_PRIMITIVE_TOPOLOGY_LINE_STRIP
@ VK_PRIMITIVE_TOPOLOGY_LINE_LIST
@ VK_FRONT_FACE_COUNTER_CLOCKWISE
@ VK_VERTEX_INPUT_RATE_VERTEX
@ VK_VERTEX_INPUT_RATE_INSTANCE
@ VK_COLOR_COMPONENT_R_BIT
@ VK_COLOR_COMPONENT_A_BIT
@ VK_COLOR_COMPONENT_B_BIT
@ VK_COLOR_COMPONENT_G_BIT
@ VK_FORMAT_R16G16B16A16_UNORM
@ VK_FORMAT_R16G16_SFLOAT
@ VK_FORMAT_R32G32_SFLOAT
@ VK_FORMAT_R32G32B32A32_SFLOAT
@ VK_FORMAT_R16G16B16A16_SINT
@ VK_FORMAT_R8G8B8A8_UNORM
@ VK_FORMAT_R32G32B32_SINT
@ VK_FORMAT_R16G16B16A16_SFLOAT
@ VK_FORMAT_R8G8B8A8_SINT
@ VK_FORMAT_R32G32B32A32_SINT
@ VK_FORMAT_R32G32B32_SFLOAT
@ VK_FORMAT_R8G8B8A8_UINT
@ VK_BLEND_FACTOR_SRC1_ALPHA
@ VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA
@ VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR
@ VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR
@ VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR
@ VK_BLEND_FACTOR_SRC_COLOR
@ VK_BLEND_FACTOR_CONSTANT_COLOR
@ VK_BLEND_FACTOR_SRC_ALPHA
@ VK_BLEND_FACTOR_DST_ALPHA
@ VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA
@ VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
@ VK_BLEND_FACTOR_DST_COLOR
@ VK_BLEND_FACTOR_SRC1_COLOR
@ VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR
@ VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO
@ VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO
@ VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO
@ VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO
@ VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO
@ VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_CONSERVATIVE_STATE_CREATE_INFO_EXT
@ VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO
@ VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO
@ VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO
@ VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO