8#ifndef skgpu_graphite_Renderer_DEFINED
9#define skgpu_graphite_Renderer_DEFINED
22#include <initializer_list>
35class PipelineDataGatherer;
38class TextureDataBlock;
41struct ResourceBindingRequirements;
97 int* nextBindingIndex)
const {
116 const char*
name()
const {
return fName.c_str(); }
167 kRequiresMSAA = 0b0000001,
168 kPerformsShading = 0b0000010,
169 kHasTextures = 0b0000100,
170 kEmitsCoverage = 0b0001000,
171 kLCDCoverage = 0b0010000,
172 kEmitsPrimitiveColor = 0b0100000,
173 kOutsetBoundsForAA = 0b1000000,
181 std::string_view variantName,
183 std::initializer_list<Uniform>
uniforms,
211 std::vector<Uniform> fUniforms;
212 std::vector<Attribute> fVertexAttrs;
213 std::vector<Attribute> fInstanceAttrs;
214 std::vector<Varying> fVaryings;
216 size_t fVertexStride;
217 size_t fInstanceStride;
227 static constexpr int kMaxRenderSteps = 4;
235 return {fSteps.data(),
static_cast<size_t>(fStepCount) };
243 return SkToBool(fStepFlags & StepFlags::kRequiresMSAA);
246 return SkToBool(fStepFlags & StepFlags::kEmitsPrimitiveColor);
249 return SkToBool(fStepFlags & StepFlags::kOutsetBoundsForAA);
264 const RenderStep* s1,
const RenderStep* s2)
265 : Renderer(
name, drawTypes,
std::array<const RenderStep*, 2>{s1, s2}) {}
268 const RenderStep* s1,
const RenderStep* s2,
const RenderStep* s3)
269 : Renderer(
name, drawTypes,
std::array<const RenderStep*, 3>{s1, s2, s3}) {}
272 const RenderStep* s1,
const RenderStep* s2,
const RenderStep* s3,
const RenderStep* s4)
273 : Renderer(
name, drawTypes,
std::array<const RenderStep*, 4>{s1, s2, s3, s4}) {}
276 Renderer(std::string_view
name,
DrawTypeFlags drawTypes, std::array<const RenderStep*, N> steps)
278 , fDrawTypes(drawTypes)
280 static_assert(
N <= kMaxRenderSteps);
281 for (
int i = 0 ;
i < fStepCount; ++
i) {
282 fSteps[
i] = steps[
i];
283 fStepFlags |= fSteps[
i]->fFlags;
284 fDepthStencilFlags |= fSteps[
i]->depthStencilFlags();
292 Renderer() : fSteps(),
fName(
""), fStepCount(0) {}
293 Renderer& operator=(Renderer&&) =
default;
295 std::array<const RenderStep*, kMaxRenderSteps> fSteps;
#define SK_DECL_BITMASK_OPS_FRIENDS(E)
SkSpan(Container &&) -> SkSpan< std::remove_pointer_t< decltype(std::data(std::declval< Container >()))> >
static constexpr bool SkToBool(const T &x)
size_t vertexStride() const
virtual ~RenderStep()=default
SkSpan< const Attribute > instanceAttributes() const
PrimitiveType primitiveType() const
bool emitsPrimitiveColor() const
static const char * ssboIndicesAttribute()
virtual const char * fragmentColorSkSL() const
virtual std::string vertexSkSL() const =0
size_t numUniforms() const
SkSpan< const Attribute > vertexAttributes() const
virtual std::string texturesAndSamplersSkSL(const ResourceBindingRequirements &, int *nextBindingIndex) const
virtual void writeVertices(DrawWriter *, const DrawParams &, skvx::ushort2 ssboIndices) const =0
Coverage coverage() const
const char * name() const
size_t numInstanceAttributes() const
bool outsetBoundsForAA() const
SkEnumBitMask< DepthStencilFlags > depthStencilFlags() const
static const char * ssboIndicesVarying()
size_t instanceStride() const
uint32_t uniqueID() const
virtual void writeUniformsAndTextures(const DrawParams &, PipelineDataGatherer *) const =0
SkSpan< const Varying > varyings() const
bool performsShading() const
SkSpan< const Uniform > uniforms() const
size_t numVertexAttributes() const
RenderStep(std::string_view className, std::string_view variantName, SkEnumBitMask< Flags > flags, std::initializer_list< Uniform > uniforms, PrimitiveType primitiveType, DepthStencilSettings depthStencilSettings, SkSpan< const Attribute > vertexAttrs, SkSpan< const Attribute > instanceAttrs, SkSpan< const Varying > varyings={})
bool requiresMSAA() const
virtual const char * fragmentCoverageSkSL() const
const DepthStencilSettings & depthStencilSettings() const
SkEnumBitMask< DepthStencilFlags > depthStencilFlags() const
bool requiresMSAA() const
const RenderStep & step(int i) const
Coverage coverage() const
int numRenderSteps() const
SkSpan< const RenderStep *const > steps() const
const char * name() const
bool emitsPrimitiveColor() const
DrawTypeFlags drawTypes() const
bool outsetBoundsForAA() const
FlutterSemanticsFlag flags
DEF_SWITCHES_START aot vmservice shared library name
SK_MAKE_BITMASK_OPS(DawnErrorType)
skgpu::graphite::Transform Transform