refactor: move invert Y from glslang_input_t to shader_set_options

This commit is contained in:
Kai Angulo 2024-10-27 23:41:51 -07:00
parent da82563c92
commit 8838252618
3 changed files with 5 additions and 4 deletions

View file

@ -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)

View file

@ -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;

View file

@ -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;