Fix isSRGB detection for EGL.

glBindFragDataLocation not allowed for gl_ outputs.
Fixes found when using Mesa.
This commit is contained in:
Michael Rennie
2017-05-15 10:16:07 +01:00
committed by Baldur Karlsson
parent 8b059987ad
commit 9ef362c28e
4 changed files with 12 additions and 5 deletions
+3
View File
@@ -2391,6 +2391,9 @@ void CopyProgramFragDataBindings(const GLHookSet &gl, GLuint progsrc, GLuint pro
if(refl->OutputSig[i].systemValue != ShaderBuiltin::ColorOutput)
continue;
if(!strncmp("gl_", refl->OutputSig[i].varName.elems, 3))
continue; // GL_INVALID_OPERATION if name starts with reserved gl_ prefix
GLint idx = gl.glGetFragDataLocation(progsrc, refl->OutputSig[i].varName.elems);
if(idx >= 0)
{
+1
View File
@@ -533,6 +533,7 @@ public:
void SetDriverType(RDCDriver type) { m_DriverType = type; }
bool isGLESMode() { return m_DriverType == RDC_OpenGLES; }
RDCDriver GetDriverType() { return m_DriverType; }
GLInitParams &GetInitParams() { return m_InitParams; }
void *GetCtx();
void SetFetchCounters(bool in) { m_FetchCounters = in; };
+7 -5
View File
@@ -435,12 +435,8 @@ __attribute__((visibility("default"))) EGLContext eglCreateContext(EGLDisplay di
init.depthBits = value;
eglhooks.eglGetConfigAttrib_real(display, config, EGL_STENCIL_SIZE, &value);
init.stencilBits = value;
// TODO: how to detect this?
#if ENABLED(RDOC_ANDROID)
// We will set isSRGB when we see the surface.
init.isSRGB = 0;
#else
init.isSRGB = 1;
#endif
GLWindowingData data;
data.egl_dpy = display;
@@ -509,6 +505,12 @@ __attribute__((visibility("default"))) EGLBoolean eglSwapBuffers(EGLDisplay dpy,
eglhooks.eglQuerySurface_real(dpy, surface, EGL_HEIGHT, &height);
eglhooks.eglQuerySurface_real(dpy, surface, EGL_WIDTH, &width);
GLInitParams &init = eglhooks.GetDriver()->GetInitParams();
int colorspace = 0;
eglhooks.eglQuerySurface_real(dpy, surface, EGL_GL_COLORSPACE, &colorspace);
// GL_SRGB8_ALPHA8 is specified as color-renderable, unlike GL_SRGB8.
init.isSRGB = init.colorBits == 32 && colorspace == EGL_GL_COLORSPACE_SRGB;
eglhooks.GetDriver()->SetDriverType(RDC_OpenGLES);
eglhooks.GetDriver()->WindowSize(surface, width, height);
eglhooks.GetDriver()->SwapBuffers(surface);
+1
View File
@@ -637,6 +637,7 @@ bool GLRenderState::CheckEnableDisableParam(GLenum pname)
case eGL_PROGRAM_POINT_SIZE:
case eGL_PRIMITIVE_RESTART:
case eGL_TEXTURE_CUBE_MAP_SEAMLESS:
case eGL_FRAMEBUFFER_SRGB:
// these are not supported by OpenGL ES
return false;