diff options
author | Ben Skeggs <[email protected]> | 2008-09-11 06:09:05 +1000 |
---|---|---|
committer | Ben Skeggs <[email protected]> | 2008-09-11 06:09:05 +1000 |
commit | 7158203b081ad34c03382f07e0df748eae235e9b (patch) | |
tree | ee61efebbafb5464ec090c21b5e05533588789a1 /progs | |
parent | 02025148c28d03d644e3d66dde1a423fe21e1c44 (diff) | |
parent | eb5b16d278e0f7ee0121049e43dfee1d52f2b0f7 (diff) |
Merge remote branch 'upstream/gallium-0.1' into nouveau-gallium-0.1
Conflicts:
configs/default
Diffstat (limited to 'progs')
-rw-r--r-- | progs/egl/eglgears.c | 2 | ||||
-rw-r--r-- | progs/egl/egltri.c | 2 | ||||
-rw-r--r-- | progs/trivial/Makefile | 1 | ||||
-rw-r--r-- | progs/trivial/long-fixed-func.c | 151 | ||||
-rw-r--r-- | progs/vp/exp.txt | 5 | ||||
-rw-r--r-- | progs/vp/log.txt | 6 | ||||
-rw-r--r-- | progs/vp/vp-tris.c | 63 | ||||
-rw-r--r-- | progs/vp/windows/vp2003.sln | 21 | ||||
-rw-r--r-- | progs/vp/windows/vp2003.vcproj | 121 |
9 files changed, 362 insertions, 10 deletions
diff --git a/progs/egl/eglgears.c b/progs/egl/eglgears.c index 20f6c1ff6ea..31346d95230 100644 --- a/progs/egl/eglgears.c +++ b/progs/egl/eglgears.c @@ -415,7 +415,7 @@ main(int argc, char *argv[]) eglGetModeAttribMESA(d, mode[i], EGL_WIDTH, &w); eglGetModeAttribMESA(d, mode[i], EGL_HEIGHT, &h); printf("%3d: %d x %d\n", i, w, h); - if (w > width && h > height && w <= 1280 && h <= 1024) { + if (w > width && h > height) { width = w; height = h; chosenMode = i; diff --git a/progs/egl/egltri.c b/progs/egl/egltri.c index 78c67939b28..44096d94a27 100644 --- a/progs/egl/egltri.c +++ b/progs/egl/egltri.c @@ -201,7 +201,7 @@ int main(int argc, char *argv[]) eglGetModeAttribMESA(d, mode[i], EGL_WIDTH, &w); eglGetModeAttribMESA(d, mode[i], EGL_HEIGHT, &h); printf("%3d: %d x %d\n", i, w, h); - if (w > width && h > height && w <= 1280 && h <= 1024) { + if (w > width && h > height) { width = w; height = h; chosenMode = i; diff --git a/progs/trivial/Makefile b/progs/trivial/Makefile index 786576cd13b..d745fefbbf4 100644 --- a/progs/trivial/Makefile +++ b/progs/trivial/Makefile @@ -41,6 +41,7 @@ SOURCES = \ linestrip-stipple-wide.c \ linestrip-stipple.c \ linestrip.c \ + long-fixed-func.c \ pgon-mode.c \ point-clip.c \ point-param.c \ diff --git a/progs/trivial/long-fixed-func.c b/progs/trivial/long-fixed-func.c new file mode 100644 index 00000000000..88f4fe01ec8 --- /dev/null +++ b/progs/trivial/long-fixed-func.c @@ -0,0 +1,151 @@ +/** + * Enable as much fixed-function vertex processing state as possible + * to test fixed-function -> program code generation. + */ + + + +#define GL_GLEXT_PROTOTYPES +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <GL/glut.h> + + +static void +Reshape(int width, int height) +{ + glViewport(0, 0, (GLint)width, (GLint)height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); + glMatrixMode(GL_MODELVIEW); +} + + +static void +Draw(void) +{ + glClear(GL_COLOR_BUFFER_BIT); + + glBegin(GL_TRIANGLES); + glColor3f(.8,0,0); + glVertex3f(-0.9, -0.9, -30.0); + glColor3f(0,.9,0); + glVertex3f( 0.9, -0.9, -30.0); + glColor3f(0,0,.7); + glVertex3f( 0.0, 0.9, -30.0); + glEnd(); + + glFlush(); + + glutSwapBuffers(); +} + + +static void +Init(void) +{ + GLubyte tex[16][16][4]; + GLfloat pos[4] = {5, 10, 3, 1.0}; + int i, j; + + fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); + fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); + fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + + glClearColor(0.3, 0.1, 0.3, 0.0); + + for (i = 0; i < 16; i++) { + for (j = 0; j < 16; j++) { + if ((i+j) & 1) { + tex[i][j][0] = 100; + tex[i][j][1] = 100; + tex[i][j][2] = 100; + tex[i][j][3] = 255; + } + else { + tex[i][j][0] = 200; + tex[i][j][1] = 200; + tex[i][j][2] = 200; + tex[i][j][3] = 255; + } + } + } + + + glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 1); + glFogi(GL_FOG_MODE, GL_LINEAR); + glEnable(GL_FOG); + + glPointParameterfv(GL_DISTANCE_ATTENUATION_EXT, pos); + + for (i = 0; i < 8; i++) { + GLuint texObj; + + glEnable(GL_LIGHT0 + i); + glLightf(GL_LIGHT0 + i, GL_SPOT_EXPONENT, 3.5); + glLightf(GL_LIGHT0 + i, GL_SPOT_CUTOFF, 30.); + glLightf(GL_LIGHT0 + i, GL_CONSTANT_ATTENUATION, 3.); + glLightf(GL_LIGHT0 + i, GL_LINEAR_ATTENUATION, 3.); + glLightf(GL_LIGHT0 + i, GL_QUADRATIC_ATTENUATION, 3.); + glLightfv(GL_LIGHT0 + i, GL_POSITION, pos); + + glActiveTexture(GL_TEXTURE0 + i); + glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); + glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); + glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); + glTexGeni(GL_Q, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); + glEnable(GL_TEXTURE_GEN_S); + glEnable(GL_TEXTURE_GEN_T); + glEnable(GL_TEXTURE_GEN_R); + glEnable(GL_TEXTURE_GEN_Q); + glEnable(GL_TEXTURE_2D); + + glMatrixMode(GL_TEXTURE); + glScalef(2.0, 1.0, 3.0); + + glGenTextures(1, &texObj); + glBindTexture(GL_TEXTURE_2D, texObj); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, + GL_RGBA, GL_UNSIGNED_BYTE, tex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + } + + glEnable(GL_LIGHTING); + glActiveTexture(GL_TEXTURE0); + glMatrixMode(GL_MODELVIEW); +} + + +static void +Key(unsigned char key, int x, int y) +{ + if (key == 27) { + exit(0); + } + glutPostRedisplay(); +} + + +int +main(int argc, char **argv) +{ + GLenum type = GLUT_RGB | GLUT_DOUBLE; + + glutInit(&argc, argv); + glutInitWindowPosition(0, 0); + glutInitWindowSize( 250, 250); + glutInitDisplayMode(type); + if (glutCreateWindow("tri-long-fixedfunc") == GL_FALSE) { + exit(1); + } + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutDisplayFunc(Draw); + Init(); + glutMainLoop(); + return 0; +} diff --git a/progs/vp/exp.txt b/progs/vp/exp.txt new file mode 100644 index 00000000000..601aae7d715 --- /dev/null +++ b/progs/vp/exp.txt @@ -0,0 +1,5 @@ +!!VP1.0 +EXP R0, v[COL0].x; +ADD o[COL0], R0.z, -R0.w; +MOV o[HPOS], v[OPOS]; +END diff --git a/progs/vp/log.txt b/progs/vp/log.txt new file mode 100644 index 00000000000..9b042684335 --- /dev/null +++ b/progs/vp/log.txt @@ -0,0 +1,6 @@ +!!VP1.0 +ADD R0, v[COL0], v[COL0]; +ADD R0, R0, R0; +LOG o[COL0], R0.x; +MOV o[HPOS], v[OPOS]; +END diff --git a/progs/vp/vp-tris.c b/progs/vp/vp-tris.c index eb450cb5981..3fe35f7e3e6 100644 --- a/progs/vp/vp-tris.c +++ b/progs/vp/vp-tris.c @@ -5,10 +5,27 @@ #include <stdio.h> #include <stdlib.h> #include <math.h> -#define GL_GLEXT_PROTOTYPES #include <GL/glut.h> + +#ifndef WIN32 #include <unistd.h> #include <signal.h> +#define GL_GLEXT_PROTOTYPES +#else +#include <GL/glext.h> +#endif + +#ifdef WIN32 +static PFNGLBINDPROGRAMARBPROC glBindProgramARB = NULL; +static PFNGLGENPROGRAMSARBPROC glGenProgramsARB = NULL; +static PFNGLPROGRAMSTRINGARBPROC glProgramStringARB = NULL; +static PFNGLISPROGRAMARBPROC glIsProgramARB = NULL; + +static PFNGLBINDPROGRAMNVPROC glBindProgramNV = NULL; +static PFNGLGENPROGRAMSNVPROC glGenProgramsNV = NULL; +static PFNGLLOADPROGRAMNVPROC glLoadProgramNV = NULL; +static PFNGLISPROGRAMNVPROC glIsProgramNV = NULL; +#endif static const char *filename = NULL; static GLuint nr_steps = 4; @@ -25,6 +42,9 @@ static void usage( char *name ) unsigned show_fps = 0; unsigned int frame_cnt = 0; + +#ifndef WIN32 + void alarmhandler(int); void alarmhandler (int sig) @@ -39,6 +59,8 @@ void alarmhandler (int sig) alarm(5); } +#endif + static void args(int argc, char *argv[]) { GLint i; @@ -83,7 +105,7 @@ static void Init( void ) exit(1); } - sz = fread(buf, 1, sizeof(buf), f); + sz = (GLuint) fread(buf, 1, sizeof(buf), f); if (!feof(f)) { fprintf(stderr, "file too long\n"); exit(1); @@ -91,13 +113,37 @@ static void Init( void ) fprintf(stderr, "%.*s\n", sz, buf); - glEnable(GL_VERTEX_PROGRAM_NV); + if (strncmp( buf, "!!VP", 4 ) == 0) { +#ifdef WIN32 + glBindProgramNV = (PFNGLBINDPROGRAMNVPROC) wglGetProcAddress( "glBindProgramNV" ); + glGenProgramsNV = (PFNGLGENPROGRAMSNVPROC) wglGetProcAddress( "glGenProgramsNV" ); + glLoadProgramNV = (PFNGLLOADPROGRAMNVPROC) wglGetProcAddress( "glLoadProgramNV" ); + glIsProgramNV = (PFNGLISPROGRAMNVPROC) wglGetProcAddress( "glIsProgramNV" ); +#endif + + glEnable( GL_VERTEX_PROGRAM_NV ); + glGenProgramsNV( 1, &prognum ); + glBindProgramNV( GL_VERTEX_PROGRAM_NV, prognum ); + glLoadProgramNV( GL_VERTEX_PROGRAM_NV, prognum, sz, (const GLubyte *) buf ); + assert( glIsProgramNV( prognum ) ); + } + else { +#ifdef WIN32 + glBindProgramARB = (PFNGLBINDPROGRAMARBPROC) wglGetProcAddress( "glBindProgramARB" ); + glGenProgramsARB = (PFNGLGENPROGRAMSARBPROC) wglGetProcAddress( "glGenProgramsARB" ); + glProgramStringARB = (PFNGLPROGRAMSTRINGARBPROC) wglGetProcAddress( "glProgramStringARB" ); + glIsProgramARB = (PFNGLISPROGRAMARBPROC) wglGetProcAddress( "glIsProgramARB" ); +#endif - glGenProgramsARB(1, &prognum); + glEnable(GL_VERTEX_PROGRAM_ARB); - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - sz, (const GLubyte *) buf); + glGenProgramsARB(1, &prognum); + + glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); + glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, + sz, (const GLubyte *) buf); + assert(glIsProgramARB(prognum)); + } errno = glGetError(); printf("glGetError = %d\n", errno); @@ -109,7 +155,6 @@ static void Init( void ) printf("errorpos: %d\n", errorpos); printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); } - assert(glIsProgramARB(prognum)); } @@ -236,10 +281,12 @@ int main( int argc, char *argv[] ) glutDisplayFunc( Display ); args( argc, argv ); Init(); +#ifndef WIN32 if (show_fps) { signal(SIGALRM, alarmhandler); alarm(5); } +#endif glutMainLoop(); return 0; } diff --git a/progs/vp/windows/vp2003.sln b/progs/vp/windows/vp2003.sln new file mode 100644 index 00000000000..76de5cfd7ff --- /dev/null +++ b/progs/vp/windows/vp2003.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vp2003", "vp2003.vcproj", "{E1C70416-98E7-4282-B6B2-6C9CF90B12C0}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {E1C70416-98E7-4282-B6B2-6C9CF90B12C0}.Debug.ActiveCfg = Debug|Win32 + {E1C70416-98E7-4282-B6B2-6C9CF90B12C0}.Debug.Build.0 = Debug|Win32 + {E1C70416-98E7-4282-B6B2-6C9CF90B12C0}.Release.ActiveCfg = Release|Win32 + {E1C70416-98E7-4282-B6B2-6C9CF90B12C0}.Release.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/progs/vp/windows/vp2003.vcproj b/progs/vp/windows/vp2003.vcproj new file mode 100644 index 00000000000..adca2c50731 --- /dev/null +++ b/progs/vp/windows/vp2003.vcproj @@ -0,0 +1,121 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="7.10" + Name="vp2003" + ProjectGUID="{E1C70416-98E7-4282-B6B2-6C9CF90B12C0}" + Keyword="Win32Proj"> + <Platforms> + <Platform + Name="Win32"/> + </Platforms> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="Debug" + IntermediateDirectory="Debug" + ConfigurationType="1" + CharacterSet="2"> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" + MinimalRebuild="TRUE" + BasicRuntimeChecks="3" + RuntimeLibrary="5" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="TRUE" + DebugInformationFormat="4"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="glut32.lib" + OutputFile="$(OutDir)/vp2003.exe" + LinkIncremental="2" + GenerateDebugInformation="TRUE" + ProgramDatabaseFile="$(OutDir)/vp2003.pdb" + SubSystem="1" + TargetMachine="1"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="Release" + IntermediateDirectory="Release" + ConfigurationType="1" + CharacterSet="2"> + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories="" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="4" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="TRUE" + DebugInformationFormat="3"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="glut32.lib" + OutputFile="$(OutDir)/vp2003.exe" + LinkIncremental="1" + GenerateDebugInformation="TRUE" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <File + RelativePath="..\vp-tris.c"> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> |