Fix replay errors on android

Avoid executing non-GLES codes, and add checks for missing function
pointers.
This commit is contained in:
Janos Pantos
2017-04-13 15:04:48 +02:00
committed by Baldur Karlsson
parent 910501062b
commit 7f04526b39
6 changed files with 35 additions and 10 deletions
+16 -4
View File
@@ -510,7 +510,7 @@ void DoVendorChecks(const GLHookSet &gl, GLPlatform &platform, GLWindowingData c
// AMD throws an error if we try to copy the mips that are smaller than 4x4,
if(gl.glGetError && gl.glGenTextures && gl.glBindTexture && gl.glCopyImageSubData &&
gl.glTexStorage2D && gl.glTexSubImage2D && gl.glTexParameteri && gl.glDeleteTextures &&
HasExt[ARB_copy_image] && HasExt[ARB_texture_storage])
HasExt[ARB_copy_image] && HasExt[ARB_texture_storage] && !IsGLES)
{
GLuint texs[2];
gl.glGenTextures(2, texs);
@@ -645,8 +645,9 @@ void DoVendorChecks(const GLHookSet &gl, GLPlatform &platform, GLWindowingData c
// only do this when we have a proper context e.g. on windows where an old
// context is first created. Check to see if FBOs or VAOs are shared between
// contexts.
if(GLCoreVersion >= 32 && gl.glGenVertexArrays && gl.glBindVertexArray && gl.glDeleteVertexArrays &&
gl.glGenFramebuffers && gl.glBindFramebuffer && gl.glDeleteFramebuffers)
if((IsGLES || GLCoreVersion >= 32) && gl.glGenVertexArrays && gl.glBindVertexArray &&
gl.glDeleteVertexArrays && gl.glGenFramebuffers && gl.glBindFramebuffer &&
gl.glDeleteFramebuffers)
{
// gen & create an FBO and VAO
GLuint fbo = 0;
@@ -2218,7 +2219,18 @@ void CopyProgramFragDataBindings(const GLHookSet &gl, GLuint progsrc, GLuint pro
GLint idx = gl.glGetFragDataLocation(progsrc, refl->OutputSig[i].varName.elems);
if(idx >= 0)
gl.glBindFragDataLocation(progdst, (GLuint)idx, refl->OutputSig[i].varName.elems);
{
if(gl.glBindFragDataLocation)
{
gl.glBindFragDataLocation(progdst, (GLuint)idx, refl->OutputSig[i].varName.elems);
}
else
{
// glBindFragDataLocation is not core GLES, but it is in GL_EXT_blend_func_extended
// TODO what to do if that extension is not supported
RDCERR("glBindFragDataLocation is not supported!");
}
}
}
}
+1 -1
View File
@@ -326,7 +326,7 @@ extern bool IsGLES;
EXT_TO_CHECK(99, 99, EXT_polygon_offset_clamp) \
EXT_TO_CHECK(99, 99, EXT_raster_multisample) \
EXT_TO_CHECK(99, 30, EXT_texture_swizzle) \
EXT_TO_CHECK(99, 32, KHR_blend_equation_advanced_coherent) \
EXT_TO_CHECK(99, 99, KHR_blend_equation_advanced_coherent) \
/* OpenGL ES extensions */ \
EXT_TO_CHECK(99, 99, EXT_clip_cull_distance) \
EXT_TO_CHECK(99, 99, EXT_multisample_compatibility) \
+6 -2
View File
@@ -3736,11 +3736,15 @@ void WrappedOpenGL::ContextReplayLog(LogState readType, uint32_t startEventID, u
if(q == eGL_NONE)
break;
for(int j = 0; j < 8; j++)
int indices = IsGLES ? 1 : 8; // GLES does not support indices
for(int j = 0; j < indices; j++)
{
if(m_ActiveQueries[i][j])
{
m_Real.glEndQueryIndexed(q, j);
if(IsGLES)
m_Real.glEndQuery(q);
else
m_Real.glEndQueryIndexed(q, j);
m_ActiveQueries[i][j] = false;
}
}
+6 -2
View File
@@ -221,8 +221,8 @@ public:
Display *dpy = XOpenDisplay(NULL);
if(dpy == NULL)
return ret;
break;
#endif
break;
}
default: RDCERR("Unexpected window system %u", system); break;
}
@@ -435,8 +435,12 @@ __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?
// TODO: how to detect this?
#if ENABLED(RDOC_ANDROID)
init.isSRGB = 0;
#else
init.isSRGB = 1;
#endif
GLWindowingData data;
data.egl_dpy = display;
+4
View File
@@ -113,6 +113,10 @@ ReplayCreateStatus GLES_CreateReplayDevice(const char *logfile, IReplayDriver **
return status;
}
#if ENABLED(RDOC_ANDROID)
initParams.isSRGB = 0;
#endif
#if DISABLED(RDOC_ANDROID)
Display *dpy = XOpenDisplay(NULL);
+2 -1
View File
@@ -283,7 +283,8 @@ GLuint MakeSeparableShaderProgram(WrappedOpenGL &gl, GLenum type, vector<string>
gl.glGetProgramiv(sepProg, eGL_LINK_STATUS, &status);
// allow any vertex processing shader to redeclare gl_PerVertex
if(status == 0 && type != eGL_FRAGMENT_SHADER && type != eGL_COMPUTE_SHADER)
// on GLES it is not required
if(!IsGLES && status == 0 && type != eGL_FRAGMENT_SHADER && type != eGL_COMPUTE_SHADER)
{
gl.glDeleteProgram(sepProg);
sepProg = 0;