+++ /dev/null
-#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
#include <msp/strings/format.h>
#include "buffer.h"
#include "error.h"
-#include "misc.h"
#include "program.h"
#include "resources.h"
#include "glsl/compiler.h"
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())
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);
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)
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)
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)
{
+#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>
#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 {
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;
}