diff options
author | Andres Gomez <[email protected]> | 2017-02-22 17:03:22 +0200 |
---|---|---|
committer | Andres Gomez <[email protected]> | 2017-03-27 12:45:59 +0300 |
commit | bf15b2b515d5f37fc67fea77dea9d2fbc1dc8bf1 (patch) | |
tree | 49ebb7f41141b76eedf5932ee0518fa88e004090 /src/compiler/glsl | |
parent | c4c02471f485e6e9a8ffdaaa789861dcd5a3b8e9 (diff) |
glsl: on UBO/SSBOs link error reset the number of active blocks to 0
While it's legal to have an active blocks count > 0 on link failure.
Unless we actually assign memory for the blocks array we can end up
segfaulting in calls such as glUniformBlockBinding().
To avoid having to NULL check these api calls we simply reset the
block count to 0 if the array was not created.
Signed-off-by: Andres Gomez <[email protected]>
Cc: Timothy Arceri <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/compiler/glsl')
-rw-r--r-- | src/compiler/glsl/linker.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 3eddbe24d09..f9c226a22c6 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -1181,6 +1181,12 @@ interstage_cross_validate_uniform_blocks(struct gl_shader_program *prog, for (unsigned k = 0; k <= i; k++) { delete[] InterfaceBlockStageIndex[k]; } + + /* Reset the block count. This will help avoid various segfaults + * from api calls that assume the array exists due to the count + * being non-zero. + */ + *num_blks = 0; return false; } |