Just a sysval to route through.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
{
struct panfrost_context *ctx = pan_context(pipe);
+ ctx->compute_grid = info;
+
struct mali_job_descriptor_header job = {
.job_type = JOB_TYPE_COMPUTE,
.job_descriptor_size = 1,
uniform->u[2] = sb.buffer_size;
}
+static void panfrost_upload_num_work_groups_sysval(struct panfrost_context *ctx,
+ struct sysval_uniform *uniform)
+{
+ uniform->u[0] = ctx->compute_grid->grid[0];
+ uniform->u[1] = ctx->compute_grid->grid[1];
+ uniform->u[2] = ctx->compute_grid->grid[2];
+}
+
static void panfrost_upload_sysvals(struct panfrost_context *ctx, void *buf,
struct panfrost_shader_state *ss,
enum pipe_shader_type st)
panfrost_upload_ssbo_sysval(ctx, st, PAN_SYSVAL_ID(sysval),
&uniforms[i]);
break;
+ case PAN_SYSVAL_NUM_WORK_GROUPS:
+ panfrost_upload_num_work_groups_sysval(ctx, &uniforms[i]);
+ break;
+
default:
assert(0);
}
/* panfrost_resource -> panfrost_job */
struct hash_table *write_jobs;
+ /* Within a launch_grid call.. */
+ const struct pipe_grid_info *compute_grid;
+
/* Bit mask for supported PIPE_DRAW for this hardware */
unsigned draw_modes;
return PAN_SYSVAL_VIEWPORT_SCALE;
case nir_intrinsic_load_viewport_offset:
return PAN_SYSVAL_VIEWPORT_OFFSET;
+ case nir_intrinsic_load_num_work_groups:
+ return PAN_SYSVAL_NUM_WORK_GROUPS;
case nir_intrinsic_load_ssbo:
case nir_intrinsic_store_ssbo:
return midgard_sysval_for_ssbo(instr);
case nir_intrinsic_load_viewport_scale:
case nir_intrinsic_load_viewport_offset:
+ case nir_intrinsic_load_num_work_groups:
emit_sysval_read(ctx, &instr->instr, -1, 3);
break;
PAN_SYSVAL_VIEWPORT_OFFSET = 2,
PAN_SYSVAL_TEXTURE_SIZE = 3,
PAN_SYSVAL_SSBO = 4,
+ PAN_SYSVAL_NUM_WORK_GROUPS = 5,
} pan_sysval;
#define PAN_TXS_SYSVAL_ID(texidx, dim, is_array) \