2013-07-06 10:08:52 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2011-2013 Gregory hainaut
|
|
|
|
* Copyright (C) 2007-2009 Gabest
|
|
|
|
*
|
|
|
|
* This Program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This Program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with GNU Make; see the file COPYING. If not, write to
|
|
|
|
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA USA.
|
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
class GSShaderOGL {
|
|
|
|
GLuint m_pipeline;
|
|
|
|
hash_map<uint64, GLuint > m_single_prog;
|
|
|
|
const bool m_debug_shader;
|
2013-10-24 20:54:27 +00:00
|
|
|
GLuint m_vs_sub_count;
|
|
|
|
GLuint m_ps_sub_count;
|
2013-07-06 10:08:52 +00:00
|
|
|
|
2013-10-24 20:54:27 +00:00
|
|
|
GLuint m_vs_sub[1];
|
|
|
|
GLuint m_ps_sub[5];
|
2013-07-06 10:08:52 +00:00
|
|
|
|
2013-08-17 08:57:52 +00:00
|
|
|
void SetupSubroutineUniform();
|
2013-07-07 16:13:11 +00:00
|
|
|
void SetupUniform();
|
2013-08-17 08:57:52 +00:00
|
|
|
void SetupRessources();
|
|
|
|
|
2013-07-06 10:08:52 +00:00
|
|
|
void SetUniformBinding(GLuint prog, GLchar* name, GLuint binding);
|
|
|
|
void SetSamplerBinding(GLuint prog, GLchar* name, GLuint binding);
|
|
|
|
|
|
|
|
bool ValidateShader(GLuint p);
|
|
|
|
bool ValidateProgram(GLuint p);
|
|
|
|
bool ValidatePipeline(GLuint p);
|
|
|
|
|
2013-07-07 16:13:11 +00:00
|
|
|
std::string GenGlslHeader(const std::string& entry, GLenum type, const std::string& macro);
|
2013-07-06 10:08:52 +00:00
|
|
|
GLuint LinkNewProgram();
|
|
|
|
|
|
|
|
public:
|
2014-02-01 11:11:14 +00:00
|
|
|
GSShaderOGL(bool debug);
|
2013-07-06 10:08:52 +00:00
|
|
|
~GSShaderOGL();
|
|
|
|
|
|
|
|
void GS(GLuint s);
|
2013-08-10 19:43:59 +00:00
|
|
|
void PS(GLuint s, GLuint sub_count = 0);
|
|
|
|
void PS_subroutine(GLuint *sub);
|
2013-08-17 08:57:52 +00:00
|
|
|
void PS_ressources(GLuint64 handle[2]);
|
2013-10-24 20:54:27 +00:00
|
|
|
void VS(GLuint s, GLuint sub_count = 0);
|
|
|
|
void VS_subroutine(GLuint *sub);
|
2013-07-06 10:08:52 +00:00
|
|
|
|
|
|
|
void UseProgram();
|
|
|
|
|
|
|
|
GLuint Compile(const std::string& glsl_file, const std::string& entry, GLenum type, const char* glsl_h_code, const std::string& macro_sel = "");
|
|
|
|
void Delete(GLuint s);
|
|
|
|
};
|