On 20 November 2016 at 13:28, Timothy Arceri
<[email protected]> wrote:
> @@ -3134,11 +3134,10 @@ check_resources(struct gl_context *ctx, struct
> gl_shader_program *prog)
> static void
> link_calculate_subroutine_compat(struct gl_shader_program *prog)
> {
> - for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
> + unsigned mask = prog->data->linked_stages;
> + while (mask) {
> + const int i = u_bit_scan(&mask);
> struct gl_linked_shader *sh = prog->_LinkedShaders[i];
> - int count;
> - if (!sh)
> - continue;
>
> for (unsigned j = 0; j < sh->NumSubroutineUniformRemapTable; j++) {
> if (sh->SubroutineUniformRemapTable[j] ==
> INACTIVE_UNIFORM_EXPLICIT_LOCATION)
> @@ -3150,7 +3149,7 @@ link_calculate_subroutine_compat(struct
> gl_shader_program *prog)
> continue;
>
> sh->NumSubroutineUniforms++;
> - count = 0;
> + int count = 0;
Nit: Maybe leave this as-is ?
> if (sh->NumSubroutineFunctions == 0) {
> linker_error(prog, "subroutine uniform %s defined but no valid
> functions found\n", uni->type->name);
> continue;
> @@ -3172,7 +3171,9 @@ link_calculate_subroutine_compat(struct
> gl_shader_program *prog)
> static void
> check_subroutine_resources(struct gl_shader_program *prog)
> {
> - for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
> + unsigned mask = prog->data->linked_stages;
> + while (mask) {
> + const int i = u_bit_scan(&mask);
> struct gl_linked_shader *sh = prog->_LinkedShaders[i];
>
> if (sh) {
Fold this "always true" conditional ?
> @@ -3374,7 +3375,9 @@ check_explicit_uniform_locations(struct gl_context *ctx,
> }
>
> unsigned entries_total = 0;
> - for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
> + unsigned mask = prog->data->linked_stages;
> + while (mask) {
> + const int i = u_bit_scan(&mask);
> struct gl_linked_shader *sh = prog->_LinkedShaders[i];
>
> if (!sh)
Drop this if block.
-Emil
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev