Flutter Engine
The Flutter Engine
GrSPIRVUniformHandler.h
Go to the documentation of this file.
1/*
2 * Copyright 2019 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef GrSPIRVUniformHandler_DEFINED
9#define GrSPIRVUniformHandler_DEFINED
10
14
15/*
16 * This class can be used for basic SPIR-V uniform handling. It will make a single uniform buffer
17 * for all the uniforms and will be placed in the first set and binding. Textures and samplers are
18 * placed in the second set and kept as separate objects. They are interleaved as sampler texture
19 * pairs with each object in the next binding slot.
20 */
22public:
23 static const int kUniformsPerBlock = 8;
24
25 const GrShaderVar& getUniformVariable(UniformHandle u) const override;
26 const char* getUniformCStr(UniformHandle u) const override;
27
28 struct SPIRVUniformInfo : public UniformInfo {
30 };
32 enum {
36 };
37 uint32_t getRTFlipOffset() const;
38
39 int numUniforms() const override {
40 return fUniforms.count();
41 }
42
43 UniformInfo& uniform(int idx) override {
44 return fUniforms.item(idx);
45 }
46 const UniformInfo& uniform(int idx) const override {
47 return fUniforms.item(idx);
48 }
49
50private:
52
53 SamplerHandle addSampler(const GrBackendFormat&, GrSamplerState, const skgpu::Swizzle&,
54 const char* name, const GrShaderCaps*) override;
55 const char* samplerVariable(SamplerHandle handle) const override;
56 skgpu::Swizzle samplerSwizzle(SamplerHandle handle) const override;
57 void appendUniformDecls(GrShaderFlags visibility, SkString*) const override;
58 UniformHandle internalAddUniformArray(const GrProcessor* owner,
59 uint32_t visibility,
61 const char* name,
62 bool mangleName,
63 int arrayCount,
64 const char** outName) override;
65
66 UniformInfoArray fUniforms;
67 UniformInfoArray fSamplers;
69
70 uint32_t fCurrentUBOOffset = 0;
71 uint32_t fRTFlipOffset = 0;
72
75
77};
78
79#endif
GrShaderFlags
Definition: GrTypesPriv.h:284
SkSLType
GLenum type
GrGLSLUniformHandler(GrGLSLProgramBuilder *program)
GrGLSLProgramDataManager::UniformHandle UniformHandle
SkTBlockList< SPIRVUniformInfo > UniformInfoArray
int numUniforms() const override
static const int kUniformsPerBlock
UniformInfo & uniform(int idx) override
const GrShaderVar & getUniformVariable(UniformHandle u) const override
const UniformInfo & uniform(int idx) const override
const char * getUniformCStr(UniformHandle u) const override
T & item(int i)
Definition: SkTBlockList.h:217
int count() const
Definition: SkTBlockList.h:167
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32