Add a vendor check to avoid glGetProgramPipelineiv+GL_COMPUTE_SHADER

This commit is contained in:
baldurk
2014-12-14 12:17:42 +00:00
parent 7c663de948
commit 7d293ddd76
3 changed files with 30 additions and 3 deletions
+25
View File
@@ -215,6 +215,31 @@ void DoVendorChecks(const GLHookSet &gl, GLWindowingData context)
gl.glDeleteTextures(2, texs);
}
if(gl.glGetError && gl.glGenProgramPipelines && gl.glDeleteProgramPipelines && gl.glGetProgramPipelineiv)
{
GLuint pipe = 0;
gl.glGenProgramPipelines(1, &pipe);
// clear all error flags.
GLenum err = gl.glGetError();
while(err != eGL_NONE) err = gl.glGetError();
GLint dummy = 0;
gl.glGetProgramPipelineiv(pipe, eGL_COMPUTE_SHADER, &dummy);
err = gl.glGetError();
if(err != eGL_NONE)
{
// if we got an error trying to query that, we should enable this hack
VendorCheck[VendorCheck_AMD_pipeline_compute_query] = true;
RDCWARN("Using hack to avoid glGetProgramPipelineiv with GL_COMPUTE_SHADER");
}
gl.glDeleteProgramPipelines(1, &pipe);
}
// 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.
+1
View File
@@ -112,6 +112,7 @@ enum VendorCheckEnum
VendorCheck_EXT_vao_shared,
VendorCheck_AMD_polygon_mode_query,
VendorCheck_AMD_copy_compressed_tinymips,
VendorCheck_AMD_pipeline_compute_query,
VendorCheck_Count,
};
extern bool VendorCheck[VendorCheck_Count];
+4 -3
View File
@@ -130,20 +130,21 @@ void GLRenderState::FetchState(void *ctx, WrappedOpenGL *gl)
m_Real->glGetIntegerv(eGL_CURRENT_PROGRAM, (GLint *)&Program);
m_Real->glGetIntegerv(eGL_PROGRAM_PIPELINE_BINDING, (GLint *)&Pipeline);
GLenum shs[] = {
const GLenum shs[] = {
eGL_VERTEX_SHADER,
eGL_TESS_CONTROL_SHADER,
eGL_TESS_EVALUATION_SHADER,
eGL_GEOMETRY_SHADER,
eGL_FRAGMENT_SHADER,
eGL_COMPUTE_SHADER
VendorCheck[VendorCheck_AMD_pipeline_compute_query] ? eGL_NONE : eGL_COMPUTE_SHADER,
};
RDCCOMPILE_ASSERT(ARRAY_COUNT(shs) == ARRAY_COUNT(Subroutines), "Subroutine array not the right size");
for(size_t s=0; s < ARRAY_COUNT(shs); s++)
{
GLuint prog = Program;
if(prog == 0 && Pipeline != 0) m_Real->glGetProgramPipelineiv(Pipeline, shs[s], (GLint *)&prog);
if(prog == 0 && Pipeline != 0 && shs[s] != eGL_NONE)
m_Real->glGetProgramPipelineiv(Pipeline, shs[s], (GLint *)&prog);
if(prog == 0) continue;