diff --git a/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp b/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp index c4162b54a0..36a8f054f5 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp @@ -296,7 +296,36 @@ void PixelShaderCache::SetCurrentShader(GLuint Shader) // GLSL Specific bool CompileGLSLPixelShader(FRAGMENTSHADER& ps, const char* pstrprogram) { - return false; + GLuint result = glCreateShader(GL_FRAGMENT_SHADER); + + glShaderSource(result, 1, &pstrprogram, NULL); + glCompileShader(result); + GLsizei length = 0; + + glGetShaderiv(result, GL_INFO_LOG_LENGTH, &length); + if (length > 0) + { + GLsizei charsWritten; + GLchar* infoLog = new GLchar[length]; + glGetShaderInfoLog(result, length, &charsWritten, infoLog); + WARN_LOG(VIDEO, "Shader info log:\n%s", infoLog); + delete[] infoLog; + } + + GLint compileStatus; + glGetShaderiv(result, GL_COMPILE_STATUS, &compileStatus); + if (compileStatus != GL_TRUE) + { + // Compile failed + ERROR_LOG(VIDEO, "Shader compilation failed; see info log"); + // Don't try to use this shader + glDeleteShader(result); + return false; + } + + (void)GL_REPORT_ERROR(); + ps.glprogid = result; + return true; } void PixelShaderCache::SetPSSampler(const char * name, unsigned int Tex) { diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderCache.cpp b/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderCache.cpp index eb4f56522e..f58e9eb786 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderCache.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderCache.cpp @@ -180,7 +180,36 @@ void VertexShaderCache::SetCurrentShader(GLuint Shader) // GLSL Specific bool CompileGLSLVertexShader(VERTEXSHADER& vs, const char* pstrprogram) { - return false; + GLuint result = glCreateShader(GL_VERTEX_SHADER); + + glShaderSource(result, 1, &pstrprogram, NULL); + glCompileShader(result); + GLsizei length = 0; + + glGetShaderiv(result, GL_INFO_LOG_LENGTH, &length); + if (length > 0) + { + GLsizei charsWritten; + GLchar* infoLog = new GLchar[length]; + glGetShaderInfoLog(result, length, &charsWritten, infoLog); + WARN_LOG(VIDEO, "Shader info log:\n%s", infoLog); + delete[] infoLog; + } + + GLint compileStatus; + glGetShaderiv(result, GL_COMPILE_STATUS, &compileStatus); + if (compileStatus != GL_TRUE) + { + // Compile failed + ERROR_LOG(VIDEO, "Shader compilation failed; see info log"); + // Don't try to use this shader + glDeleteShader(result); + return false; + } + + (void)GL_REPORT_ERROR(); + vs.glprogid = result; + return true; } void SetVSConstant4fvByName(const char * name, unsigned int offset, const float *f, const unsigned int count = 1) {