summaryrefslogtreecommitdiff
path: root/src/renderer/ral.c
diff options
context:
space:
mode:
authoromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-06-23 01:11:28 +1000
committeromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-06-23 01:11:28 +1000
commit17f0db6607534c5bf1ba96153fabd3fdbb399ed9 (patch)
treec6531c6c688e9719817ac4c06127affc1313f5d3 /src/renderer/ral.c
parentd20356fd426ccea1866fbda798864a378303bbbd (diff)
wip: debug quad shader
Diffstat (limited to 'src/renderer/ral.c')
-rw-r--r--src/renderer/ral.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/renderer/ral.c b/src/renderer/ral.c
index e73843b..a52d605 100644
--- a/src/renderer/ral.c
+++ b/src/renderer/ral.c
@@ -1,4 +1,8 @@
#include "ral.h"
+#include "file.h"
+#include "log.h"
+#include "str.h"
+#include "mem.h"
#if defined(CEL_REND_BACKEND_VULKAN)
#include "backend_vulkan.h"
@@ -75,3 +79,19 @@ void print_shader_binding(shader_binding b) {
printf("Binding name: %s type %s vis %d stores data %d\n", b.label,
shader_binding_type_name[b.type], b.vis, b.stores_data);
}
+
+shader_desc shader_quick_load(const char* filepath) {
+ arena a = arena_create(malloc(1024 * 1024), 1024 * 1024);
+ str8 path = str8_cstr_view(filepath);
+ str8_opt shader = str8_from_file(&a, path);
+ if (!shader.has_value) {
+ ERROR_EXIT("Failed to load shaders from disk");
+ }
+
+ return (shader_desc) {
+ .debug_name = filepath,
+ .code = shader.contents,
+ .filepath = path,
+ .is_spirv = true,
+ };
+} \ No newline at end of file