diff options
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/arbprogram.c | 6 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 11 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/mesa/main/arbprogram.c b/src/mesa/main/arbprogram.c index 51a299370e9..8bd3f0bd06f 100644 --- a/src/mesa/main/arbprogram.c +++ b/src/mesa/main/arbprogram.c @@ -265,6 +265,12 @@ get_local_param_pointer(struct gl_context *ctx, const char *func, return GL_FALSE; } + if (!prog->LocalParams) { + prog->LocalParams = calloc(maxParams, sizeof(float[4])); + if (!prog->LocalParams) + return GL_FALSE; + } + *param = prog->LocalParams[index]; return GL_TRUE; } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 0f470da3713..67c4996e673 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2035,8 +2035,15 @@ struct gl_program /** Named parameters, constants, etc. from program text */ struct gl_program_parameter_list *Parameters; - /** Numbered local parameters */ - GLfloat LocalParams[MAX_PROGRAM_LOCAL_PARAMS][4]; + + /** + * Local parameters used by the program. + * + * It's dynamically allocated because it is rarely used (just + * assembly-style programs), and MAX_PROGRAM_LOCAL_PARAMS entries once it's + * allocated. + */ + GLfloat (*LocalParams)[4]; /** Map from sampler unit to texture unit (set by glUniform1i()) */ GLubyte SamplerUnits[MAX_SAMPLERS]; |