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"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#include "gl_common.h"
|
||||||
#include <OpenGL/gl.h>
|
|
||||||
#include <OpenGL/glext.h>
|
|
||||||
#else
|
|
||||||
#define GL_GLEXT_PROTOTYPES
|
|
||||||
#include <GL/gl.h>
|
|
||||||
#include <GL/glext.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define NO_SDL_GLEXT
|
#define NO_SDL_GLEXT
|
||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
|
@ -53,7 +46,6 @@
|
||||||
#include "shader_glsl.h"
|
#include "shader_glsl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "gl_common.h"
|
|
||||||
|
|
||||||
#ifdef HAVE_FREETYPE
|
#ifdef HAVE_FREETYPE
|
||||||
#include "fonts.h"
|
#include "fonts.h"
|
||||||
|
@ -119,6 +111,7 @@ typedef struct gl
|
||||||
// Render-to-texture, multipass shaders
|
// Render-to-texture, multipass shaders
|
||||||
GLuint fbo[MAX_SHADERS];
|
GLuint fbo[MAX_SHADERS];
|
||||||
GLuint fbo_texture[MAX_SHADERS];
|
GLuint fbo_texture[MAX_SHADERS];
|
||||||
|
struct gl_fbo_rect fbo_rect[MAX_SHADERS];
|
||||||
bool render_to_tex;
|
bool render_to_tex;
|
||||||
unsigned fbo_width;
|
unsigned fbo_width;
|
||||||
unsigned fbo_height;
|
unsigned fbo_height;
|
||||||
|
@ -264,17 +257,33 @@ static inline unsigned gl_shader_num(void)
|
||||||
return num;
|
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;
|
bool valid = false;
|
||||||
#ifdef HAVE_CG
|
#ifdef HAVE_CG
|
||||||
if (!valid)
|
if (!valid)
|
||||||
valid = gl_cg_filter_type(num, smooth);
|
valid = gl_cg_filter_type(index, smooth);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_XML
|
#ifdef HAVE_XML
|
||||||
if (!valid)
|
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
|
#endif
|
||||||
|
|
||||||
return valid;
|
return valid;
|
||||||
|
|
|
@ -20,6 +20,15 @@
|
||||||
|
|
||||||
#include "general.h"
|
#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)
|
static inline bool gl_check_error(void)
|
||||||
{
|
{
|
||||||
int error = glGetError();
|
int error = glGetError();
|
||||||
|
@ -29,7 +38,7 @@ static inline bool gl_check_error(void)
|
||||||
SSNES_ERR("GL: Invalid enum.\n");
|
SSNES_ERR("GL: Invalid enum.\n");
|
||||||
break;
|
break;
|
||||||
case GL_INVALID_VALUE:
|
case GL_INVALID_VALUE:
|
||||||
SSNES_ERR("GL: Invalid value.\n");
|
SSNES_ERR("GL: Invalid value. (You're not alone.)\n");
|
||||||
break;
|
break;
|
||||||
case GL_INVALID_OPERATION:
|
case GL_INVALID_OPERATION:
|
||||||
SSNES_ERR("GL: Invalid operation.\n");
|
SSNES_ERR("GL: Invalid operation.\n");
|
||||||
|
@ -56,4 +65,14 @@ static inline bool gl_check_error(void)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct gl_fbo_rect
|
||||||
|
{
|
||||||
|
unsigned width;
|
||||||
|
unsigned height;
|
||||||
|
unsigned tex_width;
|
||||||
|
unsigned tex_height;
|
||||||
|
|
||||||
|
GLfloat texcoord[8];
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#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 ...
|
// We don't really care since .cg doesn't have those kinds of semantics by itself ...
|
||||||
return false;
|
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
|
#define __SSNES_CG_H
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include "gl_common.h"
|
||||||
|
|
||||||
bool gl_cg_init(const char *path);
|
bool gl_cg_init(const char *path);
|
||||||
|
|
||||||
|
@ -36,5 +37,6 @@ void gl_cg_use(unsigned index);
|
||||||
unsigned gl_cg_num(void);
|
unsigned gl_cg_num(void);
|
||||||
|
|
||||||
bool gl_cg_filter_type(unsigned index, bool *smooth);
|
bool gl_cg_filter_type(unsigned index, bool *smooth);
|
||||||
|
bool gl_cg_shader_rect(unsigned index, struct gl_fbo_rect *rect);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -420,3 +420,10 @@ bool gl_glsl_filter_type(unsigned index, bool *smooth)
|
||||||
return false;
|
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);
|
unsigned gl_glsl_num(void);
|
||||||
|
|
||||||
bool gl_glsl_filter_type(unsigned index, bool *smooth);
|
bool gl_glsl_filter_type(unsigned index, bool *smooth);
|
||||||
|
bool gl_glsl_shader_rect(unsigned index, struct gl_fbo_rect *rect);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue