Make it running under Linux.

This commit is contained in:
Michal Krol 2006-05-30 09:38:16 +00:00
parent 44d5c8668a
commit 23b7c7dc14
8 changed files with 1559 additions and 1481 deletions

67
progs/slang/Makefile Normal file
View File

@ -0,0 +1,67 @@
# progs/slang/Makefile
TOP = ../..
include $(TOP)/configs/current
INCDIR = $(TOP)/include
LIB_DEP = $(LIB_DIR)/$(GL_LIB_NAME)
#
# targets
#
.PHONY: default tests clean
default: cltest sotest vstest
tests: default
! ./sotest 2> /dev/null | (grep -e ^[*][*][*])
! ./vstest 2> /dev/null | (grep -e ^[*][*][*])
! ./cltest 2> /dev/null | (grep -e ^[*][*][*])
clean:
rm -f cltest.o sotest.o vstest.o framework.o cltest sotest vstest
#
# executables
#
cltest: cltest.o framework.o $(LIB_DEP)
$(CC) cltest.o framework.o $(APP_LIB_DEPS) -o cltest
sotest: sotest.o framework.o $(LIB_DEP)
$(CC) sotest.o framework.o $(APP_LIB_DEPS) -o sotest
vstest: vstest.o framework.o $(LIB_DEP)
$(CC) vstest.o framework.o $(APP_LIB_DEPS) -o vstest
#
# objects
#
framework.o: framework.c
$(CC) -c -I$(INCDIR) framework.c -o framework.o
cltest.o: cltest.c
$(CC) -c -I$(INCDIR) cltest.c -o cltest.o
sotest.o: sotest.c
$(CC) -c -I$(INCDIR) sotest.c -o sotest.o
vstest.o: vstest.c
$(CC) -c -I$(INCDIR) vstest.c -o vstest.o
#
# sources
#
framework.c: framework.h
cltest.c: framework.h
sotest.c: framework.h
vstest.c: framework.h

7
progs/slang/README Normal file
View File

@ -0,0 +1,7 @@
GLSL regression tests.
Type "make" to build all test apps.
Type "make tests" to build and run all test apps. If any
error is detected, a line starting with *** is output.

View File

@ -76,8 +76,8 @@ 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;
enum PROGRAM_LOAD_STATE pls = PLS_NONE;
enum SHADER_LOAD_STATE sls = SLS_NONE;
f = fopen (filename, "r");
if (f == NULL)
@ -174,7 +174,7 @@ void RenderScene (void)
exit (0);
code = program->vertex.code;
glShaderSourceARB (vert, 1, &code, NULL);
glShaderSourceARB (vert, 1, (const GLcharARB **) (&code), NULL);
glCompileShaderARB (vert);
CheckObjectStatus (vert);

File diff suppressed because it is too large Load Diff

View File

@ -3,8 +3,10 @@
/*
* GL_ARB_multitexture
*/
#ifndef GL_ARB_multitexture
PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB;
PFNGLMULTITEXCOORD4FVARBPROC glMultiTexCoord4fvARB;
#endif
/*
* GL_ARB_shader_objects
@ -65,8 +67,10 @@ void InitFramework (int *argc, char *argv[])
glutInitDisplayMode (GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow (argv[0]);
#ifndef GL_ARB_multitexture
GETPROCADDR(glClientActiveTextureARB, PFNGLCLIENTACTIVETEXTUREARBPROC);
GETPROCADDR(glMultiTexCoord4fvARB, PFNGLMULTITEXCOORD4FVARBPROC);
#endif
GETPROCADDR(glDeleteObjectARB, PFNGLDELETEOBJECTARBPROC);
GETPROCADDR(glGetHandleARB, PFNGLGETHANDLEARBPROC);
@ -100,9 +104,6 @@ void InitFramework (int *argc, char *argv[])
InitScene ();
/*glutReshapeFunc (Reshape);
glutKeyboardFunc (Key);
glutSpecialFunc (SpecialKey);*/
glutDisplayFunc (Display);
glutIdleFunc (Idle);
glutMainLoop ();

View File

