Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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 551 of file GrGeometryProcessor.cpp.

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

◆ begin()

AttributeSet::Iter AttributeSet::begin ( ) const

Definition at line 577 of file GrGeometryProcessor.cpp.

577{ 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 578 of file GrGeometryProcessor.cpp.

578{ return Iter(); }

◆ initExplicit()

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

Definition at line 537 of file GrGeometryProcessor.cpp.

537 {
538 fAttributes = attrs;
539 fRawCount = count;
540 fCount = count;
541 fStride = stride;
542 SkASSERT(Attribute::AlignOffset(fStride) == fStride);
543 for (int i = 0; i < count; ++i) {
544 SkASSERT(attrs[i].isInitialized());
545 SkASSERT(attrs[i].offset().has_value());
546 SkASSERT(Attribute::AlignOffset(*attrs[i].offset()) == *attrs[i].offset());
547 SkASSERT(*attrs[i].offset() + attrs[i].size() <= fStride);
548 }
549}
#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 524 of file GrGeometryProcessor.cpp.

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

◆ 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: