#include <GL/glut.h>
#include "shaderutil.h"
+/** time to compile previous shader */
+static GLdouble CompileTime = 0.0;
+
+/** time to linke previous program */
+static GLdouble LinkTime = 0.0;
+
GLboolean
ShadersSupported(void)
{
GLuint shader;
GLint stat;
+ GLdouble t0, t1;
shader = glCreateShader(shaderType);
glShaderSource(shader, 1, (const GLchar **) &text, NULL);
+
+ t0 = glutGet(GLUT_ELAPSED_TIME) * 0.001;
glCompileShader(shader);
+ t1 = glutGet(GLUT_ELAPSED_TIME) * 0.001;
+
+ CompileTime = t1 - t0;
+
glGetShaderiv(shader, GL_COMPILE_STATUS, &stat);
if (!stat) {
GLchar log[1000];
LinkShaders(GLuint vertShader, GLuint fragShader)
{
GLuint program = glCreateProgram();
+ GLdouble t0, t1;
assert(vertShader || fragShader);
glAttachShader(program, fragShader);
if (vertShader)
glAttachShader(program, vertShader);
+
+ t0 = glutGet(GLUT_ELAPSED_TIME) * 0.001;
glLinkProgram(program);
+ t1 = glutGet(GLUT_ELAPSED_TIME) * 0.001;
+
+ LinkTime = t1 - t0;
/* check link */
{
}
+GLdouble
+GetShaderCompileTime(void)
+{
+ return CompileTime;
+}
+
+
+GLdouble
+GetShaderLinkTime(void)
+{
+ return LinkTime;
+}
+
+
void
SetUniformValues(GLuint program, struct uniform_info uniforms[])
{
extern GLuint
LinkShaders(GLuint vertShader, GLuint fragShader);
+extern GLdouble
+GetShaderCompileTime(void);
+
+extern GLdouble
+GetShaderLinkTime(void);
+
extern void
SetUniformValues(GLuint program, struct uniform_info uniforms[]);