Flutter Engine
The Flutter Engine
Classes | Public Types | Public Member Functions | Static Public Attributes | Friends | List of all members
GrVkUniformHandler Class Reference

#include <GrVkUniformHandler.h>

Inheritance diagram for GrVkUniformHandler:
GrGLSLUniformHandler

Classes

struct  VkUniformInfo
 

Public Types

enum  { kUniformBufferDescSet = 0 , kSamplerDescSet = 1 , kInputDescSet = 2 , kLastDescSet = kInputDescSet }
 
enum  { kUniformBinding = 0 , kInputBinding = 0 }
 
enum  { kDstInputAttachmentIndex = 0 }
 
enum  Layout { kStd140Layout = 0 , kStd430Layout = 1 , kLastLayout = kStd430Layout }
 
typedef SkTBlockList< VkUniformInfoUniformInfoArray
 
- Public Types inherited from GrGLSLUniformHandler
using UniformHandle = GrGLSLProgramDataManager::UniformHandle
 

Public Member Functions

 ~GrVkUniformHandler () override
 
const GrShaderVargetUniformVariable (UniformHandle u) const override
 
const char * getUniformCStr (UniformHandle u) const override
 
uint32_t getRTFlipOffset () const
 
int numUniforms () const override
 
UniformInfouniform (int idx) override
 
const UniformInfouniform (int idx) const override
 
bool usePushConstants () const
 
uint32_t currentOffset () const
 
- Public Member Functions inherited from GrGLSLUniformHandler
virtual ~GrGLSLUniformHandler ()
 
UniformHandle addUniform (const GrProcessor *owner, uint32_t visibility, SkSLType type, const char *name, const char **outName=nullptr)
 
UniformHandle addUniformArray (const GrProcessor *owner, uint32_t visibility, SkSLType type, const char *name, int arrayCount, const char **outName=nullptr)
 
virtual const GrShaderVargetUniformVariable (UniformHandle u) const =0
 
virtual const char * getUniformCStr (UniformHandle u) const =0
 
virtual int numUniforms () const =0
 
virtual UniformInfouniform (int idx)=0
 
virtual const UniformInfouniform (int idx) const =0
 
GrShaderVar getUniformMapping (const GrProcessor &owner, SkString rawName) const
 
GrShaderVar liftUniformToVertexShader (const GrProcessor &owner, SkString rawName)
 

Static Public Attributes

static const int kUniformsPerBlock = 8
 
static constexpr int kDescSetCount = kLastDescSet + 1
 
static constexpr int kLayoutCount = kLastLayout + 1
 

Friends

class GrVkPipelineStateBuilder
 
class GrVkDescriptorSetManager
 

Additional Inherited Members

- Protected Member Functions inherited from GrGLSLUniformHandler
 GrGLSLUniformHandler (GrGLSLProgramBuilder *program)
 
- Protected Attributes inherited from GrGLSLUniformHandler
GrGLSLProgramBuilderfProgramBuilder
 

Detailed Description

Definition at line 19 of file GrVkUniformHandler.h.

Member Typedef Documentation

◆ UniformInfoArray

Definition at line 63 of file GrVkUniformHandler.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
kUniformBufferDescSet 

Binding a descriptor set invalidates all higher index descriptor sets. We must bind in the order of this enumeration. Samplers are after Uniforms because GrOps can specify GP textures as dynamic state, meaning they get rebound for each draw in a pipeline while uniforms are bound once before all the draws. We bind input attachments after samplers so those also need to be rebound if we bind new samplers.

kSamplerDescSet 
kInputDescSet 
kLastDescSet 

Definition at line 23 of file GrVkUniformHandler.h.

23 {
24 /**
25 * Binding a descriptor set invalidates all higher index descriptor sets. We must bind
26 * in the order of this enumeration. Samplers are after Uniforms because GrOps can specify
27 * GP textures as dynamic state, meaning they get rebound for each draw in a pipeline while
28 * uniforms are bound once before all the draws. We bind input attachments after samplers
29 * so those also need to be rebound if we bind new samplers.
30 */
33 kInputDescSet = 2,
34
36 };

◆ anonymous enum

anonymous enum
Enumerator
kUniformBinding 
kInputBinding 

Definition at line 40 of file GrVkUniformHandler.h.

◆ anonymous enum

anonymous enum
Enumerator
kDstInputAttachmentIndex 

Definition at line 44 of file GrVkUniformHandler.h.

◆ Layout

