[Mesa-dev] [PATCH 03/58] glsl: use linked_shaders bitmask to iterate stages for subroutine fields
Timothy Arceri
timothy.arceri at collabora.com
Tue Nov 22 23:32:14 UTC 2016
On Tue, 2016-11-22 at 18:49 +0000, Emil Velikov wrote:
> On 20 November 2016 at 13:28, Timothy Arceri
> <timothy.arceri at collabora.com> 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.
This is really odd. I don't recall fixing this but the latest patch I
have correctly removes both of these:
https://github.com/tarceri/Mesa/commit/ee9d8d8a7de6d4a2ae1889b6caca37c6
0aba5b30
Guess I must have fixed them at some point.
>
> -Emil
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list