2018-11-16 00:42:29 +01:00
|
|
|
/*****************************************************************************\
|
|
|
|
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
|
|
|
This file is licensed under the Snes9x License.
|
|
|
|
For further information, consult the LICENSE file in the root directory.
|
|
|
|
\*****************************************************************************/
|
|
|
|
|
2010-09-25 17:46:12 +02:00
|
|
|
#ifndef __GTK_DISPLAY_DRIVER_OPENGL_H
|
|
|
|
#define __GTK_DISPLAY_DRIVER_OPENGL_H
|
|
|
|
|
|
|
|
#include "gtk_s9x.h"
|
|
|
|
#include "gtk_display_driver.h"
|
|
|
|
|
2018-05-09 00:52:40 +02:00
|
|
|
#include <epoxy/gl.h>
|
2018-10-27 01:22:51 +02:00
|
|
|
|
|
|
|
#include "gtk_opengl_context.h"
|
2018-11-07 01:04:10 +01:00
|
|
|
|
2020-07-05 00:53:38 +02:00
|
|
|
#include "gtk_compat.h"
|
2018-10-15 21:04:28 +02:00
|
|
|
#ifdef GDK_WINDOWING_X11
|
2018-10-27 01:22:51 +02:00
|
|
|
#include "gtk_glx_context.h"
|
2018-10-15 21:04:28 +02:00
|
|
|
#endif
|
2018-10-22 00:05:37 +02:00
|
|
|
#ifdef GDK_WINDOWING_WAYLAND
|
2018-10-26 22:49:56 +02:00
|
|
|
#include "gtk_wayland_egl_context.h"
|
2018-10-22 00:05:37 +02:00
|
|
|
#endif
|
|
|
|
|
2018-05-11 01:47:55 +02:00
|
|
|
#include "shaders/glsl.h"
|
2018-05-08 23:56:18 +02:00
|
|
|
|
2020-07-01 00:28:10 +02:00
|
|
|
#define BUFFER_OFFSET(i) ((char *)(i))
|
2010-09-25 17:46:12 +02:00
|
|
|
|
|
|
|
class S9xOpenGLDisplayDriver : public S9xDisplayDriver
|
|
|
|
{
|
2020-07-01 00:28:10 +02:00
|
|
|
public:
|
|
|
|
S9xOpenGLDisplayDriver(Snes9xWindow *window, Snes9xConfig *config);
|
|
|
|
void refresh(int width, int height);
|
|
|
|
int init();
|
|
|
|
void deinit();
|
|
|
|
void update(uint16_t *buffer, int width, int height, int stride_in_pixels);
|
|
|
|
void *get_parameters();
|
|
|
|
void save(const char *filename);
|
|
|
|
static int query_availability();
|
|
|
|
bool is_ready();
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool opengl_defaults();
|
|
|
|
void swap_buffers();
|
|
|
|
bool load_shaders(const char *);
|
|
|
|
void update_texture_size(int width, int height);
|
|
|
|
bool create_context();
|
|
|
|
void resize();
|
|
|
|
|
|
|
|
GLuint stock_program;
|
|
|
|
GLuint coord_buffer;
|
|
|
|
GLint texture_width;
|
|
|
|
GLint texture_height;
|
|
|
|
GLuint texmap;
|
|
|
|
GLuint pbo;
|
|
|
|
|
|
|
|
bool legacy;
|
|
|
|
bool core;
|
|
|
|
int version;
|
|
|
|
bool npot;
|
|
|
|
bool using_pbos;
|
|
|
|
bool initialized;
|
|
|
|
|
|
|
|
bool using_glsl_shaders;
|
|
|
|
GLSLShader *glsl_shader;
|
|
|
|
|
|
|
|
GdkWindow *gdk_window;
|
|
|
|
int output_window_width;
|
|
|
|
int output_window_height;
|
|
|
|
|
|
|
|
OpenGLContext *context;
|
2018-10-27 01:22:51 +02:00
|
|
|
|
2018-10-15 21:04:28 +02:00
|
|
|
#ifdef GDK_WINDOWING_X11
|
2020-07-01 00:28:10 +02:00
|
|
|
GTKGLXContext glx;
|
2018-10-15 21:04:28 +02:00
|
|
|
#endif
|
2018-10-22 00:05:37 +02:00
|
|
|
#ifdef GDK_WINDOWING_WAYLAND
|
2020-07-01 00:28:10 +02:00
|
|
|
WaylandEGLContext wl;
|
2018-10-22 00:05:37 +02:00
|
|
|
#endif
|
2010-09-25 17:46:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __GTK_DISPLAY_DRIVER_OPENGL_H */
|