diff options
author | Dave Airlie <[email protected]> | 2019-08-27 15:28:26 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2019-09-04 15:22:20 +1000 |
commit | 4e709705076324ddc69e26619620752dc3ea094b (patch) | |
tree | 94deda492d26b32b74df52fa795485a6c7fa054a /src | |
parent | 0b51e73de22456c2d2b9dd7c643c14678594059c (diff) |
llvmpipe: add compute shader parameter fetching support
Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_screen.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 758960514fc..05201bf83fb 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -402,6 +402,7 @@ llvmpipe_get_shader_param(struct pipe_screen *screen, switch(shader) { case PIPE_SHADER_FRAGMENT: + case PIPE_SHADER_COMPUTE: switch (param) { default: return gallivm_get_shader_param(param); @@ -459,6 +460,58 @@ llvmpipe_get_paramf(struct pipe_screen *screen, enum pipe_capf param) return 0.0; } +static int +llvmpipe_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 = 1024; + } + return sizeof(uint64_t); + case PIPE_COMPUTE_CAP_MAX_LOCAL_SIZE: + if (ret) { + uint64_t *max_local_size = ret; + *max_local_size = 32768; + } + return sizeof(uint64_t); + case PIPE_COMPUTE_CAP_GRID_DIMENSION: + case PIPE_COMPUTE_CAP_MAX_GLOBAL_SIZE: + case PIPE_COMPUTE_CAP_MAX_PRIVATE_SIZE: + case PIPE_COMPUTE_CAP_MAX_INPUT_SIZE: + case PIPE_COMPUTE_CAP_MAX_MEM_ALLOC_SIZE: + case PIPE_COMPUTE_CAP_MAX_CLOCK_FREQUENCY: + case PIPE_COMPUTE_CAP_MAX_COMPUTE_UNITS: + case PIPE_COMPUTE_CAP_IMAGES_SUPPORTED: + case PIPE_COMPUTE_CAP_SUBGROUP_SIZE: + case PIPE_COMPUTE_CAP_ADDRESS_BITS: + case PIPE_COMPUTE_CAP_MAX_VARIABLE_THREADS_PER_BLOCK: + break; + } + return 0; +} /** * Query format support for creating a texture, drawing surface, etc. @@ -695,6 +748,7 @@ llvmpipe_create_screen(struct sw_winsys *winsys) screen->base.get_device_vendor = llvmpipe_get_vendor; // TODO should be the CPU vendor screen->base.get_param = llvmpipe_get_param; screen->base.get_shader_param = llvmpipe_get_shader_param; + screen->base.get_compute_param = llvmpipe_get_compute_param; screen->base.get_paramf = llvmpipe_get_paramf; screen->base.is_format_supported = llvmpipe_is_format_supported; |