compiler: Use util/bitset.h for system_values_read
It is currently a bitset on top of a uint64_t but there are already more than 64 values. Change to use BITSET to cover all the SYSTEM_VALUE_MAX bits. Cc: mesa-stable Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Karol Herbst <kherbst@redhat.com> Acked-by: Jesse Natalie <jenatali@microsoft.com> Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Acked-by: Alejandro Piñeiro <apinheiro@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8585>
This commit is contained in:
committed by
Marge Bot
parent
ecd0ae09f9
commit
9f3d5e99ea
@@ -1620,14 +1620,16 @@ ntq_setup_vs_inputs(struct v3d_compile *c)
|
||||
|
||||
unsigned num_components = 0;
|
||||
uint32_t vpm_components_queued = 0;
|
||||
bool uses_iid = c->s->info.system_values_read &
|
||||
(1ull << SYSTEM_VALUE_INSTANCE_ID |
|
||||
1ull << SYSTEM_VALUE_INSTANCE_INDEX);
|
||||
bool uses_biid = c->s->info.system_values_read &
|
||||
(1ull << SYSTEM_VALUE_BASE_INSTANCE);
|
||||
bool uses_vid = c->s->info.system_values_read &
|
||||
(1ull << SYSTEM_VALUE_VERTEX_ID |
|
||||
1ull << SYSTEM_VALUE_VERTEX_ID_ZERO_BASE);
|
||||
bool uses_iid = BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_INSTANCE_ID) ||
|
||||
BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_INSTANCE_INDEX);
|
||||
bool uses_biid = BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_BASE_INSTANCE);
|
||||
bool uses_vid = BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_VERTEX_ID) ||
|
||||
BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_VERTEX_ID_ZERO_BASE);
|
||||
|
||||
num_components += uses_iid;
|
||||
num_components += uses_biid;
|
||||
@@ -2079,16 +2081,16 @@ ntq_emit_load_input(struct v3d_compile *c, nir_intrinsic_instr *instr)
|
||||
* be slower if the VPM unit is busy with another QPU.
|
||||
*/
|
||||
int index = 0;
|
||||
if (c->s->info.system_values_read &
|
||||
(1ull << SYSTEM_VALUE_INSTANCE_ID)) {
|
||||
if (BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_INSTANCE_ID)) {
|
||||
index++;
|
||||
}
|
||||
if (c->s->info.system_values_read &
|
||||
(1ull << SYSTEM_VALUE_BASE_INSTANCE)) {
|
||||
if (BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_BASE_INSTANCE)) {
|
||||
index++;
|
||||
}
|
||||
if (c->s->info.system_values_read &
|
||||
(1ull << SYSTEM_VALUE_VERTEX_ID)) {
|
||||
if (BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_VERTEX_ID)) {
|
||||
index++;
|
||||
}
|
||||
for (int i = 0; i < offset; i++)
|
||||
@@ -3130,16 +3132,18 @@ nir_to_vir(struct v3d_compile *c)
|
||||
c->uses_implicit_point_line_varyings = true;
|
||||
} else if (c->fs_key->is_lines &&
|
||||
(c->devinfo->ver < 40 ||
|
||||
(c->s->info.system_values_read &
|
||||
BITFIELD64_BIT(SYSTEM_VALUE_LINE_COORD)))) {
|
||||
BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_LINE_COORD))) {
|
||||
c->line_x = emit_fragment_varying(c, NULL, -1, 0, 0);
|
||||
c->uses_implicit_point_line_varyings = true;
|
||||
}
|
||||
|
||||
c->force_per_sample_msaa =
|
||||
c->s->info.fs.uses_sample_qualifier ||
|
||||
(c->s->info.system_values_read & (SYSTEM_BIT_SAMPLE_ID |
|
||||
SYSTEM_BIT_SAMPLE_POS));
|
||||
BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_SAMPLE_ID) ||
|
||||
BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_SAMPLE_POS);
|
||||
break;
|
||||
case MESA_SHADER_COMPUTE:
|
||||
/* Set up the TSO for barriers, assuming we do some. */
|
||||
|
||||
+12
-10
@@ -640,16 +640,18 @@ v3d_vs_set_prog_data(struct v3d_compile *c,
|
||||
prog_data->vpm_input_size += c->vattr_sizes[i];
|
||||
}
|
||||
|
||||
prog_data->uses_vid = (c->s->info.system_values_read &
|
||||
(1ull << SYSTEM_VALUE_VERTEX_ID |
|
||||
1ull << SYSTEM_VALUE_VERTEX_ID_ZERO_BASE));
|
||||
prog_data->uses_vid = BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_VERTEX_ID) ||
|
||||
BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_VERTEX_ID_ZERO_BASE);
|
||||
|
||||
prog_data->uses_biid = (c->s->info.system_values_read &
|
||||
(1ull << SYSTEM_VALUE_BASE_INSTANCE));
|
||||
prog_data->uses_biid = BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_BASE_INSTANCE);
|
||||
|
||||
prog_data->uses_iid = (c->s->info.system_values_read &
|
||||
(1ull << SYSTEM_VALUE_INSTANCE_ID |
|
||||
1ull << SYSTEM_VALUE_INSTANCE_INDEX));
|
||||
prog_data->uses_iid = BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_INSTANCE_ID) ||
|
||||
BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_INSTANCE_INDEX);
|
||||
|
||||
if (prog_data->uses_vid)
|
||||
prog_data->vpm_input_size++;
|
||||
@@ -703,8 +705,8 @@ v3d_gs_set_prog_data(struct v3d_compile *c,
|
||||
* it after reading it if necessary, so it doesn't add to the VPM
|
||||
* size requirements.
|
||||
*/
|
||||
prog_data->uses_pid = (c->s->info.system_values_read &
|
||||
(1ull << SYSTEM_VALUE_PRIMITIVE_ID));
|
||||
prog_data->uses_pid = BITSET_TEST(c->s->info.system_values_read,
|
||||
SYSTEM_VALUE_PRIMITIVE_ID);
|
||||
|
||||
/* Output segment size is in sectors (8 rows of 32 bits per channel) */
|
||||
prog_data->vpm_output_size = align(c->vpm_output_size, 8) / 8;
|
||||
|
||||
Reference in New Issue
Block a user