[Mesa-dev] [PATCH 1/3] glsl: on UBO/SSBOs link error, the number of active blocks remains 0

Timothy Arceri tarceri at itsqueeze.com
Thu Mar 9 21:32:27 UTC 2017


On 23/02/17 19:55, Andres Gomez wrote:
> Commit f1293b2f9bc3 split apart buffer block arrays but introduced
> also the possibility of a recount of active
> blocks (NumUniformBlocks/NumShaderStorageBlocks) which would be
> incoherent with the actual amount of active
> blocks (UniformBlocks/ShaderStorageBlocks) in the program.
>
> This could cause a segmentation fault if trying to use the index of a
> block in a link failed program.

Where exactly does this segfault happen? 
interstage_cross_validate_uniform_blocks() should exit linking because 
we returned false.


>
> Signed-off-by: Andres Gomez <agomez at igalia.com>
> Cc: Timothy Arceri <tarceri at itsqueeze.com>
> ---
>  src/compiler/glsl/linker.cpp | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
> index b6f8bc4212e..bb9c101f430 100644
> --- a/src/compiler/glsl/linker.cpp
> +++ b/src/compiler/glsl/linker.cpp
> @@ -1181,6 +1181,7 @@ interstage_cross_validate_uniform_blocks(struct gl_shader_program *prog,
>              for (unsigned k = 0; k <= i; k++) {
>                 delete[] InterfaceBlockStageIndex[k];
>              }
> +            *num_blks = 0;
>              return false;
>           }
>
>


More information about the mesa-dev mailing list