From 1b284628ef8bc3c0fa4513a1fe64b6ed556fd4b2 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 31 Jul 2019 15:20:00 -0700 Subject: [PATCH] panfrost: Expose compute shaders as panfrost_shader_variants Whether variants are packed by graphics or compute is irrelevant. Signed-off-by: Alyssa Rosenzweig --- src/gallium/drivers/panfrost/pan_compute.c | 6 +++++- src/gallium/drivers/panfrost/pan_context.h | 10 +++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_compute.c b/src/gallium/drivers/panfrost/pan_compute.c index ee3aa5edb36..9da25874b5e 100644 --- a/src/gallium/drivers/panfrost/pan_compute.c +++ b/src/gallium/drivers/panfrost/pan_compute.c @@ -33,7 +33,11 @@ panfrost_create_compute_state( 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 f85d70a123d..64de9624f51 100644 --- a/src/gallium/drivers/panfrost/pan_context.h +++ b/src/gallium/drivers/panfrost/pan_context.h @@ -231,7 +231,15 @@ struct panfrost_shader_state { /* 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; -- 2.30.2