glsl: ensure that enter/leave record get a record type
authorIlia Mirkin <imirkin@alum.mit.edu>
Sat, 21 Feb 2015 17:53:43 +0000 (12:53 -0500)
committerIlia Mirkin <imirkin@alum.mit.edu>
Sat, 21 Feb 2015 22:27:24 +0000 (17:27 -0500)
May make life easier for tools like Coverity.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/glsl/link_uniform_blocks.cpp
src/glsl/link_uniforms.cpp

index 1c175ec8bdb4474f06e724b5a82980380428d995..6ca41107e53880c2a5edffb68475b09d55b08851 100644 (file)
@@ -69,12 +69,15 @@ private:
 
    virtual void enter_record(const glsl_type *type, const char *name,
                              bool row_major) {
+      assert(type->is_record());
       this->offset = glsl_align(
             this->offset, type->std140_base_alignment(row_major));
    }
 
    virtual void leave_record(const glsl_type *type, const char *name,
                              bool row_major) {
+      assert(type->is_record());
+
       /* If this is the last field of a structure, apply rule #9.  The
        * GL_ARB_uniform_buffer_object spec says:
        *
index 347f079fa42ba505b5f061027f9a5e041879ff92..799c74bb9e6f591f679f96f03ae9242620aa2966 100644 (file)
@@ -546,12 +546,14 @@ private:
 
    virtual void enter_record(const glsl_type *type, const char *name,
                              bool row_major) {
+      assert(type->is_record());
       this->ubo_byte_offset = glsl_align(
             this->ubo_byte_offset, type->std140_base_alignment(row_major));
    }
 
    virtual void leave_record(const glsl_type *type, const char *name,
                              bool row_major) {
+      assert(type->is_record());
       this->ubo_byte_offset = glsl_align(
             this->ubo_byte_offset, type->std140_base_alignment(row_major));
    }