summaryrefslogtreecommitdiff
path: root/gfx/gl/glSource.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-11-03 19:47:46 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2022-11-03 19:48:31 +0000
commitc3eea71370eb94cff1fd96185458643fab6eb2c5 (patch)
treecb331dd81d9cb36d69e1b659353796ec170a78e4 /gfx/gl/glSource.cpp
parentRename Shader to SceneShader (diff)
downloadilt-c3eea71370eb94cff1fd96185458643fab6eb2c5.tar.bz2
ilt-c3eea71370eb94cff1fd96185458643fab6eb2c5.tar.xz
ilt-c3eea71370eb94cff1fd96185458643fab6eb2c5.zip
Restructure how shaders are worked with
Needs a tidy-up
Diffstat (limited to 'gfx/gl/glSource.cpp')
-rw-r--r--gfx/gl/glSource.cpp40
1 files changed, 0 insertions, 40 deletions
diff --git a/gfx/gl/glSource.cpp b/gfx/gl/glSource.cpp
deleted file mode 100644
index 962d096..0000000
--- a/gfx/gl/glSource.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-#include "glSource.h"
-#include <array>
-#include <stdexcept>
-#include <string>
-
-GLsource::ShaderRef
-GLsource::compile() const
-{
- ShaderRef id {type};
- glShaderSource(id, 1, &text, &len);
- glCompileShader(id);
-
- CheckShaderError(id, GL_COMPILE_STATUS, false, "Error compiling shader!");
- return id;
-}
-
-void
-GLsource::CheckShaderError(GLuint shader, GLuint flag, bool isProgram, std::string_view errorMessage)
-{
- GLint success = 0;
-
- if (isProgram) {
- glGetProgramiv(shader, flag, &success);
- }
- else {
- glGetShaderiv(shader, flag, &success);
- }
-
- if (success == GL_FALSE) {
- std::array<GLchar, 1024> error {};
- if (isProgram) {
- glGetProgramInfoLog(shader, error.size(), nullptr, error.data());
- }
- else {
- glGetShaderInfoLog(shader, error.size(), nullptr, error.data());
- }
-
- throw std::runtime_error {std::string {errorMessage} + ": '" + std::string {error.data(), error.size()} + "'"};
- }
-}