summaryrefslogtreecommitdiff
path: root/src/sna/brw/brw_eu_emit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sna/brw/brw_eu_emit.c')
-rw-r--r--src/sna/brw/brw_eu_emit.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/sna/brw/brw_eu_emit.c b/src/sna/brw/brw_eu_emit.c
index 5c0b3065..00c984d9 100644
--- a/src/sna/brw/brw_eu_emit.c
+++ b/src/sna/brw/brw_eu_emit.c
@@ -34,6 +34,8 @@
#include <string.h>
#include <stdlib.h>
+#define ARRAY_SIZE(A) (sizeof(A)/sizeof(A[0]))
+
/***********************************************************************
* Internal helper for constructing instructions
*/
@@ -179,6 +181,11 @@ validate_reg(struct brw_instruction *insn, struct brw_reg reg)
reg.file == BRW_ARF_NULL)
return;
+ assert(reg.hstride >= 0 && reg.hstride < ARRAY_SIZE(hstride_for_reg));
+ assert(reg.vstride >= 0 && reg.vstride < ARRAY_SIZE(vstride_for_reg));
+ assert(reg.width >= 0 && reg.width < ARRAY_SIZE(width_for_reg));
+ assert(insn->header.execution_size >= 0 && insn->header.execution_size < ARRAY_SIZE(execsize_for_reg));
+
hstride = hstride_for_reg[reg.hstride];
if (reg.vstride == 0xf) {