]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/program.cpp
Remove the misc.h header
[libs/gl.git] / source / core / program.cpp
index 9ed1e634ff4e6c0f214d3dd9aaeebec941d8cb23..8bec2f6f488295474804d641516b825de8ef309a 100644 (file)
@@ -19,7 +19,6 @@
 #include <msp/strings/format.h>
 #include "buffer.h"
 #include "error.h"
-#include "misc.h"
 #include "program.h"
 #include "resources.h"
 #include "glsl/compiler.h"
@@ -162,16 +161,18 @@ void Program::add_glsl_stages(const GlslModule &mod, const map<string, int> &spe
 void Program::compile_glsl_stage(unsigned stage_id)
 {
        glCompileShader(stage_id);
-       bool compiled = get_shader_i(stage_id, GL_COMPILE_STATUS);
+       int status = 0;
+       glGetShaderiv(stage_id, GL_COMPILE_STATUS, &status);
 
-       GLsizei info_log_len = get_shader_i(stage_id, GL_INFO_LOG_LENGTH);
+       int info_log_len = 0;
+       glGetShaderiv(stage_id, GL_INFO_LOG_LENGTH, &info_log_len);
        string info_log(info_log_len+1, 0);
        glGetShaderInfoLog(stage_id, info_log_len+1, &info_log_len, &info_log[0]);
        info_log.erase(info_log_len);
        if(module && module->get_format()==Module::GLSL)
                info_log = static_cast<const GlslModule *>(module)->get_source_map().translate_errors(info_log);
 
-       if(!compiled)
+       if(!status)
                throw compile_error(info_log);
 #ifdef DEBUG
        if(!info_log.empty())
@@ -240,9 +241,12 @@ void Program::link()
        attributes.clear();
 
        glLinkProgram(id);
-       linked = get_program_i(id, GL_LINK_STATUS);
+       int status = 0;
+       glGetProgramiv(id, GL_LINK_STATUS, &status);
+       linked = status;
 
-       GLsizei info_log_len = get_program_i(id, GL_INFO_LOG_LENGTH);
+       int info_log_len = 0;
+       glGetProgramiv(id, GL_INFO_LOG_LENGTH, &info_log_len);
        string info_log(info_log_len+1, 0);
        glGetProgramInfoLog(id, info_log_len+1, &info_log_len, &info_log[0]);
        info_log.erase(info_log_len);
@@ -304,7 +308,8 @@ void Program::link()
 
 void Program::query_uniforms()
 {
-       unsigned count = get_program_i(id, GL_ACTIVE_UNIFORMS);
+       unsigned count = 0;
+       glGetProgramiv(id, GL_ACTIVE_UNIFORMS, reinterpret_cast<int *>(&count));
        uniforms.reserve(count);
        vector<string> uniform_names(count);
        for(unsigned i=0; i<count; ++i)
@@ -364,7 +369,8 @@ void Program::query_uniforms()
 
 void Program::query_uniform_blocks(const vector<UniformInfo *> &uniforms_by_index)
 {
-       unsigned count = get_program_i(id, GL_ACTIVE_UNIFORM_BLOCKS);
+       unsigned count = 0;
+       glGetProgramiv(id, GL_ACTIVE_UNIFORM_BLOCKS, reinterpret_cast<int *>(&count));
        // Reserve an extra index for the default block
        uniform_blocks.reserve(count+1);
        for(unsigned i=0; i<count; ++i)
@@ -432,7 +438,8 @@ void Program::query_uniform_blocks(const vector<UniformInfo *> &uniforms_by_inde
 
 void Program::query_attributes()
 {
-       unsigned count = get_program_i(id, GL_ACTIVE_ATTRIBUTES);
+       unsigned count = 0;
+       glGetProgramiv(id, GL_ACTIVE_ATTRIBUTES, reinterpret_cast<int *>(&count));
        attributes.reserve(count);
        for(unsigned i=0; i<count; ++i)
        {