aboutsummaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2017-11-13 11:17:41 -0800
committerIan Romanick <[email protected]>2018-03-29 14:09:23 -0700
commitd76c204d0564701b4b8b6a2bdda50e2939683e66 (patch)
treeedcf51df711640ffd89326079f10b1dcf65f311b /src/intel/vulkan
parenta3a16d4aa7e5a22816226d8e7417138164b10525 (diff)
util: Move util_is_power_of_two to bitscan.h and rename to util_is_power_of_two_or_zero
The new name make the zero-input behavior more obvious. The next patch adds a new function with different zero-input behavior. Signed-off-by: Ian Romanick <[email protected]> Suggested-by: Matt Turner <[email protected]> Reviewed-by: Alejandro PiƱeiro <[email protected]>
Diffstat (limited to 'src/intel/vulkan')
-rw-r--r--src/intel/vulkan/anv_allocator.c6
-rw-r--r--src/intel/vulkan/anv_formats.c4
-rw-r--r--src/intel/vulkan/anv_nir_lower_multiview.c2
3 files changed, 6 insertions, 6 deletions
diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c
index a27af4eccc4..f884ac3b827 100644
--- a/src/intel/vulkan/anv_allocator.c
+++ b/src/intel/vulkan/anv_allocator.c
@@ -619,7 +619,7 @@ anv_state_pool_init(struct anv_state_pool *pool,
if (result != VK_SUCCESS)
return result;
- assert(util_is_power_of_two(block_size));
+ assert(util_is_power_of_two_or_zero(block_size));
pool->block_size = block_size;
pool->back_alloc_free_list = ANV_FREE_LIST_EMPTY;
for (unsigned i = 0; i < ANV_STATE_BUCKETS; i++) {
@@ -814,7 +814,7 @@ done:
static void
anv_state_pool_free_no_vg(struct anv_state_pool *pool, struct anv_state state)
{
- assert(util_is_power_of_two(state.alloc_size));
+ assert(util_is_power_of_two_or_zero(state.alloc_size));
unsigned bucket = anv_state_pool_get_bucket(state.alloc_size);
if (state.offset < 0) {
@@ -1041,7 +1041,7 @@ anv_bo_pool_free(struct anv_bo_pool *pool, const struct anv_bo *bo_in)
struct bo_pool_bo_link *link = bo.map;
VG_NOACCESS_WRITE(&link->bo, bo);
- assert(util_is_power_of_two(bo.size));
+ assert(util_is_power_of_two_or_zero(bo.size));
const unsigned size_log2 = ilog2_round_up(bo.size);
const unsigned bucket = size_log2 - 12;
assert(bucket < ARRAY_SIZE(pool->free_list));
diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c
index 8d1ea402f0f..085706402c1 100644
--- a/src/intel/vulkan/anv_formats.c
+++ b/src/intel/vulkan/anv_formats.c
@@ -437,7 +437,7 @@ anv_get_format_plane(const struct gen_device_info *devinfo, VkFormat vk_format,
isl_format_get_layout(plane_format.isl_format);
if (tiling == VK_IMAGE_TILING_OPTIMAL &&
- !util_is_power_of_two(isl_layout->bpb)) {
+ !util_is_power_of_two_or_zero(isl_layout->bpb)) {
/* Tiled formats *must* be power-of-two because we need up upload
* them with the render pipeline. For 3-channel formats, we fix
* this by switching them over to RGBX or RGBA formats under the
@@ -563,7 +563,7 @@ get_image_format_features(const struct gen_device_info *devinfo,
*/
if (vk_tiling == VK_IMAGE_TILING_OPTIMAL &&
base_isl_format != ISL_FORMAT_UNSUPPORTED &&
- !util_is_power_of_two(isl_format_layouts[base_isl_format].bpb) &&
+ !util_is_power_of_two_or_zero(isl_format_layouts[base_isl_format].bpb) &&
isl_format_rgb_to_rgbx(base_isl_format) == ISL_FORMAT_UNSUPPORTED) {
flags &= ~VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT;
flags &= ~VK_FORMAT_FEATURE_BLIT_DST_BIT;
diff --git a/src/intel/vulkan/anv_nir_lower_multiview.c b/src/intel/vulkan/anv_nir_lower_multiview.c
index 365a70d7579..6822595728c 100644
--- a/src/intel/vulkan/anv_nir_lower_multiview.c
+++ b/src/intel/vulkan/anv_nir_lower_multiview.c
@@ -87,7 +87,7 @@ build_view_index(struct lower_multiview_state *state)
nir_umod(b, nir_load_instance_id(b),
nir_imm_int(b, _mesa_bitcount(state->view_mask)));
- if (util_is_power_of_two(state->view_mask + 1)) {
+ 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 */
state->view_index = compacted;
} else {