radv: pre-calculate user_data_0 registers and store in pipeline
There's no point recalculating these the whole time on descriptor emission, just store them at pipeline creation. Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
@@ -574,7 +574,7 @@ radv_emit_userdata_address(struct radv_cmd_buffer *cmd_buffer,
|
||||
int idx, uint64_t va)
|
||||
{
|
||||
struct ac_userdata_info *loc = radv_lookup_user_sgpr(pipeline, stage, idx);
|
||||
uint32_t base_reg = radv_shader_stage_to_user_data_0(stage, cmd_buffer->device->physical_device->rad_info.chip_class, radv_pipeline_has_gs(pipeline), radv_pipeline_has_tess(pipeline));
|
||||
uint32_t base_reg = pipeline->user_data_0[stage];
|
||||
if (loc->sgpr_idx == -1)
|
||||
return;
|
||||
assert(loc->num_sgprs == 2);
|
||||
@@ -616,7 +616,7 @@ radv_update_multisample_state(struct radv_cmd_buffer *cmd_buffer,
|
||||
if (pipeline->shaders[MESA_SHADER_FRAGMENT]->info.info.ps.needs_sample_positions) {
|
||||
uint32_t offset;
|
||||
struct ac_userdata_info *loc = radv_lookup_user_sgpr(pipeline, MESA_SHADER_FRAGMENT, AC_UD_PS_SAMPLE_POS_OFFSET);
|
||||
uint32_t base_reg = radv_shader_stage_to_user_data_0(MESA_SHADER_FRAGMENT, cmd_buffer->device->physical_device->rad_info.chip_class, radv_pipeline_has_gs(pipeline), radv_pipeline_has_tess(pipeline));
|
||||
uint32_t base_reg = pipeline->user_data_0[MESA_SHADER_FRAGMENT];
|
||||
if (loc->sgpr_idx == -1)
|
||||
return;
|
||||
assert(loc->num_sgprs == 1);
|
||||
@@ -860,7 +860,7 @@ radv_emit_tess_shaders(struct radv_cmd_buffer *cmd_buffer,
|
||||
|
||||
loc = radv_lookup_user_sgpr(pipeline, MESA_SHADER_TESS_CTRL, AC_UD_TCS_OFFCHIP_LAYOUT);
|
||||
if (loc->sgpr_idx != -1) {
|
||||
uint32_t base_reg = radv_shader_stage_to_user_data_0(MESA_SHADER_TESS_CTRL, cmd_buffer->device->physical_device->rad_info.chip_class, radv_pipeline_has_gs(pipeline), radv_pipeline_has_tess(pipeline));
|
||||
uint32_t base_reg = pipeline->user_data_0[MESA_SHADER_TESS_CTRL];
|
||||
assert(loc->num_sgprs == 4);
|
||||
assert(!loc->indirect);
|
||||
radeon_set_sh_reg_seq(cmd_buffer->cs, base_reg + loc->sgpr_idx * 4, 4);
|
||||
@@ -873,7 +873,7 @@ radv_emit_tess_shaders(struct radv_cmd_buffer *cmd_buffer,
|
||||
|
||||
loc = radv_lookup_user_sgpr(pipeline, MESA_SHADER_TESS_EVAL, AC_UD_TES_OFFCHIP_LAYOUT);
|
||||
if (loc->sgpr_idx != -1) {
|
||||
uint32_t base_reg = radv_shader_stage_to_user_data_0(MESA_SHADER_TESS_EVAL, cmd_buffer->device->physical_device->rad_info.chip_class, radv_pipeline_has_gs(pipeline), radv_pipeline_has_tess(pipeline));
|
||||
uint32_t base_reg = pipeline->user_data_0[MESA_SHADER_TESS_EVAL];
|
||||
assert(loc->num_sgprs == 1);
|
||||
assert(!loc->indirect);
|
||||
|
||||
@@ -883,7 +883,7 @@ radv_emit_tess_shaders(struct radv_cmd_buffer *cmd_buffer,
|
||||
|
||||
loc = radv_lookup_user_sgpr(pipeline, MESA_SHADER_VERTEX, AC_UD_VS_LS_TCS_IN_LAYOUT);
|
||||
if (loc->sgpr_idx != -1) {
|
||||
uint32_t base_reg = radv_shader_stage_to_user_data_0(MESA_SHADER_VERTEX, cmd_buffer->device->physical_device->rad_info.chip_class, radv_pipeline_has_gs(pipeline), radv_pipeline_has_tess(pipeline));
|
||||
uint32_t base_reg = pipeline->user_data_0[MESA_SHADER_VERTEX];
|
||||
assert(loc->num_sgprs == 1);
|
||||
assert(!loc->indirect);
|
||||
|
||||
@@ -1599,7 +1599,7 @@ emit_stage_descriptor_set_userdata(struct radv_cmd_buffer *cmd_buffer,
|
||||
gl_shader_stage stage)
|
||||
{
|
||||
struct ac_userdata_info *desc_set_loc = &pipeline->shaders[stage]->info.user_sgprs_locs.descriptor_sets[idx];
|
||||
uint32_t base_reg = radv_shader_stage_to_user_data_0(stage, cmd_buffer->device->physical_device->rad_info.chip_class, radv_pipeline_has_gs(pipeline), radv_pipeline_has_tess(pipeline));
|
||||
uint32_t base_reg = pipeline->user_data_0[stage];
|
||||
|
||||
if (desc_set_loc->sgpr_idx == -1 || desc_set_loc->indirect)
|
||||
return;
|
||||
@@ -2978,7 +2978,7 @@ static void radv_emit_view_index(struct radv_cmd_buffer *cmd_buffer, unsigned in
|
||||
struct ac_userdata_info *loc = radv_lookup_user_sgpr(pipeline, stage, AC_UD_VIEW_INDEX);
|
||||
if (loc->sgpr_idx == -1)
|
||||
continue;
|
||||
uint32_t base_reg = radv_shader_stage_to_user_data_0(stage, cmd_buffer->device->physical_device->rad_info.chip_class, radv_pipeline_has_gs(pipeline), radv_pipeline_has_tess(pipeline));
|
||||
uint32_t base_reg = pipeline->user_data_0[stage];
|
||||
radeon_set_sh_reg(cmd_buffer->cs, base_reg + loc->sgpr_idx * 4, index);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user