util/bitset: s/BITSET_SET_RANGE/BITSET_SET_RANGE_INSIDE_WORD
Prep work for the next commit. Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com> Reviewed-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11321>
This commit is contained in:

committed by
Marge Bot

parent
3d3a4b9b01
commit
3d65cea6ee
@@ -287,7 +287,7 @@ set_bitset_range(BITSET_WORD* words, unsigned start, unsigned size)
|
|||||||
unsigned end = start + size - 1;
|
unsigned end = start + size - 1;
|
||||||
unsigned start_mod = start % BITSET_WORDBITS;
|
unsigned start_mod = start % BITSET_WORDBITS;
|
||||||
if (start_mod + size <= BITSET_WORDBITS) {
|
if (start_mod + size <= BITSET_WORDBITS) {
|
||||||
BITSET_SET_RANGE(words, start, end);
|
BITSET_SET_RANGE_INSIDE_WORD(words, start, end);
|
||||||
} else {
|
} else {
|
||||||
unsigned first_size = BITSET_WORDBITS - start_mod;
|
unsigned first_size = BITSET_WORDBITS - start_mod;
|
||||||
set_bitset_range(words, start, BITSET_WORDBITS - start_mod);
|
set_bitset_range(words, start, BITSET_WORDBITS - start_mod);
|
||||||
|
@@ -232,12 +232,12 @@ record_textures_used(struct shader_info *info,
|
|||||||
const unsigned size =
|
const unsigned size =
|
||||||
glsl_type_is_array(var->type) ? glsl_get_aoa_size(var->type) : 1;
|
glsl_type_is_array(var->type) ? glsl_get_aoa_size(var->type) : 1;
|
||||||
|
|
||||||
BITSET_SET_RANGE(info->textures_used, var->data.binding, var->data.binding + (MAX2(size, 1) - 1));
|
BITSET_SET_RANGE_INSIDE_WORD(info->textures_used, var->data.binding, var->data.binding + (MAX2(size, 1) - 1));
|
||||||
|
|
||||||
if (op == nir_texop_txf ||
|
if (op == nir_texop_txf ||
|
||||||
op == nir_texop_txf_ms ||
|
op == nir_texop_txf_ms ||
|
||||||
op == nir_texop_txf_ms_mcs_intel)
|
op == nir_texop_txf_ms_mcs_intel)
|
||||||
BITSET_SET_RANGE(info->textures_used_by_txf, var->data.binding, var->data.binding + (MAX2(size, 1) - 1));
|
BITSET_SET_RANGE_INSIDE_WORD(info->textures_used_by_txf, var->data.binding, var->data.binding + (MAX2(size, 1) - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
@@ -342,7 +342,7 @@ build_bindless(nir_builder *b, nir_deref_instr *deref, bool is_sampler,
|
|||||||
const struct glsl_type *glsl_type = glsl_without_array(var->type);
|
const struct glsl_type *glsl_type = glsl_without_array(var->type);
|
||||||
uint32_t idx = var->data.index * 2;
|
uint32_t idx = var->data.index * 2;
|
||||||
|
|
||||||
BITSET_SET_RANGE(b->shader->info.textures_used, idx * 2, ((idx * 2) + (bind_layout->array_size * 2)) - 1);
|
BITSET_SET_RANGE_INSIDE_WORD(b->shader->info.textures_used, idx * 2, ((idx * 2) + (bind_layout->array_size * 2)) - 1);
|
||||||
|
|
||||||
/* D24S8 workaround: stencil of D24S8 will be sampled as uint */
|
/* D24S8 workaround: stencil of D24S8 will be sampled as uint */
|
||||||
if (glsl_get_sampler_result_type(glsl_type) == GLSL_TYPE_UINT)
|
if (glsl_get_sampler_result_type(glsl_type) == GLSL_TYPE_UINT)
|
||||||
|
@@ -113,7 +113,7 @@ clover_nir_lower_images(nir_shader *shader)
|
|||||||
shader->info.num_textures = num_rd_images;
|
shader->info.num_textures = num_rd_images;
|
||||||
BITSET_ZERO(shader->info.textures_used);
|
BITSET_ZERO(shader->info.textures_used);
|
||||||
if (num_rd_images)
|
if (num_rd_images)
|
||||||
BITSET_SET_RANGE(shader->info.textures_used, 0, num_rd_images - 1);
|
BITSET_SET_RANGE_INSIDE_WORD(shader->info.textures_used, 0, num_rd_images - 1);
|
||||||
shader->info.num_images = num_wr_images;
|
shader->info.num_images = num_wr_images;
|
||||||
|
|
||||||
nir_builder b;
|
nir_builder b;
|
||||||
|
@@ -189,7 +189,7 @@ lower_mem_store_bit_size(nir_builder *b, nir_intrinsic_instr *intrin,
|
|||||||
|
|
||||||
for (unsigned i = 0; i < num_components; i++) {
|
for (unsigned i = 0; i < num_components; i++) {
|
||||||
if (writemask & (1u << i))
|
if (writemask & (1u << i))
|
||||||
BITSET_SET_RANGE(mask, i * byte_size, ((i + 1) * byte_size) - 1);
|
BITSET_SET_RANGE_INSIDE_WORD(mask, i * byte_size, ((i + 1) * byte_size) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (BITSET_FFS(mask) != 0) {
|
while (BITSET_FFS(mask) != 0) {
|
||||||
|
@@ -196,10 +196,10 @@ __bitset_shl(BITSET_WORD *x, unsigned amount, unsigned n)
|
|||||||
(BITSET_BITWORD(b) == BITSET_BITWORD(e) ? \
|
(BITSET_BITWORD(b) == BITSET_BITWORD(e) ? \
|
||||||
(((x)[BITSET_BITWORD(b)] & BITSET_RANGE(b, e)) != 0) : \
|
(((x)[BITSET_BITWORD(b)] & BITSET_RANGE(b, e)) != 0) : \
|
||||||
(assert (!"BITSET_TEST_RANGE: bit range crosses word boundary"), 0))
|
(assert (!"BITSET_TEST_RANGE: bit range crosses word boundary"), 0))
|
||||||
#define BITSET_SET_RANGE(x, b, e) \
|
#define BITSET_SET_RANGE_INSIDE_WORD(x, b, e) \
|
||||||
(BITSET_BITWORD(b) == BITSET_BITWORD(e) ? \
|
(BITSET_BITWORD(b) == BITSET_BITWORD(e) ? \
|
||||||
((x)[BITSET_BITWORD(b)] |= BITSET_RANGE(b, e)) : \
|
((x)[BITSET_BITWORD(b)] |= BITSET_RANGE(b, e)) : \
|
||||||
(assert (!"BITSET_SET_RANGE: bit range crosses word boundary"), 0))
|
(assert (!"BITSET_SET_RANGE_INSIDE_WORD: bit range crosses word boundary"), 0))
|
||||||
#define BITSET_CLEAR_RANGE(x, b, e) \
|
#define BITSET_CLEAR_RANGE(x, b, e) \
|
||||||
(BITSET_BITWORD(b) == BITSET_BITWORD(e) ? \
|
(BITSET_BITWORD(b) == BITSET_BITWORD(e) ? \
|
||||||
((x)[BITSET_BITWORD(b)] &= ~BITSET_RANGE(b, e)) : \
|
((x)[BITSET_BITWORD(b)] &= ~BITSET_RANGE(b, e)) : \
|
||||||
|
@@ -73,7 +73,7 @@ TEST(bitset, test_basic_range)
|
|||||||
BITSET_ZERO(mask128);
|
BITSET_ZERO(mask128);
|
||||||
|
|
||||||
const int max_set = 15;
|
const int max_set = 15;
|
||||||
BITSET_SET_RANGE(mask128, 0, max_set);
|
BITSET_SET_RANGE_INSIDE_WORD(mask128, 0, max_set);
|
||||||
EXPECT_EQ(BITSET_TEST_RANGE(mask128, 0, max_set), true);
|
EXPECT_EQ(BITSET_TEST_RANGE(mask128, 0, max_set), true);
|
||||||
EXPECT_EQ(BITSET_TEST_RANGE(mask128, max_set + 1, max_set + 15), false);
|
EXPECT_EQ(BITSET_TEST_RANGE(mask128, max_set + 1, max_set + 15), false);
|
||||||
for (int i = 0; i < 128; i++) {
|
for (int i = 0; i < 128; i++) {
|
||||||
@@ -105,7 +105,7 @@ TEST(bitset, test_bitset_ffs)
|
|||||||
BITSET_CLEAR(mask128, 14);
|
BITSET_CLEAR(mask128, 14);
|
||||||
EXPECT_EQ(BITSET_FFS(mask128), 29);
|
EXPECT_EQ(BITSET_FFS(mask128), 29);
|
||||||
|
|
||||||
BITSET_SET_RANGE(mask128, 14, 18);
|
BITSET_SET_RANGE_INSIDE_WORD(mask128, 14, 18);
|
||||||
EXPECT_EQ(BITSET_FFS(mask128), 15);
|
EXPECT_EQ(BITSET_FFS(mask128), 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,10 +114,10 @@ TEST(bitset, test_range_bits)
|
|||||||
BITSET_DECLARE(mask128, 128);
|
BITSET_DECLARE(mask128, 128);
|
||||||
BITSET_ZERO(mask128);
|
BITSET_ZERO(mask128);
|
||||||
|
|
||||||
BITSET_SET_RANGE(mask128, 0, 31);
|
BITSET_SET_RANGE_INSIDE_WORD(mask128, 0, 31);
|
||||||
BITSET_SET_RANGE(mask128, 32, 63);
|
BITSET_SET_RANGE_INSIDE_WORD(mask128, 32, 63);
|
||||||
BITSET_SET_RANGE(mask128, 64, 95);
|
BITSET_SET_RANGE_INSIDE_WORD(mask128, 64, 95);
|
||||||
BITSET_SET_RANGE(mask128, 96, 127);
|
BITSET_SET_RANGE_INSIDE_WORD(mask128, 96, 127);
|
||||||
|
|
||||||
EXPECT_EQ(BITSET_TEST_RANGE(mask128, 0, 31), true);
|
EXPECT_EQ(BITSET_TEST_RANGE(mask128, 0, 31), true);
|
||||||
EXPECT_EQ(BITSET_TEST_RANGE(mask128, 32, 63), true);
|
EXPECT_EQ(BITSET_TEST_RANGE(mask128, 32, 63), true);
|
||||||
@@ -144,8 +144,8 @@ TEST(bitset, test_and)
|
|||||||
EXPECT_EQ(BITSET_TEST_RANGE(r, 96, 127), false);
|
EXPECT_EQ(BITSET_TEST_RANGE(r, 96, 127), false);
|
||||||
|
|
||||||
|
|
||||||
BITSET_SET_RANGE(a, 32, 63);
|
BITSET_SET_RANGE_INSIDE_WORD(a, 32, 63);
|
||||||
BITSET_SET_RANGE(b, 96, 127);
|
BITSET_SET_RANGE_INSIDE_WORD(b, 96, 127);
|
||||||
BITSET_AND(r, a, b);
|
BITSET_AND(r, a, b);
|
||||||
|
|
||||||
EXPECT_EQ(BITSET_TEST_RANGE(r, 0, 31), false);
|
EXPECT_EQ(BITSET_TEST_RANGE(r, 0, 31), false);
|
||||||
@@ -182,8 +182,8 @@ TEST(bitset, test_or)
|
|||||||
EXPECT_EQ(BITSET_TEST_RANGE(r, 96, 127), false);
|
EXPECT_EQ(BITSET_TEST_RANGE(r, 96, 127), false);
|
||||||
|
|
||||||
|
|
||||||
BITSET_SET_RANGE(a, 32, 63);
|
BITSET_SET_RANGE_INSIDE_WORD(a, 32, 63);
|
||||||
BITSET_SET_RANGE(b, 96, 127);
|
BITSET_SET_RANGE_INSIDE_WORD(b, 96, 127);
|
||||||
BITSET_OR(r, a, b);
|
BITSET_OR(r, a, b);
|
||||||
|
|
||||||
EXPECT_EQ(BITSET_TEST_RANGE(r, 0, 31), false);
|
EXPECT_EQ(BITSET_TEST_RANGE(r, 0, 31), false);
|
||||||
|
Reference in New Issue
Block a user