Giovanni Mascellani (@giomasce) commented about libs/vkd3d-shader/hlsl_codegen.c:
if (trace->record_count && trace->records[trace->record_count - 1].timestamp == time)
{
assert(!trace->records[trace->record_count - 1].statically_written);
continue;
}
assert(!trace->record_count || trace->records[trace->record_count - 1].timestamp < time);
if (!hlsl_array_reserve(ctx, (void **)&trace->records, &trace->record_capacity,
trace->record_count + 1, sizeof(trace->records[0])))
return;
trace->records[trace->record_count].timestamp = time;
trace->records[trace->record_count].statically_written = false;
++trace->record_count;
It looks like this snippet could be refactored to a helper, which is also used below. Mostly for clarity.