2013-04-18 05:29:41 +02:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
2008-12-08 05:46:09 +01:00
|
|
|
|
2009-04-03 16:35:49 +02:00
|
|
|
#ifndef _GLINIT_H_
|
|
|
|
#define _GLINIT_H_
|
2008-12-08 05:46:09 +01:00
|
|
|
|
2009-09-13 11:23:30 +02:00
|
|
|
#include "VideoConfig.h"
|
2009-07-15 02:51:24 +02:00
|
|
|
#include "MathUtil.h"
|
2012-12-26 02:08:24 +01:00
|
|
|
#include "GLInterface.h"
|
2008-12-08 05:46:09 +01:00
|
|
|
|
|
|
|
#ifndef GL_DEPTH24_STENCIL8_EXT // allows FBOs to support stencils
|
|
|
|
#define GL_DEPTH_STENCIL_EXT 0x84F9
|
|
|
|
#define GL_UNSIGNED_INT_24_8_EXT 0x84FA
|
|
|
|
#define GL_DEPTH24_STENCIL8_EXT 0x88F0
|
|
|
|
#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1
|
|
|
|
#endif
|
|
|
|
|
2012-12-24 16:37:12 +01:00
|
|
|
#ifdef USE_GLES
|
|
|
|
#define TEX2D GL_TEXTURE_2D
|
|
|
|
#define PREC "highp"
|
|
|
|
#define TEXTYPE "sampler2D"
|
2013-03-18 08:49:46 +01:00
|
|
|
#define TEXFUNC "texture2D"
|
2012-12-24 16:37:12 +01:00
|
|
|
#else
|
|
|
|
#define TEX2D GL_TEXTURE_RECTANGLE_ARB
|
|
|
|
#define PREC
|
|
|
|
#define TEXTYPE "sampler2DRect"
|
2013-01-22 00:18:42 +01:00
|
|
|
#define TEXFUNC "texture2DRect"
|
2011-01-10 17:18:41 +01:00
|
|
|
#endif
|
2008-12-08 05:46:09 +01:00
|
|
|
|
|
|
|
|
2008-12-11 00:23:05 +01:00
|
|
|
#ifndef _WIN32
|
2009-03-22 12:21:44 +01:00
|
|
|
|
2008-12-08 05:46:09 +01:00
|
|
|
#include <sys/types.h>
|
2009-03-08 20:19:51 +01:00
|
|
|
|
2008-12-08 05:46:09 +01:00
|
|
|
#endif
|
2012-12-17 21:54:20 +01:00
|
|
|
void InitInterface();
|
2009-03-08 20:19:51 +01:00
|
|
|
|
2012-12-17 21:54:20 +01:00
|
|
|
// Helpers
|
|
|
|
GLuint OpenGL_CompileProgram(const char *vertexShader, const char *fragmentShader);
|
2009-03-08 20:19:51 +01:00
|
|
|
|
2009-03-22 12:21:44 +01:00
|
|
|
// Error reporting - use the convenient macros.
|
|
|
|
void OpenGL_ReportARBProgramError();
|
|
|
|
GLuint OpenGL_ReportGLError(const char *function, const char *file, int line);
|
|
|
|
bool OpenGL_ReportFBOError(const char *function, const char *file, int line);
|
|
|
|
|
2010-08-03 12:48:49 +02:00
|
|
|
#if defined(_DEBUG) || defined(DEBUGFAST)
|
2010-08-04 16:00:59 +02:00
|
|
|
#define GL_REPORT_ERROR() OpenGL_ReportGLError(__FUNCTION__, __FILE__, __LINE__)
|
|
|
|
#define GL_REPORT_ERRORD() OpenGL_ReportGLError(__FUNCTION__, __FILE__, __LINE__)
|
|
|
|
#define GL_REPORT_FBO_ERROR() OpenGL_ReportFBOError(__FUNCTION__, __FILE__, __LINE__)
|
2009-03-22 12:21:44 +01:00
|
|
|
#define GL_REPORT_PROGRAM_ERROR() OpenGL_ReportARBProgramError()
|
|
|
|
#else
|
2013-03-17 00:52:49 +01:00
|
|
|
__forceinline GLenum GL_REPORT_ERROR() { return GL_NO_ERROR; }
|
2010-08-04 16:00:59 +02:00
|
|
|
#define GL_REPORT_ERRORD() (void)GL_NO_ERROR
|
|
|
|
#define GL_REPORT_FBO_ERROR() (void)true
|
|
|
|
#define GL_REPORT_PROGRAM_ERROR() (void)0
|
2008-12-08 05:46:09 +01:00
|
|
|
#endif
|
2009-03-22 12:21:44 +01:00
|
|
|
|
2013-02-07 12:47:41 +01:00
|
|
|
// this should be removed in future, but as long as glsl is unstable, we should really read this messages
|
2013-03-14 21:25:41 +01:00
|
|
|
#if defined(_DEBUG) || defined(DEBUGFAST)
|
2013-03-07 20:26:56 +01:00
|
|
|
#define DEBUG_GLSL 1
|
|
|
|
#else
|
|
|
|
#define DEBUG_GLSL 0
|
|
|
|
#endif
|
2013-02-07 12:47:41 +01:00
|
|
|
|
2011-12-20 02:10:05 +01:00
|
|
|
// Isn't defined if we aren't using GLEW 1.6
|
|
|
|
#ifndef GL_ONE_MINUS_SRC1_ALPHA
|
|
|
|
#define GL_ONE_MINUS_SRC1_ALPHA 0x88FB
|
|
|
|
#endif
|
|
|
|
|
2009-04-03 16:35:49 +02:00
|
|
|
#endif // _GLINIT_H_
|