@ -6,9 +6,10 @@
#include <windows.h>
#endif
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glut.h>
@ -25,8 +26,10 @@
/*
* GL_ARB_multitexture
*/
#ifndef GL_ARB_multitexture
extern PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB;
extern PFNGLMULTITEXCOORD4FVARBPROC glMultiTexCoord4fvARB;
#endif
/*
* GL_ARB_shader_objects
@ -68,12 +71,12 @@ extern PFNGLFOGCOORDPOINTEREXTPROC glFogCoordPointerEXT;
extern PFNGLSECONDARYCOLOR3FVEXTPROC glSecondaryColor3fvEXT;
extern PFNGLSECONDARYCOLORPOINTEREXTPROC glSecondaryColorPointerEXT;
void InitFramework (int *argc, char *argv[]);
extern void InitFramework (int *argc, char *argv[]);
extern void InitScene (void);
extern void RenderScene (void);
GLboolean CheckObjectStatus (GLhandleARB);
extern GLboolean CheckObjectStatus (GLhandleARB);
#endif

View File

@ -210,7 +210,7 @@ static void dl_end ()
static void load_test_file (const char *filename)
{
FILE *f;
long size;
GLint size;
char *code;
GLint i;
@ -230,7 +230,7 @@ static void load_test_file (const char *filename)
size = fread (code, 1, size, f);
fclose (f);
glShaderSourceARB (vert, 1, &code, &size);
glShaderSourceARB (vert, 1, (const GLcharARB **) (&code), &size);
glCompileShaderARB (vert);
if (!CheckObjectStatus (vert))
exit (0);

View File

@ -1,68 +1,68 @@
/*
* Vertex shader test.
* Uses all conventional attributes and 15 generic attributes to print
* their values, using printMESA() extension function, to the debugger
* to compare them with the actual passed-in values.
* Use different types for generic attributes to check matrix handling.
*
* Author: Michal Krol
*/
#version 110
//#extension MESA_shader_debug: require
attribute vec4 Attribute1;
attribute vec4 Attribute2;
attribute vec4 Attribute3;
attribute float Attribute4;
attribute vec2 Attribute5;
attribute vec3 Attribute6;
attribute mat2 Attribute7;
attribute mat3 Attribute9;
attribute mat4 Attribute12;
void main ()
{
//
// Do some legal stuff.
//
gl_Position = gl_ModelViewMatrix * gl_Vertex;
gl_FrontColor = vec4 (1.0);
//
// Conventional attributes - except for gl_Vertex.
//
printMESA (gl_Color);
printMESA (gl_SecondaryColor);
printMESA (gl_Normal);
printMESA (gl_MultiTexCoord0);
printMESA (gl_MultiTexCoord1);
printMESA (gl_MultiTexCoord2);
printMESA (gl_MultiTexCoord3);
printMESA (gl_MultiTexCoord4);
printMESA (gl_MultiTexCoord5);
printMESA (gl_MultiTexCoord6);
printMESA (gl_MultiTexCoord7);
printMESA (gl_FogCoord);
//
// Generic attributes - attrib with index 0 is not used because it would
// alias with gl_Vertex, which is not allowed.
//
printMESA (Attribute1);
printMESA (Attribute2);
printMESA (Attribute3);
printMESA (Attribute4);
printMESA (Attribute5);
printMESA (Attribute6);
printMESA (Attribute7);
printMESA (Attribute9);
printMESA (Attribute12);
//
// Vertex position goes last.
//
printMESA (gl_Vertex);
}
/*
* Vertex shader test.
* Uses all conventional attributes and 15 generic attributes to print
* their values, using printMESA() extension function, to the debugger
* to compare them with the actual passed-in values.
* Use different types for generic attributes to check matrix handling.
*
* Author: Michal Krol
*/
#version 110
//#extension MESA_shader_debug: require
attribute vec4 Attribute1;
attribute vec4 Attribute2;
attribute vec4 Attribute3;
attribute float Attribute4;
attribute vec2 Attribute5;
attribute vec3 Attribute6;
attribute mat2 Attribute7;
attribute mat3 Attribute9;
attribute mat4 Attribute12;
void main ()
{
//
// Do some legal stuff.
//
gl_Position = gl_ModelViewMatrix * gl_Vertex;
gl_FrontColor = vec4 (1.0);
//
// Conventional attributes - except for gl_Vertex.
//
printMESA (gl_Color);
printMESA (gl_SecondaryColor);
printMESA (gl_Normal);
printMESA (gl_MultiTexCoord0);
printMESA (gl_MultiTexCoord1);
printMESA (gl_MultiTexCoord2);
printMESA (gl_MultiTexCoord3);
printMESA (gl_MultiTexCoord4);
printMESA (gl_MultiTexCoord5);
printMESA (gl_MultiTexCoord6);
printMESA (gl_MultiTexCoord7);
printMESA (gl_FogCoord);
//
// Generic attributes - attrib with index 0 is not used because it would
// alias with gl_Vertex, which is not allowed.
//
printMESA (Attribute1);
printMESA (Attribute2);
printMESA (Attribute3);
printMESA (Attribute4);
printMESA (Attribute5);
printMESA (Attribute6);
printMESA (Attribute7);
printMESA (Attribute9);
printMESA (Attribute12);
//
// Vertex position goes last.
//
printMESA (gl_Vertex);
}