mesa: change _mesa_find_free_register() to find multiple free regs
Before, _mesa_find_free_register() would scan the given shader to find a free/unused register of the given type. But subsequent calls would return the same register again. This caused a failure in the _mesa_remove_output_reads() function which sometimes needs several free temps. Now use a new function which build a vector of 'used' flags and another function which searches that vector for an unused register starting at a position that's incremented for each call. Fixes fd.o bug 26317. Note that a regression test for this has been added to the glean/glsl1 test. (cherry picked from commit e0d01c9d7f46ccd531f8dd1a04c5ac067200ef1e)
This commit is contained in:
@@ -119,8 +119,14 @@ _mesa_combine_programs(GLcontext *ctx,
|
||||
const struct gl_program *progA,
|
||||
const struct gl_program *progB);
|
||||
|
||||
extern void
|
||||
_mesa_find_used_registers(const struct gl_program *prog,
|
||||
gl_register_file file,
|
||||
GLboolean used[], GLuint usedSize);
|
||||
|
||||
extern GLint
|
||||
_mesa_find_free_register(const struct gl_program *prog, GLuint regFile);
|
||||
_mesa_find_free_register(const GLboolean used[],
|
||||
GLuint maxRegs, GLuint firstReg);
|
||||
|
||||
extern void
|
||||
_mesa_postprocess_program(GLcontext *ctx, struct gl_program *prog);
|
||||
|
Reference in New Issue
Block a user