anv: for_each_bit -> foreach_bit
Reviewed-by: Rob Clark <robclark@freedesktop.org> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9191>
This commit is contained in:

committed by
Marge Bot

parent
77cba4b9f2
commit
025b57524f
@@ -338,7 +338,6 @@ copy_image(struct anv_cmd_buffer *cmd_buffer,
|
||||
assert(anv_image_aspects_compatible(src_mask, dst_mask));
|
||||
|
||||
if (util_bitcount(src_mask) > 1) {
|
||||
uint32_t aspect_bit;
|
||||
anv_foreach_image_aspect_bit(aspect_bit, src_image, src_mask) {
|
||||
struct blorp_surf src_surf, dst_surf;
|
||||
get_blorp_surf_for_anv_image(cmd_buffer->device,
|
||||
@@ -680,7 +679,6 @@ blit_image(struct anv_cmd_buffer *cmd_buffer,
|
||||
assert(anv_image_aspects_compatible(src_res->aspectMask,
|
||||
dst_res->aspectMask));
|
||||
|
||||
uint32_t aspect_bit;
|
||||
anv_foreach_image_aspect_bit(aspect_bit, src_image, src_res->aspectMask) {
|
||||
get_blorp_surf_for_anv_image(cmd_buffer->device,
|
||||
src_image, 1U << aspect_bit,
|
||||
@@ -1223,8 +1221,7 @@ clear_color_attachment(struct anv_cmd_buffer *cmd_buffer,
|
||||
|
||||
/* If multiview is enabled we ignore baseArrayLayer and layerCount */
|
||||
if (subpass->view_mask) {
|
||||
uint32_t view_idx;
|
||||
for_each_bit(view_idx, subpass->view_mask) {
|
||||
u_foreach_bit(view_idx, subpass->view_mask) {
|
||||
for (uint32_t r = 0; r < rectCount; ++r) {
|
||||
const VkOffset2D offset = pRects[r].rect.offset;
|
||||
const VkExtent2D extent = pRects[r].rect.extent;
|
||||
@@ -1291,8 +1288,7 @@ clear_depth_stencil_attachment(struct anv_cmd_buffer *cmd_buffer,
|
||||
|
||||
/* If multiview is enabled we ignore baseArrayLayer and layerCount */
|
||||
if (subpass->view_mask) {
|
||||
uint32_t view_idx;
|
||||
for_each_bit(view_idx, subpass->view_mask) {
|
||||
u_foreach_bit(view_idx, subpass->view_mask) {
|
||||
for (uint32_t r = 0; r < rectCount; ++r) {
|
||||
const VkOffset2D offset = pRects[r].rect.offset;
|
||||
const VkExtent2D extent = pRects[r].rect.extent;
|
||||
@@ -1456,7 +1452,6 @@ resolve_image(struct anv_cmd_buffer *cmd_buffer,
|
||||
const uint32_t layer_count =
|
||||
anv_get_layerCount(dst_image, ®ion->dstSubresource);
|
||||
|
||||
uint32_t aspect_bit;
|
||||
anv_foreach_image_aspect_bit(aspect_bit, src_image,
|
||||
region->srcSubresource.aspectMask) {
|
||||
enum isl_aux_usage src_aux_usage =
|
||||
|
@@ -663,8 +663,7 @@ add_all_surfaces(struct anv_device *device,
|
||||
const struct gen_device_info *devinfo = &device->info;
|
||||
VkResult result;
|
||||
|
||||
uint32_t b;
|
||||
for_each_bit(b, image->aspects) {
|
||||
u_foreach_bit(b, image->aspects) {
|
||||
VkImageAspectFlagBits aspect = 1 << b;
|
||||
uint32_t plane = anv_image_aspect_to_plane(image->aspects, aspect);
|
||||
const struct anv_format_plane plane_format =
|
||||
@@ -1125,7 +1124,6 @@ VkResult anv_BindImageMemory2(
|
||||
assert(image->aspects == swapchain_image->aspects);
|
||||
assert(mem == NULL);
|
||||
|
||||
uint32_t aspect_bit;
|
||||
anv_foreach_image_aspect_bit(aspect_bit, image, aspects) {
|
||||
uint32_t plane =
|
||||
anv_image_aspect_to_plane(image->aspects, 1UL << aspect_bit);
|
||||
@@ -1150,7 +1148,6 @@ VkResult anv_BindImageMemory2(
|
||||
if (!mem)
|
||||
continue;
|
||||
|
||||
uint32_t aspect_bit;
|
||||
anv_foreach_image_aspect_bit(aspect_bit, image, aspects) {
|
||||
uint32_t plane =
|
||||
anv_image_aspect_to_plane(image->aspects, 1UL << aspect_bit);
|
||||
@@ -2108,7 +2105,7 @@ anv_CreateImageView(VkDevice _device,
|
||||
/* Now go through the underlying image selected planes (computed in
|
||||
* expanded_aspects) and map them to planes in the image view.
|
||||
*/
|
||||
uint32_t iaspect_bit, vplane = 0;
|
||||
uint32_t vplane = 0;
|
||||
anv_foreach_image_aspect_bit(iaspect_bit, image, expanded_aspects) {
|
||||
uint32_t iplane =
|
||||
anv_image_aspect_to_plane(image->aspects, 1UL << iaspect_bit);
|
||||
|
@@ -101,8 +101,8 @@ build_view_index(struct lower_multiview_state *state)
|
||||
* 16 nibbles, each of which is a value from 0 to 15.
|
||||
*/
|
||||
uint64_t remap = 0;
|
||||
uint32_t bit, i = 0;
|
||||
for_each_bit(bit, state->view_mask) {
|
||||
uint32_t i = 0;
|
||||
u_foreach_bit(bit, state->view_mask) {
|
||||
assert(bit < 16);
|
||||
remap |= (uint64_t)bit << (i++ * 4);
|
||||
}
|
||||
|
@@ -52,6 +52,7 @@
|
||||
#include "blorp/blorp.h"
|
||||
#include "compiler/brw_compiler.h"
|
||||
#include "util/bitset.h"
|
||||
#include "util/bitscan.h"
|
||||
#include "util/macros.h"
|
||||
#include "util/hash_table.h"
|
||||
#include "util/list.h"
|
||||
@@ -357,11 +358,6 @@ static inline uintptr_t anv_pack_ptr(void *ptr, int bits, int flags)
|
||||
return value | (mask & flags);
|
||||
}
|
||||
|
||||
#define for_each_bit(b, dword) \
|
||||
for (uint32_t __dword = (dword); \
|
||||
(b) = __builtin_ffs(__dword) - 1, __dword; \
|
||||
__dword &= ~(1 << (b)))
|
||||
|
||||
/* Whenever we generate an error, pass it through this function. Useful for
|
||||
* debugging, where we can break on it. Only call at error site, not when
|
||||
* propagating errors. Might be useful to plug in a stack trace here.
|
||||
@@ -2442,8 +2438,7 @@ anv_pipe_flush_bits_for_access_flags(struct anv_device *device,
|
||||
{
|
||||
enum anv_pipe_bits pipe_bits = 0;
|
||||
|
||||
unsigned b;
|
||||
for_each_bit(b, flags) {
|
||||
u_foreach_bit(b, flags) {
|
||||
switch ((VkAccessFlagBits)(1 << b)) {
|
||||
case VK_ACCESS_SHADER_WRITE_BIT:
|
||||
/* We're transitioning a buffer that was previously used as write
|
||||
@@ -2503,8 +2498,7 @@ anv_pipe_invalidate_bits_for_access_flags(struct anv_device *device,
|
||||
{
|
||||
enum anv_pipe_bits pipe_bits = 0;
|
||||
|
||||
unsigned b;
|
||||
for_each_bit(b, flags) {
|
||||
u_foreach_bit(b, flags) {
|
||||
switch ((VkAccessFlagBits)(1 << b)) {
|
||||
case VK_ACCESS_INDIRECT_COMMAND_READ_BIT:
|
||||
/* Indirect draw commands take a buffer as input that we're going to
|
||||
@@ -3618,7 +3612,7 @@ anv_plane_to_aspect(VkImageAspectFlags image_aspects,
|
||||
}
|
||||
|
||||
#define anv_foreach_image_aspect_bit(b, image, aspects) \
|
||||
for_each_bit(b, anv_image_expand_aspects(image, aspects))
|
||||
u_foreach_bit(b, anv_image_expand_aspects(image, aspects))
|
||||
|
||||
const struct anv_format *
|
||||
anv_get_format(VkFormat format);
|
||||
|
@@ -2430,7 +2430,6 @@ void genX(CmdPipelineBarrier)(
|
||||
if (range->aspectMask & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV) {
|
||||
VkImageAspectFlags color_aspects =
|
||||
anv_image_expand_aspects(image, range->aspectMask);
|
||||
uint32_t aspect_bit;
|
||||
anv_foreach_image_aspect_bit(aspect_bit, image, color_aspects) {
|
||||
transition_color_buffer(cmd_buffer, image, 1UL << aspect_bit,
|
||||
range->baseMipLevel,
|
||||
@@ -3471,8 +3470,8 @@ genX(cmd_buffer_flush_state)(struct anv_cmd_buffer *cmd_buffer)
|
||||
|
||||
p = anv_batch_emitn(&cmd_buffer->batch, num_dwords,
|
||||
GENX(3DSTATE_VERTEX_BUFFERS));
|
||||
uint32_t vb, i = 0;
|
||||
for_each_bit(vb, vb_emit) {
|
||||
uint32_t i = 0;
|
||||
u_foreach_bit(vb, vb_emit) {
|
||||
struct anv_buffer *buffer = cmd_buffer->state.vertex_bindings[vb].buffer;
|
||||
uint32_t offset = cmd_buffer->state.vertex_bindings[vb].offset;
|
||||
|
||||
@@ -5511,8 +5510,7 @@ cmd_buffer_begin_subpass(struct anv_cmd_buffer *cmd_buffer,
|
||||
uint32_t pending_clear_mask =
|
||||
get_multiview_subpass_clear_mask(cmd_state, att_state);
|
||||
|
||||
uint32_t layer_idx;
|
||||
for_each_bit(layer_idx, pending_clear_mask) {
|
||||
u_foreach_bit(layer_idx, pending_clear_mask) {
|
||||
uint32_t layer =
|
||||
iview->planes[0].isl.base_array_layer + layer_idx;
|
||||
|
||||
@@ -5551,8 +5549,7 @@ cmd_buffer_begin_subpass(struct anv_cmd_buffer *cmd_buffer,
|
||||
uint32_t pending_clear_mask =
|
||||
get_multiview_subpass_clear_mask(cmd_state, att_state);
|
||||
|
||||
uint32_t layer_idx;
|
||||
for_each_bit(layer_idx, pending_clear_mask) {
|
||||
u_foreach_bit(layer_idx, pending_clear_mask) {
|
||||
uint32_t layer =
|
||||
iview->planes[0].isl.base_array_layer + layer_idx;
|
||||
|
||||
|
@@ -2205,8 +2205,8 @@ emit_3dstate_primitive_replication(struct anv_graphics_pipeline *pipeline)
|
||||
pr.ReplicaMask = (1 << view_count) - 1;
|
||||
pr.ReplicationCount = view_count - 1;
|
||||
|
||||
int i = 0, view_index;
|
||||
for_each_bit(view_index, view_mask) {
|
||||
int i = 0;
|
||||
u_foreach_bit(view_index, view_mask) {
|
||||
pr.RTAIOffset[i] = view_index;
|
||||
i++;
|
||||
}
|
||||
|
Reference in New Issue
Block a user