From 1edc1fa8de6c9be5148cf4c13d7d584331ba06dd Mon Sep 17 00:00:00 2001 From: Andrei Alexeyev Date: Wed, 5 Aug 2020 05:07:55 +0300 Subject: [PATCH] Remove dead code --- src/resource/shader_object.c | 76 ------------------------------------ 1 file changed, 76 deletions(-) diff --git a/src/resource/shader_object.c b/src/resource/shader_object.c index a9ad9d2c..6a9de158 100644 --- a/src/resource/shader_object.c +++ b/src/resource/shader_object.c @@ -62,82 +62,6 @@ static bool check_shader_object_path(const char *path) { static void load_shader_object_stage1(ResourceLoadState *st); static void load_shader_object_stage2(ResourceLoadState *st); -#if 0 -static bool load_shader_source( - const char *path, - ShaderSource *out, - const struct shobj_type *type, - ShaderLangInfo *transpile_target -) { - char backend_macro[32] = "BACKEND_"; - { - const char *backend_name = r_backend_name(); - char *out = backend_macro + sizeof("BACKEND_") - 1; - for(const char *in = backend_name; *in;) { - *out++ = toupper(*in++); - } - *out = 0; - } - - char macro_buf[32]; - char *macro_buf_p = macro_buf; - - switch(type->lang) { - case SHLANG_GLSL: { - ShaderMacro macros[16]; - int i = 0; - - #define ADD_MACRO(...) \ - (assert(i < ARRAY_SIZE(macros)), macros[i++] = (GLSLMacro) { __VA_ARGS__ }) - - #define ADD_MACRO_DYNAMIC(name, ...) do { \ - attr_unused int remaining = macro_buf_p - macro_buf; \ - int len = snprintf(macro_buf_p, remaining, __VA_ARGS__); \ - assert(len >= 0); \ - ADD_MACRO(name, macro_buf_p); \ - macro_buf_p += len + 1; \ - assert(macro_buf_p < macro_buf + ARRAY_SIZE(macro_buf)); \ - } while(0) - - #define ADD_MACRO_BOOL(name, value) \ - ADD_MACRO(name, (value) ? "1" : "0") - - ADD_MACRO_BOOL(backend_macro, true); - - if(transpile_target) { - ADD_MACRO_DYNAMIC("LANG_GLSL", "%d", SHLANG_GLSL); - ADD_MACRO_DYNAMIC("LANG_SPIRV", "%d", SHLANG_SPIRV); - ADD_MACRO_DYNAMIC("TRANSPILE_TARGET", "%d", transpile_target->lang); - - switch(transpile_target->lang) { - case SHLANG_GLSL: - ADD_MACRO_DYNAMIC("TRANSPILE_TARGET_GLSL_VERSION", "%d", transpile_target->glsl.version.version); - ADD_MACRO_BOOL("TRANSPILE_TARGET_GLSL_ES", transpile_target->glsl.version.profile == GLSL_PROFILE_ES); - break; - - case SHLANG_SPIRV: - break; - - default: UNREACHABLE; - } - } - - ADD_MACRO(NULL); - - GLSLSourceOptions opts = { - .version = { 330, GLSL_PROFILE_CORE }, - .stage = type->stage, - .macros = macros, - }; - - return glsl_load_source(path, out, &opts); - } - - default: UNREACHABLE; - } -} -#endif - static void load_shader_object_stage1(ResourceLoadState *st) { struct shobj_type *type = get_shobj_type(st->path);