mesa/glsl: remove hack to reset sampler units to zero
Now that we have the is_arb_asm flag we can just skip the initialisation. V2: remove hack from standalone compiler where it was never needed since it only compiles glsl shaders. Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
@@ -1299,17 +1299,6 @@ link_assign_uniform_locations(struct gl_shader_program *prog,
|
|||||||
if (sh == NULL)
|
if (sh == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Uniforms that lack an initializer in the shader code have an initial
|
|
||||||
* value of zero. This includes sampler uniforms.
|
|
||||||
*
|
|
||||||
* Page 24 (page 30 of the PDF) of the GLSL 1.20 spec says:
|
|
||||||
*
|
|
||||||
* "The link time initial value is either the value of the variable's
|
|
||||||
* initializer, if present, or 0 if no initializer is present. Sampler
|
|
||||||
* types cannot have initializers."
|
|
||||||
*/
|
|
||||||
memset(sh->SamplerUnits, 0, sizeof(sh->SamplerUnits));
|
|
||||||
|
|
||||||
link_update_uniform_buffer_variables(sh, i);
|
link_update_uniform_buffer_variables(sh, i);
|
||||||
|
|
||||||
/* Reset various per-shader target counts.
|
/* Reset various per-shader target counts.
|
||||||
|
@@ -107,10 +107,6 @@ init_gl_program(struct gl_program *prog, GLenum target, bool is_arb_asm)
|
|||||||
prog->RefCount = 1;
|
prog->RefCount = 1;
|
||||||
prog->Format = GL_PROGRAM_FORMAT_ASCII_ARB;
|
prog->Format = GL_PROGRAM_FORMAT_ASCII_ARB;
|
||||||
prog->is_arb_asm = is_arb_asm;
|
prog->is_arb_asm = is_arb_asm;
|
||||||
|
|
||||||
/* default mapping from samplers to texture units */
|
|
||||||
for (int i = 0; i < MAX_SAMPLERS; i++)
|
|
||||||
prog->SamplerUnits[i] = i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct gl_program *
|
struct gl_program *
|
||||||
|
@@ -181,8 +181,6 @@ struct gl_program *
|
|||||||
_mesa_init_gl_program(struct gl_program *prog, GLenum target, GLuint id,
|
_mesa_init_gl_program(struct gl_program *prog, GLenum target, GLuint id,
|
||||||
bool is_arb_asm)
|
bool is_arb_asm)
|
||||||
{
|
{
|
||||||
GLuint i;
|
|
||||||
|
|
||||||
if (!prog)
|
if (!prog)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@@ -195,9 +193,22 @@ _mesa_init_gl_program(struct gl_program *prog, GLenum target, GLuint id,
|
|||||||
prog->info.stage = _mesa_program_enum_to_shader_stage(target);
|
prog->info.stage = _mesa_program_enum_to_shader_stage(target);
|
||||||
prog->is_arb_asm = is_arb_asm;
|
prog->is_arb_asm = is_arb_asm;
|
||||||
|
|
||||||
|
/* Uniforms that lack an initializer in the shader code have an initial
|
||||||
|
* value of zero. This includes sampler uniforms.
|
||||||
|
*
|
||||||
|
* Page 24 (page 30 of the PDF) of the GLSL 1.20 spec says:
|
||||||
|
*
|
||||||
|
* "The link time initial value is either the value of the variable's
|
||||||
|
* initializer, if present, or 0 if no initializer is present. Sampler
|
||||||
|
* types cannot have initializers."
|
||||||
|
*
|
||||||
|
* So we only initialise ARB assembly style programs.
|
||||||
|
*/
|
||||||
|
if (is_arb_asm) {
|
||||||
/* default mapping from samplers to texture units */
|
/* default mapping from samplers to texture units */
|
||||||
for (i = 0; i < MAX_SAMPLERS; i++)
|
for (unsigned i = 0; i < MAX_SAMPLERS; i++)
|
||||||
prog->SamplerUnits[i] = i;
|
prog->SamplerUnits[i] = i;
|
||||||
|
}
|
||||||
|
|
||||||
return prog;
|
return prog;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user