OpenGL: Start reorganizing stuff in preparation for adding new OpenGL variants, such as OpenGL ES.
- All platform-specific header includes are now centralized in OGLRender.h. - Remove all ARB and EXT versions of legacy functions (everything pre 3.0). Legacy functions now only reference their core versions. - Do a some minor code cleanup.
This commit is contained in:
parent
76bd1a5e35
commit
086980deaf
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2006 yopyop
|
||||
Copyright (C) 2006-2007 shash
|
||||
Copyright (C) 2008-2023 DeSmuME team
|
||||
Copyright (C) 2008-2024 DeSmuME team
|
||||
|
||||
This file is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -130,14 +130,14 @@ const GLint GeometryAttachmentFogAttributes[8] = {
|
|||
|
||||
bool BEGINGL()
|
||||
{
|
||||
if(oglrender_beginOpenGL)
|
||||
if (oglrender_beginOpenGL)
|
||||
return oglrender_beginOpenGL();
|
||||
else return true;
|
||||
}
|
||||
|
||||
void ENDGL()
|
||||
{
|
||||
if(oglrender_endOpenGL)
|
||||
if (oglrender_endOpenGL)
|
||||
oglrender_endOpenGL();
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,6 @@ void (*OGLCreateRenderer_3_2_Func)(OpenGLRenderer **rendererPtr) = NULL;
|
|||
// Textures
|
||||
#if !defined(GLX_H)
|
||||
OGLEXT(PFNGLACTIVETEXTUREPROC, glActiveTexture) // Core in v1.3
|
||||
OGLEXT(PFNGLACTIVETEXTUREARBPROC, glActiveTextureARB)
|
||||
#endif
|
||||
|
||||
// Blending
|
||||
|
@ -164,9 +163,6 @@ OGLEXT(PFNGLBLENDEQUATIONPROC, glBlendEquation) // Core in v1.2
|
|||
OGLEXT(PFNGLBLENDFUNCSEPARATEPROC, glBlendFuncSeparate) // Core in v1.4
|
||||
OGLEXT(PFNGLBLENDEQUATIONSEPARATEPROC, glBlendEquationSeparate) // Core in v2.0
|
||||
|
||||
OGLEXT(PFNGLBLENDFUNCSEPARATEEXTPROC, glBlendFuncSeparateEXT)
|
||||
OGLEXT(PFNGLBLENDEQUATIONSEPARATEEXTPROC, glBlendEquationSeparateEXT)
|
||||
|
||||
// Shaders
|
||||
OGLEXT(PFNGLCREATESHADERPROC, glCreateShader) // Core in v2.0
|
||||
OGLEXT(PFNGLSHADERSOURCEPROC, glShaderSource) // Core in v2.0
|
||||
|
@ -192,24 +188,17 @@ OGLEXT(PFNGLUNIFORM2FPROC, glUniform2f) // Core in v2.0
|
|||
OGLEXT(PFNGLUNIFORM4FPROC, glUniform4f) // Core in v2.0
|
||||
OGLEXT(PFNGLUNIFORM4FVPROC, glUniform4fv) // Core in v2.0
|
||||
OGLEXT(PFNGLDRAWBUFFERSPROC, glDrawBuffers) // Core in v2.0
|
||||
|
||||
// Generic vertex attributes
|
||||
OGLEXT(PFNGLBINDATTRIBLOCATIONPROC, glBindAttribLocation) // Core in v2.0
|
||||
OGLEXT(PFNGLENABLEVERTEXATTRIBARRAYPROC, glEnableVertexAttribArray) // Core in v2.0
|
||||
OGLEXT(PFNGLDISABLEVERTEXATTRIBARRAYPROC, glDisableVertexAttribArray) // Core in v2.0
|
||||
OGLEXT(PFNGLVERTEXATTRIBPOINTERPROC, glVertexAttribPointer) // Core in v2.0
|
||||
|
||||
// VAO
|
||||
OGLEXT(PFNGLGENVERTEXARRAYSPROC, glGenVertexArrays)
|
||||
OGLEXT(PFNGLDELETEVERTEXARRAYSPROC, glDeleteVertexArrays)
|
||||
OGLEXT(PFNGLBINDVERTEXARRAYPROC, glBindVertexArray)
|
||||
|
||||
// Buffer Objects
|
||||
OGLEXT(PFNGLGENBUFFERSARBPROC, glGenBuffersARB)
|
||||
OGLEXT(PFNGLDELETEBUFFERSARBPROC, glDeleteBuffersARB)
|
||||
OGLEXT(PFNGLBINDBUFFERARBPROC, glBindBufferARB)
|
||||
OGLEXT(PFNGLBUFFERDATAARBPROC, glBufferDataARB)
|
||||
OGLEXT(PFNGLBUFFERSUBDATAARBPROC, glBufferSubDataARB)
|
||||
OGLEXT(PFNGLMAPBUFFERARBPROC, glMapBufferARB)
|
||||
OGLEXT(PFNGLUNMAPBUFFERARBPROC, glUnmapBufferARB)
|
||||
// VAO (always available in Apple's implementation of OpenGL, including old versions)
|
||||
OGLEXT(PFNGLGENVERTEXARRAYSPROC, glGenVertexArrays) // Core in v3.0 and ES v3.0
|
||||
OGLEXT(PFNGLDELETEVERTEXARRAYSPROC, glDeleteVertexArrays) // Core in v3.0 and ES v3.0
|
||||
OGLEXT(PFNGLBINDVERTEXARRAYPROC, glBindVertexArray) // Core in v3.0 and ES v3.0
|
||||
|
||||
OGLEXT(PFNGLGENBUFFERSPROC, glGenBuffers) // Core in v1.5
|
||||
OGLEXT(PFNGLDELETEBUFFERSPROC, glDeleteBuffers) // Core in v1.5
|
||||
|
@ -219,6 +208,7 @@ OGLEXT(PFNGLBUFFERSUBDATAPROC, glBufferSubData) // Core in v1.5
|
|||
OGLEXT(PFNGLMAPBUFFERPROC, glMapBuffer) // Core in v1.5
|
||||
OGLEXT(PFNGLUNMAPBUFFERPROC, glUnmapBuffer) // Core in v1.5
|
||||
|
||||
#ifdef GL_EXT_framebuffer_object
|
||||
// FBO
|
||||
OGLEXT(PFNGLGENFRAMEBUFFERSEXTPROC, glGenFramebuffersEXT)
|
||||
OGLEXT(PFNGLBINDFRAMEBUFFEREXTPROC, glBindFramebufferEXT)
|
||||
|
@ -227,18 +217,20 @@ OGLEXT(PFNGLFRAMEBUFFERTEXTURE2DEXTPROC, glFramebufferTexture2DEXT)
|
|||
OGLEXT(PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC, glCheckFramebufferStatusEXT)
|
||||
OGLEXT(PFNGLDELETEFRAMEBUFFERSEXTPROC, glDeleteFramebuffersEXT)
|
||||
OGLEXT(PFNGLBLITFRAMEBUFFEREXTPROC, glBlitFramebufferEXT)
|
||||
|
||||
// Multisampled FBO
|
||||
OGLEXT(PFNGLGENRENDERBUFFERSEXTPROC, glGenRenderbuffersEXT)
|
||||
OGLEXT(PFNGLBINDRENDERBUFFEREXTPROC, glBindRenderbufferEXT)
|
||||
OGLEXT(PFNGLRENDERBUFFERSTORAGEEXTPROC, glRenderbufferStorageEXT)
|
||||
OGLEXT(PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC, glRenderbufferStorageMultisampleEXT)
|
||||
OGLEXT(PFNGLDELETERENDERBUFFERSEXTPROC, glDeleteRenderbuffersEXT)
|
||||
#endif // GL_EXT_framebuffer_object
|
||||
|
||||
static void OGLLoadEntryPoints_Legacy()
|
||||
{
|
||||
// Textures
|
||||
#if !defined(GLX_H)
|
||||
INITOGLEXT(PFNGLACTIVETEXTUREPROC, glActiveTexture) // Core in v1.3
|
||||
INITOGLEXT(PFNGLACTIVETEXTUREARBPROC, glActiveTextureARB)
|
||||
#endif
|
||||
|
||||
// Blending
|
||||
|
@ -248,9 +240,6 @@ static void OGLLoadEntryPoints_Legacy()
|
|||
INITOGLEXT(PFNGLBLENDFUNCSEPARATEPROC, glBlendFuncSeparate) // Core in v1.4
|
||||
INITOGLEXT(PFNGLBLENDEQUATIONSEPARATEPROC, glBlendEquationSeparate) // Core in v2.0
|
||||
|
||||
INITOGLEXT(PFNGLBLENDFUNCSEPARATEEXTPROC, glBlendFuncSeparateEXT)
|
||||
INITOGLEXT(PFNGLBLENDEQUATIONSEPARATEEXTPROC, glBlendEquationSeparateEXT)
|
||||
|
||||
// Shaders
|
||||
INITOGLEXT(PFNGLCREATESHADERPROC, glCreateShader) // Core in v2.0
|
||||
INITOGLEXT(PFNGLSHADERSOURCEPROC, glShaderSource) // Core in v2.0
|
||||
|
@ -276,25 +265,14 @@ static void OGLLoadEntryPoints_Legacy()
|
|||
INITOGLEXT(PFNGLUNIFORM4FPROC, glUniform4f) // Core in v2.0
|
||||
INITOGLEXT(PFNGLUNIFORM4FVPROC, glUniform4fv) // Core in v2.0
|
||||
INITOGLEXT(PFNGLDRAWBUFFERSPROC, glDrawBuffers) // Core in v2.0
|
||||
|
||||
// Generic vertex attributes
|
||||
INITOGLEXT(PFNGLBINDATTRIBLOCATIONPROC, glBindAttribLocation) // Core in v2.0
|
||||
INITOGLEXT(PFNGLENABLEVERTEXATTRIBARRAYPROC, glEnableVertexAttribArray) // Core in v2.0
|
||||
INITOGLEXT(PFNGLDISABLEVERTEXATTRIBARRAYPROC, glDisableVertexAttribArray) // Core in v2.0
|
||||
INITOGLEXT(PFNGLVERTEXATTRIBPOINTERPROC, glVertexAttribPointer) // Core in v2.0
|
||||
|
||||
// VAO
|
||||
INITOGLEXT(PFNGLGENVERTEXARRAYSPROC, glGenVertexArrays)
|
||||
INITOGLEXT(PFNGLDELETEVERTEXARRAYSPROC, glDeleteVertexArrays)
|
||||
INITOGLEXT(PFNGLBINDVERTEXARRAYPROC, glBindVertexArray)
|
||||
|
||||
// Buffer Objects
|
||||
INITOGLEXT(PFNGLGENBUFFERSARBPROC, glGenBuffersARB)
|
||||
INITOGLEXT(PFNGLDELETEBUFFERSARBPROC, glDeleteBuffersARB)
|
||||
INITOGLEXT(PFNGLBINDBUFFERARBPROC, glBindBufferARB)
|
||||
INITOGLEXT(PFNGLBUFFERDATAARBPROC, glBufferDataARB)
|
||||
INITOGLEXT(PFNGLBUFFERSUBDATAARBPROC, glBufferSubDataARB)
|
||||
INITOGLEXT(PFNGLMAPBUFFERARBPROC, glMapBufferARB)
|
||||
INITOGLEXT(PFNGLUNMAPBUFFERARBPROC, glUnmapBufferARB)
|
||||
|
||||
INITOGLEXT(PFNGLGENBUFFERSPROC, glGenBuffers) // Core in v1.5
|
||||
INITOGLEXT(PFNGLDELETEBUFFERSPROC, glDeleteBuffers) // Core in v1.5
|
||||
INITOGLEXT(PFNGLBINDBUFFERPROC, glBindBuffer) // Core in v1.5
|
||||
|
@ -303,6 +281,12 @@ static void OGLLoadEntryPoints_Legacy()
|
|||
INITOGLEXT(PFNGLMAPBUFFERPROC, glMapBuffer) // Core in v1.5
|
||||
INITOGLEXT(PFNGLUNMAPBUFFERPROC, glUnmapBuffer) // Core in v1.5
|
||||
|
||||
// VAO (always available in Apple's implementation of OpenGL, including old versions)
|
||||
INITOGLEXT(PFNGLGENVERTEXARRAYSPROC, glGenVertexArrays) // Core in v3.0 and ES v3.0
|
||||
INITOGLEXT(PFNGLDELETEVERTEXARRAYSPROC, glDeleteVertexArrays) // Core in v3.0 and ES v3.0
|
||||
INITOGLEXT(PFNGLBINDVERTEXARRAYPROC, glBindVertexArray) // Core in v3.0 and ES v3.0
|
||||
|
||||
#ifdef GL_EXT_framebuffer_object
|
||||
// FBO
|
||||
INITOGLEXT(PFNGLGENFRAMEBUFFERSEXTPROC, glGenFramebuffersEXT)
|
||||
INITOGLEXT(PFNGLBINDFRAMEBUFFEREXTPROC, glBindFramebufferEXT)
|
||||
|
@ -311,11 +295,14 @@ static void OGLLoadEntryPoints_Legacy()
|
|||
INITOGLEXT(PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC, glCheckFramebufferStatusEXT)
|
||||
INITOGLEXT(PFNGLDELETEFRAMEBUFFERSEXTPROC, glDeleteFramebuffersEXT)
|
||||
INITOGLEXT(PFNGLBLITFRAMEBUFFEREXTPROC, glBlitFramebufferEXT)
|
||||
|
||||
// Multisampled FBO
|
||||
INITOGLEXT(PFNGLGENRENDERBUFFERSEXTPROC, glGenRenderbuffersEXT)
|
||||
INITOGLEXT(PFNGLBINDRENDERBUFFEREXTPROC, glBindRenderbufferEXT)
|
||||
INITOGLEXT(PFNGLRENDERBUFFERSTORAGEEXTPROC, glRenderbufferStorageEXT)
|
||||
INITOGLEXT(PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC, glRenderbufferStorageMultisampleEXT)
|
||||
INITOGLEXT(PFNGLDELETERENDERBUFFERSEXTPROC, glDeleteRenderbuffersEXT)
|
||||
#endif // GL_EXT_framebuffer_object
|
||||
}
|
||||
|
||||
// Vertex Shader GLSL 1.00
|
||||
|
@ -1127,6 +1114,8 @@ GPU3DInterface gpu3Dgl_3_2 = {
|
|||
|
||||
OpenGLRenderer::OpenGLRenderer()
|
||||
{
|
||||
_variantID = OpenGLVariantID_Legacy;
|
||||
|
||||
_deviceInfo.renderID = RENDERID_OPENGL_AUTO;
|
||||
_deviceInfo.renderName = "OpenGL";
|
||||
_deviceInfo.isTexturingSupported = true;
|
||||
|
@ -2372,7 +2361,6 @@ OpenGLRenderer_1_2::~OpenGLRenderer_1_2()
|
|||
this->DestroyFramebufferOutput8888Programs();
|
||||
}
|
||||
|
||||
|
||||
isShaderSupported = false;
|
||||
|
||||
DestroyVAOs();
|
||||
|
@ -2423,28 +2411,25 @@ Render3DError OpenGLRenderer_1_2::InitExtensions()
|
|||
// This texture is only required by shaders, and so if shader creation
|
||||
// fails, then we can immediately delete this texture if an error occurs.
|
||||
glGenTextures(1, &OGLRef.texFinalColorID);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + OGLTextureUnitID_FinalColor);
|
||||
glActiveTexture(GL_TEXTURE0 + OGLTextureUnitID_FinalColor);
|
||||
glBindTexture(GL_TEXTURE_2D, OGLRef.texFinalColorID);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)this->_framebufferWidth, (GLsizei)this->_framebufferHeight, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
|
||||
this->isVBOSupported = this->IsExtensionPresent(&oglExtensionSet, "GL_ARB_vertex_buffer_object");
|
||||
if (this->isVBOSupported)
|
||||
{
|
||||
this->CreateVBOs();
|
||||
}
|
||||
else
|
||||
else if (this->IsVersionSupported(1, 5, 0))
|
||||
{
|
||||
error = OGLERROR_VBO_UNSUPPORTED;
|
||||
if (this->IsVersionSupported(1, 5, 0))
|
||||
{
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
this->isPBOSupported = this->isVBOSupported &&
|
||||
(this->IsExtensionPresent(&oglExtensionSet, "GL_ARB_pixel_buffer_object") ||
|
||||
|
@ -2453,14 +2438,11 @@ Render3DError OpenGLRenderer_1_2::InitExtensions()
|
|||
{
|
||||
this->CreatePBOs();
|
||||
}
|
||||
else
|
||||
else if (this->IsVersionSupported(2, 1, 0))
|
||||
{
|
||||
error = OGLERROR_PBO_UNSUPPORTED;
|
||||
if (this->IsVersionSupported(2, 1, 0))
|
||||
{
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
// Don't use ARB versions since we're using the EXT versions for backwards compatibility.
|
||||
this->isFBOSupported = this->IsExtensionPresent(&oglExtensionSet, "GL_EXT_framebuffer_object") &&
|
||||
|
@ -2550,8 +2532,8 @@ Render3DError OpenGLRenderer_1_2::InitExtensions()
|
|||
GLint maxDrawBuffersOGL = 0;
|
||||
GLint maxShaderTexUnitsOGL = 0;
|
||||
glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &maxColorAttachmentsOGL);
|
||||
glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &maxDrawBuffersOGL);
|
||||
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &maxShaderTexUnitsOGL);
|
||||
glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffersOGL);
|
||||
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &maxShaderTexUnitsOGL);
|
||||
|
||||
if ( (maxColorAttachmentsOGL >= 4) && (maxDrawBuffersOGL >= 4) && (maxShaderTexUnitsOGL >= 8) )
|
||||
{
|
||||
|
@ -2639,20 +2621,20 @@ Render3DError OpenGLRenderer_1_2::CreateVBOs()
|
|||
{
|
||||
OGLRenderRef &OGLRef = *this->ref;
|
||||
|
||||
glGenBuffersARB(1, &OGLRef.vboGeometryVtxID);
|
||||
glGenBuffersARB(1, &OGLRef.iboGeometryIndexID);
|
||||
glGenBuffersARB(1, &OGLRef.vboPostprocessVtxID);
|
||||
glGenBuffers(1, &OGLRef.vboGeometryVtxID);
|
||||
glGenBuffers(1, &OGLRef.iboGeometryIndexID);
|
||||
glGenBuffers(1, &OGLRef.vboPostprocessVtxID);
|
||||
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, OGLRef.vboGeometryVtxID);
|
||||
glBufferDataARB(GL_ARRAY_BUFFER_ARB, VERTLIST_SIZE * sizeof(NDSVertex), NULL, GL_STREAM_DRAW_ARB);
|
||||
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, OGLRef.iboGeometryIndexID);
|
||||
glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, sizeof(OGLRef.vertIndexBuffer), NULL, GL_STREAM_DRAW_ARB);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, OGLRef.vboGeometryVtxID);
|
||||
glBufferData(GL_ARRAY_BUFFER, VERTLIST_SIZE * sizeof(NDSVertex), NULL, GL_STREAM_DRAW);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, OGLRef.iboGeometryIndexID);
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(OGLRef.vertIndexBuffer), NULL, GL_STREAM_DRAW);
|
||||
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, OGLRef.vboPostprocessVtxID);
|
||||
glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(PostprocessVtxBuffer), PostprocessVtxBuffer, GL_STATIC_DRAW_ARB);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, OGLRef.vboPostprocessVtxID);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(PostprocessVtxBuffer), PostprocessVtxBuffer, GL_STATIC_DRAW);
|
||||
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
|
||||
return OGLERROR_NOERR;
|
||||
}
|
||||
|
@ -2666,12 +2648,12 @@ void OpenGLRenderer_1_2::DestroyVBOs()
|
|||
|
||||
OGLRenderRef &OGLRef = *this->ref;
|
||||
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
|
||||
glDeleteBuffersARB(1, &OGLRef.vboGeometryVtxID);
|
||||
glDeleteBuffersARB(1, &OGLRef.iboGeometryIndexID);
|
||||
glDeleteBuffersARB(1, &OGLRef.vboPostprocessVtxID);
|
||||
glDeleteBuffers(1, &OGLRef.vboGeometryVtxID);
|
||||
glDeleteBuffers(1, &OGLRef.iboGeometryIndexID);
|
||||
glDeleteBuffers(1, &OGLRef.vboPostprocessVtxID);
|
||||
|
||||
this->isVBOSupported = false;
|
||||
}
|
||||
|
@ -2680,10 +2662,10 @@ Render3DError OpenGLRenderer_1_2::CreatePBOs()
|
|||
{
|
||||
OGLRenderRef &OGLRef = *this->ref;
|
||||
|
||||
glGenBuffersARB(1, &OGLRef.pboRenderDataID);
|
||||
glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, OGLRef.pboRenderDataID);
|
||||
glBufferDataARB(GL_PIXEL_PACK_BUFFER_ARB, this->_framebufferColorSizeBytes, NULL, GL_STREAM_READ_ARB);
|
||||
this->_mappedFramebuffer = (Color4u8 *__restrict)glMapBuffer(GL_PIXEL_PACK_BUFFER_ARB, GL_READ_ONLY_ARB);
|
||||
glGenBuffers(1, &OGLRef.pboRenderDataID);
|
||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, OGLRef.pboRenderDataID);
|
||||
glBufferData(GL_PIXEL_PACK_BUFFER, this->_framebufferColorSizeBytes, NULL, GL_STREAM_READ);
|
||||
this->_mappedFramebuffer = (Color4u8 *__restrict)glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY);
|
||||
|
||||
return OGLERROR_NOERR;
|
||||
}
|
||||
|
@ -2697,12 +2679,12 @@ void OpenGLRenderer_1_2::DestroyPBOs()
|
|||
|
||||
if (this->_mappedFramebuffer != NULL)
|
||||
{
|
||||
glUnmapBufferARB(GL_PIXEL_PACK_BUFFER_ARB);
|
||||
glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
|
||||
this->_mappedFramebuffer = NULL;
|
||||
}
|
||||
|
||||
glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0);
|
||||
glDeleteBuffersARB(1, &this->ref->pboRenderDataID);
|
||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
|
||||
glDeleteBuffers(1, &this->ref->pboRenderDataID);
|
||||
|
||||
this->isPBOSupported = false;
|
||||
}
|
||||
|
@ -2715,11 +2697,11 @@ Render3DError OpenGLRenderer_1_2::CreateVAOs()
|
|||
glGenVertexArrays(1, &OGLRef.vaoPostprocessStatesID);
|
||||
|
||||
glBindVertexArray(OGLRef.vaoGeometryStatesID);
|
||||
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, OGLRef.iboGeometryIndexID);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, OGLRef.iboGeometryIndexID);
|
||||
|
||||
if (this->isShaderSupported)
|
||||
{
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, OGLRef.vboGeometryVtxID);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, OGLRef.vboGeometryVtxID);
|
||||
|
||||
glEnableVertexAttribArray(OGLVertexAttributeID_Position);
|
||||
glEnableVertexAttribArray(OGLVertexAttributeID_TexCoord0);
|
||||
|
@ -2730,7 +2712,7 @@ Render3DError OpenGLRenderer_1_2::CreateVAOs()
|
|||
}
|
||||
else
|
||||
{
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
@ -2746,7 +2728,7 @@ Render3DError OpenGLRenderer_1_2::CreateVAOs()
|
|||
|
||||
if (this->isShaderSupported)
|
||||
{
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, OGLRef.vboPostprocessVtxID);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, OGLRef.vboPostprocessVtxID);
|
||||
|
||||
glEnableVertexAttribArray(OGLVertexAttributeID_Position);
|
||||
glEnableVertexAttribArray(OGLVertexAttributeID_TexCoord0);
|
||||
|
@ -2793,7 +2775,7 @@ Render3DError OpenGLRenderer_1_2::CreateFBOs()
|
|||
glGenTextures(1, &OGLRef.texGPolyID);
|
||||
glGenTextures(1, &OGLRef.texGDepthStencilID);
|
||||
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + OGLTextureUnitID_DepthStencil);
|
||||
glActiveTexture(GL_TEXTURE0 + OGLTextureUnitID_DepthStencil);
|
||||
glBindTexture(GL_TEXTURE_2D, OGLRef.texGDepthStencilID);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
@ -2802,7 +2784,7 @@ Render3DError OpenGLRenderer_1_2::CreateFBOs()
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_NONE);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8_EXT, (GLsizei)this->_framebufferWidth, (GLsizei)this->_framebufferHeight, 0, GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT, NULL);
|
||||
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + OGLTextureUnitID_GColor);
|
||||
glActiveTexture(GL_TEXTURE0 + OGLTextureUnitID_GColor);
|
||||
glBindTexture(GL_TEXTURE_2D, OGLRef.texGColorID);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
@ -2810,7 +2792,7 @@ Render3DError OpenGLRenderer_1_2::CreateFBOs()
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)this->_framebufferWidth, (GLsizei)this->_framebufferHeight, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
|
||||
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + OGLTextureUnitID_GPolyID);
|
||||
glActiveTexture(GL_TEXTURE0 + OGLTextureUnitID_GPolyID);
|
||||
glBindTexture(GL_TEXTURE_2D, OGLRef.texGPolyID);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
@ -2818,7 +2800,7 @@ Render3DError OpenGLRenderer_1_2::CreateFBOs()
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)this->_framebufferWidth, (GLsizei)this->_framebufferHeight, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
|
||||
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + OGLTextureUnitID_FogAttr);
|
||||
glActiveTexture(GL_TEXTURE0 + OGLTextureUnitID_FogAttr);
|
||||
glBindTexture(GL_TEXTURE_2D, OGLRef.texGFogAttrID);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
@ -2826,7 +2808,7 @@ Render3DError OpenGLRenderer_1_2::CreateFBOs()
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)this->_framebufferWidth, (GLsizei)this->_framebufferHeight, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
|
||||
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
|
||||
CACHE_ALIGN GLint tempClearImageBuffer[GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT];
|
||||
memset(tempClearImageBuffer, 0, sizeof(tempClearImageBuffer));
|
||||
|
@ -3693,12 +3675,12 @@ Render3DError OpenGLRenderer_1_2::InitFinalRenderStates(const std::set<std::stri
|
|||
{
|
||||
// we want to use alpha destination blending so we can track the last-rendered alpha value
|
||||
// test: new super mario brothers renders the stormclouds at the beginning
|
||||
glBlendFuncSeparateEXT(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA, GL_DST_ALPHA);
|
||||
glBlendEquationSeparateEXT(GL_FUNC_ADD, GL_MAX);
|
||||
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA, GL_DST_ALPHA);
|
||||
glBlendEquationSeparate(GL_FUNC_ADD, GL_MAX);
|
||||
}
|
||||
else
|
||||
{
|
||||
glBlendFuncSeparateEXT(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_DST_ALPHA);
|
||||
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_DST_ALPHA);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -3785,7 +3767,7 @@ Render3DError OpenGLRenderer_1_2::UploadClearImage(const u16 *__restrict colorBu
|
|||
const bool didDepthStencilChange = (memcmp(OGLRef.workingCIDepthStencilBuffer[this->_clearImageIndex], OGLRef.workingCIDepthStencilBuffer[this->_clearImageIndex ^ 0x01], GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT * sizeof(GLuint)) != 0);
|
||||
const bool didFogAttributesChange = this->_enableFog && this->_deviceInfo.isFogSupported && (memcmp(OGLRef.workingCIFogAttributesBuffer[this->_clearImageIndex], OGLRef.workingCIFogAttributesBuffer[this->_clearImageIndex ^ 0x01], GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT * sizeof(GLuint)) != 0);
|
||||
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
|
||||
if (didColorChange)
|
||||
{
|
||||
|
@ -4124,9 +4106,9 @@ Render3DError OpenGLRenderer_1_2::ReadBackPixels()
|
|||
const GLuint convertProgramID = (this->_outputFormat == NDSColorFormat_BGR666_Rev) ? OGLRef.programFramebufferRGBA6665OutputID[0] : OGLRef.programFramebufferRGBA8888OutputID[0];
|
||||
glUseProgram(convertProgramID);
|
||||
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + OGLTextureUnitID_FinalColor);
|
||||
glActiveTexture(GL_TEXTURE0 + OGLTextureUnitID_FinalColor);
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, (GLsizei)this->_framebufferWidth, (GLsizei)this->_framebufferHeight);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
}
|
||||
|
||||
glViewport(0, 0, (GLsizei)this->_framebufferWidth, (GLsizei)this->_framebufferHeight);
|
||||
|
@ -4182,7 +4164,7 @@ Render3DError OpenGLRenderer_1_2::ReadBackPixels()
|
|||
// penalty if the readback is in any other format.
|
||||
if (this->_mappedFramebuffer != NULL)
|
||||
{
|
||||
glUnmapBufferARB(GL_PIXEL_PACK_BUFFER_ARB);
|
||||
glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
|
||||
this->_mappedFramebuffer = NULL;
|
||||
}
|
||||
|
||||
|
@ -4211,17 +4193,17 @@ Render3DError OpenGLRenderer_1_2::BeginRender(const GFX3D_State &renderState, co
|
|||
|
||||
if (this->isVBOSupported)
|
||||
{
|
||||
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, OGLRef.iboGeometryIndexID);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, OGLRef.iboGeometryIndexID);
|
||||
|
||||
if (this->isShaderSupported)
|
||||
{
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, OGLRef.vboGeometryVtxID);
|
||||
glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(NDSVertex) * renderGList.rawVertCount, renderGList.rawVtxList);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, OGLRef.vboGeometryVtxID);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(NDSVertex) * renderGList.rawVertCount, renderGList.rawVtxList);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If shaders aren't supported, we need to use the client-side buffers here.
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4315,7 +4297,7 @@ Render3DError OpenGLRenderer_1_2::BeginRender(const GFX3D_State &renderState, co
|
|||
{
|
||||
// Replace the entire index buffer as a hint to the driver that we can orphan the index buffer and
|
||||
// avoid a synchronization cost.
|
||||
glBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0, sizeof(OGLRef.vertIndexBuffer), OGLRef.vertIndexBuffer);
|
||||
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, sizeof(OGLRef.vertIndexBuffer), OGLRef.vertIndexBuffer);
|
||||
}
|
||||
|
||||
// Set up rendering states that will remain constant for the entire frame.
|
||||
|
@ -4431,7 +4413,7 @@ Render3DError OpenGLRenderer_1_2::RenderGeometry()
|
|||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
|
||||
this->EnableVertexAttributes();
|
||||
|
||||
|
@ -5219,7 +5201,7 @@ Render3DError OpenGLRenderer_1_2::RenderPowerOff()
|
|||
{
|
||||
if (this->_mappedFramebuffer != NULL)
|
||||
{
|
||||
glUnmapBufferARB(GL_PIXEL_PACK_BUFFER_ARB);
|
||||
glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
|
||||
this->_mappedFramebuffer = NULL;
|
||||
}
|
||||
|
||||
|
@ -5250,7 +5232,7 @@ Render3DError OpenGLRenderer_1_2::RenderFinish()
|
|||
|
||||
if (this->isPBOSupported)
|
||||
{
|
||||
this->_mappedFramebuffer = (Color4u8 *__restrict)glMapBufferARB(GL_PIXEL_PACK_BUFFER_ARB, GL_READ_ONLY_ARB);
|
||||
this->_mappedFramebuffer = (Color4u8 *__restrict)glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -5311,41 +5293,41 @@ Render3DError OpenGLRenderer_1_2::SetFramebufferSize(size_t w, size_t h)
|
|||
{
|
||||
if (this->_mappedFramebuffer != NULL)
|
||||
{
|
||||
glUnmapBufferARB(GL_PIXEL_PACK_BUFFER_ARB);
|
||||
glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
|
||||
glFinish();
|
||||
}
|
||||
|
||||
glBufferDataARB(GL_PIXEL_PACK_BUFFER_ARB, newFramebufferColorSizeBytes, NULL, GL_STREAM_READ_ARB);
|
||||
glBufferData(GL_PIXEL_PACK_BUFFER, newFramebufferColorSizeBytes, NULL, GL_STREAM_READ);
|
||||
|
||||
if (this->_mappedFramebuffer != NULL)
|
||||
{
|
||||
this->_mappedFramebuffer = (Color4u8 *__restrict)glMapBufferARB(GL_PIXEL_PACK_BUFFER_ARB, GL_READ_ONLY_ARB);
|
||||
this->_mappedFramebuffer = (Color4u8 *__restrict)glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY);
|
||||
glFinish();
|
||||
}
|
||||
}
|
||||
|
||||
if (this->isShaderSupported || this->isFBOSupported)
|
||||
{
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + OGLTextureUnitID_FinalColor);
|
||||
glActiveTexture(GL_TEXTURE0 + OGLTextureUnitID_FinalColor);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)w, (GLsizei)h, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
|
||||
}
|
||||
|
||||
if (this->isFBOSupported)
|
||||
{
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + OGLTextureUnitID_DepthStencil);
|
||||
glActiveTexture(GL_TEXTURE0 + OGLTextureUnitID_DepthStencil);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8_EXT, (GLsizei)w, (GLsizei)h, 0, GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT, NULL);
|
||||
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + OGLTextureUnitID_GColor);
|
||||
glActiveTexture(GL_TEXTURE0 + OGLTextureUnitID_GColor);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)w, (GLsizei)h, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
|
||||
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + OGLTextureUnitID_GPolyID);
|
||||
glActiveTexture(GL_TEXTURE0 + OGLTextureUnitID_GPolyID);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)w, (GLsizei)h, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
|
||||
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + OGLTextureUnitID_FogAttr);
|
||||
glActiveTexture(GL_TEXTURE0 + OGLTextureUnitID_FogAttr);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)w, (GLsizei)h, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
|
||||
}
|
||||
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
|
||||
this->_framebufferWidth = w;
|
||||
this->_framebufferHeight = h;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2006 yopyop
|
||||
Copyright (C) 2006-2007 shash
|
||||
Copyright (C) 2008-2023 DeSmuME team
|
||||
Copyright (C) 2008-2024 DeSmuME team
|
||||
|
||||
This file is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -27,34 +27,79 @@
|
|||
#include "render3D.h"
|
||||
#include "types.h"
|
||||
|
||||
#ifndef OGLRENDER_3_2_H
|
||||
// OPENGL PLATFORM-SPECIFIC INCLUDES
|
||||
#if defined(__ANGLE__) || defined(__ANDROID__)
|
||||
#define OPENGL_VARIANT_ES
|
||||
#define _NO_SDL_TYPES
|
||||
#include <GLES3/gl3.h>
|
||||
#include <GLES3/gl3ext.h>
|
||||
#include <EGL/egl.h>
|
||||
//#include "opengl.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
// Ignore dynamic linking
|
||||
#define OGLEXT(procPtr, func)
|
||||
#define INITOGLEXT(procPtr, func)
|
||||
#define EXTERNOGLEXT(procPtr, func)
|
||||
#elif defined(__EMSCRIPTEN__)
|
||||
#define OPENGL_VARIANT_ES
|
||||
#include <SDL_opengl.h>
|
||||
#include <emscripten/emscripten.h>
|
||||
|
||||
// Ignore dynamic linking
|
||||
#define OGLEXT(procPtr, func)
|
||||
#define INITOGLEXT(procPtr, func)
|
||||
#define EXTERNOGLEXT(procPtr, func)
|
||||
#elif defined(_WIN32)
|
||||
#define OPENGL_VARIANT_STANDARD
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
#ifdef OGLRENDER_3_2_H
|
||||
#include <GL/glcorearb.h>
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glext.h>
|
||||
#endif
|
||||
|
||||
#define OGLEXT(procPtr, func) procPtr func = NULL;
|
||||
#define INITOGLEXT(procPtr, func) func = (procPtr)wglGetProcAddress(#func);
|
||||
#define EXTERNOGLEXT(procPtr, func) extern procPtr func;
|
||||
#elif defined(__APPLE__)
|
||||
#include <TargetConditionals.h>
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
#define OPENGL_VARIANT_ES
|
||||
#include <OpenGLES/ES3/gl.h>
|
||||
#include <OpenGLES/ES3/glext.h>
|
||||
#else
|
||||
#define OPENGL_VARIANT_STANDARD
|
||||
|
||||
#ifdef OGLRENDER_3_2_H
|
||||
#include <OpenGL/gl3.h>
|
||||
#include <OpenGL/gl3ext.h>
|
||||
#else
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glext.h>
|
||||
#endif
|
||||
|
||||
// Ignore dynamic linking on Apple OS
|
||||
#define OGLEXT(procPtr, func)
|
||||
#define INITOGLEXT(procPtr, func)
|
||||
#define EXTERNOGLEXT(procPtr, func)
|
||||
|
||||
// We're not exactly committing to OpenGL 3.2 Core Profile just yet, so redefine APPLE
|
||||
// extensions as a temporary measure.
|
||||
// Use Apple's extension function if the core function is not available
|
||||
#if defined(GL_APPLE_vertex_array_object) && !defined(GL_ARB_vertex_array_object)
|
||||
#define glGenVertexArrays(n, ids) glGenVertexArraysAPPLE(n, ids)
|
||||
#define glBindVertexArray(id) glBindVertexArrayAPPLE(id)
|
||||
#define glDeleteVertexArrays(n, ids) glDeleteVertexArraysAPPLE(n, ids)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Ignore dynamic linking
|
||||
#define OGLEXT(procPtr, func)
|
||||
#define INITOGLEXT(procPtr, func)
|
||||
#define EXTERNOGLEXT(procPtr, func)
|
||||
#else
|
||||
#define OPENGL_VARIANT_STANDARD
|
||||
|
||||
#ifdef OGLRENDER_3_2_H
|
||||
#include "utils/glcorearb.h"
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glext.h>
|
||||
#include <GL/glx.h>
|
||||
|
@ -63,6 +108,7 @@
|
|||
#ifndef GL_ALPHA_BLEND_EQUATION_ATI
|
||||
#undef GL_VERSION_1_3
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define OGLEXT(procPtr, func) procPtr func = NULL;
|
||||
#define INITOGLEXT(procPtr, func) func = (procPtr)glXGetProcAddress((const GLubyte *) #func);
|
||||
|
@ -70,38 +116,23 @@
|
|||
#endif
|
||||
|
||||
// Check minimum OpenGL header version
|
||||
#if !defined(GL_VERSION_2_1)
|
||||
#if defined(GL_VERSION_2_0)
|
||||
#warning Using OpenGL v2.0 headers with v2.1 overrides. Some features will be disabled.
|
||||
|
||||
#if !defined(GL_ARB_framebuffer_object)
|
||||
// Overrides for GL_EXT_framebuffer_blit
|
||||
#if !defined(GL_EXT_framebuffer_blit)
|
||||
#define GL_READ_FRAMEBUFFER_EXT GL_FRAMEBUFFER_EXT
|
||||
#define GL_DRAW_FRAMEBUFFER_EXT GL_FRAMEBUFFER_EXT
|
||||
#define glBlitFramebufferEXT(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter)
|
||||
#endif
|
||||
|
||||
// Overrides for GL_EXT_framebuffer_multisample
|
||||
#if !defined(GL_EXT_framebuffer_multisample)
|
||||
#define GL_MAX_SAMPLES_EXT 0
|
||||
#define glRenderbufferStorageMultisampleEXT(target, samples, internalformat, width, height)
|
||||
#endif
|
||||
|
||||
// Overrides for GL_ARB_pixel_buffer_object
|
||||
#if !defined(GL_PIXEL_PACK_BUFFER) && defined(GL_PIXEL_PACK_BUFFER_ARB)
|
||||
#define GL_PIXEL_PACK_BUFFER GL_PIXEL_PACK_BUFFER_ARB
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#if defined(OPENGL_VARIANT_STANDARD)
|
||||
#if !defined(GL_VERSION_2_1)
|
||||
#error OpenGL requires v2.1 headers or later.
|
||||
#endif
|
||||
#elif defined(OPENGL_VARIANT_ES)
|
||||
#if !defined(GL_ES_VERSION_3_0)
|
||||
#error OpenGL ES requires v3.0 headers or later.
|
||||
#endif
|
||||
#else
|
||||
#error Unknown OpenGL variant.
|
||||
#endif
|
||||
|
||||
// OPENGL LEGACY CORE FUNCTIONS
|
||||
|
||||
// Textures
|
||||
#if !defined(GLX_H)
|
||||
EXTERNOGLEXT(PFNGLACTIVETEXTUREPROC, glActiveTexture) // Core in v1.3
|
||||
EXTERNOGLEXT(PFNGLACTIVETEXTUREARBPROC, glActiveTextureARB)
|
||||
#endif
|
||||
|
||||
// Blending
|
||||
|
@ -111,9 +142,6 @@ EXTERNOGLEXT(PFNGLBLENDEQUATIONPROC, glBlendEquation) // Core in v1.2
|
|||
EXTERNOGLEXT(PFNGLBLENDFUNCSEPARATEPROC, glBlendFuncSeparate) // Core in v1.4
|
||||
EXTERNOGLEXT(PFNGLBLENDEQUATIONSEPARATEPROC, glBlendEquationSeparate) // Core in v2.0
|
||||
|
||||
EXTERNOGLEXT(PFNGLBLENDFUNCSEPARATEEXTPROC, glBlendFuncSeparateEXT)
|
||||
EXTERNOGLEXT(PFNGLBLENDEQUATIONSEPARATEEXTPROC, glBlendEquationSeparateEXT)
|
||||
|
||||
// Shaders
|
||||
EXTERNOGLEXT(PFNGLCREATESHADERPROC, glCreateShader) // Core in v2.0
|
||||
EXTERNOGLEXT(PFNGLSHADERSOURCEPROC, glShaderSource) // Core in v2.0
|
||||
|
@ -146,20 +174,7 @@ EXTERNOGLEXT(PFNGLENABLEVERTEXATTRIBARRAYPROC, glEnableVertexAttribArray) // Cor
|
|||
EXTERNOGLEXT(PFNGLDISABLEVERTEXATTRIBARRAYPROC, glDisableVertexAttribArray) // Core in v2.0
|
||||
EXTERNOGLEXT(PFNGLVERTEXATTRIBPOINTERPROC, glVertexAttribPointer) // Core in v2.0
|
||||
|
||||
// VAO
|
||||
EXTERNOGLEXT(PFNGLGENVERTEXARRAYSPROC, glGenVertexArrays)
|
||||
EXTERNOGLEXT(PFNGLDELETEVERTEXARRAYSPROC, glDeleteVertexArrays)
|
||||
EXTERNOGLEXT(PFNGLBINDVERTEXARRAYPROC, glBindVertexArray)
|
||||
|
||||
// VBO and PBO
|
||||
EXTERNOGLEXT(PFNGLGENBUFFERSARBPROC, glGenBuffersARB)
|
||||
EXTERNOGLEXT(PFNGLDELETEBUFFERSARBPROC, glDeleteBuffersARB)
|
||||
EXTERNOGLEXT(PFNGLBINDBUFFERARBPROC, glBindBufferARB)
|
||||
EXTERNOGLEXT(PFNGLBUFFERDATAARBPROC, glBufferDataARB)
|
||||
EXTERNOGLEXT(PFNGLBUFFERSUBDATAARBPROC, glBufferSubDataARB)
|
||||
EXTERNOGLEXT(PFNGLMAPBUFFERARBPROC, glMapBufferARB)
|
||||
EXTERNOGLEXT(PFNGLUNMAPBUFFERARBPROC, glUnmapBufferARB)
|
||||
|
||||
// Buffer Objects
|
||||
EXTERNOGLEXT(PFNGLGENBUFFERSPROC, glGenBuffers) // Core in v1.5
|
||||
EXTERNOGLEXT(PFNGLDELETEBUFFERSPROC, glDeleteBuffers) // Core in v1.5
|
||||
EXTERNOGLEXT(PFNGLBINDBUFFERPROC, glBindBuffer) // Core in v1.5
|
||||
|
@ -168,6 +183,71 @@ EXTERNOGLEXT(PFNGLBUFFERSUBDATAPROC, glBufferSubData) // Core in v1.5
|
|||
EXTERNOGLEXT(PFNGLMAPBUFFERPROC, glMapBuffer) // Core in v1.5
|
||||
EXTERNOGLEXT(PFNGLUNMAPBUFFERPROC, glUnmapBuffer) // Core in v1.5
|
||||
|
||||
// VAO (always available in Apple's implementation of OpenGL, including old versions)
|
||||
#if defined(__APPLE__) || defined(GL_VERSION_3_0) || defined(GL_ES_VERSION_3_0)
|
||||
EXTERNOGLEXT(PFNGLGENVERTEXARRAYSPROC, glGenVertexArrays) // Core in v3.0 and ES v3.0
|
||||
EXTERNOGLEXT(PFNGLDELETEVERTEXARRAYSPROC, glDeleteVertexArrays) // Core in v3.0 and ES v3.0
|
||||
EXTERNOGLEXT(PFNGLBINDVERTEXARRAYPROC, glBindVertexArray) // Core in v3.0 and ES v3.0
|
||||
#endif
|
||||
|
||||
// OPENGL CORE FUNCTIONS ADDED IN 3.2 CORE PROFILE AND VARIANTS
|
||||
#if defined(GL_VERSION_3_0) || defined(GL_ES_VERSION_3_0)
|
||||
|
||||
// Basic Functions
|
||||
EXTERNOGLEXT(PFNGLGETSTRINGIPROC, glGetStringi) // Core in v3.0 and ES v3.0
|
||||
EXTERNOGLEXT(PFNGLCLEARBUFFERFVPROC, glClearBufferfv) // Core in v3.0 and ES v3.0
|
||||
EXTERNOGLEXT(PFNGLCLEARBUFFERFIPROC, glClearBufferfi) // Core in v3.0 and ES v3.0
|
||||
|
||||
// Shaders
|
||||
#if !defined(GL_ES_VERSION_3_0)
|
||||
EXTERNOGLEXT(PFNGLBINDFRAGDATALOCATIONPROC, glBindFragDataLocation) // Core in v3.0, not available in ES
|
||||
EXTERNOGLEXT(PFNGLBINDFRAGDATALOCATIONINDEXEDPROC, glBindFragDataLocationIndexed) // Core in v3.3, not available in ES
|
||||
#endif
|
||||
|
||||
// Buffer Objects
|
||||
EXTERNOGLEXT(PFNGLMAPBUFFERRANGEPROC, glMapBufferRange) // Core in v3.0 and ES v3.0
|
||||
|
||||
// FBO
|
||||
EXTERNOGLEXT(PFNGLGENFRAMEBUFFERSPROC, glGenFramebuffers) // Core in v3.0 and ES v2.0
|
||||
EXTERNOGLEXT(PFNGLBINDFRAMEBUFFERPROC, glBindFramebuffer) // Core in v3.0 and ES v2.0
|
||||
EXTERNOGLEXT(PFNGLFRAMEBUFFERRENDERBUFFERPROC, glFramebufferRenderbuffer) // Core in v3.0 and ES v2.0
|
||||
EXTERNOGLEXT(PFNGLFRAMEBUFFERTEXTURE2DPROC, glFramebufferTexture2D) // Core in v3.0 and ES v2.0
|
||||
EXTERNOGLEXT(PFNGLCHECKFRAMEBUFFERSTATUSPROC, glCheckFramebufferStatus) // Core in v3.0 and ES v2.0
|
||||
EXTERNOGLEXT(PFNGLDELETEFRAMEBUFFERSPROC, glDeleteFramebuffers) // Core in v3.0 and ES v2.0
|
||||
EXTERNOGLEXT(PFNGLBLITFRAMEBUFFERPROC, glBlitFramebuffer) // Core in v3.0 and ES v3.0
|
||||
|
||||
// Multisampled FBO
|
||||
EXTERNOGLEXT(PFNGLGENRENDERBUFFERSPROC, glGenRenderbuffers) // Core in v3.0 and ES v2.0
|
||||
EXTERNOGLEXT(PFNGLBINDRENDERBUFFERPROC, glBindRenderbuffer) // Core in v3.0 and ES v2.0
|
||||
EXTERNOGLEXT(PFNGLRENDERBUFFERSTORAGEPROC, glRenderbufferStorage) // Core in v3.0 and ES v2.0
|
||||
EXTERNOGLEXT(PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC, glRenderbufferStorageMultisample) // Core in v3.0 and ES v3.0
|
||||
EXTERNOGLEXT(PFNGLDELETERENDERBUFFERSPROC, glDeleteRenderbuffers) // Core in v3.0 and ES v2.0
|
||||
#if !defined(GL_ES_VERSION_3_0)
|
||||
EXTERNOGLEXT(PFNGLTEXIMAGE2DMULTISAMPLEPROC, glTexImage2DMultisample) // Core in v3.2, not available in ES
|
||||
#endif
|
||||
|
||||
// UBO
|
||||
EXTERNOGLEXT(PFNGLGETUNIFORMBLOCKINDEXPROC, glGetUniformBlockIndex) // Core in v3.1 and ES v3.0
|
||||
EXTERNOGLEXT(PFNGLUNIFORMBLOCKBINDINGPROC, glUniformBlockBinding) // Core in v3.1 and ES v3.0
|
||||
EXTERNOGLEXT(PFNGLBINDBUFFERBASEPROC, glBindBufferBase) // Core in v3.0 and ES v3.0
|
||||
EXTERNOGLEXT(PFNGLGETACTIVEUNIFORMBLOCKIVPROC, glGetActiveUniformBlockiv) // Core in v3.1 and ES v3.0
|
||||
|
||||
// TBO
|
||||
#if defined(GL_VERSION_3_1) || defined(GL_ES_VERSION_3_2)
|
||||
EXTERNOGLEXT(PFNGLTEXBUFFERPROC, glTexBuffer) // Core in v3.1 and ES v3.2
|
||||
#endif
|
||||
|
||||
// Sync Objects
|
||||
EXTERNOGLEXT(PFNGLFENCESYNCPROC, glFenceSync) // Core in v3.2 and ES v3.0
|
||||
EXTERNOGLEXT(PFNGLWAITSYNCPROC, glWaitSync) // Core in v3.2 and ES v3.0
|
||||
EXTERNOGLEXT(PFNGLDELETESYNCPROC, glDeleteSync) // Core in v3.2 and ES v3.0
|
||||
|
||||
#endif // GL_VERSION_3_0 || GL_ES_VERSION_3_0
|
||||
|
||||
// OPENGL FBO EXTENSIONS
|
||||
// We need to include these explicitly for OpenGL legacy mode since the EXT versions of FBOs
|
||||
// may work differently than their ARB counterparts when running on older drivers.
|
||||
#if defined(GL_EXT_framebuffer_object)
|
||||
// FBO
|
||||
EXTERNOGLEXT(PFNGLGENFRAMEBUFFERSEXTPROC, glGenFramebuffersEXT)
|
||||
EXTERNOGLEXT(PFNGLBINDFRAMEBUFFEREXTPROC, glBindFramebufferEXT)
|
||||
|
@ -184,109 +264,45 @@ EXTERNOGLEXT(PFNGLRENDERBUFFERSTORAGEEXTPROC, glRenderbufferStorageEXT)
|
|||
EXTERNOGLEXT(PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC, glRenderbufferStorageMultisampleEXT)
|
||||
EXTERNOGLEXT(PFNGLDELETERENDERBUFFERSEXTPROC, glDeleteRenderbuffersEXT)
|
||||
|
||||
#else // OGLRENDER_3_2_H
|
||||
#elif defined(GL_ARB_framebuffer_object)
|
||||
// Most OpenGL variants don't have GL_EXT_framebuffer_object, so redeclare all the ARB versions
|
||||
// to their EXT versions to avoid compile time errors in OGLRender.cpp.
|
||||
//
|
||||
// In practice, class objects for more modern variants like 3.2 Core Profile and ES 3.0 should
|
||||
// override all the methods that would use FBOs so that only the ARB versions are actually used.
|
||||
|
||||
// Basic Functions
|
||||
EXTERNOGLEXT(PFNGLGETSTRINGIPROC, glGetStringi) // Core in v3.0
|
||||
EXTERNOGLEXT(PFNGLCLEARBUFFERFVPROC, glClearBufferfv) // Core in v3.0
|
||||
EXTERNOGLEXT(PFNGLCLEARBUFFERFIPROC, glClearBufferfi) // Core in v3.0
|
||||
#define GL_MAX_COLOR_ATTACHMENTS_EXT GL_MAX_COLOR_ATTACHMENTS
|
||||
#define GL_DEPTH24_STENCIL8_EXT GL_DEPTH24_STENCIL8
|
||||
#define GL_DEPTH_STENCIL_EXT GL_DEPTH_STENCIL
|
||||
#define GL_UNSIGNED_INT_24_8_EXT GL_UNSIGNED_INT_24_8
|
||||
#define GL_FRAMEBUFFER_EXT GL_FRAMEBUFFER
|
||||
#define GL_FRAMEBUFFER_COMPLETE_EXT GL_FRAMEBUFFER_COMPLETE
|
||||
#define GL_DEPTH_ATTACHMENT_EXT GL_DEPTH_ATTACHMENT
|
||||
#define GL_STENCIL_ATTACHMENT_EXT GL_STENCIL_ATTACHMENT
|
||||
#define GL_RENDERBUFFER_EXT GL_RENDERBUFFER
|
||||
#define GL_DRAW_FRAMEBUFFER_EXT GL_DRAW_FRAMEBUFFER
|
||||
#define GL_READ_FRAMEBUFFER_EXT GL_READ_FRAMEBUFFER
|
||||
#define GL_COLOR_ATTACHMENT0_EXT GL_COLOR_ATTACHMENT0
|
||||
#define GL_COLOR_ATTACHMENT1_EXT GL_COLOR_ATTACHMENT1
|
||||
#define GL_COLOR_ATTACHMENT2_EXT GL_COLOR_ATTACHMENT2
|
||||
#define GL_COLOR_ATTACHMENT3_EXT GL_COLOR_ATTACHMENT3
|
||||
#define GL_MAX_SAMPLES_EXT GL_MAX_SAMPLES
|
||||
|
||||
// Textures
|
||||
#if !defined(GLX_H)
|
||||
EXTERNOGLEXT(PFNGLACTIVETEXTUREPROC, glActiveTexture) // Core in v1.3
|
||||
#endif
|
||||
#define glGenFramebuffersEXT(n, framebuffers) glGenFramebuffers(n, framebuffers)
|
||||
#define glBindFramebufferEXT(target, framebuffer) glBindFramebuffer(target, framebuffer)
|
||||
#define glFramebufferRenderbufferEXT(target, attachment, renderbuffertarget, renderbuffer) glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer)
|
||||
#define glFramebufferTexture2DEXT(target, attachment, textarget, texture, level) glFramebufferTexture2D(target, attachment, textarget, texture, level)
|
||||
#define glCheckFramebufferStatusEXT(target) glCheckFramebufferStatus(target)
|
||||
#define glDeleteFramebuffersEXT(n, framebuffers) glDeleteFramebuffers(n, framebuffers)
|
||||
#define glBlitFramebufferEXT(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter) glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter)
|
||||
|
||||
// Blending
|
||||
#if !defined(GLX_H)
|
||||
EXTERNOGLEXT(PFNGLBLENDEQUATIONPROC, glBlendEquation) // Core in v1.2
|
||||
#endif
|
||||
EXTERNOGLEXT(PFNGLBLENDFUNCSEPARATEPROC, glBlendFuncSeparate) // Core in v1.4
|
||||
EXTERNOGLEXT(PFNGLBLENDEQUATIONSEPARATEPROC, glBlendEquationSeparate) // Core in v2.0
|
||||
#define glGenRenderbuffersEXT(n, renderbuffers) glGenRenderbuffers(n, renderbuffers)
|
||||
#define glBindRenderbufferEXT(target, renderbuffer) glBindRenderbuffer(target, renderbuffer)
|
||||
#define glRenderbufferStorageEXT(target, internalformat, width, height) glRenderbufferStorage(target, internalformat, width, height)
|
||||
#define glRenderbufferStorageMultisampleEXT(target, samples, internalformat, width, height) glRenderbufferStorageMultisample(target, samples, internalformat, width, height)
|
||||
#define glDeleteRenderbuffersEXT(n, renderbuffers) glDeleteRenderbuffers(n, renderbuffers)
|
||||
|
||||
// Shaders
|
||||
EXTERNOGLEXT(PFNGLCREATESHADERPROC, glCreateShader) // Core in v2.0
|
||||
EXTERNOGLEXT(PFNGLSHADERSOURCEPROC, glShaderSource) // Core in v2.0
|
||||
EXTERNOGLEXT(PFNGLCOMPILESHADERPROC, glCompileShader) // Core in v2.0
|
||||
EXTERNOGLEXT(PFNGLCREATEPROGRAMPROC, glCreateProgram) // Core in v2.0
|
||||
EXTERNOGLEXT(PFNGLATTACHSHADERPROC, glAttachShader) // Core in v2.0
|
||||
EXTERNOGLEXT(PFNGLDETACHSHADERPROC, glDetachShader) // Core in v2.0
|
||||
EXTERNOGLEXT(PFNGLLINKPROGRAMPROC, glLinkProgram) // Core in v2.0
|
||||
EXTERNOGLEXT(PFNGLUSEPROGRAMPROC, glUseProgram) // Core in v2.0
|
||||
EXTERNOGLEXT(PFNGLGETSHADERIVPROC, glGetShaderiv) // Core in v2.0
|
||||
EXTERNOGLEXT(PFNGLGETSHADERINFOLOGPROC, glGetShaderInfoLog) // Core in v2.0
|
||||
EXTERNOGLEXT(PFNGLDELETESHADERPROC, glDeleteShader) // Core in v2.0
|
||||
EXTERNOGLEXT(PFNGLDELETEPROGRAMPROC, glDeleteProgram) // Core in v2.0
|
||||
EXTERNOGLEXT(PFNGLGETPROGRAMIVPROC, glGetProgramiv) // Core in v2.0
|
||||
EXTERNOGLEXT(PFNGLGETPROGRAMINFOLOGPROC, glGetProgramInfoLog) // Core in v2.0
|
||||
EXTERNOGLEXT(PFNGLVALIDATEPROGRAMPROC, glValidateProgram) // Core in v2.0
|
||||
EXTERNOGLEXT(PFNGLGETUNIFORMLOCATIONPROC, glGetUniformLocation) // Core in v2.0
|
||||
EXTERNOGLEXT(PFNGLUNIFORM1IPROC, glUniform1i) // Core in v2.0
|
||||
EXTERNOGLEXT(PFNGLUNIFORM1IVPROC, glUniform1iv) // Core in v2.0
|
||||
EXTERNOGLEXT(PFNGLUNIFORM1FPROC, glUniform1f) // Core in v2.0
|
||||
EXTERNOGLEXT(PFNGLUNIFORM1FVPROC, glUniform1fv) // Core in v2.0
|
||||
EXTERNOGLEXT(PFNGLUNIFORM2FPROC, glUniform2f) // Core in v2.0
|
||||
EXTERNOGLEXT(PFNGLUNIFORM4FPROC, glUniform4f) // Core in v2.0
|
||||
EXTERNOGLEXT(PFNGLUNIFORM4FVPROC, glUniform4fv) // Core in v2.0
|
||||
EXTERNOGLEXT(PFNGLDRAWBUFFERSPROC, glDrawBuffers) // Core in v2.0
|
||||
|
||||
// Generic vertex attributes
|
||||
EXTERNOGLEXT(PFNGLBINDATTRIBLOCATIONPROC, glBindAttribLocation) // Core in v2.0
|
||||
EXTERNOGLEXT(PFNGLBINDFRAGDATALOCATIONPROC, glBindFragDataLocation) // Core in v3.0
|
||||
EXTERNOGLEXT(PFNGLBINDFRAGDATALOCATIONINDEXEDPROC, glBindFragDataLocationIndexed) // Core in v3.3
|
||||
EXTERNOGLEXT(PFNGLENABLEVERTEXATTRIBARRAYPROC, glEnableVertexAttribArray) // Core in v2.0
|
||||
EXTERNOGLEXT(PFNGLDISABLEVERTEXATTRIBARRAYPROC, glDisableVertexAttribArray) // Core in v2.0
|
||||
EXTERNOGLEXT(PFNGLVERTEXATTRIBPOINTERPROC, glVertexAttribPointer) // Core in v2.0
|
||||
|
||||
// VAO
|
||||
EXTERNOGLEXT(PFNGLGENVERTEXARRAYSPROC, glGenVertexArrays) // Core in v3.0
|
||||
EXTERNOGLEXT(PFNGLDELETEVERTEXARRAYSPROC, glDeleteVertexArrays) // Core in v3.0
|
||||
EXTERNOGLEXT(PFNGLBINDVERTEXARRAYPROC, glBindVertexArray) // Core in v3.0
|
||||
|
||||
// VBO and PBO
|
||||
EXTERNOGLEXT(PFNGLGENBUFFERSPROC, glGenBuffers) // Core in v1.5
|
||||
EXTERNOGLEXT(PFNGLDELETEBUFFERSPROC, glDeleteBuffers) // Core in v1.5
|
||||
EXTERNOGLEXT(PFNGLBINDBUFFERPROC, glBindBuffer) // Core in v1.5
|
||||
EXTERNOGLEXT(PFNGLBUFFERDATAPROC, glBufferData) // Core in v1.5
|
||||
EXTERNOGLEXT(PFNGLBUFFERSUBDATAPROC, glBufferSubData) // Core in v1.5
|
||||
EXTERNOGLEXT(PFNGLMAPBUFFERPROC, glMapBuffer) // Core in v1.5
|
||||
EXTERNOGLEXT(PFNGLUNMAPBUFFERPROC, glUnmapBuffer) // Core in v1.5
|
||||
|
||||
// Buffer Objects
|
||||
EXTERNOGLEXT(PFNGLMAPBUFFERRANGEPROC, glMapBufferRange) // Core in v3.0
|
||||
|
||||
// FBO
|
||||
EXTERNOGLEXT(PFNGLGENFRAMEBUFFERSPROC, glGenFramebuffers) // Core in v3.0
|
||||
EXTERNOGLEXT(PFNGLBINDFRAMEBUFFERPROC, glBindFramebuffer) // Core in v3.0
|
||||
EXTERNOGLEXT(PFNGLFRAMEBUFFERRENDERBUFFERPROC, glFramebufferRenderbuffer) // Core in v3.0
|
||||
EXTERNOGLEXT(PFNGLFRAMEBUFFERTEXTURE2DPROC, glFramebufferTexture2D) // Core in v3.0
|
||||
EXTERNOGLEXT(PFNGLCHECKFRAMEBUFFERSTATUSPROC, glCheckFramebufferStatus) // Core in v3.0
|
||||
EXTERNOGLEXT(PFNGLDELETEFRAMEBUFFERSPROC, glDeleteFramebuffers) // Core in v3.0
|
||||
EXTERNOGLEXT(PFNGLBLITFRAMEBUFFERPROC, glBlitFramebuffer) // Core in v3.0
|
||||
EXTERNOGLEXT(PFNGLDRAWBUFFERSPROC, glDrawBuffers) // Core in v2.0
|
||||
|
||||
// Multisampled FBO
|
||||
EXTERNOGLEXT(PFNGLGENRENDERBUFFERSPROC, glGenRenderbuffers) // Core in v3.0
|
||||
EXTERNOGLEXT(PFNGLBINDRENDERBUFFERPROC, glBindRenderbuffer) // Core in v3.0
|
||||
EXTERNOGLEXT(PFNGLRENDERBUFFERSTORAGEPROC, glRenderbufferStorage) // Core in v3.0
|
||||
EXTERNOGLEXT(PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC, glRenderbufferStorageMultisample) // Core in v3.0
|
||||
EXTERNOGLEXT(PFNGLDELETERENDERBUFFERSPROC, glDeleteRenderbuffers) // Core in v3.0
|
||||
EXTERNOGLEXT(PFNGLTEXIMAGE2DMULTISAMPLEPROC, glTexImage2DMultisample) // Core in v3.2
|
||||
|
||||
// UBO
|
||||
EXTERNOGLEXT(PFNGLGETUNIFORMBLOCKINDEXPROC, glGetUniformBlockIndex) // Core in v3.1
|
||||
EXTERNOGLEXT(PFNGLUNIFORMBLOCKBINDINGPROC, glUniformBlockBinding) // Core in v3.1
|
||||
EXTERNOGLEXT(PFNGLBINDBUFFERBASEPROC, glBindBufferBase) // Core in v3.0
|
||||
EXTERNOGLEXT(PFNGLGETACTIVEUNIFORMBLOCKIVPROC, glGetActiveUniformBlockiv) // Core in v3.1
|
||||
|
||||
// TBO
|
||||
EXTERNOGLEXT(PFNGLTEXBUFFERPROC, glTexBuffer) // Core in v3.1
|
||||
|
||||
// Sync Objects
|
||||
EXTERNOGLEXT(PFNGLFENCESYNCPROC, glFenceSync) // Core in v3.2
|
||||
EXTERNOGLEXT(PFNGLWAITSYNCPROC, glWaitSync) // Core in v3.2
|
||||
EXTERNOGLEXT(PFNGLDELETESYNCPROC, glDeleteSync) // Core in v3.2
|
||||
|
||||
#endif // OGLRENDER_3_2_H
|
||||
#endif // GL_EXT_framebuffer_object
|
||||
|
||||
// Define the minimum required OpenGL version for the driver to support
|
||||
#define OGLRENDER_MINIMUM_DRIVER_VERSION_REQUIRED_MAJOR 1
|
||||
|
@ -296,7 +312,7 @@ EXTERNOGLEXT(PFNGLDELETESYNCPROC, glDeleteSync) // Core in v3.2
|
|||
#define OGLRENDER_VERT_INDEX_BUFFER_COUNT (CLIPPED_POLYLIST_SIZE * 6)
|
||||
|
||||
// Assign the FBO attachments for the main geometry render
|
||||
#ifdef OGLRENDER_3_2_H
|
||||
#if defined(GL_VERSION_3_0) || defined(GL_ES_VERSION_3_0)
|
||||
#define GL_COLOROUT_ATTACHMENT_ID GL_COLOR_ATTACHMENT0
|
||||
#define GL_WORKING_ATTACHMENT_ID GL_COLOR_ATTACHMENT3
|
||||
#define GL_POLYID_ATTACHMENT_ID GL_COLOR_ATTACHMENT1
|
||||
|
@ -308,6 +324,14 @@ EXTERNOGLEXT(PFNGLDELETESYNCPROC, glDeleteSync) // Core in v3.2
|
|||
#define GL_FOGATTRIBUTES_ATTACHMENT_ID GL_COLOR_ATTACHMENT2_EXT
|
||||
#endif
|
||||
|
||||
enum OpenGLVariantID
|
||||
{
|
||||
OpenGLVariantID_Unknown = 0,
|
||||
OpenGLVariantID_Legacy = 1,
|
||||
OpenGLVariantID_CoreProfile_3_2 = 2,
|
||||
OpenGLVariantID_ES_3_0 = 3
|
||||
};
|
||||
|
||||
enum OGLVertexAttributeID
|
||||
{
|
||||
OGLVertexAttributeID_Position = 0,
|
||||
|
@ -324,7 +348,7 @@ enum OGLTextureUnitID
|
|||
OGLTextureUnitID_GPolyID,
|
||||
OGLTextureUnitID_FogAttr,
|
||||
OGLTextureUnitID_PolyStates,
|
||||
OGLTextureUnitID_LookupTable,
|
||||
OGLTextureUnitID_LookupTable
|
||||
};
|
||||
|
||||
enum OGLBindingPointID
|
||||
|
@ -712,6 +736,7 @@ protected:
|
|||
OGLRenderRef *ref;
|
||||
|
||||
// OpenGL Feature Support
|
||||
OpenGLVariantID _variantID;
|
||||
bool isVBOSupported;
|
||||
bool isPBOSupported;
|
||||
bool isFBOSupported;
|
||||
|
@ -932,4 +957,4 @@ public:
|
|||
virtual Render3DError RenderFlush(bool willFlushBuffer32, bool willFlushBuffer16);
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // OGLRENDER_H
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2006 yopyop
|
||||
Copyright (C) 2006-2007 shash
|
||||
Copyright (C) 2008-2023 DeSmuME team
|
||||
Copyright (C) 2008-2024 DeSmuME team
|
||||
|
||||
This file is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -33,87 +33,91 @@
|
|||
//------------------------------------------------------------
|
||||
|
||||
// Basic Functions
|
||||
OGLEXT(PFNGLGETSTRINGIPROC, glGetStringi) // Core in v3.0
|
||||
OGLEXT(PFNGLCLEARBUFFERFVPROC, glClearBufferfv) // Core in v3.0
|
||||
OGLEXT(PFNGLCLEARBUFFERFIPROC, glClearBufferfi) // Core in v3.0
|
||||
OGLEXT(PFNGLGETSTRINGIPROC, glGetStringi) // Core in v3.0 and ES v3.0
|
||||
OGLEXT(PFNGLCLEARBUFFERFVPROC, glClearBufferfv) // Core in v3.0 and ES v3.0
|
||||
OGLEXT(PFNGLCLEARBUFFERFIPROC, glClearBufferfi) // Core in v3.0 and ES v3.0
|
||||
|
||||
// Shaders
|
||||
OGLEXT(PFNGLBINDFRAGDATALOCATIONPROC, glBindFragDataLocation) // Core in v3.0
|
||||
OGLEXT(PFNGLBINDFRAGDATALOCATIONINDEXEDPROC, glBindFragDataLocationIndexed) // Core in v3.3
|
||||
OGLEXT(PFNGLBINDFRAGDATALOCATIONPROC, glBindFragDataLocation) // Core in v3.0, not available in ES
|
||||
OGLEXT(PFNGLBINDFRAGDATALOCATIONINDEXEDPROC, glBindFragDataLocationIndexed) // Core in v3.3, not available in ES
|
||||
|
||||
// Buffer Objects
|
||||
OGLEXT(PFNGLMAPBUFFERRANGEPROC, glMapBufferRange) // Core in v3.0
|
||||
OGLEXT(PFNGLMAPBUFFERRANGEPROC, glMapBufferRange) // Core in v3.0 and ES v3.0
|
||||
|
||||
// FBO
|
||||
OGLEXT(PFNGLGENFRAMEBUFFERSPROC, glGenFramebuffers) // Core in v3.0
|
||||
OGLEXT(PFNGLBINDFRAMEBUFFERPROC, glBindFramebuffer) // Core in v3.0
|
||||
OGLEXT(PFNGLFRAMEBUFFERRENDERBUFFERPROC, glFramebufferRenderbuffer) // Core in v3.0
|
||||
OGLEXT(PFNGLFRAMEBUFFERTEXTURE2DPROC, glFramebufferTexture2D) // Core in v3.0
|
||||
OGLEXT(PFNGLCHECKFRAMEBUFFERSTATUSPROC, glCheckFramebufferStatus) // Core in v3.0
|
||||
OGLEXT(PFNGLDELETEFRAMEBUFFERSPROC, glDeleteFramebuffers) // Core in v3.0
|
||||
OGLEXT(PFNGLBLITFRAMEBUFFERPROC, glBlitFramebuffer) // Core in v3.0
|
||||
OGLEXT(PFNGLGENRENDERBUFFERSPROC, glGenRenderbuffers) // Core in v3.0
|
||||
OGLEXT(PFNGLBINDRENDERBUFFERPROC, glBindRenderbuffer) // Core in v3.0
|
||||
OGLEXT(PFNGLRENDERBUFFERSTORAGEPROC, glRenderbufferStorage) // Core in v3.0
|
||||
OGLEXT(PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC, glRenderbufferStorageMultisample) // Core in v3.0
|
||||
OGLEXT(PFNGLDELETERENDERBUFFERSPROC, glDeleteRenderbuffers) // Core in v3.0
|
||||
OGLEXT(PFNGLTEXIMAGE2DMULTISAMPLEPROC, glTexImage2DMultisample) // Core in v3.2
|
||||
OGLEXT(PFNGLGENFRAMEBUFFERSPROC, glGenFramebuffers) // Core in v3.0 and ES v2.0
|
||||
OGLEXT(PFNGLBINDFRAMEBUFFERPROC, glBindFramebuffer) // Core in v3.0 and ES v2.0
|
||||
OGLEXT(PFNGLFRAMEBUFFERRENDERBUFFERPROC, glFramebufferRenderbuffer) // Core in v3.0 and ES v2.0
|
||||
OGLEXT(PFNGLFRAMEBUFFERTEXTURE2DPROC, glFramebufferTexture2D) // Core in v3.0 and ES v2.0
|
||||
OGLEXT(PFNGLCHECKFRAMEBUFFERSTATUSPROC, glCheckFramebufferStatus) // Core in v3.0 and ES v2.0
|
||||
OGLEXT(PFNGLDELETEFRAMEBUFFERSPROC, glDeleteFramebuffers) // Core in v3.0 and ES v2.0
|
||||
OGLEXT(PFNGLBLITFRAMEBUFFERPROC, glBlitFramebuffer) // Core in v3.0 and ES v3.0
|
||||
|
||||
// Multisampled FBO
|
||||
OGLEXT(PFNGLGENRENDERBUFFERSPROC, glGenRenderbuffers) // Core in v3.0 and ES v2.0
|
||||
OGLEXT(PFNGLBINDRENDERBUFFERPROC, glBindRenderbuffer) // Core in v3.0 and ES v2.0
|
||||
OGLEXT(PFNGLRENDERBUFFERSTORAGEPROC, glRenderbufferStorage) // Core in v3.0 and ES v2.0
|
||||
OGLEXT(PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC, glRenderbufferStorageMultisample) // Core in v3.0 and ES v3.0
|
||||
OGLEXT(PFNGLDELETERENDERBUFFERSPROC, glDeleteRenderbuffers) // Core in v3.0 and ES v2.0
|
||||
OGLEXT(PFNGLTEXIMAGE2DMULTISAMPLEPROC, glTexImage2DMultisample) // Core in v3.2, not available in ES
|
||||
|
||||
// UBO
|
||||
OGLEXT(PFNGLGETUNIFORMBLOCKINDEXPROC, glGetUniformBlockIndex) // Core in v3.1
|
||||
OGLEXT(PFNGLUNIFORMBLOCKBINDINGPROC, glUniformBlockBinding) // Core in v3.1
|
||||
OGLEXT(PFNGLBINDBUFFERBASEPROC, glBindBufferBase) // Core in v3.0
|
||||
OGLEXT(PFNGLGETACTIVEUNIFORMBLOCKIVPROC, glGetActiveUniformBlockiv) // Core in v3.1
|
||||
OGLEXT(PFNGLGETUNIFORMBLOCKINDEXPROC, glGetUniformBlockIndex) // Core in v3.1 and ES v3.0
|
||||
OGLEXT(PFNGLUNIFORMBLOCKBINDINGPROC, glUniformBlockBinding) // Core in v3.1 and ES v3.0
|
||||
OGLEXT(PFNGLBINDBUFFERBASEPROC, glBindBufferBase) // Core in v3.0 and ES v3.0
|
||||
OGLEXT(PFNGLGETACTIVEUNIFORMBLOCKIVPROC, glGetActiveUniformBlockiv) // Core in v3.1 and ES v3.0
|
||||
|
||||
// TBO
|
||||
OGLEXT(PFNGLTEXBUFFERPROC, glTexBuffer) // Core in v3.1
|
||||
OGLEXT(PFNGLTEXBUFFERPROC, glTexBuffer) // Core in v3.1 and ES v3.2
|
||||
|
||||
// Sync Objects
|
||||
OGLEXT(PFNGLFENCESYNCPROC, glFenceSync) // Core in v3.2
|
||||
OGLEXT(PFNGLWAITSYNCPROC, glWaitSync) // Core in v3.2
|
||||
OGLEXT(PFNGLDELETESYNCPROC, glDeleteSync) // Core in v3.2
|
||||
OGLEXT(PFNGLFENCESYNCPROC, glFenceSync) // Core in v3.2 and ES v3.0
|
||||
OGLEXT(PFNGLWAITSYNCPROC, glWaitSync) // Core in v3.2 and ES v3.0
|
||||
OGLEXT(PFNGLDELETESYNCPROC, glDeleteSync) // Core in v3.2 and ES v3.0
|
||||
|
||||
void OGLLoadEntryPoints_3_2()
|
||||
{
|
||||
// Basic Functions
|
||||
INITOGLEXT(PFNGLGETSTRINGIPROC, glGetStringi)
|
||||
INITOGLEXT(PFNGLCLEARBUFFERFVPROC, glClearBufferfv)
|
||||
INITOGLEXT(PFNGLCLEARBUFFERFIPROC, glClearBufferfi)
|
||||
INITOGLEXT(PFNGLGETSTRINGIPROC, glGetStringi) // Core in v3.0 and ES v3.0
|
||||
INITOGLEXT(PFNGLCLEARBUFFERFVPROC, glClearBufferfv) // Core in v3.0 and ES v3.0
|
||||
INITOGLEXT(PFNGLCLEARBUFFERFIPROC, glClearBufferfi) // Core in v3.0 and ES v3.0
|
||||
|
||||
// Shaders
|
||||
INITOGLEXT(PFNGLBINDFRAGDATALOCATIONPROC, glBindFragDataLocation)
|
||||
INITOGLEXT(PFNGLBINDFRAGDATALOCATIONPROC, glBindFragDataLocation) // Core in v3.0, not available in ES
|
||||
|
||||
// Buffer Objects
|
||||
INITOGLEXT(PFNGLMAPBUFFERRANGEPROC, glMapBufferRange)
|
||||
INITOGLEXT(PFNGLMAPBUFFERRANGEPROC, glMapBufferRange) // Core in v3.0 and ES v3.0
|
||||
|
||||
// FBO
|
||||
INITOGLEXT(PFNGLGENFRAMEBUFFERSPROC, glGenFramebuffers) // Promote to core version
|
||||
INITOGLEXT(PFNGLBINDFRAMEBUFFERPROC, glBindFramebuffer) // Promote to core version
|
||||
INITOGLEXT(PFNGLFRAMEBUFFERRENDERBUFFERPROC, glFramebufferRenderbuffer) // Promote to core version
|
||||
INITOGLEXT(PFNGLFRAMEBUFFERTEXTURE2DPROC, glFramebufferTexture2D) // Promote to core version
|
||||
INITOGLEXT(PFNGLCHECKFRAMEBUFFERSTATUSPROC, glCheckFramebufferStatus) // Promote to core version
|
||||
INITOGLEXT(PFNGLDELETEFRAMEBUFFERSPROC, glDeleteFramebuffers) // Promote to core version
|
||||
INITOGLEXT(PFNGLBLITFRAMEBUFFERPROC, glBlitFramebuffer) // Promote to core version
|
||||
INITOGLEXT(PFNGLGENRENDERBUFFERSPROC, glGenRenderbuffers) // Promote to core version
|
||||
INITOGLEXT(PFNGLBINDRENDERBUFFERPROC, glBindRenderbuffer) // Promote to core version
|
||||
INITOGLEXT(PFNGLRENDERBUFFERSTORAGEPROC, glRenderbufferStorage) // Promote to core version
|
||||
INITOGLEXT(PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC, glRenderbufferStorageMultisample) // Promote to core version
|
||||
INITOGLEXT(PFNGLDELETERENDERBUFFERSPROC, glDeleteRenderbuffers) // Promote to core version
|
||||
INITOGLEXT(PFNGLTEXIMAGE2DMULTISAMPLEPROC, glTexImage2DMultisample)
|
||||
INITOGLEXT(PFNGLGENFRAMEBUFFERSPROC, glGenFramebuffers) // Core in v3.0 and ES v2.0
|
||||
INITOGLEXT(PFNGLBINDFRAMEBUFFERPROC, glBindFramebuffer) // Core in v3.0 and ES v2.0
|
||||
INITOGLEXT(PFNGLFRAMEBUFFERRENDERBUFFERPROC, glFramebufferRenderbuffer) // Core in v3.0 and ES v2.0
|
||||
INITOGLEXT(PFNGLFRAMEBUFFERTEXTURE2DPROC, glFramebufferTexture2D) // Core in v3.0 and ES v2.0
|
||||
INITOGLEXT(PFNGLCHECKFRAMEBUFFERSTATUSPROC, glCheckFramebufferStatus) // Core in v3.0 and ES v2.0
|
||||
INITOGLEXT(PFNGLDELETEFRAMEBUFFERSPROC, glDeleteFramebuffers) // Core in v3.0 and ES v2.0
|
||||
INITOGLEXT(PFNGLBLITFRAMEBUFFERPROC, glBlitFramebuffer) // Core in v3.0 and ES v3.0
|
||||
|
||||
// Multisampled FBO
|
||||
INITOGLEXT(PFNGLGENRENDERBUFFERSPROC, glGenRenderbuffers) // Core in v3.0 and ES v2.0
|
||||
INITOGLEXT(PFNGLBINDRENDERBUFFERPROC, glBindRenderbuffer) // Core in v3.0 and ES v2.0
|
||||
INITOGLEXT(PFNGLRENDERBUFFERSTORAGEPROC, glRenderbufferStorage) // Core in v3.0 and ES v2.0
|
||||
INITOGLEXT(PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC, glRenderbufferStorageMultisample) // Core in v3.0 and ES v3.0
|
||||
INITOGLEXT(PFNGLDELETERENDERBUFFERSPROC, glDeleteRenderbuffers) // Core in v3.0 and ES v2.0
|
||||
INITOGLEXT(PFNGLTEXIMAGE2DMULTISAMPLEPROC, glTexImage2DMultisample) // Core in v3.2, not available in ES
|
||||
|
||||
// UBO
|
||||
INITOGLEXT(PFNGLGETUNIFORMBLOCKINDEXPROC, glGetUniformBlockIndex)
|
||||
INITOGLEXT(PFNGLUNIFORMBLOCKBINDINGPROC, glUniformBlockBinding)
|
||||
INITOGLEXT(PFNGLBINDBUFFERBASEPROC, glBindBufferBase)
|
||||
INITOGLEXT(PFNGLGETACTIVEUNIFORMBLOCKIVPROC, glGetActiveUniformBlockiv)
|
||||
INITOGLEXT(PFNGLGETUNIFORMBLOCKINDEXPROC, glGetUniformBlockIndex) // Core in v3.1 and ES v3.0
|
||||
INITOGLEXT(PFNGLUNIFORMBLOCKBINDINGPROC, glUniformBlockBinding) // Core in v3.1 and ES v3.0
|
||||
INITOGLEXT(PFNGLBINDBUFFERBASEPROC, glBindBufferBase) // Core in v3.0 and ES v3.0
|
||||
INITOGLEXT(PFNGLGETACTIVEUNIFORMBLOCKIVPROC, glGetActiveUniformBlockiv) // Core in v3.1 and ES v3.0
|
||||
|
||||
// TBO
|
||||
INITOGLEXT(PFNGLTEXBUFFERPROC, glTexBuffer)
|
||||
INITOGLEXT(PFNGLTEXBUFFERPROC, glTexBuffer) // Core in v3.1 and ES v3.2
|
||||
|
||||
// Sync Objects
|
||||
INITOGLEXT(PFNGLFENCESYNCPROC, glFenceSync) // Core in v3.2
|
||||
INITOGLEXT(PFNGLWAITSYNCPROC, glWaitSync) // Core in v3.2
|
||||
INITOGLEXT(PFNGLDELETESYNCPROC, glDeleteSync) // Core in v3.2
|
||||
INITOGLEXT(PFNGLFENCESYNCPROC, glFenceSync) // Core in v3.2 and ES v3.0
|
||||
INITOGLEXT(PFNGLWAITSYNCPROC, glWaitSync) // Core in v3.2 and ES v3.0
|
||||
INITOGLEXT(PFNGLDELETESYNCPROC, glDeleteSync) // Core in v3.2 and ES v3.0
|
||||
}
|
||||
|
||||
// Vertex shader for geometry, GLSL 1.50
|
||||
|
@ -611,6 +615,7 @@ void OGLCreateRenderer_3_2(OpenGLRenderer **rendererPtr)
|
|||
|
||||
OpenGLRenderer_3_2::OpenGLRenderer_3_2()
|
||||
{
|
||||
_variantID = OpenGLVariantID_CoreProfile_3_2;
|
||||
_is64kUBOSupported = false;
|
||||
_isDualSourceBlendingSupported = false;
|
||||
_isSampleShadingSupported = false;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2006 yopyop
|
||||
Copyright (C) 2006-2007 shash
|
||||
Copyright (C) 2008-2023 DeSmuME team
|
||||
Copyright (C) 2008-2024 DeSmuME team
|
||||
|
||||
This file is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -20,40 +20,6 @@
|
|||
#ifndef OGLRENDER_3_2_H
|
||||
#define OGLRENDER_3_2_H
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glext.h>
|
||||
#include <GL/glcorearb.h>
|
||||
|
||||
#define OGLEXT(procPtr, func) procPtr func = NULL;
|
||||
#define INITOGLEXT(procPtr, func) func = (procPtr)wglGetProcAddress(#func);
|
||||
#define EXTERNOGLEXT(procPtr, func) extern procPtr func;
|
||||
#elif defined(__APPLE__)
|
||||
#include <OpenGL/gl3.h>
|
||||
#include <OpenGL/gl3ext.h>
|
||||
|
||||
// Ignore dynamic linking on Apple OS
|
||||
#define OGLEXT(procPtr, func)
|
||||
#define INITOGLEXT(procPtr, func)
|
||||
#define EXTERNOGLEXT(procPtr, func)
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glext.h>
|
||||
#include <GL/glx.h>
|
||||
#include "utils/glcorearb.h"
|
||||
|
||||
#define OGLEXT(procPtr, func) procPtr func = NULL;
|
||||
#define INITOGLEXT(procPtr, func) func = (procPtr)glXGetProcAddress((const GLubyte *) #func);
|
||||
#define EXTERNOGLEXT(procPtr, func) extern procPtr func;
|
||||
#endif
|
||||
|
||||
// Check minimum OpenGL header version
|
||||
#if !defined(GL_VERSION_3_2)
|
||||
#error OpenGL requires v3.2 headers or later.
|
||||
#endif
|
||||
|
||||
#include "OGLRender.h"
|
||||
|
||||
#define MAX_CLIPPED_POLY_COUNT_FOR_UBO 16384
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (C) 2007 Pascal Giard (evilynux)
|
||||
Copyright (C) 2006-2021 DeSmuME team
|
||||
Copyright (C) 2006-2024 DeSmuME team
|
||||
|
||||
This file is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -76,7 +76,6 @@
|
|||
|
||||
#ifdef HAVE_OPENGL
|
||||
#include <GL/gl.h>
|
||||
#include "OGLRender.h"
|
||||
#include "OGLRender_3_2.h"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (C) 2009 Guillaume Duhamel
|
||||
Copyright (C) 2009-2017 DeSmuME team
|
||||
Copyright (C) 2009-2024 DeSmuME team
|
||||
|
||||
This file is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -20,7 +20,6 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <GL/osmesa.h>
|
||||
#include "../OGLRender.h"
|
||||
#include "../OGLRender_3_2.h"
|
||||
|
||||
#include "osmesa_3Demu.h"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (C) 2007 Pascal Giard (evilynux)
|
||||
Copyright (C) 2006-2021 DeSmuME team
|
||||
Copyright (C) 2006-2024 DeSmuME team
|
||||
|
||||
This file is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -72,7 +72,6 @@
|
|||
|
||||
#ifdef HAVE_OPENGL
|
||||
#include <GL/gl.h>
|
||||
#include "OGLRender.h"
|
||||
#include "OGLRender_3_2.h"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (C) 2009 Guillaume Duhamel
|
||||
Copyright (C) 2009-2017 DeSmuME team
|
||||
Copyright (C) 2009-2024 DeSmuME team
|
||||
|
||||
This file is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -20,7 +20,6 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <GL/osmesa.h>
|
||||
#include "../OGLRender.h"
|
||||
#include "../OGLRender_3_2.h"
|
||||
|
||||
#include "osmesa_3Demu.h"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
/*
|
||||
Copyright (C) 2006 Theo Berkau
|
||||
Copyright (C) 2006-2023 DeSmuME team
|
||||
Copyright (C) 2006-2024 DeSmuME team
|
||||
|
||||
This file is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -52,7 +52,6 @@
|
|||
#include "slot2.h"
|
||||
#include "GPU.h"
|
||||
#include "SPU.h"
|
||||
#include "OGLRender.h"
|
||||
#include "OGLRender_3_2.h"
|
||||
#include "rasterize.h"
|
||||
#include "gfx3d.h"
|
||||
|
|
Loading…
Reference in New Issue