Flutter Engine
The Flutter Engine
Classes | Public Member Functions | List of all members
GrGeometryProcessor::AttributeSet Class Reference

#include <GrGeometryProcessor.h>

Public Member Functions

Iter begin () const
 
Iter end () const
 
int count () const
 
size_t stride () const
 
void initImplicit (const Attribute *attrs, int count)
 
void initExplicit (const Attribute *attrs, int count, size_t stride)
 
void addToKey (skgpu::KeyBuilder *b) const
 

Detailed Description

A set of attributes that can iterated. The iterator handles hides two pieces of complexity: 1) It skips uninitialized attributes. 2) It always returns an attribute with a known offset.

Definition at line 134 of file GrGeometryProcessor.h.

Member Function Documentation

◆ addToKey()

void AttributeSet::addToKey ( skgpu::KeyBuilder b) const

Definition at line 549 of file GrGeometryProcessor.cpp.

549 {
550 int rawCount = SkAbs32(fRawCount);
551 b->addBits(16, SkToU16(this->stride()), "stride");
552 b->addBits(16, rawCount, "attribute count");
553 size_t implicitOffset = 0;
554 for (int i = 0; i < rawCount; ++i) {
555 const Attribute& attr = fAttributes[i];
556 b->appendComment(attr.isInitialized() ? attr.name() : "unusedAttr");
557 static_assert(kGrVertexAttribTypeCount < (1 << 8), "");
558 static_assert(kSkSLTypeCount < (1 << 8), "");
559 b->addBits(8, attr.isInitialized() ? attr.cpuType() : 0xff, "attrType");
560 b->addBits(8 , attr.isInitialized() ? static_cast<int>(attr.gpuType()) : 0xff,
561 "attrGpuType");
562 int16_t offset = -1;
563 if (attr.isInitialized()) {
564 if (attr.offset().has_value()) {
565 offset = *attr.offset();
566 } else {
567 offset = implicitOffset;
568 implicitOffset += Attribute::AlignOffset(attr.size());
569 }
570 }
571 b->addBits(16, static_cast<uint16_t>(offset), "attrOffset");
572 }
573}
static const int kGrVertexAttribTypeCount
Definition: GrTypesPriv.h:352
static const int kSkSLTypeCount
static int32_t SkAbs32(int32_t value)
Definition: SkSafe32.h:41
constexpr uint16_t SkToU16(S x)
Definition: SkTo.h:24
static constexpr size_t AlignOffset(size_t offset)
virtual void addBits(uint32_t numBits, uint32_t val, std::string_view label)
Definition: KeyBuilder.h:29
static bool b
SeparatedVector2 offset

◆ begin()

AttributeSet::Iter AttributeSet::begin ( ) const

Definition at line 575 of file GrGeometryProcessor.cpp.

575{ return Iter(fAttributes, fCount); }

◆ count()

int GrGeometryProcessor::AttributeSet::count ( ) const
inline

Definition at line 161 of file GrGeometryProcessor.h.

161{ return fCount; }

◆ end()

AttributeSet::Iter AttributeSet::end ( ) const

Definition at line 576 of file GrGeometryProcessor.cpp.

576{ return Iter(); }

◆ initExplicit()

void AttributeSet::initExplicit ( const Attribute attrs,
int  count,
size_t  stride 
)

Definition at line 535 of file GrGeometryProcessor.cpp.

535 {
536 fAttributes = attrs;
537 fRawCount = count;
538 fCount = count;
539 fStride = stride;
540 SkASSERT(Attribute::AlignOffset(fStride) == fStride);
541 for (int i = 0; i < count; ++i) {
542 SkASSERT(attrs[i].isInitialized());
543 SkASSERT(attrs[i].offset().has_value());
544 SkASSERT(Attribute::AlignOffset(*attrs[i].offset()) == *attrs[i].offset());
545 SkASSERT(*attrs[i].offset() + attrs[i].size() <= fStride);
546 }
547}
#define SkASSERT(cond)
Definition: SkAssert.h:116
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259

◆ initImplicit()

void AttributeSet::initImplicit ( const Attribute attrs,
int  count 
)

Definition at line 522 of file GrGeometryProcessor.cpp.

522 {
523 fAttributes = attrs;
524 fRawCount = count;
525 fCount = 0;
526 fStride = 0;
527 for (int i = 0; i < count; ++i) {
528 if (attrs[i].isInitialized()) {
529 fCount++;
530 fStride += Attribute::AlignOffset(attrs[i].size());
531 }
532 }
533}

◆ stride()

size_t GrGeometryProcessor::AttributeSet::stride ( ) const
inline

Definition at line 162 of file GrGeometryProcessor.h.

162{ return fStride; }

The documentation for this class was generated from the following files: