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 <alyssa.rosenzweig@collabora.com>
This commit is contained in:
Alyssa Rosenzweig 2019-07-31 15:49:13 -07:00
parent d9eb65c60c
commit 4647999327
4 changed files with 9 additions and 32 deletions

View 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);

View 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);

View 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"
@ -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;
}

View 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