upleb.uk

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

summaryrefslogtreecommitdiff
path: root/runtime/test/vk_texture_test.cpp
diff options
context:
space:
mode:
authorDiesel <dev.diesel@proton.me>2026-11-21 22:44:07 +0100
committerDiesel <dev.diesel@proton.me>2026-11-21 22:44:07 +0100
commit5c1a1fbb6bf6f609eb4e61baa4961ce382743a4e (patch)
treeac8ad90058b97ab241fdc65edae3d4628d20ee1e /runtime/test/vk_texture_test.cpp
parentc45309e29f21c1d5b75678db0e2dc2dd11cff25b (diff)
parent4e390e0871d7265e629b51aca8ff99a15a6a6845 (diff)
Merge main to include the compute Y/Z harness test fix
Diffstat (limited to 'runtime/test/vk_texture_test.cpp')
-rw-r--r--runtime/test/vk_texture_test.cpp27
1 files changed, 5 insertions, 22 deletions
diff --git a/runtime/test/vk_texture_test.cpp b/runtime/test/vk_texture_test.cpp
index a46338bf6..fafc8ef50 100644
--- a/runtime/test/vk_texture_test.cpp
+++ b/runtime/test/vk_texture_test.cpp
@@ -34,23 +34,7 @@ static std::vector<uint32_t> read_spv(const char* p) {
34 return w; 34 return w;
35} 35}
36 36
37// Same hash as the translator's desc_lookup: FNV-1a over the 8 key dwords (whole dwords, not bytes). 37#include "../src/descriptor_table.h"
38static uint32_t key_hash(const uint32_t k[8]) {
39 uint32_t h = 2166136261u;
40 for (int i = 0; i < 8; i++) h = (h ^ k[i]) * 16777619u;
41 return h;
42}
43static void table_insert(std::vector<uint32_t>& t, const uint32_t key[8], uint32_t index) {
44 uint32_t mask = t[0], h = key_hash(key);
45 for (uint32_t k = 0; k < 8; k++) {
46 uint32_t slot = (h + k) & mask, base = slot * 10;
47 if (t[base + 10] == 0xA11CA7ED) continue; // pad dword marks a used slot (host-side only)
48 for (int j = 0; j < 8; j++) t[base + 1 + j] = key[j];
49 t[base + 9] = index;
50 t[base + 10] = 0xA11CA7ED;
51 return;
52 }
53}
54 38
55int main(int argc, char** argv) { 39int main(int argc, char** argv) {
56 if (argc < 9) { std::fprintf(stderr, "usage: vk_texture_test vs fs out ptr_sgpr s0 s1 s2 s3\n"); return 2; } 40 if (argc < 9) { std::fprintf(stderr, "usage: vk_texture_test vs fs out ptr_sgpr s0 s1 s2 s3\n"); return 2; }
@@ -133,11 +117,10 @@ int main(int argc, char** argv) {
133 VkBufferDeviceAddressInfo bdai{VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO}; bdai.buffer = heap; 117 VkBufferDeviceAddressInfo bdai{VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO}; bdai.buffer = heap;
134 VkDeviceAddress heap_base = vkGetBufferDeviceAddress(dev, &bdai); 118 VkDeviceAddress heap_base = vkGetBufferDeviceAddress(dev, &bdai);
135 // Descriptor hash table: 16 slots. 119 // Descriptor hash table: 16 slots.
136 std::vector<uint32_t> table(1 + 16 * 10 + 10, 0); 120 leonida::DescriptorTable desc_table(16);
137 table[0] = 15; 121 desc_table.insert(tsharp, 1);
138 table_insert(table, tsharp, 1); 122 desc_table.insert(ssharp, 1);
139 table_insert(table, ssharp, 1); 123 const auto table = desc_table.build_gpu_buffer(true);
140 for (uint32_t s = 0; s <= 16; s++) if (s * 10 + 10 < table.size() && table[s * 10 + 10] == 0xA11CA7ED) table[s * 10 + 10] = 0;
141 VkBuffer tb; VkDeviceMemory tbm; void* tbp; 124 VkBuffer tb; VkDeviceMemory tbm; void* tbp;
142 CHECK(make_buffer(table.size() * 4, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, &tb, &tbm, &tbp)); 125 CHECK(make_buffer(table.size() * 4, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, &tb, &tbm, &tbp));
143 std::memcpy(tbp, table.data(), table.size() * 4); 126 std::memcpy(tbp, table.data(), table.size() * 4);