gsdx ogl: format GSShader code

Move the Geometry Shader to the call of the function
This commit is contained in:
Gregory Hainaut 2016-06-01 09:46:14 +02:00
parent 5672d2b39e
commit 405f312fe8
2 changed files with 9 additions and 10 deletions

View File

@ -420,7 +420,9 @@ void GSDeviceOGL::CreateTextureFX()
// Pre compile the (remaining) Geometry & Vertex Shader
for (uint32 key = 0; key < countof(m_gs); key++) {
GSSelector sel(key);
if (sel.point == sel.sprite)
if (!GLLoader::found_geometry_shader)
m_gs[key] = 0;
else if (sel.point == sel.sprite) // Invalid key
m_gs[key] = 0;
else
m_gs[key] = CompileGS(GSSelector(key));

View File

@ -56,23 +56,24 @@ GLuint GSShaderOGL::LinkPipeline(GLuint vs, GLuint gs, GLuint ps)
void GSShaderOGL::BindPipeline(GLuint vs, GLuint gs, GLuint ps)
{
BindPipeline(m_pipeline);
if (GLState::vs != vs)
{
if (GLState::vs != vs) {
GLState::vs = vs;
glUseProgramStages(m_pipeline, GL_VERTEX_SHADER_BIT, vs);
}
if (GLState::gs != gs)
{
if (GLState::gs != gs) {
GLState::gs = gs;
glUseProgramStages(m_pipeline, GL_GEOMETRY_SHADER_BIT, gs);
}
#ifdef _DEBUG
// In debug always sets the program. It allow to replace the program in apitrace easily.
if (true)
#else
if (GLState::ps != ps)
#endif
{
// In debug always sets the program. It allow to replace the program in apitrace easily.
GLState::ps = ps;
glUseProgramStages(m_pipeline, GL_FRAGMENT_SHADER_BIT, ps);
}
@ -180,10 +181,6 @@ GLuint GSShaderOGL::Compile(const std::string& glsl_file, const std::string& ent
GLuint program = 0;
if (type == GL_GEOMETRY_SHADER && !GLLoader::found_geometry_shader) {
return program;
}
// Note it is better to separate header and source file to have the good line number
// in the glsl compiler report
const int shader_nb = 3;