aboutsummaryrefslogtreecommitdiff
path: root/src/shader/wrap/compute_shader.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader/wrap/compute_shader.cc')
-rw-r--r--src/shader/wrap/compute_shader.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/shader/wrap/compute_shader.cc b/src/shader/wrap/compute_shader.cc
index 97ce52a..e91ba77 100644
--- a/src/shader/wrap/compute_shader.cc
+++ b/src/shader/wrap/compute_shader.cc
@@ -17,14 +17,23 @@ ComputeShader::Guard ComputeShader::use() const {
ComputeShader::ComputeShader(const std::string& src):
_id(glCreateProgram()) {
- glAttachShader(_id, util::compileShader(src, GL_COMPUTE_SHADER));
- glLinkProgram(_id);
+ GLint shader = util::compileShader(src, GL_COMPUTE_SHADER);
+
+ if ( shader != -1 ) {
+ glAttachShader(_id, shader);
+ glLinkProgram(_id);
+ _good = true;
+ }
}
ComputeShader::~ComputeShader() {
glDeleteProgram(_id);
}
+bool ComputeShader::isGood() const {
+ return _good;
+}
+
GLuint ComputeShader::setUniform(const std::string& name, float x, float y) const {
GLuint id = util::getUniform(_id, name);
glUniform2f(id, x, y);