private:
virtual void visit_field(const glsl_type *type, const char *name,
bool row_major)
+ {
+ (void) type;
+ (void) name;
+ (void) row_major;
+ assert(!"Should not get here.");
+ }
+
+ virtual void visit_field(const glsl_type *type, const char *name,
+ bool row_major, const glsl_type *record_type)
{
assert(this->index < this->num_variables);
v->IndexName = v->Name;
}
- unsigned alignment = type->std140_base_alignment(v->RowMajor);
+ const unsigned alignment = record_type
+ ? record_type->std140_base_alignment(v->RowMajor)
+ : type->std140_base_alignment(v->RowMajor);
unsigned size = type->std140_size(v->RowMajor);
this->offset = glsl_align(this->offset, alignment);
virtual void visit_field(const glsl_struct_field *field)
{
+ /* FINISHME: When support for doubles (dvec4, etc.) is added to the
+ * FINISHME: compiler, this may be incorrect for a structure in a UBO
+ * FINISHME: like struct s { struct { float f } s1; dvec4 v; };.
+ */
this->offset = glsl_align(this->offset,
field->type->std140_base_alignment(false));
}
virtual void visit_field(const glsl_type *type, const char *name,
bool row_major)
+ {
+ (void) type;
+ (void) name;
+ (void) row_major;
+ assert(!"Should not get here.");
+ }
+
+ virtual void visit_field(const glsl_type *type, const char *name,
+ bool row_major, const glsl_type *record_type)
{
assert(!type->is_record());
assert(!(type->is_array() && type->fields.array->is_record()));
if (this->ubo_block_index != -1) {
this->uniforms[id].block_index = this->ubo_block_index;
- unsigned alignment = type->std140_base_alignment(ubo_row_major);
+ const unsigned alignment = record_type
+ ? record_type->std140_base_alignment(ubo_row_major)
+ : type->std140_base_alignment(ubo_row_major);
this->ubo_byte_offset = glsl_align(this->ubo_byte_offset, alignment);
this->uniforms[id].offset = this->ubo_byte_offset;
this->ubo_byte_offset += type->std140_size(ubo_row_major);