1 /*
2  * Copyright (c) 2010 VMware, Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * on the rights to use, copy, modify, merge, publish, distribute, sub
8  * license, and/or sell copies of the Software, and to permit persons to whom
9  * the Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18  * NON-INFRINGEMENT.  IN NO EVENT SHALL VMWARE AND/OR THEIR SUPPLIERS
19  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
24 
25 /**
26  * @file texel-offset-limits.c
27  *
28  * Tests that GLSL 1.30 exposes the GL_MIN/MAX_PROGRAM_TEXEL_OFFSET limits.
29  */
30 
31 #include "piglit-util-gl.h"
32 
33 PIGLIT_GL_TEST_CONFIG_BEGIN
34 
35 	config.supports_gl_compat_version = 10;
36 
37 	config.window_width = 10;
38 	config.window_height = 10;
39 	config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
40 	config.khr_no_error_support = PIGLIT_NO_ERRORS;
41 
42 PIGLIT_GL_TEST_CONFIG_END
43 
44 enum piglit_result
piglit_display()45 piglit_display()
46 {
47 	/* UNREACHED */
48 	return PIGLIT_FAIL;
49 }
50 
51 void
piglit_init(int argc,char ** argv)52 piglit_init(int argc, char **argv)
53 {
54 	bool pass = true;
55 	GLint val;
56 
57 	piglit_require_GLSL_version(130);
58 
59 	glGetIntegerv(GL_MIN_PROGRAM_TEXEL_OFFSET, &val);
60 	if (!piglit_check_gl_error(GL_NO_ERROR))
61 		piglit_report_result(PIGLIT_FAIL);
62 	if (val > -8) {
63 		fprintf(stderr,
64 			"query of GL_MIN_PROGRAM_TEXEL_OFFSET "
65 			"returned %d, must be at least -8\n",
66 			val);
67 		pass = false;
68 	}
69 
70 	glGetIntegerv(GL_MAX_PROGRAM_TEXEL_OFFSET, &val);
71 	if (!piglit_check_gl_error(GL_NO_ERROR))
72 		piglit_report_result(PIGLIT_FAIL);
73 	if (val < 7) {
74 		fprintf(stderr,
75 			"query of GL_MAX_PROGRAM_TEXEL_OFFSET "
76 			"returned %d, must be at least 7\n",
77 			val);
78 		pass = false;
79 	}
80 
81 	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
82 }
83