2013-04-18 03:29:41 +00:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2009-04-03 14:35:49 +00:00
|
|
|
#ifndef _GLINIT_H_
|
|
|
|
#define _GLINIT_H_
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2009-09-13 09:23:30 +00:00
|
|
|
#include "VideoConfig.h"
|
2009-07-15 00:51:24 +00:00
|
|
|
#include "MathUtil.h"
|
2012-12-26 01:08:24 +00:00
|
|
|
#include "GLInterface.h"
|
2008-12-08 04:46:09 +00: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 15:37:12 +00:00
|
|
|
#ifdef USE_GLES
|
|
|
|
#define TEX2D GL_TEXTURE_2D
|
|
|
|
#define PREC "highp"
|
|
|
|
#define TEXTYPE "sampler2D"
|
2013-03-18 07:49:46 +00:00
|
|
|
#define TEXFUNC "texture2D"
|
2013-06-11 13:33:56 +00:00
|
|
|
#ifdef USE_GLES3
|
|
|
|
#include "GLFunctions.h"
|
2013-07-13 22:24:23 +00:00
|
|
|
#define GLAPIENTRY GL_APIENTRY
|
|
|
|
#define GL_SAMPLES_PASSED GL_ANY_SAMPLES_PASSED
|
|
|
|
#define GL_READ_ONLY 0x88B8
|
|
|
|
#define GL_WRITE_ONLY 0x88B9
|
|
|
|
#define GL_READ_WRITE 0x88BA
|
|
|
|
#define GL_SRC1_ALPHA 0
|
|
|
|
#define GL_BGRA GL_RGBA
|
|
|
|
#define glDrawElementsBaseVertex
|
2013-07-26 14:50:51 +00:00
|
|
|
#define glDrawRangeElementsBaseVertex
|
2013-06-11 13:33:56 +00:00
|
|
|
#endif
|
2012-12-24 15:37:12 +00:00
|
|
|
#else
|
|
|
|
#define TEX2D GL_TEXTURE_RECTANGLE_ARB
|
|
|
|
#define PREC
|
|
|
|
#define TEXTYPE "sampler2DRect"
|
2013-01-21 23:18:42 +00:00
|
|
|
#define TEXFUNC "texture2DRect"
|
2011-01-10 16:18:41 +00:00
|
|
|
#endif
|
2008-12-08 04:46:09 +00:00
|
|
|
|
|
|
|
|
2008-12-10 23:23:05 +00:00
|
|
|
#ifndef _WIN32
|
2009-03-22 11:21:44 +00:00
|
|
|
|
2008-12-08 04:46:09 +00:00
|
|
|
#include <sys/types.h>
|
2009-03-08 19:19:51 +00:00
|
|
|
|
2008-12-08 04:46:09 +00:00
|
|
|
#endif
|
2012-12-17 20:54:20 +00:00
|
|
|
void InitInterface();
|
2009-03-08 19:19:51 +00:00
|
|
|
|
2012-12-17 20:54:20 +00:00
|
|
|
// Helpers
|
|
|
|
GLuint OpenGL_CompileProgram(const char *vertexShader, const char *fragmentShader);
|
2009-03-08 19:19:51 +00:00
|
|
|
|
2009-03-22 11:21:44 +00: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 10:48:49 +00:00
|
|
|
#if defined(_DEBUG) || defined(DEBUGFAST)
|
2010-08-04 14:00:59 +00: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 11:21:44 +00:00
|
|
|
#define GL_REPORT_PROGRAM_ERROR() OpenGL_ReportARBProgramError()
|
|
|
|
#else
|
2013-03-16 23:52:49 +00:00
|
|
|
__forceinline GLenum GL_REPORT_ERROR() { return GL_NO_ERROR; }
|
2010-08-04 14:00:59 +00: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 04:46:09 +00:00
|
|
|
#endif
|
2009-03-22 11:21:44 +00:00
|
|
|
|
2013-02-07 11:47:41 +00:00
|
|
|
// this should be removed in future, but as long as glsl is unstable, we should really read this messages
|
2013-03-14 20:25:41 +00:00
|
|
|
#if defined(_DEBUG) || defined(DEBUGFAST)
|
2013-03-07 19:26:56 +00:00
|
|
|
#define DEBUG_GLSL 1
|
|
|
|
#else
|
|
|
|
#define DEBUG_GLSL 0
|
|
|
|
#endif
|
2013-02-07 11:47:41 +00:00
|
|
|
|
2011-12-20 01:10:05 +00: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 14:35:49 +00:00
|
|
|
#endif // _GLINIT_H_
|