@@ -40,11 +40,28 @@ class BufferInterfaceBlock {
40
40
std::string_view name;
41
41
uint32_t size;
42
42
backend::UniformType type;
43
- backend::Precision precision{};
44
- backend::FeatureLevel minFeatureLevel = backend::FeatureLevel::FEATURE_LEVEL_1;
45
- std::string_view structName{};
46
- uint32_t stride{};
47
- std::string_view sizeName{};
43
+ backend::Precision precision;
44
+ uint8_t associatedSampler = 0 ;
45
+ backend::FeatureLevel minFeatureLevel;
46
+ std::string_view structName;
47
+ uint32_t stride;
48
+ std::string_view sizeName;
49
+
50
+ InterfaceBlockEntry () = default ;
51
+ InterfaceBlockEntry (std::string_view name, uint32_t size, backend::UniformType type,
52
+ backend::Precision precision = {},
53
+ backend::FeatureLevel minFeatureLevel = backend::FeatureLevel::FEATURE_LEVEL_1, std::string_view structName = {},
54
+ uint32_t stride = {}, std::string_view sizeName = {}) noexcept
55
+ : name(name), size(size), type(type), precision(precision),
56
+ associatedSampler (0 ), minFeatureLevel(minFeatureLevel),
57
+ structName(structName), stride(stride), sizeName(sizeName) {}
58
+ InterfaceBlockEntry (std::string_view name, uint8_t associatedSampler, uint32_t size, backend::UniformType type,
59
+ backend::Precision precision = {},
60
+ backend::FeatureLevel minFeatureLevel = backend::FeatureLevel::FEATURE_LEVEL_1, std::string_view structName = {},
61
+ uint32_t stride = {}, std::string_view sizeName = {}) noexcept
62
+ : name(name), size(size), type(type), precision(precision),
63
+ associatedSampler(associatedSampler), minFeatureLevel(minFeatureLevel),
64
+ structName(structName), stride(stride), sizeName(sizeName) {}
48
65
};
49
66
50
67
BufferInterfaceBlock ();
@@ -68,6 +85,7 @@ class BufferInterfaceBlock {
68
85
bool isArray; // true if the field is an array
69
86
uint32_t size; // size of the array in elements, or 0 if not an array
70
87
Precision precision; // precision of this field
88
+ uint8_t associatedSampler; // sampler associated with this field
71
89
backend::FeatureLevel minFeatureLevel; // below this feature level, this field is not needed
72
90
utils::CString structName; // name of this field structure if type is STRUCT
73
91
utils::CString sizeName; // name of the size parameter in the shader
@@ -152,6 +170,10 @@ class BufferInterfaceBlock {
152
170
// negative value if name doesn't exist or Panic if exceptions are enabled
153
171
ssize_t getFieldOffset (std::string_view name, size_t index) const ;
154
172
173
+ // returns offset in bytes of the transform matrix for the given external texture binding
174
+ // returns -1 if the field doesn't exist
175
+ ssize_t getTransformFieldOffset (uint8_t binding) const ;
176
+
155
177
FieldInfo const * getFieldInfo (std::string_view name) const ;
156
178
157
179
bool hasField (std::string_view name) const noexcept {
@@ -179,6 +201,7 @@ class BufferInterfaceBlock {
179
201
utils::CString mName ;
180
202
utils::FixedCapacityVector<FieldInfo> mFieldInfoList ;
181
203
std::unordered_map<std::string_view , uint32_t > mInfoMap ;
204
+ std::unordered_map<uint8_t , uint32_t > mTransformOffsetMap ;
182
205
uint32_t mSize = 0 ; // size in bytes rounded to multiple of 4
183
206
Alignment mAlignment = Alignment::std140;
184
207
Target mTarget = Target::UNIFORM;
0 commit comments