From 3f3bd79b7e298190af7a1bde6c6812d0a408a4c0 Mon Sep 17 00:00:00 2001 From: Per Mathisen Date: Tue, 8 Oct 2024 12:52:58 +0900 Subject: [PATCH] A few bugfixes --- README.md | 5 +++-- include/vulkan_ext.h | 7 ++++--- src/vulkan_common.cpp | 14 ++++---------- src/vulkan_compute_bda_sc.cpp | 2 +- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 85f2369..83a948f 100644 --- a/README.md +++ b/README.md @@ -90,8 +90,9 @@ vkGetLayerObjectPropertyTRACETOOLTEST(VkInstance instance, VkObjectType objectTy uint64_t objectHandle, VkLayerObjectPropertyTRACETOOLTEST valueType) which can request layer internal information from the layer supporting this extension. -VK_TRACETOOLTEST_memory_markup - defines ways to mark buffer device addresses and -shader group handles in memory for identification by tools. +VK_TRACETOOLTEST_trace_helpers - various helper commands for tracing tools. Defines +ways to mark buffer device addresses and shader group handles in memory for +identification by tools. Private GLES extensions ----------------------- diff --git a/include/vulkan_ext.h b/include/vulkan_ext.h index 4b10c22..1455e9c 100644 --- a/include/vulkan_ext.h +++ b/include/vulkan_ext.h @@ -47,7 +47,7 @@ typedef enum VkAddressRemapTargetTRACETOOLTEST // Mark where in memory buffer device addresses or shader group handles are stored, as they may need to be // remapped for trace replay. -// Passed to vkCreatePipelineLayout for specialization constants, vkCmdPushConstants2KHR for push constants, +// Passed to VkPipelineShaderStageCreateInfo for specialization constants, vkCmdPushConstants2KHR for push constants, // vkCmdUpdateBuffer2TRACETOOLTEST for commandbuffer buffer updates, or vkUpdateBufferTRACETOOLTEST for mapped // memory buffer updates. When used with vkCmdPushConstants2KHR, offsets given here are relative to the start // of its dstOffset. @@ -93,5 +93,6 @@ typedef void (VKAPI_PTR *PFN_vkPatchImageTRACETOOLTEST)(VkDevice device, VkImage // All pending Vulkan work has been host synchronized at this point to prevent race conditions. On trace replay, all other threads // must also synchronize to this point. When called outside of a replay context, this is a no-op. You should never need to add this -// yourself to code, but it could be useful as a debug tool for tracing issues. -typedef void (VKAPI_PTR *PFN_vkThreadBarrierTRACETOOLTEST)(); +// yourself to code, but it could be useful as a debug tool for tracing issues. To call it yourself, set count to zero and pValues +// to null, and tools will find it and fill it out with their internal tracking data for your threads. +typedef void (VKAPI_PTR *PFN_vkThreadBarrierTRACETOOLTEST)(uint32_t count, uint32_t* pValues); diff --git a/src/vulkan_common.cpp b/src/vulkan_common.cpp index ad52483..42cb5dd 100644 --- a/src/vulkan_common.cpp +++ b/src/vulkan_common.cpp @@ -408,13 +408,15 @@ vulkan_setup_t test_init(int argc, char** argv, const std::string& testname, vul { reqs.reqfeat12.bufferDeviceAddress = VK_TRUE; } + if (VK_VERSION_MAJOR(reqs.apiVersion) >= 1 && VK_VERSION_MINOR(reqs.apiVersion) >= 2) { deviceInfo.pNext = &reqs.reqfeat2; } - else + else // Vulkan 1.1 or below { deviceInfo.pEnabledFeatures = &reqs.reqfeat2.features; + deviceInfo.pNext = &reqs.reqfeat11; } std::vector enabledExtensions; @@ -424,7 +426,6 @@ vulkan_setup_t test_init(int argc, char** argv, const std::string& testname, vul std::vector supported_device_extensions(propertyCount); result = vkEnumerateDeviceExtensionProperties(vulkan.physical, nullptr, &propertyCount, supported_device_extensions.data()); assert(result == VK_SUCCESS); - VkPhysicalDeviceFrameBoundaryFeaturesEXT pdfbfinfo = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAME_BOUNDARY_FEATURES_EXT, nullptr }; for (const VkExtensionProperties& s : supported_device_extensions) { @@ -453,14 +454,7 @@ vulkan_setup_t test_init(int argc, char** argv, const std::string& testname, vul enabledExtensions.push_back(str.c_str()); device_required.erase(str); - // Official frame boundary extension required and supported - if (strcmp(s.extensionName, VK_EXT_FRAME_BOUNDARY_EXTENSION_NAME) == 0) - { - pdfbfinfo.pNext = (void*)deviceInfo.pNext; - pdfbfinfo.frameBoundary = VK_TRUE; - deviceInfo.pNext = (VkPhysicalDeviceFrameBoundaryFeaturesEXT*)&pdfbfinfo; - } - else if (strcmp(s.extensionName, VK_KHR_MAINTENANCE_6_EXTENSION_NAME) == 0) + if (strcmp(s.extensionName, VK_KHR_MAINTENANCE_6_EXTENSION_NAME) == 0) { req_maintenance_6 = true; } diff --git a/src/vulkan_compute_bda_sc.cpp b/src/vulkan_compute_bda_sc.cpp index 3978e6c..34ed976 100644 --- a/src/vulkan_compute_bda_sc.cpp +++ b/src/vulkan_compute_bda_sc.cpp @@ -67,7 +67,7 @@ static void bda_sc_create_pipeline(vulkan_setup_t& vulkan, compute_resources& r, shaderStageCreateInfo.pName = "main"; shaderStageCreateInfo.pSpecializationInfo = &specInfo; - VkDeviceSize markup_location = 5; + VkDeviceSize markup_location = 5 * sizeof(int32_t); // address in bytes VkAddressRemapTRACETOOLTEST mm = { VK_STRUCTURE_TYPE_ADDRESS_REMAP_TRACETOOLTEST, shaderStageCreateInfo.pNext }; mm.target = VK_ADDRESS_REMAP_TARGET_SPECIALIZATION_CONSTANTS_TRACETOOLTEST; mm.count = 1;