Commit 3f37a7f0 authored by Eric Anholt's avatar Eric Anholt

glsl-fs-sqrt-zero: New test to make sure that sqrt(0) works in FS as well.

Not based on a test failure.
parent aec48cff
......@@ -130,6 +130,7 @@ add_plain_test(shaders, 'glsl-unused-varying')
add_plain_test(shaders, 'glsl-fs-exp2')
add_plain_test(shaders, 'glsl-fs-fragcoord')
add_plain_test(shaders, 'glsl-fs-log2')
add_plain_test(shaders, 'glsl-fs-sqrt-zero')
add_plain_test(shaders, 'glsl-vs-arrays')
add_plain_test(shaders, 'glsl-vs-if')
add_plain_test(shaders, 'glsl-vs-if-bool')
......
......@@ -49,6 +49,7 @@ add_executable (glsl-uniform-out-of-bounds glsl-uniform-out-of-bounds.c)
add_executable (glsl-fs-exp2 glsl-fs-exp2.c)
add_executable (glsl-fs-fragcoord glsl-fs-fragcoord.c)
add_executable (glsl-fs-log2 glsl-fs-log2.c)
add_executable (glsl-fs-sqrt-zero glsl-fs-sqrt-zero.c)
add_executable (glsl-vs-arrays glsl-vs-arrays.c)
add_executable (glsl-vs-mov-after-deref glsl-vs-mov-after-deref.c)
add_executable (glsl-vs-if glsl-vs-if.c)
......
/*
* Copyright © 2009 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
* Authors:
* Eric Anholt <eric@anholt.net>
*
*/
/** @file glsl-vs-sqrt-zero.c
*
* Tests that sqrt(0.0) in the FS produces 0.0.
*/
#include "piglit-util.h"
int piglit_width = 100, piglit_height = 100;
int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
static GLint prog;
enum piglit_result
piglit_display(void)
{
GLboolean pass = GL_TRUE;
float color[4] = {0.75, 0.75, 0.75, 0.75};
glClearColor(0.5, 0.5, 0.5, 0.5);
glClear(GL_COLOR_BUFFER_BIT);
piglit_draw_rect(10, 10, 10, 10);
pass &= piglit_probe_pixel_rgb(15, 15, color);
glutSwapBuffers();
return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
void
piglit_init(int argc, char **argv)
{
GLint vs, fs;
if (!GLEW_VERSION_2_0) {
printf("Requires OpenGL 2.0\n");
piglit_report_result(PIGLIT_SKIP);
}
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
vs = piglit_compile_shader(GL_VERTEX_SHADER,
SOURCE_DIR "tests/shaders/glsl-mvp.vert");
fs = piglit_compile_shader(GL_FRAGMENT_SHADER,
SOURCE_DIR "tests/shaders/glsl-fs-sqrt-zero.frag");
prog = piglit_link_simple_program(vs, fs);
glUseProgram(prog);
}
void main()
{
gl_FragColor = vec4(sqrt(0) + 0.75);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment