/* * Copyright 2021 Google LLC * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "src/gpu/graphite/GraphicsPipeline.h" #include "src/gpu/graphite/ContextUtils.h" #include "src/gpu/graphite/Renderer.h" #include "src/gpu/graphite/ShaderInfo.h" #include "src/utils/SkShaderUtils.h" namespace skgpu::graphite { GraphicsPipeline::GraphicsPipeline(const SharedContext* sharedContext, const PipelineInfo& pipelineInfo) : Resource(sharedContext, Ownership::kOwned, skgpu::Budgeted::kYes, /*gpuMemorySize=*/0) , fPipelineInfo(pipelineInfo) {} GraphicsPipeline::~GraphicsPipeline() = default; GraphicsPipeline::PipelineInfo::PipelineInfo( const ShaderInfo& shaderInfo, SkEnumBitMask pipelineCreationFlags) : fDstReadReq(shaderInfo.dstReadRequirement()) , fNumFragTexturesAndSamplers(shaderInfo.numFragmentTexturesAndSamplers()) , fHasPaintUniforms(shaderInfo.hasPaintUniforms()) , fHasStepUniforms(shaderInfo.hasStepUniforms()) , fHasGradientBuffer(shaderInfo.hasGradientBuffer()) { #if defined(GPU_TEST_UTILS) fSkSLVertexShader = SkShaderUtils::PrettyPrint(shaderInfo.vertexSkSL()); fSkSLFragmentShader = SkShaderUtils::PrettyPrint(shaderInfo.fragmentSkSL()); fLabel = shaderInfo.fsLabel(); #endif #if SK_HISTOGRAMS_ENABLED fFromPrecompile = SkToBool(pipelineCreationFlags & PipelineCreationFlags::kForPrecompilation); #endif } } // namespace skgpu::graphite