panfrost: Expose compute shaders as panfrost_shader_variants
Whether variants are packed by graphics or compute is irrelevant.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
diff --git a/src/gallium/drivers/panfrost/pan_compute.c b/src/gallium/drivers/panfrost/pan_compute.c
index ee3aa5e..9da2587 100644
--- a/src/gallium/drivers/panfrost/pan_compute.c
+++ b/src/gallium/drivers/panfrost/pan_compute.c
@@ -33,7 +33,11 @@
struct pipe_context *pctx,
const struct pipe_compute_state *cso)
{
- return mem_dup(cso, sizeof(*cso));
+ struct panfrost_shader_variants *so = CALLOC_STRUCT(panfrost_shader_variants);
+ so->cbase = *cso;
+ so->is_compute = true;
+
+ return so;
}
static void
diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h
index f85d70a..64de962 100644
--- a/src/gallium/drivers/panfrost/pan_context.h
+++ b/src/gallium/drivers/panfrost/pan_context.h
@@ -231,7 +231,15 @@
/* A collection of varyings (the CSO) */
struct panfrost_shader_variants {
- struct pipe_shader_state base;
+ /* A panfrost_shader_variants can represent a shader for
+ * either graphics or compute */
+
+ bool is_compute;
+
+ union {
+ struct pipe_shader_state base;
+ struct pipe_compute_state cbase;
+ };
struct panfrost_shader_state variants[MAX_SHADER_VARIANTS];
unsigned variant_count;