summaryrefslogtreecommitdiffstats
path: root/progs/glsl/shtest.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-08-26 12:16:07 -0600
committerBrian Paul <[email protected]>2009-08-26 12:16:18 -0600
commit72052210516b4cb0e082e0c56822cd33b1562630 (patch)
treea7f3e9ed555a7b259904a346cba2cede0b6fa058 /progs/glsl/shtest.c
parentaf7315e58b8bfe230f7b4c5a8d5b669d67aab9f0 (diff)
progs/glsl: asst. changes in shtest.c
Diffstat (limited to 'progs/glsl/shtest.c')
-rw-r--r--progs/glsl/shtest.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/progs/glsl/shtest.c b/progs/glsl/shtest.c
index fa477d9eeb7..628a7dd5b98 100644
--- a/progs/glsl/shtest.c
+++ b/progs/glsl/shtest.c
@@ -107,10 +107,18 @@ RandomUniformValues(void)
{
GLuint i;
for (i = 0; i < NumUniforms; i++) {
- if (Uniforms[i].type == GL_FLOAT) {
+ switch (Uniforms[i].type) {
+ case GL_FLOAT:
Uniforms[i].value[0] = RandomFloat(0.0, 1.0);
- }
- else {
+ break;
+ case GL_SAMPLER_1D:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_3D:
+ case GL_SAMPLER_CUBE:
+ case GL_SAMPLER_2D_RECT_ARB:
+ /* don't change sampler values - random values are bad */
+ break;
+ default:
Uniforms[i].value[0] = RandomFloat(-1.0, 2.0);
Uniforms[i].value[1] = RandomFloat(-1.0, 2.0);
Uniforms[i].value[2] = RandomFloat(-1.0, 2.0);
@@ -595,10 +603,15 @@ Init(void)
Program = LinkShaders(vertShader, fragShader);
linkTime = GetShaderLinkTime();
+ printf("Read vert shader %s\n", VertShaderFile);
+ printf("Read frag shader %s\n", FragShaderFile);
+
printf("Time to compile vertex shader: %fs\n", vertTime);
printf("Time to compile fragment shader: %fs\n", fragTime);
printf("Time to link shaders: %fs\n", linkTime);
+ assert(ValidateShaderProgram(Program));
+
glUseProgram(Program);
NumUniforms = GetUniforms(Program, Uniforms);