From: Brian Paul Date: Wed, 26 Aug 2009 18:16:07 +0000 (-0600) Subject: progs/glsl: asst. changes in shtest.c X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=72052210516b4cb0e082e0c56822cd33b1562630;p=mesa.git progs/glsl: asst. changes in shtest.c --- 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);