Add GPU tilers/tests

This commit is contained in:
nmzik
2026-07-20 07:03:07 +02:00
parent 728b5b7d01
commit b51d4322cc
31 changed files with 3071 additions and 3360 deletions
+30
View File
@@ -0,0 +1,30 @@
if(NOT DEFINED INPUT OR NOT DEFINED OUTPUT OR NOT DEFINED SYMBOL)
message(FATAL_ERROR "embed_spirv.cmake requires INPUT, OUTPUT, and SYMBOL")
endif()
file(READ "${INPUT}" bytes HEX)
string(LENGTH "${bytes}" length)
math(EXPR remainder "${length} % 8")
if(NOT remainder EQUAL 0)
message(FATAL_ERROR "SPIR-V byte count is not a multiple of four: ${INPUT}")
endif()
set(contents "#pragma once\n#include <cstdint>\ninline constexpr uint32_t ${SYMBOL}[] = {\n")
set(column 0)
while(length GREATER 0)
string(SUBSTRING "${bytes}" 0 8 word)
string(SUBSTRING "${word}" 0 2 b0)
string(SUBSTRING "${word}" 2 2 b1)
string(SUBSTRING "${word}" 4 2 b2)
string(SUBSTRING "${word}" 6 2 b3)
string(APPEND contents "0x${b3}${b2}${b1}${b0}u,")
math(EXPR column "${column} + 1")
if(column EQUAL 8)
string(APPEND contents "\n")
set(column 0)
endif()
string(SUBSTRING "${bytes}" 8 -1 bytes)
math(EXPR length "${length} - 8")
endwhile()
string(APPEND contents "\n};\n")
file(WRITE "${OUTPUT}" "${contents}")