aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/panfrost
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-07-31 15:31:23 -0700
committerAlyssa Rosenzweig <[email protected]>2019-08-01 16:23:03 -0700
commit22a8f6de6171abc20bcde3df87597248cad69249 (patch)
tree7e7d9ef8f9a6b4cbb0f72e8ed4745cbcaf17f257 /src/gallium/drivers/panfrost
parent1b284628ef8bc3c0fa4513a1fe64b6ed556fd4b2 (diff)
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 <[email protected]>
Diffstat (limited to 'src/gallium/drivers/panfrost')
-rw-r--r--src/gallium/drivers/panfrost/pan_compute.c28
1 files 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