diff --git a/src/imagination/common/pvr_debug.c b/src/imagination/common/pvr_debug.c index 829e8f570db..59709796401 100644 --- a/src/imagination/common/pvr_debug.c +++ b/src/imagination/common/pvr_debug.c @@ -36,6 +36,8 @@ static const struct debug_named_value debug_control[] = { "Track all buffer objects with at least one reference." }, { "bo_zero", PVR_DEBUG_ZERO_BOS, "Zero all buffer objects at allocation to make them deterministic." }, + { "vk_desc", PVR_DEBUG_VK_DUMP_DESCRIPTOR_SET_LAYOUT, + "Dump descriptor set and pipeline layouts." }, DEBUG_NAMED_VALUE_END }; /* clang-format on */ diff --git a/src/imagination/common/pvr_debug.h b/src/imagination/common/pvr_debug.h index c2378cc01ae..f0254cccdc3 100644 --- a/src/imagination/common/pvr_debug.h +++ b/src/imagination/common/pvr_debug.h @@ -37,6 +37,7 @@ extern uint32_t PVR_DEBUG; #define PVR_DEBUG_DUMP_CONTROL_STREAM BITFIELD_BIT(0) #define PVR_DEBUG_TRACK_BOS BITFIELD_BIT(1) #define PVR_DEBUG_ZERO_BOS BITFIELD_BIT(2) +#define PVR_DEBUG_VK_DUMP_DESCRIPTOR_SET_LAYOUT BITFIELD_BIT(3) void pvr_process_debug_variable(void); diff --git a/src/imagination/vulkan/pvr_descriptor_set.c b/src/imagination/vulkan/pvr_descriptor_set.c index fede093b44c..c65bd0407b8 100644 --- a/src/imagination/vulkan/pvr_descriptor_set.c +++ b/src/imagination/vulkan/pvr_descriptor_set.c @@ -30,6 +30,7 @@ #include "hwdef/rogue_hw_utils.h" #include "pvr_bo.h" +#include "pvr_debug.h" #include "pvr_private.h" #include "pvr_types.h" #include "util/compiler.h" @@ -42,7 +43,6 @@ #include "vk_object.h" #include "vk_util.h" -#if defined(DEBUG) static const struct { const char *raw; const char *primary; @@ -78,7 +78,6 @@ static const char *descriptor_names[] = { "VK SAMPLER", "VK UNIFORM_BUFFER_DYNAMIC", "VK STORAGE_BUFFER_DYNAMIC", "VK INPUT_ATTACHMENT" }; -#endif #define PVR_DESC_IMAGE_SECONDARY_OFFSET_ARRAYBASE 0U #define PVR_DESC_IMAGE_SECONDARY_SIZE_ARRAYBASE 2U @@ -332,7 +331,6 @@ static void pvr_setup_in_memory_layout_sizes( } } -#if defined(DEBUG) static void pvr_dump_in_memory_layout_sizes(const struct pvr_descriptor_set_layout *layout) { @@ -424,7 +422,6 @@ pvr_dump_in_memory_layout_sizes(const struct pvr_descriptor_set_layout *layout) mesa_logd("=============================================="); } } -#endif VkResult pvr_CreateDescriptorSetLayout( VkDevice _device, @@ -654,9 +651,8 @@ VkResult pvr_CreateDescriptorSetLayout( pvr_setup_in_memory_layout_sizes(layout, reg_usage); -#if defined(DEBUG) - pvr_dump_in_memory_layout_sizes(layout); -#endif + if (PVR_IS_DEBUG_SET(VK_DUMP_DESCRIPTOR_SET_LAYOUT)) + pvr_dump_in_memory_layout_sizes(layout); vk_free2(&device->vk.alloc, pAllocator, bindings); @@ -678,7 +674,6 @@ void pvr_DestroyDescriptorSetLayout(VkDevice _device, pvr_descriptor_set_layout_free(device, pAllocator, layout); } -#if defined(DEBUG) static void pvr_dump_in_register_layout_sizes(const struct pvr_device *device, const struct pvr_pipeline_layout *layout) @@ -853,7 +848,6 @@ pvr_dump_in_register_layout_sizes(const struct pvr_device *device, # undef LOGD_CHAR_NTIMES # undef SEPARATOR_LENGTH } -#endif /* Pipeline layouts. These have nothing to do with the pipeline. They are * just multiple descriptor set layouts pasted together. @@ -1015,9 +1009,8 @@ VkResult pvr_CreatePipelineLayout(VkDevice _device, layout->compute_push_constants_offset = range->offset; } -#if defined(DEBUG) - pvr_dump_in_register_layout_sizes(device, layout); -#endif + if (PVR_IS_DEBUG_SET(VK_DUMP_DESCRIPTOR_SET_LAYOUT)) + pvr_dump_in_register_layout_sizes(device, layout); *pPipelineLayout = pvr_pipeline_layout_to_handle(layout);