diff options
author | Danylo Piliaiev <[email protected]> | 2020-02-12 12:45:55 +0200 |
---|---|---|
committer | Danylo Piliaiev <[email protected]> | 2020-02-18 09:18:37 +0000 |
commit | b684ba6ce7fc6cabf42132559192e1065891e67a (patch) | |
tree | 6f2735de351a141193e6cf364b32a124d9a73209 /src | |
parent | 9903f10636566834a7563b6828c52fe40c5b0d71 (diff) |
st/nir: Unify inputs_read/outputs_written before serializing NIR
Otherwise input/output interfaces won't be unified when reading
NIR from a cache.
Fixes piglit test on iris:
clip-distance-vs-gs-out.shader_test
Fixes: 19ed12af
Signed-off-by: Danylo Piliaiev <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3787>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3787>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_nir.cpp | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp index 35464c982a6..796bfb0317e 100644 --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp @@ -793,6 +793,25 @@ st_link_nir(struct gl_context *ctx, } } + struct shader_info *prev_info = NULL; + + for (unsigned i = 0; i < num_shaders; i++) { + struct gl_linked_shader *shader = linked_shader[i]; + struct shader_info *info = &shader->Program->nir->info; + + if (prev_info && + ctx->Const.ShaderCompilerOptions[shader->Stage].NirOptions->unify_interfaces) { + prev_info->outputs_written |= info->inputs_read & + ~(VARYING_BIT_TESS_LEVEL_INNER | VARYING_BIT_TESS_LEVEL_OUTER); + info->inputs_read |= prev_info->outputs_written & + ~(VARYING_BIT_TESS_LEVEL_INNER | VARYING_BIT_TESS_LEVEL_OUTER); + + prev_info->patch_outputs_written |= info->patch_inputs_read; + info->patch_inputs_read |= prev_info->patch_outputs_written; + } + prev_info = info; + } + for (unsigned i = 0; i < num_shaders; i++) { struct gl_linked_shader *shader = linked_shader[i]; struct gl_program *prog = shader->Program; @@ -819,28 +838,6 @@ st_link_nir(struct gl_context *ctx, shader->ir = NULL; } - struct shader_info *prev_info = NULL; - - for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) { - struct gl_linked_shader *shader = shader_program->_LinkedShaders[i]; - if (!shader) - continue; - - struct shader_info *info = &shader->Program->nir->info; - - if (prev_info && - ctx->Const.ShaderCompilerOptions[i].NirOptions->unify_interfaces) { - prev_info->outputs_written |= info->inputs_read & - ~(VARYING_BIT_TESS_LEVEL_INNER | VARYING_BIT_TESS_LEVEL_OUTER); - info->inputs_read |= prev_info->outputs_written & - ~(VARYING_BIT_TESS_LEVEL_INNER | VARYING_BIT_TESS_LEVEL_OUTER); - - prev_info->patch_outputs_written |= info->patch_inputs_read; - info->patch_inputs_read |= prev_info->patch_outputs_written; - } - prev_info = info; - } - return true; } |