mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
Adds names to GL shaders and programs.
This was SVN commit r26776.
This commit is contained in:
parent
eafdb2339d
commit
3db24af763
2 changed files with 18 additions and 6 deletions
|
|
@ -358,13 +358,13 @@ class CShaderProgramGLSL : public CShaderProgram
|
|||
{
|
||||
public:
|
||||
CShaderProgramGLSL(
|
||||
CDevice* device,
|
||||
CDevice* device, const CStr& name,
|
||||
const VfsPath& vertexFile, const VfsPath& fragmentFile,
|
||||
const CShaderDefines& defines,
|
||||
const std::map<CStrIntern, int>& vertexAttribs,
|
||||
int streamflags) :
|
||||
CShaderProgram(streamflags),
|
||||
m_Device(device),
|
||||
m_Device(device), m_Name(name),
|
||||
m_VertexFile(vertexFile), m_FragmentFile(fragmentFile),
|
||||
m_Defines(defines), m_VertexAttribs(vertexAttribs)
|
||||
{
|
||||
|
|
@ -376,6 +376,11 @@ public:
|
|||
m_FragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
m_FileDependencies = {m_VertexFile, m_FragmentFile};
|
||||
|
||||
#if !CONFIG2_GLES
|
||||
glObjectLabel(GL_SHADER, m_VertexShader, -1, vertexFile.string8().c_str());
|
||||
glObjectLabel(GL_SHADER, m_FragmentShader, -1, fragmentFile.string8().c_str());
|
||||
#endif
|
||||
|
||||
Load();
|
||||
}
|
||||
|
||||
|
|
@ -435,6 +440,10 @@ public:
|
|||
ENSURE(!m_Program);
|
||||
m_Program = glCreateProgram();
|
||||
|
||||
#if !CONFIG2_GLES
|
||||
glObjectLabel(GL_PROGRAM, m_Program, -1, m_Name.c_str());
|
||||
#endif
|
||||
|
||||
glAttachShader(m_Program, m_VertexShader);
|
||||
ogl_WarnIfError();
|
||||
glAttachShader(m_Program, m_FragmentShader);
|
||||
|
|
@ -806,6 +815,7 @@ public:
|
|||
private:
|
||||
CDevice* m_Device = nullptr;
|
||||
|
||||
CStr m_Name;
|
||||
VfsPath m_VertexFile;
|
||||
VfsPath m_FragmentFile;
|
||||
std::vector<VfsPath> m_FileDependencies;
|
||||
|
|
@ -981,7 +991,7 @@ std::unique_ptr<CShaderProgram> CShaderProgram::Create(CDevice* device, const CS
|
|||
}
|
||||
|
||||
if (root.GetAttributes().GetNamedItem(at_type) == "glsl")
|
||||
return CShaderProgram::ConstructGLSL(device, vertexFile, fragmentFile, defines, vertexAttribs, streamFlags);
|
||||
return CShaderProgram::ConstructGLSL(device, name, vertexFile, fragmentFile, defines, vertexAttribs, streamFlags);
|
||||
else
|
||||
return CShaderProgram::ConstructARB(device, vertexFile, fragmentFile, defines, vertexUniforms, fragmentUniforms, streamFlags);
|
||||
}
|
||||
|
|
@ -1013,12 +1023,13 @@ std::unique_ptr<CShaderProgram> CShaderProgram::ConstructARB(
|
|||
|
||||
// static
|
||||
std::unique_ptr<CShaderProgram> CShaderProgram::ConstructGLSL(
|
||||
CDevice* device, const VfsPath& vertexFile, const VfsPath& fragmentFile,
|
||||
CDevice* device, const CStr& name,
|
||||
const VfsPath& vertexFile, const VfsPath& fragmentFile,
|
||||
const CShaderDefines& defines,
|
||||
const std::map<CStrIntern, int>& vertexAttribs, int streamflags)
|
||||
{
|
||||
return std::make_unique<CShaderProgramGLSL>(
|
||||
device, vertexFile, fragmentFile, defines, vertexAttribs, streamflags);
|
||||
device, name, vertexFile, fragmentFile, defines, vertexAttribs, streamflags);
|
||||
}
|
||||
|
||||
int CShaderProgram::GetStreamFlags() const
|
||||
|
|
|
|||
|
|
@ -191,7 +191,8 @@ protected:
|
|||
* Construct based on GLSL vertex/fragment shader files.
|
||||
*/
|
||||
static std::unique_ptr<CShaderProgram> ConstructGLSL(
|
||||
CDevice* device, const VfsPath& vertexFile, const VfsPath& fragmentFile,
|
||||
CDevice* device, const CStr& name,
|
||||
const VfsPath& vertexFile, const VfsPath& fragmentFile,
|
||||
const CShaderDefines& defines,
|
||||
const std::map<CStrIntern, int>& vertexAttribs,
|
||||
int streamflags);
|
||||
|
|
|
|||
Loading…
Reference in a new issue