From: Michael Tretter <[email protected]> For NIR shaders, get the shader stage from the nir_shader structure instead from tgsi_shader_info.
Signed-off-by: Michael Tretter <[email protected]> Signed-off-by: Philipp Zabel <[email protected]> --- .../drivers/etnaviv/etnaviv_compiler.c | 37 ++++++++++++++++++- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler.c b/src/gallium/drivers/etnaviv/etnaviv_compiler.c index f87708d33f03..59caff435e64 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_compiler.c +++ b/src/gallium/drivers/etnaviv/etnaviv_compiler.c @@ -255,6 +255,39 @@ sort_rec_compar(const struct sort_rec *a, const struct sort_rec *b) return 0; } +static inline enum pipe_shader_type +st_shader_stage_to_ptarget(gl_shader_stage stage) +{ + switch (stage) { + case MESA_SHADER_VERTEX: + return PIPE_SHADER_VERTEX; + case MESA_SHADER_FRAGMENT: + return PIPE_SHADER_FRAGMENT; + case MESA_SHADER_GEOMETRY: + return PIPE_SHADER_GEOMETRY; + case MESA_SHADER_TESS_CTRL: + return PIPE_SHADER_TESS_CTRL; + case MESA_SHADER_TESS_EVAL: + return PIPE_SHADER_TESS_EVAL; + case MESA_SHADER_COMPUTE: + return PIPE_SHADER_COMPUTE; + default: + break; + } + + assert(!"Invalid shader type"); + return PIPE_SHADER_VERTEX; +} + +static inline bool +etna_shader_is_stage(struct etna_compile *c, gl_shader_stage stage) +{ + if (!c->s) + return c->info.processor == st_shader_stage_to_ptarget(stage); + else + return c->s->info.stage == stage; +} + /* Calculate "mystery meat" load balancing value. This value determines how * work is scheduled between VS and PS in the unified shader architecture. * More precisely, it is determined from the number of VS outputs, as well as @@ -658,7 +691,7 @@ etna_compile_pass_check_usage(struct etna_compile *c) static void assign_special_inputs(struct etna_compile *c) { - if (c->info.processor == PIPE_SHADER_FRAGMENT) { + if (etna_shader_is_stage(c, MESA_SHADER_FRAGMENT)) { /* never assign t0 as it is the position output, start assigning at t1 */ c->next_free_native = 1; @@ -2424,7 +2457,7 @@ fill_in_vs_outputs(struct etna_shader_variant *sobj, struct etna_compile *c) static bool etna_compile_check_limits(struct etna_compile *c) { - int max_uniforms = (c->info.processor == PIPE_SHADER_VERTEX) + int max_uniforms = etna_shader_is_stage(c, MESA_SHADER_VERTEX) ? c->specs->max_vs_uniforms : c->specs->max_ps_uniforms; /* round up number of uniforms, including immediates, in units of four */ -- 2.17.1 _______________________________________________ mesa-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-dev
