Merge branch 'mesa_7_5_branch'
Conflicts: src/mesa/main/dlist.c src/mesa/vbo/vbo_save_api.c
This commit is contained in:
commit
862488075c
|
@ -514,12 +514,27 @@ static void draw_surface( unsigned int with_state )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (GLVERTEX|STRIPS):
|
case (GLVERTEX|STRIPS):
|
||||||
glBegin( GL_TRIANGLE_STRIP );
|
if (with_state & MATERIALS) {
|
||||||
for (i=0;i<numverts;i++) {
|
glBegin( GL_TRIANGLE_STRIP );
|
||||||
glNormal3fv( &data[i][3] );
|
for (i=0;i<numverts;i++) {
|
||||||
glVertex3fv( &data[i][0] );
|
if (i % 600 == 0 && i != 0) {
|
||||||
|
unsigned j = i / 600;
|
||||||
|
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, col[j]);
|
||||||
|
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, col[j]);
|
||||||
|
}
|
||||||
|
glNormal3fv( &data[i][3] );
|
||||||
|
glVertex3fv( &data[i][0] );
|
||||||
|
}
|
||||||
|
glEnd();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
glBegin( GL_TRIANGLE_STRIP );
|
||||||
|
for (i=0;i<numverts;i++) {
|
||||||
|
glNormal3fv( &data[i][3] );
|
||||||
|
glVertex3fv( &data[i][0] );
|
||||||
|
}
|
||||||
|
glEnd();
|
||||||
}
|
}
|
||||||
glEnd();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -59,6 +59,7 @@ no_s3tc
|
||||||
packedpixels
|
packedpixels
|
||||||
persp_hint
|
persp_hint
|
||||||
pbo
|
pbo
|
||||||
|
prim
|
||||||
prog_parameter
|
prog_parameter
|
||||||
quads
|
quads
|
||||||
random
|
random
|
||||||
|
@ -81,6 +82,7 @@ subtex
|
||||||
subtexrate
|
subtexrate
|
||||||
tex1d
|
tex1d
|
||||||
texcompress2
|
texcompress2
|
||||||
|
texcompsub
|
||||||
texdown
|
texdown
|
||||||
texfilt
|
texfilt
|
||||||
texline
|
texline
|
||||||
|
|
|
@ -88,6 +88,7 @@ SOURCES = \
|
||||||
subtexrate.c \
|
subtexrate.c \
|
||||||
tex1d.c \
|
tex1d.c \
|
||||||
texcompress2.c \
|
texcompress2.c \
|
||||||
|
texcompsub.c \
|
||||||
texdown \
|
texdown \
|
||||||
texfilt.c \
|
texfilt.c \
|
||||||
texline.c \
|
texline.c \
|
||||||
|
|
|
@ -110,6 +110,7 @@ progs = [
|
||||||
'tex1d',
|
'tex1d',
|
||||||
'texcmp',
|
'texcmp',
|
||||||
'texcompress2',
|
'texcompress2',
|
||||||
|
'texcompsub',
|
||||||
'texdown',
|
'texdown',
|
||||||
'texfilt',
|
'texfilt',
|
||||||
'texgenmix',
|
'texgenmix',
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,165 @@
|
||||||
|
/*
|
||||||
|
* Test texture compression.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <GL/glew.h>
|
||||||
|
#include <GL/glut.h>
|
||||||
|
|
||||||
|
#include "texcomp_image.h"
|
||||||
|
|
||||||
|
static int ImgWidth = 512;
|
||||||
|
static int ImgHeight = 512;
|
||||||
|
static GLenum CompFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
|
||||||
|
static GLfloat EyeDist = 5.0;
|
||||||
|
static GLfloat Rot = 0.0;
|
||||||
|
const GLenum Target = GL_TEXTURE_2D;
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
CheckError(int line)
|
||||||
|
{
|
||||||
|
GLenum err = glGetError();
|
||||||
|
if (err) {
|
||||||
|
printf("GL Error %d at line %d\n", (int) err, line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
LoadCompressedImage(void)
|
||||||
|
{
|
||||||
|
const GLenum filter = GL_LINEAR;
|
||||||
|
glTexImage2D(Target, 0, CompFormat, ImgWidth, ImgHeight, 0,
|
||||||
|
GL_RGB, GL_UNSIGNED_BYTE, NULL);
|
||||||
|
|
||||||
|
/* bottom half */
|
||||||
|
glCompressedTexSubImage2DARB(Target, 0,
|
||||||
|
0, 0, /* pos */
|
||||||
|
ImgWidth, ImgHeight / 2,
|
||||||
|
CompFormat, ImgSize / 2, ImgData + ImgSize / 2);
|
||||||
|
/* top half */
|
||||||
|
glCompressedTexSubImage2DARB(Target, 0,
|
||||||
|
0, ImgHeight / 2, /* pos */
|
||||||
|
ImgWidth, ImgHeight / 2,
|
||||||
|
CompFormat, ImgSize / 2, ImgData);
|
||||||
|
|
||||||
|
glTexParameteri(Target, GL_TEXTURE_MIN_FILTER, filter);
|
||||||
|
glTexParameteri(Target, GL_TEXTURE_MAG_FILTER, filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
Init()
|
||||||
|
{
|
||||||
|
GLint numFormats, formats[100];
|
||||||
|
GLint p;
|
||||||
|
|
||||||
|
if (!glutExtensionSupported("GL_ARB_texture_compression")) {
|
||||||
|
printf("Sorry, GL_ARB_texture_compression is required.\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (!glutExtensionSupported("GL_EXT_texture_compression_s3tc")) {
|
||||||
|
printf("Sorry, GL_EXT_texture_compression_s3tc is required.\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||||
|
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||||
|
|
||||||
|
glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB, &numFormats);
|
||||||
|
glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS_ARB, formats);
|
||||||
|
printf("%d supported compression formats: ", numFormats);
|
||||||
|
for (p = 0; p < numFormats; p++)
|
||||||
|
printf("0x%x ", formats[p]);
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
|
LoadCompressedImage();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
Reshape( int width, int height )
|
||||||
|
{
|
||||||
|
glViewport( 0, 0, width, height );
|
||||||
|
glMatrixMode( GL_PROJECTION );
|
||||||
|
glLoadIdentity();
|
||||||
|
glFrustum(-1, 1, -1, 1, 4, 100);
|
||||||
|
glMatrixMode( GL_MODELVIEW );
|
||||||
|
glLoadIdentity();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
Key( unsigned char key, int x, int y )
|
||||||
|
{
|
||||||
|
(void) x;
|
||||||
|
(void) y;
|
||||||
|
switch (key) {
|
||||||
|
case 'd':
|
||||||
|
EyeDist -= 1.0;
|
||||||
|
if (EyeDist < 4.0)
|
||||||
|
EyeDist = 4.0;
|
||||||
|
break;
|
||||||
|
case 'D':
|
||||||
|
EyeDist += 1.0;
|
||||||
|
break;
|
||||||
|
case 'z':
|
||||||
|
Rot += 5.0;
|
||||||
|
break;
|
||||||
|
case 'Z':
|
||||||
|
Rot -= 5.0;
|
||||||
|
break;
|
||||||
|
case 27:
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
Draw( void )
|
||||||
|
{
|
||||||
|
glClearColor(0.3, 0.3, .8, 0);
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
CheckError(__LINE__);
|
||||||
|
glPushMatrix();
|
||||||
|
glTranslatef(0, 0, -(EyeDist+0.01));
|
||||||
|
glRotatef(Rot, 0, 0, 1);
|
||||||
|
glBegin(GL_POLYGON);
|
||||||
|
glTexCoord2f(0, 0); glVertex2f(-1, -1);
|
||||||
|
glTexCoord2f(1, 0); glVertex2f( 1, -1);
|
||||||
|
glTexCoord2f(1, 1); glVertex2f( 1, 1);
|
||||||
|
glTexCoord2f(0, 1); glVertex2f(-1, 1);
|
||||||
|
glEnd();
|
||||||
|
glPopMatrix();
|
||||||
|
|
||||||
|
glutSwapBuffers();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
main( int argc, char *argv[] )
|
||||||
|
{
|
||||||
|
glutInit( &argc, argv );
|
||||||
|
glutInitWindowSize( 600, 600 );
|
||||||
|
|
||||||
|
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE);
|
||||||
|
|
||||||
|
glutCreateWindow(argv[0]);
|
||||||
|
glewInit();
|
||||||
|
|
||||||
|
glutReshapeFunc( Reshape );
|
||||||
|
glutKeyboardFunc( Key );
|
||||||
|
glutDisplayFunc( Draw );
|
||||||
|
|
||||||
|
Init();
|
||||||
|
|
||||||
|
glutMainLoop();
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -19,6 +19,12 @@ SOURCES = \
|
||||||
clear-random.c \
|
clear-random.c \
|
||||||
clear.c \
|
clear.c \
|
||||||
dlist-dangling.c \
|
dlist-dangling.c \
|
||||||
|
dlist-flat-tri.c \
|
||||||
|
dlist-mat-tri.c \
|
||||||
|
dlist-tri-flat-tri.c \
|
||||||
|
dlist-tri-mat-tri.c \
|
||||||
|
dlist-recursive-call.c \
|
||||||
|
dlist-begin-call-end.c \
|
||||||
dlist-edgeflag-dangling.c \
|
dlist-edgeflag-dangling.c \
|
||||||
dlist-edgeflag.c \
|
dlist-edgeflag.c \
|
||||||
dlist-degenerate.c \
|
dlist-degenerate.c \
|
||||||
|
@ -105,6 +111,7 @@ SOURCES = \
|
||||||
tri-fp.c \
|
tri-fp.c \
|
||||||
tri-fp-const-imm.c \
|
tri-fp-const-imm.c \
|
||||||
tri-lit.c \
|
tri-lit.c \
|
||||||
|
tri-lit-material.c \
|
||||||
tri-mask-tri.c \
|
tri-mask-tri.c \
|
||||||
tri-orig.c \
|
tri-orig.c \
|
||||||
tri-query.c \
|
tri-query.c \
|
||||||
|
|
|
@ -0,0 +1,159 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, distribute, and sell this software and
|
||||||
|
* its documentation for any purpose is hereby granted without fee, provided
|
||||||
|
* that (i) the above copyright notices and this permission notice appear in
|
||||||
|
* all copies of the software and related documentation, and (ii) the name of
|
||||||
|
* Silicon Graphics may not be used in any advertising or
|
||||||
|
* publicity relating to the software without the specific, prior written
|
||||||
|
* permission of Silicon Graphics.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
|
||||||
|
* ANY KIND,
|
||||||
|
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||||
|
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||||
|
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||||
|
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||||
|
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||||
|
* OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <GL/glut.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define CI_OFFSET_1 16
|
||||||
|
#define CI_OFFSET_2 32
|
||||||
|
|
||||||
|
|
||||||
|
GLenum doubleBuffer;
|
||||||
|
GLint first_list, list;
|
||||||
|
|
||||||
|
static void Init(void)
|
||||||
|
{
|
||||||
|
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));
|
||||||
|
fflush(stderr);
|
||||||
|
|
||||||
|
glClearColor(0.0, 0.0, 1.0, 0.0);
|
||||||
|
|
||||||
|
/* First list will disrupt state which might potentially be
|
||||||
|
* short-circuited in calling list:
|
||||||
|
*/
|
||||||
|
first_list = glGenLists(1);
|
||||||
|
glNewList(first_list, GL_COMPILE);
|
||||||
|
// glColor3f(0,1,0);
|
||||||
|
glEndList();
|
||||||
|
|
||||||
|
|
||||||
|
/* List that looks like it might have redundant state:
|
||||||
|
*/
|
||||||
|
list = glGenLists(1);
|
||||||
|
glNewList(list, GL_COMPILE);
|
||||||
|
|
||||||
|
glShadeModel(GL_FLAT);
|
||||||
|
glBegin(GL_TRIANGLES);
|
||||||
|
glColor3f(1,0,0);
|
||||||
|
glVertex3f( -0.9, 0.9, -30.0);
|
||||||
|
glVertex3f( -0.9, -0.9, -30.0);
|
||||||
|
glCallList( first_list );
|
||||||
|
glVertex3f( 0.9, 0.0, -30.0);
|
||||||
|
glEnd();
|
||||||
|
glEndList();
|
||||||
|
}
|
||||||
|
|
||||||
|
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 Key(unsigned char key, int x, int y)
|
||||||
|
{
|
||||||
|
|
||||||
|
switch (key) {
|
||||||
|
case 27:
|
||||||
|
exit(1);
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void Draw(void)
|
||||||
|
{
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
glShadeModel( GL_SMOOTH );
|
||||||
|
glCallList(list);
|
||||||
|
|
||||||
|
glFlush();
|
||||||
|
|
||||||
|
if (doubleBuffer) {
|
||||||
|
glutSwapBuffers();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static GLenum Args(int argc, char **argv)
|
||||||
|
{
|
||||||
|
GLint i;
|
||||||
|
|
||||||
|
doubleBuffer = GL_FALSE;
|
||||||
|
|
||||||
|
for (i = 1; i < argc; i++) {
|
||||||
|
if (strcmp(argv[i], "-sb") == 0) {
|
||||||
|
doubleBuffer = GL_FALSE;
|
||||||
|
} else if (strcmp(argv[i], "-db") == 0) {
|
||||||
|
doubleBuffer = GL_TRUE;
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "%s (Bad option).\n", argv[i]);
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return GL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
GLenum type;
|
||||||
|
|
||||||
|
glutInit(&argc, argv);
|
||||||
|
|
||||||
|
if (Args(argc, argv) == GL_FALSE) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
|
||||||
|
|
||||||
|
type = GLUT_RGB | GLUT_ALPHA;
|
||||||
|
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
|
||||||
|
glutInitDisplayMode(type);
|
||||||
|
|
||||||
|
if (glutCreateWindow(*argv) == GL_FALSE) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Init();
|
||||||
|
|
||||||
|
glutReshapeFunc(Reshape);
|
||||||
|
glutKeyboardFunc(Key);
|
||||||
|
glutDisplayFunc(Draw);
|
||||||
|
glutMainLoop();
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,171 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, distribute, and sell this software and
|
||||||
|
* its documentation for any purpose is hereby granted without fee, provided
|
||||||
|
* that (i) the above copyright notices and this permission notice appear in
|
||||||
|
* all copies of the software and related documentation, and (ii) the name of
|
||||||
|
* Silicon Graphics may not be used in any advertising or
|
||||||
|
* publicity relating to the software without the specific, prior written
|
||||||
|
* permission of Silicon Graphics.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
|
||||||
|
* ANY KIND,
|
||||||
|
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||||
|
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||||
|
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||||
|
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||||
|
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||||
|
* OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <GL/glut.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define CI_OFFSET_1 16
|
||||||
|
#define CI_OFFSET_2 32
|
||||||
|
|
||||||
|
|
||||||
|
GLenum doubleBuffer;
|
||||||
|
GLint list;
|
||||||
|
|
||||||
|
static void Init(void)
|
||||||
|
{
|
||||||
|
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));
|
||||||
|
fflush(stderr);
|
||||||
|
|
||||||
|
glClearColor(0.0, 0.0, 1.0, 0.0);
|
||||||
|
|
||||||
|
list = glGenLists(1);
|
||||||
|
glNewList(list, GL_COMPILE);
|
||||||
|
|
||||||
|
/* XXX: this state-change will only be executed if list is called
|
||||||
|
* from outside a begin/end pair:
|
||||||
|
*/
|
||||||
|
glShadeModel( GL_FLAT );
|
||||||
|
glBegin(GL_TRIANGLES);
|
||||||
|
glColor3f(0,0,.7);
|
||||||
|
glVertex3f( -0.9, 0.9, -30.0);
|
||||||
|
glColor3f(0,.9,0);
|
||||||
|
glVertex3f( -0.9, -0.9, -30.0);
|
||||||
|
glColor3f(.8,0,0);
|
||||||
|
glVertex3f( 0.9, 0.0, -30.0);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
/* This statechange is potentially NOT redundant:
|
||||||
|
*/
|
||||||
|
glShadeModel( GL_FLAT );
|
||||||
|
glBegin(GL_TRIANGLES);
|
||||||
|
glColor3f(0,1,0);
|
||||||
|
glVertex3f( -0.5, 0.5, -30.0);
|
||||||
|
glColor3f(0,0,1);
|
||||||
|
glVertex3f( -0.5, -0.5, -30.0);
|
||||||
|
glColor3f(1,0,0);
|
||||||
|
glVertex3f( 0.5, 0.0, -30.0);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glEndList();
|
||||||
|
}
|
||||||
|
|
||||||
|
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 Key(unsigned char key, int x, int y)
|
||||||
|
{
|
||||||
|
|
||||||
|
switch (key) {
|
||||||
|
case 27:
|
||||||
|
exit(1);
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void Draw(void)
|
||||||
|
{
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
glShadeModel( GL_SMOOTH );
|
||||||
|
|
||||||
|
glBegin(GL_TRIANGLES);
|
||||||
|
|
||||||
|
/* Note: call the list from inside a begin/end pair. The end is
|
||||||
|
* provided by the display list...
|
||||||
|
*/
|
||||||
|
glCallList(list);
|
||||||
|
|
||||||
|
glFlush();
|
||||||
|
|
||||||
|
if (doubleBuffer) {
|
||||||
|
glutSwapBuffers();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static GLenum Args(int argc, char **argv)
|
||||||
|
{
|
||||||
|
GLint i;
|
||||||
|
|
||||||
|
doubleBuffer = GL_FALSE;
|
||||||
|
|
||||||
|
for (i = 1; i < argc; i++) {
|
||||||
|
if (strcmp(argv[i], "-sb") == 0) {
|
||||||
|
doubleBuffer = GL_FALSE;
|
||||||
|
} else if (strcmp(argv[i], "-db") == 0) {
|
||||||
|
doubleBuffer = GL_TRUE;
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "%s (Bad option).\n", argv[i]);
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return GL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
GLenum type;
|
||||||
|
|
||||||
|
glutInit(&argc, argv);
|
||||||
|
|
||||||
|
if (Args(argc, argv) == GL_FALSE) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
|
||||||
|
|
||||||
|
type = GLUT_RGB | GLUT_ALPHA;
|
||||||
|
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
|
||||||
|
glutInitDisplayMode(type);
|
||||||
|
|
||||||
|
if (glutCreateWindow(*argv) == GL_FALSE) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Init();
|
||||||
|
|
||||||
|
glutReshapeFunc(Reshape);
|
||||||
|
glutKeyboardFunc(Key);
|
||||||
|
glutDisplayFunc(Draw);
|
||||||
|
glutMainLoop();
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,182 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, distribute, and sell this software and
|
||||||
|
* its documentation for any purpose is hereby granted without fee, provided
|
||||||
|
* that (i) the above copyright notices and this permission notice appear in
|
||||||
|
* all copies of the software and related documentation, and (ii) the name of
|
||||||
|
* Silicon Graphics may not be used in any advertising or
|
||||||
|
* publicity relating to the software without the specific, prior written
|
||||||
|
* permission of Silicon Graphics.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
|
||||||
|
* ANY KIND,
|
||||||
|
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||||
|
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||||
|
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||||
|
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||||
|
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||||
|
* OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <GL/glut.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define CI_OFFSET_1 16
|
||||||
|
#define CI_OFFSET_2 32
|
||||||
|
|
||||||
|
|
||||||
|
GLenum doubleBuffer;
|
||||||
|
GLint list;
|
||||||
|
|
||||||
|
static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0};
|
||||||
|
static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0};
|
||||||
|
/*static GLfloat blue[4] = {0.2, 0.2, .7, 1.0};*/
|
||||||
|
|
||||||
|
static void Init(void)
|
||||||
|
{
|
||||||
|
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));
|
||||||
|
fflush(stderr);
|
||||||
|
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
glEnable(GL_LIGHTING);
|
||||||
|
glEnable(GL_LIGHT0);
|
||||||
|
|
||||||
|
glClearColor(0.0, 0.0, 1.0, 0.0);
|
||||||
|
|
||||||
|
list = glGenLists(1);
|
||||||
|
glNewList(list, GL_COMPILE);
|
||||||
|
|
||||||
|
/* XXX: this state-change will be executed regardless of whether
|
||||||
|
* the list is called from outside a begin/end pair:
|
||||||
|
*/
|
||||||
|
glMaterialfv(GL_FRONT, GL_AMBIENT, red);
|
||||||
|
glBegin(GL_TRIANGLES);
|
||||||
|
glVertex3f( -0.9, 0.9, -30.0);
|
||||||
|
glVertex3f( -0.9, -0.9, -30.0);
|
||||||
|
glVertex3f( 0.9, 0.0, -30.0);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glMaterialfv(GL_FRONT, GL_DIFFUSE, red);
|
||||||
|
glBegin(GL_TRIANGLES);
|
||||||
|
glVertex3f( -0.7, 0.7, -30.0);
|
||||||
|
glVertex3f( -0.7, -0.7, -30.0);
|
||||||
|
glVertex3f( 0.7, 0.0, -30.0);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
/* This statechange is redundant:
|
||||||
|
*/
|
||||||
|
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
|
||||||
|
glBegin(GL_TRIANGLES);
|
||||||
|
glVertex3f( -0.5, 0.5, -30.0);
|
||||||
|
glVertex3f( -0.5, -0.5, -30.0);
|
||||||
|
glVertex3f( 0.5, 0.0, -30.0);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glEndList();
|
||||||
|
}
|
||||||
|
|
||||||
|
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 Key(unsigned char key, int x, int y)
|
||||||
|
{
|
||||||
|
|
||||||
|
switch (key) {
|
||||||
|
case 27:
|
||||||
|
exit(1);
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void Draw(void)
|
||||||
|
{
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
glShadeModel( GL_SMOOTH );
|
||||||
|
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
|
||||||
|
|
||||||
|
glBegin(GL_TRIANGLES);
|
||||||
|
|
||||||
|
/* Note: call the list from inside a begin/end pair. The end is
|
||||||
|
* provided by the display list...
|
||||||
|
*/
|
||||||
|
glCallList(list);
|
||||||
|
|
||||||
|
glFlush();
|
||||||
|
|
||||||
|
if (doubleBuffer) {
|
||||||
|
glutSwapBuffers();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static GLenum Args(int argc, char **argv)
|
||||||
|
{
|
||||||
|
GLint i;
|
||||||
|
|
||||||
|
doubleBuffer = GL_FALSE;
|
||||||
|
|
||||||
|
for (i = 1; i < argc; i++) {
|
||||||
|
if (strcmp(argv[i], "-sb") == 0) {
|
||||||
|
doubleBuffer = GL_FALSE;
|
||||||
|
} else if (strcmp(argv[i], "-db") == 0) {
|
||||||
|
doubleBuffer = GL_TRUE;
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "%s (Bad option).\n", argv[i]);
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return GL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
GLenum type;
|
||||||
|
|
||||||
|
glutInit(&argc, argv);
|
||||||
|
|
||||||
|
if (Args(argc, argv) == GL_FALSE) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
|
||||||
|
|
||||||
|
type = GLUT_RGB | GLUT_ALPHA;
|
||||||
|
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
|
||||||
|
glutInitDisplayMode(type);
|
||||||
|
|
||||||
|
if (glutCreateWindow(*argv) == GL_FALSE) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Init();
|
||||||
|
|
||||||
|
glutReshapeFunc(Reshape);
|
||||||
|
glutKeyboardFunc(Key);
|
||||||
|
glutDisplayFunc(Draw);
|
||||||
|
glutMainLoop();
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,190 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, distribute, and sell this software and
|
||||||
|
* its documentation for any purpose is hereby granted without fee, provided
|
||||||
|
* that (i) the above copyright notices and this permission notice appear in
|
||||||
|
* all copies of the software and related documentation, and (ii) the name of
|
||||||
|
* Silicon Graphics may not be used in any advertising or
|
||||||
|
* publicity relating to the software without the specific, prior written
|
||||||
|
* permission of Silicon Graphics.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
|
||||||
|
* ANY KIND,
|
||||||
|
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||||
|
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||||
|
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||||
|
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||||
|
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||||
|
* OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <GL/glut.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define CI_OFFSET_1 16
|
||||||
|
#define CI_OFFSET_2 32
|
||||||
|
|
||||||
|
|
||||||
|
GLenum doubleBuffer;
|
||||||
|
GLint first_list, list;
|
||||||
|
|
||||||
|
static void Init(void)
|
||||||
|
{
|
||||||
|
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));
|
||||||
|
fflush(stderr);
|
||||||
|
|
||||||
|
glClearColor(0.0, 0.0, 1.0, 0.0);
|
||||||
|
|
||||||
|
/* First list will disrupt state which might potentially be
|
||||||
|
* short-circuited in calling list:
|
||||||
|
*/
|
||||||
|
first_list = glGenLists(1);
|
||||||
|
glNewList(first_list, GL_COMPILE);
|
||||||
|
glShadeModel( GL_SMOOTH );
|
||||||
|
glEndList();
|
||||||
|
|
||||||
|
|
||||||
|
/* List that looks like it might have redundant state:
|
||||||
|
*/
|
||||||
|
list = glGenLists(1);
|
||||||
|
glNewList(list, GL_COMPILE);
|
||||||
|
|
||||||
|
glBegin(GL_TRIANGLES);
|
||||||
|
glColor3f(0,0,.7);
|
||||||
|
glVertex3f( 0.9, -0.9, -30.0);
|
||||||
|
glColor3f(.8,0,0);
|
||||||
|
glVertex3f( 0.9, 0.9, -30.0);
|
||||||
|
glColor3f(0,.9,0);
|
||||||
|
glVertex3f(-0.9, 0.0, -30.0);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glShadeModel( GL_FLAT );
|
||||||
|
glBegin(GL_TRIANGLES);
|
||||||
|
glColor3f(0,0,.7);
|
||||||
|
glVertex3f( -0.9, 0.9, -30.0);
|
||||||
|
glColor3f(0,.9,0);
|
||||||
|
glVertex3f( -0.9, -0.9, -30.0);
|
||||||
|
glColor3f(.8,0,0);
|
||||||
|
glVertex3f( 0.9, 0.0, -30.0);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glCallList( first_list );
|
||||||
|
|
||||||
|
/* Do a quick begin/end to ensure we are not inside a dangling
|
||||||
|
* primitive from the called list:
|
||||||
|
*/
|
||||||
|
glBegin( GL_POINTS );
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
/* This statechange is NOT redundant:
|
||||||
|
*/
|
||||||
|
glShadeModel( GL_FLAT );
|
||||||
|
glBegin(GL_TRIANGLES);
|
||||||
|
glColor3f(1,0,0);
|
||||||
|
glVertex3f( -0.5, 0.5, -30.0);
|
||||||
|
glColor3f(0,1,0);
|
||||||
|
glVertex3f( -0.5, -0.5, -30.0);
|
||||||
|
glColor3f(0,0,1);
|
||||||
|
glVertex3f( 0.5, 0.0, -30.0);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glEndList();
|
||||||
|
}
|
||||||
|
|
||||||
|
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 Key(unsigned char key, int x, int y)
|
||||||
|
{
|
||||||
|
|
||||||
|
switch (key) {
|
||||||
|
case 27:
|
||||||
|
exit(1);
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void Draw(void)
|
||||||
|
{
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
glShadeModel( GL_SMOOTH );
|
||||||
|
glCallList(list);
|
||||||
|
|
||||||
|
glFlush();
|
||||||
|
|
||||||
|
if (doubleBuffer) {
|
||||||
|
glutSwapBuffers();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static GLenum Args(int argc, char **argv)
|
||||||
|
{
|
||||||
|
GLint i;
|
||||||
|
|
||||||
|
doubleBuffer = GL_FALSE;
|
||||||
|
|
||||||
|
for (i = 1; i < argc; i++) {
|
||||||
|
if (strcmp(argv[i], "-sb") == 0) {
|
||||||
|
doubleBuffer = GL_FALSE;
|
||||||
|
} else if (strcmp(argv[i], "-db") == 0) {
|
||||||
|
doubleBuffer = GL_TRUE;
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "%s (Bad option).\n", argv[i]);
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return GL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
GLenum type;
|
||||||
|
|
||||||
|
glutInit(&argc, argv);
|
||||||
|
|
||||||
|
if (Args(argc, argv) == GL_FALSE) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
|
||||||
|
|
||||||
|
type = GLUT_RGB | GLUT_ALPHA;
|
||||||
|
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
|
||||||
|
glutInitDisplayMode(type);
|
||||||
|
|
||||||
|
if (glutCreateWindow(*argv) == GL_FALSE) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Init();
|
||||||
|
|
||||||
|
glutReshapeFunc(Reshape);
|
||||||
|
glutKeyboardFunc(Key);
|
||||||
|
glutDisplayFunc(Draw);
|
||||||
|
glutMainLoop();
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,171 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, distribute, and sell this software and
|
||||||
|
* its documentation for any purpose is hereby granted without fee, provided
|
||||||
|
* that (i) the above copyright notices and this permission notice appear in
|
||||||
|
* all copies of the software and related documentation, and (ii) the name of
|
||||||
|
* Silicon Graphics may not be used in any advertising or
|
||||||
|
* publicity relating to the software without the specific, prior written
|
||||||
|
* permission of Silicon Graphics.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
|
||||||
|
* ANY KIND,
|
||||||
|
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||||
|
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||||
|
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||||
|
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||||
|
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||||
|
* OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <GL/glut.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define CI_OFFSET_1 16
|
||||||
|
#define CI_OFFSET_2 32
|
||||||
|
|
||||||
|
|
||||||
|
GLenum doubleBuffer;
|
||||||
|
GLint list;
|
||||||
|
|
||||||
|
static void Init(void)
|
||||||
|
{
|
||||||
|
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));
|
||||||
|
fflush(stderr);
|
||||||
|
|
||||||
|
glClearColor(0.0, 0.0, 1.0, 0.0);
|
||||||
|
|
||||||
|
list = glGenLists(1);
|
||||||
|
glNewList(list, GL_COMPILE);
|
||||||
|
|
||||||
|
glBegin(GL_TRIANGLES);
|
||||||
|
glColor3f(0,0,.7);
|
||||||
|
glVertex3f( 0.9, -0.9, -30.0);
|
||||||
|
glColor3f(.8,0,0);
|
||||||
|
glVertex3f( 0.9, 0.9, -30.0);
|
||||||
|
glColor3f(0,.9,0);
|
||||||
|
glVertex3f(-0.9, 0.0, -30.0);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glShadeModel( GL_FLAT );
|
||||||
|
glBegin(GL_TRIANGLES);
|
||||||
|
glColor3f(0,0,.7);
|
||||||
|
glVertex3f( -0.9, 0.9, -30.0);
|
||||||
|
glColor3f(0,.9,0);
|
||||||
|
glVertex3f( -0.9, -0.9, -30.0);
|
||||||
|
glColor3f(.8,0,0);
|
||||||
|
glVertex3f( 0.9, 0.0, -30.0);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
/* This statechange is redundant:
|
||||||
|
*/
|
||||||
|
glShadeModel( GL_FLAT );
|
||||||
|
glBegin(GL_TRIANGLES);
|
||||||
|
glColor3f(1,0,0);
|
||||||
|
glVertex3f( -0.5, 0.5, -30.0);
|
||||||
|
glColor3f(0,1,0);
|
||||||
|
glVertex3f( -0.5, -0.5, -30.0);
|
||||||
|
glColor3f(0,0,1);
|
||||||
|
glVertex3f( 0.5, 0.0, -30.0);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glEndList();
|
||||||
|
}
|
||||||
|
|
||||||
|
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 Key(unsigned char key, int x, int y)
|
||||||
|
{
|
||||||
|
|
||||||
|
switch (key) {
|
||||||
|
case 27:
|
||||||
|
exit(1);
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void Draw(void)
|
||||||
|
{
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
glShadeModel( GL_SMOOTH );
|
||||||
|
glCallList(list);
|
||||||
|
|
||||||
|
glFlush();
|
||||||
|
|
||||||
|
if (doubleBuffer) {
|
||||||
|
glutSwapBuffers();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static GLenum Args(int argc, char **argv)
|
||||||
|
{
|
||||||
|
GLint i;
|
||||||
|
|
||||||
|
doubleBuffer = GL_FALSE;
|
||||||
|
|
||||||
|
for (i = 1; i < argc; i++) {
|
||||||
|
if (strcmp(argv[i], "-sb") == 0) {
|
||||||
|
doubleBuffer = GL_FALSE;
|
||||||
|
} else if (strcmp(argv[i], "-db") == 0) {
|
||||||
|
doubleBuffer = GL_TRUE;
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "%s (Bad option).\n", argv[i]);
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return GL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
GLenum type;
|
||||||
|
|
||||||
|
glutInit(&argc, argv);
|
||||||
|
|
||||||
|
if (Args(argc, argv) == GL_FALSE) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
|
||||||
|
|
||||||
|
type = GLUT_RGB | GLUT_ALPHA;
|
||||||
|
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
|
||||||
|
glutInitDisplayMode(type);
|
||||||
|
|
||||||
|
if (glutCreateWindow(*argv) == GL_FALSE) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Init();
|
||||||
|
|
||||||
|
glutReshapeFunc(Reshape);
|
||||||
|
glutKeyboardFunc(Key);
|
||||||
|
glutDisplayFunc(Draw);
|
||||||
|
glutMainLoop();
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,174 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, distribute, and sell this software and
|
||||||
|
* its documentation for any purpose is hereby granted without fee, provided
|
||||||
|
* that (i) the above copyright notices and this permission notice appear in
|
||||||
|
* all copies of the software and related documentation, and (ii) the name of
|
||||||
|
* Silicon Graphics may not be used in any advertising or
|
||||||
|
* publicity relating to the software without the specific, prior written
|
||||||
|
* permission of Silicon Graphics.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
|
||||||
|
* ANY KIND,
|
||||||
|
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||||
|
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||||
|
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||||
|
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||||
|
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||||
|
* OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <GL/glut.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define CI_OFFSET_1 16
|
||||||
|
#define CI_OFFSET_2 32
|
||||||
|
|
||||||
|
|
||||||
|
GLenum doubleBuffer;
|
||||||
|
GLint list;
|
||||||
|
|
||||||
|
static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0};
|
||||||
|
static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0};
|
||||||
|
static GLfloat blue[4] = {0.2, 0.2, .9, 1.0};
|
||||||
|
|
||||||
|
static void Init(void)
|
||||||
|
{
|
||||||
|
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));
|
||||||
|
fflush(stderr);
|
||||||
|
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
glEnable(GL_LIGHTING);
|
||||||
|
glEnable(GL_LIGHT0);
|
||||||
|
|
||||||
|
glClearColor(0.0, 0.0, 1.0, 0.0);
|
||||||
|
|
||||||
|
list = glGenLists(1);
|
||||||
|
glNewList(list, GL_COMPILE);
|
||||||
|
|
||||||
|
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
|
||||||
|
|
||||||
|
glBegin(GL_TRIANGLES);
|
||||||
|
glNormal3f(0,0,.7);
|
||||||
|
glVertex3f( 0.9, -0.9, -30.0);
|
||||||
|
glVertex3f( 0.9, 0.9, -30.0);
|
||||||
|
glVertex3f(-0.9, 0.0, -30.0);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
|
||||||
|
|
||||||
|
glBegin(GL_TRIANGLES);
|
||||||
|
glVertex3f( -0.9, 0.9, -30.0);
|
||||||
|
glVertex3f( -0.9, -0.9, -30.0);
|
||||||
|
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
|
||||||
|
glVertex3f( 0.9, 0.0, -30.0);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
|
||||||
|
glBegin(GL_TRIANGLES);
|
||||||
|
glVertex3f( -0.5, 0.5, -30.0);
|
||||||
|
glVertex3f( -0.5, -0.5, -30.0);
|
||||||
|
glVertex3f( 0.5, 0.0, -30.0);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glEndList();
|
||||||
|
}
|
||||||
|
|
||||||
|
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 Key(unsigned char key, int x, int y)
|
||||||
|
{
|
||||||
|
|
||||||
|
switch (key) {
|
||||||
|
case 27:
|
||||||
|
exit(1);
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void Draw(void)
|
||||||
|
{
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
glShadeModel( GL_SMOOTH );
|
||||||
|
glCallList(list);
|
||||||
|
|
||||||
|
glFlush();
|
||||||
|
|
||||||
|
if (doubleBuffer) {
|
||||||
|
glutSwapBuffers();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static GLenum Args(int argc, char **argv)
|
||||||
|
{
|
||||||
|
GLint i;
|
||||||
|
|
||||||
|
doubleBuffer = GL_FALSE;
|
||||||
|
|
||||||
|
for (i = 1; i < argc; i++) {
|
||||||
|
if (strcmp(argv[i], "-sb") == 0) {
|
||||||
|
doubleBuffer = GL_FALSE;
|
||||||
|
} else if (strcmp(argv[i], "-db") == 0) {
|
||||||
|
doubleBuffer = GL_TRUE;
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "%s (Bad option).\n", argv[i]);
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return GL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
GLenum type;
|
||||||
|
|
||||||
|
glutInit(&argc, argv);
|
||||||
|
|
||||||
|
if (Args(argc, argv) == GL_FALSE) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
|
||||||
|
|
||||||
|
type = GLUT_RGB | GLUT_ALPHA;
|
||||||
|
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
|
||||||
|
glutInitDisplayMode(type);
|
||||||
|
|
||||||
|
if (glutCreateWindow(*argv) == GL_FALSE) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Init();
|
||||||
|
|
||||||
|
glutReshapeFunc(Reshape);
|
||||||
|
glutKeyboardFunc(Key);
|
||||||
|
glutDisplayFunc(Draw);
|
||||||
|
glutMainLoop();
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,149 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, distribute, and sell this software and
|
||||||
|
* its documentation for any purpose is hereby granted without fee, provided
|
||||||
|
* that (i) the above copyright notices and this permission notice appear in
|
||||||
|
* all copies of the software and related documentation, and (ii) the name of
|
||||||
|
* Silicon Graphics may not be used in any advertising or
|
||||||
|
* publicity relating to the software without the specific, prior written
|
||||||
|
* permission of Silicon Graphics.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
|
||||||
|
* ANY KIND,
|
||||||
|
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||||
|
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||||
|
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||||
|
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||||
|
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||||
|
* OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <GL/glut.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define CI_OFFSET_1 16
|
||||||
|
#define CI_OFFSET_2 32
|
||||||
|
|
||||||
|
|
||||||
|
GLenum doubleBuffer;
|
||||||
|
|
||||||
|
static void Init(void)
|
||||||
|
{
|
||||||
|
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));
|
||||||
|
fflush(stderr);
|
||||||
|
|
||||||
|
glEnable(GL_LIGHTING);
|
||||||
|
glEnable(GL_LIGHT0);
|
||||||
|
|
||||||
|
glClearColor(0.0, 0.0, 1.0, 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 Key(unsigned char key, int x, int y)
|
||||||
|
{
|
||||||
|
|
||||||
|
switch (key) {
|
||||||
|
case 27:
|
||||||
|
exit(1);
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Draw(void)
|
||||||
|
{
|
||||||
|
static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0};
|
||||||
|
static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0};
|
||||||
|
static GLfloat blue[4] = {0.2, 0.2, .9, 1.0};
|
||||||
|
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
glBegin(GL_TRIANGLES);
|
||||||
|
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
|
||||||
|
glNormal3f(0,0,.7);
|
||||||
|
glVertex3f( 0.9, -0.9, -0.0);
|
||||||
|
|
||||||
|
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
|
||||||
|
glNormal3f(0,0,.8);
|
||||||
|
glVertex3f( 0.9, 0.9, -0.0);
|
||||||
|
|
||||||
|
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
|
||||||
|
glNormal3f(0,0,.9);
|
||||||
|
glVertex3f(-0.9, 0.0, -0.0);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glFlush();
|
||||||
|
|
||||||
|
if (doubleBuffer) {
|
||||||
|
glutSwapBuffers();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static GLenum Args(int argc, char **argv)
|
||||||
|
{
|
||||||
|
GLint i;
|
||||||
|
|
||||||
|
doubleBuffer = GL_FALSE;
|
||||||
|
|
||||||
|
for (i = 1; i < argc; i++) {
|
||||||
|
if (strcmp(argv[i], "-sb") == 0) {
|
||||||
|
doubleBuffer = GL_FALSE;
|
||||||
|
} else if (strcmp(argv[i], "-db") == 0) {
|
||||||
|
doubleBuffer = GL_TRUE;
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "%s (Bad option).\n", argv[i]);
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return GL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
GLenum type;
|
||||||
|
|
||||||
|
glutInit(&argc, argv);
|
||||||
|
|
||||||
|
if (Args(argc, argv) == GL_FALSE) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
|
||||||
|
|
||||||
|
type = GLUT_RGB | GLUT_ALPHA;
|
||||||
|
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
|
||||||
|
glutInitDisplayMode(type);
|
||||||
|
|
||||||
|
if (glutCreateWindow(*argv) == GL_FALSE) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Init();
|
||||||
|
|
||||||
|
glutReshapeFunc(Reshape);
|
||||||
|
glutKeyboardFunc(Key);
|
||||||
|
glutDisplayFunc(Draw);
|
||||||
|
glutMainLoop();
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -26,7 +26,7 @@
|
||||||
* -p Open a display connection for each thread
|
* -p Open a display connection for each thread
|
||||||
* -l Enable application-side locking
|
* -l Enable application-side locking
|
||||||
* -n <num threads> Number of threads to create (default is 2)
|
* -n <num threads> Number of threads to create (default is 2)
|
||||||
* -display <display name> Specify X display (default is :0.0)
|
* -display <display name> Specify X display (default is $DISPLAY)
|
||||||
* -t Use texture mapping
|
* -t Use texture mapping
|
||||||
*
|
*
|
||||||
* Brian Paul 20 July 2000
|
* Brian Paul 20 July 2000
|
||||||
|
@ -573,7 +573,7 @@ usage(void)
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char *displayName = ":0.0";
|
char *displayName = NULL;
|
||||||
int numThreads = 2;
|
int numThreads = 2;
|
||||||
Display *dpy = NULL;
|
Display *dpy = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -267,7 +267,8 @@ main(int argc, char *argv[])
|
||||||
printf(" glxheads xdisplayname ...\n");
|
printf(" glxheads xdisplayname ...\n");
|
||||||
printf("Example:\n");
|
printf("Example:\n");
|
||||||
printf(" glxheads :0 mars:0 venus:1\n");
|
printf(" glxheads :0 mars:0 venus:1\n");
|
||||||
h = AddHead(":0");
|
|
||||||
|
h = AddHead(XDisplayName(NULL));
|
||||||
if (h)
|
if (h)
|
||||||
PrintInfo(h);
|
PrintInfo(h);
|
||||||
}
|
}
|
||||||
|
|
|
@ -759,7 +759,7 @@ main(int argc, char *argv[])
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
Window win;
|
Window win;
|
||||||
GLXContext ctx;
|
GLXContext ctx;
|
||||||
char *dpyName = ":0";
|
char *dpyName = NULL;
|
||||||
int swap_interval = 1;
|
int swap_interval = 1;
|
||||||
GLboolean do_swap_interval = GL_FALSE;
|
GLboolean do_swap_interval = GL_FALSE;
|
||||||
GLboolean force_get_rate = GL_FALSE;
|
GLboolean force_get_rate = GL_FALSE;
|
||||||
|
|
|
@ -158,7 +158,7 @@ main(int argc, char *argv[])
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
Window win;
|
Window win;
|
||||||
GLXContext ctx;
|
GLXContext ctx;
|
||||||
char *dpyName = ":0";
|
char *dpyName = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
|
|
|
@ -97,10 +97,8 @@ void _debug_vprintf(const char *format, va_list ap)
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
}
|
}
|
||||||
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
|
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
|
||||||
/* EngDebugPrint does not handle float point arguments, so we need to use
|
/* OutputDebugStringA can be very slow, so buffer until we find a newline. */
|
||||||
* our own vsnprintf implementation. It is also very slow, so buffer until
|
static char buf[4096] = {'\0'};
|
||||||
* we find a newline. */
|
|
||||||
static char buf[512 + 1] = {'\0'};
|
|
||||||
size_t len = strlen(buf);
|
size_t len = strlen(buf);
|
||||||
int ret = util_vsnprintf(buf + len, sizeof(buf) - len, format, ap);
|
int ret = util_vsnprintf(buf + len, sizeof(buf) - len, format, ap);
|
||||||
if(ret > (int)(sizeof(buf) - len - 1) || util_strchr(buf + len, '\n')) {
|
if(ret > (int)(sizeof(buf) - len - 1) || util_strchr(buf + len, '\n')) {
|
||||||
|
|
|
@ -787,11 +787,10 @@ static void setup_tri_coefficients( struct setup_context *setup )
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FOG) {
|
if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FACE) {
|
||||||
/* FOG.y = front/back facing XXX fix this */
|
setup->coef[fragSlot].a0[0] = 1.0f - setup->quad.input.facing;
|
||||||
setup->coef[fragSlot].a0[1] = 1.0f - setup->quad.input.facing;
|
setup->coef[fragSlot].dadx[0] = 0.0;
|
||||||
setup->coef[fragSlot].dadx[1] = 0.0;
|
setup->coef[fragSlot].dady[0] = 0.0;
|
||||||
setup->coef[fragSlot].dady[1] = 0.0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1101,11 +1100,10 @@ setup_line_coefficients(struct setup_context *setup,
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FOG) {
|
if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FACE) {
|
||||||
/* FOG.y = front/back facing XXX fix this */
|
setup->coef[fragSlot].a0[0] = 1.0f - setup->quad.input.facing;
|
||||||
setup->coef[fragSlot].a0[1] = 1.0f - setup->quad.input.facing;
|
setup->coef[fragSlot].dadx[0] = 0.0;
|
||||||
setup->coef[fragSlot].dadx[1] = 0.0;
|
setup->coef[fragSlot].dady[0] = 0.0;
|
||||||
setup->coef[fragSlot].dady[1] = 0.0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -1347,11 +1345,10 @@ setup_point( struct setup_context *setup,
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FOG) {
|
if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FACE) {
|
||||||
/* FOG.y = front/back facing XXX fix this */
|
setup->coef[fragSlot].a0[0] = 1.0f - setup->quad.input.facing;
|
||||||
setup->coef[fragSlot].a0[1] = 1.0f - setup->quad.input.facing;
|
setup->coef[fragSlot].dadx[0] = 0.0;
|
||||||
setup->coef[fragSlot].dadx[1] = 0.0;
|
setup->coef[fragSlot].dady[0] = 0.0;
|
||||||
setup->coef[fragSlot].dady[1] = 0.0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,6 +110,7 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TGSI_SEMANTIC_GENERIC:
|
case TGSI_SEMANTIC_GENERIC:
|
||||||
|
case TGSI_SEMANTIC_FACE:
|
||||||
/* this includes texcoords and varying vars */
|
/* this includes texcoords and varying vars */
|
||||||
src = draw_find_vs_output(softpipe->draw, TGSI_SEMANTIC_GENERIC,
|
src = draw_find_vs_output(softpipe->draw, TGSI_SEMANTIC_GENERIC,
|
||||||
spfs->info.input_semantic_index[i]);
|
spfs->info.input_semantic_index[i]);
|
||||||
|
|
|
@ -131,7 +131,8 @@ struct tgsi_declaration_range
|
||||||
#define TGSI_SEMANTIC_PSIZE 4
|
#define TGSI_SEMANTIC_PSIZE 4
|
||||||
#define TGSI_SEMANTIC_GENERIC 5
|
#define TGSI_SEMANTIC_GENERIC 5
|
||||||
#define TGSI_SEMANTIC_NORMAL 6
|
#define TGSI_SEMANTIC_NORMAL 6
|
||||||
#define TGSI_SEMANTIC_COUNT 7 /**< number of semantic values */
|
#define TGSI_SEMANTIC_FACE 7
|
||||||
|
#define TGSI_SEMANTIC_COUNT 8 /**< number of semantic values */
|
||||||
|
|
||||||
struct tgsi_declaration_semantic
|
struct tgsi_declaration_semantic
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,6 +27,7 @@ if env['platform'] in ['windows']:
|
||||||
'shared/stw_framebuffer.c',
|
'shared/stw_framebuffer.c',
|
||||||
'shared/stw_pixelformat.c',
|
'shared/stw_pixelformat.c',
|
||||||
'shared/stw_extensionsstring.c',
|
'shared/stw_extensionsstring.c',
|
||||||
|
'shared/stw_extswapinterval.c',
|
||||||
'shared/stw_getprocaddress.c',
|
'shared/stw_getprocaddress.c',
|
||||||
'shared/stw_arbpixelformat.c',
|
'shared/stw_arbpixelformat.c',
|
||||||
'shared/stw_tls.c',
|
'shared/stw_tls.c',
|
||||||
|
|
|
@ -38,6 +38,7 @@ static const char *stw_extension_string =
|
||||||
"WGL_ARB_extensions_string "
|
"WGL_ARB_extensions_string "
|
||||||
"WGL_ARB_multisample "
|
"WGL_ARB_multisample "
|
||||||
"WGL_ARB_pixel_format "
|
"WGL_ARB_pixel_format "
|
||||||
|
/* "WGL_EXT_swap_interval " */
|
||||||
"WGL_EXT_extensions_string";
|
"WGL_EXT_extensions_string";
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
/**************************************************************************
|
||||||
|
*
|
||||||
|
* Copyright 2009 VMware, Inc.
|
||||||
|
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sub license, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
* the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice (including the
|
||||||
|
* next paragraph) shall be included in all copies or substantial portions
|
||||||
|
* of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
|
||||||
|
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
#define WGL_WGLEXT_PROTOTYPES
|
||||||
|
|
||||||
|
#include <GL/gl.h>
|
||||||
|
#include <GL/wglext.h>
|
||||||
|
#include "util/u_debug.h"
|
||||||
|
|
||||||
|
/* A dummy implementation of this extension.
|
||||||
|
*
|
||||||
|
* Required as some applications retrieve and call these functions
|
||||||
|
* regardless of the fact that we don't advertise the extension and
|
||||||
|
* further more the results of wglGetProcAddress are NULL.
|
||||||
|
*/
|
||||||
|
WINGDIAPI BOOL APIENTRY
|
||||||
|
wglSwapIntervalEXT(int interval)
|
||||||
|
{
|
||||||
|
(void) interval;
|
||||||
|
debug_printf("%s: %d\n", __FUNCTION__, interval);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
WINGDIAPI int APIENTRY
|
||||||
|
wglGetSwapIntervalEXT(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -300,8 +300,18 @@ struct stw_framebuffer *
|
||||||
stw_framebuffer_from_hdc_locked(
|
stw_framebuffer_from_hdc_locked(
|
||||||
HDC hdc )
|
HDC hdc )
|
||||||
{
|
{
|
||||||
|
HWND hwnd;
|
||||||
struct stw_framebuffer *fb;
|
struct stw_framebuffer *fb;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Some applications create and use several HDCs for the same window, so
|
||||||
|
* looking up the framebuffer by the HDC is not reliable. Use HWND whenever
|
||||||
|
* possible.
|
||||||
|
*/
|
||||||
|
hwnd = WindowFromDC(hdc);
|
||||||
|
if(hwnd)
|
||||||
|
return stw_framebuffer_from_hwnd_locked(hwnd);
|
||||||
|
|
||||||
for (fb = stw_dev->fb_head; fb != NULL; fb = fb->next)
|
for (fb = stw_dev->fb_head; fb != NULL; fb = fb->next)
|
||||||
if (fb->hDC == hdc)
|
if (fb->hDC == hdc)
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -56,6 +56,10 @@ static const struct stw_extension_entry stw_extension_entries[] = {
|
||||||
/* WGL_EXT_extensions_string */
|
/* WGL_EXT_extensions_string */
|
||||||
STW_EXTENSION_ENTRY( wglGetExtensionsStringEXT ),
|
STW_EXTENSION_ENTRY( wglGetExtensionsStringEXT ),
|
||||||
|
|
||||||
|
/* WGL_EXT_swap_interval */
|
||||||
|
STW_EXTENSION_ENTRY( wglGetSwapIntervalEXT ),
|
||||||
|
STW_EXTENSION_ENTRY( wglSwapIntervalEXT ),
|
||||||
|
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -65,13 +69,13 @@ stw_get_proc_address(
|
||||||
{
|
{
|
||||||
const struct stw_extension_entry *entry;
|
const struct stw_extension_entry *entry;
|
||||||
|
|
||||||
PROC p = (PROC) _glapi_get_proc_address( lpszProc );
|
if (lpszProc[0] == 'w' && lpszProc[1] == 'g' && lpszProc[2] == 'l')
|
||||||
if (p)
|
for (entry = stw_extension_entries; entry->name; entry++)
|
||||||
return p;
|
if (strcmp( lpszProc, entry->name ) == 0)
|
||||||
|
return entry->proc;
|
||||||
|
|
||||||
for (entry = stw_extension_entries; entry->name; entry++)
|
if (lpszProc[0] == 'g' && lpszProc[1] == 'l')
|
||||||
if (strcmp( lpszProc, entry->name ) == 0)
|
return (PROC) _glapi_get_proc_address( lpszProc );
|
||||||
return entry->proc;
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -516,6 +516,7 @@ intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb,
|
||||||
irb->Base.BlueBits = texImage->TexFormat->BlueBits;
|
irb->Base.BlueBits = texImage->TexFormat->BlueBits;
|
||||||
irb->Base.AlphaBits = texImage->TexFormat->AlphaBits;
|
irb->Base.AlphaBits = texImage->TexFormat->AlphaBits;
|
||||||
irb->Base.DepthBits = texImage->TexFormat->DepthBits;
|
irb->Base.DepthBits = texImage->TexFormat->DepthBits;
|
||||||
|
irb->Base.StencilBits = texImage->TexFormat->StencilBits;
|
||||||
|
|
||||||
irb->Base.Delete = intel_delete_renderbuffer;
|
irb->Base.Delete = intel_delete_renderbuffer;
|
||||||
irb->Base.AllocStorage = intel_nop_alloc_storage;
|
irb->Base.AllocStorage = intel_nop_alloc_storage;
|
||||||
|
|
|
@ -110,6 +110,29 @@ const char *_mesa_lookup_enum_by_nr( int nr )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Get the name of an enum given that it is a primitive type. Avoids
|
||||||
|
* GL_FALSE/GL_POINTS ambiguity and others.
|
||||||
|
*/
|
||||||
|
const char *_mesa_lookup_prim_by_nr( int nr )
|
||||||
|
{
|
||||||
|
switch (nr) {
|
||||||
|
case GL_POINTS: return "GL_POINTS";
|
||||||
|
case GL_LINES: return "GL_LINES";
|
||||||
|
case GL_LINE_STRIP: return "GL_LINE_STRIP";
|
||||||
|
case GL_LINE_LOOP: return "GL_LINE_LOOP";
|
||||||
|
case GL_TRIANGLES: return "GL_TRIANGLES";
|
||||||
|
case GL_TRIANGLE_STRIP: return "GL_TRIANGLE_STRIP";
|
||||||
|
case GL_TRIANGLE_FAN: return "GL_TRIANGLE_FAN";
|
||||||
|
case GL_QUADS: return "GL_QUADS";
|
||||||
|
case GL_QUAD_STRIP: return "GL_QUAD_STRIP";
|
||||||
|
case GL_POLYGON: return "GL_POLYGON";
|
||||||
|
case GL_POLYGON+1: return "OUTSIDE_BEGIN_END";
|
||||||
|
default: return "<invalid>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int _mesa_lookup_enum_by_name( const char *symbol )
|
int _mesa_lookup_enum_by_name( const char *symbol )
|
||||||
{
|
{
|
||||||
enum_elt * f = NULL;
|
enum_elt * f = NULL;
|
||||||
|
|
|
@ -960,6 +960,20 @@ save_BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void invalidate_saved_current_state( GLcontext *ctx )
|
||||||
|
{
|
||||||
|
GLint i;
|
||||||
|
|
||||||
|
for (i = 0; i < VERT_ATTRIB_MAX; i++)
|
||||||
|
ctx->ListState.ActiveAttribSize[i] = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < MAT_ATTRIB_MAX; i++)
|
||||||
|
ctx->ListState.ActiveMaterialSize[i] = 0;
|
||||||
|
|
||||||
|
memset(&ctx->ListState.Current, 0, sizeof ctx->ListState.Current);
|
||||||
|
|
||||||
|
ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
void GLAPIENTRY
|
void GLAPIENTRY
|
||||||
_mesa_save_CallList(GLuint list)
|
_mesa_save_CallList(GLuint list)
|
||||||
|
@ -973,9 +987,10 @@ _mesa_save_CallList(GLuint list)
|
||||||
n[1].ui = list;
|
n[1].ui = list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* After this, we don't know what begin/end state we're in:
|
/* After this, we don't know what state we're in. Invalidate all
|
||||||
|
* cached information previously gathered:
|
||||||
*/
|
*/
|
||||||
ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
|
invalidate_saved_current_state( ctx );
|
||||||
|
|
||||||
if (ctx->ExecuteFlag) {
|
if (ctx->ExecuteFlag) {
|
||||||
_mesa_CallList(list);
|
_mesa_CallList(list);
|
||||||
|
@ -1018,9 +1033,10 @@ _mesa_save_CallLists(GLsizei n, GLenum type, const GLvoid * lists)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* After this, we don't know what begin/end state we're in:
|
/* After this, we don't know what state we're in. Invalidate all
|
||||||
|
* cached information previously gathered:
|
||||||
*/
|
*/
|
||||||
ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
|
invalidate_saved_current_state( ctx );
|
||||||
|
|
||||||
if (ctx->ExecuteFlag) {
|
if (ctx->ExecuteFlag) {
|
||||||
CALL_CallLists(ctx->Exec, (n, type, lists));
|
CALL_CallLists(ctx->Exec, (n, type, lists));
|
||||||
|
@ -3180,14 +3196,26 @@ save_ShadeModel(GLenum mode)
|
||||||
{
|
{
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
Node *n;
|
Node *n;
|
||||||
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
|
ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx);
|
||||||
|
|
||||||
|
if (ctx->ExecuteFlag) {
|
||||||
|
CALL_ShadeModel(ctx->Exec, (mode));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctx->ListState.Current.ShadeModel == mode)
|
||||||
|
return;
|
||||||
|
|
||||||
|
SAVE_FLUSH_VERTICES(ctx);
|
||||||
|
|
||||||
|
/* Only save the value if we know the statechange will take effect:
|
||||||
|
*/
|
||||||
|
if (ctx->Driver.CurrentSavePrimitive == PRIM_OUTSIDE_BEGIN_END)
|
||||||
|
ctx->ListState.Current.ShadeModel = mode;
|
||||||
|
|
||||||
n = ALLOC_INSTRUCTION(ctx, OPCODE_SHADE_MODEL, 1);
|
n = ALLOC_INSTRUCTION(ctx, OPCODE_SHADE_MODEL, 1);
|
||||||
if (n) {
|
if (n) {
|
||||||
n[1].e = mode;
|
n[1].e = mode;
|
||||||
}
|
}
|
||||||
if (ctx->ExecuteFlag) {
|
|
||||||
CALL_ShadeModel(ctx->Exec, (mode));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5149,14 +5177,21 @@ save_EdgeFlag(GLboolean x)
|
||||||
save_Attr1fNV(VERT_ATTRIB_EDGEFLAG, x ? (GLfloat)1.0 : (GLfloat)0.0);
|
save_Attr1fNV(VERT_ATTRIB_EDGEFLAG, x ? (GLfloat)1.0 : (GLfloat)0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static INLINE GLboolean compare4fv( const GLfloat *a,
|
||||||
|
const GLfloat *b,
|
||||||
|
GLuint count )
|
||||||
|
{
|
||||||
|
return memcmp( a, b, count * sizeof(GLfloat) ) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void GLAPIENTRY
|
static void GLAPIENTRY
|
||||||
save_Materialfv(GLenum face, GLenum pname, const GLfloat * param)
|
save_Materialfv(GLenum face, GLenum pname, const GLfloat * param)
|
||||||
{
|
{
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
Node *n;
|
Node *n;
|
||||||
int args, i;
|
int args, i;
|
||||||
|
GLuint bitmask;
|
||||||
SAVE_FLUSH_VERTICES(ctx);
|
|
||||||
|
|
||||||
switch (face) {
|
switch (face) {
|
||||||
case GL_BACK:
|
case GL_BACK:
|
||||||
|
@ -5186,6 +5221,36 @@ save_Materialfv(GLenum face, GLenum pname, const GLfloat * param)
|
||||||
_mesa_compile_error(ctx, GL_INVALID_ENUM, "material(pname)");
|
_mesa_compile_error(ctx, GL_INVALID_ENUM, "material(pname)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ctx->ExecuteFlag) {
|
||||||
|
CALL_Materialfv(ctx->Exec, (face, pname, param));
|
||||||
|
}
|
||||||
|
|
||||||
|
bitmask = _mesa_material_bitmask(ctx, face, pname, ~0, NULL);
|
||||||
|
|
||||||
|
/* Try to eliminate redundant statechanges. Because it is legal to
|
||||||
|
* call glMaterial even inside begin/end calls, don't need to worry
|
||||||
|
* about ctx->Driver.CurrentSavePrimitive here.
|
||||||
|
*/
|
||||||
|
for (i = 0; i < MAT_ATTRIB_MAX; i++) {
|
||||||
|
if (bitmask & (1 << i)) {
|
||||||
|
if (ctx->ListState.ActiveMaterialSize[i] == args &&
|
||||||
|
compare4fv(ctx->ListState.CurrentMaterial[i], param, args)) {
|
||||||
|
bitmask &= ~(1 << i);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ctx->ListState.ActiveMaterialSize[i] = args;
|
||||||
|
COPY_SZ_4V(ctx->ListState.CurrentMaterial[i], args, param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If this call has effect, return early:
|
||||||
|
*/
|
||||||
|
if (bitmask == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
SAVE_FLUSH_VERTICES(ctx);
|
||||||
|
|
||||||
n = ALLOC_INSTRUCTION(ctx, OPCODE_MATERIAL, 6);
|
n = ALLOC_INSTRUCTION(ctx, OPCODE_MATERIAL, 6);
|
||||||
if (n) {
|
if (n) {
|
||||||
|
@ -5194,19 +5259,6 @@ save_Materialfv(GLenum face, GLenum pname, const GLfloat * param)
|
||||||
for (i = 0; i < args; i++)
|
for (i = 0; i < args; i++)
|
||||||
n[3 + i].f = param[i];
|
n[3 + i].f = param[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
GLuint bitmask = _mesa_material_bitmask(ctx, face, pname, ~0, NULL);
|
|
||||||
for (i = 0; i < MAT_ATTRIB_MAX; i++)
|
|
||||||
if (bitmask & (1 << i)) {
|
|
||||||
ctx->ListState.ActiveMaterialSize[i] = args;
|
|
||||||
COPY_SZ_4V(ctx->ListState.CurrentMaterial[i], args, param);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ctx->ExecuteFlag) {
|
|
||||||
CALL_Materialfv(ctx->Exec, (face, pname, param));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GLAPIENTRY
|
static void GLAPIENTRY
|
||||||
|
@ -6796,7 +6848,6 @@ void GLAPIENTRY
|
||||||
_mesa_NewList(GLuint name, GLenum mode)
|
_mesa_NewList(GLuint name, GLenum mode)
|
||||||
{
|
{
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
GLint i;
|
|
||||||
|
|
||||||
FLUSH_CURRENT(ctx, 0); /* must be called before assert */
|
FLUSH_CURRENT(ctx, 0); /* must be called before assert */
|
||||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||||
|
@ -6824,20 +6875,15 @@ _mesa_NewList(GLuint name, GLenum mode)
|
||||||
ctx->CompileFlag = GL_TRUE;
|
ctx->CompileFlag = GL_TRUE;
|
||||||
ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE);
|
ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE);
|
||||||
|
|
||||||
|
/* Reset acumulated list state:
|
||||||
|
*/
|
||||||
|
invalidate_saved_current_state( ctx );
|
||||||
|
|
||||||
/* Allocate new display list */
|
/* Allocate new display list */
|
||||||
ctx->ListState.CurrentList = make_list(name, BLOCK_SIZE);
|
ctx->ListState.CurrentList = make_list(name, BLOCK_SIZE);
|
||||||
ctx->ListState.CurrentBlock = ctx->ListState.CurrentList->Head;
|
ctx->ListState.CurrentBlock = ctx->ListState.CurrentList->Head;
|
||||||
ctx->ListState.CurrentPos = 0;
|
ctx->ListState.CurrentPos = 0;
|
||||||
|
|
||||||
/* Reset acumulated list state:
|
|
||||||
*/
|
|
||||||
for (i = 0; i < Elements(ctx->ListState.ActiveAttribSize); i++)
|
|
||||||
ctx->ListState.ActiveAttribSize[i] = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < Elements(ctx->ListState.ActiveMaterialSize); i++)
|
|
||||||
ctx->ListState.ActiveMaterialSize[i] = 0;
|
|
||||||
|
|
||||||
ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
|
|
||||||
ctx->Driver.NewList(ctx, name, mode);
|
ctx->Driver.NewList(ctx, name, mode);
|
||||||
|
|
||||||
ctx->CurrentDispatch = ctx->Save;
|
ctx->CurrentDispatch = ctx->Save;
|
||||||
|
|
|
@ -5091,6 +5091,28 @@ const char *_mesa_lookup_enum_by_nr( int nr )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Get the name of an enum given that it is a primitive type. Avoids
|
||||||
|
* GL_FALSE/GL_POINTS ambiguity and others.
|
||||||
|
*/
|
||||||
|
const char *_mesa_lookup_prim_by_nr( int nr )
|
||||||
|
{
|
||||||
|
switch (nr) {
|
||||||
|
case GL_POINTS: return "GL_POINTS";
|
||||||
|
case GL_LINES: return "GL_LINES";
|
||||||
|
case GL_LINE_STRIP: return "GL_LINE_STRIP";
|
||||||
|
case GL_LINE_LOOP: return "GL_LINE_LOOP";
|
||||||
|
case GL_TRIANGLES: return "GL_TRIANGLES";
|
||||||
|
case GL_TRIANGLE_STRIP: return "GL_TRIANGLE_STRIP";
|
||||||
|
case GL_TRIANGLE_FAN: return "GL_TRIANGLE_FAN";
|
||||||
|
case GL_QUADS: return "GL_QUADS";
|
||||||
|
case GL_QUAD_STRIP: return "GL_QUAD_STRIP";
|
||||||
|
case GL_POLYGON: return "GL_POLYGON";
|
||||||
|
case GL_POLYGON+1: return "OUTSIDE_BEGIN_END";
|
||||||
|
default: return "<invalid>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int _mesa_lookup_enum_by_name( const char *symbol )
|
int _mesa_lookup_enum_by_name( const char *symbol )
|
||||||
{
|
{
|
||||||
enum_elt * f = NULL;
|
enum_elt * f = NULL;
|
||||||
|
|
|
@ -40,6 +40,12 @@
|
||||||
#if defined(_HAVE_FULL_GL) && _HAVE_FULL_GL
|
#if defined(_HAVE_FULL_GL) && _HAVE_FULL_GL
|
||||||
|
|
||||||
extern const char *_mesa_lookup_enum_by_nr( int nr );
|
extern const char *_mesa_lookup_enum_by_nr( int nr );
|
||||||
|
|
||||||
|
/* Get the name of an enum given that it is a primitive type. Avoids
|
||||||
|
* GL_FALSE/GL_POINTS ambiguity and others.
|
||||||
|
*/
|
||||||
|
const char *_mesa_lookup_prim_by_nr( int nr );
|
||||||
|
|
||||||
extern int _mesa_lookup_enum_by_name( const char *symbol );
|
extern int _mesa_lookup_enum_by_name( const char *symbol );
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
*
|
*
|
||||||
* Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
|
* Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||||
* All Rights Reserved.
|
* All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the
|
* copy of this software and associated documentation files (the
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
@ -10,11 +10,11 @@
|
||||||
* distribute, sub license, and/or sell copies of the Software, and to
|
* distribute, sub license, and/or sell copies of the Software, and to
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
* permit persons to whom the Software is furnished to do so, subject to
|
||||||
* the following conditions:
|
* the following conditions:
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice (including the
|
* The above copyright notice and this permission notice (including the
|
||||||
* next paragraph) shall be included in all copies or substantial portions
|
* next paragraph) shall be included in all copies or substantial portions
|
||||||
* of the Software.
|
* of the Software.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*
|
*
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,20 +48,16 @@
|
||||||
|
|
||||||
struct state_key {
|
struct state_key {
|
||||||
unsigned light_color_material_mask:12;
|
unsigned light_color_material_mask:12;
|
||||||
unsigned light_material_mask:12;
|
|
||||||
unsigned light_global_enabled:1;
|
unsigned light_global_enabled:1;
|
||||||
unsigned light_local_viewer:1;
|
unsigned light_local_viewer:1;
|
||||||
unsigned light_twoside:1;
|
unsigned light_twoside:1;
|
||||||
unsigned light_color_material:1;
|
|
||||||
unsigned material_shininess_is_zero:1;
|
unsigned material_shininess_is_zero:1;
|
||||||
unsigned need_eye_coords:1;
|
unsigned need_eye_coords:1;
|
||||||
unsigned normalize:1;
|
unsigned normalize:1;
|
||||||
unsigned rescale_normals:1;
|
unsigned rescale_normals:1;
|
||||||
|
|
||||||
unsigned fog_source_is_depth:1;
|
unsigned fog_source_is_depth:1;
|
||||||
unsigned tnl_do_vertex_fog:1;
|
|
||||||
unsigned separate_specular:1;
|
unsigned separate_specular:1;
|
||||||
unsigned fog_mode:2;
|
|
||||||
unsigned point_attenuated:1;
|
unsigned point_attenuated:1;
|
||||||
unsigned point_array:1;
|
unsigned point_array:1;
|
||||||
unsigned texture_enabled_global:1;
|
unsigned texture_enabled_global:1;
|
||||||
|
@ -73,7 +69,7 @@ struct state_key {
|
||||||
unsigned light_enabled:1;
|
unsigned light_enabled:1;
|
||||||
unsigned light_eyepos3_is_zero:1;
|
unsigned light_eyepos3_is_zero:1;
|
||||||
unsigned light_spotcutoff_is_180:1;
|
unsigned light_spotcutoff_is_180:1;
|
||||||
unsigned light_attenuated:1;
|
unsigned light_attenuated:1;
|
||||||
unsigned texunit_really_enabled:1;
|
unsigned texunit_really_enabled:1;
|
||||||
unsigned texmat_enabled:1;
|
unsigned texmat_enabled:1;
|
||||||
unsigned texgen_enabled:4;
|
unsigned texgen_enabled:4;
|
||||||
|
@ -85,23 +81,6 @@ struct state_key {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define FOG_NONE 0
|
|
||||||
#define FOG_LINEAR 1
|
|
||||||
#define FOG_EXP 2
|
|
||||||
#define FOG_EXP2 3
|
|
||||||
|
|
||||||
static GLuint translate_fog_mode( GLenum mode )
|
|
||||||
{
|
|
||||||
switch (mode) {
|
|
||||||
case GL_LINEAR: return FOG_LINEAR;
|
|
||||||
case GL_EXP: return FOG_EXP;
|
|
||||||
case GL_EXP2: return FOG_EXP2;
|
|
||||||
default: return FOG_NONE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#define TXG_NONE 0
|
#define TXG_NONE 0
|
||||||
#define TXG_OBJ_LINEAR 1
|
#define TXG_OBJ_LINEAR 1
|
||||||
#define TXG_EYE_LINEAR 2
|
#define TXG_EYE_LINEAR 2
|
||||||
|
@ -125,42 +104,6 @@ static GLuint translate_texgen( GLboolean enabled, GLenum mode )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns bitmask of flags indicating which materials are set per-vertex
|
|
||||||
* in the current VB.
|
|
||||||
* XXX get these from the VBO...
|
|
||||||
*/
|
|
||||||
static GLbitfield
|
|
||||||
tnl_get_per_vertex_materials(GLcontext *ctx)
|
|
||||||
{
|
|
||||||
GLbitfield mask = 0x0;
|
|
||||||
#if 0
|
|
||||||
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
|
||||||
struct vertex_buffer *VB = &tnl->vb;
|
|
||||||
GLuint i;
|
|
||||||
|
|
||||||
for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++)
|
|
||||||
if (VB->AttribPtr[i] && VB->AttribPtr[i]->stride)
|
|
||||||
mask |= 1 << (i - _TNL_FIRST_MAT);
|
|
||||||
#endif
|
|
||||||
return mask;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Should fog be computed per-vertex?
|
|
||||||
*/
|
|
||||||
static GLboolean
|
|
||||||
tnl_get_per_vertex_fog(GLcontext *ctx)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
|
||||||
return tnl->_DoVertexFog;
|
|
||||||
#else
|
|
||||||
return GL_FALSE;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static GLboolean check_active_shininess( GLcontext *ctx,
|
static GLboolean check_active_shininess( GLcontext *ctx,
|
||||||
const struct state_key *key,
|
const struct state_key *key,
|
||||||
|
@ -168,10 +111,11 @@ static GLboolean check_active_shininess( GLcontext *ctx,
|
||||||
{
|
{
|
||||||
GLuint bit = 1 << (MAT_ATTRIB_FRONT_SHININESS + side);
|
GLuint bit = 1 << (MAT_ATTRIB_FRONT_SHININESS + side);
|
||||||
|
|
||||||
if (key->light_color_material_mask & bit)
|
if ((key->varying_vp_inputs & VERT_BIT_COLOR0) &&
|
||||||
|
(key->light_color_material_mask & bit))
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
|
|
||||||
if (key->light_material_mask & bit)
|
if (key->varying_vp_inputs & (bit << 16))
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
|
|
||||||
if (ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_SHININESS + side][0] != 0.0F)
|
if (ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_SHININESS + side][0] != 0.0F)
|
||||||
|
@ -216,12 +160,9 @@ static void make_state_key( GLcontext *ctx, struct state_key *key )
|
||||||
key->light_twoside = 1;
|
key->light_twoside = 1;
|
||||||
|
|
||||||
if (ctx->Light.ColorMaterialEnabled) {
|
if (ctx->Light.ColorMaterialEnabled) {
|
||||||
key->light_color_material = 1;
|
|
||||||
key->light_color_material_mask = ctx->Light.ColorMaterialBitmask;
|
key->light_color_material_mask = ctx->Light.ColorMaterialBitmask;
|
||||||
}
|
}
|
||||||
|
|
||||||
key->light_material_mask = tnl_get_per_vertex_materials(ctx);
|
|
||||||
|
|
||||||
for (i = 0; i < MAX_LIGHTS; i++) {
|
for (i = 0; i < MAX_LIGHTS; i++) {
|
||||||
struct gl_light *light = &ctx->Light.Light[i];
|
struct gl_light *light = &ctx->Light.Light[i];
|
||||||
|
|
||||||
|
@ -230,7 +171,7 @@ static void make_state_key( GLcontext *ctx, struct state_key *key )
|
||||||
|
|
||||||
if (light->EyePosition[3] == 0.0)
|
if (light->EyePosition[3] == 0.0)
|
||||||
key->unit[i].light_eyepos3_is_zero = 1;
|
key->unit[i].light_eyepos3_is_zero = 1;
|
||||||
|
|
||||||
if (light->SpotCutoff == 180.0)
|
if (light->SpotCutoff == 180.0)
|
||||||
key->unit[i].light_spotcutoff_is_180 = 1;
|
key->unit[i].light_spotcutoff_is_180 = 1;
|
||||||
|
|
||||||
|
@ -259,12 +200,8 @@ static void make_state_key( GLcontext *ctx, struct state_key *key )
|
||||||
if (ctx->Transform.RescaleNormals)
|
if (ctx->Transform.RescaleNormals)
|
||||||
key->rescale_normals = 1;
|
key->rescale_normals = 1;
|
||||||
|
|
||||||
key->fog_mode = translate_fog_mode(fp->FogOption);
|
|
||||||
|
|
||||||
if (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT)
|
if (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT)
|
||||||
key->fog_source_is_depth = 1;
|
key->fog_source_is_depth = 1;
|
||||||
|
|
||||||
key->tnl_do_vertex_fog = tnl_get_per_vertex_fog(ctx);
|
|
||||||
|
|
||||||
if (ctx->Point._Attenuated)
|
if (ctx->Point._Attenuated)
|
||||||
key->point_attenuated = 1;
|
key->point_attenuated = 1;
|
||||||
|
@ -278,29 +215,29 @@ static void make_state_key( GLcontext *ctx, struct state_key *key )
|
||||||
ctx->Texture._TexMatEnabled ||
|
ctx->Texture._TexMatEnabled ||
|
||||||
ctx->Texture._EnabledUnits)
|
ctx->Texture._EnabledUnits)
|
||||||
key->texture_enabled_global = 1;
|
key->texture_enabled_global = 1;
|
||||||
|
|
||||||
for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {
|
for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {
|
||||||
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
|
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
|
||||||
|
|
||||||
if (texUnit->_ReallyEnabled)
|
if (texUnit->_ReallyEnabled)
|
||||||
key->unit[i].texunit_really_enabled = 1;
|
key->unit[i].texunit_really_enabled = 1;
|
||||||
|
|
||||||
if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i))
|
if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i))
|
||||||
key->unit[i].texmat_enabled = 1;
|
key->unit[i].texmat_enabled = 1;
|
||||||
|
|
||||||
if (texUnit->TexGenEnabled) {
|
if (texUnit->TexGenEnabled) {
|
||||||
key->unit[i].texgen_enabled = 1;
|
key->unit[i].texgen_enabled = 1;
|
||||||
|
|
||||||
key->unit[i].texgen_mode0 =
|
key->unit[i].texgen_mode0 =
|
||||||
translate_texgen( texUnit->TexGenEnabled & (1<<0),
|
translate_texgen( texUnit->TexGenEnabled & (1<<0),
|
||||||
texUnit->GenS.Mode );
|
texUnit->GenS.Mode );
|
||||||
key->unit[i].texgen_mode1 =
|
key->unit[i].texgen_mode1 =
|
||||||
translate_texgen( texUnit->TexGenEnabled & (1<<1),
|
translate_texgen( texUnit->TexGenEnabled & (1<<1),
|
||||||
texUnit->GenT.Mode );
|
texUnit->GenT.Mode );
|
||||||
key->unit[i].texgen_mode2 =
|
key->unit[i].texgen_mode2 =
|
||||||
translate_texgen( texUnit->TexGenEnabled & (1<<2),
|
translate_texgen( texUnit->TexGenEnabled & (1<<2),
|
||||||
texUnit->GenR.Mode );
|
texUnit->GenR.Mode );
|
||||||
key->unit[i].texgen_mode3 =
|
key->unit[i].texgen_mode3 =
|
||||||
translate_texgen( texUnit->TexGenEnabled & (1<<3),
|
translate_texgen( texUnit->TexGenEnabled & (1<<3),
|
||||||
texUnit->GenQ.Mode );
|
texUnit->GenQ.Mode );
|
||||||
}
|
}
|
||||||
|
@ -308,7 +245,7 @@ static void make_state_key( GLcontext *ctx, struct state_key *key )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Very useful debugging tool - produces annotated listing of
|
/* Very useful debugging tool - produces annotated listing of
|
||||||
* generated program with line/function references for each
|
* generated program with line/function references for each
|
||||||
* instruction back into this file:
|
* instruction back into this file:
|
||||||
|
@ -317,7 +254,7 @@ static void make_state_key( GLcontext *ctx, struct state_key *key )
|
||||||
|
|
||||||
|
|
||||||
/* Use uregs to represent registers internally, translate to Mesa's
|
/* Use uregs to represent registers internally, translate to Mesa's
|
||||||
* expected formats on emit.
|
* expected formats on emit.
|
||||||
*
|
*
|
||||||
* NOTE: These are passed by value extensively in this file rather
|
* NOTE: These are passed by value extensively in this file rather
|
||||||
* than as usual by pointer reference. If this disturbs you, try
|
* than as usual by pointer reference. If this disturbs you, try
|
||||||
|
@ -343,10 +280,10 @@ struct tnl_program {
|
||||||
struct gl_vertex_program *program;
|
struct gl_vertex_program *program;
|
||||||
GLint max_inst; /** number of instructions allocated for program */
|
GLint max_inst; /** number of instructions allocated for program */
|
||||||
GLboolean mvp_with_dp4;
|
GLboolean mvp_with_dp4;
|
||||||
|
|
||||||
GLuint temp_in_use;
|
GLuint temp_in_use;
|
||||||
GLuint temp_reserved;
|
GLuint temp_reserved;
|
||||||
|
|
||||||
struct ureg eye_position;
|
struct ureg eye_position;
|
||||||
struct ureg eye_position_z;
|
struct ureg eye_position_z;
|
||||||
struct ureg eye_position_normalized;
|
struct ureg eye_position_normalized;
|
||||||
|
@ -450,7 +387,7 @@ static void release_temps( struct tnl_program *p )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct ureg register_param5(struct tnl_program *p,
|
static struct ureg register_param5(struct tnl_program *p,
|
||||||
GLint s0,
|
GLint s0,
|
||||||
GLint s1,
|
GLint s1,
|
||||||
GLint s2,
|
GLint s2,
|
||||||
|
@ -481,9 +418,9 @@ static struct ureg register_param5(struct tnl_program *p,
|
||||||
*/
|
*/
|
||||||
static struct ureg register_input( struct tnl_program *p, GLuint input )
|
static struct ureg register_input( struct tnl_program *p, GLuint input )
|
||||||
{
|
{
|
||||||
/* Material attribs are passed here as inputs >= 32
|
assert(input < 32);
|
||||||
*/
|
|
||||||
if (input >= 32 || (p->state->varying_vp_inputs & (1<<input))) {
|
if (p->state->varying_vp_inputs & (1<<input)) {
|
||||||
p->program->Base.InputsRead |= (1<<input);
|
p->program->Base.InputsRead |= (1<<input);
|
||||||
return make_ureg(PROGRAM_INPUT, input);
|
return make_ureg(PROGRAM_INPUT, input);
|
||||||
}
|
}
|
||||||
|
@ -503,7 +440,7 @@ static struct ureg register_output( struct tnl_program *p, GLuint output )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct ureg register_const4f( struct tnl_program *p,
|
static struct ureg register_const4f( struct tnl_program *p,
|
||||||
GLfloat s0,
|
GLfloat s0,
|
||||||
GLfloat s1,
|
GLfloat s1,
|
||||||
GLfloat s2,
|
GLfloat s2,
|
||||||
|
@ -535,7 +472,7 @@ static GLboolean is_undef( struct ureg reg )
|
||||||
|
|
||||||
static struct ureg get_identity_param( struct tnl_program *p )
|
static struct ureg get_identity_param( struct tnl_program *p )
|
||||||
{
|
{
|
||||||
if (is_undef(p->identity))
|
if (is_undef(p->identity))
|
||||||
p->identity = register_const4f(p, 0,0,0,1);
|
p->identity = register_const4f(p, 0,0,0,1);
|
||||||
|
|
||||||
return p->identity;
|
return p->identity;
|
||||||
|
@ -554,7 +491,7 @@ static void register_matrix_param5( struct tnl_program *p,
|
||||||
/* This is a bit sad as the support is there to pull the whole
|
/* This is a bit sad as the support is there to pull the whole
|
||||||
* matrix out in one go:
|
* matrix out in one go:
|
||||||
*/
|
*/
|
||||||
for (i = 0; i <= s3 - s2; i++)
|
for (i = 0; i <= s3 - s2; i++)
|
||||||
matrix[i] = register_param5( p, s0, s1, i, i, s4 );
|
matrix[i] = register_param5( p, s0, s1, i, i, s4 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -579,7 +516,7 @@ static void emit_dst( struct prog_dst_register *dst,
|
||||||
dst->File = reg.file;
|
dst->File = reg.file;
|
||||||
dst->Index = reg.idx;
|
dst->Index = reg.idx;
|
||||||
/* allow zero as a shorthand for xyzw */
|
/* allow zero as a shorthand for xyzw */
|
||||||
dst->WriteMask = mask ? mask : WRITEMASK_XYZW;
|
dst->WriteMask = mask ? mask : WRITEMASK_XYZW;
|
||||||
dst->CondMask = COND_TR; /* always pass cond test */
|
dst->CondMask = COND_TR; /* always pass cond test */
|
||||||
dst->CondSwizzle = SWIZZLE_NOOP;
|
dst->CondSwizzle = SWIZZLE_NOOP;
|
||||||
dst->CondSrc = 0;
|
dst->CondSrc = 0;
|
||||||
|
@ -594,12 +531,12 @@ static void debug_insn( struct prog_instruction *inst, const char *fn,
|
||||||
{
|
{
|
||||||
if (DISASSEM) {
|
if (DISASSEM) {
|
||||||
static const char *last_fn;
|
static const char *last_fn;
|
||||||
|
|
||||||
if (fn != last_fn) {
|
if (fn != last_fn) {
|
||||||
last_fn = fn;
|
last_fn = fn;
|
||||||
_mesa_printf("%s:\n", fn);
|
_mesa_printf("%s:\n", fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
_mesa_printf("%d:\t", line);
|
_mesa_printf("%d:\t", line);
|
||||||
_mesa_print_instruction(inst);
|
_mesa_print_instruction(inst);
|
||||||
}
|
}
|
||||||
|
@ -618,7 +555,7 @@ static void emit_op3fn(struct tnl_program *p,
|
||||||
{
|
{
|
||||||
GLuint nr;
|
GLuint nr;
|
||||||
struct prog_instruction *inst;
|
struct prog_instruction *inst;
|
||||||
|
|
||||||
assert((GLint) p->program->Base.NumInstructions <= p->max_inst);
|
assert((GLint) p->program->Base.NumInstructions <= p->max_inst);
|
||||||
|
|
||||||
if (p->program->Base.NumInstructions == p->max_inst) {
|
if (p->program->Base.NumInstructions == p->max_inst) {
|
||||||
|
@ -643,16 +580,16 @@ static void emit_op3fn(struct tnl_program *p,
|
||||||
|
|
||||||
p->program->Base.Instructions = newInst;
|
p->program->Base.Instructions = newInst;
|
||||||
}
|
}
|
||||||
|
|
||||||
nr = p->program->Base.NumInstructions++;
|
nr = p->program->Base.NumInstructions++;
|
||||||
|
|
||||||
inst = &p->program->Base.Instructions[nr];
|
inst = &p->program->Base.Instructions[nr];
|
||||||
inst->Opcode = (enum prog_opcode) op;
|
inst->Opcode = (enum prog_opcode) op;
|
||||||
inst->Data = 0;
|
inst->Data = 0;
|
||||||
|
|
||||||
emit_arg( &inst->SrcReg[0], src0 );
|
emit_arg( &inst->SrcReg[0], src0 );
|
||||||
emit_arg( &inst->SrcReg[1], src1 );
|
emit_arg( &inst->SrcReg[1], src1 );
|
||||||
emit_arg( &inst->SrcReg[2], src2 );
|
emit_arg( &inst->SrcReg[2], src2 );
|
||||||
|
|
||||||
emit_dst( &inst->DstReg, dest, mask );
|
emit_dst( &inst->DstReg, dest, mask );
|
||||||
|
|
||||||
|
@ -672,7 +609,7 @@ static void emit_op3fn(struct tnl_program *p,
|
||||||
|
|
||||||
static struct ureg make_temp( struct tnl_program *p, struct ureg reg )
|
static struct ureg make_temp( struct tnl_program *p, struct ureg reg )
|
||||||
{
|
{
|
||||||
if (reg.file == PROGRAM_TEMPORARY &&
|
if (reg.file == PROGRAM_TEMPORARY &&
|
||||||
!(p->temp_reserved & (1<<reg.idx)))
|
!(p->temp_reserved & (1<<reg.idx)))
|
||||||
return reg;
|
return reg;
|
||||||
else {
|
else {
|
||||||
|
@ -753,19 +690,19 @@ static void emit_normalize_vec3( struct tnl_program *p,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void emit_passthrough( struct tnl_program *p,
|
static void emit_passthrough( struct tnl_program *p,
|
||||||
GLuint input,
|
GLuint input,
|
||||||
GLuint output )
|
GLuint output )
|
||||||
{
|
{
|
||||||
struct ureg out = register_output(p, output);
|
struct ureg out = register_output(p, output);
|
||||||
emit_op1(p, OPCODE_MOV, out, 0, register_input(p, input));
|
emit_op1(p, OPCODE_MOV, out, 0, register_input(p, input));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct ureg get_eye_position( struct tnl_program *p )
|
static struct ureg get_eye_position( struct tnl_program *p )
|
||||||
{
|
{
|
||||||
if (is_undef(p->eye_position)) {
|
if (is_undef(p->eye_position)) {
|
||||||
struct ureg pos = register_input( p, VERT_ATTRIB_POS );
|
struct ureg pos = register_input( p, VERT_ATTRIB_POS );
|
||||||
struct ureg modelview[4];
|
struct ureg modelview[4];
|
||||||
|
|
||||||
p->eye_position = reserve_temp(p);
|
p->eye_position = reserve_temp(p);
|
||||||
|
@ -783,18 +720,18 @@ static struct ureg get_eye_position( struct tnl_program *p )
|
||||||
emit_transpose_matrix_transform_vec4(p, p->eye_position, modelview, pos);
|
emit_transpose_matrix_transform_vec4(p, p->eye_position, modelview, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return p->eye_position;
|
return p->eye_position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct ureg get_eye_position_z( struct tnl_program *p )
|
static struct ureg get_eye_position_z( struct tnl_program *p )
|
||||||
{
|
{
|
||||||
if (!is_undef(p->eye_position))
|
if (!is_undef(p->eye_position))
|
||||||
return swizzle1(p->eye_position, Z);
|
return swizzle1(p->eye_position, Z);
|
||||||
|
|
||||||
if (is_undef(p->eye_position_z)) {
|
if (is_undef(p->eye_position_z)) {
|
||||||
struct ureg pos = register_input( p, VERT_ATTRIB_POS );
|
struct ureg pos = register_input( p, VERT_ATTRIB_POS );
|
||||||
struct ureg modelview[4];
|
struct ureg modelview[4];
|
||||||
|
|
||||||
p->eye_position_z = reserve_temp(p);
|
p->eye_position_z = reserve_temp(p);
|
||||||
|
@ -804,10 +741,10 @@ static struct ureg get_eye_position_z( struct tnl_program *p )
|
||||||
|
|
||||||
emit_op2(p, OPCODE_DP4, p->eye_position_z, 0, pos, modelview[2]);
|
emit_op2(p, OPCODE_DP4, p->eye_position_z, 0, pos, modelview[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return p->eye_position_z;
|
return p->eye_position_z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct ureg get_eye_position_normalized( struct tnl_program *p )
|
static struct ureg get_eye_position_normalized( struct tnl_program *p )
|
||||||
{
|
{
|
||||||
|
@ -816,7 +753,7 @@ static struct ureg get_eye_position_normalized( struct tnl_program *p )
|
||||||
p->eye_position_normalized = reserve_temp(p);
|
p->eye_position_normalized = reserve_temp(p);
|
||||||
emit_normalize_vec3(p, p->eye_position_normalized, eye);
|
emit_normalize_vec3(p, p->eye_position_normalized, eye);
|
||||||
}
|
}
|
||||||
|
|
||||||
return p->eye_position_normalized;
|
return p->eye_position_normalized;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -830,7 +767,7 @@ static struct ureg get_transformed_normal( struct tnl_program *p )
|
||||||
{
|
{
|
||||||
p->transformed_normal = register_input(p, VERT_ATTRIB_NORMAL );
|
p->transformed_normal = register_input(p, VERT_ATTRIB_NORMAL );
|
||||||
}
|
}
|
||||||
else if (is_undef(p->transformed_normal))
|
else if (is_undef(p->transformed_normal))
|
||||||
{
|
{
|
||||||
struct ureg normal = register_input(p, VERT_ATTRIB_NORMAL );
|
struct ureg normal = register_input(p, VERT_ATTRIB_NORMAL );
|
||||||
struct ureg mvinv[3];
|
struct ureg mvinv[3];
|
||||||
|
@ -861,7 +798,7 @@ static struct ureg get_transformed_normal( struct tnl_program *p )
|
||||||
emit_op2( p, OPCODE_MUL, transformed_normal, 0, normal, rescale );
|
emit_op2( p, OPCODE_MUL, transformed_normal, 0, normal, rescale );
|
||||||
normal = transformed_normal;
|
normal = transformed_normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(normal.file == PROGRAM_TEMPORARY);
|
assert(normal.file == PROGRAM_TEMPORARY);
|
||||||
p->transformed_normal = normal;
|
p->transformed_normal = normal;
|
||||||
}
|
}
|
||||||
|
@ -872,17 +809,17 @@ static struct ureg get_transformed_normal( struct tnl_program *p )
|
||||||
|
|
||||||
static void build_hpos( struct tnl_program *p )
|
static void build_hpos( struct tnl_program *p )
|
||||||
{
|
{
|
||||||
struct ureg pos = register_input( p, VERT_ATTRIB_POS );
|
struct ureg pos = register_input( p, VERT_ATTRIB_POS );
|
||||||
struct ureg hpos = register_output( p, VERT_RESULT_HPOS );
|
struct ureg hpos = register_output( p, VERT_RESULT_HPOS );
|
||||||
struct ureg mvp[4];
|
struct ureg mvp[4];
|
||||||
|
|
||||||
if (p->mvp_with_dp4) {
|
if (p->mvp_with_dp4) {
|
||||||
register_matrix_param5( p, STATE_MVP_MATRIX, 0, 0, 3,
|
register_matrix_param5( p, STATE_MVP_MATRIX, 0, 0, 3,
|
||||||
0, mvp );
|
0, mvp );
|
||||||
emit_matrix_transform_vec4( p, hpos, mvp, pos );
|
emit_matrix_transform_vec4( p, hpos, mvp, pos );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
register_matrix_param5( p, STATE_MVP_MATRIX, 0, 0, 3,
|
register_matrix_param5( p, STATE_MVP_MATRIX, 0, 0, 3,
|
||||||
STATE_MATRIX_TRANSPOSE, mvp );
|
STATE_MATRIX_TRANSPOSE, mvp );
|
||||||
emit_transpose_matrix_transform_vec4( p, hpos, mvp, pos );
|
emit_transpose_matrix_transform_vec4( p, hpos, mvp, pos );
|
||||||
}
|
}
|
||||||
|
@ -903,27 +840,28 @@ static void set_material_flags( struct tnl_program *p )
|
||||||
p->color_materials = 0;
|
p->color_materials = 0;
|
||||||
p->materials = 0;
|
p->materials = 0;
|
||||||
|
|
||||||
if (p->state->light_color_material) {
|
if (p->state->varying_vp_inputs & VERT_BIT_COLOR0) {
|
||||||
p->materials =
|
p->materials =
|
||||||
p->color_materials = p->state->light_color_material_mask;
|
p->color_materials = p->state->light_color_material_mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
p->materials |= p->state->light_material_mask;
|
p->materials |= (p->state->varying_vp_inputs >> 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* XXX temporary!!! */
|
static struct ureg get_material( struct tnl_program *p, GLuint side,
|
||||||
#define _TNL_ATTRIB_MAT_FRONT_AMBIENT 32
|
|
||||||
|
|
||||||
static struct ureg get_material( struct tnl_program *p, GLuint side,
|
|
||||||
GLuint property )
|
GLuint property )
|
||||||
{
|
{
|
||||||
GLuint attrib = material_attrib(side, property);
|
GLuint attrib = material_attrib(side, property);
|
||||||
|
|
||||||
if (p->color_materials & (1<<attrib))
|
if (p->color_materials & (1<<attrib))
|
||||||
return register_input(p, VERT_ATTRIB_COLOR0);
|
return register_input(p, VERT_ATTRIB_COLOR0);
|
||||||
else if (p->materials & (1<<attrib))
|
else if (p->materials & (1<<attrib)) {
|
||||||
return register_input( p, attrib + _TNL_ATTRIB_MAT_FRONT_AMBIENT );
|
/* Put material values in the GENERIC slots -- they are not used
|
||||||
|
* for anything in fixed function mode.
|
||||||
|
*/
|
||||||
|
return register_input( p, attrib + VERT_ATTRIB_GENERIC0 );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return register_param3( p, STATE_MATERIAL, side, property );
|
return register_param3( p, STATE_MATERIAL, side, property );
|
||||||
}
|
}
|
||||||
|
@ -952,7 +890,7 @@ static struct ureg get_scenecolor( struct tnl_program *p, GLuint side )
|
||||||
struct ureg material_ambient = get_material(p, side, STATE_AMBIENT);
|
struct ureg material_ambient = get_material(p, side, STATE_AMBIENT);
|
||||||
struct ureg material_diffuse = get_material(p, side, STATE_DIFFUSE);
|
struct ureg material_diffuse = get_material(p, side, STATE_DIFFUSE);
|
||||||
struct ureg tmp = make_temp(p, material_diffuse);
|
struct ureg tmp = make_temp(p, material_diffuse);
|
||||||
emit_op3(p, OPCODE_MAD, tmp, WRITEMASK_XYZ, lm_ambient,
|
emit_op3(p, OPCODE_MAD, tmp, WRITEMASK_XYZ, lm_ambient,
|
||||||
material_ambient, material_emission);
|
material_ambient, material_emission);
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
@ -961,12 +899,12 @@ static struct ureg get_scenecolor( struct tnl_program *p, GLuint side )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct ureg get_lightprod( struct tnl_program *p, GLuint light,
|
static struct ureg get_lightprod( struct tnl_program *p, GLuint light,
|
||||||
GLuint side, GLuint property )
|
GLuint side, GLuint property )
|
||||||
{
|
{
|
||||||
GLuint attrib = material_attrib(side, property);
|
GLuint attrib = material_attrib(side, property);
|
||||||
if (p->materials & (1<<attrib)) {
|
if (p->materials & (1<<attrib)) {
|
||||||
struct ureg light_value =
|
struct ureg light_value =
|
||||||
register_param3(p, STATE_LIGHT, light, property);
|
register_param3(p, STATE_LIGHT, light, property);
|
||||||
struct ureg material_value = get_material(p, side, property);
|
struct ureg material_value = get_material(p, side, property);
|
||||||
struct ureg tmp = get_temp(p);
|
struct ureg tmp = get_temp(p);
|
||||||
|
@ -979,7 +917,7 @@ static struct ureg get_lightprod( struct tnl_program *p, GLuint light,
|
||||||
|
|
||||||
|
|
||||||
static struct ureg calculate_light_attenuation( struct tnl_program *p,
|
static struct ureg calculate_light_attenuation( struct tnl_program *p,
|
||||||
GLuint i,
|
GLuint i,
|
||||||
struct ureg VPpli,
|
struct ureg VPpli,
|
||||||
struct ureg dist )
|
struct ureg dist )
|
||||||
{
|
{
|
||||||
|
@ -1008,27 +946,27 @@ static struct ureg calculate_light_attenuation( struct tnl_program *p,
|
||||||
*/
|
*/
|
||||||
if (p->state->unit[i].light_attenuated) {
|
if (p->state->unit[i].light_attenuated) {
|
||||||
/* 1/d,d,d,1/d */
|
/* 1/d,d,d,1/d */
|
||||||
emit_op1(p, OPCODE_RCP, dist, WRITEMASK_YZ, dist);
|
emit_op1(p, OPCODE_RCP, dist, WRITEMASK_YZ, dist);
|
||||||
/* 1,d,d*d,1/d */
|
/* 1,d,d*d,1/d */
|
||||||
emit_op2(p, OPCODE_MUL, dist, WRITEMASK_XZ, dist, swizzle1(dist,Y));
|
emit_op2(p, OPCODE_MUL, dist, WRITEMASK_XZ, dist, swizzle1(dist,Y));
|
||||||
/* 1/dist-atten */
|
/* 1/dist-atten */
|
||||||
emit_op2(p, OPCODE_DP3, dist, 0, attenuation, dist);
|
emit_op2(p, OPCODE_DP3, dist, 0, attenuation, dist);
|
||||||
|
|
||||||
if (!p->state->unit[i].light_spotcutoff_is_180) {
|
if (!p->state->unit[i].light_spotcutoff_is_180) {
|
||||||
/* dist-atten */
|
/* dist-atten */
|
||||||
emit_op1(p, OPCODE_RCP, dist, 0, dist);
|
emit_op1(p, OPCODE_RCP, dist, 0, dist);
|
||||||
/* spot-atten * dist-atten */
|
/* spot-atten * dist-atten */
|
||||||
emit_op2(p, OPCODE_MUL, att, 0, dist, att);
|
emit_op2(p, OPCODE_MUL, att, 0, dist, att);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* dist-atten */
|
/* dist-atten */
|
||||||
emit_op1(p, OPCODE_RCP, att, 0, dist);
|
emit_op1(p, OPCODE_RCP, att, 0, dist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return att;
|
return att;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute:
|
* Compute:
|
||||||
|
@ -1047,7 +985,7 @@ static void emit_degenerate_lit( struct tnl_program *p,
|
||||||
|
|
||||||
/* MAX lit, id, dots;
|
/* MAX lit, id, dots;
|
||||||
*/
|
*/
|
||||||
emit_op2(p, OPCODE_MAX, lit, WRITEMASK_XYZW, id, dots);
|
emit_op2(p, OPCODE_MAX, lit, WRITEMASK_XYZW, id, dots);
|
||||||
|
|
||||||
/* result[2] = (in > 0 ? 1 : 0)
|
/* result[2] = (in > 0 ? 1 : 0)
|
||||||
* SLT lit.z, id.z, dots; # lit.z = (0 < dots.z) ? 1 : 0
|
* SLT lit.z, id.z, dots; # lit.z = (0 < dots.z) ? 1 : 0
|
||||||
|
@ -1080,10 +1018,10 @@ static void build_lighting( struct tnl_program *p )
|
||||||
* dots.w = front.shininess
|
* dots.w = front.shininess
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (i = 0; i < MAX_LIGHTS; i++)
|
for (i = 0; i < MAX_LIGHTS; i++)
|
||||||
if (p->state->unit[i].light_enabled)
|
if (p->state->unit[i].light_enabled)
|
||||||
nr_lights++;
|
nr_lights++;
|
||||||
|
|
||||||
set_material_flags(p);
|
set_material_flags(p);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -1106,7 +1044,7 @@ static void build_lighting( struct tnl_program *p )
|
||||||
* The negation will be un-done later in the back-face code below.
|
* The negation will be un-done later in the back-face code below.
|
||||||
*/
|
*/
|
||||||
struct ureg shininess = get_material(p, 1, STATE_SHININESS);
|
struct ureg shininess = get_material(p, 1, STATE_SHININESS);
|
||||||
emit_op1(p, OPCODE_MOV, dots, WRITEMASK_Z,
|
emit_op1(p, OPCODE_MOV, dots, WRITEMASK_Z,
|
||||||
negate(swizzle1(shininess,X)));
|
negate(swizzle1(shininess,X)));
|
||||||
release_temp(p, shininess);
|
release_temp(p, shininess);
|
||||||
}
|
}
|
||||||
|
@ -1134,12 +1072,12 @@ static void build_lighting( struct tnl_program *p )
|
||||||
struct ureg res0 = register_output( p, VERT_RESULT_BFC0 );
|
struct ureg res0 = register_output( p, VERT_RESULT_BFC0 );
|
||||||
emit_op1(p, OPCODE_MOV, res0, 0, _bfc0);
|
emit_op1(p, OPCODE_MOV, res0, 0, _bfc0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (twoside && separate) {
|
if (twoside && separate) {
|
||||||
struct ureg res1 = register_output( p, VERT_RESULT_BFC1 );
|
struct ureg res1 = register_output( p, VERT_RESULT_BFC1 );
|
||||||
emit_op1(p, OPCODE_MOV, res1, 0, _bfc1);
|
emit_op1(p, OPCODE_MOV, res1, 0, _bfc1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nr_lights == 0) {
|
if (nr_lights == 0) {
|
||||||
release_temps(p);
|
release_temps(p);
|
||||||
return;
|
return;
|
||||||
|
@ -1149,16 +1087,16 @@ static void build_lighting( struct tnl_program *p )
|
||||||
if (p->state->unit[i].light_enabled) {
|
if (p->state->unit[i].light_enabled) {
|
||||||
struct ureg half = undef;
|
struct ureg half = undef;
|
||||||
struct ureg att = undef, VPpli = undef;
|
struct ureg att = undef, VPpli = undef;
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
if (p->state->unit[i].light_eyepos3_is_zero) {
|
if (p->state->unit[i].light_eyepos3_is_zero) {
|
||||||
/* Can used precomputed constants in this case.
|
/* Can used precomputed constants in this case.
|
||||||
* Attenuation never applies to infinite lights.
|
* Attenuation never applies to infinite lights.
|
||||||
*/
|
*/
|
||||||
VPpli = register_param3(p, STATE_INTERNAL,
|
VPpli = register_param3(p, STATE_INTERNAL,
|
||||||
STATE_LIGHT_POSITION_NORMALIZED, i);
|
STATE_LIGHT_POSITION_NORMALIZED, i);
|
||||||
|
|
||||||
if (!p->state->material_shininess_is_zero) {
|
if (!p->state->material_shininess_is_zero) {
|
||||||
if (p->state->light_local_viewer) {
|
if (p->state->light_local_viewer) {
|
||||||
struct ureg eye_hat = get_eye_position_normalized(p);
|
struct ureg eye_hat = get_eye_position_normalized(p);
|
||||||
|
@ -1167,22 +1105,22 @@ static void build_lighting( struct tnl_program *p )
|
||||||
emit_normalize_vec3(p, half, half);
|
emit_normalize_vec3(p, half, half);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
half = register_param3(p, STATE_INTERNAL,
|
half = register_param3(p, STATE_INTERNAL,
|
||||||
STATE_LIGHT_HALF_VECTOR, i);
|
STATE_LIGHT_HALF_VECTOR, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
struct ureg Ppli = register_param3(p, STATE_INTERNAL,
|
struct ureg Ppli = register_param3(p, STATE_INTERNAL,
|
||||||
STATE_LIGHT_POSITION, i);
|
STATE_LIGHT_POSITION, i);
|
||||||
struct ureg V = get_eye_position(p);
|
struct ureg V = get_eye_position(p);
|
||||||
struct ureg dist = get_temp(p);
|
struct ureg dist = get_temp(p);
|
||||||
|
|
||||||
VPpli = get_temp(p);
|
VPpli = get_temp(p);
|
||||||
|
|
||||||
/* Calculate VPpli vector
|
/* Calculate VPpli vector
|
||||||
*/
|
*/
|
||||||
emit_op2(p, OPCODE_SUB, VPpli, 0, Ppli, V);
|
emit_op2(p, OPCODE_SUB, VPpli, 0, Ppli, V);
|
||||||
|
|
||||||
/* Normalize VPpli. The dist value also used in
|
/* Normalize VPpli. The dist value also used in
|
||||||
* attenuation below.
|
* attenuation below.
|
||||||
|
@ -1192,7 +1130,7 @@ static void build_lighting( struct tnl_program *p )
|
||||||
emit_op2(p, OPCODE_MUL, VPpli, 0, VPpli, dist);
|
emit_op2(p, OPCODE_MUL, VPpli, 0, VPpli, dist);
|
||||||
|
|
||||||
/* Calculate attenuation:
|
/* Calculate attenuation:
|
||||||
*/
|
*/
|
||||||
if (!p->state->unit[i].light_spotcutoff_is_180 ||
|
if (!p->state->unit[i].light_spotcutoff_is_180 ||
|
||||||
p->state->unit[i].light_attenuated) {
|
p->state->unit[i].light_attenuated) {
|
||||||
att = calculate_light_attenuation(p, i, VPpli, dist);
|
att = calculate_light_attenuation(p, i, VPpli, dist);
|
||||||
|
@ -1208,7 +1146,7 @@ static void build_lighting( struct tnl_program *p )
|
||||||
emit_op2(p, OPCODE_SUB, half, 0, VPpli, eye_hat);
|
emit_op2(p, OPCODE_SUB, half, 0, VPpli, eye_hat);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
struct ureg z_dir = swizzle(get_identity_param(p),X,Y,W,Z);
|
struct ureg z_dir = swizzle(get_identity_param(p),X,Y,W,Z);
|
||||||
emit_op2(p, OPCODE_ADD, half, 0, VPpli, z_dir);
|
emit_op2(p, OPCODE_ADD, half, 0, VPpli, z_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1277,7 +1215,7 @@ static void build_lighting( struct tnl_program *p )
|
||||||
|
|
||||||
emit_op3(p, OPCODE_MAD, res0, mask0, swizzle1(lit,Y), diffuse, _col0);
|
emit_op3(p, OPCODE_MAD, res0, mask0, swizzle1(lit,Y), diffuse, _col0);
|
||||||
emit_op3(p, OPCODE_MAD, res1, mask1, swizzle1(lit,Z), specular, _col1);
|
emit_op3(p, OPCODE_MAD, res1, mask1, swizzle1(lit,Z), specular, _col1);
|
||||||
|
|
||||||
release_temp(p, ambient);
|
release_temp(p, ambient);
|
||||||
release_temp(p, diffuse);
|
release_temp(p, diffuse);
|
||||||
release_temp(p, specular);
|
release_temp(p, specular);
|
||||||
|
@ -1291,7 +1229,7 @@ static void build_lighting( struct tnl_program *p )
|
||||||
struct ureg specular = get_lightprod(p, i, 1, STATE_SPECULAR);
|
struct ureg specular = get_lightprod(p, i, 1, STATE_SPECULAR);
|
||||||
struct ureg res0, res1;
|
struct ureg res0, res1;
|
||||||
GLuint mask0, mask1;
|
GLuint mask0, mask1;
|
||||||
|
|
||||||
if (count == nr_lights) {
|
if (count == nr_lights) {
|
||||||
if (separate) {
|
if (separate) {
|
||||||
mask0 = WRITEMASK_XYZ;
|
mask0 = WRITEMASK_XYZ;
|
||||||
|
@ -1368,52 +1306,10 @@ static void build_fog( struct tnl_program *p )
|
||||||
input = swizzle1(register_input(p, VERT_ATTRIB_FOG), X);
|
input = swizzle1(register_input(p, VERT_ATTRIB_FOG), X);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->state->fog_mode && p->state->tnl_do_vertex_fog) {
|
emit_op1(p, OPCODE_ABS, fog, WRITEMASK_X, input);
|
||||||
struct ureg params = register_param2(p, STATE_INTERNAL,
|
|
||||||
STATE_FOG_PARAMS_OPTIMIZED);
|
|
||||||
struct ureg tmp = get_temp(p);
|
|
||||||
GLboolean useabs = (p->state->fog_mode != FOG_EXP2);
|
|
||||||
|
|
||||||
if (useabs) {
|
|
||||||
emit_op1(p, OPCODE_ABS, tmp, 0, input);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (p->state->fog_mode) {
|
|
||||||
case FOG_LINEAR: {
|
|
||||||
struct ureg id = get_identity_param(p);
|
|
||||||
emit_op3(p, OPCODE_MAD, tmp, 0, useabs ? tmp : input,
|
|
||||||
swizzle1(params,X), swizzle1(params,Y));
|
|
||||||
emit_op2(p, OPCODE_MAX, tmp, 0, tmp, swizzle1(id,X)); /* saturate */
|
|
||||||
emit_op2(p, OPCODE_MIN, fog, WRITEMASK_X, tmp, swizzle1(id,W));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case FOG_EXP:
|
|
||||||
emit_op2(p, OPCODE_MUL, tmp, 0, useabs ? tmp : input,
|
|
||||||
swizzle1(params,Z));
|
|
||||||
emit_op1(p, OPCODE_EX2, fog, WRITEMASK_X, negate(tmp));
|
|
||||||
break;
|
|
||||||
case FOG_EXP2:
|
|
||||||
emit_op2(p, OPCODE_MUL, tmp, 0, input, swizzle1(params,W));
|
|
||||||
emit_op2(p, OPCODE_MUL, tmp, 0, tmp, tmp);
|
|
||||||
emit_op1(p, OPCODE_EX2, fog, WRITEMASK_X, negate(tmp));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
release_temp(p, tmp);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* results = incoming fog coords (compute fog per-fragment later)
|
|
||||||
*
|
|
||||||
* KW: Is it really necessary to do anything in this case?
|
|
||||||
* BP: Yes, we always need to compute the absolute value, unless
|
|
||||||
* we want to push that down into the fragment program...
|
|
||||||
*/
|
|
||||||
GLboolean useabs = GL_TRUE;
|
|
||||||
emit_op1(p, useabs ? OPCODE_ABS : OPCODE_MOV, fog, WRITEMASK_X, input);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void build_reflect_texgen( struct tnl_program *p,
|
static void build_reflect_texgen( struct tnl_program *p,
|
||||||
struct ureg dest,
|
struct ureg dest,
|
||||||
GLuint writemask )
|
GLuint writemask )
|
||||||
|
@ -1423,9 +1319,9 @@ static void build_reflect_texgen( struct tnl_program *p,
|
||||||
struct ureg tmp = get_temp(p);
|
struct ureg tmp = get_temp(p);
|
||||||
|
|
||||||
/* n.u */
|
/* n.u */
|
||||||
emit_op2(p, OPCODE_DP3, tmp, 0, normal, eye_hat);
|
emit_op2(p, OPCODE_DP3, tmp, 0, normal, eye_hat);
|
||||||
/* 2n.u */
|
/* 2n.u */
|
||||||
emit_op2(p, OPCODE_ADD, tmp, 0, tmp, tmp);
|
emit_op2(p, OPCODE_ADD, tmp, 0, tmp, tmp);
|
||||||
/* (-2n.u)n + u */
|
/* (-2n.u)n + u */
|
||||||
emit_op3(p, OPCODE_MAD, dest, writemask, negate(tmp), normal, eye_hat);
|
emit_op3(p, OPCODE_MAD, dest, writemask, negate(tmp), normal, eye_hat);
|
||||||
|
|
||||||
|
@ -1454,22 +1350,22 @@ static void build_sphere_texgen( struct tnl_program *p,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* n.u */
|
/* n.u */
|
||||||
emit_op2(p, OPCODE_DP3, tmp, 0, normal, eye_hat);
|
emit_op2(p, OPCODE_DP3, tmp, 0, normal, eye_hat);
|
||||||
/* 2n.u */
|
/* 2n.u */
|
||||||
emit_op2(p, OPCODE_ADD, tmp, 0, tmp, tmp);
|
emit_op2(p, OPCODE_ADD, tmp, 0, tmp, tmp);
|
||||||
/* (-2n.u)n + u */
|
/* (-2n.u)n + u */
|
||||||
emit_op3(p, OPCODE_MAD, r, 0, negate(tmp), normal, eye_hat);
|
emit_op3(p, OPCODE_MAD, r, 0, negate(tmp), normal, eye_hat);
|
||||||
/* r + 0,0,1 */
|
/* r + 0,0,1 */
|
||||||
emit_op2(p, OPCODE_ADD, tmp, 0, r, swizzle(id,X,Y,W,Z));
|
emit_op2(p, OPCODE_ADD, tmp, 0, r, swizzle(id,X,Y,W,Z));
|
||||||
/* rx^2 + ry^2 + (rz+1)^2 */
|
/* rx^2 + ry^2 + (rz+1)^2 */
|
||||||
emit_op2(p, OPCODE_DP3, tmp, 0, tmp, tmp);
|
emit_op2(p, OPCODE_DP3, tmp, 0, tmp, tmp);
|
||||||
/* 2/m */
|
/* 2/m */
|
||||||
emit_op1(p, OPCODE_RSQ, tmp, 0, tmp);
|
emit_op1(p, OPCODE_RSQ, tmp, 0, tmp);
|
||||||
/* 1/m */
|
/* 1/m */
|
||||||
emit_op2(p, OPCODE_MUL, inv_m, 0, tmp, half);
|
emit_op2(p, OPCODE_MUL, inv_m, 0, tmp, half);
|
||||||
/* r/m + 1/2 */
|
/* r/m + 1/2 */
|
||||||
emit_op3(p, OPCODE_MAD, dest, writemask, r, inv_m, half);
|
emit_op3(p, OPCODE_MAD, dest, writemask, r, inv_m, half);
|
||||||
|
|
||||||
release_temp(p, tmp);
|
release_temp(p, tmp);
|
||||||
release_temp(p, r);
|
release_temp(p, r);
|
||||||
release_temp(p, inv_m);
|
release_temp(p, inv_m);
|
||||||
|
@ -1484,10 +1380,10 @@ static void build_texture_transform( struct tnl_program *p )
|
||||||
|
|
||||||
if (!(p->state->fragprog_inputs_read & FRAG_BIT_TEX(i)))
|
if (!(p->state->fragprog_inputs_read & FRAG_BIT_TEX(i)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (p->state->unit[i].texgen_enabled ||
|
if (p->state->unit[i].texgen_enabled ||
|
||||||
p->state->unit[i].texmat_enabled) {
|
p->state->unit[i].texmat_enabled) {
|
||||||
|
|
||||||
GLuint texmat_enabled = p->state->unit[i].texmat_enabled;
|
GLuint texmat_enabled = p->state->unit[i].texmat_enabled;
|
||||||
struct ureg out = register_output(p, VERT_RESULT_TEX0 + i);
|
struct ureg out = register_output(p, VERT_RESULT_TEX0 + i);
|
||||||
struct ureg out_texgen = undef;
|
struct ureg out_texgen = undef;
|
||||||
|
@ -1498,8 +1394,8 @@ static void build_texture_transform( struct tnl_program *p )
|
||||||
GLuint reflect_mask = 0;
|
GLuint reflect_mask = 0;
|
||||||
GLuint normal_mask = 0;
|
GLuint normal_mask = 0;
|
||||||
GLuint modes[4];
|
GLuint modes[4];
|
||||||
|
|
||||||
if (texmat_enabled)
|
if (texmat_enabled)
|
||||||
out_texgen = get_temp(p);
|
out_texgen = get_temp(p);
|
||||||
else
|
else
|
||||||
out_texgen = out;
|
out_texgen = out;
|
||||||
|
@ -1513,31 +1409,31 @@ static void build_texture_transform( struct tnl_program *p )
|
||||||
switch (modes[j]) {
|
switch (modes[j]) {
|
||||||
case TXG_OBJ_LINEAR: {
|
case TXG_OBJ_LINEAR: {
|
||||||
struct ureg obj = register_input(p, VERT_ATTRIB_POS);
|
struct ureg obj = register_input(p, VERT_ATTRIB_POS);
|
||||||
struct ureg plane =
|
struct ureg plane =
|
||||||
register_param3(p, STATE_TEXGEN, i,
|
register_param3(p, STATE_TEXGEN, i,
|
||||||
STATE_TEXGEN_OBJECT_S + j);
|
STATE_TEXGEN_OBJECT_S + j);
|
||||||
|
|
||||||
emit_op2(p, OPCODE_DP4, out_texgen, WRITEMASK_X << j,
|
emit_op2(p, OPCODE_DP4, out_texgen, WRITEMASK_X << j,
|
||||||
obj, plane );
|
obj, plane );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TXG_EYE_LINEAR: {
|
case TXG_EYE_LINEAR: {
|
||||||
struct ureg eye = get_eye_position(p);
|
struct ureg eye = get_eye_position(p);
|
||||||
struct ureg plane =
|
struct ureg plane =
|
||||||
register_param3(p, STATE_TEXGEN, i,
|
register_param3(p, STATE_TEXGEN, i,
|
||||||
STATE_TEXGEN_EYE_S + j);
|
STATE_TEXGEN_EYE_S + j);
|
||||||
|
|
||||||
emit_op2(p, OPCODE_DP4, out_texgen, WRITEMASK_X << j,
|
emit_op2(p, OPCODE_DP4, out_texgen, WRITEMASK_X << j,
|
||||||
eye, plane );
|
eye, plane );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TXG_SPHERE_MAP:
|
case TXG_SPHERE_MAP:
|
||||||
sphere_mask |= WRITEMASK_X << j;
|
sphere_mask |= WRITEMASK_X << j;
|
||||||
break;
|
break;
|
||||||
case TXG_REFLECTION_MAP:
|
case TXG_REFLECTION_MAP:
|
||||||
reflect_mask |= WRITEMASK_X << j;
|
reflect_mask |= WRITEMASK_X << j;
|
||||||
break;
|
break;
|
||||||
case TXG_NORMAL_MAP:
|
case TXG_NORMAL_MAP:
|
||||||
normal_mask |= WRITEMASK_X << j;
|
normal_mask |= WRITEMASK_X << j;
|
||||||
break;
|
break;
|
||||||
case TXG_NONE:
|
case TXG_NONE:
|
||||||
|
@ -1566,8 +1462,8 @@ static void build_texture_transform( struct tnl_program *p )
|
||||||
|
|
||||||
if (texmat_enabled) {
|
if (texmat_enabled) {
|
||||||
struct ureg texmat[4];
|
struct ureg texmat[4];
|
||||||
struct ureg in = (!is_undef(out_texgen) ?
|
struct ureg in = (!is_undef(out_texgen) ?
|
||||||
out_texgen :
|
out_texgen :
|
||||||
register_input(p, VERT_ATTRIB_TEX0+i));
|
register_input(p, VERT_ATTRIB_TEX0+i));
|
||||||
if (p->mvp_with_dp4) {
|
if (p->mvp_with_dp4) {
|
||||||
register_matrix_param5( p, STATE_TEXTURE_MATRIX, i, 0, 3,
|
register_matrix_param5( p, STATE_TEXTURE_MATRIX, i, 0, 3,
|
||||||
|
@ -1628,17 +1524,6 @@ static void build_atten_pointsize( struct tnl_program *p )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Emit constant point size.
|
|
||||||
*/
|
|
||||||
static void build_constant_pointsize( struct tnl_program *p )
|
|
||||||
{
|
|
||||||
struct ureg state_size = register_param1(p, STATE_POINT_SIZE);
|
|
||||||
struct ureg out = register_output(p, VERT_RESULT_PSIZ);
|
|
||||||
emit_op1(p, OPCODE_MOV, out, WRITEMASK_X, state_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pass-though per-vertex point size, from user's point size array.
|
* Pass-though per-vertex point size, from user's point size array.
|
||||||
*/
|
*/
|
||||||
|
@ -1670,8 +1555,7 @@ static void build_tnl_program( struct tnl_program *p )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((p->state->fragprog_inputs_read & FRAG_BIT_FOGC) ||
|
if (p->state->fragprog_inputs_read & FRAG_BIT_FOGC)
|
||||||
p->state->fog_mode != FOG_NONE)
|
|
||||||
build_fog(p);
|
build_fog(p);
|
||||||
|
|
||||||
if (p->state->fragprog_inputs_read & FRAG_BITS_TEX_ANY)
|
if (p->state->fragprog_inputs_read & FRAG_BITS_TEX_ANY)
|
||||||
|
@ -1681,12 +1565,6 @@ static void build_tnl_program( struct tnl_program *p )
|
||||||
build_atten_pointsize(p);
|
build_atten_pointsize(p);
|
||||||
else if (p->state->point_array)
|
else if (p->state->point_array)
|
||||||
build_array_pointsize(p);
|
build_array_pointsize(p);
|
||||||
#if 0
|
|
||||||
else
|
|
||||||
build_constant_pointsize(p);
|
|
||||||
#else
|
|
||||||
(void) build_constant_pointsize;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Finish up:
|
/* Finish up:
|
||||||
*/
|
*/
|
||||||
|
@ -1718,7 +1596,7 @@ create_new_program( const struct state_key *key,
|
||||||
p.identity = undef;
|
p.identity = undef;
|
||||||
p.temp_in_use = 0;
|
p.temp_in_use = 0;
|
||||||
p.mvp_with_dp4 = mvp_with_dp4;
|
p.mvp_with_dp4 = mvp_with_dp4;
|
||||||
|
|
||||||
if (max_temps >= sizeof(int) * 8)
|
if (max_temps >= sizeof(int) * 8)
|
||||||
p.temp_reserved = 0;
|
p.temp_reserved = 0;
|
||||||
else
|
else
|
||||||
|
@ -1761,14 +1639,14 @@ _mesa_get_fixed_func_vertex_program(GLcontext *ctx)
|
||||||
*/
|
*/
|
||||||
prog = (struct gl_vertex_program *)
|
prog = (struct gl_vertex_program *)
|
||||||
_mesa_search_program_cache(ctx->VertexProgram.Cache, &key, sizeof(key));
|
_mesa_search_program_cache(ctx->VertexProgram.Cache, &key, sizeof(key));
|
||||||
|
|
||||||
if (!prog) {
|
if (!prog) {
|
||||||
/* OK, we'll have to build a new one */
|
/* OK, we'll have to build a new one */
|
||||||
if (0)
|
if (0)
|
||||||
_mesa_printf("Build new TNL program\n");
|
_mesa_printf("Build new TNL program\n");
|
||||||
|
|
||||||
prog = (struct gl_vertex_program *)
|
prog = (struct gl_vertex_program *)
|
||||||
ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0);
|
ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0);
|
||||||
if (!prog)
|
if (!prog)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -1778,7 +1656,7 @@ _mesa_get_fixed_func_vertex_program(GLcontext *ctx)
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (ctx->Driver.ProgramStringNotify)
|
if (ctx->Driver.ProgramStringNotify)
|
||||||
ctx->Driver.ProgramStringNotify( ctx, GL_VERTEX_PROGRAM_ARB,
|
ctx->Driver.ProgramStringNotify( ctx, GL_VERTEX_PROGRAM_ARB,
|
||||||
&prog->Base );
|
&prog->Base );
|
||||||
#endif
|
#endif
|
||||||
_mesa_program_cache_insert(ctx, ctx->VertexProgram.Cache,
|
_mesa_program_cache_insert(ctx, ctx->VertexProgram.Cache,
|
||||||
|
|
|
@ -2834,6 +2834,13 @@ struct gl_dlist_state
|
||||||
|
|
||||||
GLubyte ActiveEdgeFlag;
|
GLubyte ActiveEdgeFlag;
|
||||||
GLboolean CurrentEdgeFlag;
|
GLboolean CurrentEdgeFlag;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
/* State known to have been set by the currently-compiling display
|
||||||
|
* list. Used to eliminate some redundant state changes.
|
||||||
|
*/
|
||||||
|
GLenum ShadeModel;
|
||||||
|
} Current;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3973,6 +3973,13 @@ _mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target,
|
||||||
|
|
||||||
if (program->FogOption)
|
if (program->FogOption)
|
||||||
program->Base.InputsRead |= FRAG_BIT_FOGC;
|
program->Base.InputsRead |= FRAG_BIT_FOGC;
|
||||||
|
|
||||||
|
/* XXX: assume that ARB fragment programs don't have access to the
|
||||||
|
* FrontFacing and PointCoord values stuffed into the fog
|
||||||
|
* coordinate in GLSL shaders.
|
||||||
|
*/
|
||||||
|
if (program->Base.InputsRead & FRAG_BIT_FOGC)
|
||||||
|
program->UsesFogFragCoord = GL_TRUE;
|
||||||
|
|
||||||
if (program->Base.Instructions)
|
if (program->Base.Instructions)
|
||||||
_mesa_free(program->Base.Instructions);
|
_mesa_free(program->Base.Instructions);
|
||||||
|
|
|
@ -396,6 +396,7 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog)
|
||||||
fprog->Base.Instructions = newInst;
|
fprog->Base.Instructions = newInst;
|
||||||
fprog->Base.NumInstructions = inst - newInst;
|
fprog->Base.NumInstructions = inst - newInst;
|
||||||
fprog->Base.InputsRead |= FRAG_BIT_FOGC;
|
fprog->Base.InputsRead |= FRAG_BIT_FOGC;
|
||||||
|
fprog->UsesFogFragCoord = GL_TRUE;
|
||||||
/* XXX do this? fprog->FogOption = GL_NONE; */
|
/* XXX do this? fprog->FogOption = GL_NONE; */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ lookup_statevar(const char *var, GLint index1, GLint index2, const char *field,
|
||||||
{ "gl_TextureMatrixTranspose", STATE_TEXTURE_MATRIX, 0 },
|
{ "gl_TextureMatrixTranspose", STATE_TEXTURE_MATRIX, 0 },
|
||||||
{ "gl_TextureMatrixInverseTranspose", STATE_TEXTURE_MATRIX, STATE_MATRIX_INVERSE },
|
{ "gl_TextureMatrixInverseTranspose", STATE_TEXTURE_MATRIX, STATE_MATRIX_INVERSE },
|
||||||
|
|
||||||
{ "gl_NormalMatrix", STATE_MODELVIEW_MATRIX, STATE_MATRIX_TRANSPOSE },
|
{ "gl_NormalMatrix", STATE_MODELVIEW_MATRIX, STATE_MATRIX_INVERSE },
|
||||||
|
|
||||||
{ NULL, 0, 0 }
|
{ NULL, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
|
@ -148,6 +148,8 @@ update_framebuffer_state( struct st_context *st )
|
||||||
assert(strb->surface);
|
assert(strb->surface);
|
||||||
pipe_surface_reference(&framebuffer->zsbuf, strb->surface);
|
pipe_surface_reference(&framebuffer->zsbuf, strb->surface);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
pipe_surface_reference(&framebuffer->zsbuf, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
cso_set_framebuffer(st->cso_context, framebuffer);
|
cso_set_framebuffer(st->cso_context, framebuffer);
|
||||||
|
|
|
@ -137,8 +137,23 @@ find_translated_vp(struct st_context *st,
|
||||||
|
|
||||||
for (inAttr = 0; inAttr < FRAG_ATTRIB_MAX; inAttr++) {
|
for (inAttr = 0; inAttr < FRAG_ATTRIB_MAX; inAttr++) {
|
||||||
if (fragInputsRead & (1 << inAttr)) {
|
if (fragInputsRead & (1 << inAttr)) {
|
||||||
stfp->input_to_slot[inAttr] = numIn;
|
if ((fragInputsRead & FRAG_BIT_FOGC)) {
|
||||||
numIn++;
|
if (stfp->Base.UsesPointCoord) {
|
||||||
|
stfp->input_to_slot[inAttr] = numIn;
|
||||||
|
numIn++;
|
||||||
|
}
|
||||||
|
if (stfp->Base.UsesFrontFacing) {
|
||||||
|
stfp->input_to_slot[inAttr] = numIn;
|
||||||
|
numIn++;
|
||||||
|
}
|
||||||
|
if (stfp->Base.UsesFogFragCoord) {
|
||||||
|
stfp->input_to_slot[inAttr] = numIn;
|
||||||
|
numIn++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
stfp->input_to_slot[inAttr] = numIn;
|
||||||
|
numIn++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
stfp->input_to_slot[inAttr] = UNUSED;
|
stfp->input_to_slot[inAttr] = UNUSED;
|
||||||
|
|
|
@ -335,7 +335,9 @@ guess_and_alloc_texture(struct st_context *st,
|
||||||
* pagetable arrangements.
|
* pagetable arrangements.
|
||||||
*/
|
*/
|
||||||
if ((stObj->base.MinFilter == GL_NEAREST ||
|
if ((stObj->base.MinFilter == GL_NEAREST ||
|
||||||
stObj->base.MinFilter == GL_LINEAR) &&
|
stObj->base.MinFilter == GL_LINEAR ||
|
||||||
|
stImage->base._BaseFormat == GL_DEPTH_COMPONENT ||
|
||||||
|
stImage->base._BaseFormat == GL_DEPTH_STENCIL_EXT) &&
|
||||||
stImage->level == firstLevel) {
|
stImage->level == firstLevel) {
|
||||||
lastLevel = firstLevel;
|
lastLevel = firstLevel;
|
||||||
}
|
}
|
||||||
|
@ -1169,6 +1171,88 @@ st_TexSubImage1D(GLcontext *ctx, GLenum target, GLint level,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
st_CompressedTexSubImage1D(GLcontext *ctx, GLenum target, GLint level,
|
||||||
|
GLint xoffset, GLsizei width,
|
||||||
|
GLenum format,
|
||||||
|
GLsizei imageSize, const GLvoid *data,
|
||||||
|
struct gl_texture_object *texObj,
|
||||||
|
struct gl_texture_image *texImage)
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
st_CompressedTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
|
||||||
|
GLint xoffset, GLint yoffset,
|
||||||
|
GLsizei width, GLint height,
|
||||||
|
GLenum format,
|
||||||
|
GLsizei imageSize, const GLvoid *data,
|
||||||
|
struct gl_texture_object *texObj,
|
||||||
|
struct gl_texture_image *texImage)
|
||||||
|
{
|
||||||
|
struct st_texture_image *stImage = st_texture_image(texImage);
|
||||||
|
struct pipe_format_block block;
|
||||||
|
int srcBlockStride;
|
||||||
|
int dstBlockStride;
|
||||||
|
int y;
|
||||||
|
|
||||||
|
if (stImage->pt) {
|
||||||
|
st_teximage_flush_before_map(ctx->st, stImage->pt, 0, level,
|
||||||
|
PIPE_TRANSFER_WRITE);
|
||||||
|
texImage->Data = st_texture_image_map(ctx->st, stImage, 0,
|
||||||
|
PIPE_TRANSFER_WRITE,
|
||||||
|
xoffset, yoffset,
|
||||||
|
width, height);
|
||||||
|
|
||||||
|
block = stImage->pt->block;
|
||||||
|
srcBlockStride = pf_get_stride(&block, width);
|
||||||
|
dstBlockStride = stImage->transfer->stride;
|
||||||
|
} else {
|
||||||
|
assert(stImage->pt);
|
||||||
|
/* TODO find good values for block and strides */
|
||||||
|
/* TODO also adjust texImage->data for yoffset/xoffset */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!texImage->Data) {
|
||||||
|
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(xoffset % block.width == 0);
|
||||||
|
assert(yoffset % block.height == 0);
|
||||||
|
assert(width % block.width == 0);
|
||||||
|
assert(height % block.height == 0);
|
||||||
|
|
||||||
|
for (y = 0; y < height; y += block.height) {
|
||||||
|
/* don't need to adjust for xoffset and yoffset as st_texture_image_map does that */
|
||||||
|
const char *src = (const char*)data + srcBlockStride * pf_get_nblocksy(&block, y);
|
||||||
|
char *dst = (char*)texImage->Data + dstBlockStride * pf_get_nblocksy(&block, y);
|
||||||
|
memcpy(dst, src, pf_get_stride(&block, width));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stImage->pt) {
|
||||||
|
st_texture_image_unmap(ctx->st, stImage);
|
||||||
|
texImage->Data = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
st_CompressedTexSubImage3D(GLcontext *ctx, GLenum target, GLint level,
|
||||||
|
GLint xoffset, GLint yoffset, GLint zoffset,
|
||||||
|
GLsizei width, GLint height, GLint depth,
|
||||||
|
GLenum format,
|
||||||
|
GLsizei imageSize, const GLvoid *data,
|
||||||
|
struct gl_texture_object *texObj,
|
||||||
|
struct gl_texture_image *texImage)
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do a CopyTexSubImage operation using a read transfer from the source,
|
* Do a CopyTexSubImage operation using a read transfer from the source,
|
||||||
|
@ -1818,6 +1902,9 @@ st_init_texture_functions(struct dd_function_table *functions)
|
||||||
functions->TexSubImage1D = st_TexSubImage1D;
|
functions->TexSubImage1D = st_TexSubImage1D;
|
||||||
functions->TexSubImage2D = st_TexSubImage2D;
|
functions->TexSubImage2D = st_TexSubImage2D;
|
||||||
functions->TexSubImage3D = st_TexSubImage3D;
|
functions->TexSubImage3D = st_TexSubImage3D;
|
||||||
|
functions->CompressedTexSubImage1D = st_CompressedTexSubImage1D;
|
||||||
|
functions->CompressedTexSubImage2D = st_CompressedTexSubImage2D;
|
||||||
|
functions->CompressedTexSubImage3D = st_CompressedTexSubImage3D;
|
||||||
functions->CopyTexImage1D = st_CopyTexImage1D;
|
functions->CopyTexImage1D = st_CopyTexImage1D;
|
||||||
functions->CopyTexImage2D = st_CopyTexImage2D;
|
functions->CopyTexImage2D = st_CopyTexImage2D;
|
||||||
functions->CopyTexSubImage1D = st_CopyTexSubImage1D;
|
functions->CopyTexSubImage1D = st_CopyTexSubImage1D;
|
||||||
|
|
|
@ -101,8 +101,10 @@ map_register_file(
|
||||||
*/
|
*/
|
||||||
static GLuint
|
static GLuint
|
||||||
map_register_file_index(
|
map_register_file_index(
|
||||||
|
GLuint procType,
|
||||||
GLuint file,
|
GLuint file,
|
||||||
GLuint index,
|
GLuint index,
|
||||||
|
GLuint *swizzle,
|
||||||
const GLuint inputMapping[],
|
const GLuint inputMapping[],
|
||||||
const GLuint outputMapping[],
|
const GLuint outputMapping[],
|
||||||
const GLuint immediateMapping[],
|
const GLuint immediateMapping[],
|
||||||
|
@ -110,6 +112,20 @@ map_register_file_index(
|
||||||
{
|
{
|
||||||
switch( file ) {
|
switch( file ) {
|
||||||
case TGSI_FILE_INPUT:
|
case TGSI_FILE_INPUT:
|
||||||
|
if (procType == TGSI_PROCESSOR_FRAGMENT &&
|
||||||
|
index == FRAG_ATTRIB_FOGC) {
|
||||||
|
if (GET_SWZ(*swizzle, 0) == SWIZZLE_X) {
|
||||||
|
/* do nothing we're, ok */
|
||||||
|
} else if (GET_SWZ(*swizzle, 0) == SWIZZLE_Y) {
|
||||||
|
/* replace the swizzle with xxxx */
|
||||||
|
*swizzle = MAKE_SWIZZLE4(SWIZZLE_X,
|
||||||
|
SWIZZLE_X,
|
||||||
|
SWIZZLE_X,
|
||||||
|
SWIZZLE_X);
|
||||||
|
} else {
|
||||||
|
/* fixme: point coord */
|
||||||
|
}
|
||||||
|
}
|
||||||
/* inputs are mapped according to the user-defined map */
|
/* inputs are mapped according to the user-defined map */
|
||||||
return inputMapping[index];
|
return inputMapping[index];
|
||||||
|
|
||||||
|
@ -236,8 +252,10 @@ compile_instruction(
|
||||||
fulldst = &fullinst->FullDstRegisters[0];
|
fulldst = &fullinst->FullDstRegisters[0];
|
||||||
fulldst->DstRegister.File = map_register_file( inst->DstReg.File, 0, NULL, GL_FALSE );
|
fulldst->DstRegister.File = map_register_file( inst->DstReg.File, 0, NULL, GL_FALSE );
|
||||||
fulldst->DstRegister.Index = map_register_file_index(
|
fulldst->DstRegister.Index = map_register_file_index(
|
||||||
|
procType,
|
||||||
fulldst->DstRegister.File,
|
fulldst->DstRegister.File,
|
||||||
inst->DstReg.Index,
|
inst->DstReg.Index,
|
||||||
|
NULL,
|
||||||
inputMapping,
|
inputMapping,
|
||||||
outputMapping,
|
outputMapping,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -246,6 +264,7 @@ compile_instruction(
|
||||||
|
|
||||||
for (i = 0; i < fullinst->Instruction.NumSrcRegs; i++) {
|
for (i = 0; i < fullinst->Instruction.NumSrcRegs; i++) {
|
||||||
GLuint j;
|
GLuint j;
|
||||||
|
GLuint swizzle = inst->SrcReg[i].Swizzle;
|
||||||
|
|
||||||
fullsrc = &fullinst->FullSrcRegisters[i];
|
fullsrc = &fullinst->FullSrcRegisters[i];
|
||||||
|
|
||||||
|
@ -264,8 +283,10 @@ compile_instruction(
|
||||||
immediateMapping,
|
immediateMapping,
|
||||||
indirectAccess );
|
indirectAccess );
|
||||||
fullsrc->SrcRegister.Index = map_register_file_index(
|
fullsrc->SrcRegister.Index = map_register_file_index(
|
||||||
|
procType,
|
||||||
fullsrc->SrcRegister.File,
|
fullsrc->SrcRegister.File,
|
||||||
inst->SrcReg[i].Index,
|
inst->SrcReg[i].Index,
|
||||||
|
&swizzle,
|
||||||
inputMapping,
|
inputMapping,
|
||||||
outputMapping,
|
outputMapping,
|
||||||
immediateMapping,
|
immediateMapping,
|
||||||
|
@ -278,7 +299,7 @@ compile_instruction(
|
||||||
GLboolean extended = (inst->SrcReg[i].Negate != NEGATE_NONE &&
|
GLboolean extended = (inst->SrcReg[i].Negate != NEGATE_NONE &&
|
||||||
inst->SrcReg[i].Negate != NEGATE_XYZW);
|
inst->SrcReg[i].Negate != NEGATE_XYZW);
|
||||||
for( j = 0; j < 4; j++ ) {
|
for( j = 0; j < 4; j++ ) {
|
||||||
swz[j] = GET_SWZ( inst->SrcReg[i].Swizzle, j );
|
swz[j] = GET_SWZ( swizzle, j );
|
||||||
if (swz[j] > SWIZZLE_W)
|
if (swz[j] > SWIZZLE_W)
|
||||||
extended = GL_TRUE;
|
extended = GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -457,11 +457,16 @@ st_translate_fragment_program(struct st_context *st,
|
||||||
if (stfp->Base.UsesPointCoord) {
|
if (stfp->Base.UsesPointCoord) {
|
||||||
stfp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
|
stfp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
|
||||||
stfp->input_semantic_index[slot] = num_generic++;
|
stfp->input_semantic_index[slot] = num_generic++;
|
||||||
|
interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
|
||||||
|
} else if (stfp->Base.UsesFrontFacing) {
|
||||||
|
stfp->input_semantic_name[slot] = TGSI_SEMANTIC_FACE;
|
||||||
|
stfp->input_semantic_index[slot] = 0;
|
||||||
|
interpMode[slot] = TGSI_INTERPOLATE_CONSTANT;
|
||||||
} else {
|
} else {
|
||||||
stfp->input_semantic_name[slot] = TGSI_SEMANTIC_FOG;
|
stfp->input_semantic_name[slot] = TGSI_SEMANTIC_FOG;
|
||||||
stfp->input_semantic_index[slot] = 0;
|
stfp->input_semantic_index[slot] = 0;
|
||||||
|
interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
|
||||||
}
|
}
|
||||||
interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
|
|
||||||
break;
|
break;
|
||||||
case FRAG_ATTRIB_TEX0:
|
case FRAG_ATTRIB_TEX0:
|
||||||
case FRAG_ATTRIB_TEX1:
|
case FRAG_ATTRIB_TEX1:
|
||||||
|
|
|
@ -51,7 +51,7 @@ vbo_exec_debug_verts( struct vbo_exec_context *exec )
|
||||||
struct _mesa_prim *prim = &exec->vtx.prim[i];
|
struct _mesa_prim *prim = &exec->vtx.prim[i];
|
||||||
_mesa_printf(" prim %d: %s%s %d..%d %s %s\n",
|
_mesa_printf(" prim %d: %s%s %d..%d %s %s\n",
|
||||||
i,
|
i,
|
||||||
_mesa_lookup_enum_by_nr(prim->mode),
|
_mesa_lookup_prim_by_nr(prim->mode),
|
||||||
prim->weak ? " (weak)" : "",
|
prim->weak ? " (weak)" : "",
|
||||||
prim->start,
|
prim->start,
|
||||||
prim->start + prim->count,
|
prim->start + prim->count,
|
||||||
|
|
|
@ -667,19 +667,33 @@ do { \
|
||||||
* -- Flush current buffer
|
* -- Flush current buffer
|
||||||
* -- Fallback to opcodes for the rest of the begin/end object.
|
* -- Fallback to opcodes for the rest of the begin/end object.
|
||||||
*/
|
*/
|
||||||
#define DO_FALLBACK(ctx) \
|
static void DO_FALLBACK( GLcontext *ctx )
|
||||||
do { \
|
{
|
||||||
struct vbo_save_context *save = &vbo_context(ctx)->save; \
|
struct vbo_save_context *save = &vbo_context(ctx)->save;
|
||||||
\
|
|
||||||
if (save->vert_count || save->prim_count) \
|
if (save->vert_count || save->prim_count) {
|
||||||
_save_compile_vertex_list( ctx ); \
|
GLint i = save->prim_count - 1;
|
||||||
\
|
|
||||||
_save_copy_to_current( ctx ); \
|
/* Close off in-progress primitive.
|
||||||
_save_reset_vertex( ctx ); \
|
*/
|
||||||
_save_reset_counters( ctx ); \
|
save->prim[i].count = (save->vert_count -
|
||||||
_mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt ); \
|
save->prim[i].start);
|
||||||
ctx->Driver.SaveNeedFlush = 0; \
|
|
||||||
} while (0)
|
/* Need to replay this display list with loopback,
|
||||||
|
* unfortunately, otherwise this primitive won't be handled
|
||||||
|
* properly:
|
||||||
|
*/
|
||||||
|
save->dangling_attr_ref = 1;
|
||||||
|
|
||||||
|
_save_compile_vertex_list( ctx );
|
||||||
|
}
|
||||||
|
|
||||||
|
_save_copy_to_current( ctx );
|
||||||
|
_save_reset_vertex( ctx );
|
||||||
|
_save_reset_counters( ctx );
|
||||||
|
_mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt );
|
||||||
|
ctx->Driver.SaveNeedFlush = 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void GLAPIENTRY _save_EvalCoord1f( GLfloat u )
|
static void GLAPIENTRY _save_EvalCoord1f( GLfloat u )
|
||||||
{
|
{
|
||||||
|
@ -1146,14 +1160,14 @@ static void vbo_print_vertex_list( GLcontext *ctx, void *data )
|
||||||
|
|
||||||
for (i = 0 ; i < node->prim_count ; i++) {
|
for (i = 0 ; i < node->prim_count ; i++) {
|
||||||
struct _mesa_prim *prim = &node->prim[i];
|
struct _mesa_prim *prim = &node->prim[i];
|
||||||
_mesa_printf(" prim %d: %s%s %d..%d %s %s\n",
|
_mesa_debug(NULL, " prim %d: %s%s %d..%d %s %s\n",
|
||||||
i,
|
i,
|
||||||
_mesa_lookup_enum_by_nr(prim->mode),
|
_mesa_lookup_prim_by_nr(prim->mode),
|
||||||
prim->weak ? " (weak)" : "",
|
prim->weak ? " (weak)" : "",
|
||||||
prim->start,
|
prim->start,
|
||||||
prim->start + prim->count,
|
prim->start + prim->count,
|
||||||
(prim->begin) ? "BEGIN" : "(wrap)",
|
(prim->begin) ? "BEGIN" : "(wrap)",
|
||||||
(prim->end) ? "END" : "(wrap)");
|
(prim->end) ? "END" : "(wrap)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ static void loopback_prim( GLcontext *ctx,
|
||||||
|
|
||||||
if (0)
|
if (0)
|
||||||
_mesa_printf("loopback prim %s(%s,%s) verts %d..%d\n",
|
_mesa_printf("loopback prim %s(%s,%s) verts %d..%d\n",
|
||||||
_mesa_lookup_enum_by_nr(prim->mode),
|
_mesa_lookup_prim_by_nr(prim->mode),
|
||||||
prim->begin ? "begin" : "..",
|
prim->begin ? "begin" : "..",
|
||||||
prim->end ? "end" : "..",
|
prim->end ? "end" : "..",
|
||||||
start,
|
start,
|
||||||
|
|
|
@ -219,7 +219,7 @@ begin( struct copy_context *copy, GLenum mode, GLboolean begin_flag )
|
||||||
{
|
{
|
||||||
struct _mesa_prim *prim = ©->dstprim[copy->dstprim_nr];
|
struct _mesa_prim *prim = ©->dstprim[copy->dstprim_nr];
|
||||||
|
|
||||||
/* _mesa_printf("begin %s (%d)\n", _mesa_lookup_enum_by_nr(mode), begin_flag); */
|
/* _mesa_printf("begin %s (%d)\n", _mesa_lookup_prim_by_nr(mode), begin_flag); */
|
||||||
|
|
||||||
prim->mode = mode;
|
prim->mode = mode;
|
||||||
prim->begin = begin_flag;
|
prim->begin = begin_flag;
|
||||||
|
|
Loading…
Reference in New Issue