summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/softpipe/sp_screen.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2016-04-26 14:32:52 +1000
committerDave Airlie <airlied@redhat.com>2016-04-26 15:06:43 +1000
commit477f65a6ab74a76efc34b85adc8df647d3e86c54 (patch)
tree5c62cddda4773480c79f224a6b3aa1c3b76a02dd /src/gallium/drivers/softpipe/sp_screen.c
parent10c0fa7f7b457d996b3405f749af3976fa42af78 (diff)
softpipe: add support for compute shaders.HEADmaster
This enables ARB_compute_shader on softpipe. I've only tested this with piglit so far, and I hopefully plan on integrating it with my vulkan work. I'll get to testing it with deqp more later. The basic premise is to create up to 1024 restartable TGSI machines, and execute workgroups of those machines. v1.1: free machines. Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_screen.c')
-rw-r--r--src/gallium/drivers/softpipe/sp_screen.c48
1 files changed, 46 insertions, 2 deletions
diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
index d89d95c884c..4beeb801b90 100644
--- a/src/gallium/drivers/softpipe/sp_screen.c
+++ b/src/gallium/drivers/softpipe/sp_screen.c
@@ -157,7 +157,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION:
return 0;
case PIPE_CAP_COMPUTE:
- return 0;
+ return 1;
case PIPE_CAP_USER_VERTEX_BUFFERS:
case PIPE_CAP_USER_INDEX_BUFFERS:
case PIPE_CAP_USER_CONSTANT_BUFFERS:
@@ -289,6 +289,8 @@ softpipe_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe
{
case PIPE_SHADER_FRAGMENT:
return tgsi_exec_get_shader_param(param);
+ case PIPE_SHADER_COMPUTE:
+ return tgsi_exec_get_shader_param(param);
case PIPE_SHADER_VERTEX:
case PIPE_SHADER_GEOMETRY:
if (sp_screen->use_llvm)
@@ -447,6 +449,48 @@ softpipe_get_timestamp(struct pipe_screen *_screen)
return os_time_get_nano();
}
+static int
+softpipe_get_compute_param(struct pipe_screen *_screen,
+ enum pipe_shader_ir ir_type,
+ enum pipe_compute_cap param,
+ void *ret)
+{
+ switch (param) {
+ case PIPE_COMPUTE_CAP_IR_TARGET:
+ return 0;
+ case PIPE_COMPUTE_CAP_MAX_GRID_SIZE:
+ if (ret) {
+ uint64_t *grid_size = ret;
+ grid_size[0] = 65535;
+ grid_size[1] = 65535;
+ grid_size[2] = 65535;
+ }
+ return 3 * sizeof(uint64_t) ;
+ case PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE:
+ if (ret) {
+ uint64_t *block_size = ret;
+ block_size[0] = 1024;
+ block_size[1] = 1024;
+ block_size[2] = 1024;
+ }
+ return 3 * sizeof(uint64_t);
+ case PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK:
+ if (ret) {
+ uint64_t *max_threads_per_block = ret;
+ *max_threads_per_block = 2048;
+ }
+ return sizeof(uint64_t);
+ case PIPE_COMPUTE_CAP_MAX_LOCAL_SIZE:
+ if (ret) {
+ uint64_t *max_local_size = ret;
+ /* Value reported by the closed source driver. */
+ *max_local_size = 32768;
+ }
+ return sizeof(uint64_t);
+ }
+ return 0;
+}
+
/**
* Create a new pipe_screen object
* Note: we're not presently subclassing pipe_screen (no softpipe_screen).
@@ -473,7 +517,7 @@ softpipe_create_screen(struct sw_winsys *winsys)
screen->base.is_format_supported = softpipe_is_format_supported;
screen->base.context_create = softpipe_create_context;
screen->base.flush_frontbuffer = softpipe_flush_frontbuffer;
-
+ screen->base.get_compute_param = softpipe_get_compute_param;
screen->use_llvm = debug_get_option_use_llvm();
util_format_s3tc_init();