mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 11:48:06 +02:00
radv: fix incorrect stride for primitives generated query with GDS
When the query pool uses GDS (for NGG), the stride is 40.
Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8412
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21650>
(cherry picked from commit c119b19f98)
This commit is contained in:
parent
945f966e0f
commit
2f3741fbea
2 changed files with 13 additions and 6 deletions
|
|
@ -7114,7 +7114,7 @@
|
|||
"description": "radv: fix incorrect stride for primitives generated query with GDS",
|
||||
"nominated": true,
|
||||
"nomination_type": 0,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null
|
||||
},
|
||||
|
|
|
|||
|
|
@ -605,6 +605,9 @@ build_timestamp_query_shader(struct radv_device *device)
|
|||
return b.shader;
|
||||
}
|
||||
|
||||
#define RADV_PGQ_STRIDE 32
|
||||
#define RADV_PGQ_STRIDE_GDS (RADV_PGQ_STRIDE + 4 * 2)
|
||||
|
||||
static nir_shader *
|
||||
build_pg_query_shader(struct radv_device *device)
|
||||
{
|
||||
|
|
@ -665,8 +668,12 @@ build_pg_query_shader(struct radv_device *device)
|
|||
/* Compute global ID. */
|
||||
nir_ssa_def *global_id = get_global_ids(&b, 1);
|
||||
|
||||
/* Determine if the query pool uses GDS for NGG. */
|
||||
nir_ssa_def *uses_gds =
|
||||
nir_i2b(&b, nir_load_push_constant(&b, 1, 32, nir_imm_int(&b, 16), .range = 20));
|
||||
|
||||
/* Compute src/dst strides. */
|
||||
nir_ssa_def *input_stride = nir_imm_int(&b, 32);
|
||||
nir_ssa_def *input_stride = nir_bcsel(&b, uses_gds, nir_imm_int(&b, RADV_PGQ_STRIDE_GDS), nir_imm_int(&b, RADV_PGQ_STRIDE));
|
||||
nir_ssa_def *input_base = nir_imul(&b, input_stride, global_id);
|
||||
nir_ssa_def *output_stride = nir_load_push_constant(&b, 1, 32, nir_imm_int(&b, 4), .range = 16);
|
||||
nir_ssa_def *output_base = nir_imul(&b, output_stride, global_id);
|
||||
|
|
@ -698,8 +705,7 @@ build_pg_query_shader(struct radv_device *device)
|
|||
|
||||
nir_store_var(&b, result, primitive_storage_needed, 0x1);
|
||||
|
||||
nir_ssa_def *uses_gds = nir_load_push_constant(&b, 1, 32, nir_imm_int(&b, 16), .range = 20);
|
||||
nir_push_if(&b, nir_i2b(&b, uses_gds));
|
||||
nir_push_if(&b, uses_gds);
|
||||
{
|
||||
nir_ssa_def *gds_start =
|
||||
nir_load_ssbo(&b, 1, 32, src_buf, nir_iadd(&b, input_base, nir_imm_int(&b, 32)), .align_mul = 4);
|
||||
|
|
@ -1124,12 +1130,13 @@ radv_create_query_pool(struct radv_device *device, const VkQueryPoolCreateInfo *
|
|||
pool->stride = 32;
|
||||
break;
|
||||
case VK_QUERY_TYPE_PRIMITIVES_GENERATED_EXT:
|
||||
pool->stride = 32;
|
||||
if (pool->uses_gds && device->physical_device->rad_info.gfx_level < GFX11) {
|
||||
/* When the hardware can use both the legacy and the NGG paths in the same begin/end pair,
|
||||
* allocate 2x32-bit values for the GDS counters.
|
||||
*/
|
||||
pool->stride += 4 * 2;
|
||||
pool->stride = RADV_PGQ_STRIDE_GDS;
|
||||
} else {
|
||||
pool->stride = RADV_PGQ_STRIDE;
|
||||
}
|
||||
break;
|
||||
case VK_QUERY_TYPE_PERFORMANCE_QUERY_KHR: {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue