Commit ab951537 authored by Marek Olšák's avatar Marek Olšák

vs-point_size-zero: test that the minimum point size is 1 when outputting zero

parent 3c4786c0
......@@ -306,6 +306,7 @@ add_plain_test(general, 'timer_query')
add_plain_test(general, 'two-sided-lighting')
add_plain_test(general, 'two-sided-lighting-separate-specular')
add_plain_test(general, 'user-clip')
add_plain_test(general, 'vs-point_size-zero')
add_plain_test(general, 'vao-01')
add_plain_test(general, 'vao-02')
add_concurrent_test(general, 'vao-element-array-buffer')
......
......@@ -125,5 +125,6 @@ add_executable (occlusion_query occlusion_query.c)
add_executable (occlusion-query-discard occlusion-query-discard.c)
add_executable (quad-invariance quad-invariance.c)
add_executable (clear-accum clear-accum.c)
add_executable (vs-point_size-zero vs-point_size-zero.c)
# vim: ft=cmake:
/*
* Copyright (c) 2012 Marek Olšák <maraeo@gmail.com>
*
* 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
* on the rights to use, copy, modify, merge, publish, distribute, sub
* license, 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
* NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS AND/OR THEIR SUPPLIERS
* 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.
*/
#include "piglit-util.h"
int piglit_width = 100, piglit_height = 50;
int piglit_window_mode = GLUT_RGB | GLUT_ALPHA | GLUT_DOUBLE;
static const char *vstext =
"void main() \n"
"{ \n"
" gl_Position = ftransform(); \n"
" gl_FrontColor = vec4(1.0); \n"
" gl_PointSize = 0.0; \n"
"} \n";
static GLuint vs, prog;
enum piglit_result
piglit_display(void)
{
GLboolean pass;
float black[] = {0, 0, 0};
glClear(GL_COLOR_BUFFER_BIT);
glUseProgram(prog);
glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
glBegin(GL_POINTS);
glVertex2i(50, 20);
glEnd();
glUseProgram(0);
pass = !piglit_probe_rect_rgb_silent(49, 19, 3, 3, black);
if (!pass)
puts("Fail: nothing rendered.");
glutSwapBuffers();
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
void
piglit_init(int argc, char **argv)
{
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstext);
assert(vs);
prog = piglit_link_simple_program(vs, 0);
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
}
......@@ -336,6 +336,32 @@ piglit_probe_rect_rgb(int x, int y, int w, int h, const float *expected)
return 1;
}
int
piglit_probe_rect_rgb_silent(int x, int y, int w, int h, const float *expected)
{
int i, j, p;
GLfloat *probe;
GLfloat *pixels = malloc(w*h*3*sizeof(float));
glReadPixels(x, y, w, h, GL_RGB, GL_FLOAT, pixels);
for (j = 0; j < h; j++) {
for (i = 0; i < w; i++) {
probe = &pixels[(j*w+i)*3];
for (p = 0; p < 3; ++p) {
if (fabs(probe[p] - expected[p]) >= piglit_tolerance[p]) {
free(pixels);
return 0;
}
}
}
}
free(pixels);
return 1;
}
/**
* Read a pixel from the given location and compare its depth value to the
* given expected value.
......
......@@ -198,6 +198,7 @@ int piglit_probe_pixel_rgba_silent(int x, int y, const float* expected, float *o
int piglit_probe_pixel_rgb(int x, int y, const float* expected);
int piglit_probe_pixel_rgba(int x, int y, const float* expected);
int piglit_probe_rect_rgb(int x, int y, int w, int h, const float* expected);
int piglit_probe_rect_rgb_silent(int x, int y, int w, int h, const float *expected);
int piglit_probe_rect_rgba(int x, int y, int w, int h, const float* expected);
int piglit_probe_rect_rgba_int(int x, int y, int w, int h, const int* expected);
int piglit_probe_rect_rgba_uint(int x, int y, int w, int h, const unsigned int* expected);
......
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