Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Friends | List of all members
GrProgramDesc Class Reference

#include <GrProgramDesc.h>

Public Member Functions

 GrProgramDesc (const GrProgramDesc &other)=default
 
GrProgramDescoperator= (const GrProgramDesc &other)=default
 
bool isValid () const
 
void reset ()
 
const uint32_t * asKey () const
 
uint32_t keyLength () const
 
bool operator== (const GrProgramDesc &that) const
 
bool operator!= (const GrProgramDesc &other) const
 
uint32_t initialKeyLength () const
 

Static Public Member Functions

static SkString Describe (const GrProgramInfo &, const GrCaps &)
 

Protected Types

enum  { kHeaderSize = 1 , kMaxPreallocProcessors = 8 , kIntsPerProcessor = 4 , kPreAllocSize }
 
using KeyType = skia_private::STArray< kPreAllocSize, uint32_t, true >
 

Protected Member Functions

 GrProgramDesc ()
 
KeyTypekey ()
 

Static Protected Member Functions

static void Build (GrProgramDesc *, const GrProgramInfo &, const GrCaps &)
 
static bool BuildFromData (GrProgramDesc *desc, const void *keyData, size_t keyLength)
 

Friends

class GrDawnCaps
 
class GrD3DCaps
 
class GrGLCaps
 
class GrMockCaps
 
class GrMtlCaps
 
class GrVkCaps
 
class GrGLGpu
 
class GrMtlResourceProvider
 

Detailed Description

This class is used to generate a generic program cache key. The Dawn, Metal and Vulkan backends derive backend-specific versions which add additional information.

Definition at line 26 of file GrProgramDesc.h.

Member Typedef Documentation

◆ KeyType

Definition at line 99 of file GrProgramDesc.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected
Enumerator
kHeaderSize 
kMaxPreallocProcessors 
kIntsPerProcessor 
kPreAllocSize 

Definition at line 91 of file GrProgramDesc.h.

91 {
92 kHeaderSize = 1, // "header" in ::Build
94 kIntsPerProcessor = 4, // This is an overestimate of the average effect key size.
97 };

Constructor & Destructor Documentation

◆ GrProgramDesc() [1/2]

GrProgramDesc::GrProgramDesc ( const GrProgramDesc other)
default

◆ GrProgramDesc() [2/2]

GrProgramDesc::GrProgramDesc ( )
inlineprotected

Definition at line 70 of file GrProgramDesc.h.

70{}

Member Function Documentation

◆ asKey()

const uint32_t * GrProgramDesc::asKey ( ) const
inline

Definition at line 35 of file GrProgramDesc.h.

35 {
36 return fKey.data();
37 }

◆ Build()

void GrProgramDesc::Build ( GrProgramDesc desc,
const GrProgramInfo programInfo,
const GrCaps caps 
)
staticprotected

Builds a program descriptor.

Parameters
descThe built descriptor
programInfoProgram information need to build the key
capsthe caps

Definition at line 176 of file GrProgramDesc.cpp.

178 {
179 desc->reset();
180 skgpu::KeyBuilder b(desc->key());
181 gen_key(&b, programInfo, caps);
182 desc->fInitialKeyLength = desc->keyLength();
183}
static void gen_key(skgpu::KeyBuilder *b, const GrProgramInfo &programInfo, const GrCaps &caps)
static bool b

◆ BuildFromData()

static bool GrProgramDesc::BuildFromData ( GrProgramDesc desc,
const void *  keyData,
size_t  keyLength 
)
inlinestaticprotected

Definition at line 82 of file GrProgramDesc.h.

82 {
83 if (!SkTFitsIn<int>(keyLength) || !SkIsAlign4(keyLength)) {
84 return false;
85 }
86 desc->fKey.reset(SkToInt(keyLength / 4));
87 memcpy(desc->fKey.begin(), keyData, keyLength);
88 return true;
89 }
static constexpr bool SkIsAlign4(T x)
Definition: SkAlign.h:20
constexpr int SkToInt(S x)
Definition: SkTo.h:29
uint32_t keyLength() const
Definition: GrProgramDesc.h:40

◆ Describe()

SkString GrProgramDesc::Describe ( const GrProgramInfo programInfo,
const GrCaps caps 
)
static

Definition at line 185 of file GrProgramDesc.cpp.

186 {
189 gen_key(&b, programInfo, caps);
190 b.flush();
191 return b.description();
192}

◆ initialKeyLength()

uint32_t GrProgramDesc::initialKeyLength ( ) const
inline

Definition at line 52 of file GrProgramDesc.h.

52{ return fInitialKeyLength; }

◆ isValid()

bool GrProgramDesc::isValid ( ) const
inline

Definition at line 31 of file GrProgramDesc.h.

31{ return !fKey.empty(); }
bool empty() const
Definition: SkTArray.h:199

◆ key()

KeyType * GrProgramDesc::key ( )
inlineprotected

Definition at line 101 of file GrProgramDesc.h.

101{ return &fKey; }

◆ keyLength()

uint32_t GrProgramDesc::keyLength ( ) const
inline

Definition at line 40 of file GrProgramDesc.h.

40 {
41 return SkToU32(fKey.size() * sizeof(uint32_t));
42 }
constexpr uint32_t SkToU32(S x)
Definition: SkTo.h:26
int size() const
Definition: SkTArray.h:421

◆ operator!=()

bool GrProgramDesc::operator!= ( const GrProgramDesc other) const
inline

Definition at line 48 of file GrProgramDesc.h.

48 {
49 return !(*this == other);
50 }

◆ operator=()

GrProgramDesc & GrProgramDesc::operator= ( const GrProgramDesc other)
default

◆ operator==()

bool GrProgramDesc::operator== ( const GrProgramDesc that) const
inline

Definition at line 44 of file GrProgramDesc.h.

44 {
45 return this->fKey == that.fKey;
46 }

◆ reset()

void GrProgramDesc::reset ( )
inline

Definition at line 32 of file GrProgramDesc.h.

32{ *this = GrProgramDesc{}; }

Friends And Related Function Documentation

◆ GrD3DCaps

friend class GrD3DCaps
friend

Definition at line 60 of file GrProgramDesc.h.

◆ GrDawnCaps

friend class GrDawnCaps
friend

Definition at line 59 of file GrProgramDesc.h.

◆ GrGLCaps

friend class GrGLCaps
friend

Definition at line 61 of file GrProgramDesc.h.

◆ GrGLGpu

friend class GrGLGpu
friend

Definition at line 66 of file GrProgramDesc.h.

◆ GrMockCaps

friend class GrMockCaps
friend

Definition at line 62 of file GrProgramDesc.h.

◆ GrMtlCaps

friend class GrMtlCaps
friend

Definition at line 63 of file GrProgramDesc.h.

◆ GrMtlResourceProvider

friend class GrMtlResourceProvider
friend

Definition at line 67 of file GrProgramDesc.h.

◆ GrVkCaps

friend class GrVkCaps
friend

Definition at line 64 of file GrProgramDesc.h.


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