radv: declare the NGG query argument for primitives generated query

To emulare counting for NGG VS/TES.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15639>
This commit is contained in:
Samuel Pitoiset 2022-04-29 16:25:57 +02:00 committed by Marge Bot
parent 11734f935a
commit 60b07a0ab2

View file

@ -104,11 +104,11 @@ count_ms_user_sgprs(const struct radv_shader_info *info)
}
static unsigned
count_ngg_sgprs(const struct radv_shader_info *info, bool has_api_gs)
count_ngg_sgprs(const struct radv_shader_info *info, bool has_ngg_query)
{
unsigned count = 0;
if (has_api_gs)
if (has_ngg_query)
count += 1; /* ngg_query_state */
if (info->has_ngg_culling)
count += 5; /* ngg_culling_settings + 4x ngg_viewport_* */
@ -150,7 +150,7 @@ allocate_inline_push_consts(const struct radv_shader_info *info,
static void
allocate_user_sgprs(enum amd_gfx_level gfx_level, const struct radv_shader_info *info,
struct radv_shader_args *args, gl_shader_stage stage, bool has_previous_stage,
gl_shader_stage previous_stage, bool needs_view_index, bool has_api_gs,
gl_shader_stage previous_stage, bool needs_view_index, bool has_ngg_query,
struct user_sgpr_info *user_sgpr_info)
{
uint8_t user_sgpr_count = 0;
@ -198,7 +198,7 @@ allocate_user_sgprs(enum amd_gfx_level gfx_level, const struct radv_shader_info
case MESA_SHADER_GEOMETRY:
if (has_previous_stage) {
if (info->is_ngg)
user_sgpr_count += count_ngg_sgprs(info, has_api_gs);
user_sgpr_count += count_ngg_sgprs(info, has_ngg_query);
if (previous_stage == MESA_SHADER_VERTEX) {
user_sgpr_count += count_vs_user_sgprs(info);
@ -450,11 +450,10 @@ declare_ps_input_vgprs(const struct radv_shader_info *info, struct radv_shader_a
static void
declare_ngg_sgprs(const struct radv_shader_info *info, struct radv_shader_args *args,
bool has_api_gs)
bool has_ngg_query)
{
if (has_api_gs) {
if (has_ngg_query)
ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ngg_query_state);
}
if (info->has_ngg_culling) {
ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ngg_culling_settings);
@ -531,7 +530,7 @@ radv_declare_shader_args(enum amd_gfx_level gfx_level, const struct radv_pipelin
{
struct user_sgpr_info user_sgpr_info;
bool needs_view_index = info->uses_view_index;
bool has_api_gs = stage == MESA_SHADER_GEOMETRY;
bool has_ngg_query = stage == MESA_SHADER_GEOMETRY || key->primitives_generated_query;
if (gfx_level >= GFX10 && info->is_ngg && stage != MESA_SHADER_GEOMETRY) {
/* Handle all NGG shaders as GS to simplify the code here. */
@ -546,7 +545,7 @@ radv_declare_shader_args(enum amd_gfx_level gfx_level, const struct radv_pipelin
args->user_sgprs_locs.shader_data[i].sgpr_idx = -1;
allocate_user_sgprs(gfx_level, info, args, stage, has_previous_stage, previous_stage,
needs_view_index, has_api_gs, &user_sgpr_info);
needs_view_index, has_ngg_query, &user_sgpr_info);
if (args->explicit_scratch_args) {
ac_add_arg(&args->ac, AC_ARG_SGPR, 2, AC_ARG_CONST_DESC_PTR, &args->ring_offsets);
@ -740,7 +739,7 @@ radv_declare_shader_args(enum amd_gfx_level gfx_level, const struct radv_pipelin
}
if (info->is_ngg) {
declare_ngg_sgprs(info, args, has_api_gs);
declare_ngg_sgprs(info, args, has_ngg_query);
}
ac_add_arg(&args->ac, AC_ARG_VGPR, 1, AC_ARG_INT, &args->ac.gs_vtx_offset[0]);