diff options
| author | Ayinaki <ayinakidev@gmail.com> | 2026-11-21 21:17:07 +0000 |
|---|---|---|
| committer | Ayinaki <ayinakidev@gmail.com> | 2026-11-21 21:17:07 +0000 |
| commit | f348eb9be0eb087d659803605509aaa241cb1c50 (patch) | |
| tree | f0d17c9f00c2de9972206a48abb597012b0ff6be /runtime/test/vk_harness.cpp | |
| parent | aae4d99e10784eb21b4f14d08470c79613b9e7fe (diff) | |
GPU tests: skip pixel tests without barycentrics and narrow subgroups
Diffstat (limited to 'runtime/test/vk_harness.cpp')
| -rw-r--r-- | runtime/test/vk_harness.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/runtime/test/vk_harness.cpp b/runtime/test/vk_harness.cpp index ac5b66194..43eebac87 100644 --- a/runtime/test/vk_harness.cpp +++ b/runtime/test/vk_harness.cpp | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | #define VK_NO_PROTOTYPES | 6 | #define VK_NO_PROTOTYPES |
| 7 | #include "vulkan_loader.h" | 7 | #include "vulkan_loader.h" |
| 8 | 8 | ||
| 9 | #include <cstddef> | ||
| 9 | #include <cstdio> | 10 | #include <cstdio> |
| 10 | #include <cstdlib> | 11 | #include <cstdlib> |
| 11 | #include <cstring> | 12 | #include <cstring> |
| @@ -86,6 +87,25 @@ int main(int argc, char** argv) { | |||
| 86 | for (auto& x : exts) if (!std::strcmp(x.extensionName, e)) return true; | 87 | for (auto& x : exts) if (!std::strcmp(x.extensionName, e)) return true; |
| 87 | return false; | 88 | return false; |
| 88 | }; | 89 | }; |
| 90 | // A translated pixel shader that reads BaryCoordKHR aborts the driver when the device lacks barycentrics | ||
| 91 | // (llvmpipe and other software devices), so the suite reports it as unsupported instead. 77 is the existing | ||
| 92 | // "this device cannot run the test" code (runtime/test/shaders/check.py, scripts/run_gpu_tests.py). | ||
| 93 | const std::vector<uint32_t> fs_code = read_spv(argv[2]); | ||
| 94 | bool needs_barycentric = false; | ||
| 95 | for (std::size_t i = 5; i + 1 < fs_code.size();) { // instructions follow the 5-word SPIR-V header | ||
| 96 | const uint32_t words = fs_code[i] >> 16, op = fs_code[i] & 0xffffu; | ||
| 97 | if (!words) break; | ||
| 98 | if (op == 17 && fs_code[i + 1] == 5284) { // OpCapability FragmentBarycentricKHR | ||
| 99 | needs_barycentric = true; | ||
| 100 | break; | ||
| 101 | } | ||
| 102 | i += words; | ||
| 103 | } | ||
| 104 | if (needs_barycentric && !has(VK_KHR_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME)) { | ||
| 105 | std::fprintf(stderr, "unsupported: %s reads BaryCoordKHR and the device has no %s\n", | ||
| 106 | argv[2], VK_KHR_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME); | ||
| 107 | return 77; | ||
| 108 | } | ||
| 89 | std::vector<const char*> enable; | 109 | std::vector<const char*> enable; |
| 90 | void* chain = nullptr; | 110 | void* chain = nullptr; |
| 91 | VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR bary{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_FEATURES_KHR}; | 111 | VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR bary{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_FEATURES_KHR}; |