From 6ff0246f42737ce6442a6e4ff144d1b599ffe0b6 Mon Sep 17 00:00:00 2001 From: klemek Date: Sat, 16 May 2026 18:40:52 +0200 Subject: [PATCH] fix: GLint uniform location instead of GLuint --- src/shaders.c | 20 ++++++++++---------- src/types.h | 42 +++++++++++++++++++++--------------------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/shaders.c b/src/shaders.c index ea3dc85..97f9db0 100644 --- a/src/shaders.c +++ b/src/shaders.c @@ -24,7 +24,7 @@ #include #endif /* VIDEO_IN */ -static const GLuint unused_uniform = (GLuint)-1; +static const GLint UNUSED_UNIFORM = -1; static bool check_glerror_ro(const char *context) { unsigned int code; @@ -666,27 +666,27 @@ static void update_viewport(ShaderProgram *program, const Context *context) { } } -static void write_uniform_1f(GLuint location, float value) { - if (location != unused_uniform) { +static void write_uniform_1f(GLint location, float value) { + if (location != UNUSED_UNIFORM) { glUniform1f(location, value); } } -static void write_uniform_1i(GLuint location, unsigned int value) { - if (location != unused_uniform) { +static void write_uniform_1i(GLint location, unsigned int value) { + if (location != UNUSED_UNIFORM) { glUniform1i(location, (const GLint)value); } } -static void write_uniform_2f(GLuint location, const vec2 *value) { - if (location != unused_uniform) { +static void write_uniform_2f(GLint location, const vec2 *value) { + if (location != UNUSED_UNIFORM) { glUniform2fv(location, 1, (const GLfloat *)value); } } -static void write_uniform_multi_3f(GLuint location, unsigned int count, +static void write_uniform_multi_3f(GLint location, unsigned int count, const vec3 *value) { - if (location != unused_uniform) { + if (location != UNUSED_UNIFORM) { glUniform3fv(location, count, (const GLfloat *)value); } } @@ -774,7 +774,7 @@ static void use_program(const ShaderProgram *program, int i, bool output, if (program->sub_locations[i * program->sub_variant_count * program->sub_type_count + j * program->sub_variant_count + k] != - unused_uniform) { + UNUSED_UNIFORM) { subroutines[subcount++] = program->sub_locations[i * program->sub_variant_count * program->sub_type_count + diff --git a/src/types.h b/src/types.h index b0fa496..abde4e9 100644 --- a/src/types.h +++ b/src/types.h @@ -100,34 +100,34 @@ typedef struct ShaderProgram { GLuint frame_buffers[ARRAY_SIZE]; GLuint fragment_shaders[ARRAY_SIZE]; - GLuint itime_locations[ARRAY_SIZE]; - GLuint itempo_locations[ARRAY_SIZE]; - GLuint ibeats_locations[ARRAY_SIZE]; - GLuint ifps_locations[ARRAY_SIZE]; - GLuint ires_locations[ARRAY_SIZE]; - GLuint itexres_locations[ARRAY_SIZE]; - GLuint iinres_locations[ARRAY_SIZE]; - GLuint iinfmt_locations[ARRAY_SIZE]; - GLuint iinfps_locations[ARRAY_SIZE]; - GLuint idemo_locations[ARRAY_SIZE]; - GLuint iautorand_locations[ARRAY_SIZE]; - GLuint iautorandcycle_locations[ARRAY_SIZE]; - GLuint iseed_locations[ARRAY_SIZE]; - GLuint istate_locations[ARRAY_SIZE]; - GLuint ipage_locations[ARRAY_SIZE]; - GLuint iselected_locations[ARRAY_SIZE]; - GLuint iactive_locations[ARRAY_SIZE]; + GLint itime_locations[ARRAY_SIZE]; + GLint itempo_locations[ARRAY_SIZE]; + GLint ibeats_locations[ARRAY_SIZE]; + GLint ifps_locations[ARRAY_SIZE]; + GLint ires_locations[ARRAY_SIZE]; + GLint itexres_locations[ARRAY_SIZE]; + GLint iinres_locations[ARRAY_SIZE]; + GLint iinfmt_locations[ARRAY_SIZE]; + GLint iinfps_locations[ARRAY_SIZE]; + GLint idemo_locations[ARRAY_SIZE]; + GLint iautorand_locations[ARRAY_SIZE]; + GLint iautorandcycle_locations[ARRAY_SIZE]; + GLint iseed_locations[ARRAY_SIZE]; + GLint istate_locations[ARRAY_SIZE]; + GLint ipage_locations[ARRAY_SIZE]; + GLint iselected_locations[ARRAY_SIZE]; + GLint iactive_locations[ARRAY_SIZE]; UintArray midi_lengths; - GLuint igroup_locations[ARRAY_SIZE]; + GLint igroup_locations[ARRAY_SIZE]; - GLuint vpos_locations[ARRAY_SIZE]; + GLint vpos_locations[ARRAY_SIZE]; - GLuint textures_locations[ARRAY_SIZE]; + GLint textures_locations[ARRAY_SIZE]; unsigned int sub_type_count; unsigned int sub_variant_count; - GLuint sub_locations[ARRAY_SIZE]; + GLint sub_locations[ARRAY_SIZE]; unsigned int active_count;