2010-09-25 15:46:12 +00:00
|
|
|
#ifndef __GTK_DISPLAY_DRIVER_OPENGL_H
|
|
|
|
#define __GTK_DISPLAY_DRIVER_OPENGL_H
|
|
|
|
|
|
|
|
#include "gtk_s9x.h"
|
|
|
|
#include "gtk_display_driver.h"
|
|
|
|
|
2018-05-08 22:52:40 +00:00
|
|
|
#include <epoxy/gl.h>
|
2018-10-26 23:22:51 +00:00
|
|
|
|
|
|
|
#include "gtk_opengl_context.h"
|
2018-10-15 19:04:28 +00:00
|
|
|
#ifdef GDK_WINDOWING_X11
|
2018-10-26 23:22:51 +00:00
|
|
|
#include "gtk_glx_context.h"
|
2018-10-15 19:04:28 +00:00
|
|
|
#endif
|
2018-10-21 22:05:37 +00:00
|
|
|
#ifdef GDK_WINDOWING_WAYLAND
|
2018-10-26 20:49:56 +00:00
|
|
|
#include "gtk_wayland_egl_context.h"
|
2018-10-21 22:05:37 +00:00
|
|
|
#endif
|
|
|
|
|
2018-05-10 23:47:55 +00:00
|
|
|
#include "shaders/glsl.h"
|
2018-05-08 21:56:18 +00:00
|
|
|
|
2010-09-25 15:46:12 +00:00
|
|
|
#define BUFFER_OFFSET(i) ((char *) NULL + (i))
|
|
|
|
|
|
|
|
class S9xOpenGLDisplayDriver : public S9xDisplayDriver
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
S9xOpenGLDisplayDriver (Snes9xWindow *window, Snes9xConfig *config);
|
|
|
|
void refresh (int width, int height);
|
2018-10-26 23:22:51 +00:00
|
|
|
int init ();
|
|
|
|
void deinit ();
|
|
|
|
void clear_buffers ();
|
2018-05-04 22:12:22 +00:00
|
|
|
void update (int width, int height, int yoffset);
|
2018-10-26 23:22:51 +00:00
|
|
|
uint16 *get_next_buffer ();
|
|
|
|
uint16 *get_current_buffer ();
|
2010-09-25 15:46:12 +00:00
|
|
|
void push_buffer (uint16 *src);
|
2018-10-26 23:22:51 +00:00
|
|
|
void *get_parameters ();
|
2018-05-13 16:02:52 +00:00
|
|
|
void save (const char *filename);
|
2018-10-26 23:22:51 +00:00
|
|
|
static int query_availability ();
|
2010-09-25 15:46:12 +00:00
|
|
|
|
|
|
|
private:
|
2018-10-26 23:22:51 +00:00
|
|
|
int opengl_defaults ();
|
|
|
|
void swap_buffers ();
|
2010-10-22 02:18:56 +00:00
|
|
|
int load_shaders (const char *);
|
2010-09-25 15:46:12 +00:00
|
|
|
void update_texture_size (int width, int height);
|
2018-10-26 23:22:51 +00:00
|
|
|
int init_gl ();
|
|
|
|
void resize ();
|
2010-09-26 09:19:15 +00:00
|
|
|
|
|
|
|
GLint texture_width;
|
|
|
|
GLint texture_height;
|
|
|
|
GLfloat vertices[8];
|
|
|
|
GLfloat texcoords[8];
|
|
|
|
GLuint texmap;
|
|
|
|
GLuint pbo;
|
|
|
|
GLuint program;
|
|
|
|
GLuint fragment_shader;
|
|
|
|
GLuint vertex_shader;
|
2010-09-25 15:46:12 +00:00
|
|
|
|
2018-10-27 20:56:22 +00:00
|
|
|
bool npot;
|
|
|
|
bool using_pbos;
|
|
|
|
bool using_shaders;
|
|
|
|
bool initialized;
|
2010-09-25 15:46:12 +00:00
|
|
|
|
2018-05-10 23:47:55 +00:00
|
|
|
int using_glsl_shaders;
|
|
|
|
GLSLShader *glsl_shader;
|
|
|
|
|
2018-10-15 19:04:28 +00:00
|
|
|
GdkWindow *gdk_window;
|
|
|
|
int output_window_width;
|
|
|
|
int output_window_height;
|
|
|
|
|
2018-10-26 23:22:51 +00:00
|
|
|
OpenGLContext *context;
|
|
|
|
|
2018-10-15 19:04:28 +00:00
|
|
|
#ifdef GDK_WINDOWING_X11
|
2018-10-26 23:22:51 +00:00
|
|
|
GTKGLXContext glx;
|
2018-10-15 19:04:28 +00:00
|
|
|
#endif
|
2018-10-21 22:05:37 +00:00
|
|
|
#ifdef GDK_WINDOWING_WAYLAND
|
2018-10-26 23:22:51 +00:00
|
|
|
WaylandEGLContext wl;
|
2018-10-21 22:05:37 +00:00
|
|
|
#endif
|
2010-09-25 15:46:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __GTK_DISPLAY_DRIVER_OPENGL_H */
|