refactor: not overlaping keyboard and midi
Clang Lint CI / lint-no-video (push) Successful in 1m0s
Clang Build CI / run-no-video (push) Successful in 1m0s
Clang Build CI / run-video (push) Successful in 1m1s
Clang Build CI / build-release (push) Successful in 1m56s
Clang Lint CI / lint-video (push) Successful in 1m59s

This commit is contained in:
2026-05-14 22:27:39 +02:00
parent 28b87d316a
commit 6abf050bcc
16 changed files with 499 additions and 420 deletions
+11 -9
View File
@@ -565,23 +565,24 @@ static bool init_single_program(ShaderProgram *program, unsigned int i,
if (program->midi_lengths.length == 0) {
index1 = 0;
for (unsigned int j = 0; j < state_config->midi_active_counts.length; j++) {
for (unsigned int k = 0; k < state_config->midi_active_counts.values[j];
for (unsigned int j = 0; j < state_config->group_active_counts.length;
j++) {
for (unsigned int k = 0; k < state_config->group_active_counts.values[j];
k++) {
program->midi_lengths.values[index1++] =
state_config->midi_counts.values[j];
state_config->group_counts.values[j];
}
}
program->midi_lengths.length = index1;
}
prefix = config_file_get_str(config, "UNIFORM_MIDI_PREFIX", "iMidi");
prefix = config_file_get_str(config, "UNIFORM_GROUP_PREFIX", "iGroup");
index2 = 0;
for (unsigned int j = 0; j < state_config->midi_active_counts.length; j++) {
for (unsigned int k = 0; k < state_config->midi_active_counts.values[j];
for (unsigned int j = 0; j < state_config->group_active_counts.length; j++) {
for (unsigned int k = 0; k < state_config->group_active_counts.values[j];
k++) {
snprintf(name, STR_LEN, "%s%d_%d", prefix, j + 1, k + 1);
program->imidi_locations[i * program->midi_lengths.length + index2++] =
program->igroup_locations[i * program->midi_lengths.length + index2++] =
glGetUniformLocation(program->programs[i], name);
}
}
@@ -755,7 +756,7 @@ static void use_program(const ShaderProgram *program, int i, bool output,
offset = 0;
for (unsigned int j = 0; j < program->midi_lengths.length; j++) {
write_uniform_multi_3f(
program->imidi_locations[i * program->midi_lengths.length + j],
program->igroup_locations[i * program->midi_lengths.length + j],
program->midi_lengths.values[j], context->values + offset);
offset += program->midi_lengths.values[j];
}
@@ -780,6 +781,7 @@ static void use_program(const ShaderProgram *program, int i, bool output,
}
// set GL_TEXTURE(X) to uniform sampler2D texX
// TODO perform input swap here
for (unsigned int j = 0; j < program->tex_count; j++) {
write_uniform_1i(program->textures_locations[i * program->tex_count + j],
j);
@@ -805,7 +807,7 @@ void shaders_init(ShaderProgram *program, const Project *project,
config_file_get_int(&project->config, "SUB_TYPE_COUNT", 0);
program->in_count = config_file_get_int(&project->config, "IN_COUNT", 0);
program->sub_variant_count = project->state_config.state_max;
program->active_count = project->state_config.midi_active_counts.length;
program->active_count = project->state_config.group_active_counts.length;
program->midi_lengths.length = 0;
#ifdef VIDEO_IN