mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 07:28:11 +02:00
vulkan: Add a vk_device parameter to get_encode_key
Useful for selecting different encoding options based on hardware generation. Reviewed-by: Natalie Vock <natalie.vock@gmx.de> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34273>
This commit is contained in:
parent
0cc9443e9b
commit
2dee1117b7
6 changed files with 13 additions and 11 deletions
|
|
@ -385,7 +385,8 @@ radv_get_update_scratch_size(struct vk_device *vk_device, uint32_t leaf_count)
|
|||
}
|
||||
|
||||
static uint32_t
|
||||
radv_get_encode_key(VkAccelerationStructureTypeKHR type, VkBuildAccelerationStructureFlagBitsKHR flags)
|
||||
radv_get_encode_key(struct vk_device *device, VkAccelerationStructureTypeKHR type,
|
||||
VkBuildAccelerationStructureFlagBitsKHR flags)
|
||||
{
|
||||
if (flags & VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_KHR)
|
||||
return RADV_ENCODE_KEY_COMPACT;
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ VkDeviceSize get_bvh_size(VkDevice device,
|
|||
}
|
||||
|
||||
static uint32_t
|
||||
encode_key(VkAccelerationStructureTypeKHR type,
|
||||
encode_key(struct vk_device *device, VkAccelerationStructureTypeKHR type,
|
||||
VkBuildAccelerationStructureFlagBitsKHR flags)
|
||||
{
|
||||
return 0;
|
||||
|
|
@ -233,7 +233,7 @@ enum tu_header_key {
|
|||
};
|
||||
|
||||
static uint32_t
|
||||
header_key(VkAccelerationStructureTypeKHR type,
|
||||
header_key(struct vk_device *device, VkAccelerationStructureTypeKHR type,
|
||||
VkBuildAccelerationStructureFlagBitsKHR flags)
|
||||
{
|
||||
return (flags & VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_KHR) ?
|
||||
|
|
|
|||
|
|
@ -646,7 +646,7 @@ lvp_get_as_size(VkDevice device,
|
|||
}
|
||||
|
||||
static uint32_t
|
||||
lvp_get_encode_key(VkAccelerationStructureTypeKHR type,
|
||||
lvp_get_encode_key(struct vk_device *device, VkAccelerationStructureTypeKHR type,
|
||||
VkBuildAccelerationStructureFlagBitsKHR flags)
|
||||
{
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -350,7 +350,7 @@ anv_get_as_size(VkDevice device,
|
|||
}
|
||||
|
||||
static uint32_t
|
||||
anv_get_encode_key(VkAccelerationStructureTypeKHR type,
|
||||
anv_get_encode_key(struct vk_device *device, VkAccelerationStructureTypeKHR type,
|
||||
VkBuildAccelerationStructureFlagBitsKHR flags)
|
||||
{
|
||||
return 0;
|
||||
|
|
@ -437,7 +437,7 @@ anv_encode_as(VkCommandBuffer commandBuffer,
|
|||
}
|
||||
|
||||
static uint32_t
|
||||
anv_get_header_key(VkAccelerationStructureTypeKHR type,
|
||||
anv_get_header_key(struct vk_device *device, VkAccelerationStructureTypeKHR type,
|
||||
VkBuildAccelerationStructureFlagBitsKHR flags)
|
||||
{
|
||||
return (flags & VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_KHR) ?
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ struct scratch_layout {
|
|||
};
|
||||
|
||||
static struct build_config
|
||||
build_config(uint32_t leaf_count,
|
||||
build_config(struct vk_device *device, uint32_t leaf_count,
|
||||
const VkAccelerationStructureBuildGeometryInfoKHR *build_info,
|
||||
const struct vk_acceleration_structure_build_ops *ops)
|
||||
{
|
||||
|
|
@ -176,7 +176,7 @@ build_config(uint32_t leaf_count,
|
|||
for (unsigned i = 0; i < ARRAY_SIZE(config.encode_key); i++) {
|
||||
if (!ops->get_encode_key[i])
|
||||
break;
|
||||
config.encode_key[i] = ops->get_encode_key[i](leaf_count, build_info->flags);
|
||||
config.encode_key[i] = ops->get_encode_key[i](device, leaf_count, build_info->flags);
|
||||
}
|
||||
|
||||
return config;
|
||||
|
|
@ -218,7 +218,7 @@ get_scratch_layout(struct vk_device *device,
|
|||
uint32_t ploc_scratch_space = 0;
|
||||
uint32_t lbvh_node_space = 0;
|
||||
|
||||
struct build_config config = build_config(leaf_count, build_info,
|
||||
struct build_config config = build_config(device, leaf_count, build_info,
|
||||
device->as_build_ops);
|
||||
|
||||
if (config.internal_type == INTERNAL_BUILD_TYPE_PLOC)
|
||||
|
|
@ -1039,7 +1039,7 @@ vk_cmd_build_acceleration_structures(VkCommandBuffer commandBuffer,
|
|||
|
||||
get_scratch_layout(device, leaf_node_count, pInfos + i, args, &bvh_states[i].scratch);
|
||||
|
||||
struct build_config config = build_config(leaf_node_count, pInfos + i,
|
||||
struct build_config config = build_config(cmd_buffer->base.device, leaf_node_count, pInfos + i,
|
||||
device->as_build_ops);
|
||||
bvh_states[i].config = config;
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,8 @@ struct vk_acceleration_structure_build_ops {
|
|||
const VkAccelerationStructureBuildGeometryInfoKHR *pBuildInfo,
|
||||
uint32_t leaf_count);
|
||||
VkDeviceSize (*get_update_scratch_size)(struct vk_device *device, uint32_t leaf_count);
|
||||
uint32_t (*get_encode_key[MAX_ENCODE_PASSES])(VkAccelerationStructureTypeKHR type,
|
||||
uint32_t (*get_encode_key[MAX_ENCODE_PASSES])(struct vk_device *device,
|
||||
VkAccelerationStructureTypeKHR type,
|
||||
VkBuildAccelerationStructureFlagBitsKHR flags);
|
||||
VkResult (*encode_bind_pipeline[MAX_ENCODE_PASSES])(VkCommandBuffer cmd_buffer,
|
||||
uint32_t key);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue