summaryrefslogtreecommitdiff
path: root/gfx/gl/shader.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-02-20 13:48:31 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-02-20 13:59:46 +0000
commitb95cf46bed86e4d0641f7862cfe550af2bc02d60 (patch)
tree2daf2998f6dc3ab6d8761674d8ac107674fc63b7 /gfx/gl/shader.cpp
parentm4 based GLSL embedding (diff)
downloadilt-b95cf46bed86e4d0641f7862cfe550af2bc02d60.tar.bz2
ilt-b95cf46bed86e4d0641f7862cfe550af2bc02d60.tar.xz
ilt-b95cf46bed86e4d0641f7862cfe550af2bc02d60.zip
Remove now redundent Shader::Source class
Moves compile functionality to GLsource.
Diffstat (limited to 'gfx/gl/shader.cpp')
-rw-r--r--gfx/gl/shader.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/gfx/gl/shader.cpp b/gfx/gl/shader.cpp
index badaaef..d4cb747 100644
--- a/gfx/gl/shader.cpp
+++ b/gfx/gl/shader.cpp
@@ -31,16 +31,16 @@ Shader::ProgramHandle::ProgramHandle(GLuint vs, GLuint fs) : viewProjection_unif
Shader::Shader() :
programs {{{
- Source {basicShader_vs}.id,
- Source {basicShader_fs}.id,
+ basicShader_vs.compile(),
+ basicShader_fs.compile(),
},
{
- Source {waterShader_vs}.id,
- Source {waterShader_fs}.id,
+ waterShader_vs.compile(),
+ waterShader_fs.compile(),
},
{
- Source {landmassShader_vs}.id,
- Source {landmassShader_fs}.id,
+ landmassShader_vs.compile(),
+ landmassShader_fs.compile(),
}}}
{
}
@@ -98,10 +98,13 @@ Shader::CheckShaderError(GLuint shader, GLuint flag, bool isProgram, std::string
}
}
-Shader::Source::Source(const GLsource src) : id {src.type}
+GLsource::ShaderRef
+GLsource::compile() const
{
- glShaderSource(id, 1, &src.text, &src.len);
+ ShaderRef id {type};
+ glShaderSource(id, 1, &text, &len);
glCompileShader(id);
- CheckShaderError(id, GL_COMPILE_STATUS, false, "Error compiling shader!");
+ Shader::CheckShaderError(id, GL_COMPILE_STATUS, false, "Error compiling shader!");
+ return id;
}