panfrost: Expose compute shaders as panfrost_shader_variants
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 31 Jul 2019 22:20:00 +0000 (15:20 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 1 Aug 2019 23:23:03 +0000 (16:23 -0700)
Whether variants are packed by graphics or compute is irrelevant.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/gallium/drivers/panfrost/pan_compute.c
src/gallium/drivers/panfrost/pan_context.h

index ee3aa5edb367014b36760f0cf1a136ae44687b87..9da25874b5e33c84f047c03c6411de439cb90799 100644 (file)
@@ -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
index f85d70a123df5497e07d13375c372d4b9eaf520b..64de9624f51839ff02a488a2dff65d073f7d71e7 100644 (file)
@@ -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;