mirror of https://github.com/PCSX2/pcsx2.git
gsdx-ogl-wnd:
* remove an old&useles dummy geometry shader (was used to workaround amd bug) * use a basic X11 window for GSopen1 * redo the replayer: it is now based on dlopen rather than standard static/dynamic library. AMD driver doesn't play nicely with the later... git-svn-id: http://pcsx2.googlecode.com/svn/branches/gsdx-ogl-wnd@5639 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
5a0367f398
commit
49cd9fd97d
|
@ -222,31 +222,10 @@ endif(PACKAGE_MODE)
|
|||
################################### Replay Loader
|
||||
if(BUILD_REPLAY_LOADERS)
|
||||
set(Replay pcsx2_GSReplayLoader)
|
||||
set(Static GSdx-static)
|
||||
|
||||
# We can have separate option for gsdx inside the player. It will only
|
||||
# cost a 2nd rebuild of gsdx...
|
||||
#add_definitions(${CommonFlags} ${OptimizationFlags} -W)
|
||||
|
||||
add_library(${Static} STATIC ${GSdxSources} ${GSdxHeaders})
|
||||
|
||||
add_executable(${Replay} linux_replay.cpp)
|
||||
|
||||
target_link_libraries(${Static} ${OPENGL_LIBRARIES})
|
||||
if(EGL_API AND EGL_FOUND AND EGL_GL_CONTEXT_SUPPORT)
|
||||
target_link_libraries(${Static} ${EGL_LIBRARIES})
|
||||
endif()
|
||||
target_link_libraries(${Static} ${X11_LIBRARIES})
|
||||
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})
|
||||
if(EGL_API AND EGL_FOUND AND EGL_GL_CONTEXT_SUPPORT)
|
||||
target_link_libraries(${Replay} ${EGL_LIBRARIES})
|
||||
endif()
|
||||
target_link_libraries(${Replay} ${X11_LIBRARIES})
|
||||
target_link_libraries(${Replay} ${GTK2_LIBRARIES})
|
||||
target_link_libraries(${Replay} ${LIBC_LIBRARIES})
|
||||
|
||||
if(NOT USER_CMAKE_LD_FLAGS STREQUAL "")
|
||||
target_link_libraries(${Replay} "${USER_CMAKE_LD_FLAGS}")
|
||||
|
|
|
@ -216,7 +216,6 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
|
|||
// convert
|
||||
// ****************************************************************
|
||||
CompileShaderFromSource("convert.glsl", "vs_main", GL_VERTEX_SHADER, &m_convert.vs, convert_glsl);
|
||||
CompileShaderFromSource("convert.glsl", "gs_main", GL_GEOMETRY_SHADER, &m_convert.gs, convert_glsl);
|
||||
for(uint32 i = 0; i < countof(m_convert.ps); i++)
|
||||
CompileShaderFromSource("convert.glsl", format("ps_main%d", i), GL_FRAGMENT_SHADER, &m_convert.ps[i], convert_glsl);
|
||||
|
||||
|
|
|
@ -504,7 +504,6 @@ class GSDeviceOGL : public GSDevice
|
|||
GLuint ps[8]; // program object
|
||||
GLuint ln; // sampler object
|
||||
GLuint pt; // sampler object
|
||||
GLuint gs;
|
||||
GSDepthStencilOGL* dss;
|
||||
GSBlendStateOGL* bs;
|
||||
} m_convert;
|
||||
|
|
|
@ -172,6 +172,7 @@ bool GSWndEGL::Create(const string& title, int w, int h)
|
|||
// note this part must be only executed when replaying .gs debug file
|
||||
m_NativeDisplay = XOpenDisplay(NULL);
|
||||
|
||||
#if 0
|
||||
int attrListDbl[] = { GLX_RGBA, GLX_DOUBLEBUFFER,
|
||||
GLX_RED_SIZE, 8,
|
||||
GLX_GREEN_SIZE, 8,
|
||||
|
@ -195,8 +196,12 @@ bool GSWndEGL::Create(const string& title, int w, int h)
|
|||
0 , 0 , w, h, 0, vi->depth, InputOutput, vi->visual,
|
||||
CWBorderPixel | CWColormap | CWEventMask, &attr);
|
||||
|
||||
XMapWindow (m_NativeDisplay, m_NativeWindow);
|
||||
XFree(vi);
|
||||
#else
|
||||
m_NativeWindow = XCreateSimpleWindow(m_NativeDisplay, DefaultRootWindow(m_NativeDisplay), 0, 0, w, h, 0, 0, 0);
|
||||
#endif
|
||||
|
||||
XMapWindow (m_NativeDisplay, m_NativeWindow);
|
||||
|
||||
if (!CreateContext(3, 3)) return false;
|
||||
|
||||
|
|
|
@ -57,13 +57,13 @@ bool GSWndOGL::CreateContext(int major, int minor)
|
|||
None
|
||||
};
|
||||
|
||||
PFNGLXCHOOSEFBCONFIGPROC glXChooseFBConfig = (PFNGLXCHOOSEFBCONFIGPROC) glXGetProcAddress((GLubyte *) "glXChooseFBConfig");
|
||||
PFNGLXCHOOSEFBCONFIGPROC glX_ChooseFBConfig = (PFNGLXCHOOSEFBCONFIGPROC) glXGetProcAddress((GLubyte *) "glXChooseFBConfig");
|
||||
int fbcount = 0;
|
||||
GLXFBConfig *fbc = glXChooseFBConfig(m_NativeDisplay, DefaultScreen(m_NativeDisplay), attrListDbl, &fbcount);
|
||||
GLXFBConfig *fbc = glX_ChooseFBConfig(m_NativeDisplay, DefaultScreen(m_NativeDisplay), attrListDbl, &fbcount);
|
||||
if (!fbc || fbcount < 1) return false;
|
||||
|
||||
PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddress((const GLubyte*) "glXCreateContextAttribsARB");
|
||||
if (!glXCreateContextAttribsARB) return false;
|
||||
PFNGLXCREATECONTEXTATTRIBSARBPROC glX_CreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddress((const GLubyte*) "glXCreateContextAttribsARB");
|
||||
if (!glX_CreateContextAttribsARB) return false;
|
||||
|
||||
// Install a dummy handler to handle gracefully (aka not segfault) the support of GL version
|
||||
int (*oldHandler)(Display*, XErrorEvent*) = XSetErrorHandler(&ctxErrorHandler);
|
||||
|
@ -82,7 +82,7 @@ bool GSWndOGL::CreateContext(int major, int minor)
|
|||
None
|
||||
};
|
||||
|
||||
m_context = glXCreateContextAttribsARB(m_NativeDisplay, fbc[0], 0, true, context_attribs);
|
||||
m_context = glX_CreateContextAttribsARB(m_NativeDisplay, fbc[0], 0, true, context_attribs);
|
||||
|
||||
// Don't forget to reinstall the older Handler
|
||||
XSetErrorHandler(oldHandler);
|
||||
|
@ -174,6 +174,7 @@ bool GSWndOGL::Create(const string& title, int w, int h)
|
|||
// note this part must be only executed when replaying .gs debug file
|
||||
m_NativeDisplay = XOpenDisplay(NULL);
|
||||
|
||||
#if 0
|
||||
int attrListDbl[] = { GLX_RGBA, GLX_DOUBLEBUFFER,
|
||||
GLX_RED_SIZE, 8,
|
||||
GLX_GREEN_SIZE, 8,
|
||||
|
@ -197,13 +198,20 @@ bool GSWndOGL::Create(const string& title, int w, int h)
|
|||
0 , 0 , w, h, 0, vi->depth, InputOutput, vi->visual,
|
||||
CWBorderPixel | CWColormap | CWEventMask, &attr);
|
||||
|
||||
XMapWindow (m_NativeDisplay, m_NativeWindow);
|
||||
XFree(vi);
|
||||
#else
|
||||
m_NativeWindow = XCreateSimpleWindow(m_NativeDisplay, DefaultRootWindow(m_NativeDisplay), 0, 0, w, h, 0, 0, 0);
|
||||
#endif
|
||||
|
||||
XMapWindow (m_NativeDisplay, m_NativeWindow);
|
||||
|
||||
|
||||
if (!CreateContext(3, 3)) return false;
|
||||
|
||||
AttachContext();
|
||||
|
||||
CheckContext();
|
||||
|
||||
return (m_NativeWindow != 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,43 +19,63 @@
|
|||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include <dlfcn.h>
|
||||
|
||||
EXPORT_C GSsetSettingsDir(const char* dir);
|
||||
EXPORT_C GSReplay(char* lpszCmdLine, int renderer);
|
||||
//typedef void* (ReplaysetSettingsDir)(const char*);
|
||||
//typedef void* (ReplayReplay)(char*, int);
|
||||
|
||||
//ypedef void* (*GSsetSettingsDir)(const char* dir);
|
||||
//void (*GSReplay)(char* lpszCmdLine, int renderer);
|
||||
|
||||
void help()
|
||||
{
|
||||
fprintf(stderr, "Loader gs file\n");
|
||||
fprintf(stderr, "ARG1 Ini directory\n");
|
||||
fprintf(stderr, "ARG1 GSdx plugin\n");
|
||||
fprintf(stderr, "ARG2 .gs file\n");
|
||||
fprintf(stderr, "ARG3 Ini directory\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int main ( int argc, char *argv[] )
|
||||
{
|
||||
if ( argc == 3) {
|
||||
GSsetSettingsDir(argv[1]);
|
||||
GSReplay(argv[2], 12);
|
||||
} else if ( argc == 2) {
|
||||
#ifdef XDG_STD
|
||||
std::string home("HOME");
|
||||
char * val = getenv( home.c_str() );
|
||||
if (val == NULL) {
|
||||
fprintf(stderr, "Failed to get the home dir\n");
|
||||
help();
|
||||
}
|
||||
if (argc < 3) help();
|
||||
|
||||
std::string ini_dir(val);
|
||||
ini_dir += "/.config/pcsx2/inis";
|
||||
void *handle = dlopen(argv[1], RTLD_LAZY|RTLD_DEEPBIND);
|
||||
if (handle == NULL) {
|
||||
fprintf(stderr, "Failed to open plugin %s\n", argv[1]);
|
||||
help();
|
||||
}
|
||||
|
||||
GSsetSettingsDir(ini_dir.c_str());
|
||||
GSReplay(argv[1], 12);
|
||||
#else
|
||||
fprintf(stderr, "default ini dir only supported on XDG\n");
|
||||
help();
|
||||
#if 0
|
||||
ReplaysetSettingsDir GSsetSettingsDir_ptr;
|
||||
ReplayReplay GSReplay_ptr;
|
||||
#endif
|
||||
} else
|
||||
help();
|
||||
void (*GSsetSettingsDir_ptr)(const char*);
|
||||
void (*GSReplay_ptr)(char*, int);
|
||||
|
||||
*(void**)(&GSsetSettingsDir_ptr) = dlsym(handle, "GSsetSettingsDir");
|
||||
*(void**)(&GSReplay_ptr) = dlsym(handle, "GSReplay");
|
||||
|
||||
if ( argc == 4) {
|
||||
(void)GSsetSettingsDir_ptr(argv[3]);
|
||||
} else if ( argc == 3) {
|
||||
#ifdef XDG_STD
|
||||
std::string home("HOME");
|
||||
char * val = getenv( home.c_str() );
|
||||
if (val == NULL) {
|
||||
fprintf(stderr, "Failed to get the home dir\n");
|
||||
help();
|
||||
}
|
||||
|
||||
std::string ini_dir(val);
|
||||
ini_dir += "/.config/pcsx2/inis";
|
||||
|
||||
GSsetSettingsDir_ptr(ini_dir.c_str());
|
||||
#else
|
||||
fprintf(stderr, "default ini dir only supported on XDG\n");
|
||||
help();
|
||||
#endif
|
||||
}
|
||||
|
||||
GSReplay_ptr(argv[2], 12);
|
||||
}
|
||||
|
|
|
@ -37,39 +37,6 @@ void vs_main()
|
|||
|
||||
#endif
|
||||
|
||||
#ifdef GEOMETRY_SHADER
|
||||
in gl_PerVertex {
|
||||
vec4 gl_Position;
|
||||
float gl_PointSize;
|
||||
float gl_ClipDistance[];
|
||||
} gl_in[];
|
||||
|
||||
out gl_PerVertex {
|
||||
vec4 gl_Position;
|
||||
float gl_PointSize;
|
||||
float gl_ClipDistance[];
|
||||
};
|
||||
|
||||
// FIXME
|
||||
// AMD Driver bug again !!!!
|
||||
//layout(location = 0) in vertex GSin[];
|
||||
in vertex_basic GSin[];
|
||||
|
||||
layout(location = 0) out vertex_basic GSout;
|
||||
layout(triangles) in;
|
||||
layout(triangle_strip, max_vertices = 3) out;
|
||||
|
||||
void gs_main()
|
||||
{
|
||||
for(int i = 0; i < gl_in.length(); i++) {
|
||||
gl_Position = gl_in[i].gl_Position;
|
||||
GSout = GSin[i];
|
||||
EmitVertex();
|
||||
}
|
||||
EndPrimitive();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FRAGMENT_SHADER
|
||||
// NOTE: pixel can be clip with "discard"
|
||||
|
||||
|
|
|
@ -65,39 +65,6 @@ static const char* convert_glsl =
|
|||
"\n"
|
||||
"#endif\n"
|
||||
"\n"
|
||||
"#ifdef GEOMETRY_SHADER\n"
|
||||
"in gl_PerVertex {\n"
|
||||
" vec4 gl_Position;\n"
|
||||
" float gl_PointSize;\n"
|
||||
" float gl_ClipDistance[];\n"
|
||||
"} gl_in[];\n"
|
||||
"\n"
|
||||
"out gl_PerVertex {\n"
|
||||
" vec4 gl_Position;\n"
|
||||
" float gl_PointSize;\n"
|
||||
" float gl_ClipDistance[];\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"// FIXME\n"
|
||||
"// AMD Driver bug again !!!!\n"
|
||||
"//layout(location = 0) in vertex GSin[];\n"
|
||||
"in vertex_basic GSin[];\n"
|
||||
"\n"
|
||||
"layout(location = 0) out vertex_basic GSout;\n"
|
||||
"layout(triangles) in;\n"
|
||||
"layout(triangle_strip, max_vertices = 3) out;\n"
|
||||
"\n"
|
||||
"void gs_main()\n"
|
||||
"{\n"
|
||||
" for(int i = 0; i < gl_in.length(); i++) {\n"
|
||||
" gl_Position = gl_in[i].gl_Position;\n"
|
||||
" GSout = GSin[i];\n"
|
||||
" EmitVertex();\n"
|
||||
" }\n"
|
||||
" EndPrimitive();\n"
|
||||
"}\n"
|
||||
"#endif\n"
|
||||
"\n"
|
||||
"#ifdef FRAGMENT_SHADER\n"
|
||||
"// NOTE: pixel can be clip with \"discard\"\n"
|
||||
"\n"
|
||||
|
|
Loading…
Reference in New Issue