upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/test/vk_harness.cpp
diff options
context:
space:
mode:
authorYaBulochka <yabulochka@users.noreply.github.com>2026-11-23 22:51:30 +0300
committerYaBulochka <157796093+YaBulochka@users.noreply.github.com>2026-11-24 00:35:10 +0300
commit3e648aa10f6f7dedd5e00de2f3c4759edcb579ce (patch)
tree05a89712389a0fbea20ecb724f48294edc2e4159 /runtime/test/vk_harness.cpp
parent5d74c272363f2703265d44e6aaab1a1df8ddfaf3 (diff)
vk_harness: build without VK_KHR_pipeline_binary headers, exit 77 with the flag
The VKH_BINARY_OUT/VKH_BINARY_IN path needs VK_KHR_pipeline_binary, which is newer than some Vulkan header sets: Ubuntu 24.04 ships 1.3.275 and CMake's find_package(Vulkan) picks those up when VULKAN_SDK is not set, so the whole target failed to compile with "VkPhysicalDevicePipelineBinaryFeaturesKHR was not declared in this scope" and seven follow-on errors. Guard the feature on the two extension macros the code already needs. With old headers a VKH_BINARY_OUT/VKH_BINARY_IN run now prints "unsupported: these Vulkan headers have no VK_KHR_pipeline_binary" and exits 77, the skip code the harness uses elsewhere, and everything else in the harness is unchanged.
Diffstat (limited to 'runtime/test/vk_harness.cpp')
-rw-r--r--runtime/test/vk_harness.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/runtime/test/vk_harness.cpp b/runtime/test/vk_harness.cpp
index 23d58bc70..cd374e8b6 100644
--- a/runtime/test/vk_harness.cpp
+++ b/runtime/test/vk_harness.cpp
@@ -38,6 +38,14 @@
38#include "../src/gfx10_descriptors.h" 38#include "../src/gfx10_descriptors.h"
39#include "spirv_capability.h" 39#include "spirv_capability.h"
40 40
41// VK_KHR_pipeline_binary is newer than some Vulkan header sets (CI images, an older SDK). Guard the feature so the
42// harness still builds there; VKH_BINARY_OUT/VKH_BINARY_IN then report unsupported and exit 77.
43#if defined(VK_KHR_pipeline_binary) && defined(VK_KHR_maintenance5)
44#define VKH_PIPELINE_BINARY 1
45#else
46#define VKH_PIPELINE_BINARY 0
47#endif
48
41#include <cctype> 49#include <cctype>
42#include <cstddef> 50#include <cstddef>
43#include <cstdio> 51#include <cstdio>
@@ -453,9 +461,15 @@ int main(int argc, char** argv) {
453 // size, the data. 461 // size, the data.
454 const char* bin_out = std::getenv("VKH_BINARY_OUT"); 462 const char* bin_out = std::getenv("VKH_BINARY_OUT");
455 const char* bin_in = std::getenv("VKH_BINARY_IN"); 463 const char* bin_in = std::getenv("VKH_BINARY_IN");
464#if VKH_PIPELINE_BINARY
456 VkPhysicalDevicePipelineBinaryFeaturesKHR pbf{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_BINARY_FEATURES_KHR}; 465 VkPhysicalDevicePipelineBinaryFeaturesKHR pbf{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_BINARY_FEATURES_KHR};
457 VkPhysicalDeviceMaintenance5FeaturesKHR m5{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_FEATURES_KHR}; 466 VkPhysicalDeviceMaintenance5FeaturesKHR m5{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_FEATURES_KHR};
467#endif
458 if (bin_out || bin_in) { 468 if (bin_out || bin_in) {
469#if !VKH_PIPELINE_BINARY
470 std::fprintf(stderr, "unsupported: these Vulkan headers have no VK_KHR_pipeline_binary\n");
471 return 77;
472#else
459 VkPhysicalDeviceFeatures2 q{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2}; 473 VkPhysicalDeviceFeatures2 q{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2};
460 VkPhysicalDevicePipelineBinaryFeaturesKHR pbq{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_BINARY_FEATURES_KHR}; 474 VkPhysicalDevicePipelineBinaryFeaturesKHR pbq{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_BINARY_FEATURES_KHR};
461 q.pNext = &pbq; 475 q.pNext = &pbq;
@@ -469,6 +483,7 @@ int main(int argc, char** argv) {
469 enable.push_back(VK_KHR_MAINTENANCE_5_EXTENSION_NAME); 483 enable.push_back(VK_KHR_MAINTENANCE_5_EXTENSION_NAME);
470 pbf.pipelineBinaries = VK_TRUE; pbf.pNext = chain; chain = &pbf; 484 pbf.pipelineBinaries = VK_TRUE; pbf.pNext = chain; chain = &pbf;
471 m5.maintenance5 = VK_TRUE; m5.pNext = chain; chain = &m5; 485 m5.maintenance5 = VK_TRUE; m5.pNext = chain; chain = &m5;
486#endif
472 } 487 }
473 for (auto e : enable) std::fprintf(stderr, "enabled %s\n", e); 488 for (auto e : enable) std::fprintf(stderr, "enabled %s\n", e);
474 VkDeviceCreateInfo dci{VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO}; 489 VkDeviceCreateInfo dci{VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO};
@@ -749,6 +764,7 @@ int main(int argc, char** argv) {
749 gpi.pDepthStencilState = &ds_state; 764 gpi.pDepthStencilState = &ds_state;
750 } 765 }
751 gpi.layout = pl; gpi.renderPass = rp; 766 gpi.layout = pl; gpi.renderPass = rp;
767#if VKH_PIPELINE_BINARY
752 VkPipelineCreateFlags2CreateInfoKHR capture{VK_STRUCTURE_TYPE_PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR}; 768 VkPipelineCreateFlags2CreateInfoKHR capture{VK_STRUCTURE_TYPE_PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR};
753 std::vector<VkPipelineBinaryKHR> in_bins; 769 std::vector<VkPipelineBinaryKHR> in_bins;
754 VkPipelineBinaryInfoKHR bin_info{VK_STRUCTURE_TYPE_PIPELINE_BINARY_INFO_KHR}; 770 VkPipelineBinaryInfoKHR bin_info{VK_STRUCTURE_TYPE_PIPELINE_BINARY_INFO_KHR};
@@ -787,7 +803,9 @@ int main(int argc, char** argv) {
787 gpi.pNext = &bin_info; 803 gpi.pNext = &bin_info;
788 std::fprintf(stderr, "pipeline from %u binaries in %s\n", count, bin_in); 804 std::fprintf(stderr, "pipeline from %u binaries in %s\n", count, bin_in);
789 } 805 }
806#endif
790 VkPipeline pipe; CHECK(vkCreateGraphicsPipelines(dev, VK_NULL_HANDLE, 1, &gpi, nullptr, &pipe)); 807 VkPipeline pipe; CHECK(vkCreateGraphicsPipelines(dev, VK_NULL_HANDLE, 1, &gpi, nullptr, &pipe));
808#if VKH_PIPELINE_BINARY
791 if (bin_out) { 809 if (bin_out) {
792 auto vkCreatePipelineBinariesKHR = reinterpret_cast<PFN_vkCreatePipelineBinariesKHR>( 810 auto vkCreatePipelineBinariesKHR = reinterpret_cast<PFN_vkCreatePipelineBinariesKHR>(
793 vkGetDeviceProcAddr(dev, "vkCreatePipelineBinariesKHR")); 811 vkGetDeviceProcAddr(dev, "vkCreatePipelineBinariesKHR"));
@@ -824,6 +842,7 @@ int main(int argc, char** argv) {
824 } 842 }
825 std::fprintf(stderr, "wrote %u pipeline binaries to %s\n", count, bin_out); 843 std::fprintf(stderr, "wrote %u pipeline binaries to %s\n", count, bin_out);
826 } 844 }
845#endif
827 VkPipeline cpipe = VK_NULL_HANDLE; 846 VkPipeline cpipe = VK_NULL_HANDLE;
828 if (mesh_compute) { 847 if (mesh_compute) {
829 VkComputePipelineCreateInfo cpi{VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO}; 848 VkComputePipelineCreateInfo cpi{VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO};