glsl: ensure that enter/leave record get a record type
May make life easier for tools like Coverity. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
@@ -69,12 +69,15 @@ private:
|
|||||||
|
|
||||||
virtual void enter_record(const glsl_type *type, const char *name,
|
virtual void enter_record(const glsl_type *type, const char *name,
|
||||||
bool row_major) {
|
bool row_major) {
|
||||||
|
assert(type->is_record());
|
||||||
this->offset = glsl_align(
|
this->offset = glsl_align(
|
||||||
this->offset, type->std140_base_alignment(row_major));
|
this->offset, type->std140_base_alignment(row_major));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void leave_record(const glsl_type *type, const char *name,
|
virtual void leave_record(const glsl_type *type, const char *name,
|
||||||
bool row_major) {
|
bool row_major) {
|
||||||
|
assert(type->is_record());
|
||||||
|
|
||||||
/* If this is the last field of a structure, apply rule #9. The
|
/* If this is the last field of a structure, apply rule #9. The
|
||||||
* GL_ARB_uniform_buffer_object spec says:
|
* GL_ARB_uniform_buffer_object spec says:
|
||||||
*
|
*
|
||||||
|
@@ -546,12 +546,14 @@ private:
|
|||||||
|
|
||||||
virtual void enter_record(const glsl_type *type, const char *name,
|
virtual void enter_record(const glsl_type *type, const char *name,
|
||||||
bool row_major) {
|
bool row_major) {
|
||||||
|
assert(type->is_record());
|
||||||
this->ubo_byte_offset = glsl_align(
|
this->ubo_byte_offset = glsl_align(
|
||||||
this->ubo_byte_offset, type->std140_base_alignment(row_major));
|
this->ubo_byte_offset, type->std140_base_alignment(row_major));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void leave_record(const glsl_type *type, const char *name,
|
virtual void leave_record(const glsl_type *type, const char *name,
|
||||||
bool row_major) {
|
bool row_major) {
|
||||||
|
assert(type->is_record());
|
||||||
this->ubo_byte_offset = glsl_align(
|
this->ubo_byte_offset = glsl_align(
|
||||||
this->ubo_byte_offset, type->std140_base_alignment(row_major));
|
this->ubo_byte_offset, type->std140_base_alignment(row_major));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user