30 VkRenderPass compatibleRenderPass,
31 bool overrideSubpassForResolveLoad) {
44 if (!
builder.emitAndInstallProcs()) {
48 return builder.finalize(
desc, compatibleRenderPass, overrideSubpassForResolveLoad);
51GrVkPipelineStateBuilder::GrVkPipelineStateBuilder(
GrVkGpu* gpu,
56 , fVaryingHandler(this)
57 , fUniformHandler(this) {}
68 const std::string& sksl,
69 VkShaderModule* shaderModule,
72 std::string* outSPIRV,
75 stageInfo,
settings, outSPIRV, outInterface)) {
86 VkShaderModule* shaderModule,
102int GrVkPipelineStateBuilder::loadShadersFromCache(
SkReadBuffer* cached,
103 VkShaderModule outShaderModules[],
129 if (outShaderModules[
i]) {
131 DestroyShaderModule(fGpu->
device(), outShaderModules[
i],
nullptr));
139void GrVkPipelineStateBuilder::storeShadersInCache(
const std::string shaders[],
148 this->
desc().initialKeyLength()+4);
159 VkRenderPass compatibleRenderPass,
160 bool overrideSubpassForResolveLoad) {
171 GrVkDescriptorSetManager::Handle samplerDSHandle;
173 fUniformHandler, &samplerDSHandle);
188 settings.fUsePushConstants = usePushConstants;
189 if (
fFS.fForceHighPrecision) {
190 settings.fForceHighPrecision =
true;
198 if (persistentCache) {
205 cached = persistentCache->load(*
key);
212 int numShaderStages = 0;
214 numShaderStages = this->loadShadersFromCache(&reader, shaderModules, shaderStageInfo);
218 if (!numShaderStages) {
232 sksl[
i] = &cached_sksl[
i];
255 if (shaderModules[
i]) {
257 shaderModules[
i],
nullptr));
263 if (persistentCache && !cached) {
272 this->storeShadersInCache(shaders, interfaces, isSkSL);
281 uint32_t layoutCount =
287 layoutCreateInfo.
pNext =
nullptr;
288 layoutCreateInfo.
flags = 0;
292 if (usePushConstants) {
294 pushConstantRange.
offset = 0;
305 VkPipelineLayout pipelineLayout;
316 uint32_t subpass = 0;
317 if (overrideSubpassForResolveLoad ||
323 fProgramInfo, shaderStageInfo, numShaderStages, compatibleRenderPass, pipelineLayout,
329 if (shaderModules[
i]) {
345 fUniformHandler.fUniforms,
348 fUniformHandler.fSamplers,
static const int kGrShaderTypeCount
static constexpr SkFourByteTag kSPIRV_Tag
static constexpr SkFourByteTag kSKSL_Tag
bool GrCompileVkShaderModule(GrVkGpu *gpu, const std::string &shaderString, VkShaderStageFlagBits stage, VkShaderModule *shaderModule, VkPipelineShaderStageCreateInfo *stageInfo, const SkSL::ProgramSettings &settings, std::string *outSPIRV, SkSL::Program::Interface *outInterface)
bool GrInstallVkShaderModule(GrVkGpu *gpu, const std::string &spirv, VkShaderStageFlagBits stage, VkShaderModule *shaderModule, VkPipelineShaderStageCreateInfo *stageInfo)
#define GR_VK_CALL(IFACE, X)
#define GR_VK_CALL_RESULT(GPU, RESULT, X)
#define INHERITED(method,...)
static constexpr bool SkToBool(const T &x)
static constexpr SkFourByteTag SkSetFourByteTag(char a, char b, char c, char d)
const GrContextOptions & options() const
virtual void store(const SkData &, const SkData &)
GrContextOptions::PersistentCache * getPersistentCache()
GrDirectContextPriv priv()
const GrProgramDesc & desc() const
std::vector< std::unique_ptr< GrFragmentProcessor::ProgramImpl > > fFPImpls
std::unique_ptr< GrGeometryProcessor::ProgramImpl > fGPImpl
bool fragColorIsInOut() const
std::unique_ptr< GrXferProcessor::ProgramImpl > fXPImpl
GrGLSLBuiltinUniformHandles fUniformHandles
const GrProgramInfo & fProgramInfo
GrGLSLFragmentShaderBuilder fFS
void addRTFlipUniform(const char *name)
const GrPipeline & pipeline() const
std::string fCompilerString
const GrCaps * caps() const
GrDirectContext * getContext()
uint32_t initialKeyLength() const
const uint32_t * asKey() const
static SkString Describe(const GrProgramInfo &, const GrCaps &)
GrLoadOp colorLoadOp() const
GrXferBarrierFlags renderPassBarriers() const
void addLayoutQualifier(const char *layoutQualifier)
void incShaderCompilations()
bool programInfoWillUseDiscardableMSAA(const GrProgramInfo &) const
VkShaderStageFlags getPushConstantStageFlags() const
int getFragmentUniformSet() const
int getFragmentUniformBinding() const
const GrVkCaps & vkCaps() const
const skgpu::VulkanInterface * vkInterface() const
GrVkResourceProvider & resourceProvider()
static GrVkPipelineState * CreatePipelineState(GrVkGpu *, const GrProgramDesc &, const GrProgramInfo &, VkRenderPass compatibleRenderPass, bool overrideSubpassForResolveLoad)
const GrCaps * caps() const override
void finalizeFragmentSecondaryColor(GrShaderVar &outputColor) override
VkDescriptorSetLayout getInputDSLayout() const
VkDescriptorSetLayout getUniformDSLayout() const
sk_sp< const GrVkPipeline > makePipeline(const GrProgramInfo &, VkPipelineShaderStageCreateInfo *shaderStageInfo, int shaderStageCount, VkRenderPass compatibleRenderPass, VkPipelineLayout layout, uint32_t subpass)
VkDescriptorSetLayout getSamplerDSLayout(const GrVkDescriptorSetManager::Handle &) const
void getSamplerDescriptorSetHandle(VkDescriptorType type, const GrVkUniformHandler &, GrVkDescriptorSetManager::Handle *handle)
GrThreadSafePipelineBuilder * pipelineStateCache()
static sk_sp< SkData > MakeWithoutCopy(const void *data, size_t length)
const void * data() const
void setMemory(const void *, size_t)
sk_sp< SkData > PackCachedShaders(SkFourByteTag shaderType, const std::string shaders[], const SkSL::Program::Interface interfaces[], int numInterfaces, const ShaderMetadata *meta)
bool UnpackCachedShaders(SkReadBuffer *reader, std::string shaders[], SkSL::Program::Interface interfaces[], int numInterfaces, ShaderMetadata *meta)
SkFourByteTag GetType(SkReadBuffer *reader)
std::string PrettyPrint(const std::string &string)
ShaderCacheStrategy fShaderCacheStrategy
VkPipelineLayoutCreateFlags flags
uint32_t pushConstantRangeCount
const VkPushConstantRange * pPushConstantRanges
const VkDescriptorSetLayout * pSetLayouts
VkShaderStageFlags stageFlags
std::shared_ptr< const fml::Mapping > data
#define TRACE_EVENT0(category_group, name)
@ VK_SHADER_STAGE_VERTEX_BIT
@ VK_SHADER_STAGE_FRAGMENT_BIT
VkFlags VkPipelineLayoutCreateFlags
@ VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER
@ VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO