summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2011-03-02 09:32:45 -0700
committerBrian Paul <[email protected]>2011-03-02 09:32:47 -0700
commit8ad821df0a2d49964141f2ea4ef8179f4edc052f (patch)
tree617653ede90f6a518c247cb7737e25f9559e1481 /src
parent41208bf047888f5633befc5bcfac1c9132920492 (diff)
mesa: added gl_program_constants::MaxAddressOffset
See https://bugs.freedesktop.org/show_bug.cgi?id=29418
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/context.c1
-rw-r--r--src/mesa/main/mtypes.h1
-rw-r--r--src/mesa/program/program.c3
-rw-r--r--src/mesa/program/program_parse.y4
4 files changed, 7 insertions, 2 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index a942314552e..5d581c84002 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -487,6 +487,7 @@ init_program_limits(GLenum type, struct gl_program_constants *prog)
prog->MaxEnvParams = MAX_PROGRAM_ENV_PARAMS;
prog->MaxLocalParams = MAX_PROGRAM_LOCAL_PARAMS;
prog->MaxUniformComponents = 4 * MAX_UNIFORMS;
+ prog->MaxAddressOffset = MAX_PROGRAM_LOCAL_PARAMS;
switch (type) {
case GL_VERTEX_PROGRAM_ARB:
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index fcb06d49e9e..db3eba20c68 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2573,6 +2573,7 @@ struct gl_program_constants
GLuint MaxAttribs;
GLuint MaxTemps;
GLuint MaxAddressRegs;
+ GLuint MaxAddressOffset; /**< [-MaxAddressOffset, MaxAddressOffset-1] */
GLuint MaxParameters;
GLuint MaxLocalParams;
GLuint MaxEnvParams;
diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c
index 52254e9365f..cfdd0da86d8 100644
--- a/src/mesa/program/program.c
+++ b/src/mesa/program/program.c
@@ -71,6 +71,9 @@ _mesa_init_program(struct gl_context *ctx)
ASSERT(ctx->Const.VertexProgram.MaxUniformComponents <= 4 * MAX_UNIFORMS);
ASSERT(ctx->Const.FragmentProgram.MaxUniformComponents <= 4 * MAX_UNIFORMS);
+ ASSERT(ctx->Const.VertexProgram.MaxAddressOffset <= (1 << INST_INDEX_BITS));
+ ASSERT(ctx->Const.FragmentProgram.MaxAddressOffset <= (1 << INST_INDEX_BITS));
+
/* If this fails, increase prog_instruction::TexSrcUnit size */
ASSERT(MAX_TEXTURE_UNITS < (1 << 5));
diff --git a/src/mesa/program/program_parse.y b/src/mesa/program/program_parse.y
index 784ea28c17a..19aa8ccdb53 100644
--- a/src/mesa/program/program_parse.y
+++ b/src/mesa/program/program_parse.y
@@ -935,7 +935,7 @@ addrRegRelOffset: { $$ = 0; }
addrRegPosOffset: INTEGER
{
- if (($1 < 0) || ($1 > 4095)) {
+ if (($1 < 0) || ($1 > (state->limits->MaxAddressOffset - 1))) {
char s[100];
_mesa_snprintf(s, sizeof(s),
"relative address offset too large (%d)", $1);
@@ -949,7 +949,7 @@ addrRegPosOffset: INTEGER
addrRegNegOffset: INTEGER
{
- if (($1 < 0) || ($1 > 4096)) {
+ if (($1 < 0) || ($1 > state->limits->MaxAddressOffset)) {
char s[100];
_mesa_snprintf(s, sizeof(s),
"relative address offset too large (%d)", $1);