1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
/*
* Copyright (c) The Piglit project 2007
*
* 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
* VA LINUX SYSTEM, IBM 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 <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
#if defined(__APPLE__)
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif
#if defined(_MSC_VER)
#include <GL/glext.h>
#endif
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
enum piglit_result {
PIGLIT_SUCCESS,
PIGLIT_FAILURE,
PIGLIT_SKIP
};
int FindLine(const char *program, int position);
void piglit_report_result(enum piglit_result result);
void piglit_require_extension(const char *name);
int piglit_probe_pixel_rgb(int x, int y, const float* expected);
int piglit_probe_pixel_rgba(int x, int y, const float* expected);
#if defined(__APPLE__)
extern void (*pglGenProgramsARB)(GLsizei n, GLuint *programs);
extern void (*pglProgramStringARB)(GLenum target, GLenum format, GLsizei len, const GLvoid *string);
extern void (*pglBindProgramARB)(GLenum target, GLuint program);
extern GLboolean (*pglIsProgramARB)(GLuint program);
extern void (*pglDeleteProgramsARB)(GLsizei n, const GLuint *programs);
extern void (*pglProgramLocalParameter4fvARB)(GLenum target, GLuint index, const GLfloat *params);
extern void (*pglProgramLocalParameter4dARB)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
extern void (*pglGetProgramivARB)(GLenum target, GLenum pname, GLint *params);
extern void (*pglGetProgramLocalParameterdvARB)(GLenum target, GLuint index, GLdouble *params);
#else
extern PFNGLGENPROGRAMSARBPROC pglGenProgramsARB;
extern PFNGLPROGRAMSTRINGARBPROC pglProgramStringARB;
extern PFNGLBINDPROGRAMARBPROC pglBindProgramARB;
extern PFNGLISPROGRAMARBPROC pglIsProgramARB;
extern PFNGLDELETEPROGRAMSARBPROC pglDeleteProgramsARB;
extern PFNGLPROGRAMLOCALPARAMETER4FVARBPROC pglProgramLocalParameter4fvARB;
extern PFNGLPROGRAMLOCALPARAMETER4DARBPROC pglProgramLocalParameter4dARB;
extern PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC pglGetProgramLocalParameterdvARB;
extern PFNGLGETPROGRAMIVARBPROC pglGetProgramivARB;
#endif
int piglit_use_fragment_program(void);
int piglit_use_vertex_program(void);
void piglit_require_fragment_program(void);
void piglit_require_vertex_program(void);
GLuint piglit_compile_program(GLenum target, const char* text);
GLint piglit_compile_shader(GLenum target, char *filename);
GLint piglit_link_simple_program(GLint vs, GLint fs);
GLvoid piglit_draw_rect(float x, float y, float w, float h);
GLvoid piglit_draw_rect_tex(float x, float y, float w, float h,
float tx, float ty, float tw, float th);
void piglit_escape_exit_key(unsigned char key, int x, int y);
char *piglit_load_text_file(const char *file_name, unsigned *size);
void piglit_ortho_projection(int w, int h, GLboolean push);
extern GLfloat cube_face_texcoords[6][4][3];
extern const char *cube_face_names[6];
extern const GLenum cube_face_targets[6];
|