rsx: Track command barrier types during recording for faster instancing compatibility checks

This commit is contained in:
kd-11 2025-04-08 01:53:01 +03:00 committed by kd-11
parent 87d8bebd0d
commit 21434c471b
2 changed files with 16 additions and 25 deletions

View file

@ -44,6 +44,8 @@ namespace rsx
} }
}; };
draw_command_barrier_mask |= (1u << type);
if (type == primitive_restart_barrier) if (type == primitive_restart_barrier)
{ {
// Rasterization flow barrier // Rasterization flow barrier
@ -97,16 +99,6 @@ namespace rsx
return false; return false;
} }
// For instancing all draw calls must be identical
const auto& ref = draw_command_ranges.front();
for (const auto& range : draw_command_ranges)
{
if (range.first != ref.first || range.count != ref.count)
{
return false;
}
}
if (draw_command_barriers.empty()) if (draw_command_barriers.empty())
{ {
// Raise alarm here for investigation, we may be missing a corner case. // Raise alarm here for investigation, we may be missing a corner case.
@ -115,30 +107,26 @@ namespace rsx
} }
// Barriers must exist, but can only involve updating transform constants (for now) // Barriers must exist, but can only involve updating transform constants (for now)
for (const auto& barrier : draw_command_barriers) const u32 compatible_barrier_mask =
{ (1u << rsx::transform_constant_load_modifier_barrier) |
if (barrier.type != rsx::transform_constant_load_modifier_barrier && (1u << rsx::transform_constant_update_barrier);
barrier.type != rsx::transform_constant_update_barrier)
{
ensure(barrier.draw_id < ::size32(draw_command_ranges));
if (draw_command_ranges[barrier.draw_id].count == 0)
{
// Dangling command barriers are ignored. We're also at the end of the command, so abort.
break;
}
// Fail. Only transform constant instancing is supported at the moment. if (draw_command_barrier_mask & ~compatible_barrier_mask)
return false; {
} return false;
} }
return true; // For instancing all draw calls must be identical
// FIXME: This requirement can be easily lifted by chunking contiguous chunks.
const auto& ref = draw_command_ranges.front();
return !draw_command_ranges.any(FN(x.first != ref.first || x.count != ref.count));
} }
void draw_clause::reset(primitive_type type) void draw_clause::reset(primitive_type type)
{ {
current_range_index = ~0u; current_range_index = ~0u;
last_execution_barrier_index = 0; last_execution_barrier_index = 0;
draw_command_barrier_mask = 0;
command = draw_command::none; command = draw_command::none;
primitive = type; primitive = type;

View file

@ -29,6 +29,9 @@ namespace rsx
// Location of last execution barrier // Location of last execution barrier
u32 last_execution_barrier_index{}; u32 last_execution_barrier_index{};
// Mask of all active barriers
u32 draw_command_barrier_mask = 0;
// Draw-time iterator to the draw_command_barriers struct // Draw-time iterator to the draw_command_barriers struct
mutable simple_array<barrier_t>::iterator current_barrier_it; mutable simple_array<barrier_t>::iterator current_barrier_it;