Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | Protected Member Functions | List of all members
GrGLSLProgramDataManager Class Referenceabstract

#include <GrGLSLProgramDataManager.h>

Inheritance diagram for GrGLSLProgramDataManager:
GrGLProgramDataManager GrUniformDataManager GrD3DPipelineStateDataManager GrMtlPipelineStateDataManager GrVkPipelineStateDataManager

Public Types

enum class  Specialized : bool { kNo = false , kYes = true }
 

Public Member Functions

virtual ~GrGLSLProgramDataManager ()
 
virtual void set1i (UniformHandle, int32_t) const =0
 
virtual void set1iv (UniformHandle, int arrayCount, const int v[]) const =0
 
virtual void set1f (UniformHandle, float v0) const =0
 
virtual void set1fv (UniformHandle, int arrayCount, const float v[]) const =0
 
virtual void set2i (UniformHandle, int32_t, int32_t) const =0
 
virtual void set2iv (UniformHandle, int arrayCount, const int v[]) const =0
 
virtual void set2f (UniformHandle, float, float) const =0
 
virtual void set2fv (UniformHandle, int arrayCount, const float v[]) const =0
 
virtual void set3i (UniformHandle, int32_t, int32_t, int32_t) const =0
 
virtual void set3iv (UniformHandle, int arrayCount, const int v[]) const =0
 
virtual void set3f (UniformHandle, float, float, float) const =0
 
virtual void set3fv (UniformHandle, int arrayCount, const float v[]) const =0
 
virtual void set4i (UniformHandle, int32_t, int32_t, int32_t, int32_t) const =0
 
virtual void set4iv (UniformHandle, int arrayCount, const int v[]) const =0
 
virtual void set4f (UniformHandle, float, float, float, float) const =0
 
virtual void set4fv (UniformHandle, int arrayCount, const float v[]) const =0
 
virtual void setMatrix2f (UniformHandle, const float matrix[]) const =0
 
virtual void setMatrix3f (UniformHandle, const float matrix[]) const =0
 
virtual void setMatrix4f (UniformHandle, const float matrix[]) const =0
 
virtual void setMatrix2fv (UniformHandle, int arrayCount, const float matrices[]) const =0
 
virtual void setMatrix3fv (UniformHandle, int arrayCount, const float matrices[]) const =0
 
virtual void setMatrix4fv (UniformHandle, int arrayCount, const float matrices[]) const =0
 
void setSkMatrix (UniformHandle, const SkMatrix &) const
 
void setSkM44 (UniformHandle, const SkM44 &) const
 
void setRuntimeEffectUniforms (SkSpan< const SkRuntimeEffect::Uniform >, SkSpan< const UniformHandle >, SkSpan< const Specialized >, const void *src) const
 
void setRuntimeEffectUniforms (SkSpan< const SkRuntimeEffect::Uniform > uniforms, SkSpan< const UniformHandle > handles, const void *src) const
 

Protected Member Functions

 GrGLSLProgramDataManager ()
 

Detailed Description

Manages the resources used by a shader program. The resources are objects the program uses to communicate with the application code.

Definition at line 26 of file GrGLSLProgramDataManager.h.

Member Enumeration Documentation

◆ Specialized

enum class GrGLSLProgramDataManager::Specialized : bool
strong
Enumerator
kNo 
kYes 

Definition at line 65 of file GrGLSLProgramDataManager.h.

65: bool { kNo = false, kYes = true };
@ kYes
Do pre-clip the geometry before applying the (perspective) matrix.
@ kNo
Don't pre-clip the geometry before applying the (perspective) matrix.

Constructor & Destructor Documentation

◆ ~GrGLSLProgramDataManager()

virtual GrGLSLProgramDataManager::~GrGLSLProgramDataManager ( )
inlinevirtual

Definition at line 30 of file GrGLSLProgramDataManager.h.

30{}

◆ GrGLSLProgramDataManager()

GrGLSLProgramDataManager::GrGLSLProgramDataManager ( )
inlineprotected

Definition at line 86 of file GrGLSLProgramDataManager.h.

86{}

Member Function Documentation

◆ set1f()

virtual void GrGLSLProgramDataManager::set1f ( UniformHandle  ,
float  v0 
) const
pure virtual

◆ set1fv()

virtual void GrGLSLProgramDataManager::set1fv ( UniformHandle  ,
int  arrayCount,
const float  v[] 
) const
pure virtual

◆ set1i()

virtual void GrGLSLProgramDataManager::set1i ( UniformHandle  ,
int32_t   
) const
pure virtual

Functions for uploading uniform values. The varities ending in v can be used to upload to an array of uniforms. arrayCount must be <= the array count of the uniform.

Implemented in GrGLProgramDataManager, and GrUniformDataManager.

