From 17f0db6607534c5bf1ba96153fabd3fdbb399ed9 Mon Sep 17 00:00:00 2001 From: omniscient <17525998+omnisci3nce@users.noreply.github.com> Date: Sun, 23 Jun 2024 01:11:28 +1000 Subject: wip: debug quad shader --- src/renderer/ral.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/renderer/ral.c') 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 -- cgit v1.2.3-70-g09d2