From 883825261816a12a61f49978ba1a2632d33d1743 Mon Sep 17 00:00:00 2001 From: Kai Angulo Date: Sun, 27 Oct 2024 23:41:51 -0700 Subject: [PATCH] refactor: move invert Y from glslang_input_t to shader_set_options --- glslang/CInterface/glslang_c_interface.cpp | 7 ++++--- glslang/Include/glslang_c_interface.h | 1 - glslang/Include/glslang_c_shader_types.h | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/glslang/CInterface/glslang_c_interface.cpp b/glslang/CInterface/glslang_c_interface.cpp index d4e3dff3..2576ded9 100644 --- a/glslang/CInterface/glslang_c_interface.cpp +++ b/glslang/CInterface/glslang_c_interface.cpp @@ -360,9 +360,6 @@ GLSLANG_EXPORT glslang_shader_t* glslang_shader_create(const glslang_input_t* in shader->shader->setSourceEntryPoint(input->source_entrypoint); } - if (input->invert_y) - shader->shader->setInvertY(true); - return shader; } @@ -395,6 +392,10 @@ GLSLANG_EXPORT void glslang_shader_set_options(glslang_shader_t* shader, int opt if (options & GLSLANG_SHADER_VULKAN_RULES_RELAXED) { shader->shader->setEnvInputVulkanRulesRelaxed(); } + + if (options & GLSLANG_SHADER_INVERT_Y) { + shader->shader->setInvertY(true); + } } GLSLANG_EXPORT void glslang_shader_set_glsl_version(glslang_shader_t* shader, int version) diff --git a/glslang/Include/glslang_c_interface.h b/glslang/Include/glslang_c_interface.h index 10cebab5..c24964b3 100644 --- a/glslang/Include/glslang_c_interface.h +++ b/glslang/Include/glslang_c_interface.h @@ -219,7 +219,6 @@ typedef struct glslang_input_s { const char* code; const char* entrypoint; // This is what actually gets called by the GPU. Best to leave it at 'main' or something so opengl doesn't trip over itself. const char* source_entrypoint; // This just renames the source entrypoint in the code to 'entrypoint' and should be what is used to set different entrypoint names. - int invert_y; int hlsl_functionality_1; int default_version; glslang_profile_t default_profile; diff --git a/glslang/Include/glslang_c_shader_types.h b/glslang/Include/glslang_c_shader_types.h index 768e2e84..bccab765 100644 --- a/glslang/Include/glslang_c_shader_types.h +++ b/glslang/Include/glslang_c_shader_types.h @@ -211,6 +211,7 @@ typedef enum { GLSLANG_SHADER_AUTO_MAP_BINDINGS = (1 << 0), GLSLANG_SHADER_AUTO_MAP_LOCATIONS = (1 << 1), GLSLANG_SHADER_VULKAN_RULES_RELAXED = (1 << 2), + GLSLANG_SHADER_INVERT_Y = (1 << 3), LAST_ELEMENT_MARKER(GLSLANG_SHADER_COUNT), } glslang_shader_options_t;