diff options
author | Ian Romanick <[email protected]> | 2011-11-14 16:52:05 -0800 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2012-01-11 12:51:24 -0800 |
commit | ca5b30bf8142d916a40eaaa7091882464a237f1f (patch) | |
tree | 4ebce6f6c7b7de9b1584b7a59178466e6f2090a6 | |
parent | f409a710e3562856a53a3b43ed526b877639a27c (diff) |
mesa: Use static buffer for uniform name
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r-- | src/mesa/main/ff_fragment_shader.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp index 49a8af090f5..165230c13b1 100644 --- a/src/mesa/main/ff_fragment_shader.cpp +++ b/src/mesa/main/ff_fragment_shader.cpp @@ -1509,7 +1509,12 @@ create_new_program(struct gl_context *ctx, struct state_key *key) _mesa_associate_uniform_storage(ctx, p.shader_program, fp->Parameters); for (unsigned int i = 0; i < MAX_TEXTURE_UNITS; i++) { - char *name = ralloc_asprintf(p.mem_ctx, "sampler_%d", i); + /* Enough space for 'sampler_999\0'. + */ + char name[12]; + + snprintf(name, sizeof(name), "sampler_%d", i); + int loc = _mesa_get_uniform_location(ctx, p.shader_program, name); if (loc != -1) { unsigned base; |