Initial PCem OpenGL 3.x renderer port
This commit is contained in:
@@ -188,6 +188,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);
|
||||
|
||||
@@ -58,6 +58,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)
|
||||
|
||||
@@ -90,6 +91,33 @@ extern ini_section_t ini_find_or_create_section(ini_t ini, const char *name);
|
||||
extern void ini_rename_section(ini_section_t section, const char *name);
|
||||
extern void ini_delete_section_if_empty(ini_t ini, ini_section_t section);
|
||||
|
||||
static inline void *wx_config_load(const char *path) { return (void*) ini_read(path); };
|
||||
static inline int wx_config_get_string(void *config, const char *name, char *dst, int size, const char *defVal) {
|
||||
int res = ini_has_entry(ini_find_or_create_section((ini_t)config, ""), name);
|
||||
char* str = ini_get_string((ini_t)config, "", name, (char*)defVal);
|
||||
if (size == 0)
|
||||
return res;
|
||||
strncpy(dst, str, size);
|
||||
return res;
|
||||
}
|
||||
static inline int wx_config_get_int(void *config, const char *name, int *dst, int defVal) {
|
||||
int res = ini_has_entry(ini_find_or_create_section((ini_t)config, ""), name);
|
||||
*dst = ini_get_int((ini_t)config, "", name, defVal);
|
||||
return res;
|
||||
}
|
||||
static inline int wx_config_get_float(void *config, const char *name, float *dst, float defVal) {
|
||||
int res = ini_has_entry(ini_find_or_create_section((ini_t)config, ""), name);
|
||||
*dst = (float)ini_get_double((ini_t)config, "", name, defVal);
|
||||
return res;
|
||||
}
|
||||
static inline int wx_config_get_bool(void *config, const char *name, int *dst, int defVal) {
|
||||
int res = ini_has_entry(ini_find_or_create_section((ini_t)config, ""), name);
|
||||
*dst = !!ini_get_int((ini_t)config, "", name, defVal);
|
||||
return res;
|
||||
}
|
||||
static inline int wx_config_has_entry(void *config, const char *name) { return ini_has_entry(ini_find_or_create_section((ini_t)config, ""), name); }
|
||||
static inline void wx_config_free(void *config) { ini_close(config); };
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -22,6 +22,13 @@
|
||||
#ifndef EMU_KEYBOARD_H
|
||||
#define EMU_KEYBOARD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
# include <atomic>
|
||||
using atomic_uint = std::atomic_uint;
|
||||
#else
|
||||
# include <stdatomic.h>
|
||||
#endif
|
||||
|
||||
enum {
|
||||
DEV_KBD = 0,
|
||||
DEV_AUX = 1
|
||||
@@ -54,16 +61,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;
|
||||
atomic_uint queue_start;
|
||||
atomic_uint queue_end;
|
||||
|
||||
uint16_t flags;
|
||||
|
||||
|
||||
158
src/include/86box/qt-glsl.h
Normal file
158
src/include/86box/qt-glsl.h
Normal 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
|
||||
56
src/include/86box/qt-glslp-parser.h
Normal file
56
src/include/86box/qt-glslp-parser.h
Normal file
@@ -0,0 +1,56 @@
|
||||
#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);
|
||||
|
||||
#endif /* SRC_WX_GLSLP_PARSER_H_ */
|
||||
Reference in New Issue
Block a user