mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 13:28:06 +02:00
zink: export compute-specific shader/compute caps
this doesn't enable the compute cap itself, it just handles all the other caps Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8781>
This commit is contained in:
parent
a2771967cb
commit
c5cf5ad6f0
1 changed files with 64 additions and 0 deletions
|
|
@ -93,6 +93,67 @@ get_video_mem(struct zink_screen *screen)
|
|||
return (int)(size >> 20);
|
||||
}
|
||||
|
||||
static int
|
||||
zink_get_compute_param(struct pipe_screen *pscreen, enum pipe_shader_ir ir_type,
|
||||
enum pipe_compute_cap param, void *ret)
|
||||
{
|
||||
struct zink_screen *screen = zink_screen(pscreen);
|
||||
#define RET(x) do { \
|
||||
if (ret) \
|
||||
memcpy(ret, x, sizeof(x)); \
|
||||
return sizeof(x); \
|
||||
} while (0)
|
||||
|
||||
switch (param) {
|
||||
case PIPE_COMPUTE_CAP_ADDRESS_BITS:
|
||||
RET((uint32_t []){ 32 });
|
||||
|
||||
case PIPE_COMPUTE_CAP_IR_TARGET:
|
||||
if (ret)
|
||||
strcpy(ret, "nir");
|
||||
return 4;
|
||||
|
||||
case PIPE_COMPUTE_CAP_GRID_DIMENSION:
|
||||
RET((uint64_t []) { 3 });
|
||||
|
||||
case PIPE_COMPUTE_CAP_MAX_GRID_SIZE:
|
||||
RET(((uint64_t []) { screen->info.props.limits.maxComputeWorkGroupCount[0],
|
||||
screen->info.props.limits.maxComputeWorkGroupCount[1],
|
||||
screen->info.props.limits.maxComputeWorkGroupCount[2] }));
|
||||
|
||||
case PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE:
|
||||
/* MaxComputeWorkGroupSize[0..2] */
|
||||
RET(((uint64_t []) {screen->info.props.limits.maxComputeWorkGroupSize[0],
|
||||
screen->info.props.limits.maxComputeWorkGroupSize[1],
|
||||
screen->info.props.limits.maxComputeWorkGroupSize[2]}));
|
||||
|
||||
case PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK:
|
||||
case PIPE_COMPUTE_CAP_MAX_VARIABLE_THREADS_PER_BLOCK:
|
||||
RET((uint64_t []) { screen->info.props.limits.maxComputeWorkGroupInvocations });
|
||||
|
||||
case PIPE_COMPUTE_CAP_MAX_LOCAL_SIZE:
|
||||
RET((uint64_t []) { screen->info.props.limits.maxComputeSharedMemorySize });
|
||||
|
||||
case PIPE_COMPUTE_CAP_IMAGES_SUPPORTED:
|
||||
RET((uint32_t []) { 1 });
|
||||
|
||||
case PIPE_COMPUTE_CAP_SUBGROUP_SIZE:
|
||||
RET((uint32_t []) { screen->info.props11.subgroupSize });
|
||||
|
||||
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_MAX_GLOBAL_SIZE:
|
||||
case PIPE_COMPUTE_CAP_MAX_PRIVATE_SIZE:
|
||||
case PIPE_COMPUTE_CAP_MAX_INPUT_SIZE:
|
||||
// XXX: I think these are for Clover...
|
||||
return 0;
|
||||
|
||||
default:
|
||||
unreachable("unknown compute param");
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
zink_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
|
||||
{
|
||||
|
|
@ -432,6 +493,8 @@ zink_get_shader_param(struct pipe_screen *pscreen,
|
|||
return INT_MAX;
|
||||
break;
|
||||
|
||||
case PIPE_SHADER_COMPUTE:
|
||||
return INT_MAX;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -1149,6 +1212,7 @@ zink_internal_create_screen(const struct pipe_screen_config *config)
|
|||
screen->base.get_name = zink_get_name;
|
||||
screen->base.get_vendor = zink_get_vendor;
|
||||
screen->base.get_device_vendor = zink_get_device_vendor;
|
||||
screen->base.get_compute_param = zink_get_compute_param;
|
||||
screen->base.get_param = zink_get_param;
|
||||
screen->base.get_paramf = zink_get_paramf;
|
||||
screen->base.get_shader_param = zink_get_shader_param;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue