This makes the GLSL compiler independent of any OpenGL-specific code.
+#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_gpu_shader5.h>
+#include <msp/gl/extensions/arb_separate_shader_objects.h>
#include <msp/gl/extensions/arb_uniform_buffer_object.h>
#include <msp/gl/extensions/arb_vertex_shader.h>
#include <msp/gl/extensions/ext_framebuffer_multisample.h>
+#include <msp/gl/extensions/ext_gpu_shader4.h>
+#include <msp/gl/extensions/ext_texture_array.h>
#include <msp/gl/extensions/msp_clipping.h>
#include <msp/gl/extensions/nv_fbo_color_attachments.h>
#include "deviceinfo.h"
}
+DeviceInfo::DeviceInfo()
+{
+ glsl_features.gl_api = get_gl_api();
+ glsl_features.glsl_version = get_glsl_version();
+ glsl_features.arb_enhanced_layouts = ARB_enhanced_layouts;
+ glsl_features.arb_explicit_attrib_location = ARB_explicit_attrib_location;
+ glsl_features.arb_explicit_uniform_location = ARB_explicit_uniform_location;
+ glsl_features.arb_gpu_shader5 = ARB_gpu_shader5;
+ glsl_features.arb_separate_shader_objects = ARB_separate_shader_objects;
+ glsl_features.arb_uniform_buffer_object = ARB_uniform_buffer_object;
+ glsl_features.ext_gpu_shader4 = EXT_gpu_shader4;
+ glsl_features.ext_texture_array = EXT_texture_array;
+ glsl_features.uniform_binding_range = limits.max_uniform_bindings;
+ glsl_features.texture_binding_range = limits.max_texture_bindings;
+}
+
const DeviceInfo &DeviceInfo::get_global()
{
static DeviceInfo info;
#ifndef MSP_GL_DEVICEINFO_H_
#define MSP_GL_DEVICEINFO_H_
+#include "glsl/features.h"
+
namespace Msp {
namespace GL {
struct DeviceInfo
{
Limits limits;
+ SL::Features glsl_features;
DeviceInfo();
#include "builtin.h"
#include "compiler.h"
#include "debug.h"
+#include "deviceinfo.h"
#include "error.h"
#include "finalize.h"
#include "generate.h"
namespace SL {
Compiler::Compiler():
- features(Features::from_context()),
+ features(DeviceInfo::get_global().glsl_features),
module(0),
compiled(false),
specialized(false)
-#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_gpu_shader5.h>
-#include <msp/gl/extensions/arb_separate_shader_objects.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 "features.h"
namespace Msp {
texture_binding_range(96)
{ }
-Features Features::from_context()
-{
- Features features;
- features.gl_api = get_gl_api();
- features.glsl_version = get_glsl_version();
- features.arb_enhanced_layouts = ARB_enhanced_layouts;
- features.arb_explicit_attrib_location = ARB_explicit_attrib_location;
- features.arb_explicit_uniform_location = ARB_explicit_uniform_location;
- features.arb_gpu_shader5 = ARB_gpu_shader5;
- features.arb_separate_shader_objects = ARB_separate_shader_objects;
- features.arb_uniform_buffer_object = ARB_uniform_buffer_object;
- features.ext_gpu_shader4 = EXT_gpu_shader4;
- features.ext_texture_array = EXT_texture_array;
- const Limits &limits = DeviceInfo::get_global().limits;
- features.uniform_binding_range = limits.max_uniform_bindings;
- features.texture_binding_range = limits.max_texture_bindings;
- return features;
-}
-
Features Features::from_version(const Version &ver)
{
Features features;
Features();
- static Features from_context();
static Features from_version(const Version &);
static Features latest();
};