Enumerator
kStd140Layout 
kStd430Layout 
kLastLayout 

Definition at line 49 of file GrVkUniformHandler.h.

Constructor & Destructor Documentation

◆ ~GrVkUniformHandler()

GrVkUniformHandler::~GrVkUniformHandler ( )
override

Definition at line 194 of file GrVkUniformHandler.cpp.

194 {
195 for (VkUniformInfo& sampler : fSamplers.items()) {
196 if (sampler.fImmutableSampler) {
197 sampler.fImmutableSampler->unref();
198 sampler.fImmutableSampler = nullptr;
199 }
200 }
201}

Member Function Documentation

◆ currentOffset()

uint32_t GrVkUniformHandler::currentOffset ( ) const
inline

Definition at line 92 of file GrVkUniformHandler.h.

92 {
93 return fUsePushConstants ? fCurrentOffsets[kStd430Layout] : fCurrentOffsets[kStd140Layout];
94 }

◆ getRTFlipOffset()

uint32_t GrVkUniformHandler::getRTFlipOffset ( ) const

Returns the offset that the RTFlip synthetic uniform should use if it needs to be created.

Definition at line 384 of file GrVkUniformHandler.cpp.

384 {
385 Layout layout = fUsePushConstants ? kStd430Layout : kStd140Layout;
386 uint32_t currentOffset = fCurrentOffsets[layout];
388}
static uint32_t get_aligned_offset(uint32_t *currentOffset, SkSLType type, int arrayCount, int layout)
uint32_t currentOffset() const

◆ getUniformCStr()

const char * GrVkUniformHandler::getUniformCStr ( UniformHandle  u) const
inlineoverridevirtual

Shortcut for getUniformVariable(u).c_str()

Implements GrGLSLUniformHandler.

Definition at line 71 of file GrVkUniformHandler.h.

71 {
72 return this->getUniformVariable(u).c_str();
73 }
const char * c_str() const
Definition: GrShaderVar.h:94
const GrShaderVar & getUniformVariable(UniformHandle u) const override

◆ getUniformVariable()

const GrShaderVar & GrVkUniformHandler::getUniformVariable ( UniformHandle  u) const
inlineoverridevirtual

Implements GrGLSLUniformHandler.

Definition at line 67 of file GrVkUniformHandler.h.

67 {
68 return fUniforms.item(u.toIndex()).fVariable;
69 }
T & item(int i)
Definition: SkTBlockList.h:217

◆ numUniforms()

int GrVkUniformHandler::numUniforms ( ) const
inlineoverridevirtual

Implements GrGLSLUniformHandler.

Definition at line 80 of file GrVkUniformHandler.h.

80 {
81 return fUniforms.count();
82 }
int count() const
Definition: SkTBlockList.h:167

◆ uniform() [1/2]

const UniformInfo & GrVkUniformHandler::uniform ( int  idx) const
inlineoverridevirtual

Implements GrGLSLUniformHandler.

Definition at line 87 of file GrVkUniformHandler.h.

87 {
88 return fUniforms.item(idx);
89 }

◆ uniform() [2/2]

UniformInfo & GrVkUniformHandler::uniform ( int  idx)
inlineoverridevirtual

Implements GrGLSLUniformHandler.

Definition at line 84 of file GrVkUniformHandler.h.

84 {
85 return fUniforms.item(idx);
86 }

◆ usePushConstants()

bool GrVkUniformHandler::usePushConstants ( ) const
inline

Definition at line 91 of file GrVkUniformHandler.h.

91{ return fUsePushConstants; }

Friends And Related Function Documentation

◆ GrVkDescriptorSetManager

friend class GrVkDescriptorSetManager
friend

Definition at line 166 of file GrVkUniformHandler.h.

◆ GrVkPipelineStateBuilder

friend class GrVkPipelineStateBuilder
friend

Definition at line 165 of file GrVkUniformHandler.h.

Member Data Documentation

◆ kDescSetCount

constexpr int GrVkUniformHandler::kDescSetCount = kLastDescSet + 1
staticconstexpr

Definition at line 37 of file GrVkUniformHandler.h.

◆ kLayoutCount

constexpr int GrVkUniformHandler::kLayoutCount = kLastLayout + 1
staticconstexpr

Definition at line 55 of file GrVkUniformHandler.h.

◆ kUniformsPerBlock

const int GrVkUniformHandler::kUniformsPerBlock = 8
static

Definition at line 21 of file GrVkUniformHandler.h.


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