◆ set1iv()

virtual void GrGLSLProgramDataManager::set1iv ( UniformHandle  ,
int  arrayCount,
const int  v[] 
) const
pure virtual

◆ set2f()

virtual void GrGLSLProgramDataManager::set2f ( UniformHandle  ,
float  ,
float   
) const
pure virtual

◆ set2fv()

virtual void GrGLSLProgramDataManager::set2fv ( UniformHandle  ,
int  arrayCount,
const float  v[] 
) const
pure virtual

◆ set2i()

virtual void GrGLSLProgramDataManager::set2i ( UniformHandle  ,
int32_t  ,
int32_t   
) const
pure virtual

◆ set2iv()

virtual void GrGLSLProgramDataManager::set2iv ( UniformHandle  ,
int  arrayCount,
const int  v[] 
) const
pure virtual

◆ set3f()

virtual void GrGLSLProgramDataManager::set3f ( UniformHandle  ,
float  ,
float  ,
float   
) const
pure virtual

◆ set3fv()

virtual void GrGLSLProgramDataManager::set3fv ( UniformHandle  ,
int  arrayCount,
const float  v[] 
) const
pure virtual

◆ set3i()

virtual void GrGLSLProgramDataManager::set3i ( UniformHandle  ,
int32_t  ,
int32_t  ,
int32_t   
) const
pure virtual

◆ set3iv()

virtual void GrGLSLProgramDataManager::set3iv ( UniformHandle  ,
int  arrayCount,
const int  v[] 
) const
pure virtual

◆ set4f()

virtual void GrGLSLProgramDataManager::set4f ( UniformHandle  ,
float  ,
float  ,
float  ,
float   
) const
pure virtual

◆ set4fv()

virtual void GrGLSLProgramDataManager::set4fv ( UniformHandle  ,
int  arrayCount,
const float  v[] 
) const
pure virtual

◆ set4i()

virtual void GrGLSLProgramDataManager::set4i ( UniformHandle  ,
int32_t  ,
int32_t  ,
int32_t  ,
int32_t   
) const
pure virtual

◆ set4iv()

virtual void GrGLSLProgramDataManager::set4iv ( UniformHandle  ,
int  arrayCount,
const int  v[] 
) const
pure virtual

◆ setMatrix2f()

virtual void GrGLSLProgramDataManager::setMatrix2f ( UniformHandle  ,
const float  matrix[] 
) const
pure virtual

◆ setMatrix2fv()

virtual void GrGLSLProgramDataManager::setMatrix2fv ( UniformHandle  ,
int  arrayCount,
const float  matrices[] 
) const
pure virtual

◆ setMatrix3f()

virtual void GrGLSLProgramDataManager::setMatrix3f ( UniformHandle  ,
const float  matrix[] 
) const
pure virtual

◆ setMatrix3fv()

virtual void GrGLSLProgramDataManager::setMatrix3fv ( UniformHandle  ,
int  arrayCount,
const float  matrices[] 
) const
pure virtual

◆ setMatrix4f()

virtual void GrGLSLProgramDataManager::setMatrix4f ( UniformHandle  ,
const float  matrix[] 
) const
pure virtual

◆ setMatrix4fv()

virtual void GrGLSLProgramDataManager::setMatrix4fv ( UniformHandle  ,
int  arrayCount,
const float  matrices[] 
) const
pure virtual

◆ setRuntimeEffectUniforms() [1/2]

void GrGLSLProgramDataManager::setRuntimeEffectUniforms ( SkSpan< const SkRuntimeEffect::Uniform uniforms,
SkSpan< const UniformHandle >  handles,
const void *  src 
) const
inline

Definition at line 79 of file GrGLSLProgramDataManager.h.

81 {
82 this->setRuntimeEffectUniforms(uniforms, handles, {}, src);
83 }
void setRuntimeEffectUniforms(SkSpan< const SkRuntimeEffect::Uniform >, SkSpan< const UniformHandle >, SkSpan< const Specialized >, const void *src) const

◆ setRuntimeEffectUniforms() [2/2]

void GrGLSLProgramDataManager::setRuntimeEffectUniforms ( SkSpan< const SkRuntimeEffect::Uniform uniforms,
SkSpan< const UniformHandle >  handles,
SkSpan< const Specialized specialized,
const void *  src 
) const

Sets runtime effect uniform values. The Specialized span is optional. If it is non-empty then it should be the same size as the Uniform span. Uniforms for which the Specialized value is kYes will be skipped and the UniformHandle span should have an entry for each kNo value. If Specialized is empty then the Uniform and UniformHandle spans should have the same size.

Definition at line 35 of file GrGLSLProgramDataManager.cpp.

