Lines Matching full:args
42 set_loc_shader(struct radv_shader_args *args, int idx, uint8_t *sgpr_idx, uint8_t num_sgprs) in set_loc_shader() argument
44 struct radv_userdata_info *ud_info = &args->shader_info->user_sgprs_locs.shader_data[idx]; in set_loc_shader()
51 set_loc_shader_ptr(struct radv_shader_args *args, int idx, uint8_t *sgpr_idx) in set_loc_shader_ptr() argument
55 set_loc_shader(args, idx, sgpr_idx, use_32bit_pointers ? 1 : 2); in set_loc_shader_ptr()
59 set_loc_desc(struct radv_shader_args *args, int idx, uint8_t *sgpr_idx) in set_loc_desc() argument
61 struct radv_userdata_locations *locs = &args->shader_info->user_sgprs_locs; in set_loc_desc()
78 needs_view_index_sgpr(struct radv_shader_args *args, gl_shader_stage stage) in needs_view_index_sgpr() argument
82 if (args->shader_info->uses_view_index || in needs_view_index_sgpr()
83 (!args->shader_info->vs.as_es && !args->shader_info->vs.as_ls && in needs_view_index_sgpr()
84 args->options->key.has_multiview_view_index)) in needs_view_index_sgpr()
88 if (args->shader_info->uses_view_index || in needs_view_index_sgpr()
89 (!args->shader_info->tes.as_es && args->options->key.has_multiview_view_index)) in needs_view_index_sgpr()
93 if (args->shader_info->uses_view_index) in needs_view_index_sgpr()
97 if (args->shader_info->uses_view_index || in needs_view_index_sgpr()
98 (args->shader_info->is_ngg && args->options->key.has_multiview_view_index)) in needs_view_index_sgpr()
108 count_vs_user_sgprs(struct radv_shader_args *args) in count_vs_user_sgprs() argument
112 if (args->shader_info->vs.vb_desc_usage_mask) in count_vs_user_sgprs()
114 if (args->shader_info->vs.needs_draw_id) in count_vs_user_sgprs()
116 if (args->shader_info->vs.needs_base_instance) in count_vs_user_sgprs()
123 count_ngg_sgprs(struct radv_shader_args *args, bool has_api_gs) in count_ngg_sgprs() argument
129 if (args->shader_info->has_ngg_culling) in count_ngg_sgprs()
136 allocate_inline_push_consts(struct radv_shader_args *args, struct user_sgpr_info *user_sgpr_info) in allocate_inline_push_consts() argument
141 if (args->shader_info->min_push_constant_used == UINT8_MAX) in allocate_inline_push_consts()
145 if (args->shader_info->has_indirect_push_constants) in allocate_inline_push_consts()
149 if (!args->shader_info->has_only_32bit_push_constants) in allocate_inline_push_consts()
153 (args->shader_info->max_push_constant_used - args->shader_info->min_push_constant_used) / 4; in allocate_inline_push_consts()
167 !args->shader_info->loads_dynamic_offsets) { in allocate_inline_push_consts()
176 allocate_user_sgprs(struct radv_shader_args *args, gl_shader_stage stage, bool has_previous_stage, in allocate_user_sgprs() argument
188 if (args->shader_info->vs.has_prolog) in allocate_user_sgprs()
193 if (args->shader_info->cs.uses_sbt) in allocate_user_sgprs()
195 if (args->shader_info->cs.uses_grid_size) in allocate_user_sgprs()
197 if (args->shader_info->cs.uses_ray_launch_size) in allocate_user_sgprs()
203 if (!args->is_gs_copy_shader) in allocate_user_sgprs()
204 user_sgpr_count += count_vs_user_sgprs(args); in allocate_user_sgprs()
209 user_sgpr_count += count_vs_user_sgprs(args); in allocate_user_sgprs()
216 if (args->shader_info->is_ngg) in allocate_user_sgprs()
217 user_sgpr_count += count_ngg_sgprs(args, has_api_gs); in allocate_user_sgprs()
220 user_sgpr_count += count_vs_user_sgprs(args); in allocate_user_sgprs()
231 if (args->shader_info->loads_push_constants) in allocate_user_sgprs()
234 if (args->shader_info->so.num_outputs) in allocate_user_sgprs()
238 args->options->chip_class >= GFX9 && stage != MESA_SHADER_COMPUTE ? 32 : 16; in allocate_user_sgprs()
240 uint32_t num_desc_set = util_bitcount(args->shader_info->desc_set_used_mask); in allocate_user_sgprs()
249 allocate_inline_push_consts(args, user_sgpr_info); in allocate_user_sgprs()
253 declare_global_input_sgprs(struct radv_shader_args *args, in declare_global_input_sgprs() argument
258 uint32_t mask = args->shader_info->desc_set_used_mask; in declare_global_input_sgprs()
263 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_CONST_PTR, &args->descriptor_sets[i]); in declare_global_input_sgprs()
266 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_CONST_PTR_PTR, &args->descriptor_sets[0]); in declare_global_input_sgprs()
269 if (args->shader_info->loads_push_constants && !user_sgpr_info->inlined_all_push_consts) { in declare_global_input_sgprs()
271 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_CONST_PTR, &args->ac.push_constants); in declare_global_input_sgprs()
275 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.inline_push_consts[i]); in declare_global_input_sgprs()
277 args->ac.base_inline_push_consts = args->shader_info->min_push_constant_used / 4; in declare_global_input_sgprs()
279 if (args->shader_info->so.num_outputs) { in declare_global_input_sgprs()
280 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_CONST_DESC_PTR, &args->streamout_buffers); in declare_global_input_sgprs()
285 declare_vs_specific_input_sgprs(struct radv_shader_args *args, gl_shader_stage stage, in declare_vs_specific_input_sgprs() argument
288 if (args->shader_info->vs.has_prolog) in declare_vs_specific_input_sgprs()
289 ac_add_arg(&args->ac, AC_ARG_SGPR, 2, AC_ARG_INT, &args->prolog_inputs); in declare_vs_specific_input_sgprs()
291 if (!args->is_gs_copy_shader && (stage == MESA_SHADER_VERTEX || in declare_vs_specific_input_sgprs()
293 if (args->shader_info->vs.vb_desc_usage_mask) { in declare_vs_specific_input_sgprs()
294 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_CONST_DESC_PTR, &args->ac.vertex_buffers); in declare_vs_specific_input_sgprs()
296 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.base_vertex); in declare_vs_specific_input_sgprs()
297 if (args->shader_info->vs.needs_draw_id) { in declare_vs_specific_input_sgprs()
298 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.draw_id); in declare_vs_specific_input_sgprs()
300 if (args->shader_info->vs.needs_base_instance) { in declare_vs_specific_input_sgprs()
301 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.start_instance); in declare_vs_specific_input_sgprs()
307 declare_vs_input_vgprs(struct radv_shader_args *args) in declare_vs_input_vgprs() argument
309 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.vertex_id); in declare_vs_input_vgprs()
310 if (!args->is_gs_copy_shader) { in declare_vs_input_vgprs()
311 if (args->shader_info->vs.as_ls) { in declare_vs_input_vgprs()
312 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.vs_rel_patch_id); in declare_vs_input_vgprs()
313 if (args->options->chip_class >= GFX10) { in declare_vs_input_vgprs()
314 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, NULL); /* user vgpr */ in declare_vs_input_vgprs()
315 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.instance_id); in declare_vs_input_vgprs()
317 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.instance_id); in declare_vs_input_vgprs()
318 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, NULL); /* unused */ in declare_vs_input_vgprs()
321 if (args->options->chip_class >= GFX10) { in declare_vs_input_vgprs()
322 if (args->shader_info->is_ngg) { in declare_vs_input_vgprs()
323 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, NULL); /* user vgpr */ in declare_vs_input_vgprs()
324 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, NULL); /* user vgpr */ in declare_vs_input_vgprs()
325 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.instance_id); in declare_vs_input_vgprs()
327 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, NULL); /* unused */ in declare_vs_input_vgprs()
328 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.vs_prim_id); in declare_vs_input_vgprs()
329 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.instance_id); in declare_vs_input_vgprs()
332 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.instance_id); in declare_vs_input_vgprs()
333 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.vs_prim_id); in declare_vs_input_vgprs()
334 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, NULL); /* unused */ in declare_vs_input_vgprs()
339 if (args->shader_info->vs.dynamic_inputs) { in declare_vs_input_vgprs()
340 assert(args->shader_info->vs.use_per_attribute_vb_descs); in declare_vs_input_vgprs()
341 unsigned num_attributes = util_last_bit(args->shader_info->vs.vb_desc_usage_mask); in declare_vs_input_vgprs()
343 ac_add_arg(&args->ac, AC_ARG_VGPR, 4, AC_ARG_INT, &args->vs_inputs[i]); in declare_vs_input_vgprs()
347 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, NULL); in declare_vs_input_vgprs()
352 declare_streamout_sgprs(struct radv_shader_args *args, gl_shader_stage stage) in declare_streamout_sgprs() argument
357 if (args->shader_info->so.num_outputs) { in declare_streamout_sgprs()
360 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.streamout_config); in declare_streamout_sgprs()
361 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.streamout_write_index); in declare_streamout_sgprs()
363 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, NULL); in declare_streamout_sgprs()
368 if (!args->shader_info->so.strides[i]) in declare_streamout_sgprs()
371 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.streamout_offset[i]); in declare_streamout_sgprs()
376 declare_tes_input_vgprs(struct radv_shader_args *args) in declare_tes_input_vgprs() argument
378 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_FLOAT, &args->ac.tes_u); in declare_tes_input_vgprs()
379 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_FLOAT, &args->ac.tes_v); in declare_tes_input_vgprs()
380 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.tes_rel_patch_id); in declare_tes_input_vgprs()
381 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.tes_patch_id); in declare_tes_input_vgprs()
385 declare_ps_input_vgprs(struct radv_shader_args *args) in declare_ps_input_vgprs() argument
387 unsigned spi_ps_input = args->shader_info->ps.spi_ps_input; in declare_ps_input_vgprs()
389 ac_add_arg(&args->ac, AC_ARG_VGPR, 2, AC_ARG_INT, &args->ac.persp_sample); in declare_ps_input_vgprs()
390 ac_add_arg(&args->ac, AC_ARG_VGPR, 2, AC_ARG_INT, &args->ac.persp_center); in declare_ps_input_vgprs()
391 ac_add_arg(&args->ac, AC_ARG_VGPR, 2, AC_ARG_INT, &args->ac.persp_centroid); in declare_ps_input_vgprs()
392 ac_add_arg(&args->ac, AC_ARG_VGPR, 3, AC_ARG_INT, &args->ac.pull_model); in declare_ps_input_vgprs()
393 ac_add_arg(&args->ac, AC_ARG_VGPR, 2, AC_ARG_INT, &args->ac.linear_sample); in declare_ps_input_vgprs()
394 ac_add_arg(&args->ac, AC_ARG_VGPR, 2, AC_ARG_INT, &args->ac.linear_center); in declare_ps_input_vgprs()
395 ac_add_arg(&args->ac, AC_ARG_VGPR, 2, AC_ARG_INT, &args->ac.linear_centroid); in declare_ps_input_vgprs()
396 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_FLOAT, NULL); /* line stipple tex */ in declare_ps_input_vgprs()
397 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_FLOAT, &args->ac.frag_pos[0]); in declare_ps_input_vgprs()
398 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_FLOAT, &args->ac.frag_pos[1]); in declare_ps_input_vgprs()
399 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_FLOAT, &args->ac.frag_pos[2]); in declare_ps_input_vgprs()
400 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_FLOAT, &args->ac.frag_pos[3]); in declare_ps_input_vgprs()
401 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.front_face); in declare_ps_input_vgprs()
402 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.ancillary); in declare_ps_input_vgprs()
403 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.sample_coverage); in declare_ps_input_vgprs()
404 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, NULL); /* fixed pt */ in declare_ps_input_vgprs()
406 if (args->options->remap_spi_ps_input) { in declare_ps_input_vgprs()
412 for (unsigned i = 0, vgpr_arg = 0, vgpr_reg = 0; i < args->ac.arg_count; i++) { in declare_ps_input_vgprs()
413 if (args->ac.args[i].file != AC_ARG_VGPR) { in declare_ps_input_vgprs()
419 args->ac.args[i].skip = true; in declare_ps_input_vgprs()
421 args->ac.args[i].offset = vgpr_reg; in declare_ps_input_vgprs()
422 vgpr_reg += args->ac.args[i].size; in declare_ps_input_vgprs()
431 declare_ngg_sgprs(struct radv_shader_args *args, bool has_api_gs) in declare_ngg_sgprs() argument
434 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ngg_gs_state); in declare_ngg_sgprs()
437 if (args->shader_info->has_ngg_culling) { in declare_ngg_sgprs()
438 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ngg_culling_settings); in declare_ngg_sgprs()
439 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ngg_viewport_scale[0]); in declare_ngg_sgprs()
440 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ngg_viewport_scale[1]); in declare_ngg_sgprs()
441 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ngg_viewport_translate[0]); in declare_ngg_sgprs()
442 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ngg_viewport_translate[1]); in declare_ngg_sgprs()
447 set_global_input_locs(struct radv_shader_args *args, const struct user_sgpr_info *user_sgpr_info, in set_global_input_locs() argument
453 for (unsigned i = 0; i < ARRAY_SIZE(args->descriptor_sets); i++) { in set_global_input_locs()
454 if (args->descriptor_sets[i].used) in set_global_input_locs()
455 set_loc_desc(args, i, user_sgpr_idx); in set_global_input_locs()
458 set_loc_shader_ptr(args, AC_UD_INDIRECT_DESCRIPTOR_SETS, user_sgpr_idx); in set_global_input_locs()
461 if (args->ac.push_constants.used) { in set_global_input_locs()
462 set_loc_shader_ptr(args, AC_UD_PUSH_CONSTANTS, user_sgpr_idx); in set_global_input_locs()
465 for (unsigned i = 0; i < ARRAY_SIZE(args->ac.inline_push_consts); i++) { in set_global_input_locs()
466 if (args->ac.inline_push_consts[i].used) in set_global_input_locs()
471 set_loc_shader(args, AC_UD_INLINE_PUSH_CONSTANTS, user_sgpr_idx, num_inline_push_consts); in set_global_input_locs()
474 if (args->streamout_buffers.used) { in set_global_input_locs()
475 set_loc_shader_ptr(args, AC_UD_STREAMOUT_BUFFERS, user_sgpr_idx); in set_global_input_locs()
480 set_vs_specific_input_locs(struct radv_shader_args *args, gl_shader_stage stage, in set_vs_specific_input_locs() argument
484 if (args->prolog_inputs.used) in set_vs_specific_input_locs()
485 set_loc_shader(args, AC_UD_VS_PROLOG_INPUTS, user_sgpr_idx, 2); in set_vs_specific_input_locs()
487 if (!args->is_gs_copy_shader && (stage == MESA_SHADER_VERTEX || in set_vs_specific_input_locs()
489 if (args->ac.vertex_buffers.used) { in set_vs_specific_input_locs()
490 set_loc_shader_ptr(args, AC_UD_VS_VERTEX_BUFFERS, user_sgpr_idx); in set_vs_specific_input_locs()
493 unsigned vs_num = args->ac.base_vertex.used + args->ac.draw_id.used + in set_vs_specific_input_locs()
494 args->ac.start_instance.used; in set_vs_specific_input_locs()
495 set_loc_shader(args, AC_UD_VS_BASE_VERTEX_START_INSTANCE, user_sgpr_idx, vs_num); in set_vs_specific_input_locs()
507 radv_declare_shader_args(struct radv_shader_args *args, gl_shader_stage stage, in radv_declare_shader_args() argument
511 bool needs_view_index = needs_view_index_sgpr(args, stage); in radv_declare_shader_args()
514 if (args->options->chip_class >= GFX10) { in radv_declare_shader_args()
515 if (is_pre_gs_stage(stage) && args->shader_info->is_ngg) { in radv_declare_shader_args()
524 args->shader_info->user_sgprs_locs.descriptor_sets[i].sgpr_idx = -1; in radv_declare_shader_args()
526 args->shader_info->user_sgprs_locs.shader_data[i].sgpr_idx = -1; in radv_declare_shader_args()
528 allocate_user_sgprs(args, stage, has_previous_stage, previous_stage, needs_view_index, in radv_declare_shader_args()
531 if (args->options->explicit_scratch_args) { in radv_declare_shader_args()
532 ac_add_arg(&args->ac, AC_ARG_SGPR, 2, AC_ARG_CONST_DESC_PTR, &args->ring_offsets); in radv_declare_shader_args()
541 declare_global_input_sgprs(args, &user_sgpr_info); in radv_declare_shader_args()
543 if (args->shader_info->cs.uses_sbt) { in radv_declare_shader_args()
544 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_CONST_DESC_PTR, &args->ac.sbt_descriptors); in radv_declare_shader_args()
547 if (args->shader_info->cs.uses_grid_size) { in radv_declare_shader_args()
548 ac_add_arg(&args->ac, AC_ARG_SGPR, 3, AC_ARG_INT, &args->ac.num_work_groups); in radv_declare_shader_args()
551 if (args->shader_info->cs.uses_ray_launch_size) { in radv_declare_shader_args()
552 ac_add_arg(&args->ac, AC_ARG_SGPR, 3, AC_ARG_INT, &args->ac.ray_launch_size); in radv_declare_shader_args()
556 if (args->shader_info->cs.uses_block_id[i]) { in radv_declare_shader_args()
557 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.workgroup_ids[i]); in radv_declare_shader_args()
561 if (args->shader_info->cs.uses_local_invocation_idx) { in radv_declare_shader_args()
562 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.tg_size); in radv_declare_shader_args()
565 if (args->options->explicit_scratch_args) { in radv_declare_shader_args()
566 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.scratch_offset); in radv_declare_shader_args()
569 ac_add_arg(&args->ac, AC_ARG_VGPR, 3, AC_ARG_INT, &args->ac.local_invocation_ids); in radv_declare_shader_args()
573 assert(!args->shader_info->is_ngg); in radv_declare_shader_args()
575 declare_vs_specific_input_sgprs(args, stage, has_previous_stage, previous_stage); in radv_declare_shader_args()
577 declare_global_input_sgprs(args, &user_sgpr_info); in radv_declare_shader_args()
580 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.view_index); in radv_declare_shader_args()
583 if (args->shader_info->vs.as_es) { in radv_declare_shader_args()
584 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.es2gs_offset); in radv_declare_shader_args()
585 } else if (args->shader_info->vs.as_ls) { in radv_declare_shader_args()
588 declare_streamout_sgprs(args, stage); in radv_declare_shader_args()
591 if (args->options->explicit_scratch_args) { in radv_declare_shader_args()
592 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.scratch_offset); in radv_declare_shader_args()
595 declare_vs_input_vgprs(args); in radv_declare_shader_args()
600 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.tess_offchip_offset); in radv_declare_shader_args()
601 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.merged_wave_info); in radv_declare_shader_args()
602 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.tcs_factor_offset); in radv_declare_shader_args()
604 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.scratch_offset); in radv_declare_shader_args()
605 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, NULL); // unknown in radv_declare_shader_args()
606 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, NULL); // unknown in radv_declare_shader_args()
608 declare_vs_specific_input_sgprs(args, stage, has_previous_stage, previous_stage); in radv_declare_shader_args()
610 declare_global_input_sgprs(args, &user_sgpr_info); in radv_declare_shader_args()
613 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.view_index); in radv_declare_shader_args()
616 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.tcs_patch_id); in radv_declare_shader_args()
617 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.tcs_rel_ids); in radv_declare_shader_args()
619 declare_vs_input_vgprs(args); in radv_declare_shader_args()
621 declare_global_input_sgprs(args, &user_sgpr_info); in radv_declare_shader_args()
624 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.view_index); in radv_declare_shader_args()
627 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.tess_offchip_offset); in radv_declare_shader_args()
628 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.tcs_factor_offset); in radv_declare_shader_args()
629 if (args->options->explicit_scratch_args) { in radv_declare_shader_args()
630 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.scratch_offset); in radv_declare_shader_args()
632 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.tcs_patch_id); in radv_declare_shader_args()
633 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.tcs_rel_ids); in radv_declare_shader_args()
638 assert(!args->shader_info->is_ngg); in radv_declare_shader_args()
640 declare_global_input_sgprs(args, &user_sgpr_info); in radv_declare_shader_args()
643 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.view_index); in radv_declare_shader_args()
645 if (args->shader_info->tes.as_es) { in radv_declare_shader_args()
646 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.tess_offchip_offset); in radv_declare_shader_args()
647 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, NULL); in radv_declare_shader_args()
648 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.es2gs_offset); in radv_declare_shader_args()
650 declare_streamout_sgprs(args, stage); in radv_declare_shader_args()
651 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.tess_offchip_offset); in radv_declare_shader_args()
653 if (args->options->explicit_scratch_args) { in radv_declare_shader_args()
654 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.scratch_offset); in radv_declare_shader_args()
656 declare_tes_input_vgprs(args); in radv_declare_shader_args()
661 if (args->shader_info->is_ngg) { in radv_declare_shader_args()
662 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.gs_tg_info); in radv_declare_shader_args()
664 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.gs2vs_offset); in radv_declare_shader_args()
667 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.merged_wave_info); in radv_declare_shader_args()
668 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.tess_offchip_offset); in radv_declare_shader_args()
670 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.scratch_offset); in radv_declare_shader_args()
671 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, NULL); // unknown in radv_declare_shader_args()
672 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, NULL); // unknown in radv_declare_shader_args()
675 declare_vs_specific_input_sgprs(args, stage, has_previous_stage, previous_stage); in radv_declare_shader_args()
678 declare_global_input_sgprs(args, &user_sgpr_info); in radv_declare_shader_args()
681 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.view_index); in radv_declare_shader_args()
684 if (args->shader_info->is_ngg) { in radv_declare_shader_args()
685 declare_ngg_sgprs(args, has_api_gs); in radv_declare_shader_args()
688 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.gs_vtx_offset[0]); in radv_declare_shader_args()
689 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.gs_vtx_offset[1]); in radv_declare_shader_args()
690 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.gs_prim_id); in radv_declare_shader_args()
691 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.gs_invocation_id); in radv_declare_shader_args()
692 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.gs_vtx_offset[2]); in radv_declare_shader_args()
695 declare_vs_input_vgprs(args); in radv_declare_shader_args()
697 declare_tes_input_vgprs(args); in radv_declare_shader_args()
700 declare_global_input_sgprs(args, &user_sgpr_info); in radv_declare_shader_args()
703 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.view_index); in radv_declare_shader_args()
706 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.gs2vs_offset); in radv_declare_shader_args()
707 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.gs_wave_id); in radv_declare_shader_args()
708 if (args->options->explicit_scratch_args) { in radv_declare_shader_args()
709 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.scratch_offset); in radv_declare_shader_args()
711 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.gs_vtx_offset[0]); in radv_declare_shader_args()
712 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.gs_vtx_offset[1]); in radv_declare_shader_args()
713 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.gs_prim_id); in radv_declare_shader_args()
714 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.gs_vtx_offset[2]); in radv_declare_shader_args()
715 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.gs_vtx_offset[3]); in radv_declare_shader_args()
716 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.gs_vtx_offset[4]); in radv_declare_shader_args()
717 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.gs_vtx_offset[5]); in radv_declare_shader_args()
718 ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.gs_invocation_id); in radv_declare_shader_args()
722 declare_global_input_sgprs(args, &user_sgpr_info); in radv_declare_shader_args()
724 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.prim_mask); in radv_declare_shader_args()
725 if (args->options->explicit_scratch_args) { in radv_declare_shader_args()
726 ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.scratch_offset); in radv_declare_shader_args()
729 declare_ps_input_vgprs(args); in radv_declare_shader_args()
735 args->shader_info->num_input_vgprs = 0; in radv_declare_shader_args()
736 args->shader_info->num_input_sgprs = 2; in radv_declare_shader_args()
737 args->shader_info->num_input_sgprs += args->ac.num_sgprs_used; in radv_declare_shader_args()
738 args->shader_info->num_input_vgprs = args->ac.num_vgprs_used; in radv_declare_shader_args()
742 set_loc_shader_ptr(args, AC_UD_SCRATCH_RING_OFFSETS, &user_sgpr_idx); in radv_declare_shader_args()
750 set_vs_specific_input_locs(args, stage, has_previous_stage, previous_stage, &user_sgpr_idx); in radv_declare_shader_args()
752 set_global_input_locs(args, &user_sgpr_info, &user_sgpr_idx); in radv_declare_shader_args()
756 if (args->ac.sbt_descriptors.used) { in radv_declare_shader_args()
757 set_loc_shader_ptr(args, AC_UD_CS_SBT_DESCRIPTORS, &user_sgpr_idx); in radv_declare_shader_args()
759 if (args->ac.num_work_groups.used) { in radv_declare_shader_args()
760 set_loc_shader(args, AC_UD_CS_GRID_SIZE, &user_sgpr_idx, 3); in radv_declare_shader_args()
762 if (args->ac.ray_launch_size.used) { in radv_declare_shader_args()
763 set_loc_shader(args, AC_UD_CS_RAY_LAUNCH_SIZE, &user_sgpr_idx, 3); in radv_declare_shader_args()
767 if (args->ac.view_index.used) in radv_declare_shader_args()
768 set_loc_shader(args, AC_UD_VIEW_INDEX, &user_sgpr_idx, 1); in radv_declare_shader_args()
771 if (args->ac.view_index.used) in radv_declare_shader_args()
772 set_loc_shader(args, AC_UD_VIEW_INDEX, &user_sgpr_idx, 1); in radv_declare_shader_args()
775 if (args->ac.view_index.used) in radv_declare_shader_args()
776 set_loc_shader(args, AC_UD_VIEW_INDEX, &user_sgpr_idx, 1); in radv_declare_shader_args()
779 if (args->ac.view_index.used) in radv_declare_shader_args()
780 set_loc_shader(args, AC_UD_VIEW_INDEX, &user_sgpr_idx, 1); in radv_declare_shader_args()
782 if (args->ngg_gs_state.used) { in radv_declare_shader_args()
783 set_loc_shader(args, AC_UD_NGG_GS_STATE, &user_sgpr_idx, 1); in radv_declare_shader_args()
786 if (args->ngg_culling_settings.used) { in radv_declare_shader_args()
787 set_loc_shader(args, AC_UD_NGG_CULLING_SETTINGS, &user_sgpr_idx, 1); in radv_declare_shader_args()
790 if (args->ngg_viewport_scale[0].used) { in radv_declare_shader_args()
791 assert(args->ngg_viewport_scale[1].used && in radv_declare_shader_args()
792 args->ngg_viewport_translate[0].used && in radv_declare_shader_args()
793 args->ngg_viewport_translate[1].used); in radv_declare_shader_args()
794 set_loc_shader(args, AC_UD_NGG_VIEWPORT, &user_sgpr_idx, 4); in radv_declare_shader_args()
803 args->shader_info->num_user_sgprs = user_sgpr_idx; in radv_declare_shader_args()