mirror of
https://github.com/libretro/RetroArch
synced 2025-01-18 13:23:40 +00:00
Add fbo structures, ready to implement. :v
This commit is contained in:
parent
01cf24f15f
commit
ef19ea7a85
33
gfx/gl.c
33
gfx/gl.c
@ -31,14 +31,7 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glext.h>
|
||||
#else
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glext.h>
|
||||
#endif
|
||||
#include "gl_common.h"
|
||||
|
||||
#define NO_SDL_GLEXT
|
||||
#include "SDL.h"
|
||||
@ -53,7 +46,6 @@
|
||||
#include "shader_glsl.h"
|
||||
#endif
|
||||
|
||||
#include "gl_common.h"
|
||||
|
||||
#ifdef HAVE_FREETYPE
|
||||
#include "fonts.h"
|
||||
@ -119,6 +111,7 @@ typedef struct gl
|
||||
// Render-to-texture, multipass shaders
|
||||
GLuint fbo[MAX_SHADERS];
|
||||
GLuint fbo_texture[MAX_SHADERS];
|
||||
struct gl_fbo_rect fbo_rect[MAX_SHADERS];
|
||||
bool render_to_tex;
|
||||
unsigned fbo_width;
|
||||
unsigned fbo_height;
|
||||
@ -264,17 +257,33 @@ static inline unsigned gl_shader_num(void)
|
||||
return num;
|
||||
}
|
||||
|
||||
static inline bool gl_shader_filter_type(unsigned num, bool *smooth)
|
||||
static inline bool gl_shader_filter_type(unsigned index, bool *smooth)
|
||||
{
|
||||
bool valid = false;
|
||||
#ifdef HAVE_CG
|
||||
if (!valid)
|
||||
valid = gl_cg_filter_type(num, smooth);
|
||||
valid = gl_cg_filter_type(index, smooth);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_XML
|
||||
if (!valid)
|
||||
valid = gl_glsl_filter_type(num, smooth);
|
||||
valid = gl_glsl_filter_type(index, smooth);
|
||||
#endif
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
static inline bool gl_shader_rect(unsigned index, struct gl_fbo_rect *rect)
|
||||
{
|
||||
bool valid = false;
|
||||
#ifdef HAVE_CG
|
||||
if (!valid)
|
||||
valid = gl_cg_shader_rect(index, rect);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_XML
|
||||
if (!valid)
|
||||
valid = gl_glsl_shader_rect(index, rect);
|
||||
#endif
|
||||
|
||||
return valid;
|
||||
|
@ -20,6 +20,15 @@
|
||||
|
||||
#include "general.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glext.h>
|
||||
#else
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glext.h>
|
||||
#endif
|
||||
|
||||
static inline bool gl_check_error(void)
|
||||
{
|
||||
int error = glGetError();
|
||||
@ -29,7 +38,7 @@ static inline bool gl_check_error(void)
|
||||
SSNES_ERR("GL: Invalid enum.\n");
|
||||
break;
|
||||
case GL_INVALID_VALUE:
|
||||
SSNES_ERR("GL: Invalid value.\n");
|
||||
SSNES_ERR("GL: Invalid value. (You're not alone.)\n");
|
||||
break;
|
||||
case GL_INVALID_OPERATION:
|
||||
SSNES_ERR("GL: Invalid operation.\n");
|
||||
@ -56,4 +65,14 @@ static inline bool gl_check_error(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
struct gl_fbo_rect
|
||||
{
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
unsigned tex_width;
|
||||
unsigned tex_height;
|
||||
|
||||
GLfloat texcoord[8];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -208,3 +208,11 @@ bool gl_cg_filter_type(unsigned index, bool *smooth)
|
||||
// We don't really care since .cg doesn't have those kinds of semantics by itself ...
|
||||
return false;
|
||||
}
|
||||
|
||||
bool gl_cg_shader_rect(unsigned index, struct gl_fbo_rect *rect)
|
||||
{
|
||||
(void)index;
|
||||
(void)rect;
|
||||
// We don't really care since .cg doesn't have those kinds of semantics by itself ...
|
||||
return false;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
#define __SSNES_CG_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "gl_common.h"
|
||||
|
||||
bool gl_cg_init(const char *path);
|
||||
|
||||
@ -36,5 +37,6 @@ void gl_cg_use(unsigned index);
|
||||
unsigned gl_cg_num(void);
|
||||
|
||||
bool gl_cg_filter_type(unsigned index, bool *smooth);
|
||||
bool gl_cg_shader_rect(unsigned index, struct gl_fbo_rect *rect);
|
||||
|
||||
#endif
|
||||
|
@ -420,3 +420,10 @@ bool gl_glsl_filter_type(unsigned index, bool *smooth)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool gl_glsl_shader_rect(unsigned index, struct gl_fbo_rect *rect)
|
||||
{
|
||||
(void)index;
|
||||
(void)rect;
|
||||
return false;
|
||||
}
|
||||
|
@ -36,5 +36,6 @@ void gl_glsl_use(unsigned index);
|
||||
unsigned gl_glsl_num(void);
|
||||
|
||||
bool gl_glsl_filter_type(unsigned index, bool *smooth);
|
||||
bool gl_glsl_shader_rect(unsigned index, struct gl_fbo_rect *rect);
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user