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

Author: Jason Ekstrand <[email protected]>
Date:   Thu Oct  8 02:14:47 2020 -0500

compiler/types: Assert non-zero alignments in get_explicit_type_for_size_align

Reviewed-by: Karol Herbst <[email protected]>
Reviewed-by: Dave Airlie <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7069>

---

 src/compiler/glsl_types.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp
index ff3ed678680..b0c99e82ad0 100644
--- a/src/compiler/glsl_types.cpp
+++ b/src/compiler/glsl_types.cpp
@@ -2479,6 +2479,7 @@ 
glsl_type::get_explicit_type_for_size_align(glsl_type_size_align_func type_info,
       return this;
    } else if (this->is_vector()) {
       type_info(this, size, alignment);
+      assert(*alignment > 0);
       assert(*alignment % explicit_type_scalar_byte_size(this) == 0);
       return glsl_type::get_instance(this->base_type, this->vector_elements,
                                      1, 0, false, *alignment);
@@ -2532,6 +2533,7 @@ 
glsl_type::get_explicit_type_for_size_align(glsl_type_size_align_func type_info,
 
       *size = this->matrix_columns * stride;
       /* Matrix and column alignments match. See glsl_type::column_type() */
+      assert(col_align > 0);
       *alignment = col_align;
       return glsl_type::get_instance(this->base_type, this->vector_elements,
                                      this->matrix_columns, stride, false, 
*alignment);

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to