fix shared context with fixed-size memory units

This commit is contained in:
2025-09-28 16:33:50 +02:00
parent 6eaba98fff
commit 32eb037710
4 changed files with 24 additions and 8 deletions
+5
View File
@@ -122,6 +122,11 @@ Parameters args_parse(int argc, char **argv) {
invalid_value(arg, value);
}
} else if (is_arg(arg, "-v") || is_arg(arg, "--video-in")) {
if (params.video_in_count == MAX_VIDEO) {
log_error("maximum video input reached");
exit(EXIT_FAILURE);
}
params.video_in[params.video_in_count++] = value;
} else if (is_arg(arg, "-vs") || is_arg(arg, "--video-size")) {
params.video_size = parse_uint(arg, value);
+5 -1
View File
@@ -10,7 +10,11 @@
#endif /* VERSION */
#ifndef MAX_VIDEO
#define MAX_VIDEO 256
#define MAX_VIDEO 16
#endif
#ifndef MAX_FRAG
#define MAX_FRAG 64
#endif
#endif /* CONFIG_H */
+8 -1
View File
@@ -4,6 +4,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "config.h"
#include "config_file.h"
#include "constants.h"
#include "shaders.h"
@@ -377,7 +378,7 @@ ShaderProgram shaders_init(File *fragment_shaders, ConfigFile config,
program.last_width = context->width;
program.last_height = context->height;
program.tex_count = config_file_get_int(config, "TEX_COUNT", 9);
program.frag_count = config_file_get_int(config, "FRAG_COUNT", 6);
program.frag_count = config_file_get_int(config, "FRAG_COUNT", 10);
program.frag_output_index =
config_file_get_int(config, "FRAG_OUTPUT", 1) - 1;
program.frag_monitor_index =
@@ -387,6 +388,12 @@ ShaderProgram shaders_init(File *fragment_shaders, ConfigFile config,
config_file_get_int(config, "SUB_VARIANT_COUNT", 0);
program.in_count = config_file_get_int(config, "IN_COUNT", 0);
if (program.frag_count > MAX_FRAG) {
log_error("FRAG_COUNT over %d", MAX_FRAG);
program.error = true;
return program;
}
init_gl(&program);
init_shaders(&program, fragment_shaders);
+6 -6
View File
@@ -125,14 +125,14 @@ typedef struct SharedContext {
double time;
unsigned int fps;
float tempo;
unsigned int sub_state[256]; // TODO
unsigned int sub_state[MAX_FRAG * MAX_FRAG];
bool demo;
unsigned int seeds[256];
unsigned int seeds[MAX_FRAG];
bool monitor;
unsigned int input_widths[256];
unsigned int input_heights[256];
unsigned int input_formats[256];
unsigned int input_fps[256];
unsigned int input_widths[MAX_VIDEO];
unsigned int input_heights[MAX_VIDEO];
unsigned int input_formats[MAX_VIDEO];
unsigned int input_fps[MAX_VIDEO];
bool stop;
} SharedContext;