diff options
author | Timothy Arceri <[email protected]> | 2018-02-26 20:40:38 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2018-04-02 14:56:00 +1000 |
commit | 2ca5d9548fc42bfb19c21dd119845b941ada63a6 (patch) | |
tree | fa2ebc8cbb17f46a9bb38e81ee9419942b5bce10 /src | |
parent | 2f175bfe5d8ca59a8a68b6d6d072cd7bf2f8baa9 (diff) |
st/glsl_to_nir: gather next_stage in shader_info
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/shader_info.h | 5 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_nir.cpp | 15 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h index 737e9cffa86..ababe520b2d 100644 --- a/src/compiler/shader_info.h +++ b/src/compiler/shader_info.h @@ -64,6 +64,11 @@ typedef struct shader_info { /** The shader stage, such as MESA_SHADER_VERTEX. */ gl_shader_stage stage; + /** The shader stage in a non SSO linked program that follows this stage, + * such as MESA_SHADER_FRAGMENT. + */ + gl_shader_stage next_stage; + /* Number of textures used by this shader */ unsigned num_textures; /* Number of uniform buffers used by this shader */ diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp index 2cd1d97baec..f2d4b184d67 100644 --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp @@ -362,6 +362,21 @@ st_glsl_to_nir(struct st_context *st, struct gl_program *prog, nir_shader *nir = glsl_to_nir(shader_program, stage, options); + /* Set the next shader stage hint for VS and TES. */ + if (!nir->info.separate_shader && + (nir->info.stage == MESA_SHADER_VERTEX || + nir->info.stage == MESA_SHADER_TESS_EVAL)) { + + unsigned prev_stages = (1 << (prog->info.stage + 1)) - 1; + unsigned stages_mask = + ~prev_stages & shader_program->data->linked_stages; + + nir->info.next_stage = stages_mask ? + (gl_shader_stage) ffs(stages_mask) : MESA_SHADER_FRAGMENT; + } else { + nir->info.next_stage = MESA_SHADER_FRAGMENT; + } + nir_variable_mode mask = (nir_variable_mode) (nir_var_shader_in | nir_var_shader_out); nir_remove_dead_variables(nir, mask); |