39 {
40 SkASSERT(uniforms.empty() || src);
41 SkASSERT(specialized.empty() || specialized.size() == uniforms.size());
42 SkASSERT(!specialized.empty() || handles.size() == uniforms.size());
43
45 size_t handleIdx = 0;
46 for (size_t uniformIdx = 0; uniformIdx < uniforms.size(); ++uniformIdx) {
47 const auto& u = uniforms[uniformIdx];
48 auto floatData = [=] { return SkTAddOffset<const float>(src, u.offset); };
49 auto intData = [=] { return SkTAddOffset<const int >(src, u.offset); };
50 if (!specialized.empty() && specialized[uniformIdx] == Specialized::kYes) {
51 continue;
52 }
53 const auto h = handles[handleIdx++];
54 switch (u.type) {
55 case Type::kFloat: this->set1fv(h, u.count, floatData()); break;
56 case Type::kFloat2: this->set2fv(h, u.count, floatData()); break;
57 case Type::kFloat3: this->set3fv(h, u.count, floatData()); break;
58 case Type::kFloat4: this->set4fv(h, u.count, floatData()); break;
59
60 case Type::kFloat2x2: this->setMatrix2fv(h, u.count, floatData()); break;
61 case Type::kFloat3x3: this->setMatrix3fv(h, u.count, floatData()); break;
62 case Type::kFloat4x4: this->setMatrix4fv(h, u.count, floatData()); break;
63
64 case Type::kInt: this->set1iv(h, u.count, intData()); break;
65 case Type::kInt2: this->set2iv(h, u.count, intData()); break;
66 case Type::kInt3: this->set3iv(h, u.count, intData()); break;
67 case Type::kInt4: this->set4iv(h, u.count, intData()); break;
68
69 default:
70 SkDEBUGFAIL("Unsupported uniform type");
71 break;
72 }
73 }
74 SkASSERT(handleIdx == handles.size());
75}
#define SkDEBUGFAIL(message)
Definition: SkAssert.h:118
#define SkASSERT(cond)
Definition: SkAssert.h:116
virtual void set4fv(UniformHandle, int arrayCount, const float v[]) const =0
virtual void set3fv(UniformHandle, int arrayCount, const float v[]) const =0
virtual void setMatrix4fv(UniformHandle, int arrayCount, const float matrices[]) const =0
virtual void set1fv(UniformHandle, int arrayCount, const float v[]) const =0
virtual void set4iv(UniformHandle, int arrayCount, const int v[]) const =0
virtual void set1iv(UniformHandle, int arrayCount, const int v[]) const =0
virtual void set2fv(UniformHandle, int arrayCount, const float v[]) const =0
virtual void setMatrix3fv(UniformHandle, int arrayCount, const float matrices[]) const =0
virtual void set3iv(UniformHandle, int arrayCount, const int v[]) const =0
virtual void set2iv(UniformHandle, int arrayCount, const int v[]) const =0
virtual void setMatrix2fv(UniformHandle, int arrayCount, const float matrices[]) const =0
constexpr bool empty() const
Definition: SkSpan_impl.h:96
constexpr size_t size() const
Definition: SkSpan_impl.h:95
SkScalar h

◆ setSkM44()

void GrGLSLProgramDataManager::setSkM44 ( UniformHandle  u,
const SkM44 matrix 
) const

Definition at line 31 of file GrGLSLProgramDataManager.cpp.

31 {
33}
virtual void setMatrix4f(UniformHandle, const float matrix[]) const =0
static const SkScalar * M44ColMajor(const SkM44 &m)
Definition: SkMatrixPriv.h:185
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258

◆ setSkMatrix()

void GrGLSLProgramDataManager::setSkMatrix ( UniformHandle  u,
const SkMatrix matrix 
) const

Definition at line 16 of file GrGLSLProgramDataManager.cpp.

16 {
17 float mt[] = {
27 };
28 this->setMatrix3f(u, mt);
29}
virtual void setMatrix3f(UniformHandle, const float matrix[]) const =0
static constexpr int kMScaleX
horizontal scale factor
Definition: SkMatrix.h:353
static constexpr int kMTransY
vertical translation
Definition: SkMatrix.h:358
static constexpr int kMPersp1
input y perspective factor
Definition: SkMatrix.h:360
static constexpr int kMPersp0
input x perspective factor
Definition: SkMatrix.h:359
static constexpr int kMPersp2
perspective bias
Definition: SkMatrix.h:361
static constexpr int kMTransX
horizontal translation
Definition: SkMatrix.h:355
static constexpr int kMSkewY
vertical skew factor
Definition: SkMatrix.h:356
static constexpr int kMScaleY
vertical scale factor
Definition: SkMatrix.h:357
static constexpr int kMSkewX
horizontal skew factor
Definition: SkMatrix.h:354

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