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:
authorTreXito <81475944+TreXito@users.noreply.github.com>2026-11-22 22:58:15 +0000
committerTreXito <81475944+TreXito@users.noreply.github.com>2026-11-23 11:53:17 +0000
commit279898ee6ce736d77e03ca81eeeacde31f4f4f9f (patch)
tree9adc7ff30543f6af671d6fd0e3cc1a0628780db3 /runtime/test/vk_harness.cpp
parent561b65a832218fbb9e6d2effd392a8eef093a3f8 (diff)
vk_harness, vk_store_test, vk_texture_test, vk_sampler_test: opt-in validation with LEONIDA_VK_VALIDATION
The four programs that run every pixel, store, texture and sampler case of scripts/run_gpu_tests.py built their instance without layers and ignored LEONIDA_VK_VALIDATION, and a validation message never changed their exit code, so a validation run of the suite could not fail on them. Each now takes the instance setup from runtime/test/vk_validation.h, like vk_compute_test (TEST-877): the layer, VK_EXT_debug_utils and a messenger when the variable is set, and main ends through OptInValidation::exit_status, so a counted validation error exits 1 with "N validation errors". Without the variable nothing changes. docs/testing.md now lists every shader test program as reading the variable, and drops the by-hand VK_INSTANCE_LAYERS recipe that only covered them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/test/vk_harness.cpp')
-rw-r--r--runtime/test/vk_harness.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/runtime/test/vk_harness.cpp b/runtime/test/vk_harness.cpp
index fc1f352b8..53a39b2e0 100644
--- a/runtime/test/vk_harness.cpp
+++ b/runtime/test/vk_harness.cpp
@@ -29,10 +29,12 @@
29// dwords, default 0x92,0xc00000,0x14500000,0) at sampler index 1. 29// dwords, default 0x92,0xc00000,0x14500000,0) at sampler index 1.
30// 30//
31#define VK_NO_PROTOTYPES 31#define VK_NO_PROTOTYPES
32// LEONIDA_VK_VALIDATION=1 (env): a validation error from VK_LAYER_KHRONOS_validation fails the run (vk_validation.h).
32#include "vulkan_loader.h" 33#include "vulkan_loader.h"
33#include "vk_device_pick.h" 34#include "vk_device_pick.h"
34#include "vk_shader_fma.h" 35#include "vk_shader_fma.h"
35#include "vk_pc_tail.h" 36#include "vk_pc_tail.h"
37#include "vk_validation.h"
36#include "../src/descriptor_table.h" 38#include "../src/descriptor_table.h"
37#include "../src/gfx10_descriptors.h" 39#include "../src/gfx10_descriptors.h"
38 40
@@ -135,7 +137,7 @@ static bool read_mesh(const char* path, uint32_t stride, std::vector<uint8_t>& v
135 return bool(f); 137 return bool(f);
136} 138}
137 139
138int main(int argc, char** argv) { 140static int run(int argc, char** argv) {
139 if (argc < 4) { 141 if (argc < 4) {
140 std::fprintf(stderr, "usage: vk_harness vs.spv fs.spv out.raw [w h [clip-test-s0 clip-test-s1]]\n" 142 std::fprintf(stderr, "usage: vk_harness vs.spv fs.spv out.raw [w h [clip-test-s0 clip-test-s1]]\n"
141 " vk_harness ms.spv fs.spv out.raw --mesh-group-readback X Y Z\n"); 143 " vk_harness ms.spv fs.spv out.raw --mesh-group-readback X Y Z\n");
@@ -248,7 +250,10 @@ int main(int argc, char** argv) {
248 app.apiVersion = VK_API_VERSION_1_3; 250 app.apiVersion = VK_API_VERSION_1_3;
249 VkInstanceCreateInfo ici{VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO}; 251 VkInstanceCreateInfo ici{VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO};
250 ici.pApplicationInfo = &app; 252 ici.pApplicationInfo = &app;
253 leonida::vk_test::OptInValidation validation; // LEONIDA_VK_VALIDATION
254 if (!validation.prepare(gipa, ici)) return 1;
251 CHECK(vkCreateInstance(&ici, nullptr, &inst)); 255 CHECK(vkCreateInstance(&ici, nullptr, &inst));
256 CHECK(validation.attach(gipa, inst));
252 LOADI(vkEnumeratePhysicalDevices); LOADI(vkGetPhysicalDeviceProperties); 257 LOADI(vkEnumeratePhysicalDevices); LOADI(vkGetPhysicalDeviceProperties);
253 LOADI(vkGetPhysicalDeviceProperties2); LOADI(vkGetPhysicalDeviceFeatures2); 258 LOADI(vkGetPhysicalDeviceProperties2); LOADI(vkGetPhysicalDeviceFeatures2);
254 LOADI(vkGetPhysicalDeviceQueueFamilyProperties); LOADI(vkGetPhysicalDeviceMemoryProperties); 259 LOADI(vkGetPhysicalDeviceQueueFamilyProperties); LOADI(vkGetPhysicalDeviceMemoryProperties);
@@ -1133,3 +1138,7 @@ int main(int argc, char** argv) {
1133 std::fprintf(stderr, "ok %ux%u -> %s\n", W, H, argv[3]); 1138 std::fprintf(stderr, "ok %ux%u -> %s\n", W, H, argv[3]);
1134 return 0; 1139 return 0;
1135} 1140}
1141
1142int main(int argc, char** argv) {
1143 return leonida::vk_test::OptInValidation::exit_status(run(argc, argv));
1144}