mirror of https://github.com/PCSX2/pcsx2.git
gsdx-ogl-wnd:
* Remove bad redefinition of glActiveTexture and glBlendColor pointer * Remove glew dependency on linux * s/OGL_DEBUG/ENABLE_OGL_DEBUG/ and enable it on debug git-svn-id: http://pcsx2.googlecode.com/svn/branches/gsdx-ogl-wnd@5512 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
fb9c4e5a61
commit
58cc2ddd1f
|
@ -18,7 +18,7 @@ set(CommonFlags
|
|||
-Wunused-variable
|
||||
-std=c++0x
|
||||
-fno-strict-aliasing
|
||||
#-DOGL_DEBUG # FIXME remove me when code is ready
|
||||
#-DENABLE_OGL_DEBUG # FIXME remove me when code is ready
|
||||
)
|
||||
|
||||
set(OptimizationFlags
|
||||
|
@ -28,7 +28,7 @@ set(OptimizationFlags
|
|||
|
||||
# Debug - Build
|
||||
if(CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
add_definitions(${CommonFlags} -DOGL_DEBUG -g -Wall)
|
||||
add_definitions(${CommonFlags} -DENABLE_OGL_DEBUG -g -Wall)
|
||||
endif(CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
|
||||
# Devel - Build
|
||||
|
@ -181,7 +181,6 @@ include_directories(.)
|
|||
add_library(${Output} SHARED ${GSdxSources} ${GSdxHeaders})
|
||||
|
||||
target_link_libraries(${Output} ${X11_LIBRARIES})
|
||||
target_link_libraries(${Output} ${GLEW_LIBRARY})
|
||||
target_link_libraries(${Output} ${OPENGL_LIBRARIES})
|
||||
|
||||
if(Linux)
|
||||
|
@ -221,14 +220,12 @@ if(BUILD_REPLAY_LOADERS)
|
|||
|
||||
target_link_libraries(${Static} ${OPENGL_LIBRARIES})
|
||||
target_link_libraries(${Static} ${X11_LIBRARIES})
|
||||
target_link_libraries(${Static} ${GLEW_LIBRARY})
|
||||
target_link_libraries(${Static} ${GTK2_LIBRARIES})
|
||||
|
||||
target_link_libraries(${Replay} ${Static})
|
||||
# Warning others lib must be linked after GSdx...
|
||||
target_link_libraries(${Replay} ${OPENGL_LIBRARIES})
|
||||
target_link_libraries(${Replay} ${X11_LIBRARIES})
|
||||
target_link_libraries(${Replay} ${GLEW_LIBRARY})
|
||||
target_link_libraries(${Replay} ${GTK2_LIBRARIES})
|
||||
|
||||
if(NOT USER_CMAKE_LD_FLAGS STREQUAL "")
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "stdafx.h"
|
||||
#include "GLLoader.h"
|
||||
|
||||
PFNGLACTIVETEXTUREPROC glActiveTexture = NULL;
|
||||
PFNGLATTACHSHADERPROC glAttachShader = NULL;
|
||||
PFNGLBINDBUFFERPROC glBindBuffer = NULL;
|
||||
PFNGLBINDBUFFERBASEPROC glBindBufferBase = NULL;
|
||||
|
@ -31,7 +30,6 @@ PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer = NULL;
|
|||
PFNGLBINDPROGRAMPIPELINEPROC glBindProgramPipeline = NULL;
|
||||
PFNGLBINDSAMPLERPROC glBindSampler = NULL;
|
||||
PFNGLBINDVERTEXARRAYPROC glBindVertexArray = NULL;
|
||||
PFNGLBLENDCOLORPROC glBlendColor = NULL;
|
||||
PFNGLBLENDEQUATIONSEPARATEPROC glBlendEquationSeparate = NULL;
|
||||
PFNGLBLENDFUNCSEPARATEPROC glBlendFuncSeparate = NULL;
|
||||
PFNGLBLITFRAMEBUFFERPROC glBlitFramebuffer = NULL;
|
||||
|
@ -110,7 +108,6 @@ namespace GLLoader {
|
|||
}
|
||||
|
||||
void init_gl_function() {
|
||||
GL_LOADFN(glActiveTexture);
|
||||
GL_LOADFN(glAttachShader);
|
||||
GL_LOADFN(glBindBuffer);
|
||||
GL_LOADFN(glBindBufferBase);
|
||||
|
@ -119,7 +116,6 @@ namespace GLLoader {
|
|||
GL_LOADFN(glBindProgramPipeline);
|
||||
GL_LOADFN(glBindSampler);
|
||||
GL_LOADFN(glBindVertexArray);
|
||||
GL_LOADFN(glBlendColor);
|
||||
GL_LOADFN(glBlendEquationSeparate);
|
||||
GL_LOADFN(glBlendFuncSeparate);
|
||||
GL_LOADFN(glBlitFramebuffer);
|
||||
|
|
|
@ -33,71 +33,67 @@
|
|||
fprintf(stderr,"Failed to find %s\n", #name); \
|
||||
} \
|
||||
}
|
||||
// Use glew
|
||||
//#define GL_LOADFN(name)
|
||||
#endif
|
||||
|
||||
extern PFNGLACTIVETEXTUREPROC glActiveTexture;
|
||||
extern PFNGLATTACHSHADERPROC glAttachShader;
|
||||
extern PFNGLBINDBUFFERPROC glBindBuffer;
|
||||
extern PFNGLBINDBUFFERBASEPROC glBindBufferBase;
|
||||
extern PFNGLBINDFRAGDATALOCATIONINDEXEDPROC glBindFragDataLocationIndexed;
|
||||
extern PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer;
|
||||
extern PFNGLBINDPROGRAMPIPELINEPROC glBindProgramPipeline;
|
||||
extern PFNGLBINDSAMPLERPROC glBindSampler;
|
||||
extern PFNGLBINDVERTEXARRAYPROC glBindVertexArray;
|
||||
extern PFNGLBLENDCOLORPROC glBlendColor;
|
||||
extern PFNGLBLENDEQUATIONSEPARATEPROC glBlendEquationSeparate;
|
||||
extern PFNGLBLENDFUNCSEPARATEPROC glBlendFuncSeparate;
|
||||
extern PFNGLBLITFRAMEBUFFERPROC glBlitFramebuffer;
|
||||
extern PFNGLBUFFERDATAPROC glBufferData;
|
||||
extern PFNGLCHECKFRAMEBUFFERSTATUSPROC glCheckFramebufferStatus;
|
||||
extern PFNGLCLEARBUFFERFVPROC glClearBufferfv;
|
||||
extern PFNGLCLEARBUFFERIVPROC glClearBufferiv;
|
||||
extern PFNGLCOMPILESHADERPROC glCompileShader;
|
||||
extern PFNGLCOPYIMAGESUBDATANVPROC glCopyImageSubDataNV;
|
||||
extern PFNGLCREATEPROGRAMPROC glCreateProgram;
|
||||
extern PFNGLCREATESHADERPROC glCreateShader;
|
||||
extern PFNGLCREATESHADERPROGRAMVPROC glCreateShaderProgramv;
|
||||
extern PFNGLDELETEBUFFERSPROC glDeleteBuffers;
|
||||
extern PFNGLDELETEFRAMEBUFFERSPROC glDeleteFramebuffers;
|
||||
extern PFNGLDELETEPROGRAMPROC glDeleteProgram;
|
||||
extern PFNGLDELETEPROGRAMPIPELINESPROC glDeleteProgramPipelines;
|
||||
extern PFNGLDELETESAMPLERSPROC glDeleteSamplers;
|
||||
extern PFNGLDELETESHADERPROC glDeleteShader;
|
||||
extern PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays;
|
||||
extern PFNGLDETACHSHADERPROC glDetachShader;
|
||||
extern PFNGLDRAWBUFFERSPROC glDrawBuffers;
|
||||
extern PFNGLDRAWELEMENTSBASEVERTEXPROC glDrawElementsBaseVertex;
|
||||
extern PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray;
|
||||
extern PFNGLFRAMEBUFFERRENDERBUFFERPROC glFramebufferRenderbuffer;
|
||||
extern PFNGLFRAMEBUFFERTEXTURE2DPROC glFramebufferTexture2D;
|
||||
extern PFNGLGENBUFFERSPROC glGenBuffers;
|
||||
extern PFNGLGENFRAMEBUFFERSPROC glGenFramebuffers;
|
||||
extern PFNGLGENPROGRAMPIPELINESPROC glGenProgramPipelines;
|
||||
extern PFNGLGENSAMPLERSPROC glGenSamplers;
|
||||
extern PFNGLGENVERTEXARRAYSPROC glGenVertexArrays;
|
||||
extern PFNGLGETBUFFERPARAMETERIVPROC glGetBufferParameteriv;
|
||||
extern PFNGLGETDEBUGMESSAGELOGARBPROC glGetDebugMessageLogARB;
|
||||
extern PFNGLGETFRAGDATAINDEXPROC glGetFragDataIndex;
|
||||
extern PFNGLGETFRAGDATALOCATIONPROC glGetFragDataLocation;
|
||||
extern PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog;
|
||||
extern PFNGLGETPROGRAMIVPROC glGetProgramiv;
|
||||
extern PFNGLGETSHADERIVPROC glGetShaderiv;
|
||||
extern PFNGLGETSTRINGIPROC glGetStringi;
|
||||
extern PFNGLISFRAMEBUFFERPROC glIsFramebuffer;
|
||||
extern PFNGLLINKPROGRAMPROC glLinkProgram;
|
||||
extern PFNGLMAPBUFFERPROC glMapBuffer;
|
||||
extern PFNGLMAPBUFFERRANGEPROC glMapBufferRange;
|
||||
extern PFNGLPROGRAMPARAMETERIPROC glProgramParameteri;
|
||||
extern PFNGLSAMPLERPARAMETERFPROC glSamplerParameterf;
|
||||
extern PFNGLSAMPLERPARAMETERIPROC glSamplerParameteri;
|
||||
extern PFNGLSHADERSOURCEPROC glShaderSource;
|
||||
extern PFNGLUNIFORM1IPROC glUniform1i;
|
||||
extern PFNGLUNMAPBUFFERPROC glUnmapBuffer;
|
||||
extern PFNGLUSEPROGRAMSTAGESPROC glUseProgramStages;
|
||||
extern PFNGLVERTEXATTRIBIPOINTERPROC glVertexAttribIPointer;
|
||||
extern PFNGLVERTEXATTRIBPOINTERPROC glVertexAttribPointer;
|
||||
extern PFNGLATTACHSHADERPROC glAttachShader;
|
||||
extern PFNGLBINDBUFFERPROC glBindBuffer;
|
||||
extern PFNGLBINDBUFFERBASEPROC glBindBufferBase;
|
||||
extern PFNGLBINDFRAGDATALOCATIONINDEXEDPROC glBindFragDataLocationIndexed;
|
||||
extern PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer;
|
||||
extern PFNGLBINDPROGRAMPIPELINEPROC glBindProgramPipeline;
|
||||
extern PFNGLBINDSAMPLERPROC glBindSampler;
|
||||
extern PFNGLBINDVERTEXARRAYPROC glBindVertexArray;
|
||||
extern PFNGLBLENDEQUATIONSEPARATEPROC glBlendEquationSeparate;
|
||||
extern PFNGLBLENDFUNCSEPARATEPROC glBlendFuncSeparate;
|
||||
extern PFNGLBLITFRAMEBUFFERPROC glBlitFramebuffer;
|
||||
extern PFNGLBUFFERDATAPROC glBufferData;
|
||||
extern PFNGLCHECKFRAMEBUFFERSTATUSPROC glCheckFramebufferStatus;
|
||||
extern PFNGLCLEARBUFFERFVPROC glClearBufferfv;
|
||||
extern PFNGLCLEARBUFFERIVPROC glClearBufferiv;
|
||||
extern PFNGLCOMPILESHADERPROC glCompileShader;
|
||||
extern PFNGLCOPYIMAGESUBDATANVPROC glCopyImageSubDataNV;
|
||||
extern PFNGLCREATEPROGRAMPROC glCreateProgram;
|
||||
extern PFNGLCREATESHADERPROC glCreateShader;
|
||||
extern PFNGLCREATESHADERPROGRAMVPROC glCreateShaderProgramv;
|
||||
extern PFNGLDELETEBUFFERSPROC glDeleteBuffers;
|
||||
extern PFNGLDELETEFRAMEBUFFERSPROC glDeleteFramebuffers;
|
||||
extern PFNGLDELETEPROGRAMPROC glDeleteProgram;
|
||||
extern PFNGLDELETEPROGRAMPIPELINESPROC glDeleteProgramPipelines;
|
||||
extern PFNGLDELETESAMPLERSPROC glDeleteSamplers;
|
||||
extern PFNGLDELETESHADERPROC glDeleteShader;
|
||||
extern PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays;
|
||||
extern PFNGLDETACHSHADERPROC glDetachShader;
|
||||
extern PFNGLDRAWBUFFERSPROC glDrawBuffers;
|
||||
extern PFNGLDRAWELEMENTSBASEVERTEXPROC glDrawElementsBaseVertex;
|
||||
extern PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray;
|
||||
extern PFNGLFRAMEBUFFERRENDERBUFFERPROC glFramebufferRenderbuffer;
|
||||
extern PFNGLFRAMEBUFFERTEXTURE2DPROC glFramebufferTexture2D;
|
||||
extern PFNGLGENBUFFERSPROC glGenBuffers;
|
||||
extern PFNGLGENFRAMEBUFFERSPROC glGenFramebuffers;
|
||||
extern PFNGLGENPROGRAMPIPELINESPROC glGenProgramPipelines;
|
||||
extern PFNGLGENSAMPLERSPROC glGenSamplers;
|
||||
extern PFNGLGENVERTEXARRAYSPROC glGenVertexArrays;
|
||||
extern PFNGLGETBUFFERPARAMETERIVPROC glGetBufferParameteriv;
|
||||
extern PFNGLGETDEBUGMESSAGELOGARBPROC glGetDebugMessageLogARB;
|
||||
extern PFNGLGETFRAGDATAINDEXPROC glGetFragDataIndex;
|
||||
extern PFNGLGETFRAGDATALOCATIONPROC glGetFragDataLocation;
|
||||
extern PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog;
|
||||
extern PFNGLGETPROGRAMIVPROC glGetProgramiv;
|
||||
extern PFNGLGETSHADERIVPROC glGetShaderiv;
|
||||
extern PFNGLGETSTRINGIPROC glGetStringi;
|
||||
extern PFNGLISFRAMEBUFFERPROC glIsFramebuffer;
|
||||
extern PFNGLLINKPROGRAMPROC glLinkProgram;
|
||||
extern PFNGLMAPBUFFERPROC glMapBuffer;
|
||||
extern PFNGLMAPBUFFERRANGEPROC glMapBufferRange;
|
||||
extern PFNGLPROGRAMPARAMETERIPROC glProgramParameteri;
|
||||
extern PFNGLSAMPLERPARAMETERFPROC glSamplerParameterf;
|
||||
extern PFNGLSAMPLERPARAMETERIPROC glSamplerParameteri;
|
||||
extern PFNGLSHADERSOURCEPROC glShaderSource;
|
||||
extern PFNGLUNIFORM1IPROC glUniform1i;
|
||||
extern PFNGLUNMAPBUFFERPROC glUnmapBuffer;
|
||||
extern PFNGLUSEPROGRAMSTAGESPROC glUseProgramStages;
|
||||
extern PFNGLVERTEXATTRIBIPOINTERPROC glVertexAttribIPointer;
|
||||
extern PFNGLVERTEXATTRIBPOINTERPROC glVertexAttribPointer;
|
||||
|
||||
namespace GLLoader {
|
||||
bool check_gl_version(uint32 major, uint32 minor);
|
||||
|
|
|
@ -460,7 +460,7 @@ EXPORT_C GSreadFIFO(uint8* mem)
|
|||
#ifdef ENABLE_OGL_MT_HACK
|
||||
// FIXME: double check which thread call this function
|
||||
// See fifo2 issue below
|
||||
#ifdef OGL_DEBUG
|
||||
#ifdef ENABLE_OGL_DEBUG
|
||||
if (theApp.GetConfig("renderer", 0) / 3 == 4) fprintf(stderr, "Disable FIFO1 on opengl\n");
|
||||
#endif
|
||||
s_gs->m_wnd->AttachContext();
|
||||
|
@ -484,7 +484,7 @@ EXPORT_C GSreadFIFO2(uint8* mem, uint32 size)
|
|||
#ifdef ENABLE_OGL_MT_HACK
|
||||
// FIXME called from EE core thread not MTGS which cause
|
||||
// invalidate data for opengl
|
||||
#ifdef OGL_DEBUG
|
||||
#ifdef ENABLE_OGL_DEBUG
|
||||
if (theApp.GetConfig("renderer", 0) / 3 == 4) fprintf(stderr, "Disable FIFO2(%d) on opengl\n", size);
|
||||
#endif
|
||||
s_gs->m_wnd->AttachContext();
|
||||
|
|
|
@ -52,7 +52,7 @@ GSDeviceOGL::GSDeviceOGL()
|
|||
memset(&m_state, 0, sizeof(m_state));
|
||||
|
||||
// Reset the debug file
|
||||
#ifdef OGL_DEBUG
|
||||
#ifdef ENABLE_OGL_DEBUG
|
||||
FILE* f = fopen("Debug.txt","w");
|
||||
fclose(f);
|
||||
#endif
|
||||
|
@ -462,7 +462,7 @@ void GSDeviceOGL::SetVSync(bool enable)
|
|||
void GSDeviceOGL::Flip()
|
||||
{
|
||||
// FIXME: disable it when code is working
|
||||
#ifdef OGL_DEBUG
|
||||
#ifdef ENABLE_OGL_DEBUG
|
||||
CheckDebugLog();
|
||||
#endif
|
||||
|
||||
|
@ -471,7 +471,7 @@ void GSDeviceOGL::Flip()
|
|||
#ifdef PRINT_FRAME_NUMBER
|
||||
fprintf(stderr, "Draw %d (Frame %d)\n", g_draw_count, g_frame_count);
|
||||
#endif
|
||||
#ifdef OGL_DEBUG
|
||||
#ifdef ENABLE_OGL_DEBUG
|
||||
if (theApp.GetConfig("debug_ogl_dump", 0) != 0)
|
||||
g_frame_count++;
|
||||
#endif
|
||||
|
@ -552,13 +552,13 @@ void GSDeviceOGL::DebugOutput()
|
|||
|
||||
void GSDeviceOGL::DrawPrimitive()
|
||||
{
|
||||
#ifdef OGL_DEBUG
|
||||
#ifdef ENABLE_OGL_DEBUG
|
||||
DebugInput();
|
||||
#endif
|
||||
|
||||
m_state.vb->DrawPrimitive();
|
||||
|
||||
#ifdef OGL_DEBUG
|
||||
#ifdef ENABLE_OGL_DEBUG
|
||||
DebugOutput();
|
||||
g_draw_count++;
|
||||
#endif
|
||||
|
@ -566,13 +566,13 @@ void GSDeviceOGL::DrawPrimitive()
|
|||
|
||||
void GSDeviceOGL::DrawIndexedPrimitive()
|
||||
{
|
||||
#ifdef OGL_DEBUG
|
||||
#ifdef ENABLE_OGL_DEBUG
|
||||
DebugInput();
|
||||
#endif
|
||||
|
||||
m_state.vb->DrawIndexedPrimitive();
|
||||
|
||||
#ifdef OGL_DEBUG
|
||||
#ifdef ENABLE_OGL_DEBUG
|
||||
DebugOutput();
|
||||
g_draw_count++;
|
||||
#endif
|
||||
|
@ -581,13 +581,13 @@ void GSDeviceOGL::DrawIndexedPrimitive()
|
|||
void GSDeviceOGL::DrawIndexedPrimitive(int offset, int count)
|
||||
{
|
||||
ASSERT(offset + count <= m_index.count);
|
||||
#ifdef OGL_DEBUG
|
||||
#ifdef ENABLE_OGL_DEBUG
|
||||
DebugInput();
|
||||
#endif
|
||||
|
||||
m_state.vb->DrawIndexedPrimitive(offset, count);
|
||||
|
||||
#ifdef OGL_DEBUG
|
||||
#ifdef ENABLE_OGL_DEBUG
|
||||
DebugOutput();
|
||||
g_draw_count++;
|
||||
#endif
|
||||
|
|
|
@ -81,7 +81,7 @@ class GSBufferOGL {
|
|||
}
|
||||
|
||||
bool Map(void** pointer, uint32 count ) {
|
||||
#ifdef OGL_DEBUG
|
||||
#ifdef ENABLE_OGL_DEBUG
|
||||
GLint b_size = -1;
|
||||
glGetBufferParameteriv(m_target, GL_BUFFER_SIZE, &b_size);
|
||||
|
||||
|
@ -114,7 +114,7 @@ class GSBufferOGL {
|
|||
// Upload the data to the buffer
|
||||
*pointer = (uint8*) glMapBufferRange(m_target, m_stride*m_start, m_stride*m_count, map_flags);
|
||||
//fprintf(stderr, "Map %x from %d to %d\n", *pointer, m_start, m_start+m_count);
|
||||
#ifdef OGL_DEBUG
|
||||
#ifdef ENABLE_OGL_DEBUG
|
||||
if (*pointer == NULL) {
|
||||
fprintf(stderr, "CRITICAL ERROR map failed for vb!!!\n");
|
||||
return false;
|
||||
|
|
|
@ -39,3 +39,6 @@
|
|||
//#define DISABLE_DATE
|
||||
|
||||
#define ENABLE_OGL_MT_HACK // OpenGL doesn't allow to access the same bound context from multiple threads. This hack changes context binding for GSreadFIFO* access
|
||||
#ifdef _DEBUG
|
||||
#define ENABLE_OGL_DEBUG // Create a debug context and check opengl command status. Allow also to dump various textures/states.
|
||||
#endif
|
||||
|
|
|
@ -207,10 +207,10 @@ using namespace std;
|
|||
//#include <ext/hash_map>
|
||||
//#include <ext/hash_set>
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glx.h>
|
||||
#include <GL/glext.h>
|
||||
#include "GLLoader.h"
|
||||
|
||||
//using namespace __gnu_cxx;
|
||||
|
||||
|
|
Loading…
Reference in New Issue