2017-12-23 15:29:42 +00:00
|
|
|
#ifndef shader_h
|
|
|
|
#define shader_h
|
2017-12-29 11:06:38 +00:00
|
|
|
#include "opengl_compat.h"
|
2017-12-23 15:29:42 +00:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
typedef struct shader_s {
|
|
|
|
GLuint resolution_uniform;
|
|
|
|
GLuint origin_uniform;
|
|
|
|
GLuint texture_uniform;
|
|
|
|
GLuint previous_texture_uniform;
|
2020-03-26 18:54:18 +00:00
|
|
|
GLuint blending_mode_uniform;
|
2017-12-23 15:29:42 +00:00
|
|
|
|
|
|
|
GLuint position_attribute;
|
|
|
|
GLuint texture;
|
|
|
|
GLuint previous_texture;
|
|
|
|
GLuint program;
|
|
|
|
} shader_t;
|
|
|
|
|
2020-03-26 18:54:18 +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;
|
|
|
|
|
2017-12-23 15:29:42 +00:00
|
|
|
bool init_shader_with_name(shader_t *shader, const char *name);
|
2019-05-18 15:45:31 +00:00
|
|
|
void render_bitmap_with_shader(shader_t *shader, void *bitmap, void *previous,
|
|
|
|
unsigned source_width, unsigned source_height,
|
2020-03-26 18:54:18 +00:00
|
|
|
unsigned x, unsigned y, unsigned w, unsigned h,
|
|
|
|
GB_frame_blending_mode_t blending_mode);
|
2017-12-23 15:29:42 +00:00
|
|
|
void free_shader(struct shader_s *shader);
|
|
|
|
|
|
|
|
#endif /* shader_h */
|