Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | Static Public Member Functions | List of all members
SkSL::SampleUsage Class Reference

#include <SkSLSampleUsage.h>

Public Types

enum class  Kind {
  kNone , kPassThrough , kUniformMatrix , kFragCoord ,
  kExplicit
}
 

Public Member Functions

 SampleUsage ()=default
 
 SampleUsage (Kind kind, bool hasPerspective)
 
bool operator== (const SampleUsage &that) const
 
bool operator!= (const SampleUsage &that) const
 
SampleUsage merge (const SampleUsage &other)
 
Kind kind () const
 
bool hasPerspective () const
 
bool isSampled () const
 
bool isPassThrough () const
 
bool isExplicit () const
 
bool isUniformMatrix () const
 
bool isFragCoord () const
 

Static Public Member Functions

static SampleUsage UniformMatrix (bool hasPerspective)
 
static SampleUsage Explicit ()
 
static SampleUsage PassThrough ()
 
static SampleUsage FragCoord ()
 
static const char * MatrixUniformName ()
 

Detailed Description

Represents all of the ways that a fragment processor is sampled by its parent.

Definition at line 18 of file SkSLSampleUsage.h.

Member Enumeration Documentation

◆ Kind

enum class SkSL::SampleUsage::Kind
strong
Enumerator
kNone 
kPassThrough 
kUniformMatrix 
kFragCoord 
kExplicit 

Definition at line 20 of file SkSLSampleUsage.h.

20 {
21 // Child is never sampled
22 kNone,
23 // Child is only sampled at the same coordinates as the parent
24 kPassThrough,
25 // Child is sampled with a matrix whose value is uniform
26 kUniformMatrix,
27 // Child is sampled with sk_FragCoord.xy
28 kFragCoord,
29 // Child is sampled using explicit coordinates
30 kExplicit,
31 };
@ kNone
Definition: layer.h:53

Constructor & Destructor Documentation

◆ SampleUsage() [1/2]

SkSL::SampleUsage::SampleUsage ( )
default

◆ SampleUsage() [2/2]

SkSL::SampleUsage::SampleUsage ( Kind  kind,
bool  hasPerspective 
)
inline

Definition at line 36 of file SkSLSampleUsage.h.

36 : fKind(kind), fHasPerspective(hasPerspective) {
38 SkASSERT(!fHasPerspective);
39 }
40 }
#define SkASSERT(cond)
Definition: SkAssert.h:116
bool hasPerspective() const
Kind kind() const

Member Function Documentation

◆ Explicit()

static SampleUsage SkSL::SampleUsage::Explicit ( )
inlinestatic

Definition at line 47 of file SkSLSampleUsage.h.

47 {
48 return SampleUsage(Kind::kExplicit, false);
49 }
SampleUsage()=default

◆ FragCoord()

static SampleUsage SkSL::SampleUsage::FragCoord ( )
inlinestatic

Definition at line 55 of file SkSLSampleUsage.h.

◆ hasPerspective()

bool SkSL::SampleUsage::hasPerspective ( ) const
inline

Definition at line 70 of file SkSLSampleUsage.h.

70{ return fHasPerspective; }

◆ isExplicit()

bool SkSL::SampleUsage::isExplicit ( ) const
inline

Definition at line 74 of file SkSLSampleUsage.h.

74{ return fKind == Kind::kExplicit; }

◆ isFragCoord()

bool SkSL::SampleUsage::isFragCoord ( ) const
inline

Definition at line 76 of file SkSLSampleUsage.h.

76{ return fKind == Kind::kFragCoord; }

◆ isPassThrough()

bool SkSL::SampleUsage::isPassThrough ( ) const
inline

Definition at line 73 of file SkSLSampleUsage.h.

73{ return fKind == Kind::kPassThrough; }

◆ isSampled()

bool SkSL::SampleUsage::isSampled ( ) const
inline

Definition at line 72 of file SkSLSampleUsage.h.

72{ return fKind != Kind::kNone; }

◆ isUniformMatrix()

bool SkSL::SampleUsage::isUniformMatrix ( ) const
inline

Definition at line 75 of file SkSLSampleUsage.h.

75{ return fKind == Kind::kUniformMatrix; }

◆ kind()

Kind SkSL::SampleUsage::kind ( ) const
inline

Definition at line 68 of file SkSLSampleUsage.h.

68{ return fKind; }

◆ MatrixUniformName()

static const char * SkSL::SampleUsage::MatrixUniformName ( )
inlinestatic

Definition at line 64 of file SkSLSampleUsage.h.

64{ return "matrix"; }

◆ merge()

SampleUsage SkSL::SampleUsage::merge ( const SampleUsage other)

Definition at line 14 of file SkSLSampleUsage.cpp.

14 {
15 // This function is only used in Analysis::MergeSampleUsageVisitor to determine the combined
16 // SampleUsage for a child fp/shader/etc. We should never see matrix sampling here.
17 SkASSERT(fKind != Kind::kUniformMatrix && other.fKind != Kind::kUniformMatrix);
18
19 static_assert(Kind::kExplicit > Kind::kPassThrough);
20 static_assert(Kind::kPassThrough > Kind::kNone);
21 fKind = std::max(fKind, other.fKind);
22
23 return *this;
24}
static float max(float r, float g, float b)
Definition: hsl.cpp:49

◆ operator!=()

bool SkSL::SampleUsage::operator!= ( const SampleUsage that) const
inline

Definition at line 61 of file SkSLSampleUsage.h.

61{ return !(*this == that); }

◆ operator==()

bool SkSL::SampleUsage::operator== ( const SampleUsage that) const
inline

Definition at line 57 of file SkSLSampleUsage.h.

57 {
58 return fKind == that.fKind && fHasPerspective == that.fHasPerspective;
59 }

◆ PassThrough()

static SampleUsage SkSL::SampleUsage::PassThrough ( )
inlinestatic

Definition at line 51 of file SkSLSampleUsage.h.

51 {
52 return SampleUsage(Kind::kPassThrough, false);
53 }

◆ UniformMatrix()

static SampleUsage SkSL::SampleUsage::UniformMatrix ( bool  hasPerspective)
inlinestatic

Definition at line 43 of file SkSLSampleUsage.h.


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