Replace uses of _mesa_bitcount with util_bitcount

and _mesa_bitcount_64 with util_bitcount_64. This fixes a build problem
in nir for platforms that don't have popcount or popcountll, such as
32bit msvc.

v2: - Fix additional uses of _mesa_bitcount added after this was
      originally written

Acked-by: Eric Engestrom <eric.engestrom@intel.com> (v1)
Acked-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Dylan Baker
2018-08-21 09:46:46 -07:00
parent 80825abb5d
commit 8396043f30
36 changed files with 104 additions and 134 deletions

View File

@@ -57,7 +57,7 @@ build_instance_id(struct lower_multiview_state *state)
*/
state->instance_id =
nir_idiv(b, nir_load_instance_id(b),
nir_imm_int(b, _mesa_bitcount(state->view_mask)));
nir_imm_int(b, util_bitcount(state->view_mask)));
}
return state->instance_id;
@@ -72,7 +72,7 @@ build_view_index(struct lower_multiview_state *state)
b->cursor = nir_before_block(nir_start_block(b->impl));
assert(state->view_mask != 0);
if (_mesa_bitcount(state->view_mask) == 1) {
if (util_bitcount(state->view_mask) == 1) {
/* Set the view index directly. */
state->view_index = nir_imm_int(b, ffs(state->view_mask) - 1);
} else if (state->builder.shader->info.stage == MESA_SHADER_VERTEX) {
@@ -85,7 +85,7 @@ build_view_index(struct lower_multiview_state *state)
*/
nir_ssa_def *compacted =
nir_umod(b, nir_load_instance_id(b),
nir_imm_int(b, _mesa_bitcount(state->view_mask)));
nir_imm_int(b, util_bitcount(state->view_mask)));
if (util_is_power_of_two_or_zero(state->view_mask + 1)) {
/* If we have a full view mask, then compacted is what we want */
@@ -206,7 +206,7 @@ anv_nir_lower_multiview(nir_shader *shader, uint32_t view_mask)
/* Unless there is only one possible view index (that would be set
* directly), pass it to the next stage. */
if (_mesa_bitcount(state.view_mask) != 1) {
if (util_bitcount(state.view_mask) != 1) {
nir_variable *view_index_out =
nir_variable_create(shader, nir_var_shader_out,
glsl_int_type(), "view index");