#include <msp/gl/extensions/arb_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_gpu_shader4.h>
#include <msp/strings/format.h>
#include "buffer.h"
#include "error.h"
ProgramBuilder builder(features);
builder.add_shaders(*this);
- if(!features.transform)
- link();
+ link();
}
Program::Program(const string &vert, const string &frag)
glBindAttribLocation(id, index, name.c_str());
}
+void Program::bind_attribute(VertexComponent comp, const string &name)
+{
+ bind_attribute(get_component_type(comp), name);
+}
+
+void Program::bind_fragment_data(unsigned index, const string &name)
+{
+ static Require _req(EXT_gpu_shader4);
+ glBindFragDataLocation(id, index, name.c_str());
+}
+
void Program::link()
{
for(ShaderList::iterator i=shaders.begin(); i!=shaders.end(); ++i)
if(len && strncmp(name, "gl_", 3))
{
/* Some implementations report the first element of a uniform array,
- others report just the name of an array. */
+ others report just the name of the array itself. */
if(len>3 && !strcmp(name+len-3, "[0]"))
name[len-3] = 0;