]> git.tdb.fi Git - libs/gl.git/commitdiff
Remove the misc.h header
authorMikko Rasa <tdb@tdb.fi>
Sun, 26 Sep 2021 11:22:26 +0000 (14:22 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 26 Sep 2021 11:23:35 +0000 (14:23 +0300)
It was mostly unused already.

source/core/clipplane.cpp
source/core/framebuffer.cpp
source/core/misc.cpp [deleted file]
source/core/misc.h [deleted file]
source/core/program.cpp
source/core/vertexsetup.cpp
source/effects/bloom.cpp
source/glsl/features.cpp
source/materials/light.cpp
source/materials/lighting.cpp

index b27464ca20249cffa5fe0c70affed87195ab3390..3e0d5f6602beef43d414f68d97076f09f7c5f4c7 100644 (file)
@@ -2,7 +2,6 @@
 #include "clipplane.h"
 #include "gl.h"
 #include "matrix.h"
-#include "misc.h"
 #include "programdata.h"
 
 namespace Msp {
index 01a4107494387cac61ce8c46e90dd7234e07d5b4..576552057fda35df9e954d0cebce32b8107f0c86 100644 (file)
@@ -10,7 +10,6 @@
 #include <msp/strings/format.h>
 #include "error.h"
 #include "framebuffer.h"
-#include "misc.h"
 #include "texture2d.h"
 #include "texture2dmultisample.h"
 #include "texture3d.h"
diff --git a/source/core/misc.cpp b/source/core/misc.cpp
deleted file mode 100644 (file)
index 39810be..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-#include <msp/gl/extensions/arb_shader_objects.h>
-#include "misc.h"
-
-namespace Msp {
-namespace GL {
-
-void enable(GLenum state)
-{
-       glEnable(state);
-}
-
-void disable(GLenum state)
-{
-       glDisable(state);
-}
-
-void set(GLenum state, bool value)
-{
-       if(value)
-               enable(state);
-       else
-               disable(state);
-}
-
-int get_i(GLenum state)
-{
-       int data;
-       glGetIntegerv(state, &data);
-       return data;
-}
-
-int get_shader_i(unsigned id, GLenum state)
-{
-       int data;
-       glGetShaderiv(id, state, &data);
-       return data;
-}
-
-int get_program_i(unsigned id, GLenum state)
-{
-       int data;
-       glGetProgramiv(id, state, &data);
-       return data;
-}
-
-} // namespace GL
-} // namespace Msp
diff --git a/source/core/misc.h b/source/core/misc.h
deleted file mode 100644 (file)
index 32adc9b..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef MSP_GL_MISC_H_
-#define MSP_GL_MISC_H_
-
-#include "gl.h"
-
-namespace Msp {
-namespace GL {
-
-void enable(GLenum);
-void disable(GLenum);
-void set(GLenum, bool);
-
-int get_i(GLenum);
-int get_shader_i(unsigned, GLenum);
-int get_program_i(unsigned, GLenum);
-
-} // namespace GL
-} // namespace Msp
-
-#endif
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)
        {
index cda38b458fbb670bca4426d2c7060e4d7786d0f2..7c2fd87f35df235c30d3d673d7626c3d2fd6a95f 100644 (file)
@@ -11,7 +11,6 @@
 #include "deviceinfo.h"
 #include "error.h"
 #include "gl.h"
-#include "misc.h"
 #include "vertexarray.h"
 #include "vertexsetup.h"
 
index e3081d75a8d912e01948b077297389f88cc13478..aac226d90c133a9a174b25ca0fb1d0a715bfc9b4 100644 (file)
@@ -2,7 +2,6 @@
 #include <msp/strings/format.h>
 #include "blend.h"
 #include "bloom.h"
-#include "misc.h"
 #include "renderer.h"
 #include "resources.h"
 
index 0b5b438b6b1acffc21649742eed47b9f22e57ce7..db213e833deea22b250768e5cb81791fddd2be39 100644 (file)
@@ -1,3 +1,4 @@
+#include <msp/gl/deviceinfo.h>
 #include <msp/gl/extensions/arb_enhanced_layouts.h>
 #include <msp/gl/extensions/arb_explicit_attrib_location.h>
 #include <msp/gl/extensions/arb_explicit_uniform_location.h>
@@ -6,7 +7,6 @@
 #include <msp/gl/extensions/arb_uniform_buffer_object.h>
 #include <msp/gl/extensions/ext_gpu_shader4.h>
 #include <msp/gl/extensions/ext_texture_array.h>
-#include <msp/gl/misc.h>
 #include "features.h"
 
 namespace Msp {
@@ -41,8 +41,9 @@ Features Features::from_context()
        features.arb_uniform_buffer_object = ARB_uniform_buffer_object;
        features.ext_gpu_shader4 = EXT_gpu_shader4;
        features.ext_texture_array = EXT_texture_array;
-       features.uniform_binding_range = get_i(GL_MAX_UNIFORM_BUFFER_BINDINGS);
-       features.texture_binding_range = get_i(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS);
+       const Limits &limits = Limits::get_global();
+       features.uniform_binding_range = limits.max_uniform_bindings;
+       features.texture_binding_range = limits.max_texture_bindings;
        return features;
 }
 
index 3d3cba0a87127116068aa85900e24656e1f83841..e8cbbaac9990551c10fbcf729fa5e4e174b83704 100644 (file)
@@ -2,7 +2,6 @@
 #include <msp/strings/format.h>
 #include "light.h"
 #include "matrix.h"
-#include "misc.h"
 #include "programdata.h"
 
 using namespace std;
index 91bc4d064b5afaef528057a2a654f2e8a11f7197..721d5cdca8593a131e0a82070648a7dc6c3082fa 100644 (file)
@@ -6,7 +6,6 @@
 #include "light.h"
 #include "lighting.h"
 #include "matrix.h"
-#include "misc.h"
 
 using namespace std;