summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_program.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/state_tracker/st_program.c')
-rw-r--r--src/mesa/state_tracker/st_program.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 958096f68e6..5966bbadae8 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -49,6 +49,9 @@
#include "cso_cache/cso_context.h"
+#define ST_MAX_SHADER_TOKENS 4096
+
+
#define TGSI_DEBUG 0
@@ -296,6 +299,8 @@ st_translate_vertex_program(struct st_context *st,
/* tokenized result */
tokens, ST_MAX_SHADER_TOKENS);
+ assert(num_tokens < ST_MAX_SHADER_TOKENS);
+
vs.tokens = (struct tgsi_token *)
mem_dup(tokens, num_tokens * sizeof(tokens[0]));
@@ -467,6 +472,8 @@ st_translate_fragment_program(struct st_context *st,
/* tokenized result */
tokens, ST_MAX_SHADER_TOKENS);
+ assert(num_tokens < ST_MAX_SHADER_TOKENS);
+
fs.tokens = (struct tgsi_token *)
mem_dup(tokens, num_tokens * sizeof(tokens[0]));