diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c index eeed3690d34..32945f7ddb4 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c @@ -594,7 +594,8 @@ vl_mpeg12_begin_frame(struct pipe_video_codec *decoder, struct vl_mpeg12_buffer *buf; struct pipe_resource *tex; - struct pipe_box rect = { 0, 0, 0, 1, 1, 1 }; + struct pipe_box rect; + u_box_3d(0, 0, 0, 1, 1, 1, &rect); uint8_t intra_matrix[64]; uint8_t non_intra_matrix[64]; diff --git a/src/gallium/auxiliary/vl/vl_zscan.c b/src/gallium/auxiliary/vl/vl_zscan.c index f332309724b..13b044d7c9f 100644 --- a/src/gallium/auxiliary/vl/vl_zscan.c +++ b/src/gallium/auxiliary/vl/vl_zscan.c @@ -314,13 +314,11 @@ vl_zscan_layout(struct pipe_context *pipe, const int layout[64], unsigned blocks unsigned x, y, i, pitch; float *f; - struct pipe_box rect = - { - 0, 0, 0, - VL_BLOCK_WIDTH * blocks_per_line, - VL_BLOCK_HEIGHT, - 1 - }; + struct pipe_box rect; + u_box_3d(0, 0, 0, + VL_BLOCK_WIDTH * blocks_per_line, + VL_BLOCK_HEIGHT, + 1, &rect); assert(pipe && layout && blocks_per_line); @@ -496,13 +494,11 @@ vl_zscan_upload_quant(struct vl_zscan *zscan, struct vl_zscan_buffer *buffer, unsigned x, y, i, pitch; uint8_t *data; - struct pipe_box rect = - { - 0, 0, intra ? 1 : 0, - VL_BLOCK_WIDTH, - VL_BLOCK_HEIGHT, - 1 - }; + struct pipe_box rect; + u_box_3d(0, 0, intra ? 1 : 0, + VL_BLOCK_WIDTH, + VL_BLOCK_HEIGHT, + 1, &rect); assert(buffer); assert(matrix); diff --git a/src/gallium/drivers/d3d12/d3d12_draw.cpp b/src/gallium/drivers/d3d12/d3d12_draw.cpp index 7c62d622bf4..866f9f81a86 100644 --- a/src/gallium/drivers/d3d12/d3d12_draw.cpp +++ b/src/gallium/drivers/d3d12/d3d12_draw.cpp @@ -1309,7 +1309,8 @@ update_dispatch_indirect_with_sysvals(struct d3d12_context *ctx, output_buf_templ.usage = PIPE_USAGE_DEFAULT; *indirect_out = ctx->base.screen->resource_create(ctx->base.screen, &output_buf_templ); - struct pipe_box src_box = { (int)*indirect_offset_inout, 0, 0, sizeof(uint32_t) * 3, 1, 1 }; + struct pipe_box src_box; + u_box_3d((int)*indirect_offset_inout, 0, 0, sizeof(uint32_t) * 3, 1, 1, &src_box); ctx->base.resource_copy_region(&ctx->base, *indirect_out, 0, 0, 0, 0, indirect_in, 0, &src_box); ctx->base.resource_copy_region(&ctx->base, *indirect_out, 0, src_box.width, 0, 0, indirect_in, 0, &src_box); diff --git a/src/gallium/drivers/d3d12/d3d12_resource.cpp b/src/gallium/drivers/d3d12/d3d12_resource.cpp index 7c8c9cefe59..22e11e9f3c8 100644 --- a/src/gallium/drivers/d3d12/d3d12_resource.cpp +++ b/src/gallium/drivers/d3d12/d3d12_resource.cpp @@ -1313,7 +1313,8 @@ transfer_image_to_buf(struct d3d12_context *ctx, tmpl.nr_samples = 0; resolved_resource = d3d12_resource_create(ctx->base.screen, &tmpl); struct pipe_blit_info resolve_info = {}; - struct pipe_box box = {0,0,0, (int)res->base.b.width0, (int16_t)res->base.b.height0, (int16_t)res->base.b.depth0}; + struct pipe_box box; + u_box_3d(0,0,0, (int)res->base.b.width0, (int16_t)res->base.b.height0, (int16_t)res->base.b.depth0, &box); resolve_info.dst.resource = resolved_resource; resolve_info.dst.box = box; resolve_info.dst.format = res->base.b.format; diff --git a/src/gallium/drivers/d3d12/d3d12_video_dec.cpp b/src/gallium/drivers/d3d12/d3d12_video_dec.cpp index ea4470339ca..fb28a9d950f 100644 --- a/src/gallium/drivers/d3d12/d3d12_video_dec.cpp +++ b/src/gallium/drivers/d3d12/d3d12_video_dec.cpp @@ -705,13 +705,14 @@ d3d12_video_decoder_end_frame(struct pipe_video_codec *codec, // Copy all format subresources/texture planes for (PlaneSlice = 0; PlaneSlice < pD3D12Dec->m_decodeFormatInfo.PlaneCount; PlaneSlice++) { assert(d3d12OutputArguments.OutputSubresource < INT16_MAX); - struct pipe_box box = { 0, - 0, - // src array slice, taken as Z for TEXTURE_2D_ARRAY - static_cast(d3d12OutputArguments.OutputSubresource), - static_cast(pPipeDstViews[PlaneSlice]->texture->width0), - static_cast(pPipeDstViews[PlaneSlice]->texture->height0), - 1 }; + struct pipe_box box; + u_box_3d(0, + 0, + // src array slice, taken as Z for TEXTURE_2D_ARRAY + static_cast(d3d12OutputArguments.OutputSubresource), + static_cast(pPipeDstViews[PlaneSlice]->texture->width0), + static_cast(pPipeDstViews[PlaneSlice]->texture->height0), + 1, &box); pD3D12Dec->base.context->resource_copy_region(pD3D12Dec->base.context, pPipeDstViews[PlaneSlice]->texture, // dst diff --git a/src/gallium/drivers/d3d12/d3d12_video_enc.cpp b/src/gallium/drivers/d3d12/d3d12_video_enc.cpp index a1a8e63b9d5..93ede43b375 100644 --- a/src/gallium/drivers/d3d12/d3d12_video_enc.cpp +++ b/src/gallium/drivers/d3d12/d3d12_video_enc.cpp @@ -2510,14 +2510,14 @@ d3d12_video_encoder_extract_encode_metadata( d3d12_resource_from_resource(&pD3D12Screen->base, pResolvedMetadataBuffer); assert(pPipeResolvedMetadataBuffer); assert(resourceMetadataSize < INT_MAX); - struct pipe_box box = { - 0, // x - 0, // y - 0, // z - static_cast(resourceMetadataSize), // width - 1, // height - 1 // depth - }; + struct pipe_box box; + u_box_3d(0, // x + 0, // y + 0, // z + static_cast(resourceMetadataSize), // width + 1, // height + 1, // depth + &box); struct pipe_transfer *mapTransfer; unsigned mapUsage = PIPE_MAP_READ; void * pMetadataBufferSrc = pD3D12Enc->base.context->buffer_map(pD3D12Enc->base.context, diff --git a/src/gallium/drivers/d3d12/d3d12_video_enc_av1.cpp b/src/gallium/drivers/d3d12/d3d12_video_enc_av1.cpp index 1072cc6d6b7..bbe672f2059 100644 --- a/src/gallium/drivers/d3d12/d3d12_video_enc_av1.cpp +++ b/src/gallium/drivers/d3d12/d3d12_video_enc_av1.cpp @@ -2147,14 +2147,14 @@ d3d12_video_encoder_build_post_encode_codec_bitstream_av1(struct d3d12_video_enc pipe_resource *pPipeResolvedMetadataBuffer = d3d12_resource_from_resource(&pD3D12Screen->base, pResolvedMetadataBuffer); assert(resourceMetadataSize < INT_MAX); - struct pipe_box box = { - 0, // x - 0, // y - 0, // z - static_cast(resourceMetadataSize), // width - 1, // height - 1 // depth - }; + struct pipe_box box; + u_box_3d(0, // x + 0, // y + 0, // z + static_cast(resourceMetadataSize), // width + 1, // height + 1, // depth + &box); struct pipe_transfer *mapTransferMetadata; uint8_t *pMetadataBufferSrc = reinterpret_cast(pD3D12Enc->base.context->buffer_map(pD3D12Enc->base.context, @@ -2859,14 +2859,14 @@ upload_tile_group_obu(struct d3d12_video_encoder *pD3D12Enc, // Now copy the decode_tile() element from the driver staging GPU buffer onto the finalized GPU buffer - struct pipe_box src_box = { - static_cast(src_buf_tile_position), // x - 0, // y - 0, // z - static_cast(tile_size), // width - 1, // height - 1 // depth - }; + struct pipe_box src_box; + u_box_3d(static_cast(src_buf_tile_position), // x + 0, // y + 0, // z + static_cast(tile_size), // width + 1, // height + 1, // depth + &src_box); pD3D12Enc->base.context->resource_copy_region(pD3D12Enc->base.context, // ctx comp_bit_destination, // dst diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 60bd2324121..00fa51606e6 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -4518,7 +4518,8 @@ zink_copy_buffer(struct zink_context *ctx, struct zink_resource *dst, struct zin struct zink_batch *batch = &ctx->batch; - struct pipe_box box = {(int)src_offset, 0, 0, (int)size, 0, 0}; + struct pipe_box box; + u_box_3d((int)src_offset, 0, 0, (int)size, 0, 0, &box); /* must barrier if something wrote the valid buffer range */ bool valid_write = zink_check_valid_buffer_src_access(ctx, src, src_offset, size); bool unordered_src = !valid_write && !zink_check_unordered_transfer_access(src, 0, &box); diff --git a/src/gallium/drivers/zink/zink_kopper.c b/src/gallium/drivers/zink/zink_kopper.c index 79c38837f1e..89da3a883ee 100644 --- a/src/gallium/drivers/zink/zink_kopper.c +++ b/src/gallium/drivers/zink/zink_kopper.c @@ -1012,7 +1012,8 @@ zink_kopper_readback_update(struct zink_context *ctx, struct zink_resource *res) struct kopper_swapchain *cswap = cdt->swapchain; assert(res->obj->dt_idx != UINT32_MAX); struct pipe_resource *readback = cswap->images[res->obj->dt_idx].readback; - struct pipe_box box = {0, 0, 0, res->base.b.width0, res->base.b.height0, res->base.b.depth0}; + struct pipe_box box; + u_box_3d(0, 0, 0, res->base.b.width0, res->base.b.height0, res->base.b.depth0, &box); if (cswap->images[res->obj->dt_idx].readback_needs_update && readback) ctx->base.resource_copy_region(&ctx->base, readback, 0, 0, 0, 0, &res->base.b, 0, &box); diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c index 289d77b466c..293a653fef4 100644 --- a/src/gallium/drivers/zink/zink_resource.c +++ b/src/gallium/drivers/zink/zink_resource.c @@ -1754,9 +1754,10 @@ add_resource_bind(struct zink_context *ctx, struct zink_resource *res, unsigned res->obj = new_obj; res->queue = VK_QUEUE_FAMILY_IGNORED; for (unsigned i = 0; i <= res->base.b.last_level; i++) { - struct pipe_box box = {0, 0, 0, - u_minify(res->base.b.width0, i), - u_minify(res->base.b.height0, i), res->base.b.array_size}; + struct pipe_box box; + u_box_3d(0, 0, 0, + u_minify(res->base.b.width0, i), + u_minify(res->base.b.height0, i), res->base.b.array_size, &box); box.depth = util_num_layers(&res->base.b, i); ctx->base.resource_copy_region(&ctx->base, &res->base.b, i, 0, 0, 0, &staging.base.b, i, &box); } @@ -2113,7 +2114,8 @@ invalidate_buffer(struct zink_context *ctx, struct zink_resource *res) if (res->base.b.flags & PIPE_RESOURCE_FLAG_SPARSE) return false; - struct pipe_box box = {0, 0, 0, res->base.b.width0, 0, 0}; + struct pipe_box box; + u_box_3d(0, 0, 0, res->base.b.width0, 0, 0, &box); if (res->valid_buffer_range.start > res->valid_buffer_range.end && !zink_resource_copy_box_intersects(res, 0, &box)) return false; diff --git a/src/gallium/drivers/zink/zink_synchronization.cpp b/src/gallium/drivers/zink/zink_synchronization.cpp index e2be33f24cf..2746c846948 100644 --- a/src/gallium/drivers/zink/zink_synchronization.cpp +++ b/src/gallium/drivers/zink/zink_synchronization.cpp @@ -615,7 +615,8 @@ zink_resource_buffer_transfer_dst_barrier(struct zink_context *ctx, struct zink_ if (res->obj->copies_need_reset) zink_resource_copies_reset(res); bool unordered = true; - struct pipe_box box = {(int)offset, 0, 0, (int)size, 0, 0}; + struct pipe_box box; + u_box_3d((int)offset, 0, 0, (int)size, 0, 0, &box); bool can_unordered_write = unordered_res_exec(ctx, res, true); /* must barrier if something read the valid buffer range */ bool valid_read = (res->obj->access || res->obj->unordered_access) && diff --git a/src/gallium/frontends/omx/vid_dec_common.c b/src/gallium/frontends/omx/vid_dec_common.c index 74264fb2911..de5a8fd7f37 100644 --- a/src/gallium/frontends/omx/vid_dec_common.c +++ b/src/gallium/frontends/omx/vid_dec_common.c @@ -135,7 +135,8 @@ void vid_dec_FillOutput(vid_dec_PrivateType *priv, struct pipe_video_buffer *buf pipe_format_to_chroma_format(buf->buffer_format), buf->interlaced); for (j = 0; j < views[i]->texture->array_size; ++j) { - struct pipe_box box = {0, 0, j, width, height, 1}; + struct pipe_box box; + u_box_3d(0, 0, j, width, height, 1, &box); struct pipe_transfer *transfer; uint8_t *map, *dst; map = priv->pipe->texture_map(priv->pipe, views[i]->texture, 0, diff --git a/src/gallium/frontends/va/image.c b/src/gallium/frontends/va/image.c index f6f177bfe0d..e7195e1b15e 100644 --- a/src/gallium/frontends/va/image.c +++ b/src/gallium/frontends/va/image.c @@ -600,7 +600,8 @@ vlVaGetImage(VADriverContextP ctx, VASurfaceID surface, int x, int y, pipe_format_to_chroma_format(surf->templat.buffer_format), surf->templat.interlaced); for (j = 0; j < view_resources[i]->array_size; ++j) { - struct pipe_box box = {box_x, box_y, j, box_w, box_h, 1}; + struct pipe_box box; + u_box_3d(box_x, box_y, j, box_w, box_h, 1, &box); struct pipe_transfer *transfer; uint8_t *map; map = drv->pipe->texture_map(drv->pipe, view_resources[i], 0, @@ -727,7 +728,8 @@ vlVaPutImage(VADriverContextP ctx, VASurfaceID surface, VAImageID image, vlVaVideoSurfaceSize(surf, i, &width, &height); for (j = 0; j < tex->array_size; ++j) { - struct pipe_box dst_box = {0, 0, j, width, height, 1}; + struct pipe_box dst_box; + u_box_3d(0, 0, j, width, height, 1, &dst_box); if (((format == PIPE_FORMAT_YV12) || (format == PIPE_FORMAT_IYUV)) && (surf->buffer->buffer_format == PIPE_FORMAT_NV12) diff --git a/src/gallium/frontends/vdpau/output.c b/src/gallium/frontends/vdpau/output.c index 8c7013da83b..41a2dc9b07b 100644 --- a/src/gallium/frontends/vdpau/output.c +++ b/src/gallium/frontends/vdpau/output.c @@ -497,10 +497,9 @@ vlVdpOutputSurfacePutBitsYCbCr(VdpOutputSurface surface, struct pipe_sampler_view *sv = sampler_views[i]; if (!sv) continue; - struct pipe_box dst_box = { - 0, 0, 0, - sv->texture->width0, sv->texture->height0, 1 - }; + struct pipe_box dst_box; + u_box_3d(0, 0, 0, + sv->texture->width0, sv->texture->height0, 1, &dst_box); pipe->texture_subdata(pipe, sv->texture, 0, PIPE_MAP_WRITE, &dst_box, source_data[i], source_pitches[i], 0); diff --git a/src/gallium/frontends/vdpau/surface.c b/src/gallium/frontends/vdpau/surface.c index a5c3d0cfa43..4f072809fc9 100644 --- a/src/gallium/frontends/vdpau/surface.c +++ b/src/gallium/frontends/vdpau/surface.c @@ -253,10 +253,8 @@ vlVdpVideoSurfaceGetBitsYCbCr(VdpVideoSurface surface, vlVdpVideoSurfaceSize(vlsurface, i, &width, &height); for (j = 0; j < sv->texture->array_size; ++j) { - struct pipe_box box = { - 0, 0, j, - width, height, 1 - }; + struct pipe_box box; + u_box_3d(0, 0, j, width, height, 1, &box); struct pipe_transfer *transfer; uint8_t *map; @@ -391,10 +389,8 @@ vlVdpVideoSurfacePutBitsYCbCr(VdpVideoSurface surface, vlVdpVideoSurfaceSize(p_surf, i, &width, &height); for (j = 0; j < tex->array_size; ++j) { - struct pipe_box dst_box = { - 0, 0, j, - width, height, 1 - }; + struct pipe_box dst_box; + u_box_3d(0, 0, j, width, height, 1, &dst_box); if (conversion == CONVERSION_YV12_TO_NV12 && i == 1) { struct pipe_transfer *transfer;