diff options
author | Neil Roberts <[email protected]> | 2018-06-12 22:24:00 +0200 |
---|---|---|
committer | Alejandro PiƱeiro <[email protected]> | 2019-07-12 23:42:42 +0200 |
commit | 8419621176502f906aac80601eecfcdce5324ff4 (patch) | |
tree | 273de76dbc785018c8608b269efa507d407755e4 /src | |
parent | 022e9ddd1af810083b847b307baadb6bad7735da (diff) |
mesa/glspirv: Validate that compute shaders are not linked with other stages
The test is based on link_shaders().
For example, it allows the following test (when run on SPIR-V mode) to
pass:
spec/arb_compute_shader/linker/mix_compute_and_non_compute.shader_test
Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/glspirv.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mesa/main/glspirv.c b/src/mesa/main/glspirv.c index 73878d90365..21a1beb8453 100644 --- a/src/mesa/main/glspirv.c +++ b/src/mesa/main/glspirv.c @@ -203,6 +203,16 @@ _mesa_spirv_link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) } } } + + /* Compute shaders have additional restrictions. */ + if ((prog->data->linked_stages & (1 << MESA_SHADER_COMPUTE)) && + (prog->data->linked_stages & ~(1 << MESA_SHADER_COMPUTE))) { + ralloc_asprintf_append(&prog->data->InfoLog, + "Compute shaders may not be linked with any other " + "type of shader\n"); + prog->data->LinkStatus = LINKING_FAILURE; + return; + } } nir_shader * |