2009-07-28 21:32:10 +00:00
|
|
|
// Copyright (C) 2003 Dolphin Project.
|
2008-12-08 04:46:09 +00:00
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, version 2.0.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official SVN repository and contact information can be found at
|
|
|
|
// http://code.google.com/p/dolphin-emu/
|
|
|
|
|
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-17 20:54:20 +00:00
|
|
|
#include "GLVideoInterface.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"
|
|
|
|
#define TEXFUNC "texture2D"
|
|
|
|
#else
|
|
|
|
#define TEX2D GL_TEXTURE_RECTANGLE_ARB
|
|
|
|
#define PREC
|
|
|
|
#define TEXTYPE "sampler2DRect"
|
|
|
|
#define TEXFUNC "texture2DRect"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2008-12-10 23:23:05 +00:00
|
|
|
#ifndef _WIN32
|
|
|
|
|
2008-12-08 04:46:09 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
#endif
|
2012-12-17 20:54:20 +00:00
|
|
|
void InitInterface();
|
2008-12-08 04:46:09 +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
|
|
|
|
#define GL_REPORT_ERROR() 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
|
|
|
|
2010-07-24 10:24:16 +00:00
|
|
|
#if defined __APPLE__ || defined __linux__ || defined _WIN32
|
2009-09-03 20:37:35 +00:00
|
|
|
#include <Cg/cg.h>
|
|
|
|
#include <Cg/cgGL.h>
|
2010-07-24 10:24:16 +00:00
|
|
|
#define HAVE_CG 1
|
2009-09-03 20:37:35 +00:00
|
|
|
extern CGcontext g_cgcontext;
|
|
|
|
extern CGprofile g_cgvProf, g_cgfProf;
|
2010-07-24 10:24:16 +00:00
|
|
|
#endif
|
2009-09-03 20:37:35 +00:00
|
|
|
|
2010-10-23 19:55:19 +00:00
|
|
|
// XXX: Dual-source blending in OpenGL does not work correctly yet. To make it
|
|
|
|
// work, we may need to use glBindFragDataLocation. To use that, we need to
|
|
|
|
// use GLSL shaders across the whole pipeline. Yikes!
|
2010-10-24 18:26:28 +00:00
|
|
|
//#define USE_DUAL_SOURCE_BLEND
|
2010-10-23 19:55:19 +00:00
|
|
|
|
2012-12-17 20:54:20 +00:00
|
|
|
// TODO: should be removed if we use glsl a lot
|
|
|
|
#define DEBUG_GLSL
|
|
|
|
|
2009-04-03 14:35:49 +00:00
|
|
|
#endif // _GLINIT_H_
|