panfrost: Feed compute shaders into the compiler

The path for compute shader compiles resembles the graphic shader
compile path, although it is substantially simpler as we don't need any
shader keying.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
This commit is contained in:
Alyssa Rosenzweig 2019-07-31 15:31:23 -07:00
parent 1b284628ef
commit 22a8f6de61
1 changed files with 25 additions and 3 deletions

View File

@ -28,25 +28,47 @@
#include "pan_context.h"
#include "util/u_memory.h"
/* Compute CSOs are tracked like graphics shader CSOs, but are
* considerably simpler. We do not implement multiple
* variants/keying. So the CSO create function just goes ahead and
* compiles the thing. */
static void *
panfrost_create_compute_state(
struct pipe_context *pctx,
const struct pipe_compute_state *cso)
{
struct panfrost_context *ctx = pan_context(pctx);
struct panfrost_shader_variants *so = CALLOC_STRUCT(panfrost_shader_variants);
so->cbase = *cso;
so->is_compute = true;
struct panfrost_shader_state *v = &so->variants[0];
so->variant_count = 1;
so->active_variant = 0;
v->tripipe = malloc(sizeof(struct mali_shader_meta));
panfrost_shader_compile(ctx, v->tripipe,
cso->ir_type, cso->prog, NULL,
JOB_TYPE_COMPUTE, v);
return so;
}
static void
panfrost_bind_compute_state(struct pipe_context *pipe, void *cso)
{
struct pipe_compute_state *state = (struct pipe_compute_state *) cso;
struct panfrost_context *ctx = pan_context(pipe);
printf("Binding compute %p\n", state);
/* Stub */
struct panfrost_shader_variants *variants =
(struct panfrost_shader_variants *) cso;
ctx->shader[PIPE_SHADER_COMPUTE] = variants;
}
static void