Commit 7ec8eb12 authored by Eric Anholt's avatar Eric Anholt

glsl-vs-sqrt-zero: New test for sqrt(0) giving correct results.

Catches failure on 965 due to lack of CMP instruction support.
parent ad9d7cf4
......@@ -135,6 +135,7 @@ add_plain_test(shaders, 'glsl-vs-if')
add_plain_test(shaders, 'glsl-vs-if-bool')
add_plain_test(shaders, 'glsl-vs-loop')
add_plain_test(shaders, 'glsl-vs-mov-after-deref')
add_plain_test(shaders, 'glsl-vs-sqrt-zero')
add_plain_test(shaders, 'vp-address-01')
add_plain_test(shaders, 'vp-address-02')
add_plain_test(shaders, 'vp-address-03')
......
......@@ -54,6 +54,7 @@ add_executable (glsl-vs-mov-after-deref glsl-vs-mov-after-deref.c)
add_executable (glsl-vs-if glsl-vs-if.c)
add_executable (glsl-vs-if-bool glsl-vs-if-bool.c)
add_executable (glsl-vs-loop glsl-vs-loop.c)
add_executable (glsl-vs-sqrt-zero glsl-vs-sqrt-zero.c)
add_executable (vp-address-01 vp-address-01.c)
add_executable (vp-address-02 vp-address-02.c)
add_executable (vp-address-03 vp-address-03.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 VS 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-vs-sqrt-zero.vert");
fs = piglit_compile_shader(GL_FRAGMENT_SHADER,
SOURCE_DIR "tests/shaders/glsl-color.frag");
prog = piglit_link_simple_program(vs, fs);
glUseProgram(prog);
}
void main()
{
gl_FrontColor = vec4(sqrt(0.0) + 0.75);
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}
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