mirror of https://github.com/PCSX2/pcsx2.git
gsdx-gles: nvidia driver quick trial (only GLES3.0)
* Fix to create a 3.0 GLES context * set a default precision to fix most of shader compilation issue * Crash later because of GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT => need to test opensource driver
This commit is contained in:
parent
ca8c5b041d
commit
ea25d12405
|
@ -183,7 +183,9 @@ namespace GLLoader {
|
||||||
|
|
||||||
const char* vendor = (const char*)glGetString(GL_VENDOR);
|
const char* vendor = (const char*)glGetString(GL_VENDOR);
|
||||||
fprintf(stderr, "Supported Opengl version: %s on GPU: %s. Vendor: %s\n", s, glGetString(GL_RENDERER), vendor);
|
fprintf(stderr, "Supported Opengl version: %s on GPU: %s. Vendor: %s\n", s, glGetString(GL_RENDERER), vendor);
|
||||||
|
#ifndef ENABLE_GLES
|
||||||
fprintf(stderr, "Note: the maximal version supported by GSdx is 3.3 (even if you driver support more)!\n");
|
fprintf(stderr, "Note: the maximal version supported by GSdx is 3.3 (even if you driver support more)!\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
// Name change but driver is still bad!
|
// Name change but driver is still bad!
|
||||||
if (strstr(vendor, "ATI") || strstr(vendor, "Advanced Micro Devices"))
|
if (strstr(vendor, "ATI") || strstr(vendor, "Advanced Micro Devices"))
|
||||||
|
@ -222,10 +224,12 @@ namespace GLLoader {
|
||||||
#else
|
#else
|
||||||
found_geometry_shader = false;
|
found_geometry_shader = false;
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef ENABLE_GLES
|
||||||
if ( (major_gl < major) || ( major_gl == major && minor_gl < minor ) ) {
|
if ( (major_gl < major) || ( major_gl == major && minor_gl < minor ) ) {
|
||||||
fprintf(stderr, "OPENGL %d.%d is not supported\n", major, minor);
|
fprintf(stderr, "OPENGL %d.%d is not supported\n", major, minor);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -234,6 +238,7 @@ namespace GLLoader {
|
||||||
int max_ext = 0;
|
int max_ext = 0;
|
||||||
glGetIntegerv(GL_NUM_EXTENSIONS, &max_ext);
|
glGetIntegerv(GL_NUM_EXTENSIONS, &max_ext);
|
||||||
|
|
||||||
|
#ifndef ENABLE_GLES
|
||||||
if (gl_GetStringi && max_ext) {
|
if (gl_GetStringi && max_ext) {
|
||||||
for (GLint i = 0; i < max_ext; i++) {
|
for (GLint i = 0; i < max_ext; i++) {
|
||||||
string ext((const char*)gl_GetStringi(GL_EXTENSIONS, i));
|
string ext((const char*)gl_GetStringi(GL_EXTENSIONS, i));
|
||||||
|
@ -279,6 +284,7 @@ namespace GLLoader {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool status = true;
|
bool status = true;
|
||||||
#ifndef ENABLE_GLES
|
#ifndef ENABLE_GLES
|
||||||
|
|
|
@ -420,6 +420,7 @@ std::string GSShaderOGL::GenGlslHeader(const std::string& entry, GLenum type, co
|
||||||
// intel linux refuse to define it
|
// intel linux refuse to define it
|
||||||
#ifdef ENABLE_GLES
|
#ifdef ENABLE_GLES
|
||||||
header += "#define pGL_ES 1\n";
|
header += "#define pGL_ES 1\n";
|
||||||
|
header += "precision highp float;\n";
|
||||||
#else
|
#else
|
||||||
header += "#define pGL_ES 0\n";
|
header += "#define pGL_ES 0\n";
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -32,31 +32,28 @@ GSWndEGL::GSWndEGL()
|
||||||
void GSWndEGL::CreateContext(int major, int minor)
|
void GSWndEGL::CreateContext(int major, int minor)
|
||||||
{
|
{
|
||||||
EGLConfig eglConfig;
|
EGLConfig eglConfig;
|
||||||
EGLint numConfigs;
|
EGLint numConfigs = 0;
|
||||||
EGLint contextAttribs[] =
|
EGLint contextAttribs[] =
|
||||||
#ifdef ENABLE_GLES
|
|
||||||
{
|
|
||||||
EGL_CONTEXT_CLIENT_VERSION, 2,
|
|
||||||
EGL_NONE
|
|
||||||
};
|
|
||||||
#else
|
|
||||||
{
|
{
|
||||||
EGL_CONTEXT_MAJOR_VERSION_KHR, major,
|
EGL_CONTEXT_MAJOR_VERSION_KHR, major,
|
||||||
EGL_CONTEXT_MINOR_VERSION_KHR, minor,
|
EGL_CONTEXT_MINOR_VERSION_KHR, minor,
|
||||||
|
#ifndef ENABLE_GLES
|
||||||
#ifdef ENABLE_OGL_DEBUG
|
#ifdef ENABLE_OGL_DEBUG
|
||||||
EGL_CONTEXT_FLAGS_KHR, EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR,
|
EGL_CONTEXT_FLAGS_KHR, EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR,
|
||||||
#endif
|
#endif
|
||||||
EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR,
|
EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR,
|
||||||
|
#endif
|
||||||
EGL_NONE
|
EGL_NONE
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
EGLint NullContextAttribs[] = { EGL_NONE };
|
EGLint NullContextAttribs[] = { EGL_NONE };
|
||||||
EGLint attrList[] = {
|
EGLint attrList[] = {
|
||||||
EGL_RED_SIZE, 8,
|
EGL_RED_SIZE, 8,
|
||||||
EGL_GREEN_SIZE, 8,
|
EGL_GREEN_SIZE, 8,
|
||||||
EGL_BLUE_SIZE, 8,
|
EGL_BLUE_SIZE, 8,
|
||||||
EGL_DEPTH_SIZE, 24,
|
EGL_DEPTH_SIZE, 24,
|
||||||
|
#ifndef ENABLE_GLES
|
||||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
|
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
|
||||||
|
#endif
|
||||||
EGL_NONE
|
EGL_NONE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -64,7 +61,8 @@ void GSWndEGL::CreateContext(int major, int minor)
|
||||||
eglBindAPI(EGL_OPENGL_API);
|
eglBindAPI(EGL_OPENGL_API);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( !eglChooseConfig(m_eglDisplay, attrList, &eglConfig, 1, &numConfigs) )
|
eglChooseConfig(m_eglDisplay, attrList, &eglConfig, 1, &numConfigs);
|
||||||
|
if ( numConfigs == 0 )
|
||||||
{
|
{
|
||||||
fprintf(stderr,"EGL: Failed to get a frame buffer config!\n");
|
fprintf(stderr,"EGL: Failed to get a frame buffer config!\n");
|
||||||
throw GSDXRecoverableError();
|
throw GSDXRecoverableError();
|
||||||
|
@ -137,7 +135,12 @@ bool GSWndEGL::Attach(void* handle, bool managed)
|
||||||
m_NativeDisplay = XOpenDisplay(NULL);
|
m_NativeDisplay = XOpenDisplay(NULL);
|
||||||
OpenEGLDisplay();
|
OpenEGLDisplay();
|
||||||
|
|
||||||
|
#ifdef ENABLE_GLES
|
||||||
|
// FIXME: update it to GLES 3.1 when they support it
|
||||||
|
CreateContext(3, 0);
|
||||||
|
#else
|
||||||
CreateContext(3, 3);
|
CreateContext(3, 3);
|
||||||
|
#endif
|
||||||
|
|
||||||
AttachContext();
|
AttachContext();
|
||||||
|
|
||||||
|
@ -184,7 +187,12 @@ bool GSWndEGL::Create(const string& title, int w, int h)
|
||||||
m_NativeWindow = XCreateSimpleWindow(m_NativeDisplay, DefaultRootWindow(m_NativeDisplay), 0, 0, w, h, 0, 0, 0);
|
m_NativeWindow = XCreateSimpleWindow(m_NativeDisplay, DefaultRootWindow(m_NativeDisplay), 0, 0, w, h, 0, 0, 0);
|
||||||
XMapWindow (m_NativeDisplay, m_NativeWindow);
|
XMapWindow (m_NativeDisplay, m_NativeWindow);
|
||||||
|
|
||||||
|
#ifdef ENABLE_GLES
|
||||||
|
// FIXME: update it to GLES 3.1 when they support it
|
||||||
|
CreateContext(3, 0);
|
||||||
|
#else
|
||||||
CreateContext(3, 3);
|
CreateContext(3, 3);
|
||||||
|
#endif
|
||||||
|
|
||||||
AttachContext();
|
AttachContext();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue