OGL: Remove unused ProgramShaderCache::CompileShader()
This commit is contained in:
parent
f8c1ba409c
commit
bbd1ae16db
|
@ -267,73 +267,6 @@ void ProgramShaderCache::UploadConstants(const void* data, u32 data_size)
|
|||
ADDSTAT(stats.thisFrame.bytesUniformStreamed, data_size);
|
||||
}
|
||||
|
||||
bool ProgramShaderCache::CompileShader(SHADER& shader, const std::string& vcode,
|
||||
const std::string& pcode, const std::string& gcode)
|
||||
{
|
||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||
if (g_ActiveConfig.iLog & CONF_SAVESHADERS)
|
||||
{
|
||||
static int counter = 0;
|
||||
std::string filename =
|
||||
StringFromFormat("%svs_%04i.txt", File::GetUserPath(D_DUMP_IDX).c_str(), counter++);
|
||||
SaveData(filename, vcode.c_str());
|
||||
|
||||
filename = StringFromFormat("%sps_%04i.txt", File::GetUserPath(D_DUMP_IDX).c_str(), counter++);
|
||||
SaveData(filename, pcode.c_str());
|
||||
|
||||
if (!gcode.empty())
|
||||
{
|
||||
filename =
|
||||
StringFromFormat("%sgs_%04i.txt", File::GetUserPath(D_DUMP_IDX).c_str(), counter++);
|
||||
SaveData(filename, gcode.c_str());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
shader.vsid = CompileSingleShader(GL_VERTEX_SHADER, vcode);
|
||||
shader.psid = CompileSingleShader(GL_FRAGMENT_SHADER, pcode);
|
||||
|
||||
// Optional geometry shader
|
||||
shader.gsid = 0;
|
||||
if (!gcode.empty())
|
||||
shader.gsid = CompileSingleShader(GL_GEOMETRY_SHADER, gcode);
|
||||
|
||||
if (!shader.vsid || !shader.psid || (!gcode.empty() && !shader.gsid))
|
||||
{
|
||||
shader.Destroy();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create and link the program.
|
||||
shader.glprogid = glCreateProgram();
|
||||
|
||||
glAttachShader(shader.glprogid, shader.vsid);
|
||||
glAttachShader(shader.glprogid, shader.psid);
|
||||
if (shader.gsid)
|
||||
glAttachShader(shader.glprogid, shader.gsid);
|
||||
|
||||
if (g_ActiveConfig.backend_info.bSupportsPipelineCacheData)
|
||||
glProgramParameteri(shader.glprogid, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRUE);
|
||||
|
||||
shader.SetProgramBindings(false);
|
||||
|
||||
glLinkProgram(shader.glprogid);
|
||||
|
||||
if (!CheckProgramLinkResult(shader.glprogid, vcode, pcode, gcode))
|
||||
{
|
||||
// Don't try to use this shader
|
||||
shader.Destroy();
|
||||
return false;
|
||||
}
|
||||
|
||||
// For drivers that don't support binding layout, we need to bind it here.
|
||||
shader.SetProgramVariables();
|
||||
|
||||
// Original shaders aren't needed any more.
|
||||
shader.DestroyShaders();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ProgramShaderCache::CompileComputeShader(SHADER& shader, const std::string& code)
|
||||
{
|
||||
// We need to enable GL_ARB_compute_shader for drivers that support the extension,
|
||||
|
|
|
@ -74,8 +74,6 @@ public:
|
|||
static void InvalidateVertexFormat();
|
||||
static void InvalidateLastProgram();
|
||||
|
||||
static bool CompileShader(SHADER& shader, const std::string& vcode, const std::string& pcode,
|
||||
const std::string& gcode = "");
|
||||
static bool CompileComputeShader(SHADER& shader, const std::string& code);
|
||||
static GLuint CompileSingleShader(GLenum type, const std::string& code);
|
||||
static bool CheckShaderCompileResult(GLuint id, GLenum type, const std::string& code);
|
||||
|
|
Loading…
Reference in New Issue