lp: implement get_compute_state_info
authorKarol Herbst <kherbst@redhat.com>
Wed, 30 Nov 2022 11:53:57 +0000 (12:53 +0100)
committerMarge Bot <emma+marge@anholt.net>
Fri, 31 Mar 2023 20:29:00 +0000 (20:29 +0000)
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19855>

src/gallium/drivers/llvmpipe/lp_state_cs.c

index af119de..1f005ce 100644 (file)
@@ -548,6 +548,19 @@ llvmpipe_bind_compute_state(struct pipe_context *pipe,
    llvmpipe->cs_dirty |= LP_CSNEW_CS;
 }
 
+static void
+llvmpipe_get_compute_state_info(struct pipe_context *pipe, void *cs,
+                                struct pipe_compute_state_object_info *info)
+{
+   struct lp_compute_shader* shader = cs;
+   struct nir_shader* nir = shader->base.ir.nir;
+
+   info->max_threads = 1024;
+   info->preferred_simd_size = 32;
+   // TODO: this is a bad estimate, but not much we can do without actually compiling the shaders
+   info->private_memory = nir->scratch_size;
+}
+
 
 /**
  * Remove shader variant from two lists: the shader's variant list
@@ -1528,6 +1541,7 @@ llvmpipe_init_compute_funcs(struct llvmpipe_context *llvmpipe)
 {
    llvmpipe->pipe.create_compute_state = llvmpipe_create_compute_state;
    llvmpipe->pipe.bind_compute_state = llvmpipe_bind_compute_state;
+   llvmpipe->pipe.get_compute_state_info = llvmpipe_get_compute_state_info;
    llvmpipe->pipe.delete_compute_state = llvmpipe_delete_compute_state;
    llvmpipe->pipe.set_compute_resources = llvmpipe_set_compute_resources;
    llvmpipe->pipe.set_global_binding = llvmpipe_set_global_binding;