/* * Copyright 2013 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef GrGeometryProcessor_DEFINED #define GrGeometryProcessor_DEFINED #include "include/core/SkMatrix.h" #include "include/gpu/ganesh/GrBackendSurface.h" #include "include/private/base/SkAlign.h" #include "include/private/base/SkAssert.h" #include "include/private/base/SkTo.h" #include "include/private/gpu/ganesh/GrTypesPriv.h" #include "src/core/SkSLTypeShared.h" #include "src/gpu/Swizzle.h" #include "src/gpu/ganesh/GrFragmentProcessor.h" #include "src/gpu/ganesh/GrProcessor.h" #include "src/gpu/ganesh/GrSamplerState.h" #include "src/gpu/ganesh/GrShaderCaps.h" #include "src/gpu/ganesh/GrShaderVar.h" #include "src/gpu/ganesh/glsl/GrGLSLProgramDataManager.h" #include "src/gpu/ganesh/glsl/GrGLSLUniformHandler.h" #include "src/gpu/ganesh/glsl/GrGLSLVarying.h" #include <cstddef> #include <cstdint> #include <memory> #include <optional> #include <tuple> #include <unordered_map> class GrGLSLFPFragmentBuilder; class GrGLSLVertexBuilder; class GrPipeline; namespace skgpu { class KeyBuilder; } /** * The GrGeometryProcessor represents some kind of geometric primitive. This includes the shape * of the primitive and the inherent color of the primitive. The GrGeometryProcessor is * responsible for providing a color and coverage input into the Ganesh rendering pipeline. Through * optimization, Ganesh may decide a different color, no color, and / or no coverage are required * from the GrGeometryProcessor, so the GrGeometryProcessor must be able to support this * functionality. * * There are two feedback loops between the GrFragmentProcessors, the GrXferProcessor, and the * GrGeometryProcessor. These loops run on the CPU and to determine known properties of the final * color and coverage inputs to the GrXferProcessor in order to perform optimizations that preserve * correctness. The GrDrawOp seeds these loops with initial color and coverage, in its * getProcessorAnalysisInputs implementation. These seed values are processed by the * subsequent stages of the rendering pipeline and the output is then fed back into the GrDrawOp * in the applyPipelineOptimizations call, where the op can use the information to inform * decisions about GrGeometryProcessor creation. * * Note that all derived classes should hide their constructors and provide a Make factory * function that takes an arena (except for Tesselation-specific classes). This is because * geometry processors can be created in either the record-time or flush-time arenas which * define their lifetimes (i.e., a DDLs life time in the first case and a single flush in * the second case). */ class GrGeometryProcessor : public GrProcessor { … }; ////////////////////////////////////////////////////////////////////////////// class GrGeometryProcessor::ProgramImpl { … }; /////////////////////////////////////////////////////////////////////////// /** * Used to capture the properties of the GrTextureProxies required/expected by a primitiveProcessor * along with an associated GrSamplerState. The actual proxies used are stored in either the * fixed or dynamic state arrays. TextureSamplers don't perform any coord manipulation to account * for texture origin. */ class GrGeometryProcessor::TextureSampler { … }; ////////////////////////////////////////////////////////////////////////////// /** * Returns the size of the attrib type in bytes. * This was moved from include/private/gpu/ganesh/GrTypesPriv.h in service of Skia dependents that build * with C++11. */ static constexpr inline size_t GrVertexAttribTypeSize(GrVertexAttribType type) { … } constexpr size_t GrGeometryProcessor::Attribute::size() const { … } #endif