SameBoy/gtk3/shader.h

39 lines
1.1 KiB
C
Raw Permalink Normal View History

#ifndef shader_h
#define shader_h
#include <epoxy/gl.h>
#include <stdbool.h>
2019-10-01 17:56:53 +00:00
#include <string.h>
#include <glib.h>
#include <gio/gio.h>
typedef struct shader_s {
GLuint resolution_uniform;
GLuint origin_uniform;
GLuint texture_uniform;
GLuint previous_texture_uniform;
2020-04-10 02:07:01 +00:00
GLuint blending_mode_uniform;
GLuint position_attribute;
GLuint texture;
GLuint previous_texture;
GLuint program;
} shader_t;
2020-04-10 02:07:01 +00:00
typedef enum {
GB_FRAME_BLENDING_MODE_DISABLED,
GB_FRAME_BLENDING_MODE_SIMPLE,
GB_FRAME_BLENDING_MODE_ACCURATE,
GB_FRAME_BLENDING_MODE_ACCURATE_EVEN = GB_FRAME_BLENDING_MODE_ACCURATE,
GB_FRAME_BLENDING_MODE_ACCURATE_ODD,
} GB_frame_blending_mode_t;
bool init_shader_with_name(shader_t *shader, const char *name);
void render_bitmap_with_shader(shader_t *shader, void *bitmap, void *previous,
unsigned source_width, unsigned source_height,
2020-04-10 02:07:01 +00:00
unsigned x, unsigned y, unsigned w, unsigned h,
GB_frame_blending_mode_t blending_mode);
void free_shader(struct shader_s *shader);
void free_master_shader(void);
#endif /* shader_h */