Mesa (master): glsl: ensure that enter/leave record get a record type

Ilia Mirkin imirkin at kemper.freedesktop.org
Sat Feb 21 22:32:03 UTC 2015


Module: Mesa
Branch: master
Commit: c2ece77678c19f6aee1d9a3ef65a1251a59dd2ae
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c2ece77678c19f6aee1d9a3ef65a1251a59dd2ae

Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date:   Sat Feb 21 12:53:43 2015 -0500

glsl: ensure that enter/leave record get a record type

May make life easier for tools like Coverity.

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Reviewed-by: Matt Turner <mattst88 at gmail.com>

---

 src/glsl/link_uniform_blocks.cpp |    3 +++
 src/glsl/link_uniforms.cpp       |    2 ++
 2 files changed, 5 insertions(+)

diff --git a/src/glsl/link_uniform_blocks.cpp b/src/glsl/link_uniform_blocks.cpp
index 1c175ec..6ca4110 100644
--- a/src/glsl/link_uniform_blocks.cpp
+++ b/src/glsl/link_uniform_blocks.cpp
@@ -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:
        *
diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
index 347f079..799c74b 100644
--- a/src/glsl/link_uniforms.cpp
+++ b/src/glsl/link_uniforms.cpp
@@ -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));
    }




More information about the mesa-commit mailing list