upleb.uk

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

summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorTreXito <81475944+TreXito@users.noreply.github.com>2026-11-23 21:45:01 +0000
committerTreXito <81475944+TreXito@users.noreply.github.com>2026-11-23 21:45:01 +0000
commitf1d006bdbda200bb599d7652d828bb03fbf54d5a (patch)
treea013defefc537a6767c5b05a04faeb1a829f1302 /runtime
parentd030b991282748d5bbbd11a20eae6c6ea65ef36d (diff)
parentfc7d1f514d9d73c7366336c1e7adbdf5c689dfa0 (diff)
Merge #4025 (test/877b-shader-programs-validation)
Diffstat (limited to 'runtime')
-rw-r--r--runtime/test/vk_harness.cpp11
-rw-r--r--runtime/test/vk_sampler_test.cpp11
-rw-r--r--runtime/test/vk_store_test.cpp11
-rw-r--r--runtime/test/vk_texture_test.cpp11
4 files changed, 40 insertions, 4 deletions
diff --git a/runtime/test/vk_harness.cpp b/runtime/test/vk_harness.cpp
index 23d58bc70..d20c9d2c1 100644
--- a/runtime/test/vk_harness.cpp
+++ b/runtime/test/vk_harness.cpp
@@ -30,10 +30,12 @@
30// dwords, default 0x92,0xc00000,0x14500000,0) at sampler index 1. 30// dwords, default 0x92,0xc00000,0x14500000,0) at sampler index 1.
31// 31//
32#define VK_NO_PROTOTYPES 32#define VK_NO_PROTOTYPES
33// LEONIDA_VK_VALIDATION=1 (env): a validation error from VK_LAYER_KHRONOS_validation fails the run (vk_validation.h).
33#include "vulkan_loader.h" 34#include "vulkan_loader.h"
34#include "vk_device_pick.h" 35#include "vk_device_pick.h"
35#include "vk_shader_fma.h" 36#include "vk_shader_fma.h"
36#include "vk_pc_tail.h" 37#include "vk_pc_tail.h"
38#include "vk_validation.h"
37#include "../src/descriptor_table.h" 39#include "../src/descriptor_table.h"
38#include "../src/gfx10_descriptors.h" 40#include "../src/gfx10_descriptors.h"
39#include "spirv_capability.h" 41#include "spirv_capability.h"
@@ -137,7 +139,7 @@ static bool read_mesh(const char* path, uint32_t stride, std::vector<uint8_t>& v
137 return bool(f); 139 return bool(f);
138} 140}
139 141
140int main(int argc, char** argv) { 142static int run(int argc, char** argv) {
141 if (argc < 4) { 143 if (argc < 4) {
142 std::fprintf(stderr, "usage: vk_harness vs.spv fs.spv out.raw [w h [clip-test-s0 clip-test-s1]]\n" 144 std::fprintf(stderr, "usage: vk_harness vs.spv fs.spv out.raw [w h [clip-test-s0 clip-test-s1]]\n"
143 " vk_harness ms.spv fs.spv out.raw --mesh-group-readback X Y Z\n"); 145 " vk_harness ms.spv fs.spv out.raw --mesh-group-readback X Y Z\n");
@@ -250,7 +252,10 @@ int main(int argc, char** argv) {
250 app.apiVersion = VK_API_VERSION_1_3; 252 app.apiVersion = VK_API_VERSION_1_3;
251 VkInstanceCreateInfo ici{VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO}; 253 VkInstanceCreateInfo ici{VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO};
252 ici.pApplicationInfo = &app; 254 ici.pApplicationInfo = &app;
255 leonida::vk_test::OptInValidation validation; // LEONIDA_VK_VALIDATION
256 if (!validation.prepare(gipa, ici)) return 1;
253 CHECK(vkCreateInstance(&ici, nullptr, &inst)); 257 CHECK(vkCreateInstance(&ici, nullptr, &inst));
258 CHECK(validation.attach(gipa, inst));
254 LOADI(vkEnumeratePhysicalDevices); LOADI(vkGetPhysicalDeviceProperties); 259 LOADI(vkEnumeratePhysicalDevices); LOADI(vkGetPhysicalDeviceProperties);
255 LOADI(vkGetPhysicalDeviceProperties2); LOADI(vkGetPhysicalDeviceFeatures2); 260 LOADI(vkGetPhysicalDeviceProperties2); LOADI(vkGetPhysicalDeviceFeatures2);
256 LOADI(vkGetPhysicalDeviceQueueFamilyProperties); LOADI(vkGetPhysicalDeviceMemoryProperties); 261 LOADI(vkGetPhysicalDeviceQueueFamilyProperties); LOADI(vkGetPhysicalDeviceMemoryProperties);
@@ -1183,3 +1188,7 @@ int main(int argc, char** argv) {
1183 std::fprintf(stderr, "ok %ux%u -> %s\n", W, H, argv[3]); 1188 std::fprintf(stderr, "ok %ux%u -> %s\n", W, H, argv[3]);
1184 return 0; 1189 return 0;
1185} 1190}
1191
1192int main(int argc, char** argv) {
1193 return leonida::vk_test::OptInValidation::exit_status(run(argc, argv));
1194}
diff --git a/runtime/test/vk_sampler_test.cpp b/runtime/test/vk_sampler_test.cpp
index 98206931b..4a6f989b1 100644
--- a/runtime/test/vk_sampler_test.cpp
+++ b/runtime/test/vk_sampler_test.cpp
@@ -11,11 +11,13 @@
11// (LOD 1) and image_sample_lz asks for LOD 0. The 64x64 RGBA32F result is written to <out.raw>; check.py judges it. 11// (LOD 1) and image_sample_lz asks for LOD 0. The 64x64 RGBA32F result is written to <out.raw>; check.py judges it.
12// Exit 77 with "unsupported: ..." when the device lacks a feature the shader or sampler needs. 12// Exit 77 with "unsupported: ..." when the device lacks a feature the shader or sampler needs.
13#define VK_NO_PROTOTYPES 13#define VK_NO_PROTOTYPES
14// LEONIDA_VK_VALIDATION=1 (env): a validation error from VK_LAYER_KHRONOS_validation fails the run (vk_validation.h).
14#include "vulkan_loader.h" 15#include "vulkan_loader.h"
15#include "vk_shader_fma.h" 16#include "vk_shader_fma.h"
16#include "../src/vulkan_device_filter.h" 17#include "../src/vulkan_device_filter.h"
17#include "vk_pc_tail.h" 18#include "vk_pc_tail.h"
18#include "vk_shader_fma.h" 19#include "vk_shader_fma.h"
20#include "vk_validation.h"
19 21
20#include "../src/descriptor_table.h" 22#include "../src/descriptor_table.h"
21#include "../src/gfx10_descriptors.h" 23#include "../src/gfx10_descriptors.h"
@@ -51,7 +53,7 @@ std::vector<std::uint32_t> read_spv(const char* path) {
51 53
52} // namespace 54} // namespace
53 55
54int main(int argc, char** argv) { 56static int run(int argc, char** argv) {
55 if (argc != 8 && argc != 10) { 57 if (argc != 8 && argc != 10) {
56 std::fprintf(stderr, "usage: vk_sampler_test <vs.spv> <fs.spv> <out.raw> <s0> <s1> <s2> <s3> [<base> <last>]\n"); 58 std::fprintf(stderr, "usage: vk_sampler_test <vs.spv> <fs.spv> <out.raw> <s0> <s1> <s2> <s3> [<base> <last>]\n");
57 return 2; 59 return 2;
@@ -88,7 +90,10 @@ int main(int argc, char** argv) {
88 app.apiVersion = VK_API_VERSION_1_2; 90 app.apiVersion = VK_API_VERSION_1_2;
89 VkInstanceCreateInfo ici{VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO}; 91 VkInstanceCreateInfo ici{VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO};
90 ici.pApplicationInfo = &app; 92 ici.pApplicationInfo = &app;
93 leonida::vk_test::OptInValidation validation; // LEONIDA_VK_VALIDATION
94 if (!validation.prepare(gipa, ici)) return 1;
91 CHECK(vkCreateInstance(&ici, nullptr, &inst)); 95 CHECK(vkCreateInstance(&ici, nullptr, &inst));
96 CHECK(validation.attach(gipa, inst));
92 LI(vkEnumeratePhysicalDevices); LI(vkGetPhysicalDeviceProperties); LI(vkGetPhysicalDeviceQueueFamilyProperties); 97 LI(vkEnumeratePhysicalDevices); LI(vkGetPhysicalDeviceProperties); LI(vkGetPhysicalDeviceQueueFamilyProperties);
93 LI(vkGetPhysicalDeviceMemoryProperties); LI(vkGetPhysicalDeviceFeatures2); LI(vkCreateDevice); LI(vkGetDeviceProcAddr); 98 LI(vkGetPhysicalDeviceMemoryProperties); LI(vkGetPhysicalDeviceFeatures2); LI(vkCreateDevice); LI(vkGetDeviceProcAddr);
94 std::uint32_t n = 0; 99 std::uint32_t n = 0;
@@ -549,3 +554,7 @@ int main(int argc, char** argv) {
549 std::printf("ok -> %s\n", argv[3]); 554 std::printf("ok -> %s\n", argv[3]);
550 return 0; 555 return 0;
551} 556}
557
558int main(int argc, char** argv) {
559 return leonida::vk_test::OptInValidation::exit_status(run(argc, argv));
560}
diff --git a/runtime/test/vk_store_test.cpp b/runtime/test/vk_store_test.cpp
index 5567511d0..1235a16dd 100644
--- a/runtime/test/vk_store_test.cpp
+++ b/runtime/test/vk_store_test.cpp
@@ -16,10 +16,12 @@
16// at binding 7, where 2D and 3D image atomics address their image, and at index 4 of the sampled array a 16x4 rgba8 16// at binding 7, where 2D and 3D image atomics address their image, and at index 4 of the sampled array a 16x4 rgba8
17// image with all five mip levels (never read, only queried), behind the T# the runtime writes for such an image. 17// image with all five mip levels (never read, only queried), behind the T# the runtime writes for such an image.
18// "signed-zero" checks three direct float stores and all remaining RGBA32 guard words (SHADER-605). 18// "signed-zero" checks three direct float stores and all remaining RGBA32 guard words (SHADER-605).
19// LEONIDA_VK_VALIDATION=1 (env): a validation error from VK_LAYER_KHRONOS_validation fails the run (vk_validation.h).
19#include "vulkan_loader.h" 20#include "vulkan_loader.h"
20#include "vk_device_pick.h" 21#include "vk_device_pick.h"
21#include "vk_shader_fma.h" 22#include "vk_shader_fma.h"
22#include "vk_pc_tail.h" 23#include "vk_pc_tail.h"
24#include "vk_validation.h"
23#include "spirv_capability.h" 25#include "spirv_capability.h"
24#include "../src/gfx10_descriptors.h" 26#include "../src/gfx10_descriptors.h"
25 27
@@ -59,7 +61,7 @@ static void table_insert(std::vector<uint32_t>& t, const uint32_t key[8], uint32
59 } 61 }
60} 62}
61 63
62int main(int argc, char** argv) { 64static int run(int argc, char** argv) {
63 if (argc < 2) { std::fprintf(stderr, "usage: vk_store_test cs.spv [load|load-d16|words|signed-zero]\n"); return 2; } 65 if (argc < 2) { std::fprintf(stderr, "usage: vk_store_test cs.spv [load|load-d16|words|signed-zero]\n"); return 2; }
64 gipa = load_vulkan(); 66 gipa = load_vulkan();
65 if (!gipa) return 1; 67 if (!gipa) return 1;
@@ -70,7 +72,10 @@ int main(int argc, char** argv) {
70 app.apiVersion = VK_API_VERSION_1_2; 72 app.apiVersion = VK_API_VERSION_1_2;
71 VkInstanceCreateInfo ici{VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO}; 73 VkInstanceCreateInfo ici{VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO};
72 ici.pApplicationInfo = &app; 74 ici.pApplicationInfo = &app;
75 leonida::vk_test::OptInValidation validation; // LEONIDA_VK_VALIDATION
76 if (!validation.prepare(gipa, ici)) return 1;
73 CHECK(vkCreateInstance(&ici, nullptr, &inst)); 77 CHECK(vkCreateInstance(&ici, nullptr, &inst));
78 CHECK(validation.attach(gipa, inst));
74 LOADI(vkEnumeratePhysicalDevices); LOADI(vkGetPhysicalDeviceProperties); LOADI(vkCreateDevice); 79 LOADI(vkEnumeratePhysicalDevices); LOADI(vkGetPhysicalDeviceProperties); LOADI(vkCreateDevice);
75 LOADI(vkGetPhysicalDeviceQueueFamilyProperties); LOADI(vkGetDeviceProcAddr); 80 LOADI(vkGetPhysicalDeviceQueueFamilyProperties); LOADI(vkGetDeviceProcAddr);
76 LOADI(vkGetPhysicalDeviceMemoryProperties); LOADI(vkGetPhysicalDeviceFeatures); 81 LOADI(vkGetPhysicalDeviceMemoryProperties); LOADI(vkGetPhysicalDeviceFeatures);
@@ -560,3 +565,7 @@ int main(int argc, char** argv) {
560 std::printf("r32 sint (sint view): %u bad, texel(5,3) = %d\n", bad[2], static_cast<const int32_t*>(rbp[2])[3 * W + 5]); 565 std::printf("r32 sint (sint view): %u bad, texel(5,3) = %d\n", bad[2], static_cast<const int32_t*>(rbp[2])[3 * W + 5]);
561 return (bad[0] || bad[1] || bad[2]) ? 1 : 0; 566 return (bad[0] || bad[1] || bad[2]) ? 1 : 0;
562} 567}
568
569int main(int argc, char** argv) {
570 return leonida::vk_test::OptInValidation::exit_status(run(argc, argv));
571}
diff --git a/runtime/test/vk_texture_test.cpp b/runtime/test/vk_texture_test.cpp
index 3dafcaef6..6cec98364 100644
--- a/runtime/test/vk_texture_test.cpp
+++ b/runtime/test/vk_texture_test.cpp
@@ -22,10 +22,12 @@
22// clamp of image_sample_d_cl) are enabled when the device has them. A fragment shader that declares the MinLod 22// clamp of image_sample_d_cl) are enabled when the device has them. A fragment shader that declares the MinLod
23// capability on a device without shaderResourceMinLod prints "unsupported: ..." and exits 77. 23// capability on a device without shaderResourceMinLod prints "unsupported: ..." and exits 77.
24#define VK_NO_PROTOTYPES 24#define VK_NO_PROTOTYPES
25// LEONIDA_VK_VALIDATION=1 (env): a validation error from VK_LAYER_KHRONOS_validation fails the run (vk_validation.h).
25#include "vulkan_loader.h" 26#include "vulkan_loader.h"
26#include "vk_device_pick.h" 27#include "vk_device_pick.h"
27#include "vk_shader_fma.h" 28#include "vk_shader_fma.h"
28#include "vk_pc_tail.h" 29#include "vk_pc_tail.h"
30#include "vk_validation.h"
29#include "spirv_capability.h" 31#include "spirv_capability.h"
30 32
31#include <algorithm> 33#include <algorithm>
@@ -82,7 +84,7 @@ static int cube_alpha_self_test() {
82 return 0; 84 return 0;
83} 85}
84 86
85int main(int argc, char** argv) { 87static int run(int argc, char** argv) {
86 if (argc == 2 && std::strcmp(argv[1], "--self-test-cube-alpha") == 0) 88 if (argc == 2 && std::strcmp(argv[1], "--self-test-cube-alpha") == 0)
87 return cube_alpha_self_test(); 89 return cube_alpha_self_test();
88 const uint32_t W = 64, H = 64, TW = 8; 90 const uint32_t W = 64, H = 64, TW = 8;
@@ -162,12 +164,15 @@ int main(int argc, char** argv) {
162 LI(vkCreateInstance); 164 LI(vkCreateInstance);
163 VkApplicationInfo app{VK_STRUCTURE_TYPE_APPLICATION_INFO}; app.apiVersion = VK_API_VERSION_1_2; 165 VkApplicationInfo app{VK_STRUCTURE_TYPE_APPLICATION_INFO}; app.apiVersion = VK_API_VERSION_1_2;
164 VkInstanceCreateInfo ici{VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO}; ici.pApplicationInfo = &app; 166 VkInstanceCreateInfo ici{VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO}; ici.pApplicationInfo = &app;
167 leonida::vk_test::OptInValidation validation; // LEONIDA_VK_VALIDATION
168 if (!validation.prepare(gipa, ici)) return 1;
165 const VkResult instance_result = vkCreateInstance(&ici, nullptr, &inst); 169 const VkResult instance_result = vkCreateInstance(&ici, nullptr, &inst);
166 if (instance_result == VK_ERROR_INCOMPATIBLE_DRIVER) return 77; // no ICD, as on a GPU-less runner 170 if (instance_result == VK_ERROR_INCOMPATIBLE_DRIVER) return 77; // no ICD, as on a GPU-less runner
167 if (instance_result != VK_SUCCESS) { 171 if (instance_result != VK_SUCCESS) {
168 std::fprintf(stderr, "FAILED vkCreateInstance -> %d (line %d)\n", instance_result, __LINE__); 172 std::fprintf(stderr, "FAILED vkCreateInstance -> %d (line %d)\n", instance_result, __LINE__);
169 return 1; 173 return 1;
170 } 174 }
175 CHECK(validation.attach(gipa, inst));
171 LI(vkEnumeratePhysicalDevices); LI(vkGetPhysicalDeviceProperties); LI(vkGetPhysicalDeviceQueueFamilyProperties); 176 LI(vkEnumeratePhysicalDevices); LI(vkGetPhysicalDeviceProperties); LI(vkGetPhysicalDeviceQueueFamilyProperties);
172 LI(vkGetPhysicalDeviceMemoryProperties); LI(vkCreateDevice); LI(vkGetDeviceProcAddr); 177 LI(vkGetPhysicalDeviceMemoryProperties); LI(vkCreateDevice); LI(vkGetDeviceProcAddr);
173 uint32_t n = 0; 178 uint32_t n = 0;
@@ -674,3 +679,7 @@ int main(int argc, char** argv) {
674 } 679 }
675 return 0; 680 return 0;
676} 681}
682
683int main(int argc, char** argv) {
684 return leonida::vk_test::OptInValidation::exit_status(run(argc, argv));
685}