[Mesa-dev] [PATCH 2/2] glsl: ensure that enter/leave record get a record type

Matt Turner mattst88 at gmail.com
Sat Feb 21 13:39:51 PST 2015


On Sat, Feb 21, 2015 at 10:54 AM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> May make life easier for tools like Coverity.
>
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
>  src/glsl/link_uniform_blocks.cpp | 2 ++
>  src/glsl/link_uniforms.cpp       | 2 ++
>  2 files changed, 4 insertions(+)
>
> diff --git a/src/glsl/link_uniform_blocks.cpp b/src/glsl/link_uniform_blocks.cpp
> index 1c175ec..4c28b56 100644
> --- a/src/glsl/link_uniform_blocks.cpp
> +++ b/src/glsl/link_uniform_blocks.cpp
> @@ -69,12 +69,14 @@ 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());

Add a new line here before the comment.

With each comment addressed on the two patches, both are

Reviewed-by: Matt Turner <mattst88 at gmail.com>

>        /* 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));
>     }
> --
> 2.0.5
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list