mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-12-02 18:46:52 +00:00
Check for EXT_discard_framebuffer
This commit is contained in:
parent
135ae4faf5
commit
7ceecd22b4
@ -3,6 +3,7 @@
|
||||
#include "base/logging.h"
|
||||
#include "gfx_es2/fbo.h"
|
||||
#include "gfx/gl_common.h"
|
||||
#include "gfx_es2/gl_state.h"
|
||||
|
||||
#if defined(USING_GLES2)
|
||||
#define GL_READ_FRAMEBUFFER GL_FRAMEBUFFER
|
||||
@ -16,33 +17,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// TODO: Breakout this GL extension checker in its own file.
|
||||
|
||||
struct GLExtensions {
|
||||
bool OES_depth24;
|
||||
bool OES_packed_depth_stencil;
|
||||
bool OES_depth_texture;
|
||||
};
|
||||
|
||||
GLExtensions gl_extensions;
|
||||
|
||||
void CheckExtensions() {
|
||||
static bool done = false;
|
||||
if (done)
|
||||
return;
|
||||
done = true;
|
||||
|
||||
memset(&gl_extensions, 0, sizeof(gl_extensions));
|
||||
|
||||
const char *extString = (const char *)glGetString(GL_EXTENSIONS);
|
||||
|
||||
gl_extensions.OES_packed_depth_stencil = strstr(extString, "GL_OES_packed_depth_stencil");
|
||||
gl_extensions.OES_depth24 = strstr(extString, "GL_OES_depth24");
|
||||
gl_extensions.OES_depth_texture = strstr(extString, "GL_OES_depth_texture");
|
||||
}
|
||||
|
||||
|
||||
|
||||
struct FBO {
|
||||
GLuint handle;
|
||||
GLuint color_texture;
|
||||
@ -59,7 +33,7 @@ struct FBO {
|
||||
// On Android, we try to use what's available.
|
||||
|
||||
FBO *fbo_create(int width, int height, int num_color_textures, bool z_stencil) {
|
||||
CheckExtensions();
|
||||
CheckGLExtensions();
|
||||
|
||||
FBO *fbo = new FBO();
|
||||
fbo->width = width;
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "gl_state.h"
|
||||
|
||||
OpenGLState glstate;
|
||||
GLExtensions gl_extensions;
|
||||
|
||||
void OpenGLState::Initialize() {
|
||||
if(initialized) return;
|
||||
@ -26,3 +27,20 @@ void OpenGLState::Restore() {
|
||||
depthRange.restore();
|
||||
depthFunc.restore();
|
||||
}
|
||||
|
||||
void CheckGLExtensions() {
|
||||
static bool done = false;
|
||||
if (done)
|
||||
return;
|
||||
done = true;
|
||||
|
||||
memset(&gl_extensions, 0, sizeof(gl_extensions));
|
||||
|
||||
const char *extString = (const char *)glGetString(GL_EXTENSIONS);
|
||||
|
||||
gl_extensions.OES_packed_depth_stencil = strstr(extString, "GL_OES_packed_depth_stencil") != 0;
|
||||
gl_extensions.OES_depth24 = strstr(extString, "GL_OES_depth24") != 0;
|
||||
gl_extensions.OES_depth_texture = strstr(extString, "GL_OES_depth_texture") != 0;
|
||||
gl_extensions.EXT_discard_framebuffer = strstr(extString, "GL_EXT_discard_framebuffer") != 0;
|
||||
}
|
||||
|
||||
|
@ -158,3 +158,14 @@ public:
|
||||
#undef STATE2
|
||||
|
||||
extern OpenGLState glstate;
|
||||
|
||||
struct GLExtensions {
|
||||
bool OES_depth24;
|
||||
bool OES_packed_depth_stencil;
|
||||
bool OES_depth_texture;
|
||||
bool EXT_discard_framebuffer;
|
||||
};
|
||||
|
||||
extern GLExtensions gl_extensions;
|
||||
|
||||
void CheckGLExtensions();
|
||||
|
Loading…
Reference in New Issue
Block a user