1 // Copyright 2021 The Fuchsia Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef SRC_GRAPHICS_LIB_COMPUTE_RADIX_SORT_PLATFORMS_VK_INCLUDE_RADIX_SORT_PLATFORMS_VK_RADIX_SORT_VK_DEVADDR_H_ 6 #define SRC_GRAPHICS_LIB_COMPUTE_RADIX_SORT_PLATFORMS_VK_INCLUDE_RADIX_SORT_PLATFORMS_VK_RADIX_SORT_VK_DEVADDR_H_ 7 8 // 9 // 10 // 11 12 #include "radix_sort_vk.h" 13 14 // 15 // 16 // 17 18 #ifdef __cplusplus 19 extern "C" { 20 #endif 21 22 // 23 // Structure that enables integration with Vulkan drivers. 24 // 25 typedef struct radix_sort_vk_buffer_info 26 { 27 VkBuffer buffer; 28 VkDeviceSize offset; 29 VkDeviceAddress devaddr; 30 } radix_sort_vk_buffer_info_t; 31 32 // 33 // Function prototypes 34 // 35 typedef void (*radix_sort_vk_fill_buffer_pfn)(VkCommandBuffer cb, 36 radix_sort_vk_buffer_info_t const * buffer_info, 37 VkDeviceSize offset, 38 VkDeviceSize size, 39 uint32_t data); 40 41 typedef void (*radix_sort_vk_dispatch_indirect_pfn)(VkCommandBuffer cb, 42 radix_sort_vk_buffer_info_t const * buffer_info, 43 VkDeviceSize offset); 44 45 // 46 // Direct dispatch sorting using buffer device addresses 47 // ----------------------------------------------------- 48 // 49 typedef struct radix_sort_vk_sort_devaddr_info 50 { 51 void * ext; 52 uint32_t key_bits; 53 uint32_t count; 54 radix_sort_vk_buffer_info_t keyvals_even; 55 VkDeviceAddress keyvals_odd; 56 radix_sort_vk_buffer_info_t internal; 57 radix_sort_vk_fill_buffer_pfn fill_buffer; 58 } radix_sort_vk_sort_devaddr_info_t; 59 60 void 61 radix_sort_vk_sort_devaddr(radix_sort_vk_t const * rs, 62 radix_sort_vk_sort_devaddr_info_t const * info, 63 VkDevice device, 64 VkCommandBuffer cb, 65 VkDeviceAddress * keyvals_sorted); 66 67 // 68 // Indirect dispatch sorting using buffer device addresses 69 // ------------------------------------------------------- 70 // 71 // clang-format off 72 // 73 typedef struct radix_sort_vk_sort_indirect_devaddr_info 74 { 75 void * ext; 76 uint32_t key_bits; 77 VkDeviceAddress count; 78 VkDeviceAddress keyvals_even; 79 VkDeviceAddress keyvals_odd; 80 VkDeviceAddress internal; 81 radix_sort_vk_buffer_info_t indirect; 82 radix_sort_vk_dispatch_indirect_pfn dispatch_indirect; 83 } radix_sort_vk_sort_indirect_devaddr_info_t; 84 85 void 86 radix_sort_vk_sort_indirect_devaddr(radix_sort_vk_t const * rs, 87 radix_sort_vk_sort_indirect_devaddr_info_t const * info, 88 VkDevice device, 89 VkCommandBuffer cb, 90 VkDeviceAddress * keyvals_sorted); 91 92 // 93 // clang-format on 94 // 95 96 #ifdef __cplusplus 97 } 98 #endif 99 100 // 101 // 102 // 103 104 #endif // SRC_GRAPHICS_LIB_COMPUTE_RADIX_SORT_PLATFORMS_VK_INCLUDE_RADIX_SORT_PLATFORMS_VK_RADIX_SORT_VK_DEVADDR_H_ 105