diff options
author | Alyssa Rosenzweig <[email protected]> | 2019-07-31 15:49:13 -0700 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2019-08-01 16:23:03 -0700 |
commit | 464799932797e9605f14b8c955c5f581db68a016 (patch) | |
tree | b954586c51e233fa447e6bac719004a586c77ae1 | |
parent | d9eb65c60c8649dcc82f136b2cb0d7d0eeef8e0d (diff) |
panfrost: Use gl_shader_stage directly for compiles
No need to add a third set of enums to the mix.
Signed-off-by: Alyssa Rosenzweig <[email protected]>
-rw-r--r-- | src/gallium/drivers/panfrost/pan_assemble.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/panfrost/pan_compute.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/panfrost/pan_context.c | 28 | ||||
-rw-r--r-- | src/gallium/drivers/panfrost/pan_context.h | 3 |
4 files changed, 9 insertions, 32 deletions
diff --git a/src/gallium/drivers/panfrost/pan_assemble.c b/src/gallium/drivers/panfrost/pan_assemble.c index 3f3e866f54a..9e24424535c 100644 --- a/src/gallium/drivers/panfrost/pan_assemble.c +++ b/src/gallium/drivers/panfrost/pan_assemble.c @@ -41,7 +41,7 @@ panfrost_shader_compile( enum pipe_shader_ir ir_type, const void *ir, const char *src, - int type, + gl_shader_stage stage, struct panfrost_shader_state *state) { uint8_t *dst; @@ -55,9 +55,9 @@ panfrost_shader_compile( s = tgsi_to_nir(ir, ctx->base.screen); } - s->info.stage = type == JOB_TYPE_VERTEX ? MESA_SHADER_VERTEX : MESA_SHADER_FRAGMENT; + s->info.stage = stage; - if (s->info.stage == MESA_SHADER_FRAGMENT) { + if (stage == MESA_SHADER_FRAGMENT) { /* Inject the alpha test now if we need to */ if (state->alpha_state.enabled) { @@ -93,7 +93,7 @@ panfrost_shader_compile( meta->midgard1.uniform_count = MIN2(program.uniform_count, program.uniform_cutoff); meta->midgard1.work_count = program.work_register_count; - switch (s->info.stage) { + switch (stage) { case MESA_SHADER_VERTEX: meta->attribute_count = util_bitcount64(s->info.inputs_read); meta->varying_count = util_bitcount64(s->info.outputs_written); diff --git a/src/gallium/drivers/panfrost/pan_compute.c b/src/gallium/drivers/panfrost/pan_compute.c index b087ff1d0d5..10eacaa2598 100644 --- a/src/gallium/drivers/panfrost/pan_compute.c +++ b/src/gallium/drivers/panfrost/pan_compute.c @@ -53,7 +53,7 @@ panfrost_create_compute_state( panfrost_shader_compile(ctx, v->tripipe, cso->ir_type, cso->prog, NULL, - JOB_TYPE_COMPUTE, v); + MESA_SHADER_COMPUTE, v); diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index d7393243e87..93c1cb9ccae 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -40,6 +40,7 @@ #include "util/u_prim_restart.h" #include "indices/u_primconvert.h" #include "tgsi/tgsi_parse.h" +#include "tgsi/tgsi_from_mesa.h" #include "util/u_math.h" #include "pan_screen.h" @@ -51,31 +52,6 @@ /* Do not actually send anything to the GPU; merely generate the cmdstream as fast as possible. Disables framebuffer writes */ //#define DRY_RUN -static enum mali_job_type -panfrost_job_type_for_pipe(enum pipe_shader_type type) { - switch (type) - { - case PIPE_SHADER_VERTEX: - return JOB_TYPE_VERTEX; - - case PIPE_SHADER_FRAGMENT: - /* Note: JOB_TYPE_FRAGMENT is different. - * JOB_TYPE_FRAGMENT actually executes the - * fragment shader, but JOB_TYPE_TILER is how you - * specify it*/ - return JOB_TYPE_TILER; - - case PIPE_SHADER_GEOMETRY: - return JOB_TYPE_GEOMETRY; - - case PIPE_SHADER_COMPUTE: - return JOB_TYPE_COMPUTE; - - default: - unreachable("Unsupported shader stage"); - } -} - /* Framebuffer descriptor */ static struct midgard_tiler_descriptor @@ -2124,7 +2100,7 @@ panfrost_bind_shader_state( variants->base.ir.nir : variants->base.tokens, NULL, - panfrost_job_type_for_pipe(type), shader_state); + tgsi_processor_to_shader_stage(type), shader_state); shader_state->compiled = true; } diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h index 64de9624f51..57f32480e1f 100644 --- a/src/gallium/drivers/panfrost/pan_context.h +++ b/src/gallium/drivers/panfrost/pan_context.h @@ -44,6 +44,7 @@ #include "util/hash_table.h" #include "midgard/midgard_compile.h" +#include "compiler/shader_enums.h" /* Forward declare to avoid extra header dep */ struct prim_convert_context; @@ -314,7 +315,7 @@ panfrost_shader_compile( enum pipe_shader_ir ir_type, const void *ir, const char *src, - int type, + gl_shader_stage stage, struct panfrost_shader_state *state); void |