--- /dev/null
+/*
+ * GL_ARB_shading_language_100 test application.
+ *
+ * Tests correctness of emited code. Runs multiple well-formed shaders and checks if
+ * they produce valid results.
+ *
+ * Requires specific support on the GL implementation side. A special function printMESA()
+ * must be supported in the language that prints current values of generic type
+ * to the appropriate shader's info log, and optionally to the screen.
+ *
+ * Author: Michal Krol
+ */
+
+#include "framework.h"
+
+#define EPSILON 0.0001f
+
+static GLhandleARB vert = 0;
+static GLhandleARB prog = 0;
+
+static int get_line (FILE *f, char *line, int size)
+{
+ if (fgets (line, size, f) == NULL)
+ return 0;
+ if (line[strlen (line) - 1] == '\n')
+ line[strlen (line) - 1] = '\0';
+ return 1;
+}
+
+struct ATTRIB
+{
+ char name[32];
+ GLfloat value[64][4];
+ GLuint count;
+};
+
+struct ATTRIBS
+{
+ struct ATTRIB attrib[32];
+ GLuint count;
+};
+
+struct SHADER
+{
+ char code[16000];
+ GLfloat output[1000];
+ GLuint count;
+};
+
+enum SHADER_LOAD_STATE
+{
+ SLS_NONE,
+ SLS_CODE,
+ SLS_OUTPUT
+};
+
+struct PROGRAM
+{
+ struct PROGRAM *next;
+ char name[256];
+ struct ATTRIBS attribs;
+ struct SHADER vertex;
+};
+
+enum PROGRAM_LOAD_STATE
+{
+ PLS_NONE,
+ PLS_ATTRIB,
+ PLS_VERTEX
+};
+
+static struct PROGRAM *program = NULL;
+
+static void load_test_file (const char *filename, struct PROGRAM **program)
+{
+ struct PROGRAM **currprog = program;
+ FILE *f;
+ char line[256];
+ enum PROGRAM_LOAD_STATE pls;
+ enum SHADER_LOAD_STATE sls;
+
+ f = fopen (filename, "r");
+ if (f == NULL)
+ return;
+
+ while (get_line (f, line, sizeof (line))) {
+ if (line[0] == '$') {
+ if (strncmp (line + 1, "program", 7) == 0) {
+ if (*currprog != NULL)
+ currprog = &(**currprog).next;
+ *currprog = (struct PROGRAM *) (malloc (sizeof (struct PROGRAM)));
+ if (*currprog == NULL)
+ break;
+ (**currprog).next = NULL;
+ strcpy ((**currprog).name, line + 9);
+ (**currprog).attribs.count = 0;
+ (**currprog).vertex.code[0] = '\0';
+ (**currprog).vertex.count = 0;
+ pls = PLS_NONE;
+ }
+ else if (strncmp (line + 1, "attrib", 6) == 0) {
+ if (*currprog == NULL)
+ break;
+ strcpy ((**currprog).attribs.attrib[(**currprog).attribs.count].name, line + 8);
+ (**currprog).attribs.attrib[(**currprog).attribs.count].count = 0;
+ (**currprog).attribs.count++;
+ pls = PLS_ATTRIB;
+ }
+ else if (strcmp (line + 1, "vertex") == 0) {
+ if (*currprog == NULL)
+ break;
+ pls = PLS_VERTEX;
+ sls = SLS_NONE;
+ }
+ else if (strcmp (line + 1, "code") == 0) {
+ if (*currprog == NULL || pls != PLS_VERTEX)
+ break;
+ sls = SLS_CODE;
+ }
+ else if (strcmp (line + 1, "output") == 0) {
+ if (*currprog == NULL || pls != PLS_VERTEX)
+ break;
+ sls = SLS_OUTPUT;
+ }
+ }
+ else {
+ if ((*currprog == NULL || pls == PLS_NONE || sls == SLS_NONE) && line[0] != '\0')
+ break;
+ if (*currprog != NULL && pls == PLS_VERTEX) {
+ if (sls == SLS_CODE) {
+ strcat ((**currprog).vertex.code, line);
+ strcat ((**currprog).vertex.code, "\n");
+ }
+ else if (sls == SLS_OUTPUT && line[0] != '\0') {
+ if (strcmp (line, "true") == 0)
+ (**currprog).vertex.output[(**currprog).vertex.count] = 1.0f;
+ else if (strcmp (line, "false") == 0)
+ (**currprog).vertex.output[(**currprog).vertex.count] = 0.0f;
+ else
+ sscanf (line, "%f", &(**currprog).vertex.output[(**currprog).vertex.count]);
+ (**currprog).vertex.count++;
+ }
+ }
+ else if (*currprog != NULL && pls == PLS_ATTRIB && line[0] != '\0') {
+ struct ATTRIB *att = &(**currprog).attribs.attrib[(**currprog).attribs.count - 1];
+ GLfloat *vec = att->value[att->count];
+ sscanf (line, "%f %f %f %f", &vec[0], &vec[1], &vec[2], &vec[3]);
+ att->count++;
+ }
+ }
+ }
+
+ fclose (f);
+}
+
+void InitScene (void)
+{
+ prog = glCreateProgramObjectARB ();
+ vert = glCreateShaderObjectARB (GL_VERTEX_SHADER_ARB);
+ glAttachObjectARB (prog, vert);
+ glDeleteObjectARB (vert);
+ load_test_file ("cltest.txt", &program);
+}
+
+void RenderScene (void)
+{
+ struct PROGRAM *nextprogram;
+ char *code;
+ GLint info_length, length;
+ char output[65000], *p;
+ GLuint i;
+
+ if (program == NULL)
+ exit (0);
+
+ code = program->vertex.code;
+ glShaderSourceARB (vert, 1, &code, NULL);
+ glCompileShaderARB (vert);
+ CheckObjectStatus (vert);
+
+ for (i = 0; i < program->attribs.count; i++) {
+ const char *name = program->attribs.attrib[i].name;
+ if (strcmp (name, "gl_Vertex") != 0)
+ glBindAttribLocationARB (prog, i, name);
+ }
+
+ glLinkProgramARB (prog);
+ CheckObjectStatus (prog);
+ glUseProgramObjectARB (prog);
+
+ printf ("\n--- %s\n", program->name);
+
+ glGetObjectParameterivARB (vert, GL_OBJECT_INFO_LOG_LENGTH_ARB, &info_length);
+
+ glBegin (GL_POINTS);
+ if (program->attribs.count == 0) {
+ glVertex2f (0.0f, 0.0f);
+ }
+ else {
+ for (i = 0; i < program->attribs.attrib[0].count; i++) {
+ GLuint j;
+ for (j = 0; j < program->attribs.count; j++) {
+ GLuint n = (j + 1) % program->attribs.count;
+ GLfloat *vec = program->attribs.attrib[n].value[i];
+ const char *name = program->attribs.attrib[n].name;
+ if (strcmp (name, "gl_Vertex") == 0)
+ glVertex4fv (vec);
+ else
+ glVertexAttrib4fvARB (n, vec);
+ }
+ }
+ }
+ glEnd ();
+ glFlush ();
+
+ glGetInfoLogARB (vert, sizeof (output), &length, output);
+ p = output + info_length - 1;
+ for (i = 0; i < program->vertex.count; i++) {
+ GLfloat value;
+ if (p == NULL) {
+ printf ("*** %s\n", "I/O error");
+ break;
+ }
+ if (strncmp (p, "true", 4) == 0)
+ value = 1.0f;
+ else if (strncmp (p, "false", 5) == 0)
+ value = 0.0f;
+ else if (sscanf (p, "%f", &value) != 1) {
+ printf ("*** %s\n", "I/O error");
+ break;
+ }
+ if (fabs (value - program->vertex.output[i]) > EPSILON) {
+ printf ("*** Values are different, is %f, should be %f\n", value,
+ program->vertex.output[i]);
+ }
+ p = strchr (p, '\n');
+ if (p != NULL)
+ p++;
+ }
+ if (*p != '\0')
+ printf ("*** %s\n", "I/O error");
+
+ nextprogram = program->next;
+ free (program);
+ program = nextprogram;
+}
+
+int main (int argc, char *argv[])
+{
+ InitFramework (&argc, argv);
+ return 0;
+}
+
--- /dev/null
+$ /*\r
+$ Shader test script.\r
+$ \r
+$ Author: Michal Krol\r
+$ \r
+$ Comment line starts with dollar sign and white space.\r
+$ \r
+$ $program <name> starts a new test program section called <name>. Contains all other sections.\r
+$ \r
+$ $attrib <name> starts vertex data input section for attrib called <name>. Each line consists of\r
+$ four values that form single vertex attrib.\r
+$ \r
+$ $vertex starts vertex shader section. Contains $code and &output sections.\r
+$ \r
+$ $code starts source code section. All text in this section gets compiled into appropriate\r
+$ shader object.\r
+$ \r
+$ $output starts shader execution results section. These are compared, value-by-value,\r
+$ with results of executing printMESA() functions within a shader.\r
+$ */\r
+\r
+\r
+$ /*\r
+$ --------------------------------------------------------------------------------------------------\r
+$ Test printMESA() function.\r
+$ */\r
+\r
+$program PRINT TEST\r
+\r
+$vertex\r
+\r
+$code\r
+\r
+void main () {\r
+ gl_Position = gl_ModelViewMatrix * gl_Vertex;\r
+ gl_FrontColor = vec4 (1.0);\r
+\r
+ printMESA (11.1);\r
+ printMESA (111);\r
+ printMESA (true);\r
+\r
+ printMESA (vec2 (22.1, 22.2));\r
+ printMESA (vec3 (33.1, 33.2, 33.3));\r
+ printMESA (vec4 (44.1, 44.2, 44.3, 44.4));\r
+\r
+ printMESA (ivec2 (221, 222));\r
+ printMESA (ivec3 (331, 332, 333));\r
+ printMESA (ivec4 (441, 442, 443, 444));\r
+\r
+ printMESA (bvec2 (false, true));\r
+ printMESA (bvec3 (true, true, false));\r
+ printMESA (bvec4 (true, false, true, false));\r
+\r
+ printMESA (mat2 (55.11, 55.12, 55.21, 55.22));\r
+ printMESA (mat3 (66.11, 66.12, 66.13,\r
+ 66.21, 66.22, 66.23,\r
+ 66.31, 66.32, 66.33));\r
+ printMESA (mat4 (77.11, 77.12, 77.13, 77.14,\r
+ 77.21, 77.22, 77.23, 77.24,\r
+ 77.31, 77.32, 77.33, 77.34,\r
+ 77.41, 77.42, 77.43, 77.44));\r
+}\r
+\r
+$output\r
+\r
+11.1\r
+111\r
+true\r
+\r
+22.1\r
+22.2\r
+33.1\r
+33.2\r
+33.3\r
+44.1\r
+44.2\r
+44.3\r
+44.4\r
+\r
+221\r
+222\r
+331\r
+332\r
+333\r
+441\r
+442\r
+443\r
+444\r
+\r
+false\r
+true\r
+true\r
+true\r
+false\r
+true\r
+false\r
+true\r
+false\r
+\r
+55.11\r
+55.12\r
+55.21\r
+55.22\r
+\r
+66.11\r
+66.12\r
+66.13\r
+66.21\r
+66.22\r
+66.23\r
+66.31\r
+66.32\r
+66.33\r
+\r
+77.11\r
+77.12\r
+77.13\r
+77.14\r
+77.21\r
+77.22\r
+77.23\r
+77.24\r
+77.31\r
+77.32\r
+77.33\r
+77.34\r
+77.41\r
+77.42\r
+77.43\r
+77.44\r
+\r
+\r
+$ /*\r
+$ --------------------------------------------------------------------------------------------------\r
+$ Test type casting.\r
+$ */\r
+\r
+$program TYPE CAST TEST\r
+\r
+$attrib gl_Vertex\r
+0.0 0.0 0.0 1.0\r
+\r
+$attrib _Zero\r
+0.0 0.0 0.0 0.0\r
+\r
+$attrib _One\r
+1.1 0.0 0.0 0.0\r
+\r
+$attrib _Two\r
+2.2 0.0 0.0 0.0\r
+\r
+$attrib _MinusThree\r
+-3.3 0.0 0.0 0.0\r
+\r
+$vertex\r
+\r
+$code\r
+\r
+attribute float _Zero;\r
+attribute float _One;\r
+attribute float _Two;\r
+attribute float _MinusThree;\r
+\r
+void main () {\r
+ gl_Position = gl_ModelViewMatrix * gl_Vertex;\r
+ gl_FrontColor = vec4 (1.0);\r
+\r
+ printMESA (_Zero);\r
+ printMESA (_One);\r
+ printMESA (_Two);\r
+ printMESA (_MinusThree);\r
+\r
+ printMESA (float (_Zero));\r
+ printMESA (float (_One));\r
+ printMESA (float (_Two));\r
+ printMESA (float (_MinusThree));\r
+ printMESA (float (45.99));\r
+ printMESA (float (-6.17));\r
+\r
+ printMESA (bool (_Zero));\r
+ printMESA (bool (_One));\r
+ printMESA (bool (_Two));\r
+ printMESA (bool (_MinusThree));\r
+ printMESA (bool (45.99));\r
+ printMESA (bool (-6.17));\r
+ printMESA (bool (0.0001));\r
+ printMESA (bool (0.0));\r
+\r
+ printMESA (int (_Zero));\r
+ printMESA (int (_One));\r
+ printMESA (int (_Two));\r
+ printMESA (int (_MinusThree));\r
+ printMESA (int (45.99));\r
+ printMESA (int (45.22));\r
+ printMESA (int (-6.17));\r
+ printMESA (int (-6.87));\r
+}\r
+\r
+$output\r
+\r
+0.0\r
+1.1\r
+2.2\r
+-3.3\r
+\r
+0.0\r
+1.1\r
+2.2\r
+-3.3\r
+45.99\r
+-6.17\r
+\r
+false\r
+true\r
+true\r
+true\r
+true\r
+true\r
+true\r
+false\r
+\r
+0\r
+1\r
+2\r
+-3\r
+45\r
+45\r
+-6\r
+-6\r
+\r
+$ /*\r
+$ --------------------------------------------------------------------------------------------------\r
+$ Test vector swizzles.\r
+$ */\r
+\r
+$program SWIZZLE TEST\r
+\r
+$attrib gl_Vertex\r
+0.0 0.0 0.0 1.0\r
+\r
+$attrib _One\r
+1.1 1.2 1.3 1.4\r
+\r
+$attrib _Two\r
+2.1 2.2 2.3 2.4\r
+\r
+$vertex\r
+\r
+$code\r
+\r
+attribute vec4 _One;\r
+attribute vec4 _Two;\r
+\r
+void assign5678 (out vec4 v)\r
+{\r
+ v.x = 5.5;\r
+ v.y = 6.6;\r
+ v.z = 7.7;\r
+ v.w = 8.8;\r
+}\r
+\r
+void main () {\r
+ gl_Position = gl_ModelViewMatrix * gl_Vertex;\r
+ gl_FrontColor = vec4 (1.0);\r
+\r
+ printMESA (_One);\r
+ printMESA (_Two);\r
+\r
+ printMESA (_One.x);\r
+ printMESA (_One.y);\r
+ printMESA (_One.z);\r
+ printMESA (_One.w);\r
+\r
+ printMESA (_Two.xy);\r
+ printMESA (_Two.yx);\r
+ printMESA (_Two.xw);\r
+ printMESA (_Two.wx);\r
+ printMESA (_Two.yz);\r
+ printMESA (_Two.zy);\r
+ printMESA (_Two.xz);\r
+ printMESA (_Two.zx);\r
+ printMESA (_Two.zw);\r
+ printMESA (_Two.wz);\r
+\r
+ printMESA (_One.xyz);\r
+ printMESA (_One.yzx);\r
+ printMESA (_One.zxy);\r
+ printMESA (_One.xzy);\r
+ printMESA (_One.yzw);\r
+ printMESA (_One.zwx);\r
+\r
+ printMESA (_Two.xyzw);\r
+ printMESA (_Two.yzwx);\r
+ printMESA (_Two.wzyx);\r
+ printMESA (_Two.zwyx);\r
+\r
+ printMESA (_One.xx);\r
+ printMESA (_One.zz);\r
+ printMESA (_One.ww);\r
+\r
+ printMESA (_Two.xxx);\r
+ printMESA (_Two.yyy);\r
+ printMESA (_Two.www);\r
+\r
+ printMESA (_One.xxxx);\r
+ printMESA (_One.zzzz);\r
+\r
+ printMESA (_Two.xxyy);\r
+ printMESA (_Two.wwxx);\r
+ printMESA (_Two.zxxw);\r
+\r
+ vec4 v;\r
+\r
+ v.zxwy = vec4 (5.5, 6.6, 7.7, 8.8);\r
+ printMESA (v);\r
+\r
+ assign5678 (v.ywxz);\r
+ printMESA (v);\r
+}\r
+\r
+$output\r
+\r
+1.1\r
+1.2\r
+1.3\r
+1.4\r
+2.1\r
+2.2\r
+2.3\r
+2.4\r
+\r
+1.1\r
+1.2\r
+1.3\r
+1.4\r
+\r
+2.1\r
+2.2\r
+2.2\r
+2.1\r
+2.1\r
+2.4\r
+2.4\r
+2.1\r
+2.2\r
+2.3\r
+2.3\r
+2.2\r
+2.1\r
+2.3\r
+2.3\r
+2.1\r
+2.3\r
+2.4\r
+2.4\r
+2.3\r
+\r
+1.1\r
+1.2\r
+1.3\r
+1.2\r
+1.3\r
+1.1\r
+1.3\r
+1.1\r
+1.2\r
+1.1\r
+1.3\r
+1.2\r
+1.2\r
+1.3\r
+1.4\r
+1.3\r
+1.4\r
+1.1\r
+\r
+2.1\r
+2.2\r
+2.3\r
+2.4\r
+2.2\r
+2.3\r
+2.4\r
+2.1\r
+2.4\r
+2.3\r
+2.2\r
+2.1\r
+2.3\r
+2.4\r
+2.2\r
+2.1\r
+\r
+1.1\r
+1.1\r
+1.3\r
+1.3\r
+1.4\r
+1.4\r
+\r
+2.1\r
+2.1\r
+2.1\r
+2.2\r
+2.2\r
+2.2\r
+2.4\r
+2.4\r
+2.4\r
+\r
+1.1\r
+1.1\r
+1.1\r
+1.1\r
+1.3\r
+1.3\r
+1.3\r
+1.3\r
+\r
+2.1\r
+2.1\r
+2.2\r
+2.2\r
+2.4\r
+2.4\r
+2.1\r
+2.1\r
+2.3\r
+2.1\r
+2.1\r
+2.4\r
+\r
+6.6\r
+8.8\r
+5.5\r
+7.7\r
+\r
+7.7\r
+5.5\r
+8.8\r
+6.6\r
+\r
+\r
+$ /*\r
+$ --------------------------------------------------------------------------------------------------\r
+$ Test relational operators.\r
+$ */\r
+\r
+$program RELATIONAL OPERATOR TEST\r
+\r
+$attrib gl_Vertex\r
+0.0 0.0 0.0 1.0\r
+\r
+$attrib _Two\r
+2.0 0.0 0.0 0.0\r
+\r
+$attrib _Two2\r
+2.0 0.0 0.0 0.0\r
+\r
+$attrib _MinusThree\r
+-3.0 0.0 0.0 0.0\r
+\r
+$vertex\r
+\r
+$code\r
+\r
+attribute float _Two;\r
+attribute float _Two2;\r
+attribute float _MinusThree;\r
+\r
+struct foo\r
+{\r
+ float f;\r
+ vec4 v4;\r
+ vec3 v3;\r
+ mat4 m4;\r
+ int i;\r
+ bool b;\r
+};\r
+\r
+void printMESA (const in foo bar)\r
+{\r
+ printMESA (bar.f);\r
+ printMESA (bar.v4);\r
+ printMESA (bar.v3);\r
+ printMESA (bar.m4);\r
+ printMESA (bar.i);\r
+ printMESA (bar.b);\r
+}\r
+\r
+void main () {\r
+ gl_Position = gl_ModelViewMatrix * gl_Vertex;\r
+ gl_FrontColor = vec4 (1.0);\r
+\r
+ int iTwo = int (_Two);\r
+ int iTwo2 = int (_Two2);\r
+ int iMinusThree = int (_MinusThree);\r
+\r
+ printMESA (_Two <= _Two);\r
+ printMESA (_Two <= _Two2);\r
+ printMESA (_Two <= _MinusThree);\r
+ printMESA (_MinusThree <= _Two);\r
+ printMESA (iTwo <= iTwo);\r
+ printMESA (iTwo <= iTwo2);\r
+ printMESA (iTwo <= iMinusThree);\r
+ printMESA (iMinusThree <= iTwo);\r
+\r
+ printMESA (_Two >= _Two);\r
+ printMESA (_Two >= _Two2);\r
+ printMESA (_Two >= _MinusThree);\r
+ printMESA (_MinusThree >= _Two);\r
+ printMESA (iTwo >= iTwo);\r
+ printMESA (iTwo >= iTwo2);\r
+ printMESA (iTwo >= iMinusThree);\r
+ printMESA (iMinusThree >= iTwo);\r
+\r
+ printMESA (_Two < _Two);\r
+ printMESA (_Two < _Two2);\r
+ printMESA (_Two < _MinusThree);\r
+ printMESA (_MinusThree < _Two);\r
+ printMESA (iTwo < iTwo);\r
+ printMESA (iTwo < iTwo2);\r
+ printMESA (iTwo < iMinusThree);\r
+ printMESA (iMinusThree < iTwo);\r
+\r
+ printMESA (_Two > _Two);\r
+ printMESA (_Two > _Two2);\r
+ printMESA (_Two > _MinusThree);\r
+ printMESA (_MinusThree > _Two);\r
+ printMESA (iTwo > iTwo);\r
+ printMESA (iTwo > iTwo2);\r
+ printMESA (iTwo > iMinusThree);\r
+ printMESA (iMinusThree > iTwo);\r
+\r
+ printMESA (_Two == _Two);\r
+ printMESA (_Two == _Two2);\r
+ printMESA (_Two == _MinusThree);\r
+ printMESA (_MinusThree == _MinusThree);\r
+ printMESA (iTwo == iTwo);\r
+ printMESA (iTwo == iTwo2);\r
+ printMESA (iTwo == iMinusThree);\r
+ printMESA (iMinusThree == iMinusThree);\r
+\r
+ printMESA (_Two != _Two);\r
+ printMESA (_Two != _Two2);\r
+ printMESA (_Two != _MinusThree);\r
+ printMESA (_MinusThree != _MinusThree);\r
+ printMESA (iTwo != iTwo);\r
+ printMESA (iTwo != iTwo2);\r
+ printMESA (iTwo != iMinusThree);\r
+ printMESA (iMinusThree != iMinusThree);\r
+\r
+ foo foo1;\r
+ foo1.f = 13.31;\r
+ foo1.v4 = vec4 (44.11, 44.22, 44.33, 44.44);\r
+ foo1.v3 = vec3 (33.11, 33.22, 33.33);\r
+ foo1.m4 = mat4 (17.88);\r
+ foo1.i = 666;\r
+ foo1.b = true;\r
+ printMESA (foo1);\r
+\r
+ // make foo2 the same as foo1\r
+ foo foo2;\r
+ foo2.f = 13.31;\r
+ foo2.v4 = vec4 (44.11, 44.22, 44.33, 44.44);\r
+ foo2.v3 = vec3 (33.11, 33.22, 33.33);\r
+ foo2.m4 = mat4 (17.88);\r
+ foo2.i = 666;\r
+ foo2.b = true;\r
+\r
+ printMESA (foo1 == foo2);\r
+ printMESA (foo1 != foo2);\r
+\r
+ // make them a little bit different\r
+ foo2.m4[2].y = 333.333;\r
+ printMESA (foo2);\r
+\r
+ printMESA (foo1 == foo2);\r
+ printMESA (foo1 != foo2);\r
+}\r
+\r
+$output\r
+\r
+true\r
+true\r
+false\r
+true\r
+true\r
+true\r
+false\r
+true\r
+\r
+true\r
+true\r
+true\r
+false\r
+true\r
+true\r
+true\r
+false\r
+\r
+false\r
+false\r
+false\r
+true\r
+false\r
+false\r
+false\r
+true\r
+\r
+false\r
+false\r
+true\r
+false\r
+false\r
+false\r
+true\r
+false\r
+\r
+true\r
+true\r
+false\r
+true\r
+true\r
+true\r
+false\r
+true\r
+\r
+false\r
+false\r
+true\r
+false\r
+false\r
+false\r
+true\r
+false\r
+\r
+13.31\r
+44.11\r
+44.22\r
+44.33\r
+44.44\r
+33.11\r
+33.22\r
+33.33\r
+17.88\r
+0.0\r
+0.0\r
+0.0\r
+0.0\r
+17.88\r
+0.0\r
+0.0\r
+0.0\r
+0.0\r
+17.88\r
+0.0\r
+0.0\r
+0.0\r
+0.0\r
+17.88\r
+666\r
+true\r
+\r
+true\r
+false\r
+\r
+13.31\r
+44.11\r
+44.22\r
+44.33\r
+44.44\r
+33.11\r
+33.22\r
+33.33\r
+17.88\r
+0.0\r
+0.0\r
+0.0\r
+0.0\r
+17.88\r
+0.0\r
+0.0\r
+0.0\r
+333.333\r
+17.88\r
+0.0\r
+0.0\r
+0.0\r
+0.0\r
+17.88\r
+666\r
+true\r
+\r
+false\r
+true\r
+\r
+\r
+$ /*\r
+$ --------------------------------------------------------------------------------------------------\r
+$ Test logical operators.\r
+$ */\r
+\r
+$program LOGICAL OPERATOR TEST\r
+\r
+$attrib gl_Vertex\r
+0.0 0.0 0.0 1.0\r
+\r
+$attrib _False\r
+0.0 0.0 0.0 0.0\r
+\r
+$attrib _True\r
+1.0 0.0 0.0 0.0\r
+\r
+$attrib _False2\r
+0.0 0.0 0.0 0.0\r
+\r
+$attrib _True2\r
+1.0 0.0 0.0 0.0\r
+\r
+$vertex\r
+\r
+$code\r
+\r
+attribute float _False;\r
+attribute float _True;\r
+attribute float _False2;\r
+attribute float _True2;\r
+\r
+void main () {\r
+ gl_Position = gl_ModelViewMatrix * gl_Vertex;\r
+ gl_FrontColor = vec4 (1.0);\r
+\r
+ printMESA (_False);\r
+ printMESA (_True);\r
+ printMESA (_False2);\r
+ printMESA (_True2);\r
+\r
+ bool False = bool (_False);\r
+ bool True = bool (_True);\r
+ bool False2 = bool (_False2);\r
+ bool True2 = bool (_True2);\r
+\r
+ //\r
+ // It is important to test each operator with the following argument types:\r
+ // * Both arguments are different variables, even if they have the same values.\r
+ // False and False2 are distinct attributes, but are the same in value.\r
+ // * Both arguments may be the same variables. This case tests possible\r
+ // optimizations, e.g. X && X --> X.\r
+ // * Both arguments are constant. This tests constant folding.\r
+ //\r
+\r
+ printMESA (!False);\r
+ printMESA (!True);\r
+ printMESA (!false);\r
+ printMESA (!true);\r
+\r
+ printMESA (False ^^ False2);\r
+ printMESA (False ^^ True2);\r
+ printMESA (True ^^ False2);\r
+ printMESA (True ^^ True2);\r
+ printMESA (False ^^ False);\r
+ printMESA (False ^^ True);\r
+ printMESA (True ^^ False);\r
+ printMESA (True ^^ True);\r
+ printMESA (false ^^ false);\r
+ printMESA (false ^^ true);\r
+ printMESA (true ^^ false);\r
+ printMESA (true ^^ true);\r
+\r
+ printMESA (False && False2);\r
+ printMESA (False && True2);\r
+ printMESA (True && False2);\r
+ printMESA (True && True2);\r
+ printMESA (False && False);\r
+ printMESA (False && True);\r
+ printMESA (True && False);\r
+ printMESA (True && True);\r
+ printMESA (false && false);\r
+ printMESA (false && true);\r
+ printMESA (true && false);\r
+ printMESA (true && true);\r
+\r
+ printMESA (False || False2);\r
+ printMESA (False || True2);\r
+ printMESA (True || False2);\r
+ printMESA (True || True2);\r
+ printMESA (False || False);\r
+ printMESA (False || True);\r
+ printMESA (True || False);\r
+ printMESA (True || True);\r
+ printMESA (false || false);\r
+ printMESA (false || true);\r
+ printMESA (true || false);\r
+ printMESA (true || true);\r
+\r
+ //\r
+ // Test short-circuit evaluation of && and ||. The right expression evaluation depends\r
+ // on the value of the left expression. If the right expression has side effects, we\r
+ // can easily test if it happened.\r
+ //\r
+\r
+ bool x;\r
+\r
+ x = false;\r
+ printMESA (x);\r
+ printMESA (False && (x = true));\r
+ printMESA (x);\r
+\r
+ x = false;\r
+ printMESA (x);\r
+ printMESA (false && (x = true));\r
+ printMESA (x);\r
+\r
+ x = true;\r
+ printMESA (x);\r
+ printMESA (True || (x = false));\r
+ printMESA (x);\r
+\r
+ x = true;\r
+ printMESA (x);\r
+ printMESA (true || (x = false));\r
+ printMESA (x);\r
+}\r
+\r
+$output\r
+\r
+0.0\r
+1.0\r
+0.0\r
+1.0\r
+\r
+true\r
+false\r
+true\r
+false\r
+\r
+false\r
+true\r
+true\r
+false\r
+false\r
+true\r
+true\r
+false\r
+false\r
+true\r
+true\r
+false\r
+\r
+false\r
+false\r
+false\r
+true\r
+false\r
+false\r
+false\r
+true\r
+false\r
+false\r
+false\r
+true\r
+\r
+false\r
+true\r
+true\r
+true\r
+false\r
+true\r
+true\r
+true\r
+false\r
+true\r
+true\r
+true\r
+\r
+false\r
+false\r
+false\r
+\r
+false\r
+false\r
+false\r
+\r
+true\r
+true\r
+true\r
+\r
+true\r
+true\r
+true\r
+\r
+\r
+$ /*\r
+$ --------------------------------------------------------------------------------------------------\r
+$ Test subscript operator/array access.\r
+$ */\r
+\r
+$program ARRAY ACCESS TEST\r
+\r
+$attrib gl_Vertex\r
+0.0 0.0 0.0 1.0\r
+\r
+$attrib _Zero\r
+0.0 0.0 0.0 0.0\r
+\r
+$attrib _One\r
+1.1 0.0 0.0 0.0\r
+\r
+$attrib _Two\r
+2.9 0.0 0.0 0.0\r
+\r
+$attrib _Vec\r
+11.11 22.22 33.33 44.44\r
+\r
+$vertex\r
+\r
+$code\r
+\r
+attribute float _Zero;\r
+attribute float _One;\r
+attribute float _Two;\r
+attribute vec4 _Vec;\r
+\r
+void main () {\r
+ gl_Position = gl_ModelViewMatrix * gl_Vertex;\r
+ gl_FrontColor = vec4 (1.0);\r
+\r
+ printMESA (_Zero);\r
+ printMESA (_One);\r
+ printMESA (_Two);\r
+ printMESA (_Vec);\r
+\r
+ printMESA (_Vec[0]);\r
+ printMESA (_Vec[1]);\r
+ printMESA (_Vec[2]);\r
+ printMESA (_Vec[3]);\r
+\r
+ printMESA (_Vec[int (_Zero)]);\r
+ printMESA (_Vec[int (_One)]);\r
+ printMESA (_Vec[int (_Two)]);\r
+}\r
+\r
+$output\r
+\r
+0.0\r
+1.1\r
+2.9\r
+11.11\r
+22.22\r
+33.33\r
+44.44\r
+\r
+11.11\r
+22.22\r
+33.33\r
+44.44\r
+\r
+11.11\r
+22.22\r
+33.33\r
+\r
+\r
+$ /*\r
+$ --------------------------------------------------------------------------------------------------\r
+$ Test pre/post-increment/decrement operators.\r
+$ Note: assumes relational operators being correct.\r
+$ */\r
+\r
+$program PRE/POST-INC/DEC OPERATOR TEST\r
+\r
+$attrib gl_Vertex\r
+0.0 0.0 0.0 1.0\r
+\r
+$attrib _Zero\r
+0.0 0.0 0.0 0.0\r
+\r
+$attrib _One\r
+1.1 0.0 0.0 0.0\r
+\r
+$attrib _Two4\r
+2.1 2.2 2.3 2.4\r
+\r
+$vertex\r
+\r
+$code\r
+\r
+attribute float _Zero;\r
+attribute float _One;\r
+attribute vec4 _Two4;\r
+\r
+float fZero, fOne;\r
+vec4 fTwo4;\r
+int iZero, iOne;\r
+ivec4 iTwo4;\r
+\r
+void reset () {\r
+ fZero = _Zero;\r
+ fOne = _One;\r
+ fTwo4 = _Two4;\r
+ iZero = int (_Zero);\r
+ iOne = int (_One);\r
+ iTwo4 = ivec4 (_Two4);\r
+}\r
+\r
+void main () {\r
+ gl_Position = gl_ModelViewMatrix * gl_Vertex;\r
+ gl_FrontColor = vec4 (1.0);\r
+\r
+ printMESA (_Zero);\r
+ printMESA (_One);\r
+ printMESA (_Two4);\r
+\r
+ // pre-increment\r
+ reset ();\r
+ printMESA (++fZero);\r
+ printMESA (++fOne);\r
+ printMESA (++iZero);\r
+ printMESA (++iOne);\r
+ printMESA (fZero);\r
+ printMESA (fOne);\r
+ printMESA (iZero);\r
+ printMESA (iOne);\r
+ printMESA (++fTwo4 == _Two4 + 1.0);\r
+ printMESA (++iTwo4 == ivec4 (_Two4) + 1);\r
+\r
+ // pre-decrement\r
+ reset ();\r
+ printMESA (--fZero);\r
+ printMESA (--fOne);\r
+ printMESA (--iZero);\r
+ printMESA (--iOne);\r
+ printMESA (fZero);\r
+ printMESA (fOne);\r
+ printMESA (iZero);\r
+ printMESA (iOne);\r
+ printMESA (--fTwo4 == _Two4 - 1.0);\r
+ printMESA (--iTwo4 == ivec4 (_Two4) - 1);\r
+\r
+ // post-increment\r
+ reset ();\r
+ printMESA (fZero++);\r
+ printMESA (fOne++);\r
+ printMESA (iZero++);\r
+ printMESA (iOne++);\r
+ printMESA (fZero);\r
+ printMESA (fOne);\r
+ printMESA (iZero);\r
+ printMESA (iOne);\r
+ printMESA (fTwo4++ == _Two4);\r
+ printMESA (iTwo4++ == ivec4 (_Two4));\r
+\r
+ // post-decrement\r
+ reset ();\r
+ printMESA (fZero--);\r
+ printMESA (fOne--);\r
+ printMESA (iZero--);\r
+ printMESA (iOne--);\r
+ printMESA (fZero);\r
+ printMESA (fOne);\r
+ printMESA (iZero);\r
+ printMESA (iOne);\r
+ printMESA (fTwo4-- == _Two4);\r
+ printMESA (iTwo4-- == ivec4 (_Two4));\r
+}\r
+\r
+$output\r
+\r
+0.0\r
+1.1\r
+2.1\r
+2.2\r
+2.3\r
+2.4\r
+\r
+1.0\r
+2.1\r
+1\r
+2\r
+1.0\r
+2.1\r
+1\r
+2\r
+true\r
+true\r
+\r
+-1.0\r
+0.1\r
+-1\r
+0\r
+-1.0\r
+0.1\r
+-1\r
+0\r
+true\r
+true\r
+\r
+0.0\r
+1.1\r
+0\r
+1\r
+1.0\r
+2.1\r
+1\r
+2\r
+true\r
+true\r
+\r
+0.0\r
+1.1\r
+0\r
+1\r
+-1.0\r
+0.1\r
+-1\r
+0\r
+true\r
+true\r
+\r
+\r
+$ /*\r
+$ --------------------------------------------------------------------------------------------------\r
+$ Test arithmetical operators.\r
+$ */\r
+\r
+$program ARITHMETICAL OPERATOR TEST\r
+\r
+$attrib gl_Vertex\r
+0.0 0.0 0.0 1.0\r
+\r
+$attrib _Zero\r
+0.0 0.0 0.0 0.0\r
+\r
+$attrib _One\r
+1.1 0.0 0.0 0.0\r
+\r
+$attrib _Two4\r
+2.1 2.2 2.3 2.4\r
+\r
+$vertex\r
+\r
+$code\r
+\r
+attribute float _Zero;\r
+attribute float _One;\r
+attribute vec4 _Two4;\r
+\r
+void main () {\r
+ gl_Position = gl_ModelViewMatrix * gl_Vertex;\r
+ gl_FrontColor = vec4 (1.0);\r
+\r
+ printMESA (_Zero);\r
+ printMESA (_One);\r
+ printMESA (_Two4);\r
+\r
+ int iZero = int (_Zero);\r
+ int iOne = int (_One);\r
+ ivec4 iTwo4 = ivec4 (_Two4);\r
+\r
+ printMESA (-_Zero);\r
+ printMESA (-_One);\r
+ printMESA (-_Two4);\r
+ printMESA (-_Two4.z);\r
+\r
+ printMESA (_Zero + 0.0);\r
+ printMESA (_One + 0.0);\r
+ printMESA (_Two4 + 0.0);\r
+ printMESA (_Two4.y + 0.0);\r
+\r
+ printMESA (_Zero + _Zero);\r
+ printMESA (_Zero + _One);\r
+ printMESA (_Zero + _Two4);\r
+ printMESA (_One + _Zero);\r
+ printMESA (_One + _Two4);\r
+ printMESA (_Two4 + _Two4);\r
+\r
+ printMESA (_Zero - 0.0);\r
+ printMESA (_One - 0.0);\r
+ printMESA (_Two4 - 0.0);\r
+ printMESA (_Two4.y - 0.0);\r
+\r
+ printMESA (_Zero - _Zero);\r
+ printMESA (_Zero - _One);\r
+ printMESA (_Zero - _Two4);\r
+ printMESA (_One - _Zero);\r
+ printMESA (_One - _Two4);\r
+ printMESA (_Two4 - _Two4);\r
+\r
+ printMESA (_Zero * 1.0);\r
+ printMESA (_One * 1.0);\r
+ printMESA (_Two4 * 1.0);\r
+ printMESA (_Two4.x * 1.0);\r
+\r
+ printMESA (_Zero * _Zero);\r
+ printMESA (_Zero * _One);\r
+ printMESA (_Zero * _Two4);\r
+ printMESA (_One * _Zero);\r
+ printMESA (_One * _One);\r
+ printMESA (_One * _Two4);\r
+ printMESA (_Two4 * _Two4);\r
+\r
+ printMESA (_Zero / 1.0);\r
+ printMESA (_One / 1.0);\r
+ printMESA (_Two4 / 1.0);\r
+ printMESA (_Two4.x / 1.0);\r
+\r
+ printMESA (_Zero / _One);\r
+ printMESA (_Zero / _Two4);\r
+ printMESA (_One / _One);\r
+ printMESA (_One / _Two4);\r
+ printMESA (_Two4 / _Two4);\r
+}\r
+\r
+$output\r
+\r
+0.0\r
+1.1\r
+2.1\r
+2.2\r
+2.3\r
+2.4\r
+\r
+0.0\r
+-1.1\r
+-2.1\r
+-2.2\r
+-2.3\r
+-2.4\r
+-2.3\r
+\r
+0.0\r
+1.1\r
+2.1\r
+2.2\r
+2.3\r
+2.4\r
+2.2\r
+\r
+0.0\r
+1.1\r
+2.1\r
+2.2\r
+2.3\r
+2.4\r
+1.1\r
+3.2\r
+3.3\r
+3.4\r
+3.5\r
+4.2\r
+4.4\r
+4.6\r
+4.8\r
+\r
+0.0\r
+1.1\r
+2.1\r
+2.2\r
+2.3\r
+2.4\r
+2.2\r
+\r
+0.0\r
+-1.1\r
+-2.1\r
+-2.2\r
+-2.3\r
+-2.4\r
+1.1\r
+-1.0\r
+-1.1\r
+-1.2\r
+-1.3\r
+0.0\r
+0.0\r
+0.0\r
+0.0\r
+\r
+0.0\r
+1.1\r
+2.1\r
+2.2\r
+2.3\r
+2.4\r
+2.1\r
+\r
+0.0\r
+0.0\r
+0.0\r
+0.0\r
+0.0\r
+0.0\r
+0.0\r
+1.21\r
+2.31\r
+2.42\r
+2.53\r
+2.64\r
+4.41\r
+4.84\r
+5.29\r
+5.76\r
+\r
+0.0\r
+1.1\r
+2.1\r
+2.2\r
+2.3\r
+2.4\r
+2.1\r
+\r
+0.0\r
+0.0\r
+0.0\r
+0.0\r
+0.0\r
+1.0\r
+0.52381\r
+0.5\r
+0.47826\r
+0.45833\r
+1.0\r
+1.0\r
+1.0\r
+1.0\r
+\r
+\r
+$ /*\r
+$ --------------------------------------------------------------------------------------------------\r
+$ Test matrix operations.\r
+$ Note: assumes relational operators being correct.\r
+$ */\r
+\r
+$program MATRIX TEST\r
+\r
+$attrib gl_Vertex\r
+0.0 0.0 0.0 1.0\r
+\r
+$attrib _Zero\r
+0.0 0.0 0.0 0.0\r
+\r
+$attrib _One\r
+1.0 1.0 1.0 1.0\r
+\r
+$attrib _Two\r
+2.0 2.0 2.0 2.0\r
+\r
+$vertex\r
+\r
+$code\r
+\r
+attribute vec4 _Zero;\r
+attribute vec4 _One;\r
+attribute vec4 _Two;\r
+\r
+void main () {\r
+ gl_Position = gl_ModelViewMatrix * gl_Vertex;\r
+ gl_FrontColor = vec4 (1.0);\r
+\r
+ printMESA (_Zero);\r
+ printMESA (_One);\r
+ printMESA (_Two);\r
+\r
+ mat4 Identity = mat4 (_One.x);\r
+\r
+ printMESA (Identity == mat4 (1.0, 0.0, 0.0, 0.0,\r
+ 0.0, 1.0, 0.0, 0.0,\r
+ 0.0, 0.0, 1.0, 0.0,\r
+ 0.0, 0.0, 0.0, 1.0));\r
+ printMESA (Identity * _Two == _Two);\r
+\r
+ mat4 Matrix = mat4 (1.1, 1.2, 1.3, 1.4,\r
+ 2.1, 2.2, 2.3, 2.4,\r
+ 3.1, 3.2, 3.3, 3.4,\r
+ 4.1, 4.2, 4.3, 4.4);\r
+\r
+ printMESA (Matrix[2].y);\r
+ printMESA (Matrix[1]);\r
+}\r
+\r
+$output\r
+\r
+0.0\r
+0.0\r
+0.0\r
+0.0\r
+1.0\r
+1.0\r
+1.0\r
+1.0\r
+2.0\r
+2.0\r
+2.0\r
+2.0\r
+true\r
+true\r
+3.2\r
+2.1\r
+2.2\r
+2.3\r
+2.4\r
+\r
--- /dev/null
+#include "framework.h"
+
+/*
+ * GL_ARB_multitexture
+ */
+PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB;
+PFNGLMULTITEXCOORD4FVARBPROC glMultiTexCoord4fvARB;
+
+/*
+ * GL_ARB_shader_objects
+ */
+PFNGLDELETEOBJECTARBPROC glDeleteObjectARB;
+PFNGLGETHANDLEARBPROC glGetHandleARB;
+PFNGLDETACHOBJECTARBPROC glDetachObjectARB;
+PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB;
+PFNGLSHADERSOURCEARBPROC glShaderSourceARB;
+PFNGLCOMPILESHADERARBPROC glCompileShaderARB;
+PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB;
+PFNGLATTACHOBJECTARBPROC glAttachObjectARB;
+PFNGLLINKPROGRAMARBPROC glLinkProgramARB;
+PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB;
+PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB;
+PFNGLGETINFOLOGARBPROC glGetInfoLogARB;
+PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB;
+
+/*
+ * GL_ARB_vertex_shader
+ */
+PFNGLVERTEXATTRIB4FVARBPROC glVertexAttrib4fvARB;
+PFNGLVERTEXATTRIBPOINTERARBPROC glVertexAttribPointerARB;
+PFNGLENABLEVERTEXATTRIBARRAYARBPROC glEnableVertexAttribArrayARB;
+PFNGLDISABLEVERTEXATTRIBARRAYARBPROC glDisableVertexAttribArrayARB;
+PFNGLBINDATTRIBLOCATIONARBPROC glBindAttribLocationARB;
+PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB;
+
+/*
+ * GL_EXT_fog_coord
+ */
+PFNGLFOGCOORDFVEXTPROC glFogCoordfvEXT;
+PFNGLFOGCOORDPOINTEREXTPROC glFogCoordPointerEXT;
+
+/*
+ * GL_EXT_secondary_color
+ */
+PFNGLSECONDARYCOLOR3FVEXTPROC glSecondaryColor3fvEXT;
+PFNGLSECONDARYCOLORPOINTEREXTPROC glSecondaryColorPointerEXT;
+
+static void Display (void)
+{
+ glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ RenderScene ();
+ glutSwapBuffers ();
+}
+
+static void Idle (void)
+{
+ glutPostRedisplay ();
+}
+
+void InitFramework (int *argc, char *argv[])
+{
+ glutInit (argc, argv);
+ glutInitWindowPosition (0, 0);
+ glutInitWindowSize (200, 200);
+ glutInitDisplayMode (GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
+ glutCreateWindow (argv[0]);
+
+ GETPROCADDR(glClientActiveTextureARB, PFNGLCLIENTACTIVETEXTUREARBPROC);
+ GETPROCADDR(glMultiTexCoord4fvARB, PFNGLMULTITEXCOORD4FVARBPROC);
+
+ GETPROCADDR(glDeleteObjectARB, PFNGLDELETEOBJECTARBPROC);
+ GETPROCADDR(glGetHandleARB, PFNGLGETHANDLEARBPROC);
+ GETPROCADDR(glDetachObjectARB, PFNGLDETACHOBJECTARBPROC);
+ GETPROCADDR(glCreateShaderObjectARB, PFNGLCREATESHADEROBJECTARBPROC);
+ GETPROCADDR(glShaderSourceARB, PFNGLSHADERSOURCEARBPROC);
+ GETPROCADDR(glCompileShaderARB, PFNGLCOMPILESHADERARBPROC);
+ GETPROCADDR(glCreateProgramObjectARB, PFNGLCREATEPROGRAMOBJECTARBPROC);
+ GETPROCADDR(glAttachObjectARB, PFNGLATTACHOBJECTARBPROC);
+ GETPROCADDR(glLinkProgramARB, PFNGLLINKPROGRAMARBPROC);
+ GETPROCADDR(glUseProgramObjectARB, PFNGLUSEPROGRAMOBJECTARBPROC);
+ GETPROCADDR(glGetObjectParameterivARB, PFNGLGETOBJECTPARAMETERIVARBPROC);
+ GETPROCADDR(glGetInfoLogARB, PFNGLGETINFOLOGARBPROC);
+ GETPROCADDR(glGetUniformLocationARB, PFNGLGETUNIFORMLOCATIONARBPROC);
+
+ GETPROCADDR(glVertexAttrib4fvARB, PFNGLVERTEXATTRIB4FVARBPROC);
+ GETPROCADDR(glVertexAttribPointerARB, PFNGLVERTEXATTRIBPOINTERARBPROC);
+ GETPROCADDR(glEnableVertexAttribArrayARB, PFNGLENABLEVERTEXATTRIBARRAYARBPROC);
+ GETPROCADDR(glDisableVertexAttribArrayARB, PFNGLDISABLEVERTEXATTRIBARRAYARBPROC);
+ GETPROCADDR(glBindAttribLocationARB, PFNGLBINDATTRIBLOCATIONARBPROC);
+ GETPROCADDR(glGetAttribLocationARB, PFNGLGETATTRIBLOCATIONARBPROC);
+
+ GETPROCADDR(glFogCoordfvEXT, PFNGLFOGCOORDFVEXTPROC);
+ GETPROCADDR(glFogCoordPointerEXT, PFNGLFOGCOORDPOINTEREXTPROC);
+
+ GETPROCADDR(glSecondaryColor3fvEXT, PFNGLSECONDARYCOLOR3FVEXTPROC);
+ GETPROCADDR(glSecondaryColorPointerEXT, PFNGLSECONDARYCOLORPOINTEREXTPROC);
+
+ printf ("VENDOR: %s\n", glGetString (GL_VENDOR));
+ printf ("RENDERER: %s\n", glGetString (GL_RENDERER));
+
+ InitScene ();
+
+ /*glutReshapeFunc (Reshape);
+ glutKeyboardFunc (Key);
+ glutSpecialFunc (SpecialKey);*/
+ glutDisplayFunc (Display);
+ glutIdleFunc (Idle);
+ glutMainLoop ();
+}
+
+GLboolean CheckObjectStatus (GLhandleARB handle)
+{
+ GLint type, status, length;
+ GLcharARB *infolog;
+
+ glGetObjectParameterivARB (handle, GL_OBJECT_TYPE_ARB, &type);
+ if (type == GL_SHADER_OBJECT_ARB)
+ glGetObjectParameterivARB (handle, GL_OBJECT_COMPILE_STATUS_ARB, &status);
+ else if (type == GL_PROGRAM_OBJECT_ARB)
+ glGetObjectParameterivARB (handle, GL_OBJECT_LINK_STATUS_ARB, &status);
+ else {
+ assert (0);
+ return GL_FALSE;
+ }
+
+ if (status)
+ return GL_TRUE;
+
+ printf ("\n%s FAILED. INFO LOG FOLLOWS:\n",
+ type == GL_SHADER_OBJECT_ARB ? "SHADER COMPILE" : "PROGRAM LINK");
+
+ glGetObjectParameterivARB (handle, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length);
+ infolog = (GLcharARB *) (malloc (length));
+ if (infolog != NULL) {
+ glGetInfoLogARB (handle, length, NULL, infolog);
+ printf ("%s", infolog);
+ free (infolog);
+ }
+
+ printf ("\n");
+
+ return GL_FALSE;
+}
+
--- /dev/null
+#ifndef _FRAMEWORK_H_
+#define _FRAMEWORK_H_
+
+#ifdef WIN32
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#endif
+
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <GL/gl.h>
+#include <GL/glut.h>
+#include <GL/glext.h>
+
+#ifdef WIN32
+#define GETPROCADDRESS(x) wglGetProcAddress (x)
+#else
+#define GETPROCADDRESS(x) glutGetProcAddress (x)
+#endif
+
+#define GETPROCADDR(x,T) do { x = (T) (GETPROCADDRESS(#x)); assert (x != NULL); } while (0)
+
+/*
+ * GL_ARB_multitexture
+ */
+extern PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB;
+extern PFNGLMULTITEXCOORD4FVARBPROC glMultiTexCoord4fvARB;
+
+/*
+ * GL_ARB_shader_objects
+ */
+extern PFNGLDELETEOBJECTARBPROC glDeleteObjectARB;
+extern PFNGLGETHANDLEARBPROC glGetHandleARB;
+extern PFNGLDETACHOBJECTARBPROC glDetachObjectARB;
+extern PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB;
+extern PFNGLSHADERSOURCEARBPROC glShaderSourceARB;
+extern PFNGLCOMPILESHADERARBPROC glCompileShaderARB;
+extern PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB;
+extern PFNGLATTACHOBJECTARBPROC glAttachObjectARB;
+extern PFNGLLINKPROGRAMARBPROC glLinkProgramARB;
+extern PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB;
+extern PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB;
+extern PFNGLGETINFOLOGARBPROC glGetInfoLogARB;
+extern PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB;
+/*static PFNGLUNIFORM4FVARBPROC glUniform4fvARB = NULL;*/
+
+/*
+ * GL_ARB_vertex_shader
+ */
+extern PFNGLVERTEXATTRIB4FVARBPROC glVertexAttrib4fvARB;
+extern PFNGLVERTEXATTRIBPOINTERARBPROC glVertexAttribPointerARB;
+extern PFNGLENABLEVERTEXATTRIBARRAYARBPROC glEnableVertexAttribArrayARB;
+extern PFNGLDISABLEVERTEXATTRIBARRAYARBPROC glDisableVertexAttribArrayARB;
+extern PFNGLBINDATTRIBLOCATIONARBPROC glBindAttribLocationARB;
+extern PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB;
+
+/*
+ * GL_EXT_fog_coord
+ */
+extern PFNGLFOGCOORDFVEXTPROC glFogCoordfvEXT;
+extern PFNGLFOGCOORDPOINTEREXTPROC glFogCoordPointerEXT;
+
+/*
+ * GL_EXT_secondary_color
+ */
+extern PFNGLSECONDARYCOLOR3FVEXTPROC glSecondaryColor3fvEXT;
+extern PFNGLSECONDARYCOLORPOINTEREXTPROC glSecondaryColorPointerEXT;
+
+void InitFramework (int *argc, char *argv[]);
+
+extern void InitScene (void);
+extern void RenderScene (void);
+
+GLboolean CheckObjectStatus (GLhandleARB);
+
+#endif
+
--- /dev/null
+/*
+ * GL_ARB_shader_objects & GL_ARB_vertex_shader interface test application.
+ * Neither compiler nor executor is being tested here, although some simple shader
+ * compilation tests are performed.
+ *
+ * Perfectly valid behaviour produces output that does not have a line
+ * beginning with three stars (***).
+ *
+ * Author: Michal Krol
+ */
+
+#include "framework.h"
+
+enum TEST_TYPE
+{
+ TT_GETERROR_NOERROR,
+ TT_GETERROR_INVALIDVALUE,
+ TT_GETERROR_INVALIDOPERATION,
+ TT_PARAM1_ZERO,
+ TT_PARAM1_NONZERO
+};
+
+static enum TEST_TYPE current_test;
+
+static void begintest (enum TEST_TYPE type, const char *name)
+{
+ current_test = type;
+ printf ("\n BEGIN TEST: %s\n", name);
+ while (glGetError () != GL_NO_ERROR)
+ ;
+}
+
+static void endtest1 (GLuint param1)
+{
+ const char *msg = NULL;
+
+ switch (current_test)
+ {
+ case TT_GETERROR_NOERROR:
+ if (glGetError () != GL_NO_ERROR)
+ msg = "glGetError () does not return GL_NO_ERROR";
+ break;
+ case TT_GETERROR_INVALIDVALUE:
+ if (glGetError () != GL_INVALID_VALUE)
+ msg = "glGetError () does not return GL_INVALID_VALUE";
+ break;
+ case TT_GETERROR_INVALIDOPERATION:
+ if (glGetError () != GL_INVALID_OPERATION)
+ msg = "glGetError () does not return GL_INVALID_OPERATION";
+ break;
+ case TT_PARAM1_ZERO:
+ if (param1)
+ msg = "The parameter is not zero";
+ break;
+ case TT_PARAM1_NONZERO:
+ if (!param1)
+ msg = "The parameter is not non-zero";
+ break;
+ default:
+ assert (0);
+ }
+
+ if (msg == NULL)
+ printf (" OK\n");
+ else
+ printf ("*** %s\n", msg);
+
+ while (glGetError () != GL_NO_ERROR)
+ ;
+}
+
+static void endtest ()
+{
+ endtest1 (0);
+}
+
+static GLhandleARB vert = 0;
+static GLhandleARB frag = 0;
+static GLhandleARB prog = 0;
+
+static GLhandleARB find_invalid_handle ()
+{
+ GLhandleARB handle;
+
+ for (handle = 1; handle < 16; handle++)
+ if (handle != vert && handle != frag && handle != prog)
+ return handle;
+ assert (0);
+ return 0;
+}
+
+static const char *invsynvertsrc =
+ "void main () {\n"
+ " gl_Position = gl_ModelViewMatrix ! gl_Vertex;\n" /* unexpected token */
+ "}\n"
+;
+
+static const char *invsemvertsrc =
+ "void main () {\n"
+ " gl_Position = gl_ModelviewMatrix * gl_Vertex;\n" /* undeclared identifier */
+ "}\n"
+;
+
+static const char *uniforms =
+ "uniform vec4 CommonUniform;\n"
+;
+
+static const char *validvertsrc =
+ "uniform vec4 VertexUniform;\n"
+ "attribute vec4 FirstAttrib;\n"
+ "attribute vec4 SecondAttrib;\n"
+ "void main () {\n"
+ " gl_Position = gl_ModelViewMatrix * gl_Vertex + CommonUniform + VertexUniform\n"
+ " + FirstAttrib + SecondAttrib;\n"
+ "}\n"
+;
+
+static const char *invsynfragsrc =
+ "void main () {\n"
+ " gl_FragColor = gl_Color\n" /* missing ; */
+ "}\n"
+;
+
+static const char *invsemfragsrc =
+ "void main () {\n"
+ " gl_FragColor = gl_FrontColor;\n" /* gl_FrontColor only in vertex shader */
+ "}\n"
+;
+
+static const char *validfragsrc =
+ "uniform vec4 FragmentUniform;\n"
+ "void main () {\n"
+ " gl_FragColor = gl_Color + CommonUniform + FragmentUniform;\n"
+ "}\n"
+;
+
+void InitScene (void)
+{
+ GLint params[1];
+ const char *tab[2];
+
+ /*
+ * GL should silently ignore calls that delete object 0.
+ */
+ begintest (TT_GETERROR_NOERROR, "glDeleteObject(0)");
+ glDeleteObjectARB (0);
+ endtest ();
+
+ /*
+ * GL generates an error on invalid object handle.
+ */
+ begintest (TT_GETERROR_INVALIDVALUE, "Pass invalid non-zero object handle");
+ glDeleteObjectARB (find_invalid_handle ());
+ endtest ();
+ glUseProgramObjectARB (find_invalid_handle ());
+ endtest ();
+
+ /*
+ * Create object. GL should return unique non-zero values.
+ */
+ begintest (TT_PARAM1_NONZERO, "Create object");
+ vert = glCreateShaderObjectARB (GL_VERTEX_SHADER_ARB);
+ endtest1 (vert);
+ frag = glCreateShaderObjectARB (GL_FRAGMENT_SHADER_ARB);
+ endtest1 (frag);
+ prog = glCreateProgramObjectARB ();
+ endtest1 (prog);
+ endtest1 (vert != frag && frag != prog && prog != vert);
+
+ /*
+ * Link empty program.
+ */
+ begintest (TT_PARAM1_NONZERO, "Link empty program");
+ glLinkProgramARB (prog);
+ endtest1 (CheckObjectStatus (prog));
+
+ /*
+ * Use empty program object. Empty program objects are valid.
+ */
+ begintest (TT_GETERROR_NOERROR, "Use empty program object");
+ glUseProgramObjectARB (prog);
+ endtest ();
+
+ /*
+ * Attach invalid object handles. Program object 0 should not be accepted.
+ */
+ begintest (TT_GETERROR_INVALIDVALUE, "Attach invalid object handle");
+ glAttachObjectARB (0, find_invalid_handle ());
+ endtest ();
+ glAttachObjectARB (0, frag);
+ endtest ();
+ glAttachObjectARB (find_invalid_handle (), find_invalid_handle ());
+ endtest ();
+ glAttachObjectARB (find_invalid_handle (), frag);
+ endtest ();
+ glAttachObjectARB (prog, find_invalid_handle ());
+ endtest ();
+
+ /*
+ * Attach valid object handles with wrong semantics.
+ */
+ begintest (TT_GETERROR_INVALIDOPERATION, "Attach object badly");
+ glAttachObjectARB (vert, frag);
+ endtest ();
+ glAttachObjectARB (vert, prog);
+ endtest ();
+ glAttachObjectARB (prog, prog);
+ endtest ();
+
+ /*
+ * Detach non-attached object.
+ */
+ begintest (TT_GETERROR_INVALIDOPERATION, "Detach non-attached object");
+ glDetachObjectARB (prog, vert);
+ endtest ();
+ glDetachObjectARB (prog, frag);
+ endtest ();
+
+ /*
+ * Attach shader.
+ */
+ begintest (TT_GETERROR_NOERROR, "Attach shader to program object");
+ glAttachObjectARB (prog, vert);
+ endtest ();
+ glAttachObjectARB (prog, frag);
+ endtest ();
+
+ /*
+ * Attach object twice.
+ */
+ begintest (TT_GETERROR_INVALIDOPERATION, "Attach object twice");
+ glAttachObjectARB (prog, vert);
+ endtest ();
+ glAttachObjectARB (prog, frag);
+ endtest ();
+
+ /*
+ * Detach attached object.
+ */
+ begintest (TT_GETERROR_NOERROR, "Detach attached object");
+ glDetachObjectARB (prog, vert);
+ endtest ();
+ glDetachObjectARB (prog, frag);
+ endtest ();
+
+ /*
+ * Attach shader again.
+ */
+ begintest (TT_GETERROR_NOERROR, "Attach shader again");
+ glAttachObjectARB (prog, vert);
+ endtest ();
+ glAttachObjectARB (prog, frag);
+ endtest ();
+
+ /*
+ * Delete attached object.
+ */
+ begintest (TT_GETERROR_NOERROR, "Delete attached object");
+ glDeleteObjectARB (vert);
+ endtest ();
+ glDeleteObjectARB (frag);
+ endtest ();
+
+ /*
+ * Query delete status. It should return TRUE. Object handles are still valid
+ * as they are referenced by program object container.
+ */
+ begintest (TT_PARAM1_NONZERO, "Query delete status");
+ glGetObjectParameterivARB (vert, GL_OBJECT_DELETE_STATUS_ARB, params);
+ endtest1 (params[0]);
+ glGetObjectParameterivARB (frag, GL_OBJECT_DELETE_STATUS_ARB, params);
+ endtest1 (params[0]);
+
+ /*
+ * Delete already deleted attached object. The behaviour is undefined, but we
+ * check for no errors. The object still exists, so the handle value is okay.
+ * In other words, these calls should be silently ignored by GL.
+ */
+ begintest (TT_GETERROR_NOERROR, "Delete already deleted attached object");
+ glDeleteObjectARB (vert);
+ endtest ();
+ glDeleteObjectARB (frag);
+ endtest ();
+
+ /*
+ * Compile shader source with syntax error.
+ */
+ begintest (TT_PARAM1_ZERO, "Compile shader source with syntax error");
+ glShaderSourceARB (vert, 1, &invsynvertsrc, NULL);
+ glCompileShaderARB (vert);
+ endtest1 (CheckObjectStatus (vert));
+ glShaderSourceARB (frag, 1, &invsynfragsrc, NULL);
+ glCompileShaderARB (frag);
+ endtest1 (CheckObjectStatus (frag));
+
+ /*
+ * Compile shader source with semantic error.
+ */
+ begintest (TT_PARAM1_ZERO, "Compile shader source with semantic error");
+ glShaderSourceARB (vert, 1, &invsemvertsrc, NULL);
+ glCompileShaderARB (vert);
+ endtest1 (CheckObjectStatus (vert));
+ glShaderSourceARB (frag, 1, &invsemfragsrc, NULL);
+ glCompileShaderARB (frag);
+ endtest1 (CheckObjectStatus (frag));
+
+ /*
+ * Link ill-formed vertex-fragment program.
+ */
+ begintest (TT_PARAM1_ZERO, "Link ill-formed vertex-fragment program");
+ glLinkProgramARB (prog);
+ endtest1 (CheckObjectStatus (prog));
+
+ /*
+ * Use badly linked program object.
+ */
+ begintest (TT_GETERROR_INVALIDOPERATION, "Use badly linked program object");
+ glUseProgramObjectARB (prog);
+ endtest ();
+
+ /*
+ * Compile well-formed shader source. Check if multi-string sources can be handled.
+ */
+ begintest (TT_PARAM1_NONZERO, "Compile well-formed shader source");
+ tab[0] = uniforms;
+ tab[1] = validvertsrc;
+ glShaderSourceARB (vert, 2, tab, NULL);
+ glCompileShaderARB (vert);
+ endtest1 (CheckObjectStatus (vert));
+ tab[0] = uniforms;
+ tab[1] = validfragsrc;
+ glShaderSourceARB (frag, 2, tab, NULL);
+ glCompileShaderARB (frag);
+ endtest1 (CheckObjectStatus (frag));
+
+ /*
+ * Link vertex-fragment program.
+ */
+ begintest (TT_PARAM1_NONZERO, "Link vertex-fragment program");
+ glLinkProgramARB (prog);
+ endtest1 (CheckObjectStatus (prog));
+
+ /*
+ * Use valid linked program object.
+ */
+ begintest (TT_GETERROR_NOERROR, "Use linked program object");
+ glUseProgramObjectARB (prog);
+ endtest ();
+
+ /*
+ * Get current program.
+ */
+ begintest (TT_PARAM1_NONZERO, "Get current program");
+ endtest1 (glGetHandleARB (GL_PROGRAM_OBJECT_ARB) == prog);
+
+ /*
+ * Use 0 program object.
+ */
+ begintest (TT_GETERROR_NOERROR, "Use 0 program object");
+ glUseProgramObjectARB (0);
+ endtest ();
+
+ /*
+ * Query uniform location. Uniforms with gl_ prefix cannot be queried.
+ */
+ begintest (TT_PARAM1_NONZERO, "Query uniform location");
+ endtest1 (glGetUniformLocationARB (prog, "gl_ModelViewMatrix") == -1);
+ endtest1 (glGetUniformLocationARB (prog, "UniformThatDoesNotExist") == -1);
+ endtest1 (glGetUniformLocationARB (prog, "") == -1);
+ endtest1 (glGetUniformLocationARB (prog, "CommonUniform") != -1);
+ endtest1 (glGetUniformLocationARB (prog, "VertexUniform") != -1);
+ endtest1 (glGetUniformLocationARB (prog, "FragmentUniform") != -1);
+
+ /*
+ * Query attrib location. Attribs with gl_ prefix cannot be queried.
+ * When gl_Vertex is used, none of the generic attribs can have index 0.
+ */
+ begintest (TT_PARAM1_NONZERO, "Query attrib location");
+ endtest1 (glGetAttribLocationARB (prog, "gl_Vertex") == -1);
+ endtest1 (glGetAttribLocationARB (prog, "AttribThatDoesNotExist") == -1);
+ endtest1 (glGetAttribLocationARB (prog, "") == -1);
+ endtest1 (glGetAttribLocationARB (prog, "FirstAttrib") > 0);
+ endtest1 (glGetAttribLocationARB (prog, "SecondAttrib") > 0);
+
+ /*
+ * Bind attrib locations, link and check if locations are correct.
+ */
+ begintest (TT_PARAM1_NONZERO, "Bind attrib location #1");
+ glBindAttribLocationARB (prog, 1, "FirstAttrib");
+ glBindAttribLocationARB (prog, 2, "SecondAttrib");
+ glLinkProgramARB (prog);
+ endtest1 (CheckObjectStatus (prog));
+ endtest1 (glGetAttribLocationARB (prog, "FirstAttrib") == 1);
+ endtest1 (glGetAttribLocationARB (prog, "SecondAttrib") == 2);
+
+ /*
+ * Bind attrib locations in different order. Link and check if locations are correct.
+ */
+ begintest (TT_PARAM1_NONZERO, "Bind attrib location #2");
+ glBindAttribLocationARB (prog, 1, "SecondAttrib");
+ glBindAttribLocationARB (prog, 2, "FirstAttrib");
+ glLinkProgramARB (prog);
+ endtest1 (CheckObjectStatus (prog));
+ endtest1 (glGetAttribLocationARB (prog, "SecondAttrib") == 1);
+ endtest1 (glGetAttribLocationARB (prog, "FirstAttrib") == 2);
+
+ /*
+ * Detach deleted object.
+ */
+ begintest (TT_GETERROR_NOERROR, "Detach deleted object");
+ glDetachObjectARB (prog, vert);
+ endtest ();
+ glDetachObjectARB (prog, frag);
+ endtest ();
+
+ /*
+ * Delete deleted detached object.
+ */
+ begintest (TT_GETERROR_INVALIDVALUE, "Delete deleted detached object");
+ glDeleteObjectARB (vert);
+ endtest ();
+ glDeleteObjectARB (frag);
+ endtest ();
+
+ exit (0);
+}
+
+void RenderScene (void)
+{
+ /* never reached */
+ assert (0);
+}
+
+int main (int argc, char *argv[])
+{
+ InitFramework (&argc, argv);
+ return 0;
+}
+
--- /dev/null
+/*
+ * GL_ARB_vertex_shader test application. Feeds a vertex shader with attributes that
+ * that have magic values and check if the values received by the shader are the same.
+ *
+ * Requires specific support on the GL implementation side. A special function printMESA()
+ * must be supported in the language that prints variable's current value of generic type
+ * to the appropriate shader's info log, and optionally to the screen.
+ *
+ * Perfectly valid behaviour produces output that does not have a line
+ * beginning with three stars (***).
+ *
+ * Author: Michal Krol
+ */
+
+#include "framework.h"
+
+#define EPSILON 0.0001f
+
+static GLhandleARB vert = 0;
+static GLhandleARB prog = 0;
+
+enum SUBMIT_MODE
+{
+ SM_IM,
+ SM_VA,
+ SM_IM_DL,
+ SM_VA_DL,
+ SM_MAX
+};
+
+static enum SUBMIT_MODE submit_method = SM_IM;
+
+#define C 0
+#define S 1
+#define N 2
+#define V 3
+#define T 4
+#define F 5
+#define A 6
+
+struct ATTRIB_DATA
+{
+ const char *name;
+ GLuint dispatch;
+ GLint index;
+ GLint bind;
+ GLuint size;
+ GLfloat data[4];
+};
+
+static struct ATTRIB_DATA attribs[] = {
+ { "gl_Color", C, -1, -1, 4, { 4.2f, 0.56f, -2.1f, 0.29f } },
+ { "gl_SecondaryColor", S, -1, -1, 4, { 0.38f, 2.0f, 0.99f, 1.0f } },
+ { "gl_Normal", N, -1, -1, 3, { 54.0f, 77.0f, 1.15f, 0.0f } },
+ { "gl_MultiTexCoord0", T, 0, -1, 4, { 11.1f, 11.2f, 11.3f, 11.4f } },
+ { "gl_MultiTexCoord1", T, 1, -1, 4, { 22.1f, 22.2f, 22.3f, 22.4f } },
+ { "gl_MultiTexCoord2", T, 2, -1, 4, { 33.1f, 33.2f, 33.3f, 33.4f } },
+ { "gl_MultiTexCoord3", T, 3, -1, 4, { 44.1f, 44.2f, 44.3f, 44.4f } },
+ { "gl_MultiTexCoord4", T, 4, -1, 4, { 55.1f, 55.2f, 55.3f, 55.4f } },
+ { "gl_MultiTexCoord5", T, 5, -1, 4, { 66.1f, 66.2f, 66.3f, 66.4f } },
+ { "gl_MultiTexCoord6", T, 6, -1, 4, { 77.1f, 77.2f, 77.3f, 77.4f } },
+ { "gl_MultiTexCoord7", T, 7, -1, 4, { 88.1f, 88.2f, 88.3f, 88.4f } },
+ { "gl_FogCoord", F, -1, -1, 1, { 0.63f, 0.0f, 0.0f, 0.0f } },
+ { "Attribute1", A, 1, 1, 4, { 1.11f, 1.22f, 1.33f, 1.44f } },
+ { "Attribute2", A, 2, 2, 4, { 2.11f, 2.22f, 2.33f, 2.44f } },
+ { "Attribute3", A, 3, 3, 4, { 3.11f, 3.22f, 3.33f, 3.44f } },
+ { "Attribute4", A, 4, 4, 1, { 4.11f, 0.0f, 0.0f, 0.0f } },
+ { "Attribute5", A, 5, 5, 2, { 5.11f, 5.22f, 0.0f, 0.0f } },
+ { "Attribute6", A, 6, 6, 3, { 6.11f, 6.22f, 6.33f, 0.0f } },
+ { "Attribute7", A, 7, 7, 2, { 7.11f, 7.22f, 0.0f, 0.0f } },
+ { "Attribute7", A, 8, -1, 2, { 8.11f, 8.22f, 0.0f, 0.0f } },
+ { "Attribute9", A, 9, 9, 3, { 9.11f, 9.22f, 9.33f, 0.0f } },
+ { "Attribute9", A, 10, -1, 3, { 10.11f, 10.22f, 10.33f, 0.0f } },
+ { "Attribute9", A, 11, -1, 3, { 11.11f, 11.22f, 11.33f, 0.0f } },
+ { "Attribute12", A, 12, 12, 4, { 12.11f, 12.22f, 12.33f, 12.44f } },
+ { "Attribute12", A, 13, -1, 4, { 13.11f, 13.22f, 13.33f, 13.44f } },
+ { "Attribute12", A, 14, -1, 4, { 14.11f, 14.22f, 14.33f, 14.44f } },
+ { "Attribute12", A, 15, -1, 4, { 15.11f, 15.22f, 15.33f, 15.44f } },
+ { "gl_Vertex", V, 16, -1, 4, { 0.25f, -0.14f, 0.01f, 1.0f } }
+};
+
+static void im_render ()
+{
+ GLint i;
+
+ glBegin (GL_POINTS);
+ for (i = 0; i < sizeof (attribs) / sizeof (*attribs); i++) {
+ struct ATTRIB_DATA *att = &attribs[i];
+ switch (att->dispatch)
+ {
+ case C:
+ glColor4fv (att->data);
+ break;
+ case S:
+ glSecondaryColor3fvEXT (att->data);
+ break;
+ case N:
+ glNormal3fv (att->data);
+ break;
+ case V:
+ glVertex4fv (att->data);
+ break;
+ case T:
+ assert (att->index >= 0 && att->index < 8);
+ glMultiTexCoord4fvARB (GL_TEXTURE0_ARB + att->index, att->data);
+ break;
+ case F:
+ glFogCoordfvEXT (att->data);
+ break;
+ case A:
+ assert (att->index > 0 && att->index < 16);
+ glVertexAttrib4fvARB (att->index, att->data);
+ break;
+ default:
+ assert (0);
+ }
+ }
+ glEnd ();
+}
+
+static void va_render ()
+{
+ GLint i;
+
+ for (i = 0; i < sizeof (attribs) / sizeof (*attribs); i++) {
+ struct ATTRIB_DATA *att = &attribs[i];
+ switch (att->dispatch)
+ {
+ case C:
+ glColorPointer (4, GL_FLOAT, 0, att->data);
+ glEnable (GL_COLOR_ARRAY);
+ break;
+ case S:
+ glSecondaryColorPointerEXT (4, GL_FLOAT, 0, att->data);
+ glEnable (GL_SECONDARY_COLOR_ARRAY_EXT);
+ break;
+ case N:
+ glNormalPointer (GL_FLOAT, 0, att->data);
+ glEnable (GL_NORMAL_ARRAY);
+ break;
+ case V:
+ glVertexPointer (4, GL_FLOAT, 0, att->data);
+ glEnable (GL_VERTEX_ARRAY);
+ break;
+ case T:
+ assert (att->index >= 0 && att->index < 8);
+ glClientActiveTextureARB (GL_TEXTURE0_ARB + att->index);
+ glTexCoordPointer (4, GL_FLOAT, 0, att->data);
+ glEnable (GL_TEXTURE_COORD_ARRAY);
+ break;
+ case F:
+ glFogCoordPointerEXT (GL_FLOAT, 0, att->data);
+ glEnable (GL_FOG_COORDINATE_ARRAY_EXT);
+ break;
+ case A:
+ assert (att->index > 0 && att->index < 16);
+ glVertexAttribPointerARB (att->index, 4, GL_FLOAT, GL_FALSE, 0, att->data);
+ glEnableVertexAttribArrayARB (att->index);
+ break;
+ default:
+ assert (0);
+ }
+ }
+
+ glDrawArrays (GL_POINTS, 0, 1);
+
+ for (i = 0; i < sizeof (attribs) / sizeof (*attribs); i++) {
+ struct ATTRIB_DATA *att = &attribs[i];
+ switch (att->dispatch)
+ {
+ case C:
+ glDisable (GL_COLOR_ARRAY);
+ break;
+ case S:
+ glDisable (GL_SECONDARY_COLOR_ARRAY_EXT);
+ break;
+ case N:
+ glDisable (GL_NORMAL_ARRAY);
+ break;
+ case V:
+ glDisable (GL_VERTEX_ARRAY);
+ break;
+ case T:
+ glClientActiveTextureARB (GL_TEXTURE0_ARB + att->index);
+ glDisable (GL_TEXTURE_COORD_ARRAY);
+ break;
+ case F:
+ glDisable (GL_FOG_COORDINATE_ARRAY_EXT);
+ break;
+ case A:
+ glDisableVertexAttribArrayARB (att->index);
+ break;
+ default:
+ assert (0);
+ }
+ }
+}
+
+static void dl_start ()
+{
+ glNewList (GL_COMPILE, 1);
+}
+
+static void dl_end ()
+{
+ glEndList ();
+ glCallList (1);
+}
+
+static void load_test_file (const char *filename)
+{
+ FILE *f;
+ long size;
+ char *code;
+ GLint i;
+
+ f = fopen (filename, "r");
+ if (f == NULL)
+ return;
+
+ fseek (f, 0, SEEK_END);
+ size = ftell (f);
+ fseek (f, 0, SEEK_SET);
+
+ code = (char *) (malloc (size));
+ if (code == NULL) {
+ fclose (f);
+ return;
+ }
+ size = fread (code, 1, size, f);
+ fclose (f);
+
+ glShaderSourceARB (vert, 1, &code, &size);
+ glCompileShaderARB (vert);
+ if (!CheckObjectStatus (vert))
+ exit (0);
+
+ for (i = 0; i < sizeof (attribs) / sizeof (*attribs); i++)
+ if (attribs[i].dispatch == A && attribs[i].bind != -1)
+ glBindAttribLocationARB (prog, attribs[i].bind, attribs[i].name);
+}
+
+void InitScene (void)
+{
+ prog = glCreateProgramObjectARB ();
+ vert = glCreateShaderObjectARB (GL_VERTEX_SHADER_ARB);
+ glAttachObjectARB (prog, vert);
+ glDeleteObjectARB (vert);
+ load_test_file ("vstest.txt");
+ glLinkProgramARB (prog);
+ if (!CheckObjectStatus (prog))
+ exit (0);
+ glUseProgramObjectARB (prog);
+}
+
+void RenderScene (void)
+{
+ GLint info_length, length;
+ char output[65000], *p;
+ GLint i;
+
+ if (submit_method == SM_MAX)
+ exit (0);
+
+ /*
+ * Get the current size of the info log. Any text output produced by executed
+ * shader will be appended to the end of log.
+ */
+ glGetObjectParameterivARB (vert, GL_OBJECT_INFO_LOG_LENGTH_ARB, &info_length);
+
+ switch (submit_method)
+ {
+ case SM_IM:
+ printf ("\n--- TESTING IMMEDIATE MODE\n");
+ im_render ();
+ break;
+ case SM_VA:
+ printf ("\n--- TESTING VERTEX ARRAY MODE\n");
+ va_render ();
+ break;
+ case SM_IM_DL:
+ printf ("\n--- TESTING IMMEDIATE + DISPLAY LIST MODE\n");
+ dl_start ();
+ im_render ();
+ dl_end ();
+ break;
+ case SM_VA_DL:
+ printf ("\n--- TESTING VERTEX ARRAY + DISPLAY LIST MODE\n");
+ dl_start ();
+ va_render ();
+ dl_end ();
+ break;
+ default:
+ assert (0);
+ }
+
+ glFlush ();
+
+ /*
+ * Get the info log and set the pointer to the beginning of the output.
+ */
+ glGetInfoLogARB (vert, sizeof (output), &length, output);
+ p = output + info_length - 1;
+
+ for (i = 0; i < sizeof (attribs) / sizeof (*attribs); i++) {
+ GLuint j;
+ for (j = 0; j < attribs[i].size; j++) {
+ GLfloat value;
+ if (p == NULL) {
+ printf ("*** %s\n", "I/O error");
+ break;
+ }
+ if (strncmp (p, "true", 4) == 0)
+ value = 1.0f;
+ else if (strncmp (p, "false", 5) == 0)
+ value = 0.0f;
+ else if (sscanf (p, "%f", &value) != 1) {
+ printf ("*** %s\n", "I/O error");
+ p = NULL;
+ break;
+ }
+ if (fabs (value - attribs[i].data[j]) > EPSILON)
+ printf ("*** %s\n", "Values are different");
+ p = strchr (p, '\n');
+ if (p != NULL)
+ p++;
+ }
+ if (p == NULL)
+ break;
+ }
+
+ submit_method++;
+}
+
+int main (int argc, char *argv[])
+{
+ InitFramework (&argc, argv);
+ return 0;
+}
+
--- /dev/null
+/*\r
+ * Vertex shader test.\r
+ * Uses all conventional attributes and 15 generic attributes to print\r
+ * their values, using printMESA() extension function, to the debugger\r
+ * to compare them with the actual passed-in values.\r
+ * Use different types for generic attributes to check matrix handling.\r
+ *\r
+ * Author: Michal Krol\r
+ */\r
+\r
+#version 110\r
+\r
+//#extension MESA_shader_debug: require\r
+\r
+attribute vec4 Attribute1;\r
+attribute vec4 Attribute2;\r
+attribute vec4 Attribute3;\r
+attribute float Attribute4;\r
+attribute vec2 Attribute5;\r
+attribute vec3 Attribute6;\r
+attribute mat2 Attribute7;\r
+attribute mat3 Attribute9;\r
+attribute mat4 Attribute12;\r
+\r
+void main ()\r
+{\r
+ //\r
+ // Do some legal stuff.\r
+ //\r
+ gl_Position = gl_ModelViewMatrix * gl_Vertex;\r
+ gl_FrontColor = vec4 (1.0);\r
+\r
+ //\r
+ // Conventional attributes - except for gl_Vertex.\r
+ //\r
+ printMESA (gl_Color);\r
+ printMESA (gl_SecondaryColor);\r
+ printMESA (gl_Normal);\r
+ printMESA (gl_MultiTexCoord0);\r
+ printMESA (gl_MultiTexCoord1);\r
+ printMESA (gl_MultiTexCoord2);\r
+ printMESA (gl_MultiTexCoord3);\r
+ printMESA (gl_MultiTexCoord4);\r
+ printMESA (gl_MultiTexCoord5);\r
+ printMESA (gl_MultiTexCoord6);\r
+ printMESA (gl_MultiTexCoord7);\r
+ printMESA (gl_FogCoord);\r
+\r
+ //\r
+ // Generic attributes - attrib with index 0 is not used because it would\r
+ // alias with gl_Vertex, which is not allowed.\r
+ //\r
+ printMESA (Attribute1);\r
+ printMESA (Attribute2);\r
+ printMESA (Attribute3);\r
+ printMESA (Attribute4);\r
+ printMESA (Attribute5);\r
+ printMESA (Attribute6);\r
+ printMESA (Attribute7);\r
+ printMESA (Attribute9);\r
+ printMESA (Attribute12);\r
+\r
+ //\r
+ // Vertex position goes last.\r
+ //\r
+ printMESA (gl_Vertex);\r
+}\r
+\r
--- /dev/null
+# Microsoft Developer Studio Project File - Name="cltest" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** DO NOT EDIT **\r
+\r
+# TARGTYPE "Win32 (x86) Console Application" 0x0103\r
+\r
+CFG=cltest - Win32 Debug\r
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
+!MESSAGE use the Export Makefile command and run\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "cltest.mak".\r
+!MESSAGE \r
+!MESSAGE You can specify a configuration when running NMAKE\r
+!MESSAGE by defining the macro CFG on the command line. For example:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "cltest.mak" CFG="cltest - Win32 Debug"\r
+!MESSAGE \r
+!MESSAGE Possible choices for configuration are:\r
+!MESSAGE \r
+!MESSAGE "cltest - Win32 Release" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "cltest - Win32 Debug" (based on "Win32 (x86) Console Application")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+RSC=rc.exe\r
+\r
+!IF "$(CFG)" == "cltest - Win32 Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "Release"\r
+# PROP BASE Intermediate_Dir "Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "cltest_release"\r
+# PROP Intermediate_Dir "cltest_release"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
+# ADD BASE RSC /l 0x415 /d "NDEBUG"\r
+# ADD RSC /l 0x415 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
+\r
+!ELSEIF "$(CFG)" == "cltest - Win32 Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "Debug"\r
+# PROP BASE Intermediate_Dir "Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "cltest_debug"\r
+# PROP Intermediate_Dir "cltest_debug"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c\r
+# ADD BASE RSC /l 0x415 /d "_DEBUG"\r
+# ADD RSC /l 0x415 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "cltest - Win32 Release"\r
+# Name "cltest - Win32 Debug"\r
+# Begin Source File\r
+\r
+SOURCE=..\..\cltest.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\cltest.txt\r
+# End Source File\r
+# End Target\r
+# End Project\r
--- /dev/null
+# Microsoft Developer Studio Project File - Name="framework" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** DO NOT EDIT **\r
+\r
+# TARGTYPE "Win32 (x86) Static Library" 0x0104\r
+\r
+CFG=framework - Win32 Debug\r
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
+!MESSAGE use the Export Makefile command and run\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "framework.mak".\r
+!MESSAGE \r
+!MESSAGE You can specify a configuration when running NMAKE\r
+!MESSAGE by defining the macro CFG on the command line. For example:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "framework.mak" CFG="framework - Win32 Debug"\r
+!MESSAGE \r
+!MESSAGE Possible choices for configuration are:\r
+!MESSAGE \r
+!MESSAGE "framework - Win32 Release" (based on "Win32 (x86) Static Library")\r
+!MESSAGE "framework - Win32 Debug" (based on "Win32 (x86) Static Library")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+RSC=rc.exe\r
+\r
+!IF "$(CFG)" == "framework - Win32 Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "Release"\r
+# PROP BASE Intermediate_Dir "Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "framework_release"\r
+# PROP Intermediate_Dir "framework_release"\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c\r
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c\r
+# ADD BASE RSC /l 0x415 /d "NDEBUG"\r
+# ADD RSC /l 0x415 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LIB32=link.exe -lib\r
+# ADD BASE LIB32 /nologo\r
+# ADD LIB32 /nologo\r
+\r
+!ELSEIF "$(CFG)" == "framework - Win32 Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "Debug"\r
+# PROP BASE Intermediate_Dir "Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "framework_debug"\r
+# PROP Intermediate_Dir "framework_debug"\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c\r
+# ADD BASE RSC /l 0x415 /d "_DEBUG"\r
+# ADD RSC /l 0x415 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LIB32=link.exe -lib\r
+# ADD BASE LIB32 /nologo\r
+# ADD LIB32 /nologo\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "framework - Win32 Release"\r
+# Name "framework - Win32 Debug"\r
+# Begin Source File\r
+\r
+SOURCE=..\..\framework.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\framework.h\r
+# End Source File\r
+# End Target\r
+# End Project\r
--- /dev/null
+Microsoft Developer Studio Workspace File, Format Version 6.00\r
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!\r
+\r
+###############################################################################\r
+\r
+Project: "cltest"=".\cltest.dsp" - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+ Begin Project Dependency\r
+ Project_Dep_Name framework\r
+ End Project Dependency\r
+}}}\r
+\r
+###############################################################################\r
+\r
+Project: "framework"=".\framework.dsp" - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+}}}\r
+\r
+###############################################################################\r
+\r
+Project: "sotest"=".\sotest.dsp" - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+ Begin Project Dependency\r
+ Project_Dep_Name framework\r
+ End Project Dependency\r
+}}}\r
+\r
+###############################################################################\r
+\r
+Project: "vstest"=".\vstest.dsp" - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+ Begin Project Dependency\r
+ Project_Dep_Name framework\r
+ End Project Dependency\r
+}}}\r
+\r
+###############################################################################\r
+\r
+Global:\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<3>\r
+{{{\r
+}}}\r
+\r
+###############################################################################\r
+\r
--- /dev/null
+# Microsoft Developer Studio Project File - Name="sotest" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** DO NOT EDIT **\r
+\r
+# TARGTYPE "Win32 (x86) Console Application" 0x0103\r
+\r
+CFG=sotest - Win32 Debug\r
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
+!MESSAGE use the Export Makefile command and run\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "sotest.mak".\r
+!MESSAGE \r
+!MESSAGE You can specify a configuration when running NMAKE\r
+!MESSAGE by defining the macro CFG on the command line. For example:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "sotest.mak" CFG="sotest - Win32 Debug"\r
+!MESSAGE \r
+!MESSAGE Possible choices for configuration are:\r
+!MESSAGE \r
+!MESSAGE "sotest - Win32 Release" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "sotest - Win32 Debug" (based on "Win32 (x86) Console Application")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+RSC=rc.exe\r
+\r
+!IF "$(CFG)" == "sotest - Win32 Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "Release"\r
+# PROP BASE Intermediate_Dir "Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "sotest_release"\r
+# PROP Intermediate_Dir "sotest_release"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
+# ADD BASE RSC /l 0x415 /d "NDEBUG"\r
+# ADD RSC /l 0x415 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
+\r
+!ELSEIF "$(CFG)" == "sotest - Win32 Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "Debug"\r
+# PROP BASE Intermediate_Dir "Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "sotest_debug"\r
+# PROP Intermediate_Dir "sotest_debug"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c\r
+# ADD BASE RSC /l 0x415 /d "_DEBUG"\r
+# ADD RSC /l 0x415 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "sotest - Win32 Release"\r
+# Name "sotest - Win32 Debug"\r
+# Begin Source File\r
+\r
+SOURCE=..\..\sotest.c\r
+# End Source File\r
+# End Target\r
+# End Project\r
--- /dev/null
+# Microsoft Developer Studio Project File - Name="vstest" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** DO NOT EDIT **\r
+\r
+# TARGTYPE "Win32 (x86) Console Application" 0x0103\r
+\r
+CFG=vstest - Win32 Debug\r
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
+!MESSAGE use the Export Makefile command and run\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "vstest.mak".\r
+!MESSAGE \r
+!MESSAGE You can specify a configuration when running NMAKE\r
+!MESSAGE by defining the macro CFG on the command line. For example:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "vstest.mak" CFG="vstest - Win32 Debug"\r
+!MESSAGE \r
+!MESSAGE Possible choices for configuration are:\r
+!MESSAGE \r
+!MESSAGE "vstest - Win32 Release" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "vstest - Win32 Debug" (based on "Win32 (x86) Console Application")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+RSC=rc.exe\r
+\r
+!IF "$(CFG)" == "vstest - Win32 Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "Release"\r
+# PROP BASE Intermediate_Dir "Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "vstest_release"\r
+# PROP Intermediate_Dir "vstest_release"\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
+# ADD BASE RSC /l 0x415 /d "NDEBUG"\r
+# ADD RSC /l 0x415 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
+\r
+!ELSEIF "$(CFG)" == "vstest - Win32 Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "Debug"\r
+# PROP BASE Intermediate_Dir "Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "vstest_debug"\r
+# PROP Intermediate_Dir "vstest_debug"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c\r
+# ADD BASE RSC /l 0x415 /d "_DEBUG"\r
+# ADD RSC /l 0x415 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "vstest - Win32 Release"\r
+# Name "vstest - Win32 Debug"\r
+# Begin Source File\r
+\r
+SOURCE=..\..\vstest.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\vstest.txt\r
+# End Source File\r
+# End Target\r
+# End Project\r