Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
ogl: report shader compilation issues in the same way as other backends
  • Loading branch information
degasus committed May 4, 2013
1 parent 719f18a commit a295a3e
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp
Expand Up @@ -23,6 +23,7 @@ u32 ProgramShaderCache::s_ubo_buffer_size;
bool ProgramShaderCache::s_ubo_dirty;

static StreamBuffer *s_buffer;
static int num_failures = 0;

LinearDiskCache<SHADERUID, u8> g_program_disk_cache;
static GLuint CurrentProgram = 0;
Expand Down Expand Up @@ -287,11 +288,19 @@ bool ProgramShaderCache::CompileShader ( SHADER& shader, const char* vcode, cons
glGetProgramInfoLog(pid, length, &charsWritten, infoLog);
ERROR_LOG(VIDEO, "Program info log:\n%s", infoLog);
char szTemp[MAX_PATH];
sprintf(szTemp, "%sp_%d.txt", File::GetUserPath(D_DUMP_IDX).c_str(), pid);
sprintf(szTemp, "%sbad_p_%d.txt", File::GetUserPath(D_DUMP_IDX).c_str(), num_failures++);
std::ofstream file;
OpenFStream(file, szTemp, std::ios_base::out);
file << infoLog << s_glsl_header << vcode << s_glsl_header << pcode;
file.close();

PanicAlert("Failed to link shaders!\nThis usually happens when trying to use Dolphin with an outdated GPU or integrated GPU like the Intel GMA series.\n\nIf you're sure this is Dolphin's error anyway, post the contents of %s along with this error message at the forums.\n\nDebug info (%s, %s, %s):\n%s",
szTemp,
g_ogl_config.gl_vendor,
g_ogl_config.gl_renderer,
g_ogl_config.gl_version,
infoLog);

delete [] infoLog;
}
if (linkStatus != GL_TRUE)
Expand Down Expand Up @@ -328,11 +337,24 @@ GLuint ProgramShaderCache::CompileSingleShader (GLuint type, const char* code )
glGetShaderInfoLog(result, length, &charsWritten, infoLog);
ERROR_LOG(VIDEO, "PS Shader info log:\n%s", infoLog);
char szTemp[MAX_PATH];
sprintf(szTemp, "%sps_%d.txt", File::GetUserPath(D_DUMP_IDX).c_str(), result);
sprintf(szTemp,
"%sbad_%s_%04i.txt",
File::GetUserPath(D_DUMP_IDX).c_str(),
type==GL_VERTEX_SHADER ? "vs" : "ps",
num_failures++);
std::ofstream file;
OpenFStream(file, szTemp, std::ios_base::out);
file << infoLog << s_glsl_header << code;
file.close();

PanicAlert("Failed to compile %s shader!\nThis usually happens when trying to use Dolphin with an outdated GPU or integrated GPU like the Intel GMA series.\n\nIf you're sure this is Dolphin's error anyway, post the contents of %s along with this error message at the forums.\n\nDebug info (%s, %s, %s):\n%s",
type==GL_VERTEX_SHADER ? "vertex" : "pixel",
szTemp,
g_ogl_config.gl_vendor,
g_ogl_config.gl_renderer,
g_ogl_config.gl_version,
infoLog);

delete[] infoLog;
}
if (compileStatus != GL_TRUE)
Expand Down

0 comments on commit a295a3e

Please sign in to comment.