From 22a8f6de6171abc20bcde3df87597248cad69249 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 31 Jul 2019 15:31:23 -0700 Subject: [PATCH] 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 --- src/gallium/drivers/panfrost/pan_compute.c | 28 +++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_compute.c b/src/gallium/drivers/panfrost/pan_compute.c index 9da25874b5e..71065e28ba7 100644 --- a/src/gallium/drivers/panfrost/pan_compute.c +++ b/src/gallium/drivers/panfrost/pan_compute.c @@ -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); + + struct panfrost_shader_variants *variants = + (struct panfrost_shader_variants *) cso; - printf("Binding compute %p\n", state); - /* Stub */ + ctx->shader[PIPE_SHADER_COMPUTE] = variants; } static void -- 2.30.2