Merge pull request #5320 from Cacodemon345/qt-openglrenderer-pcem

Port OpenGL 3.x renderer from PCem
This commit is contained in:
Miran Grča
2025-03-10 16:29:51 +01:00
committed by GitHub
31 changed files with 3307 additions and 1162 deletions

View File

@@ -126,7 +126,6 @@ extern int video_filter_method; /* (C) video */
extern int video_vsync; /* (C) video */
extern int video_framerate; /* (C) video */
extern int gfxcard[GFXCARD_MAX]; /* (C) graphics/video card */
extern char video_shader[512]; /* (C) video */
extern int bugger_enabled; /* (C) enable ISAbugger */
extern int novell_keycard_enabled; /* (C) enable Novell NetWare 2.x key card emulation. */
extern int postcard_enabled; /* (C) enable POST card */
@@ -188,6 +187,8 @@ extern FILE *stdlog; /* file to log output to */
#endif
extern int config_changed; /* config has changed */
extern __thread int is_cpu_thread; /* Is this the CPU thread? */
/* Function prototypes. */
#ifdef HAVE_STDARG_H
extern void pclog_ex(const char *fmt, va_list ap);

View File

@@ -31,6 +31,7 @@ typedef void *ini_section_t;
extern ini_t ini_new(void);
extern ini_t ini_read(const char *fn);
extern void ini_strip_quotes(ini_t ini);
extern void ini_write(ini_t ini, const char *fn);
extern void ini_dump(ini_t ini);
extern void ini_close(ini_t ini);
@@ -58,6 +59,7 @@ extern void ini_section_set_hex20(ini_section_t section, const char *name, i
extern void ini_section_set_mac(ini_section_t section, const char *name, int val);
extern void ini_section_set_string(ini_section_t section, const char *name, const char *val);
extern void ini_section_set_wstring(ini_section_t section, const char *name, wchar_t *val);
extern int ini_has_entry(ini_section_t self, const char *name);
#define ini_delete_var(ini, head, name) ini_section_delete_var(ini_find_section(ini, head), name)

View File

@@ -54,16 +54,16 @@ typedef struct kbc_at_port_t {
typedef struct atkbc_dev_t {
const char *name; /* name of this device */
uint8_t type;
uint8_t command;
uint8_t last_scan_code;
uint8_t state;
uint8_t resolution;
uint8_t rate;
uint8_t cmd_queue_start;
uint8_t cmd_queue_end;
uint8_t queue_start;
uint8_t queue_end;
uint8_t type;
uint8_t command;
uint8_t last_scan_code;
uint8_t state;
uint8_t resolution;
uint8_t rate;
uint8_t cmd_queue_start;
uint8_t cmd_queue_end;
uint8_t queue_start;
uint8_t queue_end;
uint16_t flags;

158
src/include/86box/qt-glsl.h Normal file
View File

@@ -0,0 +1,158 @@
#ifndef SRC_WX_GLSL_H_
#define SRC_WX_GLSL_H_
#define MAX_PREV 7
#define MAX_SHADERS 20
#define MAX_TEXTURES 20
#define MAX_PARAMETERS 100
#define MAX_USER_SHADERS 20
//#define SDL2_SHADER_DEBUG
struct shader_scale {
int mode[2];
float value[2];
};
struct shader_state {
float input_size[2];
float input_texture_size[2];
float output_texture_size[2];
float output_size[2];
float tex_coords[8];
};
struct shader_vbo {
int vertex_coord;
int tex_coord;
int color;
};
struct shader_texture {
int id;
int width;
int height;
int type;
int internal_format;
int format;
int min_filter;
int mag_filter;
int wrap_mode;
void *data;
int mipmap;
};
struct shader_lut_texture {
char name[50];
struct shader_texture texture;
};
struct shader_fbo {
int id;
struct shader_texture texture;
int srgb;
int mipmap_input;
};
struct shader_prev {
struct shader_fbo fbo;
struct shader_vbo vbo;
};
struct shader_input {
int texture;
int input_size;
int texture_size;
int tex_coord;
};
struct shader_uniforms {
int mvp_matrix;
int vertex_coord;
int tex_coord;
int color;
int texture;
int input_size;
int texture_size;
int output_size;
int frame_count;
int frame_direction;
struct shader_input orig;
struct shader_input pass[MAX_SHADERS];
struct shader_input prev_pass[MAX_SHADERS];
struct shader_input prev[MAX_PREV];
int parameters[MAX_PARAMETERS];
int lut_textures[MAX_TEXTURES];
};
struct shader_program {
int vertex_shader;
int fragment_shader;
int id;
};
struct shader_parameter {
char id[64];
char description[64];
float default_value;
float value;
float min;
float max;
float step;
};
struct shader_pass {
int active;
char alias[64];
int vertex_array;
int frame_count_mod;
struct shader_program program;
struct shader_uniforms uniforms;
struct shader_fbo fbo;
struct shader_vbo vbo;
struct shader_state state;
struct shader_scale scale;
};
struct glsl_shader {
int active;
char name[64];
int num_passes;
struct shader_pass passes[MAX_SHADERS];
int num_lut_textures;
struct shader_lut_texture lut_textures[MAX_TEXTURES];
int num_parameters;
struct shader_parameter parameters[MAX_PARAMETERS];
struct shader_pass prev_scene;
struct shader_prev prev[MAX_PREV + 1];
int last_prev_update;
int has_prev;
float shader_refresh_rate;
int input_filter_linear;
};
typedef struct glsl_t {
int num_shaders;
struct glsl_shader shaders[MAX_USER_SHADERS];
struct shader_pass scene;
struct shader_pass final_pass;
struct shader_pass fs_color;
#ifdef SDL2_SHADER_DEBUG
struct shader_pass debug;
#endif
int srgb;
} glsl_t;
#endif

View File

@@ -0,0 +1,59 @@
#ifndef SRC_WX_GLSLP_PARSER_H_
#define SRC_WX_GLSLP_PARSER_H_
#include "qt-glsl.h"
struct parameter {
char id[64];
char description[64];
float default_value;
float value;
float min;
float max;
float step;
};
struct texture {
char path[256];
char name[50];
int linear;
int mipmap;
char wrap_mode[50];
};
struct shader {
char shader_fn[1024];
char *shader_program;
char alias[64];
int filter_linear;
int float_framebuffer;
int srgb_framebuffer;
int mipmap_input;
int frame_count_mod;
char wrap_mode[50];
char scale_type_x[9], scale_type_y[9];
float scale_x, scale_y;
};
typedef struct glslp_t {
char name[64];
int num_shaders;
struct shader shaders[MAX_SHADERS];
int num_textures;
struct texture textures[MAX_TEXTURES];
int num_parameters;
struct parameter parameters[MAX_PARAMETERS];
int input_filter_linear;
} glslp_t;
void get_glslp_name(const char *f, char *s, int size);
glslp_t *glslp_parse(const char *f);
void glslp_free(glslp_t *p);
void glslp_read_shader_config(glslp_t *shader);
void glslp_write_shader_config(glslp_t *shader);
#endif /* SRC_WX_GLSLP_PARSER_H_ */