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

Author: Marek Olšák <[email protected]>
Date:   Wed Oct 30 20:18:05 2019 -0400

glsl: encode vector_elements and matrix_columns better

Reviewed-by: Timothy Arceri <[email protected]>

---

 src/compiler/glsl_types.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp
index 017b84a9bda..16cc79445e2 100644
--- a/src/compiler/glsl_types.cpp
+++ b/src/compiler/glsl_types.cpp
@@ -2578,9 +2578,9 @@ union packed_type {
    struct {
       unsigned base_type:5;
       unsigned interface_row_major:1;
-      unsigned vector_elements:6;
-      unsigned matrix_columns:4;
-      unsigned _pad:16;
+      unsigned vector_elements:3;
+      unsigned matrix_columns:3;
+      unsigned _pad:20;
    } basic;
    struct {
       unsigned base_type:5;
@@ -2619,6 +2619,8 @@ encode_type_to_blob(struct blob *blob, const glsl_type 
*type)
    case GLSL_TYPE_INT64:
    case GLSL_TYPE_BOOL:
       encoded.basic.interface_row_major = type->interface_row_major;
+      assert(type->vector_elements < 8);
+      assert(type->matrix_columns < 8);
       encoded.basic.vector_elements = type->vector_elements;
       encoded.basic.matrix_columns = type->matrix_columns;
       blob_write_uint32(blob, encoded.u32);

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

Reply via email to