panfrost: Use gl_shader_stage directly for compiles
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 31 Jul 2019 22:49:13 +0000 (15:49 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 1 Aug 2019 23:23:03 +0000 (16:23 -0700)
No need to add a third set of enums to the mix.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/gallium/drivers/panfrost/pan_assemble.c
src/gallium/drivers/panfrost/pan_compute.c
src/gallium/drivers/panfrost/pan_context.c
src/gallium/drivers/panfrost/pan_context.h

index 3f3e866f54a28d5a0cc999b29d18a43671eb5d2a..9e24424535c8b3e032da94b6b6cb8c7c7ab7fa0d 100644 (file)
@@ -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);
index b087ff1d0d55873f7e555a01d70a4fd84751d787..10eacaa25986b012a3d30994cd10a2a22af388b7 100644 (file)
@@ -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);
 
 
 
index d7393243e87b9b6f1c3f04c1bab014db03bf9c08..93c1cb9ccae1f9c117bde74cddec61d7be9738d9 100644 (file)
@@ -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"
 /* 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;
         }
index 64de9624f51839ff02a488a2dff65d073f7d71e7..57f32480e1f5e3cba01ce9eeab3c4fc08f514eef 100644 (file)
@@ -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