#include "src/gpu/graphite/ContextUtils.h"
#include <string>
#include "src/core/SkBlenderBase.h"
#include "src/gpu/BlendFormula.h"
#include "src/gpu/graphite/Caps.h"
#include "src/gpu/graphite/GraphicsPipelineDesc.h"
#include "src/gpu/graphite/KeyContext.h"
#include "src/gpu/graphite/PaintParams.h"
#include "src/gpu/graphite/PipelineData.h"
#include "src/gpu/graphite/RecorderPriv.h"
#include "src/gpu/graphite/RenderPassDesc.h"
#include "src/gpu/graphite/Renderer.h"
#include "src/gpu/graphite/ResourceProvider.h"
#include "src/gpu/graphite/ShaderCodeDictionary.h"
#include "src/gpu/graphite/UniformManager.h"
#include "src/gpu/graphite/UniquePaintParamsID.h"
#include "src/gpu/graphite/compute/ComputeStep.h"
#include "src/gpu/graphite/geom/Geometry.h"
#include "src/sksl/SkSLString.h"
#include "src/sksl/SkSLUtil.h"
namespace skgpu::graphite {
std::tuple<UniquePaintParamsID, const UniformDataBlock*, const TextureDataBlock*> ExtractPaintData(
Recorder* recorder,
PipelineDataGatherer* gatherer,
PaintParamsKeyBuilder* builder,
const Layout layout,
const SkM44& local2Dev,
const PaintParams& p,
const Geometry& geometry,
sk_sp<TextureProxy> dstTexture,
SkIPoint dstOffset,
const SkColorInfo& targetColorInfo) { … }
std::tuple<const UniformDataBlock*, const TextureDataBlock*> ExtractRenderStepData(
UniformDataCache* uniformDataCache,
TextureDataCache* textureDataCache,
PipelineDataGatherer* gatherer,
const Layout layout,
const RenderStep* step,
const DrawParams& params) { … }
DstReadRequirement GetDstReadRequirement(const Caps* caps,
std::optional<SkBlendMode> blendMode,
Coverage coverage) { … }
namespace {
std::string get_uniform_header(int bufferID, const char* name) { … }
std::string get_uniforms(UniformOffsetCalculator* offsetter,
SkSpan<const Uniform> uniforms,
int manglingSuffix,
bool* wrotePaintColor) { … }
std::string get_node_uniforms(UniformOffsetCalculator* offsetter,
const ShaderNode* node,
bool* wrotePaintColor) { … }
std::string get_ssbo_fields(SkSpan<const Uniform> uniforms,
int manglingSuffix,
bool* wrotePaintColor) { … }
std::string get_node_ssbo_fields(const ShaderNode* node, bool* wrotePaintColor) { … }
std::string get_node_texture_samplers(const ResourceBindingRequirements& bindingReqs,
const ShaderNode* node,
int* binding) { … }
}
std::string EmitPaintParamsUniforms(int bufferID,
const Layout layout,
SkSpan<const ShaderNode*> nodes,
bool* hasUniforms,
bool* wrotePaintColor) { … }
std::string EmitRenderStepUniforms(int bufferID,
const Layout layout,
SkSpan<const Uniform> uniforms) { … }
std::string EmitPaintParamsStorageBuffer(
int bufferID,
SkSpan<const ShaderNode*> nodes,
bool* hasUniforms,
bool* wrotePaintColor) { … }
std::string EmitRenderStepStorageBuffer(
int bufferID,
SkSpan<const Uniform> uniforms) { … }
std::string EmitUniformsFromStorageBuffer(const char* bufferNamePrefix,
const char* ssboIndex,
SkSpan<const Uniform> uniforms) { … }
std::string EmitStorageBufferAccess(const char* bufferNamePrefix,
const char* ssboIndex,
const char* uniformName) { … }
std::string EmitTexturesAndSamplers(const ResourceBindingRequirements& bindingReqs,
SkSpan<const ShaderNode*> nodes,
int* binding) { … }
std::string EmitSamplerLayout(const ResourceBindingRequirements& bindingReqs, int* binding) { … }
namespace {
std::string emit_attributes(SkSpan<const Attribute> vertexAttrs,
SkSpan<const Attribute> instanceAttrs) { … }
}
std::string EmitVaryings(const RenderStep* step,
const char* direction,
bool emitSsboIndicesVarying,
bool emitLocalCoordsVarying) { … }
VertSkSLInfo BuildVertexSkSL(const ResourceBindingRequirements& bindingReqs,
const RenderStep* step,
bool useStorageBuffers,
bool defineLocalCoordsVarying) { … }
FragSkSLInfo BuildFragmentSkSL(const Caps* caps,
const ShaderCodeDictionary* dict,
const RuntimeEffectDictionary* rteDict,
const RenderStep* step,
UniquePaintParamsID paintID,
bool useStorageBuffers,
skgpu::Swizzle writeSwizzle) { … }
std::string GetPipelineLabel(const ShaderCodeDictionary* dict,
const RenderPassDesc& renderPassDesc,
const RenderStep* renderStep,
UniquePaintParamsID paintID) { … }
std::string BuildComputeSkSL(const Caps* caps, const ComputeStep* step) { … }
}