I've noticed at least two places where we store the TGSI opcode in
an unsigned:8 bitfield.  We're at 249 opcodes now.  If we hit 256 we'll
need to grow those bitfields.  Add a static assertion to detect that.
---
 src/gallium/auxiliary/tgsi/tgsi_info.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c 
b/src/gallium/auxiliary/tgsi/tgsi_info.c
index 4e39950..ff4b150 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -55,6 +55,11 @@ tgsi_get_opcode_info( uint opcode )
 {
    static boolean firsttime = 1;
 
+   /* If this assertion fails, increase tgsi_opcode_info::opcode
+    * and glsl_to_tgsi_instruction::op field sizes (and other locations?)
+    */
+   STATIC_ASSERT(TGSI_OPCODE_LAST <= 255);
+
    if (firsttime) {
       unsigned i;
       firsttime = 0;
-- 
1.9.1

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

Reply via email to