diff options
Diffstat (limited to 'mesalib/src/mesa/program/program.c')
-rw-r--r-- | mesalib/src/mesa/program/program.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/mesalib/src/mesa/program/program.c b/mesalib/src/mesa/program/program.c index a102ec17a..01f8c6f11 100644 --- a/mesalib/src/mesa/program/program.c +++ b/mesalib/src/mesa/program/program.c @@ -349,6 +349,7 @@ _mesa_delete_program(struct gl_context *ctx, struct gl_program *prog) return; free(prog->String); + free(prog->LocalParams); if (prog->Instructions) { _mesa_free_instructions(prog->Instructions, prog->NumInstructions); @@ -477,7 +478,16 @@ _mesa_clone_program(struct gl_context *ctx, const struct gl_program *prog) if (prog->Parameters) clone->Parameters = _mesa_clone_parameter_list(prog->Parameters); - memcpy(clone->LocalParams, prog->LocalParams, sizeof(clone->LocalParams)); + if (prog->LocalParams) { + clone->LocalParams = malloc(MAX_PROGRAM_LOCAL_PARAMS * + sizeof(float[4])); + if (!clone->LocalParams) { + _mesa_reference_program(ctx, &clone, NULL); + return NULL; + } + memcpy(clone->LocalParams, prog->LocalParams, + MAX_PROGRAM_LOCAL_PARAMS * sizeof(float[4])); + } clone->IndirectRegisterFiles = prog->IndirectRegisterFiles; clone->NumInstructions = prog->NumInstructions; clone->NumTemporaries = prog->NumTemporaries; @@ -909,12 +919,6 @@ _mesa_valid_register_index(const struct gl_context *ctx, case PROGRAM_TEMPORARY: return index >= 0 && index < (GLint) c->MaxTemps; - case PROGRAM_ENV_PARAM: - return index >= 0 && index < (GLint) c->MaxEnvParams; - - case PROGRAM_LOCAL_PARAM: - return index >= 0 && index < (GLint) c->MaxLocalParams; - case PROGRAM_UNIFORM: case PROGRAM_STATE_VAR: /* aka constant buffer */ |