summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAapo Tahkola <[email protected]>2006-04-20 19:43:21 +0000
committerAapo Tahkola <[email protected]>2006-04-20 19:43:21 +0000
commit34ba50522a843f52060e2b554e07f7dc7da8413a (patch)
tree726189afa773cce96da2ceca769173d7afc848e2
parent8a97946e0a25aff2d56bbaf3ed20ba1588129993 (diff)
limit max program/param length to 255 (spotted by sroland)
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.h3
-rw-r--r--src/mesa/drivers/dri/r300/r300_state.c1
2 files changed, 3 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h
index 7504bd894ab..58f789eeae7 100644
--- a/src/mesa/drivers/dri/r300/r300_context.h
+++ b/src/mesa/drivers/dri/r300/r300_context.h
@@ -549,7 +549,8 @@ struct r300_vap_reg_state {
/* Vertex shader state */
/* Perhaps more if we store programs in vmem? */
-#define VSF_MAX_FRAGMENT_LENGTH (256*4)
+/* drm_r300_cmd_header_t->vpu->count is unsigned char */
+#define VSF_MAX_FRAGMENT_LENGTH (255*4)
/* Can be tested with colormat currently. */
#define VSF_MAX_FRAGMENT_TEMPS (14)
diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c
index 951b9259538..ae0d2715210 100644
--- a/src/mesa/drivers/dri/r300/r300_state.c
+++ b/src/mesa/drivers/dri/r300/r300_state.c
@@ -1403,6 +1403,7 @@ void r300_setup_rs_unit(GLcontext *ctx)
#define bump_vpu_count(ptr, new_count) do{\
drm_r300_cmd_header_t* _p=((drm_r300_cmd_header_t*)(ptr));\
int _nc=(new_count)/4; \
+ assert(_nc < 256); \
if(_nc>_p->vpu.count)_p->vpu.count=_nc;\
}while(0)