1 #ifndef shader_h 2 #define shader_h 3 #include "opengl_compat.h" 4 #include <stdbool.h> 5 6 typedef struct shader_s { 7 GLuint resolution_uniform; 8 GLuint origin_uniform; 9 GLuint texture_uniform; 10 GLuint previous_texture_uniform; 11 GLuint blending_mode_uniform; 12 13 GLuint position_attribute; 14 GLuint texture; 15 GLuint previous_texture; 16 GLuint program; 17 } shader_t; 18 19 typedef enum { 20 GB_FRAME_BLENDING_MODE_DISABLED, 21 GB_FRAME_BLENDING_MODE_SIMPLE, 22 GB_FRAME_BLENDING_MODE_ACCURATE, 23 GB_FRAME_BLENDING_MODE_ACCURATE_EVEN = GB_FRAME_BLENDING_MODE_ACCURATE, 24 GB_FRAME_BLENDING_MODE_ACCURATE_ODD, 25 } GB_frame_blending_mode_t; 26 27 bool init_shader_with_name(shader_t *shader, const char *name); 28 void render_bitmap_with_shader(shader_t *shader, void *bitmap, void *previous, 29 unsigned source_width, unsigned source_height, 30 unsigned x, unsigned y, unsigned w, unsigned h, 31 GB_frame_blending_mode_t blending_mode); 32 void free_shader(struct shader_s *shader); 33 34 #endif /* shader_h */ 35