From 107684b00d65eac84e4bf2dfd34073d309230d50 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Thu, 16 May 2024 18:55:58 +0200 Subject: move shader compilation from runtime to compile-time --- blob | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 blob (limited to 'blob') diff --git a/blob b/blob new file mode 100755 index 0000000..6baae9c --- /dev/null +++ b/blob @@ -0,0 +1,25 @@ +#!/bin/sh +input="$1" +base="$2" +symbol_base="$(echo "$base" | tr '[:punct:]' '_')" + +# assembly (used to compile data with custom symbol name) +cat << EOF > "$base.s" +.section .rodata +.global ${symbol_base}_head +${symbol_base}_head: +.incbin "$input" +EOF + +# C header +cat << EOF > "$base.h" +#pragma once +// NOTE: THIS FILE IS GENERATED, DO NOT EDIT +#include + +extern const char ${symbol_base}_head; +const char* ${symbol_base} = &${symbol_base}_head; +const size_t ${symbol_base}_size = $(wc -c < "$input"); + +EOF + -- cgit v1.2.3