From c54fc0d07b1a92e065000c1301971b93439595e2 Mon Sep 17 00:00:00 2001 From: Caio Marcelo de Oliveira Filho Date: Fri, 20 Mar 2020 21:02:06 -0700 Subject: intel/compiler: Replace cs_prog_data->push.total with a helper The push.total field had three values but only one was directly used (size). Replace it with a helper function that explicitly takes the cs_prog_data and the number of threads -- and use that in the drivers. This is a preparation for ARB_compute_variable_group_size where the number of threads (hence the total size for push constants) is not defined at compile time (not cs_prog_data->threads). Reviewed-by: Paulo Zanoni Reviewed-by: Jordan Justen Part-of: --- src/mesa/drivers/dri/i965/gen6_constant_state.c | 6 ++++-- src/mesa/drivers/dri/i965/genX_state_upload.c | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/gen6_constant_state.c b/src/mesa/drivers/dri/i965/gen6_constant_state.c index 919aee49ade..50e34fc9c8f 100644 --- a/src/mesa/drivers/dri/i965/gen6_constant_state.c +++ b/src/mesa/drivers/dri/i965/gen6_constant_state.c @@ -303,14 +303,16 @@ brw_upload_cs_push_constants(struct brw_context *brw, /* XXX: Should this happen somewhere before to get our state flag set? */ _mesa_load_state_parameters(ctx, prog->Parameters); - if (cs_prog_data->push.total.size == 0) { + const unsigned push_const_size = + brw_cs_push_const_total_size(cs_prog_data, cs_prog_data->threads); + if (push_const_size == 0) { stage_state->push_const_size = 0; return; } uint32_t *param = - brw_state_batch(brw, ALIGN(cs_prog_data->push.total.size, 64), + brw_state_batch(brw, ALIGN(push_const_size, 64), 64, &stage_state->push_const_offset); assert(param); diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c b/src/mesa/drivers/dri/i965/genX_state_upload.c index 898d5aa7a43..fed5eda8e48 100644 --- a/src/mesa/drivers/dri/i965/genX_state_upload.c +++ b/src/mesa/drivers/dri/i965/genX_state_upload.c @@ -4358,10 +4358,11 @@ genX(upload_cs_state)(struct brw_context *brw) vfe.CURBEAllocationSize = vfe_curbe_allocation; } - if (cs_prog_data->push.total.size > 0) { + const unsigned push_const_size = + brw_cs_push_const_total_size(cs_prog_data, cs_prog_data->threads); + if (push_const_size > 0) { brw_batch_emit(brw, GENX(MEDIA_CURBE_LOAD), curbe) { - curbe.CURBETotalDataLength = - ALIGN(cs_prog_data->push.total.size, 64); + curbe.CURBETotalDataLength = ALIGN(push_const_size, 64); curbe.CURBEDataStartAddress = stage_state->push_const_offset; } } -- cgit v1.2.3