refactor(types): rename isrc -> imidi

This commit is contained in:
2025-11-01 18:32:22 +01:00
parent a44f701e45
commit e7a5877b04
2 changed files with 11 additions and 17 deletions
+9 -9
View File
@@ -326,15 +326,15 @@ static void init_single_program(ShaderProgram *program, unsigned int i,
glGetUniformLocation(program->programs[i], name); glGetUniformLocation(program->programs[i], name);
} }
if (program->src_lengths.length == 0) { if (program->midi_lengths.length == 0) {
index1 = 0; index1 = 0;
for (j = 0; j < state_config.src_active_counts.length; j++) { for (j = 0; j < state_config.src_active_counts.length; j++) {
for (k = 0; k < state_config.src_active_counts.values[j]; k++) { for (k = 0; k < state_config.src_active_counts.values[j]; k++) {
program->src_lengths.values[index1++] = program->midi_lengths.values[index1++] =
state_config.src_counts.values[j]; state_config.src_counts.values[j];
} }
} }
program->src_lengths.length = index1; program->midi_lengths.length = index1;
} }
prefix = config_file_get_str(config, "UNIFORM_MIDI_PREFIX", "iMidi"); prefix = config_file_get_str(config, "UNIFORM_MIDI_PREFIX", "iMidi");
@@ -342,7 +342,7 @@ static void init_single_program(ShaderProgram *program, unsigned int i,
for (j = 0; j < state_config.src_active_counts.length; j++) { for (j = 0; j < state_config.src_active_counts.length; j++) {
for (k = 0; k < state_config.src_active_counts.values[j]; k++) { for (k = 0; k < state_config.src_active_counts.values[j]; k++) {
sprintf(name, "%s%d_%d", prefix, j + 1, k + 1); sprintf(name, "%s%d_%d", prefix, j + 1, k + 1);
program->isrc_locations[i * program->src_lengths.length + index2++] = program->imidi_locations[i * program->midi_lengths.length + index2++] =
glGetUniformLocation(program->programs[i], name); glGetUniformLocation(program->programs[i], name);
} }
} }
@@ -390,7 +390,7 @@ ShaderProgram shaders_init(FileArray fragment_shaders, ConfigFile config,
program.in_count = config_file_get_int(config, "IN_COUNT", 0); program.in_count = config_file_get_int(config, "IN_COUNT", 0);
program.sub_variant_count = state_config.state_max; program.sub_variant_count = state_config.state_max;
program.active_count = state_config.src_active_counts.length; program.active_count = state_config.src_active_counts.length;
program.src_lengths.length = 0; program.midi_lengths.length = 0;
if (program.frag_count > MAX_FRAG) { if (program.frag_count > MAX_FRAG) {
log_error("FRAG_COUNT over %d", MAX_FRAG); log_error("FRAG_COUNT over %d", MAX_FRAG);
@@ -551,11 +551,11 @@ static void use_program(ShaderProgram program, int i, bool output,
} }
offset = 0; offset = 0;
for (j = 0; j < program.src_lengths.length; j++) { for (j = 0; j < program.midi_lengths.length; j++) {
write_uniform_multi_3f( write_uniform_multi_3f(
program.isrc_locations[i * program.src_lengths.length + j], program.imidi_locations[i * program.midi_lengths.length + j],
program.src_lengths.values[j], context->values + offset); program.midi_lengths.values[j], context->values + offset);
offset += program.src_lengths.values[j]; offset += program.midi_lengths.values[j];
} }
// set subroutines for fragment and update state uniforms // set subroutines for fragment and update state uniforms
+2 -8
View File
@@ -68,21 +68,17 @@ typedef struct ShaderProgram {
GLuint vertex_array[2]; GLuint vertex_array[2];
unsigned int tex_count; unsigned int tex_count;
// TODO use arrays
GLuint textures[ARRAY_SIZE]; GLuint textures[ARRAY_SIZE];
unsigned int frag_count; unsigned int frag_count;
unsigned int frag_output_index; unsigned int frag_output_index;
unsigned int frag_monitor_index; unsigned int frag_monitor_index;
// TODO use array
GLuint programs[ARRAY_SIZE]; GLuint programs[ARRAY_SIZE];
// TODO use array
GLuint frame_buffers[ARRAY_SIZE]; GLuint frame_buffers[ARRAY_SIZE];
GLuint fragment_shaders[ARRAY_SIZE]; GLuint fragment_shaders[ARRAY_SIZE];
// TODO use array
GLuint itime_locations[ARRAY_SIZE]; GLuint itime_locations[ARRAY_SIZE];
GLuint itempo_locations[ARRAY_SIZE]; GLuint itempo_locations[ARRAY_SIZE];
GLuint ifps_locations[ARRAY_SIZE]; GLuint ifps_locations[ARRAY_SIZE];
@@ -98,13 +94,11 @@ typedef struct ShaderProgram {
GLuint iselected_locations[ARRAY_SIZE]; GLuint iselected_locations[ARRAY_SIZE];
GLuint iactive_locations[ARRAY_SIZE]; GLuint iactive_locations[ARRAY_SIZE];
// TODO rename inputs_xxx UintArray midi_lengths;
UintArray src_lengths; GLuint imidi_locations[ARRAY_SIZE];
GLuint isrc_locations[ARRAY_SIZE];
GLuint vpos_locations[ARRAY_SIZE]; GLuint vpos_locations[ARRAY_SIZE];
// TODO use array
GLuint textures_locations[ARRAY_SIZE]; GLuint textures_locations[ARRAY_SIZE];
unsigned int sub_type_count; unsigned int sub_type_count;