From 5a075785ac48c5c5aa2637e596280aa1bbd0df39 Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Mon, 8 Apr 2024 14:58:37 -0500 Subject: [PATCH] nil: Drop the nil_extent/offset4d() helpers They're only used one place each in NVK and we can just use a struct initializer instead. Reviewed-by: Lina Versace Part-of: --- src/nouveau/nil/extent.rs | 20 -------------------- src/nouveau/vulkan/nvk_cmd_copy.c | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/src/nouveau/nil/extent.rs b/src/nouveau/nil/extent.rs index 3b53c31176a..3e48d537058 100644 --- a/src/nouveau/nil/extent.rs +++ b/src/nouveau/nil/extent.rs @@ -15,21 +15,6 @@ pub struct Extent4D { pub array_len: u32, } -#[no_mangle] -pub extern "C" fn nil_extent4d( - width: u32, - height: u32, - depth: u32, - array_len: u32, -) -> Extent4D { - Extent4D { - width, - height, - depth, - array_len, - } -} - impl Extent4D { pub fn new( width: u32, @@ -145,11 +130,6 @@ pub struct Offset4D { pub a: u32, } -#[no_mangle] -pub extern "C" fn nil_offset4d(x: u32, y: u32, z: u32, a: u32) -> Offset4D { - Offset4D { x, y, z, a } -} - impl Offset4D { fn div_floor(self, other: Extent4D) -> Self { Self { diff --git a/src/nouveau/vulkan/nvk_cmd_copy.c b/src/nouveau/vulkan/nvk_cmd_copy.c index 820f1c7e64b..3517128957c 100644 --- a/src/nouveau/vulkan/nvk_cmd_copy.c +++ b/src/nouveau/vulkan/nvk_cmd_copy.c @@ -68,13 +68,23 @@ nouveau_copy_rect_buffer(struct nvk_buffer *buf, static struct nil_offset4d vk_to_nil_offset(VkOffset3D offset, uint32_t base_array_layer) { - return nil_offset4d(offset.x, offset.y, offset.z, base_array_layer); + return (struct nil_offset4d) { + .x = offset.x, + .y = offset.y, + .z = offset.z, + .a = base_array_layer + }; } static struct nil_extent4d vk_to_nil_extent(VkExtent3D extent, uint32_t array_layers) { - return nil_extent4d(extent.width, extent.height, extent.depth, array_layers); + return (struct nil_extent4d) { + .width = extent.width, + .height = extent.height, + .depth = extent.depth, + .array_len = array_layers, + }; } static struct nouveau_copy_buffer