mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-20 10:56:58 +02:00
Add GPU tilers/tests
This commit is contained in:
@@ -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}")
|
||||
Reference in New Issue
Block a user