Merge branch 'vbo-0.2'

Conflicts:

	src/mesa/main/texcompress_s3tc.c
	src/mesa/tnl/t_array_api.c
This commit is contained in:
Keith Whitwell 2007-02-02 12:26:10 +00:00
commit b59657ad96
170 changed files with 5425 additions and 17873 deletions

View file

@ -40,11 +40,16 @@ SOURCES = \
quad-tex-2d.c \
quad-tex-pbo.c \
quad-tex-3d.c \
quad-tex-dep.c \
quad.c \
quads.c \
quadstrip.c \
quadstrip-flat.c \
dlist-edgeflag.c \
dlist-dangling.c \
dlist-edgeflag-dangling.c \
drawrange.c \
drawelements.c \
drawarrays.c \
tri-blend.c \
tri-tex-3d.c \
tri-clip.c \
@ -61,6 +66,9 @@ SOURCES = \
tri.c \
tristrip-clip.c \
tristrip.c \
vbo-drawrange.c \
vbo-drawelements.c \
vbo-drawarrays.c \
vp-clip.c \
vp-tri.c \
vp-line-clip.c \

View file

@ -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;
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));
glClearColor(0.0, 0.0, 1.0, 0.0);
list = glGenLists(1);
glNewList(list, GL_COMPILE);
glBegin(GL_TRIANGLES);
glVertex3f( 0.9, -0.9, -30.0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(.8,0,0);
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);
glColor3f(0,.9,0);
glCallList(list);
glRotatef(45,0,0,1);
glColor3f(1,0,1);
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;
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

View file

@ -0,0 +1,152 @@
/*
* 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));
glClearColor(0.0, 0.0, 1.0, 0.0);
glPolygonMode(GL_FRONT, GL_LINE);
glPolygonMode(GL_BACK, GL_POINT);
list = glGenLists(1);
glNewList(list, GL_COMPILE);
glBegin(GL_TRIANGLES);
glVertex3f( 0.9, -0.9, -30.0);
glEdgeFlag(1);
glVertex3f( 0.9, 0.9, -30.0);
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);
glColor3f(0,.9,0);
glEdgeFlag(0);
glCallList(list);
glRotatef(45,0,0,1);
glColor3f(1,0,1);
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;
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

View file

@ -0,0 +1,156 @@
/*
* 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));
glClearColor(0.0, 0.0, 1.0, 0.0);
glPolygonMode(GL_FRONT, GL_LINE);
glPolygonMode(GL_BACK, GL_POINT);
list = glGenLists(1);
glNewList(list, GL_COMPILE);
glBegin(GL_TRIANGLES);
glEdgeFlag(1);
/* glColor3f(0,0,.7); */
glVertex3f( 0.9, -0.9, -30.0);
glEdgeFlag(0);
/* glColor3f(.8,0,0); */
glVertex3f( 0.9, 0.9, -30.0);
glEdgeFlag(1);
/* glColor3f(0,.9,0); */
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);
glColor3f(0,.9,0);
glCallList(list);
glRotatef(45,0,0,1);
glColor3f(1,0,1);
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;
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

127
progs/trivial/drawarrays.c Normal file
View file

@ -0,0 +1,127 @@
/* Basic VBO */
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
struct {
GLfloat pos[3];
GLubyte color[4];
} verts[] =
{
{ { 0.9, -0.9, 0.0 },
{ 0x00, 0x00, 0xff, 0x00 }
},
{ { 0.9, 0.9, 0.0 },
{ 0x00, 0xff, 0x00, 0x00 }
},
{ { -0.9, 0.9, 0.0 },
{ 0xff, 0x00, 0x00, 0x00 }
},
{ { -0.9, -0.9, 0.0 },
{ 0xff, 0xff, 0xff, 0x00 }
},
};
static void Init( void )
{
GLint errno;
GLuint prognum;
static const char *prog1 =
"!!ARBvp1.0\n"
"MOV result.color, vertex.color;\n"
"MOV result.position, vertex.position;\n"
"END\n";
glGenProgramsARB(1, &prognum);
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum);
glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(prog1), (const GLubyte *) prog1);
assert(glIsProgramARB(prognum));
errno = glGetError();
printf("glGetError = %d\n", errno);
if (errno != GL_NO_ERROR)
{
GLint errorpos;
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos);
printf("errorpos: %d\n", errorpos);
printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB));
}
glEnableClientState( GL_VERTEX_ARRAY );
glEnableClientState( GL_COLOR_ARRAY );
glVertexPointer( 3, GL_FLOAT, sizeof(verts[0]), verts[0].pos );
glColorPointer( 4, GL_UNSIGNED_BYTE, sizeof(verts[0]), verts[0].color );
}
static void Display( void )
{
glClearColor(0.3, 0.3, 0.3, 1);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glEnable(GL_VERTEX_PROGRAM_ARB);
// glDrawArrays( GL_TRIANGLES, 0, 3 );
glDrawArrays( GL_TRIANGLES, 1, 3 );
glFlush();
}
static void Reshape( int width, int height )
{
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
/*glTranslatef( 0.0, 0.0, -15.0 );*/
}
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
int main( int argc, char *argv[] )
{
glutInit( &argc, argv );
glutInitWindowPosition( 0, 0 );
glutInitWindowSize( 250, 250 );
glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH );
glutCreateWindow(argv[0]);
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutDisplayFunc( Display );
Init();
glutMainLoop();
return 0;
}

View file

@ -0,0 +1,120 @@
/* Test rebasing */
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
GLfloat verts[][4] = {
{ 0.9, -0.9, 0.0, 1.0 },
{ 0.9, 0.9, 0.0, 1.0 },
{ -0.9, 0.9, 0.0, 1.0 },
{ -0.9, -0.9, 0.0, 1.0 },
};
GLubyte color[][4] = {
{ 0x00, 0x00, 0xff, 0x00 },
{ 0x00, 0xff, 0x00, 0x00 },
{ 0xff, 0x00, 0x00, 0x00 },
{ 0xff, 0xff, 0xff, 0x00 },
};
GLuint indices[] = { 1, 2, 3 };
static void Init( void )
{
GLint errno;
GLuint prognum;
static const char *prog1 =
"!!ARBvp1.0\n"
"MOV result.color, vertex.color;\n"
"MOV result.position, vertex.position;\n"
"END\n";
glGenProgramsARB(1, &prognum);
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum);
glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(prog1), (const GLubyte *) prog1);
assert(glIsProgramARB(prognum));
errno = glGetError();
printf("glGetError = %d\n", errno);
if (errno != GL_NO_ERROR)
{
GLint errorpos;
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos);
printf("errorpos: %d\n", errorpos);
printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB));
}
glEnableClientState( GL_VERTEX_ARRAY );
glEnableClientState( GL_COLOR_ARRAY );
glVertexPointer( 3, GL_FLOAT, sizeof(verts[0]), verts );
glColorPointer( 4, GL_UNSIGNED_BYTE, 0, color );
}
static void Display( void )
{
glClearColor(0.3, 0.3, 0.3, 1);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glEnable(GL_VERTEX_PROGRAM_NV);
/* Should have min_index == 1, maybe force a rebase:
*/
glDrawElements( GL_TRIANGLES, 3, GL_UNSIGNED_INT, indices );
glFlush();
}
static void Reshape( int width, int height )
{
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
/*glTranslatef( 0.0, 0.0, -15.0 );*/
}
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
int main( int argc, char *argv[] )
{
glutInit( &argc, argv );
glutInitWindowPosition( 0, 0 );
glutInitWindowSize( 250, 250 );
glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH );
glutCreateWindow(argv[0]);
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutDisplayFunc( Display );
Init();
glutMainLoop();
return 0;
}

118
progs/trivial/drawrange.c Normal file
View file

@ -0,0 +1,118 @@
/* Test rebasing */
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
GLfloat verts[][4] = {
{ 0.9, -0.9, 0.0, 1.0 },
{ 0.9, 0.9, 0.0, 1.0 },
{ -0.9, 0.9, 0.0, 1.0 },
{ -0.9, -0.9, 0.0, 1.0 },
};
GLubyte color[][4] = {
{ 0x00, 0x00, 0xff, 0x00 },
{ 0x00, 0xff, 0x00, 0x00 },
{ 0xff, 0x00, 0x00, 0x00 },
{ 0xff, 0xff, 0xff, 0x00 },
};
GLuint indices[] = { 1, 2, 3 };
static void Init( void )
{
GLint errno;
GLuint prognum;
static const char *prog1 =
"!!ARBvp1.0\n"
"MOV result.color, vertex.color;\n"
"MOV result.position, vertex.position;\n"
"END\n";
glGenProgramsARB(1, &prognum);
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum);
glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(prog1), (const GLubyte *) prog1);
assert(glIsProgramARB(prognum));
errno = glGetError();
printf("glGetError = %d\n", errno);
if (errno != GL_NO_ERROR)
{
GLint errorpos;
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos);
printf("errorpos: %d\n", errorpos);
printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB));
}
glEnableClientState( GL_VERTEX_ARRAY );
glEnableClientState( GL_COLOR_ARRAY );
glVertexPointer( 3, GL_FLOAT, sizeof(verts[0]), verts );
glColorPointer( 4, GL_UNSIGNED_BYTE, 0, color );
}
static void Display( void )
{
glClearColor(0.3, 0.3, 0.3, 1);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glEnable(GL_VERTEX_PROGRAM_NV);
glDrawRangeElements( GL_TRIANGLES, 1, 3, 3, GL_UNSIGNED_INT, indices );
glFlush();
}
static void Reshape( int width, int height )
{
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
/*glTranslatef( 0.0, 0.0, -15.0 );*/
}
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
int main( int argc, char *argv[] )
{
glutInit( &argc, argv );
glutInitWindowPosition( 0, 0 );
glutInitWindowSize( 250, 250 );
glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH );
glutCreateWindow(argv[0]);
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutDisplayFunc( Display );
Init();
glutMainLoop();
return 0;
}

View file

@ -0,0 +1,133 @@
/* Basic VBO */
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
struct {
GLfloat pos[3];
GLubyte color[4];
} verts[] =
{
{ { 0.9, -0.9, 0.0 },
{ 0x00, 0x00, 0xff, 0x00 }
},
{ { 0.9, 0.9, 0.0 },
{ 0x00, 0xff, 0x00, 0x00 }
},
{ { -0.9, 0.9, 0.0 },
{ 0xff, 0x00, 0x00, 0x00 }
},
{ { -0.9, -0.9, 0.0 },
{ 0xff, 0xff, 0xff, 0x00 }
},
};
GLuint arrayObj, elementObj;
static void Init( void )
{
GLint errno;
GLuint prognum;
static const char *prog1 =
"!!ARBvp1.0\n"
"MOV result.color, vertex.color;\n"
"MOV result.position, vertex.position;\n"
"END\n";
glGenProgramsARB(1, &prognum);
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum);
glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(prog1), (const GLubyte *) prog1);
assert(glIsProgramARB(prognum));
errno = glGetError();
printf("glGetError = %d\n", errno);
if (errno != GL_NO_ERROR)
{
GLint errorpos;
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos);
printf("errorpos: %d\n", errorpos);
printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB));
}
glEnableClientState( GL_VERTEX_ARRAY );
glEnableClientState( GL_COLOR_ARRAY );
glGenBuffersARB(1, &arrayObj);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, arrayObj);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), verts, GL_STATIC_DRAW_ARB);
glVertexPointer( 3, GL_FLOAT, sizeof(verts[0]), 0 );
glColorPointer( 4, GL_UNSIGNED_BYTE, sizeof(verts[0]), (void *)(3*sizeof(float)) );
}
static void Display( void )
{
glClearColor(0.3, 0.3, 0.3, 1);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glEnable(GL_VERTEX_PROGRAM_ARB);
// glDrawArrays( GL_TRIANGLES, 0, 3 );
glDrawArrays( GL_TRIANGLES, 1, 3 );
glFlush();
}
static void Reshape( int width, int height )
{
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
/*glTranslatef( 0.0, 0.0, -15.0 );*/
}
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
int main( int argc, char *argv[] )
{
glutInit( &argc, argv );
glutInitWindowPosition( 0, 0 );
glutInitWindowSize( 250, 250 );
glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH );
glutCreateWindow(argv[0]);
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutDisplayFunc( Display );
Init();
glutMainLoop();
return 0;
}

View file

@ -0,0 +1,137 @@
/* Basic VBO */
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
struct {
GLfloat pos[3];
GLubyte color[4];
} verts[] =
{
{ { 0.9, -0.9, 0.0 },
{ 0x00, 0x00, 0xff, 0x00 }
},
{ { 0.9, 0.9, 0.0 },
{ 0x00, 0xff, 0x00, 0x00 }
},
{ { -0.9, 0.9, 0.0 },
{ 0xff, 0x00, 0x00, 0x00 }
},
{ { -0.9, -0.9, 0.0 },
{ 0xff, 0xff, 0xff, 0x00 }
},
};
GLuint indices[] = { 0, 1, 2, 3 };
GLuint arrayObj, elementObj;
static void Init( void )
{
GLint errno;
GLuint prognum;
static const char *prog1 =
"!!ARBvp1.0\n"
"MOV result.color, vertex.color;\n"
"MOV result.position, vertex.position;\n"
"END\n";
glGenProgramsARB(1, &prognum);
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum);
glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(prog1), (const GLubyte *) prog1);
assert(glIsProgramARB(prognum));
errno = glGetError();
printf("glGetError = %d\n", errno);
if (errno != GL_NO_ERROR)
{
GLint errorpos;
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos);
printf("errorpos: %d\n", errorpos);
printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB));
}
glEnableClientState( GL_VERTEX_ARRAY );
glEnableClientState( GL_COLOR_ARRAY );
glGenBuffersARB(1, &arrayObj);
glGenBuffersARB(1, &elementObj);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, arrayObj);
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, elementObj);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), verts, GL_STATIC_DRAW_ARB);
glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, sizeof(indices), indices, GL_STATIC_DRAW_ARB);
glVertexPointer( 3, GL_FLOAT, sizeof(verts[0]), 0 );
glColorPointer( 4, GL_UNSIGNED_BYTE, sizeof(verts[0]), (void *)(3*sizeof(float)) );
}
static void Display( void )
{
glClearColor(0.3, 0.3, 0.3, 1);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glEnable(GL_VERTEX_PROGRAM_ARB);
glDrawElements( GL_TRIANGLES, 3, GL_UNSIGNED_INT, NULL );
glFlush();
}
static void Reshape( int width, int height )
{
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
/*glTranslatef( 0.0, 0.0, -15.0 );*/
}
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
int main( int argc, char *argv[] )
{
glutInit( &argc, argv );
glutInitWindowPosition( 0, 0 );
glutInitWindowSize( 250, 250 );
glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH );
glutCreateWindow(argv[0]);
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutDisplayFunc( Display );
Init();
glutMainLoop();
return 0;
}

View file

@ -0,0 +1,145 @@
/* Basic VBO */
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#define ELTOBJ 0
struct {
GLfloat pos[3];
GLubyte color[4];
} verts[] =
{
{ { 0.9, -0.9, 0.0 },
{ 0x00, 0x00, 0xff, 0x00 }
},
{ { 0.9, 0.9, 0.0 },
{ 0x00, 0xff, 0x00, 0x00 }
},
{ { -0.9, 0.9, 0.0 },
{ 0xff, 0x00, 0x00, 0x00 }
},
{ { -0.9, -0.9, 0.0 },
{ 0xff, 0xff, 0xff, 0x00 }
},
};
GLuint indices[] = { 1, 2, 3 };
GLuint arrayObj, elementObj;
static void Init( void )
{
GLint errno;
GLuint prognum;
static const char *prog1 =
"!!ARBvp1.0\n"
"MOV result.color, vertex.color;\n"
"MOV result.position, vertex.position;\n"
"END\n";
glGenProgramsARB(1, &prognum);
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum);
glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(prog1), (const GLubyte *) prog1);
assert(glIsProgramARB(prognum));
errno = glGetError();
printf("glGetError = %d\n", errno);
if (errno != GL_NO_ERROR)
{
GLint errorpos;
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos);
printf("errorpos: %d\n", errorpos);
printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB));
}
glEnableClientState( GL_VERTEX_ARRAY );
glEnableClientState( GL_COLOR_ARRAY );
glGenBuffersARB(1, &arrayObj);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, arrayObj);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), verts, GL_STATIC_DRAW_ARB);
#if ELTOBJ
glGenBuffersARB(1, &elementObj);
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, elementObj);
glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, sizeof(indices), indices, GL_STATIC_DRAW_ARB);
#endif
glVertexPointer( 3, GL_FLOAT, sizeof(verts[0]), 0 );
glColorPointer( 4, GL_UNSIGNED_BYTE, sizeof(verts[0]), (void *)(3*sizeof(float)) );
}
static void Display( void )
{
glClearColor(0.3, 0.3, 0.3, 1);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glEnable(GL_VERTEX_PROGRAM_ARB);
#if ELTOBJ
glDrawRangeElements( GL_TRIANGLES, 1, 3, 3, GL_UNSIGNED_INT, NULL );
#else
glDrawRangeElements( GL_TRIANGLES, 1, 3, 3, GL_UNSIGNED_INT, indices );
#endif
glFlush();
}
static void Reshape( int width, int height )
{
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
/*glTranslatef( 0.0, 0.0, -15.0 );*/
}
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
int main( int argc, char *argv[] )
{
glutInit( &argc, argv );
glutInitWindowPosition( 0, 0 );
glutInitWindowSize( 250, 250 );
glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH );
glutCreateWindow(argv[0]);
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutDisplayFunc( Display );
Init();
glutMainLoop();
return 0;
}

View file

@ -142,7 +142,7 @@ depend: $(ALL_SOURCES)
@ echo "running $(MKDEP)"
@ touch depend
@$(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) $(ALL_SOURCES) \
> /dev/null
> /dev/null 2>/dev/null
subdirs:

View file

@ -1,375 +0,0 @@
/*
* Mesa 3-D graphics library
* Version: 5.1
*
* Copyright (C) 1999-2002 Brian Paul 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, sublicense,
* 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL 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.
*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
*/
#include "glheader.h"
#include "macros.h"
#include "imports.h"
#include "mtypes.h"
#include "array_cache/ac_context.h"
/*
* Initialize the array fallbacks. That is, by default the fallback arrays
* point into the current vertex attribute values in ctx->Current.Attrib[]
*/
static void _ac_fallbacks_init( GLcontext *ctx )
{
ACcontext *ac = AC_CONTEXT(ctx);
struct gl_client_array *cl;
GLuint i;
cl = &ac->Fallback.Normal;
cl->Size = 3;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (GLubyte *) ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
cl = &ac->Fallback.Color;
cl->Size = 4;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (GLubyte *) ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
cl = &ac->Fallback.SecondaryColor;
cl->Size = 3;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (GLubyte *) ctx->Current.Attrib[VERT_ATTRIB_COLOR1];
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
cl = &ac->Fallback.FogCoord;
cl->Size = 1;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (GLubyte *) &ctx->Current.Attrib[VERT_ATTRIB_FOG];
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
cl = &ac->Fallback.Index;
cl->Size = 1;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (GLubyte *) &ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX];
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
for (i = 0 ; i < MAX_TEXTURE_COORD_UNITS ; i++) {
cl = &ac->Fallback.TexCoord[i];
cl->Size = 4;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (GLubyte *) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + i];
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
}
cl = &ac->Fallback.EdgeFlag;
cl->Size = 1;
cl->Type = GL_UNSIGNED_BYTE;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (GLubyte *) &ctx->Current.EdgeFlag;
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
for (i = 0; i < VERT_ATTRIB_MAX; i++) {
cl = &ac->Fallback.Attrib[i];
cl->Size = 4;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (GLubyte *) ctx->Current.Attrib[i];
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
}
}
/*
* Initialize the array cache pointers, types, strides, etc.
*/
static void _ac_cache_init( GLcontext *ctx )
{
ACcontext *ac = AC_CONTEXT(ctx);
struct gl_client_array *cl;
GLuint size = ctx->Const.MaxArrayLockSize + MAX_CLIPPED_VERTICES;
GLuint i;
cl = &ac->Cache.Vertex;
cl->Size = 4;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 4 * sizeof(GLfloat);
cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
cl = &ac->Cache.Normal;
cl->Size = 3;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 3 * sizeof(GLfloat);
cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
cl = &ac->Cache.Color;
cl->Size = 4;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 4 * sizeof(GLfloat);
cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
cl = &ac->Cache.SecondaryColor;
cl->Size = 3;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 4 * sizeof(GLfloat);
cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
cl = &ac->Cache.FogCoord;
cl->Size = 1;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = sizeof(GLfloat);
cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
cl = &ac->Cache.Index;
cl->Size = 1;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = sizeof(GLfloat);
cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {
cl = &ac->Cache.TexCoord[i];
cl->Size = 4;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 4 * sizeof(GLfloat);
cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
}
cl = &ac->Cache.EdgeFlag;
cl->Size = 1;
cl->Type = GL_UNSIGNED_BYTE;
cl->Stride = 0;
cl->StrideB = sizeof(GLubyte);
cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
for (i = 0 ; i < VERT_ATTRIB_MAX; i++) {
cl = &ac->Cache.Attrib[i];
cl->Size = 4;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 4 * sizeof(GLfloat);
cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
}
}
/* This storage used to hold translated client data if type or stride
* need to be fixed.
*/
static void _ac_elts_init( GLcontext *ctx )
{
ACcontext *ac = AC_CONTEXT(ctx);
GLuint size = 1000;
ac->Elts = (GLuint *)MALLOC( sizeof(GLuint) * size );
ac->elt_size = size;
}
static void _ac_raw_init( GLcontext *ctx )
{
ACcontext *ac = AC_CONTEXT(ctx);
GLuint i;
ac->Raw.Color = ac->Fallback.Color;
ac->Raw.EdgeFlag = ac->Fallback.EdgeFlag;
ac->Raw.FogCoord = ac->Fallback.FogCoord;
ac->Raw.Index = ac->Fallback.Index;
ac->Raw.Normal = ac->Fallback.Normal;
ac->Raw.SecondaryColor = ac->Fallback.SecondaryColor;
ac->Raw.Vertex = ctx->Array.ArrayObj->Vertex;
ac->IsCached.Color = GL_FALSE;
ac->IsCached.EdgeFlag = GL_FALSE;
ac->IsCached.FogCoord = GL_FALSE;
ac->IsCached.Index = GL_FALSE;
ac->IsCached.Normal = GL_FALSE;
ac->IsCached.SecondaryColor = GL_FALSE;
ac->IsCached.Vertex = GL_FALSE;
for (i = 0 ; i < MAX_TEXTURE_COORD_UNITS ; i++) {
ac->Raw.TexCoord[i] = ac->Fallback.TexCoord[i];
ac->IsCached.TexCoord[i] = GL_FALSE;
}
for (i = 0 ; i < VERT_ATTRIB_MAX ; i++) {
ac->Raw.Attrib[i] = ac->Fallback.Attrib[i];
ac->IsCached.Attrib[i] = GL_FALSE;
}
}
GLboolean _ac_CreateContext( GLcontext *ctx )
{
ctx->acache_context = CALLOC(sizeof(ACcontext));
if (ctx->acache_context) {
_ac_cache_init( ctx );
_ac_fallbacks_init( ctx );
_ac_raw_init( ctx );
_ac_elts_init( ctx );
return GL_TRUE;
}
return GL_FALSE;
}
void _ac_DestroyContext( GLcontext *ctx )
{
struct gl_buffer_object *nullObj = ctx->Array.NullBufferObj;
ACcontext *ac = AC_CONTEXT(ctx);
GLint i;
/* only free vertex data if it's really a pointer to vertex data and
* not an offset into a buffer object.
*/
if (ac->Cache.Vertex.Ptr && ac->Cache.Vertex.BufferObj == nullObj)
FREE( (void *) ac->Cache.Vertex.Ptr );
if (ac->Cache.Normal.Ptr && ac->Cache.Normal.BufferObj == nullObj)
FREE( (void *) ac->Cache.Normal.Ptr );
if (ac->Cache.Color.Ptr && ac->Cache.Color.BufferObj == nullObj)
FREE( (void *) ac->Cache.Color.Ptr );
if (ac->Cache.SecondaryColor.Ptr && ac->Cache.SecondaryColor.BufferObj == nullObj)
FREE( (void *) ac->Cache.SecondaryColor.Ptr );
if (ac->Cache.EdgeFlag.Ptr && ac->Cache.EdgeFlag.BufferObj == nullObj)
FREE( (void *) ac->Cache.EdgeFlag.Ptr );
if (ac->Cache.Index.Ptr && ac->Cache.Index.BufferObj == nullObj)
FREE( (void *) ac->Cache.Index.Ptr );
if (ac->Cache.FogCoord.Ptr && ac->Cache.FogCoord.BufferObj == nullObj)
FREE( (void *) ac->Cache.FogCoord.Ptr );
for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {
if (ac->Cache.TexCoord[i].Ptr && ac->Cache.TexCoord[i].BufferObj == nullObj)
FREE( (void *) ac->Cache.TexCoord[i].Ptr );
}
for (i = 0; i < VERT_ATTRIB_MAX; i++) {
if (ac->Cache.Attrib[i].Ptr && ac->Cache.Attrib[i].BufferObj == nullObj)
FREE( (void *) ac->Cache.Attrib[i].Ptr );
}
if (ac->Elts)
FREE( ac->Elts );
/* Free the context structure itself */
FREE(ac);
ctx->acache_context = NULL;
}
void _ac_InvalidateState( GLcontext *ctx, GLuint new_state )
{
AC_CONTEXT(ctx)->NewState |= new_state;
AC_CONTEXT(ctx)->NewArrayState |= ctx->Array.NewState;
}

View file

@ -1,99 +0,0 @@
/*
* Mesa 3-D graphics library
* Version: 5.1
*
* Copyright (C) 1999-2002 Brian Paul 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, sublicense,
* 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL 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.
*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
*/
#ifndef _AC_CONTEXT_H
#define _AC_CONTEXT_H
#include "glheader.h"
#include "mtypes.h"
#include "array_cache/acache.h"
/* These are used to make the ctx->Current values look like
* arrays (with zero StrideB).
*/
struct ac_arrays {
struct gl_client_array Vertex;
struct gl_client_array Normal;
struct gl_client_array Color;
struct gl_client_array SecondaryColor;
struct gl_client_array FogCoord;
struct gl_client_array Index;
struct gl_client_array TexCoord[MAX_TEXTURE_COORD_UNITS];
struct gl_client_array EdgeFlag;
struct gl_client_array Attrib[VERT_ATTRIB_MAX]; /* GL_NV_vertex_program */
};
struct ac_array_pointers {
struct gl_client_array *Vertex;
struct gl_client_array *Normal;
struct gl_client_array *Color;
struct gl_client_array *SecondaryColor;
struct gl_client_array *FogCoord;
struct gl_client_array *Index;
struct gl_client_array *TexCoord[MAX_TEXTURE_COORD_UNITS];
struct gl_client_array *EdgeFlag;
struct gl_client_array *Attrib[VERT_ATTRIB_MAX]; /* GL_NV_vertex_program */
};
struct ac_array_flags {
GLboolean Vertex;
GLboolean Normal;
GLboolean Color;
GLboolean SecondaryColor;
GLboolean FogCoord;
GLboolean Index;
GLboolean TexCoord[MAX_TEXTURE_COORD_UNITS];
GLboolean EdgeFlag;
GLboolean Attrib[VERT_ATTRIB_MAX]; /* GL_NV_vertex_program */
};
typedef struct {
GLuint NewState; /* not needed? */
GLuint NewArrayState;
/* Facility for importing and caching array data:
*/
struct ac_arrays Fallback;
struct ac_arrays Cache;
struct ac_arrays Raw;
struct ac_array_flags IsCached;
GLuint start;
GLuint count;
/* Facility for importing element lists:
*/
GLuint *Elts;
GLuint elt_size;
} ACcontext;
#define AC_CONTEXT(ctx) ((ACcontext *)ctx->acache_context)
#endif

View file

@ -1,922 +0,0 @@
/*
* Mesa 3-D graphics library
* Version: 6.5
*
* Copyright (C) 1999-2006 Brian Paul 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, sublicense,
* 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL 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.
*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
*/
#include "glheader.h"
#include "macros.h"
#include "imports.h"
#include "mtypes.h"
#include "math/m_translate.h"
#include "array_cache/ac_context.h"
#include "math/m_translate.h"
#define STRIDE_ARRAY( array, offset ) \
do { \
GLubyte *tmp = ADD_POINTERS( (array).BufferObj->Data, (array).Ptr ) \
+ (offset) * (array).StrideB; \
(array).Ptr = tmp; \
} while (0)
/* Set the array pointer back to its source when the cached data is
* invalidated:
*/
static void
reset_texcoord( GLcontext *ctx, GLuint unit )
{
ACcontext *ac = AC_CONTEXT(ctx);
if (ctx->Array.ArrayObj->TexCoord[unit].Enabled) {
ac->Raw.TexCoord[unit] = ctx->Array.ArrayObj->TexCoord[unit];
STRIDE_ARRAY(ac->Raw.TexCoord[unit], ac->start);
}
else {
ac->Raw.TexCoord[unit] = ac->Fallback.TexCoord[unit];
if (ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][3] != 1.0)
ac->Raw.TexCoord[unit].Size = 4;
else if (ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][2] != 0.0)
ac->Raw.TexCoord[unit].Size = 3;
else
ac->Raw.TexCoord[unit].Size = 2;
}
ac->IsCached.TexCoord[unit] = GL_FALSE;
ac->NewArrayState &= ~_NEW_ARRAY_TEXCOORD(unit);
}
static void
reset_vertex( GLcontext *ctx )
{
ACcontext *ac = AC_CONTEXT(ctx);
ASSERT(ctx->Array.ArrayObj->Vertex.Enabled
|| (ctx->VertexProgram._Enabled && ctx->Array.ArrayObj->VertexAttrib[0].Enabled));
ac->Raw.Vertex = ctx->Array.ArrayObj->Vertex;
STRIDE_ARRAY(ac->Raw.Vertex, ac->start);
ac->IsCached.Vertex = GL_FALSE;
ac->NewArrayState &= ~_NEW_ARRAY_VERTEX;
}
static void
reset_normal( GLcontext *ctx )
{
ACcontext *ac = AC_CONTEXT(ctx);
if (ctx->Array.ArrayObj->Normal.Enabled) {
ac->Raw.Normal = ctx->Array.ArrayObj->Normal;
STRIDE_ARRAY(ac->Raw.Normal, ac->start);
}
else {
ac->Raw.Normal = ac->Fallback.Normal;
}
ac->IsCached.Normal = GL_FALSE;
ac->NewArrayState &= ~_NEW_ARRAY_NORMAL;
}
static void
reset_color( GLcontext *ctx )
{
ACcontext *ac = AC_CONTEXT(ctx);
if (ctx->Array.ArrayObj->Color.Enabled) {
ac->Raw.Color = ctx->Array.ArrayObj->Color;
STRIDE_ARRAY(ac->Raw.Color, ac->start);
}
else
ac->Raw.Color = ac->Fallback.Color;
ac->IsCached.Color = GL_FALSE;
ac->NewArrayState &= ~_NEW_ARRAY_COLOR0;
}
static void
reset_secondarycolor( GLcontext *ctx )
{
ACcontext *ac = AC_CONTEXT(ctx);
if (ctx->Array.ArrayObj->SecondaryColor.Enabled) {
ac->Raw.SecondaryColor = ctx->Array.ArrayObj->SecondaryColor;
STRIDE_ARRAY(ac->Raw.SecondaryColor, ac->start);
}
else
ac->Raw.SecondaryColor = ac->Fallback.SecondaryColor;
ac->IsCached.SecondaryColor = GL_FALSE;
ac->NewArrayState &= ~_NEW_ARRAY_COLOR1;
}
static void
reset_index( GLcontext *ctx )
{
ACcontext *ac = AC_CONTEXT(ctx);
if (ctx->Array.ArrayObj->Index.Enabled) {
ac->Raw.Index = ctx->Array.ArrayObj->Index;
STRIDE_ARRAY(ac->Raw.Index, ac->start);
}
else
ac->Raw.Index = ac->Fallback.Index;
ac->IsCached.Index = GL_FALSE;
ac->NewArrayState &= ~_NEW_ARRAY_INDEX;
}
static void
reset_fogcoord( GLcontext *ctx )
{
ACcontext *ac = AC_CONTEXT(ctx);
if (ctx->Array.ArrayObj->FogCoord.Enabled) {
ac->Raw.FogCoord = ctx->Array.ArrayObj->FogCoord;
STRIDE_ARRAY(ac->Raw.FogCoord, ac->start);
}
else
ac->Raw.FogCoord = ac->Fallback.FogCoord;
ac->IsCached.FogCoord = GL_FALSE;
ac->NewArrayState &= ~_NEW_ARRAY_FOGCOORD;
}
static void
reset_edgeflag( GLcontext *ctx )
{
ACcontext *ac = AC_CONTEXT(ctx);
if (ctx->Array.ArrayObj->EdgeFlag.Enabled) {
ac->Raw.EdgeFlag = ctx->Array.ArrayObj->EdgeFlag;
STRIDE_ARRAY(ac->Raw.EdgeFlag, ac->start);
}
else
ac->Raw.EdgeFlag = ac->Fallback.EdgeFlag;
ac->IsCached.EdgeFlag = GL_FALSE;
ac->NewArrayState &= ~_NEW_ARRAY_EDGEFLAG;
}
/**
* \param index the generic vertex array number.
*/
static void
reset_attrib( GLcontext *ctx, GLuint index )
{
ACcontext *ac = AC_CONTEXT(ctx);
if (ctx->Array.ArrayObj->VertexAttrib[index].Enabled) {
ac->Raw.Attrib[index] = ctx->Array.ArrayObj->VertexAttrib[index];
STRIDE_ARRAY(ac->Raw.Attrib[index], ac->start);
}
else
ac->Raw.Attrib[index] = ac->Fallback.Attrib[index];
ac->IsCached.Attrib[index] = GL_FALSE;
ac->NewArrayState &= ~_NEW_ARRAY_ATTRIB(index);
}
/**
* Generic import function for color data
*/
static void
import( const GLcontext *ctx,
GLenum destType,
struct gl_client_array *to,
const struct gl_client_array *from )
{
const ACcontext *ac = AC_CONTEXT(ctx);
if (destType == 0)
destType = from->Type;
switch (destType) {
case GL_FLOAT:
_math_trans_4fn( (GLfloat (*)[4]) to->Ptr,
from->Ptr,
from->StrideB,
from->Type,
from->Size,
0,
ac->count - ac->start);
to->StrideB = 4 * sizeof(GLfloat);
to->Type = GL_FLOAT;
break;
case GL_UNSIGNED_BYTE:
_math_trans_4ub( (GLubyte (*)[4]) to->Ptr,
from->Ptr,
from->StrideB,
from->Type,
from->Size,
0,
ac->count - ac->start);
to->StrideB = 4 * sizeof(GLubyte);
to->Type = GL_UNSIGNED_BYTE;
break;
case GL_UNSIGNED_SHORT:
_math_trans_4us( (GLushort (*)[4]) to->Ptr,
from->Ptr,
from->StrideB,
from->Type,
from->Size,
0,
ac->count - ac->start);
to->StrideB = 4 * sizeof(GLushort);
to->Type = GL_UNSIGNED_SHORT;
break;
default:
_mesa_problem(ctx, "Unexpected dest format in import()");
break;
}
}
/*
* Functions to import array ranges with specified types and strides.
* For example, if the vertex data is GLshort[2] and we want GLfloat[3]
* we'll use an import function to do the data conversion.
*/
static void
import_texcoord( GLcontext *ctx, GLuint unit, GLenum type, GLuint stride )
{
ACcontext *ac = AC_CONTEXT(ctx);
const struct gl_client_array *from = &ac->Raw.TexCoord[unit];
struct gl_client_array *to = &ac->Cache.TexCoord[unit];
(void) type; (void) stride;
ASSERT(unit < ctx->Const.MaxTextureCoordUnits);
/* Limited choices at this stage:
*/
ASSERT(type == GL_FLOAT);
ASSERT(stride == 4*sizeof(GLfloat) || stride == 0);
ASSERT(ac->count - ac->start < ctx->Const.MaxArrayLockSize);
_math_trans_4f( (GLfloat (*)[4]) to->Ptr,
from->Ptr,
from->StrideB,
from->Type,
from->Size,
0,
ac->count - ac->start);
to->Size = from->Size;
to->StrideB = 4 * sizeof(GLfloat);
to->Type = GL_FLOAT;
ac->IsCached.TexCoord[unit] = GL_TRUE;
}
static void
import_vertex( GLcontext *ctx, GLenum type, GLuint stride )
{
ACcontext *ac = AC_CONTEXT(ctx);
const struct gl_client_array *from = &ac->Raw.Vertex;
struct gl_client_array *to = &ac->Cache.Vertex;
(void) type; (void) stride;
/* Limited choices at this stage:
*/
ASSERT(type == GL_FLOAT);
ASSERT(stride == 4*sizeof(GLfloat) || stride == 0);
_math_trans_4f( (GLfloat (*)[4]) to->Ptr,
from->Ptr,
from->StrideB,
from->Type,
from->Size,
0,
ac->count - ac->start);
to->Size = from->Size;
to->StrideB = 4 * sizeof(GLfloat);
to->Type = GL_FLOAT;
ac->IsCached.Vertex = GL_TRUE;
}
static void
import_normal( GLcontext *ctx, GLenum type, GLuint stride )
{
ACcontext *ac = AC_CONTEXT(ctx);
const struct gl_client_array *from = &ac->Raw.Normal;
struct gl_client_array *to = &ac->Cache.Normal;
(void) type; (void) stride;
/* Limited choices at this stage:
*/
ASSERT(type == GL_FLOAT);
ASSERT(stride == 3*sizeof(GLfloat) || stride == 0);
_math_trans_3fn((GLfloat (*)[3]) to->Ptr,
from->Ptr,
from->StrideB,
from->Type,
0,
ac->count - ac->start);
to->StrideB = 3 * sizeof(GLfloat);
to->Type = GL_FLOAT;
ac->IsCached.Normal = GL_TRUE;
}
static void
import_color( GLcontext *ctx, GLenum type, GLuint stride )
{
ACcontext *ac = AC_CONTEXT(ctx);
const struct gl_client_array *from = &ac->Raw.Color;
struct gl_client_array *to = &ac->Cache.Color;
(void) stride;
import( ctx, type, to, from );
ac->IsCached.Color = GL_TRUE;
}
static void
import_index( GLcontext *ctx, GLenum type, GLuint stride )
{
ACcontext *ac = AC_CONTEXT(ctx);
const struct gl_client_array *from = &ac->Raw.Index;
struct gl_client_array *to = &ac->Cache.Index;
(void) type; (void) stride;
/* Limited choices at this stage:
*/
ASSERT(type == GL_UNSIGNED_INT);
ASSERT(stride == sizeof(GLuint) || stride == 0);
_math_trans_1ui( (GLuint *) to->Ptr,
from->Ptr,
from->StrideB,
from->Type,
0,
ac->count - ac->start);
to->StrideB = sizeof(GLuint);
to->Type = GL_UNSIGNED_INT;
ac->IsCached.Index = GL_TRUE;
}
static void
import_secondarycolor( GLcontext *ctx, GLenum type, GLuint stride )
{
ACcontext *ac = AC_CONTEXT(ctx);
const struct gl_client_array *from = &ac->Raw.SecondaryColor;
struct gl_client_array *to = &ac->Cache.SecondaryColor;
(void) stride;
import( ctx, type, to, from );
ac->IsCached.SecondaryColor = GL_TRUE;
}
static void
import_fogcoord( GLcontext *ctx, GLenum type, GLuint stride )
{
ACcontext *ac = AC_CONTEXT(ctx);
const struct gl_client_array *from = &ac->Raw.FogCoord;
struct gl_client_array *to = &ac->Cache.FogCoord;
(void) type; (void) stride;
/* Limited choices at this stage:
*/
ASSERT(type == GL_FLOAT);
ASSERT(stride == sizeof(GLfloat) || stride == 0);
_math_trans_1f( (GLfloat *) to->Ptr,
from->Ptr,
from->StrideB,
from->Type,
0,
ac->count - ac->start);
to->StrideB = sizeof(GLfloat);
to->Type = GL_FLOAT;
ac->IsCached.FogCoord = GL_TRUE;
}
static void
import_edgeflag( GLcontext *ctx, GLenum type, GLuint stride )
{
ACcontext *ac = AC_CONTEXT(ctx);
const struct gl_client_array *from = &ac->Raw.EdgeFlag;
struct gl_client_array *to = &ac->Cache.EdgeFlag;
(void) type; (void) stride;
/* Limited choices at this stage:
*/
ASSERT(type == GL_UNSIGNED_BYTE);
ASSERT(stride == sizeof(GLubyte) || stride == 0);
_math_trans_1ub( (GLubyte *) to->Ptr,
from->Ptr,
from->StrideB,
from->Type,
0,
ac->count - ac->start);
to->StrideB = sizeof(GLubyte);
to->Type = GL_UNSIGNED_BYTE;
ac->IsCached.EdgeFlag = GL_TRUE;
}
/**
* \param index the generic vertex array number
*/
static void
import_attrib( GLcontext *ctx, GLuint index, GLenum type, GLuint stride )
{
ACcontext *ac = AC_CONTEXT(ctx);
const struct gl_client_array *from = &ac->Raw.Attrib[index];
struct gl_client_array *to = &ac->Cache.Attrib[index];
(void) type; (void) stride;
ASSERT(index < MAX_VERTEX_PROGRAM_ATTRIBS);
/* Limited choices at this stage:
*/
ASSERT(type == GL_FLOAT);
ASSERT(stride == 4*sizeof(GLfloat) || stride == 0);
ASSERT(ac->count - ac->start < ctx->Const.MaxArrayLockSize);
if (from->Normalized) {
_math_trans_4fn( (GLfloat (*)[4]) to->Ptr,
from->Ptr,
from->StrideB,
from->Type,
from->Size,
0,
ac->count - ac->start);
}
else {
_math_trans_4f( (GLfloat (*)[4]) to->Ptr,
from->Ptr,
from->StrideB,
from->Type,
from->Size,
0,
ac->count - ac->start);
}
to->Size = from->Size;
to->StrideB = 4 * sizeof(GLfloat);
to->Type = GL_FLOAT;
ac->IsCached.Attrib[index] = GL_TRUE;
}
/*
* Externals to request arrays with specific properties:
*/
struct gl_client_array *
_ac_import_texcoord( GLcontext *ctx,
GLuint unit,
GLenum type,
GLuint reqstride,
GLuint reqsize,
GLboolean reqwriteable,
GLboolean *writeable )
{
ACcontext *ac = AC_CONTEXT(ctx);
ASSERT(unit < MAX_TEXTURE_COORD_UNITS);
/* Can we keep the existing version?
*/
if (ac->NewArrayState & _NEW_ARRAY_TEXCOORD(unit))
reset_texcoord( ctx, unit );
/* Is the request impossible?
*/
if (reqsize != 0 && ac->Raw.TexCoord[unit].Size > (GLint) reqsize)
return NULL;
/* Do we need to pull in a copy of the client data:
*/
if (ac->Raw.TexCoord[unit].Type != type ||
(reqstride != 0 && ac->Raw.TexCoord[unit].StrideB != (GLint)reqstride) ||
reqwriteable)
{
if (!ac->IsCached.TexCoord[unit])
import_texcoord(ctx, unit, type, reqstride );
*writeable = GL_TRUE;
return &ac->Cache.TexCoord[unit];
}
else {
*writeable = GL_FALSE;
return &ac->Raw.TexCoord[unit];
}
}
struct gl_client_array *
_ac_import_vertex( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLuint reqsize,
GLboolean reqwriteable,
GLboolean *writeable )
{
ACcontext *ac = AC_CONTEXT(ctx);
/* Can we keep the existing version?
*/
if (ac->NewArrayState & _NEW_ARRAY_VERTEX)
reset_vertex( ctx );
/* Is the request impossible?
*/
if (reqsize != 0 && ac->Raw.Vertex.Size > (GLint) reqsize)
return NULL;
/* Do we need to pull in a copy of the client data:
*/
if (ac->Raw.Vertex.Type != type ||
(reqstride != 0 && ac->Raw.Vertex.StrideB != (GLint) reqstride) ||
reqwriteable)
{
if (!ac->IsCached.Vertex)
import_vertex(ctx, type, reqstride );
*writeable = GL_TRUE;
return &ac->Cache.Vertex;
}
else {
*writeable = GL_FALSE;
return &ac->Raw.Vertex;
}
}
struct gl_client_array *
_ac_import_normal( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLboolean reqwriteable,
GLboolean *writeable )
{
ACcontext *ac = AC_CONTEXT(ctx);
/* Can we keep the existing version?
*/
if (ac->NewArrayState & _NEW_ARRAY_NORMAL)
reset_normal( ctx );
/* Do we need to pull in a copy of the client data:
*/
if (ac->Raw.Normal.Type != type ||
(reqstride != 0 && ac->Raw.Normal.StrideB != (GLint) reqstride) ||
reqwriteable)
{
if (!ac->IsCached.Normal)
import_normal(ctx, type, reqstride );
*writeable = GL_TRUE;
return &ac->Cache.Normal;
}
else {
*writeable = GL_FALSE;
return &ac->Raw.Normal;
}
}
struct gl_client_array *
_ac_import_color( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLuint reqsize,
GLboolean reqwriteable,
GLboolean *writeable )
{
ACcontext *ac = AC_CONTEXT(ctx);
/* Can we keep the existing version?
*/
if (ac->NewArrayState & _NEW_ARRAY_COLOR0)
reset_color( ctx );
/* Is the request impossible?
*/
if (reqsize != 0 && ac->Raw.Color.Size > (GLint) reqsize) {
return NULL;
}
/* Do we need to pull in a copy of the client data:
*/
if ((type != 0 && ac->Raw.Color.Type != type) ||
(reqstride != 0 && ac->Raw.Color.StrideB != (GLint) reqstride) ||
reqwriteable)
{
if (!ac->IsCached.Color) {
import_color(ctx, type, reqstride );
}
*writeable = GL_TRUE;
return &ac->Cache.Color;
}
else {
*writeable = GL_FALSE;
return &ac->Raw.Color;
}
}
struct gl_client_array *
_ac_import_index( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLboolean reqwriteable,
GLboolean *writeable )
{
ACcontext *ac = AC_CONTEXT(ctx);
/* Can we keep the existing version?
*/
if (ac->NewArrayState & _NEW_ARRAY_INDEX)
reset_index( ctx );
/* Do we need to pull in a copy of the client data:
*/
if (ac->Raw.Index.Type != type ||
(reqstride != 0 && ac->Raw.Index.StrideB != (GLint) reqstride) ||
reqwriteable)
{
if (!ac->IsCached.Index)
import_index(ctx, type, reqstride );
*writeable = GL_TRUE;
return &ac->Cache.Index;
}
else {
*writeable = GL_FALSE;
return &ac->Raw.Index;
}
}
struct gl_client_array *
_ac_import_secondarycolor( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLuint reqsize,
GLboolean reqwriteable,
GLboolean *writeable )
{
ACcontext *ac = AC_CONTEXT(ctx);
/* Can we keep the existing version?
*/
if (ac->NewArrayState & _NEW_ARRAY_COLOR1)
reset_secondarycolor( ctx );
/* Is the request impossible?
*/
if (reqsize != 0 && ac->Raw.SecondaryColor.Size > (GLint) reqsize)
return NULL;
/* Do we need to pull in a copy of the client data:
*/
if ((type != 0 && ac->Raw.SecondaryColor.Type != type) ||
(reqstride != 0 && ac->Raw.SecondaryColor.StrideB != (GLint)reqstride) ||
reqwriteable)
{
if (!ac->IsCached.SecondaryColor)
import_secondarycolor(ctx, type, reqstride );
*writeable = GL_TRUE;
return &ac->Cache.SecondaryColor;
}
else {
*writeable = GL_FALSE;
return &ac->Raw.SecondaryColor;
}
}
struct gl_client_array *
_ac_import_fogcoord( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLboolean reqwriteable,
GLboolean *writeable )
{
ACcontext *ac = AC_CONTEXT(ctx);
/* Can we keep the existing version?
*/
if (ac->NewArrayState & _NEW_ARRAY_FOGCOORD)
reset_fogcoord( ctx );
/* Do we need to pull in a copy of the client data:
*/
if (ac->Raw.FogCoord.Type != type ||
(reqstride != 0 && ac->Raw.FogCoord.StrideB != (GLint) reqstride) ||
reqwriteable)
{
if (!ac->IsCached.FogCoord)
import_fogcoord(ctx, type, reqstride );
*writeable = GL_TRUE;
return &ac->Cache.FogCoord;
}
else {
*writeable = GL_FALSE;
return &ac->Raw.FogCoord;
}
}
struct gl_client_array *
_ac_import_edgeflag( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLboolean reqwriteable,
GLboolean *writeable )
{
ACcontext *ac = AC_CONTEXT(ctx);
/* Can we keep the existing version?
*/
if (ac->NewArrayState & _NEW_ARRAY_EDGEFLAG)
reset_edgeflag( ctx );
/* Do we need to pull in a copy of the client data:
*/
if (ac->Raw.EdgeFlag.Type != type ||
(reqstride != 0 && ac->Raw.EdgeFlag.StrideB != (GLint) reqstride) ||
reqwriteable)
{
if (!ac->IsCached.EdgeFlag)
import_edgeflag(ctx, type, reqstride );
*writeable = GL_TRUE;
return &ac->Cache.EdgeFlag;
}
else {
*writeable = GL_FALSE;
return &ac->Raw.EdgeFlag;
}
}
/**
* For GL_ARB/NV_vertex_program
* \param index index of the vertex array, starting at zero.
*/
struct gl_client_array *
_ac_import_attrib( GLcontext *ctx,
GLuint index,
GLenum type,
GLuint reqstride,
GLuint reqsize,
GLboolean reqwriteable,
GLboolean *writeable )
{
ACcontext *ac = AC_CONTEXT(ctx);
ASSERT(index < VERT_ATTRIB_MAX);
/* Can we keep the existing version?
*/
if (ac->NewArrayState & _NEW_ARRAY_ATTRIB(index))
reset_attrib( ctx, index );
/* Is the request impossible?
*/
if (reqsize != 0 && ac->Raw.Attrib[index].Size > (GLint) reqsize)
return NULL;
/* Do we need to pull in a copy of the client data:
*/
if (ac->Raw.Attrib[index].Type != type ||
(reqstride != 0 && ac->Raw.Attrib[index].StrideB != (GLint)reqstride) ||
reqwriteable)
{
if (!ac->IsCached.Attrib[index])
import_attrib(ctx, index, type, reqstride );
*writeable = GL_TRUE;
return &ac->Cache.Attrib[index];
}
else {
*writeable = GL_FALSE;
return &ac->Raw.Attrib[index];
}
}
/* Clients must call this function to validate state and set bounds
* before importing any data:
*/
void
_ac_import_range( GLcontext *ctx, GLuint start, GLuint count )
{
ACcontext *ac = AC_CONTEXT(ctx);
if (!ctx->Array.LockCount) {
/* Not locked, discard cached data. Changes to lock
* status are caught via. _ac_invalidate_state().
*/
ac->NewArrayState = _NEW_ARRAY_ALL;
ac->start = start;
ac->count = count;
}
else {
/* Locked, discard data for any disabled arrays. Require that
* the whole locked range always be dealt with, otherwise hard to
* maintain cached data in the face of clipping.
*/
ac->NewArrayState |= ~ctx->Array.ArrayObj->_Enabled;
ac->start = ctx->Array.LockFirst;
ac->count = ctx->Array.LockCount;
ASSERT(ac->start == start); /* hmm? */
ASSERT(ac->count == count);
}
}
/* Additional convienence function for importing the element list
* for glDrawElements() and glDrawRangeElements().
*/
CONST void *
_ac_import_elements( GLcontext *ctx,
GLenum new_type,
GLuint count,
GLenum old_type,
CONST void *indices )
{
ACcontext *ac = AC_CONTEXT(ctx);
if (old_type == new_type)
return indices;
if (ac->elt_size < count * sizeof(GLuint)) {
if (ac->Elts) FREE(ac->Elts);
while (ac->elt_size < count * sizeof(GLuint))
ac->elt_size *= 2;
ac->Elts = (GLuint *) MALLOC(ac->elt_size);
}
switch (new_type) {
case GL_UNSIGNED_BYTE:
ASSERT(0);
return NULL;
case GL_UNSIGNED_SHORT:
ASSERT(0);
return NULL;
case GL_UNSIGNED_INT: {
GLuint *out = (GLuint *)ac->Elts;
GLuint i;
switch (old_type) {
case GL_UNSIGNED_BYTE: {
CONST GLubyte *in = (CONST GLubyte *)indices;
for (i = 0 ; i < count ; i++)
out[i] = in[i];
break;
}
case GL_UNSIGNED_SHORT: {
CONST GLushort *in = (CONST GLushort *)indices;
for (i = 0 ; i < count ; i++)
out[i] = in[i];
break;
}
default:
ASSERT(0);
}
return (CONST void *)out;
}
default:
ASSERT(0);
break;
}
return NULL;
}

View file

@ -1,132 +0,0 @@
/*
* Mesa 3-D graphics library
* Version: 4.1
*
* Copyright (C) 1999-2002 Brian Paul 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, sublicense,
* 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL 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.
*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
*/
#ifndef _ARRAYCACHE_H
#define _ARRAYCACHE_H
#include "mtypes.h"
extern GLboolean
_ac_CreateContext( GLcontext *ctx );
extern void
_ac_DestroyContext( GLcontext *ctx );
extern void
_ac_InvalidateState( GLcontext *ctx, GLuint new_state );
extern struct gl_client_array *
_ac_import_vertex( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLuint reqsize,
GLboolean reqwritable,
GLboolean *writable );
extern struct gl_client_array *
_ac_import_normal( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLboolean reqwritable,
GLboolean *writable );
extern struct gl_client_array *
_ac_import_color( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLuint reqsize,
GLboolean reqwritable,
GLboolean *writable );
extern struct gl_client_array *
_ac_import_index( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLboolean reqwritable,
GLboolean *writable );
extern struct gl_client_array *
_ac_import_secondarycolor( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLuint reqsize,
GLboolean reqwritable,
GLboolean *writable );
extern struct gl_client_array *
_ac_import_fogcoord( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLboolean reqwritable,
GLboolean *writable );
extern struct gl_client_array *
_ac_import_edgeflag( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLboolean reqwritable,
GLboolean *writable );
extern struct gl_client_array *
_ac_import_texcoord( GLcontext *ctx,
GLuint unit,
GLenum type,
GLuint reqstride,
GLuint reqsize,
GLboolean reqwritable,
GLboolean *writable );
extern struct gl_client_array *
_ac_import_attrib( GLcontext *ctx,
GLuint index,
GLenum type,
GLuint reqstride,
GLuint reqsize,
GLboolean reqwritable,
GLboolean *writable );
/* Clients must call this function to validate state and set bounds
* before importing any data:
*/
extern void
_ac_import_range( GLcontext *ctx, GLuint start, GLuint count );
/* Additional convenience function:
*/
extern CONST void *
_ac_import_elements( GLcontext *ctx,
GLenum new_type,
GLuint count,
GLenum old_type,
CONST void *indices );
#endif

View file

@ -1,37 +0,0 @@
# Makefile for core library for VMS
# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl
# Last revision : 16 June 2003
.first
define gl [---.include.gl]
define math [-.math]
define array_cache [-.array_cache]
.include [---]mms-config.
##### MACROS #####
VPATH = RCS
INCDIR = [---.include],[-.main],[-.glapi]
LIBDIR = [---.lib]
CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)/float=ieee/ieee=denorm
SOURCES = ac_context.c ac_import.c
OBJECTS = ac_context.obj,ac_import.obj
##### RULES #####
VERSION=Mesa V3.4
##### TARGETS #####
# Make the library
$(LIBDIR)$(GL_LIB) : $(OBJECTS)
@ library $(LIBDIR)$(GL_LIB) $(OBJECTS)
clean :
purge
delete *.obj;*
ac_context.obj : ac_context.c
ac_import.obj : ac_import.c

View file

@ -1,7 +0,0 @@
MESA_ARRAY_CACHE_SOURCES = \
ac_context.c \
ac_import.c
MESA_ARRAY_CACHE_HEADERS = \
ac_context.h \
acache.h

View file

@ -46,7 +46,7 @@
#include "texformat.h"
#include "teximage.h"
#include "texstore.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"

View file

@ -50,7 +50,7 @@
#include "extensions.h"
#include "framebuffer.h"
#include "renderbuffer.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
@ -93,7 +93,7 @@ update_state( GLcontext *ctx, GLuint new_state )
/* not much to do here - pass it on */
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
_ac_InvalidateState( ctx, new_state );
_vbo_InvalidateState( ctx, new_state );
_tnl_InvalidateState( ctx, new_state );
}
@ -365,7 +365,7 @@ fbCreateContext( const __GLcontextModes *glVisual,
/* Create module contexts */
_swrast_CreateContext( ctx );
_ac_CreateContext( ctx );
_vbo_CreateContext( ctx );
_tnl_CreateContext( ctx );
_swsetup_CreateContext( ctx );
_swsetup_Wakeup( ctx );
@ -399,7 +399,7 @@ fbDestroyContext( __DRIcontextPrivate *driContextPriv )
if ( fbmesa ) {
_swsetup_DestroyContext( fbmesa->glCtx );
_tnl_DestroyContext( fbmesa->glCtx );
_ac_DestroyContext( fbmesa->glCtx );
_vbo_DestroyContext( fbmesa->glCtx );
_swrast_DestroyContext( fbmesa->glCtx );
/* free the Mesa context */

View file

@ -17,7 +17,7 @@
#include "extensions.h"
#include "framebuffer.h"
#include "renderbuffer.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
@ -388,7 +388,7 @@ update_state( GLcontext *ctx, GLuint new_state )
/* not much to do here - pass it on */
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
_ac_InvalidateState( ctx, new_state );
_vbo_InvalidateState( ctx, new_state );
_tnl_InvalidateState( ctx, new_state );
}
@ -491,7 +491,7 @@ fbCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext sh
/* Create module contexts */
_swrast_CreateContext( ctx );
_ac_CreateContext( ctx );
_vbo_CreateContext( ctx );
_tnl_CreateContext( ctx );
_swsetup_CreateContext( ctx );
_swsetup_Wakeup( ctx );

View file

@ -40,7 +40,7 @@
#include "enums.h"
#include "swrast/swrast.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
#include "swrast_setup/swrast_setup.h"
@ -1034,7 +1034,7 @@ static void ffbDDUpdateState(GLcontext *ctx, GLuint newstate)
_swrast_InvalidateState( ctx, newstate );
_swsetup_InvalidateState( ctx, newstate );
_ac_InvalidateState( ctx, newstate );
_vbo_InvalidateState( ctx, newstate );
_tnl_InvalidateState( ctx, newstate );
if (newstate & _NEW_TEXTURE)

View file

@ -38,7 +38,7 @@
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
#include "tnl/t_pipeline.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "drivers/common/driverfuncs.h"
#include "ffb_context.h"
@ -277,7 +277,7 @@ ffbCreateContext(const __GLcontextModes *mesaVis,
/* Initialize the software rasterizer and helper modules. */
_swrast_CreateContext( ctx );
_ac_CreateContext( ctx );
_vbo_CreateContext( ctx );
_tnl_CreateContext( ctx );
_swsetup_CreateContext( ctx );
@ -313,7 +313,7 @@ ffbDestroyContext(__DRIcontextPrivate *driContextPriv)
_swsetup_DestroyContext( fmesa->glCtx );
_tnl_DestroyContext( fmesa->glCtx );
_ac_DestroyContext( fmesa->glCtx );
_vbo_DestroyContext( fmesa->glCtx );
_swrast_DestroyContext( fmesa->glCtx );
/* free the Mesa context */

View file

@ -28,7 +28,7 @@
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
#include "tnl/t_pipeline.h"
@ -147,7 +147,7 @@ GLboolean gammaCreateContext( const __GLcontextModes *glVisual,
/* Initialize the software rasterizer and helper modules.
*/
_swrast_CreateContext( ctx );
_ac_CreateContext( ctx );
_vbo_CreateContext( ctx );
_tnl_CreateContext( ctx );
_swsetup_CreateContext( ctx );

View file

@ -33,7 +33,7 @@
#include "colormac.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
#define ENABLELIGHTING 0
@ -1663,7 +1663,7 @@ static void gammaDDUpdateState( GLcontext *ctx, GLuint new_state )
{
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
_ac_InvalidateState( ctx, new_state );
_vbo_InvalidateState( ctx, new_state );
_tnl_InvalidateState( ctx, new_state );
GAMMA_CONTEXT(ctx)->new_gl_state |= new_state;
}

View file

@ -34,7 +34,7 @@
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
static GLboolean
gammaInitDriver(__DRIscreenPrivate *sPriv)
@ -57,7 +57,7 @@ gammaDestroyContext(__DRIcontextPrivate *driContextPriv)
if (gmesa) {
_swsetup_DestroyContext( gmesa->glCtx );
_tnl_DestroyContext( gmesa->glCtx );
_ac_DestroyContext( gmesa->glCtx );
_vbo_DestroyContext( gmesa->glCtx );
_swrast_DestroyContext( gmesa->glCtx );
gammaFreeVB( gmesa->glCtx );

View file

@ -44,7 +44,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/t_pipeline.h"
@ -287,7 +287,7 @@ i810CreateContext( const __GLcontextModes *mesaVis,
/* Initialize the software rasterizer and helper modules.
*/
_swrast_CreateContext( ctx );
_ac_CreateContext( ctx );
_vbo_CreateContext( ctx );
_tnl_CreateContext( ctx );
_swsetup_CreateContext( ctx );
@ -350,7 +350,7 @@ i810DestroyContext(__DRIcontextPrivate *driContextPriv)
release_texture_heaps = (imesa->glCtx->Shared->RefCount == 1);
_swsetup_DestroyContext( imesa->glCtx );
_tnl_DestroyContext( imesa->glCtx );
_ac_DestroyContext( imesa->glCtx );
_vbo_DestroyContext( imesa->glCtx );
_swrast_DestroyContext( imesa->glCtx );
i810FreeVB( imesa->glCtx );

View file

@ -21,8 +21,8 @@
#include "i810ioctl.h"
#include "swrast/swrast.h"
#include "array_cache/acache.h"
#include "tnl/tnl.h"
#include "vbo/vbo.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/t_pipeline.h"
@ -953,7 +953,7 @@ static void i810InvalidateState( GLcontext *ctx, GLuint new_state )
{
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
_ac_InvalidateState( ctx, new_state );
_vbo_InvalidateState( ctx, new_state );
_tnl_InvalidateState( ctx, new_state );
I810_CONTEXT(ctx)->new_state |= new_state;
}

View file

@ -36,7 +36,8 @@
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "utils.h"
#include "i915_reg.h"
@ -63,7 +64,7 @@ static void i915InvalidateState( GLcontext *ctx, GLuint new_state )
{
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
_ac_InvalidateState( ctx, new_state );
_vbo_InvalidateState( ctx, new_state );
_tnl_InvalidateState( ctx, new_state );
_tnl_invalidate_vertex_state( ctx, new_state );
INTEL_CONTEXT(ctx)->NewGLState |= new_state;

View file

@ -37,7 +37,7 @@
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/t_pipeline.h"
#include "tnl/t_vertex.h"
@ -228,7 +228,7 @@ static void intelInvalidateState( GLcontext *ctx, GLuint new_state )
{
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
_ac_InvalidateState( ctx, new_state );
_vbo_InvalidateState( ctx, new_state );
_tnl_InvalidateState( ctx, new_state );
_tnl_invalidate_vertex_state( ctx, new_state );
INTEL_CONTEXT(ctx)->NewGLState |= new_state;
@ -304,7 +304,7 @@ GLboolean intelInitContext( intelContextPtr intel,
/* Initialize the software rasterizer and helper modules. */
_swrast_CreateContext( ctx );
_ac_CreateContext( ctx );
_vbo_CreateContext( ctx );
_tnl_CreateContext( ctx );
_swsetup_CreateContext( ctx );
@ -423,7 +423,7 @@ void intelDestroyContext(__DRIcontextPrivate *driContextPriv)
release_texture_heaps = (intel->ctx.Shared->RefCount == 1);
_swsetup_DestroyContext (&intel->ctx);
_tnl_DestroyContext (&intel->ctx);
_ac_DestroyContext (&intel->ctx);
_vbo_DestroyContext (&intel->ctx);
_swrast_DestroyContext (&intel->ctx);
intel->Fallback = 0; /* don't call _swrast_Flush later */

View file

@ -36,7 +36,6 @@
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
#include "array_cache/acache.h"
#include "utils.h"
#include "i915_reg.h"
@ -67,7 +66,7 @@ i915InvalidateState(GLcontext * ctx, GLuint new_state)
{
_swrast_InvalidateState(ctx, new_state);
_swsetup_InvalidateState(ctx, new_state);
_ac_InvalidateState(ctx, new_state);
_vbo_InvalidateState(ctx, new_state);
_tnl_InvalidateState(ctx, new_state);
_tnl_invalidate_vertex_state(ctx, new_state);
intel_context(ctx)->NewGLState |= new_state;

View file

@ -37,7 +37,6 @@
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
#include "array_cache/acache.h"
#include "tnl/t_pipeline.h"
#include "tnl/t_vertex.h"
@ -241,7 +240,7 @@ intelInvalidateState(GLcontext * ctx, GLuint new_state)
{
_swrast_InvalidateState(ctx, new_state);
_swsetup_InvalidateState(ctx, new_state);
_ac_InvalidateState(ctx, new_state);
_vbo_InvalidateState(ctx, new_state);
_tnl_InvalidateState(ctx, new_state);
_tnl_invalidate_vertex_state(ctx, new_state);
intel_context(ctx)->NewGLState |= new_state;
@ -394,7 +393,7 @@ intelInitContext(struct intel_context *intel,
/* Initialize the software rasterizer and helper modules. */
_swrast_CreateContext(ctx);
_ac_CreateContext(ctx);
_vbo_CreateContext(ctx);
_tnl_CreateContext(ctx);
_swsetup_CreateContext(ctx);
@ -504,7 +503,7 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv)
release_texture_heaps = (intel->ctx.Shared->RefCount == 1);
_swsetup_DestroyContext(&intel->ctx);
_tnl_DestroyContext(&intel->ctx);
_ac_DestroyContext(&intel->ctx);
_vbo_DestroyContext(&intel->ctx);
_swrast_DestroyContext(&intel->ctx);
intel->Fallback = 0; /* don't call _swrast_Flush later */

View file

@ -35,17 +35,11 @@ DRIVER_SOURCES = \
brw_context.c \
brw_curbe.c \
brw_draw.c \
brw_draw_current.c \
brw_draw_upload.c \
brw_eu.c \
brw_eu_debug.c \
brw_eu_emit.c \
brw_eu_util.c \
brw_exec.c \
brw_exec_api.c \
brw_exec_array.c \
brw_exec_draw.c \
brw_exec_eval.c \
brw_fallback.c \
brw_gs.c \
brw_gs_emit.c \
@ -54,9 +48,6 @@ DRIVER_SOURCES = \
brw_metaops.c \
brw_misc_state.c \
brw_program.c \
brw_save.c \
brw_save_api.c \
brw_save_draw.c \
brw_sf.c \
brw_sf_emit.c \
brw_sf_state.c \

View file

@ -116,7 +116,7 @@ struct brw_clip_compile {
GLuint last_mrf;
GLuint header_position_offset;
GLuint offset[BRW_ATTRIB_MAX];
GLuint offset[VERT_ATTRIB_MAX];
};
#define ATTR_SIZE (4*4)

View file

@ -34,8 +34,6 @@
#include "brw_aub.h"
#include "brw_defines.h"
#include "brw_draw.h"
#include "brw_exec.h"
#include "brw_save.h"
#include "brw_vs.h"
#include "imports.h"
#include "intel_tex.h"
@ -158,12 +156,6 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
brw_FrameBufferTexInit( brw );
/* Hook our functions into exec and compile dispatch tables. Only
* fallback on out-of-memory situations.
*/
brw_exec_init( ctx );
brw_save_init( ctx );
{
const char *filename = getenv("INTEL_REPLAY");
if (filename) {

View file

@ -36,7 +36,6 @@
#include "intel_context.h"
#include "brw_structs.h"
#include "imports.h"
#include "brw_attrib.h"
/* Glossary:
@ -215,7 +214,7 @@ struct brw_vs_prog_data {
GLuint total_grf;
GLuint outputs_written;
GLuint64EXT inputs_read;
GLuint inputs_read;
/* Used for calculating urb partitions:
*/
@ -382,10 +381,10 @@ struct brw_cached_batch_item {
/* Protect against a future where BRW_ATTRIB_MAX > 32. Wouldn't life
/* Protect against a future where VERT_ATTRIB_MAX > 32. Wouldn't life
* be easier if C allowed arrays of packed elements?
*/
#define ATTRIB_BIT_DWORDS ((BRW_ATTRIB_MAX+31)/32)
#define ATTRIB_BIT_DWORDS ((VERT_ATTRIB_MAX+31)/32)
struct brw_vertex_element {
const struct gl_client_array *glarray;
@ -401,8 +400,8 @@ struct brw_vertex_element {
struct brw_vertex_info {
GLuint64EXT varying; /* varying:1[BRW_ATTRIB_MAX] */
GLuint sizes[ATTRIB_BIT_DWORDS * 2]; /* sizes:2[BRW_ATTRIB_MAX] */
GLuint varying; /* varying:1[VERT_ATTRIB_MAX] */
GLuint sizes[ATTRIB_BIT_DWORDS * 2]; /* sizes:2[VERT_ATTRIB_MAX] */
};
@ -449,14 +448,13 @@ struct brw_context
struct brw_cached_batch_item *cached_batch_items;
struct {
/* Fallback values for inputs not supplied:
*/
struct gl_client_array current_values[BRW_ATTRIB_MAX];
/* Arrays with buffer objects to copy non-bufferobj arrays into
* for upload:
*/
struct gl_client_array vbo_array[BRW_ATTRIB_MAX];
struct gl_client_array vbo_array[VERT_ATTRIB_MAX];
struct brw_vertex_element inputs[VERT_ATTRIB_MAX];
#define BRW_NR_UPLOAD_BUFS 17
#define BRW_UPLOAD_INIT_SIZE (128*1024)
@ -469,11 +467,6 @@ struct brw_context
GLuint wrap;
} upload;
/* Currenly bound arrays, including fallbacks to current_values
* above:
*/
struct brw_vertex_element inputs[BRW_ATTRIB_MAX];
/* Summary of size and varying of active arrays, so we can check
* for changes to this state:
*/

View file

@ -35,7 +35,6 @@
#include "brw_draw.h"
#include "brw_defines.h"
#include "brw_attrib.h"
#include "brw_context.h"
#include "brw_aub.h"
#include "brw_state.h"
@ -45,7 +44,8 @@
#include "intel_batchbuffer.h"
#include "intel_buffer_objects.h"
#include "tnl/tnl.h"
#include "vbo/vbo_context.h"
@ -143,7 +143,7 @@ static void brw_emit_cliprect( struct brw_context *brw,
static void brw_emit_prim( struct brw_context *brw,
const struct brw_draw_prim *prim )
const struct _mesa_prim *prim )
{
struct brw_3d_primitive prim_packet;
@ -170,34 +170,9 @@ static void brw_emit_prim( struct brw_context *brw,
}
}
static void update_current_size( struct gl_client_array *array)
{
const GLfloat *ptr = (const GLfloat *)array->Ptr;
assert(array->StrideB == 0);
assert(array->Type == GL_FLOAT || array->Type == GL_UNSIGNED_BYTE);
if (ptr[3] != 1.0)
array->Size = 4;
else if (ptr[2] != 0.0)
array->Size = 3;
else if (ptr[1] != 0.0)
array->Size = 2;
else
array->Size = 1;
}
/* Fill in any gaps in passed arrays with pointers to current
* attributes:
*/
static void brw_merge_inputs( struct brw_context *brw,
const struct gl_client_array *arrays[])
{
struct gl_client_array *current_values = brw->vb.current_values;
struct brw_vertex_element *inputs = brw->vb.inputs;
struct brw_vertex_info old = brw->vb.info;
GLuint i;
@ -205,19 +180,16 @@ static void brw_merge_inputs( struct brw_context *brw,
memset(inputs, 0, sizeof(*inputs));
memset(&brw->vb.info, 0, sizeof(brw->vb.info));
for (i = 0; i < BRW_ATTRIB_MAX; i++) {
if (arrays[i] && arrays[i]->Enabled)
{
brw->vb.inputs[i].glarray = arrays[i];
brw->vb.info.varying |= (GLuint64EXT) 1 << i;
}
else
{
brw->vb.inputs[i].glarray = &current_values[i];
update_current_size(&current_values[i]);
}
for (i = 0; i < VERT_ATTRIB_MAX; i++) {
brw->vb.inputs[i].glarray = arrays[i];
brw->vb.info.sizes[i/16] |= (inputs[i].glarray->Size - 1) << ((i%16) * 2);
/* XXX: metaops passes null arrays */
if (arrays[i]) {
if (arrays[i]->StrideB != 0)
brw->vb.info.varying |= 1 << i;
brw->vb.info.sizes[i/16] |= (inputs[i].glarray->Size - 1) << ((i%16) * 2);
}
}
/* Raise statechanges if input sizes and varying have changed:
@ -229,8 +201,11 @@ static void brw_merge_inputs( struct brw_context *brw,
brw->state.dirty.brw |= BRW_NEW_INPUT_VARYING;
}
/* XXX: could split the primitive list to fallback only on the
* non-conformant primitives.
*/
static GLboolean check_fallbacks( struct brw_context *brw,
const struct brw_draw_prim *prim,
const struct _mesa_prim *prim,
GLuint nr_prims )
{
GLuint i;
@ -281,15 +256,16 @@ static GLboolean check_fallbacks( struct brw_context *brw,
return GL_FALSE;
}
/* May fail if out of video memory for texture or vbo upload, or on
* fallback conditions.
*/
static GLboolean brw_try_draw_prims( GLcontext *ctx,
const struct gl_client_array *arrays[],
const struct brw_draw_prim *prim,
const struct _mesa_prim *prim,
GLuint nr_prims,
const struct brw_draw_index_buffer *ib,
const struct _mesa_index_buffer *ib,
GLuint min_index,
GLuint max_index,
GLuint flags )
GLuint max_index )
{
struct intel_context *intel = intel_context(ctx);
struct brw_context *brw = brw_context(ctx);
@ -298,11 +274,11 @@ static GLboolean brw_try_draw_prims( GLcontext *ctx,
if (ctx->NewState)
_mesa_update_state( ctx );
/* Bind all inputs, derive varying and size information:
*/
brw_merge_inputs( brw, arrays );
/* Have to validate state quite late. Will rebuild tnl_program,
* which depends on varying information.
*
@ -319,10 +295,6 @@ static GLboolean brw_try_draw_prims( GLcontext *ctx,
}
{
assert(intel->locked);
/* Set the first primitive early, ahead of validate_state:
*/
brw_set_prim(brw, prim[0].mode);
@ -411,44 +383,88 @@ static GLboolean brw_try_draw_prims( GLcontext *ctx,
return retval;
}
static GLboolean brw_need_rebase( GLcontext *ctx,
const struct gl_client_array *arrays[],
const struct _mesa_index_buffer *ib,
GLuint min_index )
{
if (min_index == 0)
return GL_FALSE;
GLboolean brw_draw_prims( GLcontext *ctx,
const struct gl_client_array *arrays[],
const struct brw_draw_prim *prim,
GLuint nr_prims,
const struct brw_draw_index_buffer *ib,
GLuint min_index,
GLuint max_index,
GLuint flags )
if (ib) {
if (!vbo_all_varyings_in_vbos(arrays))
return GL_TRUE;
else
return GL_FALSE;
}
else {
/* Hmm. This isn't quite what I wanted. BRW can actually
* handle the mixed case well enough that we shouldn't need to
* rebase. However, it's probably not very common, nor hugely
* expensive to do it this way:
*/
if (!vbo_all_varyings_in_vbos(arrays))
return GL_TRUE;
else
return GL_FALSE;
}
}
void brw_draw_prims( GLcontext *ctx,
const struct gl_client_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,
GLuint min_index,
GLuint max_index )
{
struct intel_context *intel = intel_context(ctx);
GLboolean retval;
retval = brw_try_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index, flags);
/* Decide if we want to rebase. If so we end up recursing once
* only into this function.
*/
if (brw_need_rebase( ctx, arrays, ib, min_index )) {
vbo_rebase_prims( ctx, arrays,
prim, nr_prims,
ib, min_index, max_index,
brw_draw_prims );
return;
}
/* Make a first attempt at drawing:
*/
retval = brw_try_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index);
if (!retval && bmError(intel)) {
/* This looks like out-of-memory but potentially we have
* situation where there is enough memory but it has become
* fragmented. Clear out all heaps and start from scratch by
* faking a contended lock event: (done elsewhere)
*/
if (!retval && !intel->Fallback && bmError(intel)) {
DBG("retrying\n");
/* This looks like out-of-memory but potentially we have
* situation where there is enough memory but it has become
* fragmented. Clear out all heaps and start from scratch by
* faking a contended lock event: (done elsewhere)
*/
/* Then try a second time only to upload textures and draw the
* primitives:
*/
retval = brw_try_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index, flags);
retval = brw_try_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index);
}
/* Otherwise, we really are out of memory. Pass the drawing
* command to the software tnl module and which will in turn call
* swrast to do the drawing.
*/
if (!retval) {
_tnl_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index);
}
if (intel->aub_file && (INTEL_DEBUG & DEBUG_SYNC)) {
intelFinish( &intel->ctx );
intel->aub_wrap = 1;
}
return retval;
}
@ -461,21 +477,25 @@ static void brw_invalidate_vbo_cb( struct intel_context *intel, void *ptr )
void brw_draw_init( struct brw_context *brw )
{
GLcontext *ctx = &brw->intel.ctx;
struct vbo_context *vbo = vbo_context(ctx);
GLuint i;
/* Register our drawing function:
*/
vbo->draw_prims = brw_draw_prims;
brw->vb.upload.size = BRW_UPLOAD_INIT_SIZE;
for (i = 0; i < BRW_NR_UPLOAD_BUFS; i++) {
brw->vb.upload.vbo[i] = ctx->Driver.NewBufferObject(ctx, 1, GL_ARRAY_BUFFER_ARB);
/* XXX: Set these to no-backing-store
/* NOTE: These are set to no-backing-store.
*/
bmBufferSetInvalidateCB(&brw->intel,
intel_bufferobj_buffer(intel_buffer_object(brw->vb.upload.vbo[i])),
brw_invalidate_vbo_cb,
&brw->intel,
GL_TRUE);
}
ctx->Driver.BufferData( ctx,
@ -484,9 +504,6 @@ void brw_draw_init( struct brw_context *brw )
NULL,
GL_DYNAMIC_DRAW_ARB,
brw->vb.upload.vbo[0] );
brw_init_current_values(ctx, brw->vb.current_values);
}
void brw_draw_destroy( struct brw_context *brw )

View file

@ -29,44 +29,18 @@
#define BRW_DRAW_H
#include "mtypes.h" /* for GLcontext... */
#include "brw_attrib.h"
#include "vbo/vbo.h"
struct brw_context;
struct brw_draw_prim {
GLuint mode:8;
GLuint indexed:1;
GLuint begin:1;
GLuint end:1;
GLuint weak:1;
GLuint pad:20;
GLuint start;
GLuint count;
};
struct brw_draw_index_buffer {
GLuint count;
GLenum type;
struct gl_buffer_object *obj;
const void *ptr;
GLuint rebase;
};
#define BRW_DRAW_SORTED 0x1
#define BRW_DRAW_ALL_INTERLEAVED 0x2
#define BRW_DRAW_NON_INTERLEAVED 0x4
#define BRW_DRAW_LOCKED 0x8
GLboolean brw_draw_prims( GLcontext *ctx,
const struct gl_client_array *arrays[],
const struct brw_draw_prim *prims,
GLuint nr_prims,
const struct brw_draw_index_buffer *ib,
GLuint min_index,
GLuint max_index,
GLuint flags );
void brw_draw_prims( GLcontext *ctx,
const struct gl_client_array *arrays[],
const struct _mesa_prim *prims,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,
GLuint min_index,
GLuint max_index );
void brw_draw_init( struct brw_context *brw );
void brw_draw_destroy( struct brw_context *brw );
@ -80,25 +54,12 @@ void brw_init_current_values(GLcontext *ctx,
/* brw_draw_upload.c
*/
void brw_upload_indices( struct brw_context *brw,
const struct brw_draw_index_buffer *index_buffer);
const struct _mesa_index_buffer *index_buffer);
GLboolean brw_upload_vertices( struct brw_context *brw,
GLuint min_index,
GLuint max_index );
/* Helpers for save, exec. Should probably have their own file:
*/
struct brw_exec_context;
struct brw_save_context;
struct brw_exec_save {
struct brw_exec_context *exec;
struct brw_save_context *save;
};
/* Doesn't really belong here:
*/
#define IMM_CONTEXT(ctx) ((struct brw_exec_save *)((ctx)->swtnl_im))
#endif

View file

@ -1,103 +0,0 @@
/**************************************************************************
*
* Copyright 2003 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 <stdlib.h>
#include "glheader.h"
#include "context.h"
#include "state.h"
#include "api_validate.h"
#include "enums.h"
#include "brw_context.h"
#include "brw_draw.h"
#include "bufmgr.h"
#include "intel_buffer_objects.h"
void brw_init_current_values(GLcontext *ctx,
struct gl_client_array *arrays)
{
GLuint i;
memset(arrays, 0, sizeof(*arrays) * BRW_ATTRIB_MAX);
/* Set up a constant (StrideB == 0) array for each current
* attribute:
*/
for (i = 0; i < BRW_ATTRIB_MAX; i++) {
struct gl_client_array *cl = &arrays[i];
switch (i) {
case BRW_ATTRIB_MAT_FRONT_SHININESS:
case BRW_ATTRIB_MAT_BACK_SHININESS:
case BRW_ATTRIB_INDEX:
case BRW_ATTRIB_EDGEFLAG:
cl->Size = 1;
break;
case BRW_ATTRIB_MAT_FRONT_INDEXES:
case BRW_ATTRIB_MAT_BACK_INDEXES:
cl->Size = 3;
break;
default:
/* This is fixed for the material attributes, for others will
* be determined at runtime:
*/
if (i >= BRW_ATTRIB_MAT_FRONT_AMBIENT)
cl->Size = 4;
else
cl->Size = 1;
break;
}
switch (i) {
case BRW_ATTRIB_EDGEFLAG:
cl->Type = GL_UNSIGNED_BYTE;
cl->Ptr = (const void *)&ctx->Current.EdgeFlag;
break;
case BRW_ATTRIB_INDEX:
cl->Type = GL_FLOAT;
cl->Ptr = (const void *)&ctx->Current.Index;
break;
default:
cl->Type = GL_FLOAT;
if (i < BRW_ATTRIB_FIRST_MATERIAL)
cl->Ptr = (const void *)ctx->Current.Attrib[i];
else
cl->Ptr = (const void *)ctx->Light.Material.Attrib[i - BRW_ATTRIB_FIRST_MATERIAL];
break;
}
cl->Stride = 0;
cl->StrideB = 0;
cl->Enabled = 1;
cl->Flags = 0;
cl->BufferObj = ctx->Array.NullBufferObj;
}
}

View file

@ -35,7 +35,6 @@
#include "brw_draw.h"
#include "brw_defines.h"
#include "brw_attrib.h"
#include "brw_context.h"
#include "brw_aub.h"
#include "brw_state.h"
@ -310,7 +309,6 @@ copy_array_to_vbo_array( struct brw_context *brw,
GLuint i,
const struct gl_client_array *array,
GLuint element_size,
GLuint min_index,
GLuint count)
{
GLcontext *ctx = &brw->intel.ctx;
@ -337,7 +335,6 @@ copy_array_to_vbo_array( struct brw_context *brw,
vbo_array->Enabled = 1;
vbo_array->Normalized = array->Normalized;
vbo_array->_MaxElement = array->_MaxElement; /* ? */
vbo_array->Flags = array->Flags; /* ? */
vbo_array->BufferObj = vbo;
{
@ -349,7 +346,7 @@ copy_array_to_vbo_array( struct brw_context *brw,
map += offset;
copy_strided_array( map,
array->Ptr + min_index * array->StrideB,
array->Ptr,
element_size,
array->StrideB,
count);
@ -380,7 +377,6 @@ interleaved_vbo_array( struct brw_context *brw,
vbo_array->Enabled = 1;
vbo_array->Normalized = array->Normalized;
vbo_array->_MaxElement = array->_MaxElement;
vbo_array->Flags = array->Flags; /* ? */
vbo_array->BufferObj = uploaded_array->BufferObj;
return vbo_array;
@ -393,17 +389,17 @@ GLboolean brw_upload_vertices( struct brw_context *brw,
{
GLcontext *ctx = &brw->intel.ctx;
struct intel_context *intel = intel_context(ctx);
GLuint64EXT tmp = brw->vs.prog_data->inputs_read;
GLuint tmp = brw->vs.prog_data->inputs_read;
struct brw_vertex_element_packet vep;
struct brw_array_state vbp;
GLuint i;
const void *ptr = NULL;
GLuint interleave = 0;
struct brw_vertex_element *enabled[BRW_ATTRIB_MAX];
struct brw_vertex_element *enabled[VERT_ATTRIB_MAX];
GLuint nr_enabled = 0;
struct brw_vertex_element *upload[BRW_ATTRIB_MAX];
struct brw_vertex_element *upload[VERT_ATTRIB_MAX];
GLuint nr_uploads = 0;
@ -412,17 +408,19 @@ GLboolean brw_upload_vertices( struct brw_context *brw,
/* First build an array of pointers to ve's in vb.inputs_read
*/
if (0)
_mesa_printf("%s %d..%d\n", __FUNCTION__, min_index, max_index);
while (tmp) {
GLuint i = _mesa_ffsll(tmp)-1;
struct brw_vertex_element *input = &brw->vb.inputs[i];
tmp &= ~((GLuint64EXT)1<<i);
tmp &= ~(1<<i);
enabled[nr_enabled++] = input;
input->index = i;
input->element_size = get_size(input->glarray->Type) * input->glarray->Size;
input->count = input->glarray->StrideB ? max_index - min_index : 1;
input->count = input->glarray->StrideB ? max_index + 1 - min_index : 1;
if (!input->glarray->BufferObj->Name) {
if (i == 0) {
@ -441,10 +439,16 @@ GLboolean brw_upload_vertices( struct brw_context *brw,
}
upload[nr_uploads++] = input;
input->vbo_rebase_offset = 0;
/* We rebase drawing to start at element zero only when
* varyings are not in vbos, which means we can end up
* uploading non-varying arrays (stride != 0) when min_index
* is zero. This doesn't matter as the amount to upload is
* the same for these arrays whether the draw call is rebased
* or not - we just have to upload the one element.
*/
assert(min_index == 0 || input->glarray->StrideB == 0);
}
else
input->vbo_rebase_offset = min_index * input->glarray->StrideB;
}
/* Upload interleaved arrays if all uploads are interleaved
@ -457,7 +461,6 @@ GLboolean brw_upload_vertices( struct brw_context *brw,
input0->glarray = copy_array_to_vbo_array(brw, 0,
input0->glarray,
interleave,
min_index,
input0->count);
for (i = 1; i < nr_uploads; i++) {
@ -475,7 +478,6 @@ GLboolean brw_upload_vertices( struct brw_context *brw,
input->glarray = copy_array_to_vbo_array(brw, i,
input->glarray,
input->element_size,
min_index,
input->count);
}
@ -523,9 +525,9 @@ GLboolean brw_upload_vertices( struct brw_context *brw,
vbp.vb[i].vb0.bits.pad = 0;
vbp.vb[i].vb0.bits.access_type = BRW_VERTEXBUFFER_ACCESS_VERTEXDATA;
vbp.vb[i].vb0.bits.vb_index = i;
vbp.vb[i].offset = (GLuint)input->glarray->Ptr + input->vbo_rebase_offset;
vbp.vb[i].offset = (GLuint)input->glarray->Ptr;
vbp.vb[i].buffer = array_buffer(input->glarray);
vbp.vb[i].max_index = max_index - min_index;
vbp.vb[i].max_index = max_index;
}
@ -566,93 +568,31 @@ static GLuint element_size( GLenum type )
static void rebase_indices_to_vbo_indices( struct brw_context *brw,
const struct brw_draw_index_buffer *index_buffer,
struct gl_buffer_object **vbo_return,
GLuint *offset_return )
void brw_upload_indices( struct brw_context *brw,
const struct _mesa_index_buffer *index_buffer )
{
GLcontext *ctx = &brw->intel.ctx;
GLuint min_index = index_buffer->rebase;
const void *indices = index_buffer->ptr;
GLsizei count = index_buffer->count;
GLenum type = index_buffer->type;
GLuint size = element_size(type) * count;
struct gl_buffer_object *bufferobj;
GLuint offset;
GLuint i;
get_space(brw, size, &bufferobj, &offset);
*vbo_return = bufferobj;
*offset_return = offset;
if (min_index == 0) {
/* Straight upload
*/
ctx->Driver.BufferSubData( ctx,
GL_ELEMENT_ARRAY_BUFFER_ARB,
offset,
size,
indices,
bufferobj);
}
else {
void *map = ctx->Driver.MapBuffer(ctx,
GL_ELEMENT_ARRAY_BUFFER_ARB,
GL_DYNAMIC_DRAW_ARB,
bufferobj);
map += offset;
switch (type) {
case GL_UNSIGNED_INT: {
GLuint *ui_map = (GLuint *)map;
const GLuint *ui_indices = (const GLuint *)indices;
for (i = 0; i < count; i++)
ui_map[i] = ui_indices[i] - min_index;
break;
}
case GL_UNSIGNED_SHORT: {
GLushort *us_map = (GLushort *)map;
const GLushort *us_indices = (const GLushort *)indices;
for (i = 0; i < count; i++)
us_map[i] = us_indices[i] - min_index;
break;
}
case GL_UNSIGNED_BYTE: {
GLubyte *ub_map = (GLubyte *)map;
const GLubyte *ub_indices = (const GLubyte *)indices;
for (i = 0; i < count; i++)
ub_map[i] = ub_indices[i] - min_index;
break;
}
}
ctx->Driver.UnmapBuffer(ctx,
GL_ELEMENT_ARRAY_BUFFER_ARB,
bufferobj);
}
}
void brw_upload_indices( struct brw_context *brw,
const struct brw_draw_index_buffer *index_buffer)
{
struct intel_context *intel = &brw->intel;
GLuint ib_size = get_size(index_buffer->type) * index_buffer->count;
struct gl_buffer_object *bufferobj = index_buffer->obj;
GLuint offset = (GLuint)index_buffer->ptr;
/* Already turned into a proper VBO:
/* Turn into a proper VBO:
*/
if (!index_buffer->obj->Name) {
rebase_indices_to_vbo_indices(brw, index_buffer, &bufferobj, &offset );
if (!bufferobj->Name) {
/* Get new bufferobj, offset:
*/
get_space(brw, ib_size, &bufferobj, &offset);
/* Straight upload
*/
ctx->Driver.BufferSubData( ctx,
GL_ELEMENT_ARRAY_BUFFER_ARB,
offset,
ib_size,
index_buffer->ptr,
bufferobj);
}
/* Emit the indexbuffer packet:

View file

@ -1,150 +0,0 @@
/**************************************************************************
Copyright 2002 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
on the rights to use, copy, modify, merge, publish, distribute, sub
license, and/or sell copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
*
*/
#ifndef __BRW_EXEC_H__
#define __BRW_EXEC_H__
#include "mtypes.h"
#include "brw_attrib.h"
#include "brw_draw.h"
#define BRW_MAX_PRIM 64
/* Wierd implementation stuff:
*/
#define BRW_VERT_BUFFER_SIZE (1024*16) /* dwords == 64k */
#define BRW_MAX_ATTR_CODEGEN 16
#define ERROR_ATTRIB 16
struct brw_exec_eval1_map {
struct gl_1d_map *map;
GLuint sz;
};
struct brw_exec_eval2_map {
struct gl_2d_map *map;
GLuint sz;
};
struct brw_exec_copied_vtx {
GLfloat buffer[BRW_ATTRIB_MAX * 4 * BRW_MAX_COPIED_VERTS];
GLuint nr;
};
typedef void (*brw_attrfv_func)( const GLfloat * );
struct brw_exec_context
{
GLcontext *ctx;
GLvertexformat vtxfmt;
struct {
struct gl_buffer_object *bufferobj;
GLubyte *buffer_map;
GLuint vertex_size;
struct brw_draw_prim prim[BRW_MAX_PRIM];
GLuint prim_count;
GLfloat *vbptr; /* cursor, points into buffer */
GLfloat vertex[BRW_ATTRIB_MAX*4]; /* current vertex */
GLfloat *current[BRW_ATTRIB_MAX]; /* points into ctx->Current, ctx->Light.Material */
GLfloat CurrentFloatEdgeFlag;
GLuint vert_count;
GLuint max_vert;
struct brw_exec_copied_vtx copied;
GLubyte attrsz[BRW_ATTRIB_MAX];
GLubyte active_sz[BRW_ATTRIB_MAX];
GLfloat *attrptr[BRW_ATTRIB_MAX];
struct gl_client_array arrays[BRW_ATTRIB_MAX];
const struct gl_client_array *inputs[BRW_ATTRIB_MAX];
} vtx;
struct {
GLboolean recalculate_maps;
struct brw_exec_eval1_map map1[BRW_ATTRIB_MAX];
struct brw_exec_eval2_map map2[BRW_ATTRIB_MAX];
} eval;
struct {
const struct gl_client_array *inputs[BRW_ATTRIB_MAX];
struct gl_buffer_object *index_obj;
} array;
};
/* External API:
*/
void brw_exec_init( GLcontext *ctx );
void brw_exec_destroy( GLcontext *ctx );
void brw_exec_invalidate_state( GLcontext *ctx, GLuint new_state );
void brw_exec_FlushVertices( GLcontext *ctx, GLuint flags );
void brw_exec_wakeup( GLcontext *ctx );
/* Internal functions:
*/
void brw_exec_array_init( struct brw_exec_context *exec );
void brw_exec_array_destroy( struct brw_exec_context *exec );
void brw_exec_vtx_init( struct brw_exec_context *exec );
void brw_exec_vtx_destroy( struct brw_exec_context *exec );
void brw_exec_vtx_flush( struct brw_exec_context *exec );
void brw_exec_vtx_wrap( struct brw_exec_context *exec );
void brw_exec_eval_update( struct brw_exec_context *exec );
void brw_exec_do_EvalCoord2f( struct brw_exec_context *exec,
GLfloat u, GLfloat v );
void brw_exec_do_EvalCoord1f( struct brw_exec_context *exec,
GLfloat u);
#endif

View file

@ -1,283 +0,0 @@
/**************************************************************************
*
* Copyright 2003 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 "glheader.h"
#include "context.h"
#include "state.h"
#include "api_validate.h"
#include "api_noop.h"
#include "dispatch.h"
#include "brw_attrib.h"
#include "brw_draw.h"
#include "brw_exec.h"
#include "brw_fallback.h"
static GLuint get_max_index( GLuint count, GLuint type,
const GLvoid *indices )
{
GLint i;
/* Compute max element. This is only needed for upload of non-VBO,
* non-constant data elements.
*
* XXX: Postpone this calculation until it is known that it is
* needed. Otherwise could scan this pointlessly in the all-vbo
* case.
*/
switch(type) {
case GL_UNSIGNED_INT: {
const GLuint *ui_indices = (const GLuint *)indices;
GLuint max_ui = 0;
for (i = 0; i < count; i++)
if (ui_indices[i] > max_ui)
max_ui = ui_indices[i];
return max_ui;
}
case GL_UNSIGNED_SHORT: {
const GLushort *us_indices = (const GLushort *)indices;
GLuint max_us = 0;
for (i = 0; i < count; i++)
if (us_indices[i] > max_us)
max_us = us_indices[i];
return max_us;
}
case GL_UNSIGNED_BYTE: {
const GLubyte *ub_indices = (const GLubyte *)indices;
GLuint max_ub = 0;
for (i = 0; i < count; i++)
if (ub_indices[i] > max_ub)
max_ub = ub_indices[i];
return max_ub;
}
default:
return 0;
}
}
/***********************************************************************
* API functions.
*/
static void GLAPIENTRY
brw_exec_DrawArrays(GLenum mode, GLint start, GLsizei count)
{
GET_CURRENT_CONTEXT(ctx);
struct brw_exec_context *exec = IMM_CONTEXT(ctx)->exec;
struct brw_draw_prim prim[1];
GLboolean ok;
if (!_mesa_validate_DrawArrays( ctx, mode, start, count ))
return;
FLUSH_CURRENT( ctx, 0 );
if (ctx->NewState)
_mesa_update_state( ctx );
prim[0].begin = 1;
prim[0].end = 1;
prim[0].weak = 0;
prim[0].pad = 0;
if (exec->array.inputs[0]->BufferObj->Name) {
/* Use vertex attribute as a hint to tell us if we expect all
* arrays to be in VBO's and if so, don't worry about avoiding
* the upload of elements < start.
*/
prim[0].mode = mode;
prim[0].start = start;
prim[0].count = count;
prim[0].indexed = 0;
ok = brw_draw_prims( ctx, exec->array.inputs, prim, 1, NULL, 0, start + count, 0 );
}
else {
/* If not using VBO's, we don't want to upload any more elements
* than necessary from the arrays as they will not be valid next
* time the application tries to draw with them.
*/
prim[0].mode = mode;
prim[0].start = 0;
prim[0].count = count;
prim[0].indexed = 0;
ok = brw_draw_prims( ctx, exec->array.inputs, prim, 1, NULL, start, start + count, 0 );
}
if (!ok) {
brw_fallback(ctx);
CALL_DrawArrays(ctx->Exec, ( mode, start, count ));
brw_unfallback(ctx);
}
}
static void GLAPIENTRY
brw_exec_DrawRangeElements(GLenum mode,
GLuint start, GLuint end,
GLsizei count, GLenum type, const GLvoid *indices)
{
GET_CURRENT_CONTEXT(ctx);
struct brw_exec_context *exec = IMM_CONTEXT(ctx)->exec;
struct brw_draw_index_buffer ib;
struct brw_draw_prim prim[1];
if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count, type, indices ))
return;
FLUSH_CURRENT( ctx, 0 );
if (ctx->NewState)
_mesa_update_state( ctx );
ib.count = count;
ib.type = type;
ib.obj = ctx->Array.ElementArrayBufferObj;
ib.ptr = indices;
if (ctx->Array.ElementArrayBufferObj->Name) {
/* Use the fact that indices are in a VBO as a hint that the
* program has put all the arrays in VBO's and we don't have to
* worry about performance implications of start > 0.
*
* XXX: consider passing start as min_index to draw_prims instead.
*/
ib.rebase = 0;
}
else {
ib.rebase = start;
}
prim[0].begin = 1;
prim[0].end = 1;
prim[0].weak = 0;
prim[0].pad = 0;
prim[0].mode = mode;
prim[0].start = 0;
prim[0].count = count;
prim[0].indexed = 1;
if (!brw_draw_prims( ctx, exec->array.inputs, prim, 1, &ib, ib.rebase, end+1, 0 )) {
brw_fallback(ctx);
CALL_DrawRangeElements(ctx->Exec, (mode, start, end, count, type, indices));
brw_unfallback(ctx);
}
}
static void GLAPIENTRY
brw_exec_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
{
GET_CURRENT_CONTEXT(ctx);
GLuint max_index;
if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices ))
return;
if (ctx->Array.ElementArrayBufferObj->Name) {
const GLvoid *map = ctx->Driver.MapBuffer(ctx,
GL_ELEMENT_ARRAY_BUFFER_ARB,
GL_DYNAMIC_READ_ARB,
ctx->Array.ElementArrayBufferObj);
max_index = get_max_index(count, type, ADD_POINTERS(map, indices));
ctx->Driver.UnmapBuffer(ctx,
GL_ELEMENT_ARRAY_BUFFER_ARB,
ctx->Array.ElementArrayBufferObj);
}
else {
max_index = get_max_index(count, type, indices);
}
brw_exec_DrawRangeElements(mode, 0, max_index, count, type, indices);
}
/***********************************************************************
* Initialization
*/
static void init_arrays( GLcontext *ctx,
const struct gl_client_array *arrays[] )
{
struct gl_array_object *obj = ctx->Array.ArrayObj;
GLuint i;
memset(arrays, 0, sizeof(*arrays) * BRW_ATTRIB_MAX);
arrays[BRW_ATTRIB_POS] = &obj->Vertex;
arrays[BRW_ATTRIB_NORMAL] = &obj->Normal;
arrays[BRW_ATTRIB_COLOR0] = &obj->Color;
arrays[BRW_ATTRIB_COLOR1] = &obj->SecondaryColor;
arrays[BRW_ATTRIB_FOG] = &obj->FogCoord;
for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++)
arrays[BRW_ATTRIB_TEX0 + i] = &obj->TexCoord[i];
arrays[BRW_ATTRIB_INDEX] = &obj->Index;
arrays[BRW_ATTRIB_EDGEFLAG] = &obj->EdgeFlag;
for (i = BRW_ATTRIB_GENERIC0; i <= BRW_ATTRIB_GENERIC15; i++)
arrays[i] = &obj->VertexAttrib[i - BRW_ATTRIB_GENERIC0];
}
void brw_exec_array_init( struct brw_exec_context *exec )
{
GLcontext *ctx = exec->ctx;
init_arrays(ctx, exec->array.inputs);
#if 1
exec->vtxfmt.DrawArrays = brw_exec_DrawArrays;
exec->vtxfmt.DrawElements = brw_exec_DrawElements;
exec->vtxfmt.DrawRangeElements = brw_exec_DrawRangeElements;
#else
exec->vtxfmt.DrawArrays = _mesa_noop_DrawArrays;
exec->vtxfmt.DrawElements = _mesa_noop_DrawElements;
exec->vtxfmt.DrawRangeElements = _mesa_noop_DrawRangeElements;
#endif
exec->array.index_obj = ctx->Driver.NewBufferObject(ctx, 1, GL_ARRAY_BUFFER_ARB);
}
void brw_exec_array_destroy( struct brw_exec_context *exec )
{
GLcontext *ctx = exec->ctx;
ctx->Driver.DeleteBuffer(ctx, exec->array.index_obj);
}

View file

@ -30,8 +30,6 @@
#include "tnl/tnl.h"
#include "context.h"
#include "brw_context.h"
#include "brw_exec.h"
#include "brw_save.h"
#include "brw_fallback.h"
#include "glheader.h"
@ -40,297 +38,6 @@
#include "imports.h"
#include "macros.h"
#include "mtypes.h"
#include "dispatch.h"
typedef void (*attr_func)( GLcontext *ctx, GLint target, const GLfloat * );
/* Wrapper functions in case glVertexAttrib*fvNV doesn't exist */
static void VertexAttrib1fvNV(GLcontext *ctx, GLint target, const GLfloat *v)
{
CALL_VertexAttrib1fvNV(ctx->Exec, (target, v));
}
static void VertexAttrib2fvNV(GLcontext *ctx, GLint target, const GLfloat *v)
{
CALL_VertexAttrib2fvNV(ctx->Exec, (target, v));
}
static void VertexAttrib3fvNV(GLcontext *ctx, GLint target, const GLfloat *v)
{
CALL_VertexAttrib3fvNV(ctx->Exec, (target, v));
}
static void VertexAttrib4fvNV(GLcontext *ctx, GLint target, const GLfloat *v)
{
CALL_VertexAttrib4fvNV(ctx->Exec, (target, v));
}
static attr_func vert_attrfunc[4] = {
VertexAttrib1fvNV,
VertexAttrib2fvNV,
VertexAttrib3fvNV,
VertexAttrib4fvNV
};
#if 0
static void VertexAttrib1fvARB(GLcontext *ctx, GLint target, const GLfloat *v)
{
CALL_VertexAttrib1fvARB(ctx->Exec, (target, v));
}
static void VertexAttrib2fvARB(GLcontext *ctx, GLint target, const GLfloat *v)
{
CALL_VertexAttrib2fvARB(ctx->Exec, (target, v));
}
static void VertexAttrib3fvARB(GLcontext *ctx, GLint target, const GLfloat *v)
{
CALL_VertexAttrib3fvARB(ctx->Exec, (target, v));
}
static void VertexAttrib4fvARB(GLcontext *ctx, GLint target, const GLfloat *v)
{
CALL_VertexAttrib4fvARB(ctx->Exec, (target, v));
}
static attr_func vert_attrfunc_arb[4] = {
VertexAttrib1fvARB,
VertexAttrib2fvARB,
VertexAttrib3fvARB,
VertexAttrib4fvARB
};
#endif
static void mat_attr1fv( GLcontext *ctx, GLint target, const GLfloat *v )
{
switch (target) {
case BRW_ATTRIB_MAT_FRONT_SHININESS:
CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_SHININESS, v ));
break;
case BRW_ATTRIB_MAT_BACK_SHININESS:
CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_SHININESS, v ));
break;
}
}
static void mat_attr3fv( GLcontext *ctx, GLint target, const GLfloat *v )
{
switch (target) {
case BRW_ATTRIB_MAT_FRONT_INDEXES:
CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_COLOR_INDEXES, v ));
break;
case BRW_ATTRIB_MAT_BACK_INDEXES:
CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_COLOR_INDEXES, v ));
break;
}
}
static void mat_attr4fv( GLcontext *ctx, GLint target, const GLfloat *v )
{
switch (target) {
case BRW_ATTRIB_MAT_FRONT_EMISSION:
CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_EMISSION, v ));
break;
case BRW_ATTRIB_MAT_BACK_EMISSION:
CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_EMISSION, v ));
break;
case BRW_ATTRIB_MAT_FRONT_AMBIENT:
CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_AMBIENT, v ));
break;
case BRW_ATTRIB_MAT_BACK_AMBIENT:
CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_AMBIENT, v ));
break;
case BRW_ATTRIB_MAT_FRONT_DIFFUSE:
CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_DIFFUSE, v ));
break;
case BRW_ATTRIB_MAT_BACK_DIFFUSE:
CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_DIFFUSE, v ));
break;
case BRW_ATTRIB_MAT_FRONT_SPECULAR:
CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_SPECULAR, v ));
break;
case BRW_ATTRIB_MAT_BACK_SPECULAR:
CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_SPECULAR, v ));
break;
}
}
static attr_func mat_attrfunc[4] = {
mat_attr1fv,
NULL,
mat_attr3fv,
mat_attr4fv
};
static void index_attr1fv(GLcontext *ctx, GLint target, const GLfloat *v)
{
(void) target;
CALL_Indexf(ctx->Exec, (v[0]));
}
static void edgeflag_attr1fv(GLcontext *ctx, GLint target, const GLfloat *v)
{
(void) target;
CALL_EdgeFlag(ctx->Exec, ((GLboolean)(v[0] == 1.0)));
}
struct loopback_attr {
GLint target;
GLint sz;
attr_func func;
};
/* Don't emit ends and begins on wrapped primitives. Don't replay
* wrapped vertices. If we get here, it's probably because the the
* precalculated wrapping is wrong.
*/
static void loopback_prim( GLcontext *ctx,
const GLfloat *buffer,
const struct brw_draw_prim *prim,
GLuint wrap_count,
GLuint vertex_size,
const struct loopback_attr *la, GLuint nr )
{
GLint start = prim->start;
GLint end = start + prim->count;
const GLfloat *data;
GLint j;
GLuint k;
if (0)
_mesa_printf("loopback prim %s(%s,%s) verts %d..%d\n",
_mesa_lookup_enum_by_nr(prim->mode),
prim->begin ? "begin" : "..",
prim->end ? "end" : "..",
start,
end);
if (prim->begin) {
CALL_Begin(GET_DISPATCH(), ( prim->mode ));
}
else {
assert(start == 0);
start += wrap_count;
}
data = buffer + start * vertex_size;
for (j = start ; j < end ; j++) {
const GLfloat *tmp = data + la[0].sz;
for (k = 1 ; k < nr ; k++) {
la[k].func( ctx, la[k].target, tmp );
tmp += la[k].sz;
}
/* Fire the vertex
*/
la[0].func( ctx, BRW_ATTRIB_POS, data );
data = tmp;
}
if (prim->end) {
CALL_End(GET_DISPATCH(), ());
}
}
/* Primitives generated by DrawArrays/DrawElements/Rectf may be
* caught here. If there is no primitive in progress, execute them
* normally, otherwise need to track and discard the generated
* primitives.
*/
static void loopback_weak_prim( GLcontext *ctx,
const struct brw_draw_prim *prim )
{
/* Use the prim_weak flag to ensure that if this primitive
* wraps, we don't mistake future vertex_lists for part of the
* surrounding primitive.
*
* While this flag is set, we are simply disposing of data
* generated by an operation now known to be a noop.
*/
if (prim->begin)
ctx->Driver.CurrentExecPrimitive |= BRW_SAVE_PRIM_WEAK;
if (prim->end)
ctx->Driver.CurrentExecPrimitive &= ~BRW_SAVE_PRIM_WEAK;
}
void brw_loopback_vertex_list( GLcontext *ctx,
const GLfloat *buffer,
const GLubyte *attrsz,
const struct brw_draw_prim *prim,
GLuint prim_count,
GLuint wrap_count,
GLuint vertex_size)
{
struct loopback_attr la[BRW_ATTRIB_MAX];
GLuint i, nr = 0;
for (i = 0 ; i <= BRW_ATTRIB_TEX7 ; i++) {
if (i == BRW_ATTRIB_INDEX || i == BRW_ATTRIB_EDGEFLAG)
continue;
if (attrsz[i]) {
la[nr].target = i;
la[nr].sz = attrsz[i];
la[nr].func = vert_attrfunc[attrsz[i]-1];
nr++;
}
}
for (i = BRW_ATTRIB_MAT_FRONT_AMBIENT ;
i <= BRW_ATTRIB_MAT_BACK_INDEXES ;
i++) {
if (attrsz[i]) {
la[nr].target = i;
la[nr].sz = attrsz[i];
la[nr].func = mat_attrfunc[attrsz[i]-1];
nr++;
}
}
if (attrsz[BRW_ATTRIB_EDGEFLAG]) {
la[nr].target = BRW_ATTRIB_EDGEFLAG;
la[nr].sz = attrsz[BRW_ATTRIB_EDGEFLAG];
la[nr].func = edgeflag_attr1fv;
nr++;
}
if (attrsz[BRW_ATTRIB_INDEX]) {
la[nr].target = BRW_ATTRIB_INDEX;
la[nr].sz = attrsz[BRW_ATTRIB_INDEX];
la[nr].func = index_attr1fv;
nr++;
}
/* XXX ARB vertex attribs */
for (i = 0 ; i < prim_count ; i++) {
if ((prim[i].mode & BRW_SAVE_PRIM_WEAK) &&
(ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END))
{
loopback_weak_prim( ctx, &prim[i] );
}
else
{
loopback_prim( ctx, buffer, &prim[i], wrap_count, vertex_size, la, nr );
}
}
}
@ -405,62 +112,6 @@ const struct brw_tracked_state brw_check_fallback = {
/* If there is a fallback, fallback to software rasterization and
* transformation together. There is never a requirement to have
* software t&l but hardware rasterization.
*
* Further, all fallbacks are based on GL state, not on eg. primitive
* or vertex data.
*/
static void do_fallback( struct brw_context *brw,
GLboolean fallback )
{
GLcontext *ctx = &brw->intel.ctx;
/* flush:
*/
ctx->Driver.Flush( ctx );
if (fallback) {
_swsetup_Wakeup( ctx );
_tnl_wakeup_exec( ctx );
/* Need this because tnl_wakeup_exec does too much:
*/
brw_save_wakeup(ctx);
brw_save_fallback(ctx, GL_TRUE);
}
else {
/* Flush vertices and copy-to-current:
*/
FLUSH_CURRENT(ctx, 0);
_swrast_flush( ctx );
brw_exec_wakeup(ctx);
/* Need this because tnl_wakeup_exec does too much:
*/
brw_save_wakeup(ctx);
brw_save_fallback(ctx, GL_FALSE);
}
}
void brw_fallback( GLcontext *ctx )
{
struct brw_context *brw = brw_context(ctx);
do_fallback(brw, 1);
}
void brw_unfallback( GLcontext *ctx )
{
struct brw_context *brw = brw_context(ctx);
do_fallback(brw, 0);
}
/* Not used:
*/
void intelFallback( struct intel_context *intel, GLuint bit, GLboolean mode )

View file

@ -31,7 +31,7 @@
#include "mtypes.h" /* for GLcontext... */
struct brw_context;
struct brw_draw_prim;
struct vbo_prim;
void brw_fallback( GLcontext *ctx );
void brw_unfallback( GLcontext *ctx );
@ -39,7 +39,7 @@ void brw_unfallback( GLcontext *ctx );
void brw_loopback_vertex_list( GLcontext *ctx,
const GLfloat *buffer,
const GLubyte *attrsz,
const struct brw_draw_prim *prim,
const struct vbo_prim *prim,
GLuint prim_count,
GLuint wrap_count,
GLuint vertex_size);

View file

@ -47,7 +47,6 @@
#include "brw_context.h"
#include "brw_defines.h"
#include "brw_draw.h"
#include "brw_attrib.h"
#include "brw_fallback.h"
#define INIT(brw, STRUCT, ATTRIB) \
@ -388,8 +387,8 @@ static void meta_draw_quad(struct intel_context *intel,
struct brw_context *brw = brw_context(&intel->ctx);
struct gl_client_array pos_array;
struct gl_client_array color_array;
struct gl_client_array *attribs[BRW_ATTRIB_MAX];
struct brw_draw_prim prim[1];
struct gl_client_array *attribs[VERT_ATTRIB_MAX];
struct _mesa_prim prim[1];
GLfloat pos[4][3];
GLubyte color[4];
@ -439,29 +438,29 @@ static void meta_draw_quad(struct intel_context *intel,
/* Ignoring texture coords.
*/
memset(attribs, 0, BRW_ATTRIB_MAX * sizeof(*attribs));
memset(attribs, 0, VERT_ATTRIB_MAX * sizeof(*attribs));
attribs[BRW_ATTRIB_POS] = &pos_array;
attribs[BRW_ATTRIB_POS]->Ptr = 0;
attribs[BRW_ATTRIB_POS]->Type = GL_FLOAT;
attribs[BRW_ATTRIB_POS]->Enabled = 1;
attribs[BRW_ATTRIB_POS]->Size = 3;
attribs[BRW_ATTRIB_POS]->StrideB = 3 * sizeof(GLfloat);
attribs[BRW_ATTRIB_POS]->Stride = 3 * sizeof(GLfloat);
attribs[BRW_ATTRIB_POS]->_MaxElement = 4;
attribs[BRW_ATTRIB_POS]->Normalized = 0;
attribs[BRW_ATTRIB_POS]->BufferObj = brw->metaops.vbo;
attribs[VERT_ATTRIB_POS] = &pos_array;
attribs[VERT_ATTRIB_POS]->Ptr = 0;
attribs[VERT_ATTRIB_POS]->Type = GL_FLOAT;
attribs[VERT_ATTRIB_POS]->Enabled = 1;
attribs[VERT_ATTRIB_POS]->Size = 3;
attribs[VERT_ATTRIB_POS]->StrideB = 3 * sizeof(GLfloat);
attribs[VERT_ATTRIB_POS]->Stride = 3 * sizeof(GLfloat);
attribs[VERT_ATTRIB_POS]->_MaxElement = 4;
attribs[VERT_ATTRIB_POS]->Normalized = 0;
attribs[VERT_ATTRIB_POS]->BufferObj = brw->metaops.vbo;
attribs[BRW_ATTRIB_COLOR0] = &color_array;
attribs[BRW_ATTRIB_COLOR0]->Ptr = (const GLubyte *)sizeof(pos);
attribs[BRW_ATTRIB_COLOR0]->Type = GL_UNSIGNED_BYTE;
attribs[BRW_ATTRIB_COLOR0]->Enabled = 1;
attribs[BRW_ATTRIB_COLOR0]->Size = 4;
attribs[BRW_ATTRIB_COLOR0]->StrideB = 0;
attribs[BRW_ATTRIB_COLOR0]->Stride = 0;
attribs[BRW_ATTRIB_COLOR0]->_MaxElement = 1;
attribs[BRW_ATTRIB_COLOR0]->Normalized = 1;
attribs[BRW_ATTRIB_COLOR0]->BufferObj = brw->metaops.vbo;
attribs[VERT_ATTRIB_COLOR0] = &color_array;
attribs[VERT_ATTRIB_COLOR0]->Ptr = (const GLubyte *)sizeof(pos);
attribs[VERT_ATTRIB_COLOR0]->Type = GL_UNSIGNED_BYTE;
attribs[VERT_ATTRIB_COLOR0]->Enabled = 1;
attribs[VERT_ATTRIB_COLOR0]->Size = 4;
attribs[VERT_ATTRIB_COLOR0]->StrideB = 0;
attribs[VERT_ATTRIB_COLOR0]->Stride = 0;
attribs[VERT_ATTRIB_COLOR0]->_MaxElement = 1;
attribs[VERT_ATTRIB_COLOR0]->Normalized = 1;
attribs[VERT_ATTRIB_COLOR0]->BufferObj = brw->metaops.vbo;
/* Just ignoring texture coordinates for now.
*/
@ -476,19 +475,12 @@ static void meta_draw_quad(struct intel_context *intel,
prim[0].start = 0;
prim[0].count = 4;
if (!brw_draw_prims(&brw->intel.ctx,
(const struct gl_client_array **)attribs,
prim, 1,
NULL,
0,
4,
BRW_DRAW_LOCKED ))
{
/* This should not be possible:
*/
_mesa_printf("brw_draw_prims failed in metaops!\n");
assert(0);
}
brw_draw_prims(&brw->intel.ctx,
(const struct gl_client_array **)attribs,
prim, 1,
NULL,
0,
3 );
}

View file

@ -1,126 +0,0 @@
/*
* Mesa 3-D graphics library
* Version: 6.3
*
* Copyright (C) 1999-2005 Brian Paul 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, sublicense,
* 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL 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.
*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
*/
#include "mtypes.h"
#include "api_arrayelt.h"
#include "dlist.h"
#include "vtxfmt.h"
#include "imports.h"
#include "brw_save.h"
void brw_save_init( GLcontext *ctx )
{
struct brw_save_context *save = CALLOC_STRUCT(brw_save_context);
if (ctx->swtnl_im == NULL) {
ctx->swtnl_im = CALLOC_STRUCT(brw_exec_save);
}
save->ctx = ctx;
IMM_CONTEXT(ctx)->save = save;
/* Initialize the arrayelt helper
*/
if (!ctx->aelt_context &&
!_ae_create_context( ctx ))
return;
brw_save_api_init( save );
brw_save_wakeup(ctx);
ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
}
void brw_save_destroy( GLcontext *ctx )
{
struct brw_save_context *save = IMM_CONTEXT(ctx)->save;
if (save) {
FREE(save);
IMM_CONTEXT(ctx)->save = NULL;
}
if (ctx->aelt_context) {
_ae_destroy_context( ctx );
ctx->aelt_context = NULL;
}
if (IMM_CONTEXT(ctx)->exec == NULL &&
IMM_CONTEXT(ctx)->save == NULL) {
FREE(IMM_CONTEXT(ctx));
ctx->swtnl_im = NULL;
}
}
void brw_save_invalidate_state( GLcontext *ctx, GLuint new_state )
{
_ae_invalidate_state(ctx, new_state);
}
/* Note that this can occur during the playback of a display list:
*/
void brw_save_fallback( GLcontext *ctx, GLboolean fallback )
{
struct brw_save_context *save = IMM_CONTEXT(ctx)->save;
if (fallback)
save->replay_flags |= BRW_SAVE_FALLBACK;
else
save->replay_flags &= ~BRW_SAVE_FALLBACK;
}
/* I don't see any reason to swap this code out on fallbacks. It
* wouldn't really mean anything to do so anyway as the old lists are
* still around from pre-fallback. Instead, the above code ensures
* that vertices are routed back through immediate mode dispatch on
* fallback.
*
* The below can be moved into init or removed:
*/
void brw_save_wakeup( GLcontext *ctx )
{
ctx->Driver.NewList = brw_save_NewList;
ctx->Driver.EndList = brw_save_EndList;
ctx->Driver.SaveFlushVertices = brw_save_SaveFlushVertices;
ctx->Driver.BeginCallList = brw_save_BeginCallList;
ctx->Driver.EndCallList = brw_save_EndCallList;
ctx->Driver.NotifySaveBegin = brw_save_NotifyBegin;
/* Assume we haven't been getting state updates either:
*/
brw_save_invalidate_state( ctx, ~0 );
}

View file

@ -54,12 +54,11 @@ static void do_vs_prog( struct brw_context *brw,
c.vp = vp;
c.prog_data.outputs_written = vp->program.Base.OutputsWritten;
c.prog_data.inputs_read = brw_translate_inputs(brw->intel.ctx.VertexProgram._Enabled,
vp->program.Base.InputsRead);
c.prog_data.inputs_read = vp->program.Base.InputsRead;
if (c.key.copy_edgeflag) {
c.prog_data.outputs_written |= 1<<VERT_RESULT_EDGE;
c.prog_data.inputs_read |= 1<<BRW_ATTRIB_EDGEFLAG;
c.prog_data.inputs_read |= 1<<VERT_ATTRIB_EDGEFLAG;
}
if (0)

View file

@ -162,6 +162,7 @@ static GLuint get_input_size(struct brw_context *brw,
GLuint sizes_dword = brw->vb.info.sizes[attr/16];
GLuint sizes_bits = (sizes_dword>>((attr%16)*2)) & 0x3;
return sizes_bits + 1;
/* return brw->vb.inputs[attr].glarray->Size; */
}
/* Calculate sizes of vertex program outputs. Size is the largest
@ -176,8 +177,6 @@ static void calc_wm_input_sizes( struct brw_context *brw )
struct tracker t;
GLuint insn;
GLuint i;
GLuint64EXT inputs = brw_translate_inputs(brw->intel.ctx.VertexProgram._Enabled,
vp->program.Base.InputsRead);
memset(&t, 0, sizeof(t));
@ -185,8 +184,8 @@ static void calc_wm_input_sizes( struct brw_context *brw )
if (brw->attribs.Light->Model.TwoSide)
t.twoside = 1;
for (i = 0; i < BRW_ATTRIB_MAX; i++)
if (inputs & (1<<i))
for (i = 0; i < VERT_ATTRIB_MAX; i++)
if (vp->program.Base.InputsRead & (1<<i))
set_active_component(&t, PROGRAM_INPUT, i,
szflag[get_input_size(brw, i)]);

View file

@ -77,8 +77,8 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
/* Allocate input regs:
*/
c->nr_inputs = 0;
for (i = 0; i < BRW_ATTRIB_MAX; i++) {
if (c->prog_data.inputs_read & ((GLuint64EXT)1<<i)) {
for (i = 0; i < VERT_ATTRIB_MAX; i++) {
if (c->prog_data.inputs_read & (1<<i)) {
c->nr_inputs++;
c->regs[PROGRAM_INPUT][i] = brw_vec8_grf(reg, 0);
reg++;
@ -791,7 +791,7 @@ static void emit_vertex_write( struct brw_vs_compile *c)
if (c->key.copy_edgeflag) {
brw_MOV(p,
get_reg(c, PROGRAM_OUTPUT, VERT_RESULT_EDGE),
get_reg(c, PROGRAM_INPUT, BRW_ATTRIB_EDGEFLAG));
get_reg(c, PROGRAM_INPUT, VERT_ATTRIB_EDGEFLAG));
}

View file

@ -146,9 +146,13 @@ static void make_state_key( GLcontext *ctx, struct state_key *key )
}
/* BRW_NEW_INPUT_VARYING */
for (i = BRW_ATTRIB_MAT_FRONT_AMBIENT ; i < BRW_ATTRIB_MAX ; i++)
if (brw->vb.info.varying & ((GLuint64EXT)1<<i))
key->light_material_mask |= 1<<(i-BRW_ATTRIB_MAT_FRONT_AMBIENT);
/* For these programs, material values are stuffed into the
* generic slots:
*/
for (i = 0 ; i < MAT_ATTRIB_MAX ; i++)
if (brw->vb.info.varying & (1<<(VERT_ATTRIB_GENERIC0 + i)))
key->light_material_mask |= 1<<i;
for (i = 0; i < MAX_LIGHTS; i++) {
struct gl_light *light = &brw->attribs.Light->Light[i];
@ -374,17 +378,10 @@ static void release_temps( struct tnl_program *p )
static struct ureg register_input( struct tnl_program *p, GLuint input )
{
GLuint orig_input = input;
/* Cram the material flags into the generic range. We'll translate
* them back later.
*/
if (input >= BRW_ATTRIB_MAT_FRONT_AMBIENT)
input -= BRW_ATTRIB_MAT_FRONT_AMBIENT - BRW_ATTRIB_GENERIC0;
assert(input < 32);
p->program->Base.InputsRead |= (1<<input);
return make_ureg(PROGRAM_INPUT, orig_input);
return make_ureg(PROGRAM_INPUT, input);
}
static struct ureg register_output( struct tnl_program *p, GLuint output )
@ -647,7 +644,7 @@ static void emit_passthrough( struct tnl_program *p,
static struct ureg get_eye_position( struct tnl_program *p )
{
if (is_undef(p->eye_position)) {
struct ureg pos = register_input( p, BRW_ATTRIB_POS );
struct ureg pos = register_input( p, VERT_ATTRIB_POS );
struct ureg modelview[4];
p->eye_position = reserve_temp(p);
@ -710,7 +707,7 @@ static struct ureg get_eye_position_normalized( struct tnl_program *p )
static struct ureg get_eye_normal( struct tnl_program *p )
{
if (is_undef(p->eye_normal)) {
struct ureg normal = register_input(p, BRW_ATTRIB_NORMAL );
struct ureg normal = register_input(p, VERT_ATTRIB_NORMAL );
struct ureg mvinv[3];
register_matrix_param6( p, STATE_MATRIX, STATE_MODELVIEW, 0, 0, 2,
@ -743,7 +740,7 @@ static struct ureg get_eye_normal( struct tnl_program *p )
static void build_hpos( struct tnl_program *p )
{
struct ureg pos = register_input( p, BRW_ATTRIB_POS );
struct ureg pos = register_input( p, VERT_ATTRIB_POS );
struct ureg hpos = register_output( p, VERT_RESULT_HPOS );
struct ureg mvp[4];
@ -787,9 +784,9 @@ static struct ureg get_material( struct tnl_program *p, GLuint side,
GLuint attrib = material_attrib(side, property);
if (p->color_materials & (1<<attrib))
return register_input(p, BRW_ATTRIB_COLOR0);
return register_input(p, VERT_ATTRIB_COLOR0);
else if (p->materials & (1<<attrib))
return register_input( p, attrib + BRW_ATTRIB_MAT_FRONT_AMBIENT );
return register_input( p, attrib + _TNL_ATTRIB_MAT_FRONT_AMBIENT );
else
return register_param3( p, STATE_MATERIAL, side, property );
}
@ -1157,7 +1154,7 @@ static void build_fog( struct tnl_program *p )
input = swizzle1(get_eye_position(p), Z);
}
else {
input = swizzle1(register_input(p, BRW_ATTRIB_FOG), X);
input = swizzle1(register_input(p, VERT_ATTRIB_FOG), X);
}
if (p->state->fog_option &&
@ -1299,7 +1296,7 @@ static void build_texture_transform( struct tnl_program *p )
for (j = 0; j < 4; j++) {
switch (modes[j]) {
case TXG_OBJ_LINEAR: {
struct ureg obj = register_input(p, BRW_ATTRIB_POS);
struct ureg obj = register_input(p, VERT_ATTRIB_POS);
struct ureg plane =
register_param3(p, STATE_TEXGEN, i,
STATE_TEXGEN_OBJECT_S + j);
@ -1348,7 +1345,7 @@ static void build_texture_transform( struct tnl_program *p )
}
if (copy_mask) {
struct ureg in = register_input(p, BRW_ATTRIB_TEX0+i);
struct ureg in = register_input(p, VERT_ATTRIB_TEX0+i);
emit_op1(p, OPCODE_MOV, out_texgen, copy_mask, in );
}
}
@ -1357,7 +1354,7 @@ static void build_texture_transform( struct tnl_program *p )
struct ureg texmat[4];
struct ureg in = (!is_undef(out_texgen) ?
out_texgen :
register_input(p, BRW_ATTRIB_TEX0+i));
register_input(p, VERT_ATTRIB_TEX0+i));
if (PREFER_DP4) {
register_matrix_param6( p, STATE_MATRIX, STATE_TEXTURE, i,
0, 3, STATE_MATRIX, texmat );
@ -1373,7 +1370,7 @@ static void build_texture_transform( struct tnl_program *p )
release_temps(p);
}
else {
emit_passthrough(p, BRW_ATTRIB_TEX0+i, VERT_RESULT_TEX0+i);
emit_passthrough(p, VERT_ATTRIB_TEX0+i, VERT_RESULT_TEX0+i);
}
}
}
@ -1425,10 +1422,10 @@ static void build_tnl_program( struct tnl_program *p )
build_lighting(p);
else {
if (p->state->fragprog_inputs_read & FRAG_BIT_COL0)
emit_passthrough(p, BRW_ATTRIB_COLOR0, VERT_RESULT_COL0);
emit_passthrough(p, VERT_ATTRIB_COLOR0, VERT_RESULT_COL0);
if (p->state->fragprog_inputs_read & FRAG_BIT_COL1)
emit_passthrough(p, BRW_ATTRIB_COLOR1, VERT_RESULT_COL1);
emit_passthrough(p, VERT_ATTRIB_COLOR1, VERT_RESULT_COL1);
}
}

View file

@ -46,8 +46,6 @@
#include "brw_state.h"
#include "brw_draw.h"
#include "brw_exec.h"
#include "brw_save.h"
#include "brw_state.h"
#include "brw_aub.h"
#include "brw_fallback.h"
@ -68,9 +66,6 @@ static void brw_destroy_context( struct intel_context *intel )
brw_destroy_state(brw);
brw_draw_destroy( brw );
brw_exec_destroy( ctx );
brw_save_destroy( ctx );
brw_ProgramCacheDestroy( ctx );
brw_FrameBufferTexDestroy( brw );
}
@ -166,10 +161,7 @@ static GLuint brw_flush_cmd( void )
static void brw_invalidate_state( struct intel_context *intel, GLuint new_state )
{
GLcontext *ctx = &intel->ctx;
brw_exec_invalidate_state(ctx, new_state);
brw_save_invalidate_state(ctx, new_state);
/* nothing */
}

View file

@ -38,7 +38,7 @@
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/t_pipeline.h"
#include "tnl/t_vertex.h"
@ -223,7 +223,7 @@ static void intelInvalidateState( GLcontext *ctx, GLuint new_state )
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
_ac_InvalidateState( ctx, new_state );
_vbo_InvalidateState( ctx, new_state );
_tnl_InvalidateState( ctx, new_state );
_tnl_invalidate_vertex_state( ctx, new_state );
@ -372,7 +372,7 @@ GLboolean intelInitContext( struct intel_context *intel,
/* Initialize the software rasterizer and helper modules. */
_swrast_CreateContext( ctx );
_ac_CreateContext( ctx );
_vbo_CreateContext( ctx );
_tnl_CreateContext( ctx );
_swsetup_CreateContext( ctx );
@ -517,7 +517,7 @@ void intelDestroyContext(__DRIcontextPrivate *driContextPriv)
release_texture_heaps = (intel->ctx.Shared->RefCount == 1);
_swsetup_DestroyContext (&intel->ctx);
_tnl_DestroyContext (&intel->ctx);
_ac_DestroyContext (&intel->ctx);
_vbo_DestroyContext (&intel->ctx);
_swrast_DestroyContext (&intel->ctx);
intel->Fallback = 0; /* don't call _swrast_Flush later */

View file

@ -38,7 +38,7 @@
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
#include "tnl/t_pipeline.h"
@ -225,7 +225,7 @@ GLboolean mach64CreateContext( const __GLcontextModes *glVisual,
/* Initialize the software rasterizer and helper modules.
*/
_swrast_CreateContext( ctx );
_ac_CreateContext( ctx );
_vbo_CreateContext( ctx );
_tnl_CreateContext( ctx );
_swsetup_CreateContext( ctx );
@ -278,7 +278,7 @@ void mach64DestroyContext( __DRIcontextPrivate *driContextPriv )
_swsetup_DestroyContext( mmesa->glCtx );
_tnl_DestroyContext( mmesa->glCtx );
_ac_DestroyContext( mmesa->glCtx );
_vbo_DestroyContext( mmesa->glCtx );
_swrast_DestroyContext( mmesa->glCtx );
if (release_texture_heaps) {

View file

@ -40,7 +40,7 @@
#include "enums.h"
#include "colormac.h"
#include "swrast/swrast.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
#include "swrast_setup/swrast_setup.h"
@ -1023,7 +1023,7 @@ static void mach64DDInvalidateState( GLcontext *ctx, GLuint new_state )
{
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
_ac_InvalidateState( ctx, new_state );
_vbo_InvalidateState( ctx, new_state );
_tnl_InvalidateState( ctx, new_state );
MACH64_CONTEXT(ctx)->NewGLState |= new_state;
}

View file

@ -45,7 +45,7 @@
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/t_pipeline.h"
@ -593,7 +593,7 @@ mgaCreateContext( const __GLcontextModes *mesaVis,
/* Initialize the software rasterizer and helper modules.
*/
_swrast_CreateContext( ctx );
_ac_CreateContext( ctx );
_vbo_CreateContext( ctx );
_tnl_CreateContext( ctx );
_swsetup_CreateContext( ctx );
@ -676,7 +676,7 @@ mgaDestroyContext(__DRIcontextPrivate *driContextPriv)
release_texture_heaps = (mmesa->glCtx->Shared->RefCount == 1);
_swsetup_DestroyContext( mmesa->glCtx );
_tnl_DestroyContext( mmesa->glCtx );
_ac_DestroyContext( mmesa->glCtx );
_vbo_DestroyContext( mmesa->glCtx );
_swrast_DestroyContext( mmesa->glCtx );
mgaFreeVB( mmesa->glCtx );

View file

@ -41,7 +41,7 @@
#include "mgaregs.h"
#include "swrast/swrast.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
#include "tnl/t_context.h"
#include "tnl/t_pipeline.h"
@ -1042,7 +1042,7 @@ static void mgaDDInvalidateState( GLcontext *ctx, GLuint new_state )
{
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
_ac_InvalidateState( ctx, new_state );
_vbo_InvalidateState( ctx, new_state );
_tnl_InvalidateState( ctx, new_state );
MGA_CONTEXT(ctx)->NewGLState |= new_state;
}

View file

@ -31,7 +31,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "matrix.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "array_cache/acache.h"
#include "framebuffer.h"
#include "tnl/tnl.h"
@ -200,7 +199,7 @@ GLboolean nouveauCreateContext( const __GLcontextModes *glVisual,
/* Initialize the swrast */
_swrast_CreateContext( ctx );
_ac_CreateContext( ctx );
_vbo_CreateContext( ctx );
_tnl_CreateContext( ctx );
_swsetup_CreateContext( ctx );

View file

@ -30,7 +30,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "nouveau_fifo.h"
#include "swrast/swrast.h"
#include "array_cache/acache.h"
#include "tnl/tnl.h"
#include "swrast_setup/swrast_setup.h"
@ -144,7 +143,7 @@ static void nouveauDDInvalidateState(GLcontext *ctx, GLuint new_state)
{
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
_ac_InvalidateState( ctx, new_state );
_vbo_InvalidateState( ctx, new_state );
_tnl_InvalidateState( ctx, new_state );
NOUVEAU_CONTEXT(ctx)->new_render_state |= new_state;
}

View file

@ -42,7 +42,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
#include "tnl/t_pipeline.h"
@ -235,7 +235,7 @@ GLboolean r128CreateContext( const __GLcontextModes *glVisual,
/* Initialize the software rasterizer and helper modules.
*/
_swrast_CreateContext( ctx );
_ac_CreateContext( ctx );
_vbo_CreateContext( ctx );
_tnl_CreateContext( ctx );
_swsetup_CreateContext( ctx );
@ -293,7 +293,7 @@ void r128DestroyContext( __DRIcontextPrivate *driContextPriv )
_swsetup_DestroyContext( rmesa->glCtx );
_tnl_DestroyContext( rmesa->glCtx );
_ac_DestroyContext( rmesa->glCtx );
_vbo_DestroyContext( rmesa->glCtx );
_swrast_DestroyContext( rmesa->glCtx );
if ( release_texture_heaps ) {

View file

@ -44,7 +44,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "enums.h"
#include "colormac.h"
#include "swrast/swrast.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
#include "swrast_setup/swrast_setup.h"
@ -1250,7 +1250,7 @@ static void r128DDInvalidateState( GLcontext *ctx, GLuint new_state )
{
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
_ac_InvalidateState( ctx, new_state );
_vbo_InvalidateState( ctx, new_state );
_tnl_InvalidateState( ctx, new_state );
R128_CONTEXT(ctx)->NewGLState |= new_state;
}

View file

@ -26,10 +26,6 @@ DRIVER_SOURCES = r200_context.c \
r200_span.c \
r200_maos.c \
r200_sanity.c \
r200_vtxfmt.c \
r200_vtxfmt_c.c \
r200_vtxfmt_sse.c \
r200_vtxfmt_x86.c \
r200_fragshader.c \
r200_vertprog.c \
radeon_screen.c \
@ -37,7 +33,7 @@ DRIVER_SOURCES = r200_context.c \
C_SOURCES = $(COMMON_SOURCES) $(DRIVER_SOURCES)
X86_SOURCES = r200_vtxtmp_x86.S
X86_SOURCES =
DRIVER_DEFINES = -DRADEON_COMMON=1 -DRADEON_COMMON_FOR_R200

View file

@ -45,7 +45,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
#include "tnl/t_pipeline.h"
@ -60,7 +60,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r200_tex.h"
#include "r200_swtcl.h"
#include "r200_tcl.h"
#include "r200_vtxfmt.h"
#include "r200_maos.h"
#include "r200_vertprog.h"
@ -415,7 +414,7 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual,
/* Initialize the software rasterizer and helper modules.
*/
_swrast_CreateContext( ctx );
_ac_CreateContext( ctx );
_vbo_CreateContext( ctx );
_tnl_CreateContext( ctx );
_swsetup_CreateContext( ctx );
_ae_create_context( ctx );
@ -424,11 +423,10 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual,
*/
_tnl_destroy_pipeline( ctx );
_tnl_install_pipeline( ctx, r200_pipeline );
ctx->Driver.FlushVertices = r200FlushVertices;
/* Try and keep materials and vertices separate:
*/
_tnl_isolate_materials( ctx, GL_TRUE );
/* _tnl_isolate_materials( ctx, GL_TRUE ); */
/* Configure swrast and TNL to match hardware characteristics:
@ -533,12 +531,6 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual,
TCL_FALLBACK(rmesa->glCtx, R200_TCL_FALLBACK_TCL_DISABLE, 1);
}
if (rmesa->r200Screen->chip_flags & RADEON_CHIPSET_TCL) {
if (tcl_mode >= DRI_CONF_TCL_VTXFMT)
r200VtxfmtInit( ctx, tcl_mode >= DRI_CONF_TCL_CODEGEN );
_tnl_need_dlist_norm_lengths( ctx, GL_FALSE );
}
return GL_TRUE;
}
@ -568,7 +560,7 @@ void r200DestroyContext( __DRIcontextPrivate *driContextPriv )
release_texture_heaps = (rmesa->glCtx->Shared->RefCount == 1);
_swsetup_DestroyContext( rmesa->glCtx );
_tnl_DestroyContext( rmesa->glCtx );
_ac_DestroyContext( rmesa->glCtx );
_vbo_DestroyContext( rmesa->glCtx );
_swrast_DestroyContext( rmesa->glCtx );
r200DestroySwtcl( rmesa->glCtx );
@ -579,12 +571,6 @@ void r200DestroyContext( __DRIcontextPrivate *driContextPriv )
r200FlushCmdBuf( rmesa, __FUNCTION__ );
}
if (!(rmesa->TclFallback & R200_TCL_FALLBACK_TCL_DISABLE)) {
int tcl_mode = driQueryOptioni(&rmesa->optionCache, "tcl_mode");
if (tcl_mode >= DRI_CONF_TCL_VTXFMT)
r200VtxfmtDestroy( rmesa->glCtx );
}
if (rmesa->state.scissor.pClipRects) {
FREE(rmesa->state.scissor.pClipRects);
rmesa->state.scissor.pClipRects = NULL;
@ -700,9 +686,6 @@ r200MakeCurrent( __DRIcontextPrivate *driContextPriv,
(GLframebuffer *) driDrawPriv->driverPrivate,
(GLframebuffer *) driReadPriv->driverPrivate );
if (newCtx->vb.enabled)
r200VtxfmtMakeCurrent( newCtx->glCtx );
_mesa_update_state( newCtx->glCtx );
r200ValidateState( newCtx->glCtx );
@ -727,6 +710,5 @@ r200UnbindContext( __DRIcontextPrivate *driContextPriv )
if (R200_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s ctx %p\n", __FUNCTION__, (void *)rmesa->glCtx);
r200VtxfmtUnbindContext( rmesa->glCtx );
return GL_TRUE;
}

View file

@ -43,7 +43,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "framebuffer.h"
#include "swrast/swrast.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
#include "tnl/t_pipeline.h"
#include "swrast_setup/swrast_setup.h"
@ -54,7 +54,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r200_tcl.h"
#include "r200_tex.h"
#include "r200_swtcl.h"
#include "r200_vtxfmt.h"
#include "r200_vertprog.h"
#include "drirenderbuffer.h"
@ -2536,11 +2535,10 @@ static void r200InvalidateState( GLcontext *ctx, GLuint new_state )
{
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
_ac_InvalidateState( ctx, new_state );
_vbo_InvalidateState( ctx, new_state );
_tnl_InvalidateState( ctx, new_state );
_ae_invalidate_state( ctx, new_state );
R200_CONTEXT(ctx)->NewGLState |= new_state;
r200VtxfmtInvalidate( ctx );
}
/* A hack. The r200 can actually cope just fine with materials

View file

@ -39,7 +39,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "api_arrayelt.h"
#include "swrast/swrast.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
#include "tnl/t_pipeline.h"
#include "swrast_setup/swrast_setup.h"
@ -50,7 +50,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r200_tcl.h"
#include "r200_tex.h"
#include "r200_swtcl.h"
#include "r200_vtxfmt.h"
#include "xmlpool.h"

View file

@ -48,7 +48,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "tnl/tnl.h"
#include "tnl/t_context.h"
#include "tnl/t_pipeline.h"
#include "tnl/t_vtx_api.h"
#include "r200_context.h"
#include "r200_ioctl.h"
@ -936,13 +935,6 @@ r200PointsBitmap( GLcontext *ctx, GLint px, GLint py,
}
void r200FlushVertices( GLcontext *ctx, GLuint flags )
{
_tnl_FlushVertices( ctx, flags );
if (flags & FLUSH_STORED_VERTICES)
R200_NEWPRIM( R200_CONTEXT( ctx ) );
}
/**********************************************************************/
/* Initialization. */

View file

@ -42,7 +42,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
extern void r200InitSwtcl( GLcontext *ctx );
extern void r200DestroySwtcl( GLcontext *ctx );
extern void r200FlushVertices( GLcontext *ctx, GLuint flags );
extern void r200ChooseRenderState( GLcontext *ctx );
extern void r200ChooseVertexState( GLcontext *ctx );

View file

@ -40,7 +40,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "colormac.h"
#include "light.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
#include "tnl/t_pipeline.h"

File diff suppressed because it is too large Load diff

View file

@ -1,123 +0,0 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.h,v 1.1 2002/10/30 12:51:53 alanh Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
The Weather Channel (TM) funded Tungsten Graphics to develop the
initial release of the Radeon 8500 driver under the XFree86 license.
This notice must be preserved.
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, sublicense, 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 NONINFRINGEMENT.
IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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.
**************************************************************************/
/*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
*/
#ifndef __R200_VTXFMT_H__
#define __R200_VTXFMT_H__
#include "r200_context.h"
extern void r200VtxfmtUpdate( GLcontext *ctx );
extern void r200VtxfmtInit( GLcontext *ctx, GLboolean useCodegen );
extern void r200VtxfmtInvalidate( GLcontext *ctx );
extern void r200VtxfmtDestroy( GLcontext *ctx );
extern void r200VtxfmtInitChoosers( GLvertexformat *vfmt );
extern void r200VtxfmtMakeCurrent( GLcontext *ctx );
extern void r200VtxfmtUnbindContext( GLcontext *ctx );
extern void r200_copy_to_current( GLcontext *ctx );
extern void VFMT_FALLBACK( const char *caller );
#define DFN( FUNC, CACHE) \
do { \
char *start = (char *)&FUNC; \
char *end = (char *)&FUNC##_end; \
insert_at_head( &CACHE, dfn ); \
dfn->key[0] = key[0]; \
dfn->key[1] = key[1]; \
dfn->code = _mesa_exec_malloc( end - start ); \
_mesa_memcpy(dfn->code, start, end - start); \
} \
while ( 0 )
#define FIXUP( CODE, OFFSET, CHECKVAL, NEWVAL ) \
do { \
int *icode = (int *)(CODE+OFFSET); \
assert (*icode == CHECKVAL); \
*icode = (int)NEWVAL; \
} while (0)
/* Useful for figuring out the offsets:
*/
#define FIXUP2( CODE, OFFSET, CHECKVAL, NEWVAL ) \
do { \
while (*(int *)(CODE+OFFSET) != CHECKVAL) OFFSET++; \
/*fprintf(stderr, "%s/%d CVAL %x OFFSET %d VAL %x\n", __FUNCTION__,*/ \
/* __LINE__, CHECKVAL, OFFSET, (int)(NEWVAL));*/ \
*(int *)(CODE+OFFSET) = (int)(NEWVAL); \
OFFSET += 4; \
} while (0)
/*
*/
void r200InitCodegen( struct dfn_generators *gen, GLboolean useCodegen );
void r200InitX86Codegen( struct dfn_generators *gen );
void r200InitSSECodegen( struct dfn_generators *gen );
/* Defined in r200_vtxfmt_x86.c
*/
struct dynfn *r200_makeX86Vertex2f( GLcontext *, const int * );
struct dynfn *r200_makeX86Vertex2fv( GLcontext *, const int * );
struct dynfn *r200_makeX86Vertex3f( GLcontext *, const int * );
struct dynfn *r200_makeX86Vertex3fv( GLcontext *, const int * );
struct dynfn *r200_makeX86Color4ub( GLcontext *, const int * );
struct dynfn *r200_makeX86Color4ubv( GLcontext *, const int * );
struct dynfn *r200_makeX86Color3ub( GLcontext *, const int * );
struct dynfn *r200_makeX86Color3ubv( GLcontext *, const int * );
struct dynfn *r200_makeX86Color4f( GLcontext *, const int * );
struct dynfn *r200_makeX86Color4fv( GLcontext *, const int * );
struct dynfn *r200_makeX86Color3f( GLcontext *, const int * );
struct dynfn *r200_makeX86Color3fv( GLcontext *, const int * );
struct dynfn *r200_makeX86SecondaryColor3ubEXT( GLcontext *, const int * );
struct dynfn *r200_makeX86SecondaryColor3ubvEXT( GLcontext *, const int * );
struct dynfn *r200_makeX86SecondaryColor3fEXT( GLcontext *, const int * );
struct dynfn *r200_makeX86SecondaryColor3fvEXT( GLcontext *, const int * );
struct dynfn *r200_makeX86Normal3f( GLcontext *, const int * );
struct dynfn *r200_makeX86Normal3fv( GLcontext *, const int * );
struct dynfn *r200_makeX86TexCoord2f( GLcontext *, const int * );
struct dynfn *r200_makeX86TexCoord2fv( GLcontext *, const int * );
struct dynfn *r200_makeX86TexCoord1f( GLcontext *, const int * );
struct dynfn *r200_makeX86TexCoord1fv( GLcontext *, const int * );
struct dynfn *r200_makeX86MultiTexCoord2fARB( GLcontext *, const int * );
struct dynfn *r200_makeX86MultiTexCoord2fvARB( GLcontext *, const int * );
struct dynfn *r200_makeX86MultiTexCoord1fARB( GLcontext *, const int * );
struct dynfn *r200_makeX86MultiTexCoord1fvARB( GLcontext *, const int * );
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,234 +0,0 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_sse.c,v 1.1 2002/10/30 12:51:53 alanh Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
The Weather Channel (TM) funded Tungsten Graphics to develop the
initial release of the Radeon 8500 driver under the XFree86 license.
This notice must be preserved.
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, sublicense, 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 NONINFRINGEMENT.
IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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.
**************************************************************************/
/*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
*/
#include "glheader.h"
#include "imports.h"
#include "simple_list.h"
#include "r200_vtxfmt.h"
#if defined(USE_SSE_ASM)
#include "x86/common_x86_asm.h"
#define EXTERN( FUNC ) \
extern const char *FUNC; \
extern const char *FUNC##_end
EXTERN( _sse_Attribute2fv );
EXTERN( _sse_Attribute2f );
EXTERN( _sse_Attribute3fv );
EXTERN( _sse_Attribute3f );
EXTERN( _sse_MultiTexCoord2fv );
EXTERN( _sse_MultiTexCoord2f );
EXTERN( _sse_MultiTexCoord2fv_2 );
EXTERN( _sse_MultiTexCoord2f_2 );
/* Build specialized versions of the immediate calls on the fly for
* the current state.
*/
static struct dynfn *r200_makeSSEAttribute2fv( struct dynfn * cache, const int * key,
const char * name, void * dest)
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key[0] );
DFN ( _sse_Attribute2fv, (*cache) );
FIXUP(dfn->code, 10, 0x0, (int)dest);
return dfn;
}
static struct dynfn *r200_makeSSEAttribute2f( struct dynfn * cache, const int * key,
const char * name, void * dest )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key[0] );
DFN ( _sse_Attribute2f, (*cache) );
FIXUP(dfn->code, 8, 0x0, (int)dest);
return dfn;
}
static struct dynfn *r200_makeSSEAttribute3fv( struct dynfn * cache, const int * key,
const char * name, void * dest)
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key[0] );
DFN ( _sse_Attribute3fv, (*cache) );
FIXUP(dfn->code, 13, 0x0, (int)dest);
FIXUP(dfn->code, 18, 0x8, 8+(int)dest);
return dfn;
}
static struct dynfn *r200_makeSSEAttribute3f( struct dynfn * cache, const int * key,
const char * name, void * dest )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key[0] );
DFN ( _sse_Attribute3f, (*cache) );
FIXUP(dfn->code, 12, 0x0, (int)dest);
FIXUP(dfn->code, 17, 0x8, 8+(int)dest);
return dfn;
}
static struct dynfn *r200_makeSSENormal3fv( GLcontext *ctx, const int *key )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
return r200_makeSSEAttribute3fv( & rmesa->vb.dfn_cache.Normal3fv, key,
__FUNCTION__, rmesa->vb.normalptr );
}
static struct dynfn *r200_makeSSENormal3f( GLcontext *ctx, const int * key )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
return r200_makeSSEAttribute3f( & rmesa->vb.dfn_cache.Normal3f, key,
__FUNCTION__, rmesa->vb.normalptr );
}
static struct dynfn *r200_makeSSEColor3fv( GLcontext *ctx, const int * key )
{
if (VTX_COLOR(key[0],0) != R200_VTX_FP_RGB)
return NULL;
else
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
return r200_makeSSEAttribute3fv( & rmesa->vb.dfn_cache.Color3fv, key,
__FUNCTION__, rmesa->vb.floatcolorptr );
}
}
static struct dynfn *r200_makeSSEColor3f( GLcontext *ctx, const int * key )
{
if (VTX_COLOR(key[0],0) != R200_VTX_FP_RGB)
return NULL;
else
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
return r200_makeSSEAttribute3f( & rmesa->vb.dfn_cache.Color3f, key,
__FUNCTION__, rmesa->vb.floatcolorptr );
}
}
#if 0 /* Temporarily disabled as it is broken w/the new cubemap code. - idr */
static struct dynfn *r200_makeSSETexCoord2fv( GLcontext *ctx, const int * key )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
return r200_makeSSEAttribute2fv( & rmesa->vb.dfn_cache.TexCoord2fv, key,
__FUNCTION__, rmesa->vb.texcoordptr[0] );
}
static struct dynfn *r200_makeSSETexCoord2f( GLcontext *ctx, const int * key )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
return r200_makeSSEAttribute2f( & rmesa->vb.dfn_cache.TexCoord2f, key,
__FUNCTION__, rmesa->vb.texcoordptr[0] );
}
static struct dynfn *r200_makeSSEMultiTexCoord2fv( GLcontext *ctx, const int * key )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
r200ContextPtr rmesa = R200_CONTEXT(ctx);
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key[0] );
if (rmesa->vb.texcoordptr[1] == rmesa->vb.texcoordptr[0]+4) {
DFN ( _sse_MultiTexCoord2fv, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
FIXUP(dfn->code, 18, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
} else {
DFN ( _sse_MultiTexCoord2fv_2, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
FIXUP(dfn->code, 14, 0x0, (int)rmesa->vb.texcoordptr);
}
return dfn;
}
static struct dynfn *r200_makeSSEMultiTexCoord2f( GLcontext *ctx, const int * key )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
r200ContextPtr rmesa = R200_CONTEXT(ctx);
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key[0] );
if (rmesa->vb.texcoordptr[1] == rmesa->vb.texcoordptr[0]+4) {
DFN ( _sse_MultiTexCoord2f, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
FIXUP(dfn->code, 16, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
} else {
DFN ( _sse_MultiTexCoord2f_2, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
FIXUP(dfn->code, 15, 0x0, (int)rmesa->vb.texcoordptr);
}
return dfn;
}
#endif
void r200InitSSECodegen( struct dfn_generators *gen )
{
if ( cpu_has_xmm ) {
gen->Normal3fv = (void *) r200_makeSSENormal3fv;
gen->Normal3f = (void *) r200_makeSSENormal3f;
gen->Color3fv = (void *) r200_makeSSEColor3fv;
gen->Color3f = (void *) r200_makeSSEColor3f;
#if 0 /* Temporarily disabled as it is broken w/the new cubemap code. - idr */
gen->TexCoord2fv = (void *) r200_makeSSETexCoord2fv;
gen->TexCoord2f = (void *) r200_makeSSETexCoord2f;
gen->MultiTexCoord2fvARB = (void *) r200_makeSSEMultiTexCoord2fv;
gen->MultiTexCoord2fARB = (void *) r200_makeSSEMultiTexCoord2f;
#endif
}
}
#else
void r200InitSSECodegen( struct dfn_generators *gen )
{
(void) gen;
}
#endif

View file

@ -1,440 +0,0 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_x86.c,v 1.2 2002/12/16 16:18:56 dawes Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
The Weather Channel (TM) funded Tungsten Graphics to develop the
initial release of the Radeon 8500 driver under the XFree86 license.
This notice must be preserved.
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, sublicense, 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 NONINFRINGEMENT.
IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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.
**************************************************************************/
/*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
*/
#include "glheader.h"
#include "imports.h"
#include "simple_list.h"
#include "r200_vtxfmt.h"
#if defined(USE_X86_ASM)
#define EXTERN( FUNC ) \
extern const char *FUNC; \
extern const char *FUNC##_end
EXTERN ( _x86_Attribute2fv );
EXTERN ( _x86_Attribute2f );
EXTERN ( _x86_Attribute3fv );
EXTERN ( _x86_Attribute3f );
EXTERN ( _x86_Vertex3fv_6 );
EXTERN ( _x86_Vertex3fv_8 );
EXTERN ( _x86_Vertex3fv );
EXTERN ( _x86_Vertex3f_4 );
EXTERN ( _x86_Vertex3f_6 );
EXTERN ( _x86_Vertex3f );
EXTERN ( _x86_Color4ubv_ub );
EXTERN ( _x86_Color4ubv_4f );
EXTERN ( _x86_Color4ub_ub );
EXTERN ( _x86_MultiTexCoord2fv );
EXTERN ( _x86_MultiTexCoord2fv_2 );
EXTERN ( _x86_MultiTexCoord2f );
EXTERN ( _x86_MultiTexCoord2f_2 );
/* Build specialized versions of the immediate calls on the fly for
* the current state. Generic x86 versions.
*/
struct dynfn *r200_makeX86Vertex3f( GLcontext *ctx, const int *key )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x 0x%08x %d\n", __FUNCTION__,
key[0], key[1], rmesa->vb.vertex_size );
switch (rmesa->vb.vertex_size) {
case 4: {
DFN ( _x86_Vertex3f_4, rmesa->vb.dfn_cache.Vertex3f );
FIXUP(dfn->code, 2, 0x0, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 25, 0x0, (int)&rmesa->vb.vertex[3]);
FIXUP(dfn->code, 36, 0x0, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 46, 0x0, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 51, 0x0, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 60, 0x0, (int)&rmesa->vb.notify);
break;
}
case 6: {
DFN ( _x86_Vertex3f_6, rmesa->vb.dfn_cache.Vertex3f );
FIXUP(dfn->code, 3, 0x0, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 28, 0x0, (int)&rmesa->vb.vertex[3]);
FIXUP(dfn->code, 34, 0x0, (int)&rmesa->vb.vertex[4]);
FIXUP(dfn->code, 40, 0x0, (int)&rmesa->vb.vertex[5]);
FIXUP(dfn->code, 57, 0x0, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 63, 0x0, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 70, 0x0, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 79, 0x0, (int)&rmesa->vb.notify);
break;
}
default: {
DFN ( _x86_Vertex3f, rmesa->vb.dfn_cache.Vertex3f );
FIXUP(dfn->code, 3, 0x0, (int)&rmesa->vb.vertex[3]);
FIXUP(dfn->code, 9, 0x0, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 37, 0x0, rmesa->vb.vertex_size-3);
FIXUP(dfn->code, 44, 0x0, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 50, 0x0, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 56, 0x0, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 67, 0x0, (int)&rmesa->vb.notify);
break;
}
}
return dfn;
}
struct dynfn *r200_makeX86Vertex3fv( GLcontext *ctx, const int *key )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x 0x%08x %d\n", __FUNCTION__,
key[0], key[1], rmesa->vb.vertex_size );
switch (rmesa->vb.vertex_size) {
case 6: {
DFN ( _x86_Vertex3fv_6, rmesa->vb.dfn_cache.Vertex3fv );
FIXUP(dfn->code, 1, 0x00000000, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 27, 0x0000001c, (int)&rmesa->vb.vertex[3]);
FIXUP(dfn->code, 33, 0x00000020, (int)&rmesa->vb.vertex[4]);
FIXUP(dfn->code, 45, 0x00000024, (int)&rmesa->vb.vertex[5]);
FIXUP(dfn->code, 56, 0x00000000, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 61, 0x00000004, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 67, 0x00000004, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 76, 0x00000008, (int)&rmesa->vb.notify);
break;
}
case 8: {
DFN ( _x86_Vertex3fv_8, rmesa->vb.dfn_cache.Vertex3fv );
FIXUP(dfn->code, 1, 0x00000000, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 27, 0x0000001c, (int)&rmesa->vb.vertex[3]);
FIXUP(dfn->code, 33, 0x00000020, (int)&rmesa->vb.vertex[4]);
FIXUP(dfn->code, 45, 0x0000001c, (int)&rmesa->vb.vertex[5]);
FIXUP(dfn->code, 51, 0x00000020, (int)&rmesa->vb.vertex[6]);
FIXUP(dfn->code, 63, 0x00000024, (int)&rmesa->vb.vertex[7]);
FIXUP(dfn->code, 74, 0x00000000, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 79, 0x00000004, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 85, 0x00000004, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 94, 0x00000008, (int)&rmesa->vb.notify);
break;
}
default: {
DFN ( _x86_Vertex3fv, rmesa->vb.dfn_cache.Vertex3fv );
FIXUP(dfn->code, 8, 0x01010101, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 32, 0x00000006, rmesa->vb.vertex_size-3);
FIXUP(dfn->code, 37, 0x00000058, (int)&rmesa->vb.vertex[3]);
FIXUP(dfn->code, 45, 0x01010101, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 50, 0x02020202, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 58, 0x02020202, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 67, 0x0, (int)&rmesa->vb.notify);
break;
}
}
return dfn;
}
static struct dynfn *
r200_makeX86Attribute2fv( struct dynfn * cache, const int *key,
const char * name, void * dest )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key[0] );
DFN ( _x86_Attribute2fv, (*cache) );
FIXUP(dfn->code, 11, 0x0, (int)dest);
FIXUP(dfn->code, 16, 0x4, 4+(int)dest);
return dfn;
}
static struct dynfn *
r200_makeX86Attribute2f( struct dynfn * cache, const int *key,
const char * name, void * dest )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key[0] );
DFN ( _x86_Attribute2f, (*cache) );
FIXUP(dfn->code, 1, 0x0, (int)dest);
return dfn;
}
static struct dynfn *
r200_makeX86Attribute3fv( struct dynfn * cache, const int *key,
const char * name, void * dest )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key[0] );
DFN ( _x86_Attribute3fv, (*cache) );
FIXUP(dfn->code, 14, 0x0, (int)dest);
FIXUP(dfn->code, 20, 0x4, 4+(int)dest);
FIXUP(dfn->code, 25, 0x8, 8+(int)dest);
return dfn;
}
static struct dynfn *
r200_makeX86Attribute3f( struct dynfn * cache, const int *key,
const char * name, void * dest )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key[0] );
DFN ( _x86_Attribute3f, (*cache) );
FIXUP(dfn->code, 14, 0x0, (int)dest);
FIXUP(dfn->code, 20, 0x4, 4+(int)dest);
FIXUP(dfn->code, 25, 0x8, 8+(int)dest);
return dfn;
}
struct dynfn *r200_makeX86Normal3fv( GLcontext *ctx, const int *key )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
return r200_makeX86Attribute3fv( & rmesa->vb.dfn_cache.Normal3fv, key,
__FUNCTION__, rmesa->vb.normalptr );
}
struct dynfn *r200_makeX86Normal3f( GLcontext *ctx, const int *key )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
return r200_makeX86Attribute3f( & rmesa->vb.dfn_cache.Normal3f, key,
__FUNCTION__, rmesa->vb.normalptr );
}
struct dynfn *r200_makeX86Color4ubv( GLcontext *ctx, const int *key )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
r200ContextPtr rmesa = R200_CONTEXT(ctx);
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key[0] );
if (VTX_COLOR(key[0],0) == R200_VTX_PK_RGBA) {
DFN ( _x86_Color4ubv_ub, rmesa->vb.dfn_cache.Color4ubv);
FIXUP(dfn->code, 5, 0x12345678, (int)rmesa->vb.colorptr);
return dfn;
}
else {
DFN ( _x86_Color4ubv_4f, rmesa->vb.dfn_cache.Color4ubv);
FIXUP(dfn->code, 2, 0x00000000, (int)_mesa_ubyte_to_float_color_tab);
FIXUP(dfn->code, 27, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr);
FIXUP(dfn->code, 33, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr+4);
FIXUP(dfn->code, 55, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr+8);
FIXUP(dfn->code, 61, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr+12);
return dfn;
}
}
struct dynfn *r200_makeX86Color4ub( GLcontext *ctx, const int *key )
{
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key[0] );
if (VTX_COLOR(key[0],0) == R200_VTX_PK_RGBA) {
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
r200ContextPtr rmesa = R200_CONTEXT(ctx);
DFN ( _x86_Color4ub_ub, rmesa->vb.dfn_cache.Color4ub );
FIXUP(dfn->code, 18, 0x0, (int)rmesa->vb.colorptr);
FIXUP(dfn->code, 24, 0x0, (int)rmesa->vb.colorptr+1);
FIXUP(dfn->code, 30, 0x0, (int)rmesa->vb.colorptr+2);
FIXUP(dfn->code, 36, 0x0, (int)rmesa->vb.colorptr+3);
return dfn;
}
else
return NULL;
}
struct dynfn *r200_makeX86Color3fv( GLcontext *ctx, const int *key )
{
if (VTX_COLOR(key[0],0) != R200_VTX_FP_RGB)
return NULL;
else
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
return r200_makeX86Attribute3fv( & rmesa->vb.dfn_cache.Color3fv, key,
__FUNCTION__, rmesa->vb.floatcolorptr );
}
}
struct dynfn *r200_makeX86Color3f( GLcontext *ctx, const int *key )
{
if (VTX_COLOR(key[0],0) != R200_VTX_FP_RGB)
return NULL;
else
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
return r200_makeX86Attribute3f( & rmesa->vb.dfn_cache.Color3f, key,
__FUNCTION__, rmesa->vb.floatcolorptr );
}
}
#if 0 /* Temporarily disabled as it is broken w/the new cubemap code. - idr */
struct dynfn *r200_makeX86TexCoord2fv( GLcontext *ctx, const int *key )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
return r200_makeX86Attribute2fv( & rmesa->vb.dfn_cache.TexCoord2fv, key,
__FUNCTION__, rmesa->vb.texcoordptr[0] );
}
struct dynfn *r200_makeX86TexCoord2f( GLcontext *ctx, const int *key )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
return r200_makeX86Attribute2f( & rmesa->vb.dfn_cache.TexCoord2f, key,
__FUNCTION__, rmesa->vb.texcoordptr[0] );
}
struct dynfn *r200_makeX86MultiTexCoord2fvARB( GLcontext *ctx, const int *key )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
r200ContextPtr rmesa = R200_CONTEXT(ctx);
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x 0x%08x\n", __FUNCTION__, key[0], key[1] );
if (rmesa->vb.texcoordptr[1] == rmesa->vb.texcoordptr[0]+4) {
DFN ( _x86_MultiTexCoord2fv, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
FIXUP(dfn->code, 21, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
FIXUP(dfn->code, 27, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]+4);
} else {
DFN ( _x86_MultiTexCoord2fv_2, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
FIXUP(dfn->code, 14, 0x0, (int)rmesa->vb.texcoordptr);
}
return dfn;
}
struct dynfn *r200_makeX86MultiTexCoord2fARB( GLcontext *ctx,
const int *key )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
r200ContextPtr rmesa = R200_CONTEXT(ctx);
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x 0x%08x\n", __FUNCTION__, key[0], key[1] );
if (rmesa->vb.texcoordptr[1] == rmesa->vb.texcoordptr[0]+4) {
DFN ( _x86_MultiTexCoord2f, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
FIXUP(dfn->code, 20, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
FIXUP(dfn->code, 26, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]+4);
}
else {
/* Note: this might get generated multiple times, even though the
* actual emitted code is the same.
*/
DFN ( _x86_MultiTexCoord2f_2, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
FIXUP(dfn->code, 18, 0x0, (int)rmesa->vb.texcoordptr);
}
return dfn;
}
#endif
void r200InitX86Codegen( struct dfn_generators *gen )
{
gen->Vertex3f = r200_makeX86Vertex3f;
gen->Vertex3fv = r200_makeX86Vertex3fv;
gen->Color4ub = r200_makeX86Color4ub; /* PKCOLOR only */
gen->Color4ubv = r200_makeX86Color4ubv; /* PKCOLOR only */
gen->Normal3f = r200_makeX86Normal3f;
gen->Normal3fv = r200_makeX86Normal3fv;
#if 0 /* Temporarily disabled as it is broken w/the new cubemap code. - idr */
gen->TexCoord2f = r200_makeX86TexCoord2f;
gen->TexCoord2fv = r200_makeX86TexCoord2fv;
gen->MultiTexCoord2fARB = r200_makeX86MultiTexCoord2fARB;
gen->MultiTexCoord2fvARB = r200_makeX86MultiTexCoord2fvARB;
#endif
gen->Color3f = r200_makeX86Color3f;
gen->Color3fv = r200_makeX86Color3fv;
/* Not done:
*/
/* gen->Vertex2f = r200_makeX86Vertex2f; */
/* gen->Vertex2fv = r200_makeX86Vertex2fv; */
/* gen->Color3ub = r200_makeX86Color3ub; */
/* gen->Color3ubv = r200_makeX86Color3ubv; */
/* gen->Color4f = r200_makeX86Color4f; */
/* gen->Color4fv = r200_makeX86Color4fv; */
/* gen->TexCoord1f = r200_makeX86TexCoord1f; */
/* gen->TexCoord1fv = r200_makeX86TexCoord1fv; */
/* gen->MultiTexCoord1fARB = r200_makeX86MultiTexCoord1fARB; */
/* gen->MultiTexCoord1fvARB = r200_makeX86MultiTexCoord1fvARB; */
}
#else
void r200InitX86Codegen( struct dfn_generators *gen )
{
(void) gen;
}
#endif

View file

@ -1,499 +0,0 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxtmp_x86.S,v 1.2 2002/11/07 18:31:59 tsi Exp $ */
/**************************************************************************
Copyright 2002 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
on the rights to use, copy, modify, merge, publish, distribute, sub
license, and/or sell copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
ATI, TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
#define GLOBL( x ) \
.globl x; \
x:
.data
.align 4
/*
vertex 3f vertex size 4
*/
GLOBL ( _x86_Vertex3f_4 )
movl (0), %ecx
movl 4(%esp), %eax
movl 8(%esp), %edx
movl %eax, (%ecx)
movl %edx, 4(%ecx)
movl 12(%esp), %eax
movl (0), %edx
movl %eax, 8(%ecx)
movl %edx, 12(%ecx)
movl (0), %eax
addl $16, %ecx
dec %eax
movl %ecx, (0)
movl %eax, (0)
je .1
ret
.1: jmp *0
GLOBL ( _x86_Vertex3f_4_end )
/*
vertex 3f vertex size 6
*/
GLOBL ( _x86_Vertex3f_6 )
push %edi
movl (0), %edi
movl 8(%esp), %eax
movl 12(%esp), %edx
movl 16(%esp), %ecx
movl %eax, (%edi)
movl %edx, 4(%edi)
movl %ecx, 8(%edi)
movl (0), %eax
movl (0), %edx
movl (0), %ecx
movl %eax, 12(%edi)
movl %edx, 16(%edi)
movl %ecx, 20(%edi)
addl $24, %edi
movl (0), %eax
movl %edi, (0)
dec %eax
pop %edi
movl %eax, (0)
je .2
ret
.2: jmp *0
GLOBL ( _x86_Vertex3f_6_end )
/*
vertex 3f generic size
*/
GLOBL ( _x86_Vertex3f )
push %edi
push %esi
movl $0, %esi
movl (0), %edi
movl 12(%esp), %eax
movl 16(%esp), %edx
movl 20(%esp), %ecx
movl %eax, (%edi)
movl %edx, 4(%edi)
movl %ecx, 8(%edi)
addl $12, %edi
movl $0, %ecx
repz
movsl %ds:(%esi), %es:(%edi)
movl (0), %eax
movl %edi, (0)
dec %eax
movl %eax, (0)
pop %esi
pop %edi
je .3
ret
.3: jmp *0
GLOBL ( _x86_Vertex3f_end )
/*
Vertex 3fv vertex size 6
*/
GLOBL ( _x86_Vertex3fv_6 )
movl (0), %eax
movl 4(%esp), %ecx
movl (%ecx), %edx
movl %edx, (%eax)
movl 4(%ecx), %edx
movl 8(%ecx), %ecx
movl %edx, 4(%eax)
movl %ecx, 8(%eax)
movl (28), %edx
movl (32), %ecx
movl %edx, 12(%eax)
movl %ecx, 16(%eax)
movl (36), %edx
movl %edx, 20(%eax)
addl $24, %eax
movl %eax, 0
movl 4, %eax
dec %eax
movl %eax, 4
je .4
ret
.4: jmp *8
GLOBL ( _x86_Vertex3fv_6_end )
/*
Vertex 3fv vertex size 8
*/
GLOBL ( _x86_Vertex3fv_8 )
movl (0), %eax
movl 4(%esp), %ecx
movl (%ecx), %edx
movl %edx ,(%eax)
movl 4(%ecx) ,%edx
movl 8(%ecx) ,%ecx
movl %edx, 4(%eax)
movl %ecx, 8(%eax)
movl (28), %edx
movl (32), %ecx
movl %edx, 12(%eax)
movl %ecx, 16(%eax)
movl (28), %edx
movl (32), %ecx
movl %edx, 20(%eax)
movl %ecx, 24(%eax)
movl (36), %edx
movl %edx, 28(%eax)
addl $32, %eax
movl %eax, (0)
movl 4, %eax
dec %eax
movl %eax, (4)
je .5
ret
.5: jmp *8
GLOBL ( _x86_Vertex3fv_8_end )
/*
Vertex 3fv generic vertex size
*/
GLOBL ( _x86_Vertex3fv )
movl 4(%esp), %edx
push %edi
push %esi
movl (0x1010101), %edi
movl (%edx), %eax
movl 4(%edx), %ecx
movl 8(%edx), %esi
movl %eax, (%edi)
movl %ecx, 4(%edi)
movl %esi, 8(%edi)
addl $12, %edi
movl $6, %ecx
movl $0x58, %esi
repz
movsl %ds:(%esi), %es:(%edi)
movl %edi, (0x1010101)
movl (0x2020202), %eax
pop %esi
pop %edi
dec %eax
movl %eax, (0x2020202)
je .6
ret
.6: jmp *0
GLOBL ( _x86_Vertex3fv_end )
/**
* Generic handler for 2 float format data. This can be used for
* TexCoord2f and possibly other functions.
*/
GLOBL ( _x86_Attribute2f )
movl $0x0, %edx
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, (%edx)
movl %ecx, 4(%edx)
ret
GLOBL ( _x86_Attribute2f_end )
/**
* Generic handler for 2 float vector format data. This can be used for
* TexCoord2fv and possibly other functions.
*/
GLOBL( _x86_Attribute2fv)
movl 4(%esp), %eax /* load 'v' off stack */
movl (%eax), %ecx /* load v[0] */
movl 4(%eax), %eax /* load v[1] */
movl %ecx, 0 /* store v[0] to current vertex */
movl %eax, 4 /* store v[1] to current vertex */
ret
GLOBL ( _x86_Attribute2fv_end )
/**
* Generic handler for 3 float format data. This can be used for
* Normal3f, Color3f (when the color target is also float), or
* TexCoord3f.
*/
GLOBL ( _x86_Attribute3f )
movl 4(%esp), %ecx
movl 8(%esp), %edx
movl 12(%esp), %eax
movl %ecx, 0
movl %edx, 4
movl %eax, 8
ret
GLOBL ( _x86_Attribute3f_end )
/**
* Generic handler for 3 float vector format data. This can be used for
* Normal3f, Color3f (when the color target is also float), or
* TexCoord3f.
*/
GLOBL( _x86_Attribute3fv)
movl 4(%esp), %eax /* load 'v' off stack */
movl (%eax), %ecx /* load v[0] */
movl 4(%eax), %edx /* load v[1] */
movl 8(%eax), %eax /* load v[2] */
movl %ecx, 0 /* store v[0] to current vertex */
movl %edx, 4 /* store v[1] to current vertex */
movl %eax, 8 /* store v[2] to current vertex */
ret
GLOBL ( _x86_Attribute3fv_end )
/*
Color 4ubv_ub
*/
GLOBL ( _x86_Color4ubv_ub )
movl 4(%esp), %eax
movl $0x12345678, %edx
movl (%eax), %eax
movl %eax, (%edx)
ret
GLOBL ( _x86_Color4ubv_ub_end )
/*
Color 4ubv 4f
*/
GLOBL ( _x86_Color4ubv_4f )
push %ebx
movl $0, %edx
xor %eax, %eax
xor %ecx, %ecx
movl 8(%esp), %ebx
movl (%ebx), %ebx
mov %bl, %al
mov %bh, %cl
movl (%edx,%eax,4),%eax
movl (%edx,%ecx,4),%ecx
movl %eax, (0xdeadbeaf)
movl %ecx, (0xdeadbeaf)
xor %eax, %eax
xor %ecx, %ecx
shr $16, %ebx
mov %bl, %al
mov %bh, %cl
movl (%edx,%eax,4), %eax
movl (%edx,%ecx,4), %ecx
movl %eax, (0xdeadbeaf)
movl %ecx, (0xdeadbeaf)
pop %ebx
ret
GLOBL ( _x86_Color4ubv_4f_end )
/*
Color4ub_ub
*/
GLOBL( _x86_Color4ub_ub )
push %ebx
movl 8(%esp), %eax
movl 12(%esp), %edx
movl 16(%esp), %ecx
movl 20(%esp), %ebx
mov %al, (0)
mov %dl, (0)
mov %cl, (0)
mov %bl, (0)
pop %ebx
ret
GLOBL( _x86_Color4ub_ub_end )
/* \todo: change the "and $7, %eax" to something like "target & 4 ? target & 5 : target & 3)" */
/*
MultiTexCoord2fv st0/st1
*/
GLOBL( _x86_MultiTexCoord2fv )
movl 4(%esp), %eax
movl 8(%esp), %ecx
and $7, %eax
movl (%ecx), %edx
shl $3, %eax
movl 4(%ecx), %ecx
movl %edx, 0xdeadbeef(%eax)
movl %ecx, 0xdeadbeef(%eax)
ret
GLOBL( _x86_MultiTexCoord2fv_end )
/*
MultiTexCoord2fv
*/
GLOBL( _x86_MultiTexCoord2fv_2 )
movl 4(%esp,1), %eax
movl 8(%esp,1), %ecx
and $0x7, %eax
movl 0(,%eax,4), %edx
movl (%ecx), %eax
movl %eax, (%edx)
movl 4(%ecx), %eax
movl %eax, 4(%edx)
ret
GLOBL( _x86_MultiTexCoord2fv_2_end )
/*
MultiTexCoord2f st0/st1
*/
GLOBL( _x86_MultiTexCoord2f )
movl 4(%esp), %eax
movl 8(%esp), %edx
movl 12(%esp), %ecx
and $7, %eax
shl $3, %eax
movl %edx, 0xdeadbeef(%eax)
movl %ecx, 0xdeadbeef(%eax)
ret
GLOBL( _x86_MultiTexCoord2f_end )
/*
MultiTexCoord2f
*/
GLOBL( _x86_MultiTexCoord2f_2 )
movl 4(%esp), %eax
movl 8(%esp), %edx
movl 12(%esp,1), %ecx
and $7,%eax
movl 0(,%eax,4), %eax
movl %edx, (%eax)
movl %ecx, 4(%eax)
ret
GLOBL( _x86_MultiTexCoord2f_2_end )
#if defined(USE_SSE_ASM)
/**
* This can be used as a template for either Color3fv (when the color
* target is also a 3f) or Normal3fv.
*/
GLOBL( _sse_Attribute3fv )
movl 4(%esp), %eax
movlps (%eax), %xmm0
movl 8(%eax), %eax
movlps %xmm0, 0
movl %eax, 8
ret
GLOBL( _sse_Attribute3fv_end )
/**
* This can be used as a template for either Color3f (when the color
* target is also a 3f) or Normal3f.
*/
GLOBL( _sse_Attribute3f )
movlps 4(%esp), %xmm0
movl 12(%esp), %eax
movlps %xmm0, 0
movl %eax, 8
ret
GLOBL( _sse_Attribute3f_end )
/**
* Generic handler for 2 float vector format data. This can be used for
* TexCoord2fv and possibly other functions.
*/
GLOBL( _sse_Attribute2fv )
movl 4(%esp), %eax
movlps (%eax), %xmm0
movlps %xmm0, 0
ret
GLOBL( _sse_Attribute2fv_end )
/**
* Generic handler for 2 float format data. This can be used for
* TexCoord2f and possibly other functions.
*/
GLOBL( _sse_Attribute2f )
movlps 4(%esp), %xmm0
movlps %xmm0, 0
ret
GLOBL( _sse_Attribute2f_end )
/*
MultiTexCoord2fv st0/st1
*/
GLOBL( _sse_MultiTexCoord2fv )
movl 4(%esp), %eax
movl 8(%esp), %ecx
and $7, %eax
movlps (%ecx), %xmm0
movlps %xmm0, 0xdeadbeef(,%eax,8)
ret
GLOBL( _sse_MultiTexCoord2fv_end )
/*
MultiTexCoord2fv
*/
GLOBL( _sse_MultiTexCoord2fv_2 )
movl 4(%esp), %eax
movl 8(%esp), %ecx
and $0x7, %eax
movl 0(,%eax,4), %edx
movlps (%ecx), %xmm0
movlps %xmm0, (%edx)
ret
GLOBL( _sse_MultiTexCoord2fv_2_end )
/*
MultiTexCoord2f st0/st1
*/
GLOBL( _sse_MultiTexCoord2f )
movl 4(%esp), %eax
and $7, %eax
movlps 8(%esp), %xmm0
movlps %xmm0, 0xdeadbeef(,%eax,8)
ret
GLOBL( _sse_MultiTexCoord2f_end )
/*
MultiTexCoord2f
*/
GLOBL( _sse_MultiTexCoord2f_2 )
movl 4(%esp), %eax
movlps 8(%esp), %xmm0
and $7,%eax
movl 0(,%eax,4), %eax
movlps %xmm0, (%eax)
ret
GLOBL( _sse_MultiTexCoord2f_2_end )
#endif
#if defined (__ELF__) && defined (__linux__)
.section .note.GNU-stack,"",%progbits
#endif

View file

@ -44,7 +44,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
#include "tnl/t_pipeline.h"
@ -292,7 +292,7 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
/* Initialize the software rasterizer and helper modules.
*/
_swrast_CreateContext(ctx);
_ac_CreateContext(ctx);
_vbo_CreateContext(ctx);
_tnl_CreateContext(ctx);
_swsetup_CreateContext(ctx);
_swsetup_Wakeup(ctx);
@ -305,7 +305,7 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
/* Try and keep materials and vertices separate:
*/
_tnl_isolate_materials(ctx, GL_TRUE);
/* _tnl_isolate_materials(ctx, GL_TRUE); */
/* Configure swrast and TNL to match hardware characteristics:
*/
@ -486,7 +486,7 @@ void r300DestroyContext(__DRIcontextPrivate * driContextPriv)
_swsetup_DestroyContext(r300->radeon.glCtx);
_tnl_ProgramCacheDestroy(r300->radeon.glCtx);
_tnl_DestroyContext(r300->radeon.glCtx);
_ac_DestroyContext(r300->radeon.glCtx);
_vbo_DestroyContext(r300->radeon.glCtx);
_swrast_DestroyContext(r300->radeon.glCtx);
if (r300->dma.current.buf) {

View file

@ -48,7 +48,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "radeon_context.h"
#define USER_BUFFERS
#define RADEON_VTXFMT_A
/* KW: Disable this code. Driver should hook into vbo module
* directly, see i965 driver for example.
*/
/* #define RADEON_VTXFMT_A */
#define HW_VBOS
/* We don't handle 16 bits elts swapping yet */
@ -754,7 +757,7 @@ struct radeon_vertex_buffer {
struct dt AttribPtr[VERT_ATTRIB_MAX];
struct tnl_prim *Primitive;
const struct _mesa_prim *Primitive;
GLuint PrimitiveCount;
GLint LockFirst;
GLsizei LockCount;

View file

@ -42,7 +42,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "api_arrayelt.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
#include "tnl/t_vp_build.h"
@ -352,7 +352,7 @@ GLboolean r300_run_vb_render(GLcontext *ctx,
r300EmitState(rmesa);
for(i=0; i < VB->PrimitiveCount; i++){
GLuint prim = VB->Primitive[i].mode;
GLuint prim = _tnl_translate_prim(&VB->Primitive[i]);
GLuint start = VB->Primitive[i].start;
GLuint length = VB->Primitive[i].count;

View file

@ -46,7 +46,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "api_arrayelt.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
#include "texformat.h"
@ -1885,7 +1885,7 @@ static void r300InvalidateState(GLcontext * ctx, GLuint new_state)
_swrast_InvalidateState(ctx, new_state);
_swsetup_InvalidateState(ctx, new_state);
_ac_InvalidateState(ctx, new_state);
_vbo_InvalidateState(ctx, new_state);
_tnl_InvalidateState(ctx, new_state);
_ae_invalidate_state(ctx, new_state);

View file

@ -41,7 +41,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "light.h"
#include "swrast/swrast.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
#include "tnl/t_pipeline.h"
#include "swrast_setup/swrast_setup.h"

View file

@ -46,6 +46,8 @@
#include "state.h"
#include "image.h"
#include "vbo/vbo_context.h"
#define CONV_VB(a, b) rvb->AttribPtr[(a)].size = vb->b->size, \
rvb->AttribPtr[(a)].type = GL_FLOAT, \
rvb->AttribPtr[(a)].stride = vb->b->stride, \
@ -129,15 +131,7 @@ static int setup_arrays(r300ContextPtr rmesa, GLint start)
CONV(i, VertexAttrib[i]);
for (i=0; i < VERT_ATTRIB_MAX; i++) {
if (enabled & (1 << i)) {
rmesa->state.VB.AttribPtr[i].data += rmesa->state.VB.AttribPtr[i].stride * start;
} else {
def.data = ctx->Current.Attrib[i];
memcpy(&rmesa->state.VB.AttribPtr[i], &def, sizeof(struct dt));
}
/*if(rmesa->state.VB.AttribPtr[i].data == ctx->Current.Attrib[i])
fprintf(stderr, "%d is default coord\n", i);*/
rmesa->state.VB.AttribPtr[i].data += rmesa->state.VB.AttribPtr[i].stride * start;
}
for(i=0; i < VERT_ATTRIB_MAX; i++){
@ -177,177 +171,18 @@ static int setup_arrays(r300ContextPtr rmesa, GLint start)
void radeon_init_vtxfmt_a(r300ContextPtr rmesa);
static void radeonDrawElements( GLenum mode, GLsizei count, GLenum type, const GLvoid *c_indices )
{
GET_CURRENT_CONTEXT(ctx);
r300ContextPtr rmesa = R300_CONTEXT(ctx);
int elt_size;
int i;
unsigned int min = ~0, max = 0;
struct tnl_prim prim;
static void *ptr = NULL;
struct r300_dma_region rvb;
const GLvoid *indices = c_indices;
if (count > 65535) {
WARN_ONCE("Too many verts!\n");
goto fallback;
}
if (ctx->Array.ElementArrayBufferObj->Name) {
/* use indices in the buffer object */
if (!ctx->Array.ElementArrayBufferObj->Data) {
_mesa_warning(ctx, "DrawRangeElements with empty vertex elements buffer!");
return;
}
/* actual address is the sum of pointers */
indices = (GLvoid *)
ADD_POINTERS(ctx->Array.ElementArrayBufferObj->Data, (const GLubyte *) c_indices);
}
if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices ))
return;
FLUSH_CURRENT( ctx, 0 );
memset(&rvb, 0, sizeof(rvb));
switch (type) {
case GL_UNSIGNED_BYTE:
for (i=0; i < count; i++) {
if(((unsigned char *)indices)[i] < min)
min = ((unsigned char *)indices)[i];
if(((unsigned char *)indices)[i] > max)
max = ((unsigned char *)indices)[i];
}
#ifdef FORCE_32BITS_ELTS
elt_size = 4;
#else
elt_size = 2;
#endif
r300AllocDmaRegion(rmesa, &rvb, count * elt_size, elt_size);
rvb.aos_offset = GET_START(&rvb);
ptr = rvb.address + rvb.start;
#ifdef FORCE_32BITS_ELTS
for (i=0; i < count; i++)
((unsigned int *)ptr)[i] = ((unsigned char *)indices)[i] - min;
#else
for (i=0; i < count; i++)
((unsigned short int *)ptr)[i] = ((unsigned char *)indices)[i] - min;
#endif
break;
case GL_UNSIGNED_SHORT:
for (i=0; i < count; i++) {
if(((unsigned short int *)indices)[i] < min)
min = ((unsigned short int *)indices)[i];
if(((unsigned short int *)indices)[i] > max)
max = ((unsigned short int *)indices)[i];
}
#ifdef FORCE_32BITS_ELTS
elt_size = 4;
#else
elt_size = 2;
#endif
r300AllocDmaRegion(rmesa, &rvb, count * elt_size, elt_size);
rvb.aos_offset = GET_START(&rvb);
ptr = rvb.address + rvb.start;
#ifdef FORCE_32BITS_ELTS
for (i=0; i < count; i++)
((unsigned int *)ptr)[i] = ((unsigned short int *)indices)[i] - min;
#else
for (i=0; i < count; i++)
((unsigned short int *)ptr)[i] = ((unsigned short int *)indices)[i] - min;
#endif
break;
case GL_UNSIGNED_INT:
for (i=0; i < count; i++) {
if(((unsigned int *)indices)[i] < min)
min = ((unsigned int *)indices)[i];
if(((unsigned int *)indices)[i] > max)
max = ((unsigned int *)indices)[i];
}
#ifdef FORCE_32BITS_ELTS
elt_size = 4;
#else
if (max - min <= 65535)
elt_size = 2;
else
elt_size = 4;
#endif
r300AllocDmaRegion(rmesa, &rvb, count * elt_size, elt_size);
rvb.aos_offset = GET_START(&rvb);
ptr = rvb.address + rvb.start;
if (elt_size == 2)
for (i=0; i < count; i++)
((unsigned short int *)ptr)[i] = ((unsigned int *)indices)[i] - min;
else
for (i=0; i < count; i++)
((unsigned int *)ptr)[i] = ((unsigned int *)indices)[i] - min;
break;
default:
WARN_ONCE("Unknown elt type!\n");
goto fallback;
}
if (ctx->NewState)
_mesa_update_state( ctx );
r300UpdateShaders(rmesa);
if (setup_arrays(rmesa, min) >= R300_FALLBACK_TCL) {
r300ReleaseDmaRegion(rmesa, &rvb, __FUNCTION__);
goto fallback;
}
rmesa->state.VB.Count = max - min + 1;
r300UpdateShaderStates(rmesa);
rmesa->state.VB.Primitive = &prim;
rmesa->state.VB.PrimitiveCount = 1;
prim.mode = mode | PRIM_BEGIN | PRIM_END;
if (rmesa->state.VB.LockCount)
prim.start = min - rmesa->state.VB.LockFirst;
else
prim.start = 0;
prim.count = count;
rmesa->state.VB.Elts = ptr;
rmesa->state.VB.elt_size = elt_size;
if (r300_run_vb_render(ctx, NULL)) {
r300ReleaseDmaRegion(rmesa, &rvb, __FUNCTION__);
goto fallback;
}
if(rvb.buf)
radeon_mm_use(rmesa, rvb.buf->id);
r300ReleaseDmaRegion(rmesa, &rvb, __FUNCTION__);
return;
fallback:
_tnl_array_init(ctx);
_mesa_install_exec_vtxfmt( ctx, &TNL_CONTEXT(ctx)->exec_vtxfmt );
CALL_DrawElements(GET_DISPATCH(), (mode, count, type, c_indices));
radeon_init_vtxfmt_a(rmesa);
_mesa_install_exec_vtxfmt( ctx, &TNL_CONTEXT(ctx)->exec_vtxfmt );
}
static void radeonDrawRangeElements(GLenum mode, GLuint min, GLuint max, GLsizei count, GLenum type, const GLvoid *c_indices)
static void radeonDrawRangeElements(GLcontext *ctx,
GLenum mode,
GLuint min,
GLuint max,
GLsizei count,
GLenum type,
const GLvoid *c_indices)
{
GET_CURRENT_CONTEXT(ctx);
#if 1
return GL_FALSE;
#else
r300ContextPtr rmesa = R300_CONTEXT(ctx);
struct tnl_prim prim;
int elt_size;
@ -371,26 +206,23 @@ static void radeonDrawRangeElements(GLenum mode, GLuint min, GLuint max, GLsizei
indices += i * _mesa_sizeof_type(type);
count -= i;
}
return ;
return GL_TRUE;
}
WARN_ONCE("Too many verts!\n");
goto fallback;
return GL_FALSE;
}
if (ctx->Array.ElementArrayBufferObj->Name) {
/* use indices in the buffer object */
if (!ctx->Array.ElementArrayBufferObj->Data) {
_mesa_warning(ctx, "DrawRangeElements with empty vertex elements buffer!");
return;
return GL_TRUE;
}
/* actual address is the sum of pointers */
indices = (GLvoid *)
ADD_POINTERS(ctx->Array.ElementArrayBufferObj->Data, (const GLubyte *) c_indices);
}
if (!_mesa_validate_DrawRangeElements( ctx, mode, min, max, count, type, indices ))
return;
FLUSH_CURRENT( ctx, 0 );
#ifdef OPTIMIZE_ELTS
min = 0;
@ -465,7 +297,7 @@ static void radeonDrawRangeElements(GLenum mode, GLuint min, GLuint max, GLsizei
default:
WARN_ONCE("Unknown elt type!\n");
goto fallback;
return GL_FALSE;
}
/* XXX: setup_arrays before state update? */
@ -477,7 +309,7 @@ static void radeonDrawRangeElements(GLenum mode, GLuint min, GLuint max, GLsizei
if (setup_arrays(rmesa, min) >= R300_FALLBACK_TCL) {
r300ReleaseDmaRegion(rmesa, &rvb, __FUNCTION__);
goto fallback;
return GL_FALSE;
}
rmesa->state.VB.Count = max - min + 1;
@ -501,37 +333,34 @@ static void radeonDrawRangeElements(GLenum mode, GLuint min, GLuint max, GLsizei
if (r300_run_vb_render(ctx, NULL)) {
r300ReleaseDmaRegion(rmesa, &rvb, __FUNCTION__);
goto fallback;
return GL_FALSE;
}
if(rvb.buf)
radeon_mm_use(rmesa, rvb.buf->id);
r300ReleaseDmaRegion(rmesa, &rvb, __FUNCTION__);
return ;
fallback:
_tnl_array_init(ctx);
_mesa_install_exec_vtxfmt( ctx, &TNL_CONTEXT(ctx)->exec_vtxfmt );
CALL_DrawRangeElements(GET_DISPATCH(), (mode, min, max, count, type, c_indices));
radeon_init_vtxfmt_a(rmesa);
_mesa_install_exec_vtxfmt( ctx, &TNL_CONTEXT(ctx)->exec_vtxfmt );
return GL_TRUE;
#endif
}
static void radeonDrawArrays( GLenum mode, GLint start, GLsizei count )
static GLboolean radeonDrawArrays( GLcontext *ctx,
GLenum mode, GLint start, GLsizei count )
{
#if 1
return GL_FALSE;
#else
GET_CURRENT_CONTEXT(ctx);
r300ContextPtr rmesa = R300_CONTEXT(ctx);
struct tnl_prim prim;
if (count > 65535) {
/* TODO: split into multiple draws.
*/
WARN_ONCE("Too many verts!\n");
goto fallback;
return GL_FALSE;
}
if (!_mesa_validate_DrawArrays( ctx, mode, start, count ))
return;
FLUSH_CURRENT( ctx, 0 );
if (ctx->NewState)
@ -542,7 +371,7 @@ static void radeonDrawArrays( GLenum mode, GLint start, GLsizei count )
r300UpdateShaders(rmesa);
if (setup_arrays(rmesa, start) >= R300_FALLBACK_TCL)
goto fallback;
return GL_FALSE;
rmesa->state.VB.Count = count;
@ -564,31 +393,70 @@ static void radeonDrawArrays( GLenum mode, GLint start, GLsizei count )
rmesa->state.VB.elt_max = 0;
if (r300_run_vb_render(ctx, NULL))
goto fallback;
return GL_FALSE;
return ;
fallback:
_tnl_array_init(ctx);
_mesa_install_exec_vtxfmt( ctx, &TNL_CONTEXT(ctx)->exec_vtxfmt );
CALL_DrawArrays(GET_DISPATCH(), (mode, start, count));
radeon_init_vtxfmt_a(rmesa);
_mesa_install_exec_vtxfmt( ctx, &TNL_CONTEXT(ctx)->exec_vtxfmt );
return GL_TRUE;
#endif
}
static void radeon_draw_prims( GLcontext *ctx,
const struct gl_client_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,
GLuint min_index,
GLuint max_index)
{
if (ib == NULL) {
for (i = 0; i < nr_prims; i++) {
if (!radeonDrawArrays(ctx,
prim->mode,
prim->start,
prim->count)) {
/* Fallback
*/
_tnl_draw_prims(ctx,
arrays,
prim + i,
nr_prims - i,
ib,
min_index,
max_index);
return;
}
}
} else {
for (i = 0; i < nr_prims; i++) {
if (!radeonDrawRangeElements(ctx,
prim->mode,
min_index,
max_index,
prim->count,
ib->types,
ib->ptr)) {
/* Fallback
*/
_tnl_draw_prims(ctx,
arrays,
prim + i,
nr_prims - i,
ib,
min_index,
max_index);
return;
}
}
}
}
void radeon_init_vtxfmt_a(r300ContextPtr rmesa)
{
GLcontext *ctx;
GLvertexformat *vfmt;
ctx = rmesa->radeon.glCtx;
vfmt = (GLvertexformat *)ctx->TnlModule.Current;
vfmt->DrawElements = radeonDrawElements;
vfmt->DrawArrays = radeonDrawArrays;
vfmt->DrawRangeElements = radeonDrawRangeElements;
struct vbo_context *vbo = vbo_context(ctx);
vbo->draw_prims = radeon_draw_prims;
}
#endif
#ifdef HW_VBOS

View file

@ -22,11 +22,7 @@ DRIVER_SOURCES = \
radeon_swtcl.c \
radeon_span.c \
radeon_maos.c \
radeon_sanity.c \
radeon_vtxfmt.c \
radeon_vtxfmt_c.c \
radeon_vtxfmt_sse.c \
radeon_vtxfmt_x86.c
radeon_sanity.c
C_SOURCES = \
$(COMMON_SOURCES) \
@ -34,8 +30,7 @@ C_SOURCES = \
DRIVER_DEFINES = -DRADEON_COMMON=0
X86_SOURCES = \
radeon_vtxtmp_x86.S
X86_SOURCES =
include ../Makefile.template

View file

@ -46,7 +46,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
#include "tnl/t_pipeline.h"
@ -60,7 +60,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "radeon_tex.h"
#include "radeon_swtcl.h"
#include "radeon_tcl.h"
#include "radeon_vtxfmt.h"
#include "radeon_maos.h"
#define need_GL_ARB_multisample
@ -361,7 +360,7 @@ radeonCreateContext( const __GLcontextModes *glVisual,
/* Initialize the software rasterizer and helper modules.
*/
_swrast_CreateContext( ctx );
_ac_CreateContext( ctx );
_vbo_CreateContext( ctx );
_tnl_CreateContext( ctx );
_swsetup_CreateContext( ctx );
_ae_create_context( ctx );
@ -370,13 +369,10 @@ radeonCreateContext( const __GLcontextModes *glVisual,
*/
_tnl_destroy_pipeline( ctx );
_tnl_install_pipeline( ctx, radeon_pipeline );
ctx->Driver.FlushVertices = radeonFlushVertices;
/* Try and keep materials and vertices separate:
*/
_tnl_isolate_materials( ctx, GL_TRUE );
/* _mesa_allow_light_in_model( ctx, GL_FALSE ); */
/* _tnl_isolate_materials( ctx, GL_TRUE ); */
/* Configure swrast and T&L to match hardware characteristics:
*/
@ -450,10 +446,7 @@ radeonCreateContext( const __GLcontextModes *glVisual,
}
if (rmesa->radeonScreen->chip_flags & RADEON_CHIPSET_TCL) {
if (tcl_mode >= DRI_CONF_TCL_VTXFMT)
radeonVtxfmtInit( ctx, tcl_mode >= DRI_CONF_TCL_CODEGEN );
_tnl_need_dlist_norm_lengths( ctx, GL_FALSE );
/* _tnl_need_dlist_norm_lengths( ctx, GL_FALSE ); */
}
return GL_TRUE;
}
@ -484,7 +477,7 @@ void radeonDestroyContext( __DRIcontextPrivate *driContextPriv )
release_texture_heaps = (rmesa->glCtx->Shared->RefCount == 1);
_swsetup_DestroyContext( rmesa->glCtx );
_tnl_DestroyContext( rmesa->glCtx );
_ac_DestroyContext( rmesa->glCtx );
_vbo_DestroyContext( rmesa->glCtx );
_swrast_DestroyContext( rmesa->glCtx );
radeonDestroySwtcl( rmesa->glCtx );
@ -494,12 +487,6 @@ void radeonDestroyContext( __DRIcontextPrivate *driContextPriv )
radeonFlushCmdBuf( rmesa, __FUNCTION__ );
}
if (!(rmesa->TclFallback & RADEON_TCL_FALLBACK_TCL_DISABLE)) {
int tcl_mode = driQueryOptioni(&rmesa->optionCache, "tcl_mode");
if (tcl_mode >= DRI_CONF_TCL_VTXFMT)
radeonVtxfmtDestroy( rmesa->glCtx );
}
_mesa_vector4f_free( &rmesa->tcl.ObjClean );
if (rmesa->state.scissor.pClipRects) {
@ -621,9 +608,6 @@ radeonMakeCurrent( __DRIcontextPrivate *driContextPriv,
(GLframebuffer *) driDrawPriv->driverPrivate,
(GLframebuffer *) driReadPriv->driverPrivate );
if (newCtx->vb.enabled)
radeonVtxfmtMakeCurrent( newCtx->glCtx );
} else {
if (RADEON_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s ctx is null\n", __FUNCTION__);

View file

@ -37,7 +37,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "imports.h"
#include "mtypes.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "math/m_translate.h"
#include "tnl/tnl.h"
#include "tnl/t_pipeline.h"

View file

@ -42,7 +42,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "context.h"
#include "framebuffer.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
#include "tnl/t_pipeline.h"
#include "swrast_setup/swrast_setup.h"
@ -53,7 +53,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "radeon_tcl.h"
#include "radeon_tex.h"
#include "radeon_swtcl.h"
#include "radeon_vtxfmt.h"
#include "drirenderbuffer.h"
static void radeonUpdateSpecular( GLcontext *ctx );
@ -2303,11 +2302,10 @@ static void radeonInvalidateState( GLcontext *ctx, GLuint new_state )
{
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
_ac_InvalidateState( ctx, new_state );
_vbo_InvalidateState( ctx, new_state );
_tnl_InvalidateState( ctx, new_state );
_ae_invalidate_state( ctx, new_state );
RADEON_CONTEXT(ctx)->NewGLState |= new_state;
radeonVtxfmtInvalidate( ctx );
}

View file

@ -33,7 +33,7 @@
#include "api_arrayelt.h"
#include "swrast/swrast.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
#include "tnl/t_pipeline.h"
#include "swrast_setup/swrast_setup.h"
@ -44,7 +44,6 @@
#include "radeon_tcl.h"
#include "radeon_tex.h"
#include "radeon_swtcl.h"
#include "radeon_vtxfmt.h"
#include "xmlpool.h"

View file

@ -45,7 +45,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "tnl/tnl.h"
#include "tnl/t_context.h"
#include "tnl/t_pipeline.h"
#include "tnl/t_vtx_api.h" /* for _tnl_FlushVertices */
#include "radeon_context.h"
#include "radeon_ioctl.h"
@ -848,14 +847,6 @@ void radeonFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
}
void radeonFlushVertices( GLcontext *ctx, GLuint flags )
{
_tnl_FlushVertices( ctx, flags );
if (flags & FLUSH_STORED_VERTICES)
RADEON_NEWPRIM( RADEON_CONTEXT( ctx ) );
}
/**********************************************************************/
/* Initialization. */
/**********************************************************************/

View file

@ -43,7 +43,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
extern void radeonInitSwtcl( GLcontext *ctx );
extern void radeonDestroySwtcl( GLcontext *ctx );
extern void radeonFlushVertices( GLcontext *ctx, GLuint flags );
extern void radeonChooseRenderState( GLcontext *ctx );
extern void radeonChooseVertexState( GLcontext *ctx );

View file

@ -39,7 +39,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "mtypes.h"
#include "enums.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
#include "tnl/t_pipeline.h"

File diff suppressed because it is too large Load diff

View file

@ -1,120 +0,0 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.h,v 1.3 2002/12/21 17:02:16 dawes Exp $ */
/**************************************************************************
Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
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, sublicense, 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 NONINFRINGEMENT.
IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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.
**************************************************************************/
/*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
*/
#ifndef __RADEON_VTXFMT_H__
#define __RADEON_VTXFMT_H__
#include "radeon_context.h"
extern void radeonVtxfmtUpdate( GLcontext *ctx );
extern void radeonVtxfmtInit( GLcontext *ctx, GLboolean useCodegen );
extern void radeonVtxfmtInvalidate( GLcontext *ctx );
extern void radeonVtxfmtDestroy( GLcontext *ctx );
extern void radeonVtxfmtInitChoosers( GLvertexformat *vfmt );
extern void radeonVtxfmtMakeCurrent( GLcontext *ctx );
extern void radeonVtxfmtUnbindContext( GLcontext *ctx );
extern void radeon_copy_to_current( GLcontext *ctx );
#define DFN( FUNC, CACHE) \
do { \
char *start = (char *)&FUNC; \
char *end = (char *)&FUNC##_end; \
insert_at_head( &CACHE, dfn ); \
dfn->key = key; \
dfn->code = _mesa_exec_malloc( end - start ); \
_mesa_memcpy(dfn->code, start, end - start); \
} \
while ( 0 )
#define FIXUP( CODE, OFFSET, CHECKVAL, NEWVAL ) \
do { \
int *icode = (int *)(CODE+OFFSET); \
assert (*icode == CHECKVAL); \
*icode = (int)NEWVAL; \
} while (0)
/* Useful for figuring out the offsets:
*/
#define FIXUP2( CODE, OFFSET, CHECKVAL, NEWVAL ) \
do { \
while (*(int *)(CODE+OFFSET) != CHECKVAL) OFFSET++; \
fprintf(stderr, "%s/%d CVAL %x OFFSET %d VAL %x\n", __FUNCTION__, \
__LINE__, CHECKVAL, OFFSET, (int)(NEWVAL)); \
*(int *)(CODE+OFFSET) = (int)(NEWVAL); \
OFFSET += 4; \
} while (0)
/*
*/
void radeonInitCodegen( struct dfn_generators *gen, GLboolean useCodegen );
void radeonInitX86Codegen( struct dfn_generators *gen );
void radeonInitSSECodegen( struct dfn_generators *gen );
/* Defined in radeon_vtxfmt_x86.c
*/
struct dynfn *radeon_makeX86Vertex2f( GLcontext *, int );
struct dynfn *radeon_makeX86Vertex2fv( GLcontext *, int );
struct dynfn *radeon_makeX86Vertex3f( GLcontext *, int );
struct dynfn *radeon_makeX86Vertex3fv( GLcontext *, int );
struct dynfn *radeon_makeX86Color4ub( GLcontext *, int );
struct dynfn *radeon_makeX86Color4ubv( GLcontext *, int );
struct dynfn *radeon_makeX86Color3ub( GLcontext *, int );
struct dynfn *radeon_makeX86Color3ubv( GLcontext *, int );
struct dynfn *radeon_makeX86Color4f( GLcontext *, int );
struct dynfn *radeon_makeX86Color4fv( GLcontext *, int );
struct dynfn *radeon_makeX86Color3f( GLcontext *, int );
struct dynfn *radeon_makeX86Color3fv( GLcontext *, int );
struct dynfn *radeon_makeX86SecondaryColor3ubEXT( GLcontext *, int );
struct dynfn *radeon_makeX86SecondaryColor3ubvEXT( GLcontext *, int );
struct dynfn *radeon_makeX86SecondaryColor3fEXT( GLcontext *, int );
struct dynfn *radeon_makeX86SecondaryColor3fvEXT( GLcontext *, int );
struct dynfn *radeon_makeX86Normal3f( GLcontext *, int );
struct dynfn *radeon_makeX86Normal3fv( GLcontext *, int );
struct dynfn *radeon_makeX86TexCoord2f( GLcontext *, int );
struct dynfn *radeon_makeX86TexCoord2fv( GLcontext *, int );
struct dynfn *radeon_makeX86TexCoord1f( GLcontext *, int );
struct dynfn *radeon_makeX86TexCoord1fv( GLcontext *, int );
struct dynfn *radeon_makeX86MultiTexCoord2fARB( GLcontext *, int );
struct dynfn *radeon_makeX86MultiTexCoord2fvARB( GLcontext *, int );
struct dynfn *radeon_makeX86MultiTexCoord1fARB( GLcontext *, int );
struct dynfn *radeon_makeX86MultiTexCoord1fvARB( GLcontext *, int );
#endif

View file

@ -1,924 +0,0 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_c.c,v 1.2 2002/12/16 16:18:59 dawes Exp $ */
/**************************************************************************
Copyright 2002 ATI Technologies Inc., Ontario, Canada, and
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, sublicense, 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 NONINFRINGEMENT.
IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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.
**************************************************************************/
/*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
*/
#include "glheader.h"
#include "mtypes.h"
#include "colormac.h"
#include "simple_list.h"
#include "api_noop.h"
#include "vtxfmt.h"
#include "radeon_vtxfmt.h"
#include "dispatch.h"
/* Fallback versions of all the entrypoints for situations where
* codegen isn't available. This is still a lot faster than the
* vb/pipeline implementation in Mesa.
*/
static void radeon_Vertex3f( GLfloat x, GLfloat y, GLfloat z )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
int i;
*rmesa->vb.dmaptr++ = *(int *)&x;
*rmesa->vb.dmaptr++ = *(int *)&y;
*rmesa->vb.dmaptr++ = *(int *)&z;
for (i = 3; i < rmesa->vb.vertex_size; i++)
*rmesa->vb.dmaptr++ = rmesa->vb.vertex[i].i;
if (--rmesa->vb.counter == 0)
rmesa->vb.notify();
}
static void radeon_Vertex3fv( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
int i;
*rmesa->vb.dmaptr++ = *(int *)&v[0];
*rmesa->vb.dmaptr++ = *(int *)&v[1];
*rmesa->vb.dmaptr++ = *(int *)&v[2];
for (i = 3; i < rmesa->vb.vertex_size; i++)
*rmesa->vb.dmaptr++ = rmesa->vb.vertex[i].i;
if (--rmesa->vb.counter == 0)
rmesa->vb.notify();
}
static void radeon_Vertex2f( GLfloat x, GLfloat y )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
int i;
*rmesa->vb.dmaptr++ = *(int *)&x;
*rmesa->vb.dmaptr++ = *(int *)&y;
*rmesa->vb.dmaptr++ = 0;
for (i = 3; i < rmesa->vb.vertex_size; i++)
*rmesa->vb.dmaptr++ = *(int *)&rmesa->vb.vertex[i];
if (--rmesa->vb.counter == 0)
rmesa->vb.notify();
}
static void radeon_Vertex2fv( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
int i;
*rmesa->vb.dmaptr++ = *(int *)&v[0];
*rmesa->vb.dmaptr++ = *(int *)&v[1];
*rmesa->vb.dmaptr++ = 0;
for (i = 3; i < rmesa->vb.vertex_size; i++)
*rmesa->vb.dmaptr++ = rmesa->vb.vertex[i].i;
if (--rmesa->vb.counter == 0)
rmesa->vb.notify();
}
#if 0
/* Color for ubyte (packed) color formats:
*/
static void radeon_Color3ub_ub( GLubyte r, GLubyte g, GLubyte b )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
radeon_color_t *dest = rmesa->vb.colorptr;
dest->red = r;
dest->green = g;
dest->blue = b;
dest->alpha = 0xff;
}
static void radeon_Color3ubv_ub( const GLubyte *v )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
radeon_color_t *dest = rmesa->vb.colorptr;
dest->red = v[0];
dest->green = v[1];
dest->blue = v[2];
dest->alpha = 0xff;
}
static void radeon_Color4ub_ub( GLubyte r, GLubyte g, GLubyte b, GLubyte a )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
radeon_color_t *dest = rmesa->vb.colorptr;
dest->red = r;
dest->green = g;
dest->blue = b;
dest->alpha = a;
}
static void radeon_Color4ubv_ub( const GLubyte *v )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
*(GLuint *)rmesa->vb.colorptr = LE32_TO_CPU(*(GLuint *)v);
}
#endif /* 0 */
static void radeon_Color3f_ub( GLfloat r, GLfloat g, GLfloat b )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
radeon_color_t *dest = rmesa->vb.colorptr;
UNCLAMPED_FLOAT_TO_UBYTE( dest->red, r );
UNCLAMPED_FLOAT_TO_UBYTE( dest->green, g );
UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, b );
dest->alpha = 255;
}
static void radeon_Color3fv_ub( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
radeon_color_t *dest = rmesa->vb.colorptr;
UNCLAMPED_FLOAT_TO_UBYTE( dest->red, v[0] );
UNCLAMPED_FLOAT_TO_UBYTE( dest->green, v[1] );
UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, v[2] );
dest->alpha = 255;
}
static void radeon_Color4f_ub( GLfloat r, GLfloat g, GLfloat b, GLfloat a )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
radeon_color_t *dest = rmesa->vb.colorptr;
UNCLAMPED_FLOAT_TO_UBYTE( dest->red, r );
UNCLAMPED_FLOAT_TO_UBYTE( dest->green, g );
UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, b );
UNCLAMPED_FLOAT_TO_UBYTE( dest->alpha, a );
}
static void radeon_Color4fv_ub( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
radeon_color_t *dest = rmesa->vb.colorptr;
UNCLAMPED_FLOAT_TO_UBYTE( dest->red, v[0] );
UNCLAMPED_FLOAT_TO_UBYTE( dest->green, v[1] );
UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, v[2] );
UNCLAMPED_FLOAT_TO_UBYTE( dest->alpha, v[3] );
}
/* Color for float color+alpha formats:
*/
#if 0
static void radeon_Color3ub_4f( GLubyte r, GLubyte g, GLubyte b )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat *dest = rmesa->vb.floatcolorptr;
dest[0] = UBYTE_TO_FLOAT(r);
dest[1] = UBYTE_TO_FLOAT(g);
dest[2] = UBYTE_TO_FLOAT(b);
dest[3] = 1.0;
}
static void radeon_Color3ubv_4f( const GLubyte *v )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat *dest = rmesa->vb.floatcolorptr;
dest[0] = UBYTE_TO_FLOAT(v[0]);
dest[1] = UBYTE_TO_FLOAT(v[1]);
dest[2] = UBYTE_TO_FLOAT(v[2]);
dest[3] = 1.0;
}
static void radeon_Color4ub_4f( GLubyte r, GLubyte g, GLubyte b, GLubyte a )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat *dest = rmesa->vb.floatcolorptr;
dest[0] = UBYTE_TO_FLOAT(r);
dest[1] = UBYTE_TO_FLOAT(g);
dest[2] = UBYTE_TO_FLOAT(b);
dest[3] = UBYTE_TO_FLOAT(a);
}
static void radeon_Color4ubv_4f( const GLubyte *v )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat *dest = rmesa->vb.floatcolorptr;
dest[0] = UBYTE_TO_FLOAT(v[0]);
dest[1] = UBYTE_TO_FLOAT(v[1]);
dest[2] = UBYTE_TO_FLOAT(v[2]);
dest[3] = UBYTE_TO_FLOAT(v[3]);
}
#endif /* 0 */
static void radeon_Color3f_4f( GLfloat r, GLfloat g, GLfloat b )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat *dest = rmesa->vb.floatcolorptr;
dest[0] = r;
dest[1] = g;
dest[2] = b;
dest[3] = 1.0;
}
static void radeon_Color3fv_4f( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat *dest = rmesa->vb.floatcolorptr;
dest[0] = v[0];
dest[1] = v[1];
dest[2] = v[2];
dest[3] = 1.0;
}
static void radeon_Color4f_4f( GLfloat r, GLfloat g, GLfloat b, GLfloat a )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat *dest = rmesa->vb.floatcolorptr;
dest[0] = r;
dest[1] = g;
dest[2] = b;
dest[3] = a;
}
static void radeon_Color4fv_4f( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat *dest = rmesa->vb.floatcolorptr;
dest[0] = v[0];
dest[1] = v[1];
dest[2] = v[2];
dest[3] = v[3];
}
/* Color for float color formats:
*/
#if 0
static void radeon_Color3ub_3f( GLubyte r, GLubyte g, GLubyte b )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat *dest = rmesa->vb.floatcolorptr;
dest[0] = UBYTE_TO_FLOAT(r);
dest[1] = UBYTE_TO_FLOAT(g);
dest[2] = UBYTE_TO_FLOAT(b);
}
static void radeon_Color3ubv_3f( const GLubyte *v )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat *dest = rmesa->vb.floatcolorptr;
dest[0] = UBYTE_TO_FLOAT(v[0]);
dest[1] = UBYTE_TO_FLOAT(v[1]);
dest[2] = UBYTE_TO_FLOAT(v[2]);
}
static void radeon_Color4ub_3f( GLubyte r, GLubyte g, GLubyte b, GLubyte a )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat *dest = rmesa->vb.floatcolorptr;
dest[0] = UBYTE_TO_FLOAT(r);
dest[1] = UBYTE_TO_FLOAT(g);
dest[2] = UBYTE_TO_FLOAT(b);
ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = UBYTE_TO_FLOAT(a);
}
static void radeon_Color4ubv_3f( const GLubyte *v )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat *dest = rmesa->vb.floatcolorptr;
dest[0] = UBYTE_TO_FLOAT(v[0]);
dest[1] = UBYTE_TO_FLOAT(v[1]);
dest[2] = UBYTE_TO_FLOAT(v[2]);
ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = UBYTE_TO_FLOAT(v[3]);
}
#endif /* 0 */
static void radeon_Color3f_3f( GLfloat r, GLfloat g, GLfloat b )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat *dest = rmesa->vb.floatcolorptr;
dest[0] = r;
dest[1] = g;
dest[2] = b;
}
static void radeon_Color3fv_3f( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat *dest = rmesa->vb.floatcolorptr;
dest[0] = v[0];
dest[1] = v[1];
dest[2] = v[2];
}
static void radeon_Color4f_3f( GLfloat r, GLfloat g, GLfloat b, GLfloat a )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat *dest = rmesa->vb.floatcolorptr;
dest[0] = r;
dest[1] = g;
dest[2] = b;
ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = a;
}
static void radeon_Color4fv_3f( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat *dest = rmesa->vb.floatcolorptr;
dest[0] = v[0];
dest[1] = v[1];
dest[2] = v[2];
ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = v[3];
}
/* Secondary Color:
*/
#if 0
static void radeon_SecondaryColor3ubEXT_ub( GLubyte r, GLubyte g, GLubyte b )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
radeon_color_t *dest = rmesa->vb.specptr;
dest->red = r;
dest->green = g;
dest->blue = b;
dest->alpha = 0xff;
}
static void radeon_SecondaryColor3ubvEXT_ub( const GLubyte *v )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
radeon_color_t *dest = rmesa->vb.specptr;
dest->red = v[0];
dest->green = v[1];
dest->blue = v[2];
dest->alpha = 0xff;
}
#endif /* 0 */
static void radeon_SecondaryColor3fEXT_ub( GLfloat r, GLfloat g, GLfloat b )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
radeon_color_t *dest = rmesa->vb.specptr;
UNCLAMPED_FLOAT_TO_UBYTE( dest->red, r );
UNCLAMPED_FLOAT_TO_UBYTE( dest->green, g );
UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, b );
dest->alpha = 255;
}
static void radeon_SecondaryColor3fvEXT_ub( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
radeon_color_t *dest = rmesa->vb.specptr;
UNCLAMPED_FLOAT_TO_UBYTE( dest->red, v[0] );
UNCLAMPED_FLOAT_TO_UBYTE( dest->green, v[1] );
UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, v[2] );
dest->alpha = 255;
}
#if 0
static void radeon_SecondaryColor3ubEXT_3f( GLubyte r, GLubyte g, GLubyte b )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat *dest = rmesa->vb.floatspecptr;
dest[0] = UBYTE_TO_FLOAT(r);
dest[1] = UBYTE_TO_FLOAT(g);
dest[2] = UBYTE_TO_FLOAT(b);
dest[3] = 1.0;
}
static void radeon_SecondaryColor3ubvEXT_3f( const GLubyte *v )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat *dest = rmesa->vb.floatspecptr;
dest[0] = UBYTE_TO_FLOAT(v[0]);
dest[1] = UBYTE_TO_FLOAT(v[1]);
dest[2] = UBYTE_TO_FLOAT(v[2]);
dest[3] = 1.0;
}
#endif /* 0 */
static void radeon_SecondaryColor3fEXT_3f( GLfloat r, GLfloat g, GLfloat b )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat *dest = rmesa->vb.floatspecptr;
dest[0] = r;
dest[1] = g;
dest[2] = b;
dest[3] = 1.0;
}
static void radeon_SecondaryColor3fvEXT_3f( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat *dest = rmesa->vb.floatspecptr;
dest[0] = v[0];
dest[1] = v[1];
dest[2] = v[2];
dest[3] = 1.0;
}
/* Normal
*/
static void radeon_Normal3f( GLfloat n0, GLfloat n1, GLfloat n2 )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat *dest = rmesa->vb.normalptr;
dest[0] = n0;
dest[1] = n1;
dest[2] = n2;
}
static void radeon_Normal3fv( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat *dest = rmesa->vb.normalptr;
dest[0] = v[0];
dest[1] = v[1];
dest[2] = v[2];
}
/* TexCoord
*/
static void radeon_TexCoord1f( GLfloat s )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat *dest = rmesa->vb.texcoordptr[0];
dest[0] = s;
dest[1] = 0;
}
static void radeon_TexCoord1fv( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat *dest = rmesa->vb.texcoordptr[0];
dest[0] = v[0];
dest[1] = 0;
}
static void radeon_TexCoord2f( GLfloat s, GLfloat t )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat *dest = rmesa->vb.texcoordptr[0];
dest[0] = s;
dest[1] = t;
}
static void radeon_TexCoord2fv( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat *dest = rmesa->vb.texcoordptr[0];
dest[0] = v[0];
dest[1] = v[1];
}
/* MultiTexcoord
*
* Technically speaking, these functions should subtract GL_TEXTURE0 from
* \c target before masking and using it. The value of GL_TEXTURE0 is 0x84C0,
* which has the low-order 5 bits 0. For all possible valid values of
* \c target. Subtracting GL_TEXTURE0 has the net effect of masking \c target
* with 0x1F. Masking with 0x1F and then masking with 0x01 is redundant, so
* the subtraction has been omitted.
*/
static void radeon_MultiTexCoord1fARB( GLenum target, GLfloat s )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat *dest = rmesa->vb.texcoordptr[target & 3];
dest[0] = s;
dest[1] = 0;
}
static void radeon_MultiTexCoord1fvARB( GLenum target, const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat *dest = rmesa->vb.texcoordptr[target & 3];
dest[0] = v[0];
dest[1] = 0;
}
static void radeon_MultiTexCoord2fARB( GLenum target, GLfloat s, GLfloat t )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat *dest = rmesa->vb.texcoordptr[target & 3];
dest[0] = s;
dest[1] = t;
}
static void radeon_MultiTexCoord2fvARB( GLenum target, const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat *dest = rmesa->vb.texcoordptr[target & 3];
dest[0] = v[0];
dest[1] = v[1];
}
static struct dynfn *lookup( struct dynfn *l, int key )
{
struct dynfn *f;
foreach( f, l ) {
if (f->key == key)
return f;
}
return NULL;
}
/* Can't use the loopback template for this:
*/
#define CHOOSE(FN, FNTYPE, MASK, ACTIVE, ARGS1, ARGS2 ) \
static void choose_##FN ARGS1 \
{ \
GET_CURRENT_CONTEXT(ctx); \
radeonContextPtr rmesa = RADEON_CONTEXT(ctx); \
int key = rmesa->vb.vertex_format & (MASK|ACTIVE); \
struct dynfn *dfn; \
\
dfn = lookup( &rmesa->vb.dfn_cache.FN, key ); \
if (dfn == 0) \
dfn = rmesa->vb.codegen.FN( ctx, key ); \
else if (RADEON_DEBUG & DEBUG_CODEGEN) \
fprintf(stderr, "%s -- cached codegen\n", __FUNCTION__ ); \
\
if (dfn) \
SET_ ## FN (ctx->Exec, (FNTYPE)(dfn->code)); \
else { \
if (RADEON_DEBUG & DEBUG_CODEGEN) \
fprintf(stderr, "%s -- generic version\n", __FUNCTION__ ); \
SET_ ## FN (ctx->Exec, radeon_##FN); \
} \
\
ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; \
CALL_ ## FN (ctx->Exec, ARGS2); \
}
/* For the _3f case, only allow one color function to be hooked in at
* a time. Eventually, use a similar mechanism to allow selecting the
* color component of the vertex format based on client behaviour.
*
* Note: Perform these actions even if there is a codegen or cached
* codegen version of the chosen function.
*/
#define CHOOSE_COLOR(FN, FNTYPE, NR, MASK, ACTIVE, ARGS1, ARGS2 ) \
static void choose_##FN ARGS1 \
{ \
GET_CURRENT_CONTEXT(ctx); \
radeonContextPtr rmesa = RADEON_CONTEXT(ctx); \
int key = rmesa->vb.vertex_format & (MASK|ACTIVE); \
struct dynfn *dfn; \
\
if (rmesa->vb.vertex_format & ACTIVE_PKCOLOR) { \
SET_ ## FN (ctx->Exec, radeon_##FN##_ub); \
} \
else if ((rmesa->vb.vertex_format & \
(ACTIVE_FPCOLOR|ACTIVE_FPALPHA)) == ACTIVE_FPCOLOR) { \
\
if (rmesa->vb.installed_color_3f_sz != NR) { \
rmesa->vb.installed_color_3f_sz = NR; \
if (NR == 3) ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = 1.0; \
if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) { \
radeon_copy_to_current( ctx ); \
_mesa_install_exec_vtxfmt( ctx, &rmesa->vb.vtxfmt ); \
CALL_ ## FN (ctx->Exec, ARGS2); \
return; \
} \
} \
\
SET_ ## FN (ctx->Exec, radeon_##FN##_3f); \
} \
else { \
SET_ ## FN (ctx->Exec, radeon_##FN##_4f); \
} \
\
\
dfn = lookup( &rmesa->vb.dfn_cache.FN, key ); \
if (!dfn) dfn = rmesa->vb.codegen.FN( ctx, key ); \
\
if (dfn) { \
if (RADEON_DEBUG & DEBUG_CODEGEN) \
fprintf(stderr, "%s -- codegen version\n", __FUNCTION__ ); \
SET_ ## FN (ctx->Exec, (FNTYPE)dfn->code); \
} \
else if (RADEON_DEBUG & DEBUG_CODEGEN) \
fprintf(stderr, "%s -- 'c' version\n", __FUNCTION__ ); \
\
ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; \
CALL_ ## FN (ctx->Exec, ARGS2); \
}
/* Right now there are both _ub and _3f versions of the secondary color
* functions. Currently, we only set-up the hardware to use the _ub versions.
* The _3f versions are needed for the cases where secondary color isn't used
* in the vertex format, but it still needs to be stored in the context
* state vector.
*/
#define CHOOSE_SECONDARY_COLOR(FN, FNTYPE, MASK, ACTIVE, ARGS1, ARGS2 ) \
static void choose_##FN ARGS1 \
{ \
GET_CURRENT_CONTEXT(ctx); \
radeonContextPtr rmesa = RADEON_CONTEXT(ctx); \
int key = rmesa->vb.vertex_format & (MASK|ACTIVE); \
struct dynfn *dfn = lookup( &rmesa->vb.dfn_cache.FN, key ); \
\
if (dfn == 0) \
dfn = rmesa->vb.codegen.FN( ctx, key ); \
else if (RADEON_DEBUG & DEBUG_CODEGEN) \
fprintf(stderr, "%s -- cached version\n", __FUNCTION__ ); \
\
if (dfn) \
SET_ ## FN (ctx->Exec, (FNTYPE)(dfn->code)); \
else { \
if (RADEON_DEBUG & DEBUG_CODEGEN) \
fprintf(stderr, "%s -- generic version\n", __FUNCTION__ ); \
SET_ ## FN (ctx->Exec, ((rmesa->vb.vertex_format & ACTIVE_PKSPEC) != 0) \
? radeon_##FN##_ub : radeon_##FN##_3f); \
} \
\
ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; \
CALL_ ## FN (ctx->Exec, ARGS2); \
}
/* Shorthands
*/
#define ACTIVE_XYZW (RADEON_CP_VC_FRMT_W0|RADEON_CP_VC_FRMT_Z)
#define ACTIVE_NORM RADEON_CP_VC_FRMT_N0
#define ACTIVE_PKCOLOR RADEON_CP_VC_FRMT_PKCOLOR
#define ACTIVE_FPCOLOR RADEON_CP_VC_FRMT_FPCOLOR
#define ACTIVE_FPALPHA RADEON_CP_VC_FRMT_FPALPHA
#define ACTIVE_COLOR (ACTIVE_FPCOLOR|ACTIVE_PKCOLOR)
#define ACTIVE_PKSPEC RADEON_CP_VC_FRMT_PKSPEC
#define ACTIVE_FPSPEC RADEON_CP_VC_FRMT_FPSPEC
#define ACTIVE_SPEC (ACTIVE_FPSPEC|ACTIVE_PKSPEC)
#define ACTIVE_ST0 RADEON_CP_VC_FRMT_ST0
#define ACTIVE_ST1 RADEON_CP_VC_FRMT_ST1
#define ACTIVE_ST2 RADEON_CP_VC_FRMT_ST2
#define ACTIVE_ST_ALL (RADEON_CP_VC_FRMT_ST1|RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST2)
/* Each codegen function should be able to be fully specified by a
* subsetted version of rmesa->vb.vertex_format.
*/
#define MASK_NORM (ACTIVE_XYZW)
#define MASK_COLOR (MASK_NORM|ACTIVE_NORM)
#define MASK_SPEC (MASK_COLOR|ACTIVE_COLOR)
#define MASK_ST0 (MASK_SPEC|ACTIVE_SPEC)
#define MASK_ST1 (MASK_ST0|ACTIVE_ST0)
#define MASK_ST2 (MASK_ST1|ACTIVE_ST1)
#define MASK_ST_ALL (MASK_ST2|ACTIVE_ST2)
#define MASK_VERTEX (MASK_ST_ALL|ACTIVE_FPALPHA)
typedef void (*p4f)( GLfloat, GLfloat, GLfloat, GLfloat );
typedef void (*p3f)( GLfloat, GLfloat, GLfloat );
typedef void (*p2f)( GLfloat, GLfloat );
typedef void (*p1f)( GLfloat );
typedef void (*pe2f)( GLenum, GLfloat, GLfloat );
typedef void (*pe1f)( GLenum, GLfloat );
typedef void (*p4ub)( GLubyte, GLubyte, GLubyte, GLubyte );
typedef void (*p3ub)( GLubyte, GLubyte, GLubyte );
typedef void (*pfv)( const GLfloat * );
typedef void (*pefv)( GLenum, const GLfloat * );
typedef void (*pubv)( const GLubyte * );
CHOOSE(Normal3f, p3f, MASK_NORM, ACTIVE_NORM,
(GLfloat a,GLfloat b,GLfloat c), (a,b,c))
CHOOSE(Normal3fv, pfv, MASK_NORM, ACTIVE_NORM,
(const GLfloat *v), (v))
#if 0
CHOOSE_COLOR(Color4ub, p4ub, 4, MASK_COLOR, ACTIVE_COLOR,
(GLubyte a,GLubyte b, GLubyte c, GLubyte d), (a,b,c,d))
CHOOSE_COLOR(Color4ubv, pubv, 4, MASK_COLOR, ACTIVE_COLOR,
(const GLubyte *v), (v))
CHOOSE_COLOR(Color3ub, p3ub, 3, MASK_COLOR, ACTIVE_COLOR,
(GLubyte a,GLubyte b, GLubyte c), (a,b,c))
CHOOSE_COLOR(Color3ubv, pubv, 3, MASK_COLOR, ACTIVE_COLOR,
(const GLubyte *v), (v))
#endif
CHOOSE_COLOR(Color4f, p4f, 4, MASK_COLOR, ACTIVE_COLOR,
(GLfloat a,GLfloat b, GLfloat c, GLfloat d), (a,b,c,d))
CHOOSE_COLOR(Color4fv, pfv, 4, MASK_COLOR, ACTIVE_COLOR,
(const GLfloat *v), (v))
CHOOSE_COLOR(Color3f, p3f, 3, MASK_COLOR, ACTIVE_COLOR,
(GLfloat a,GLfloat b, GLfloat c), (a,b,c))
CHOOSE_COLOR(Color3fv, pfv, 3, MASK_COLOR, ACTIVE_COLOR,
(const GLfloat *v), (v))
#if 0
CHOOSE_SECONDARY_COLOR(SecondaryColor3ubEXT, p3ub, MASK_SPEC, ACTIVE_SPEC,
(GLubyte a,GLubyte b, GLubyte c), (a,b,c))
CHOOSE_SECONDARY_COLOR(SecondaryColor3ubvEXT, pubv, MASK_SPEC, ACTIVE_SPEC,
(const GLubyte *v), (v))
#endif
CHOOSE_SECONDARY_COLOR(SecondaryColor3fEXT, p3f, MASK_SPEC, ACTIVE_SPEC,
(GLfloat a,GLfloat b, GLfloat c), (a,b,c))
CHOOSE_SECONDARY_COLOR(SecondaryColor3fvEXT, pfv, MASK_SPEC, ACTIVE_SPEC,
(const GLfloat *v), (v))
CHOOSE(TexCoord2f, p2f, MASK_ST0, ACTIVE_ST0,
(GLfloat a,GLfloat b), (a,b))
CHOOSE(TexCoord2fv, pfv, MASK_ST0, ACTIVE_ST0,
(const GLfloat *v), (v))
CHOOSE(TexCoord1f, p1f, MASK_ST0, ACTIVE_ST0,
(GLfloat a), (a))
CHOOSE(TexCoord1fv, pfv, MASK_ST0, ACTIVE_ST0,
(const GLfloat *v), (v))
CHOOSE(MultiTexCoord2fARB, pe2f, MASK_ST_ALL, ACTIVE_ST_ALL,
(GLenum u,GLfloat a,GLfloat b), (u,a,b))
CHOOSE(MultiTexCoord2fvARB, pefv, MASK_ST_ALL, ACTIVE_ST_ALL,
(GLenum u,const GLfloat *v), (u,v))
CHOOSE(MultiTexCoord1fARB, pe1f, MASK_ST_ALL, ACTIVE_ST_ALL,
(GLenum u,GLfloat a), (u,a))
CHOOSE(MultiTexCoord1fvARB, pefv, MASK_ST_ALL, ACTIVE_ST_ALL,
(GLenum u,const GLfloat *v), (u,v))
CHOOSE(Vertex3f, p3f, MASK_VERTEX, MASK_VERTEX,
(GLfloat a,GLfloat b,GLfloat c), (a,b,c))
CHOOSE(Vertex3fv, pfv, MASK_VERTEX, MASK_VERTEX,
(const GLfloat *v), (v))
CHOOSE(Vertex2f, p2f, MASK_VERTEX, MASK_VERTEX,
(GLfloat a,GLfloat b), (a,b))
CHOOSE(Vertex2fv, pfv, MASK_VERTEX, MASK_VERTEX,
(const GLfloat *v), (v))
void radeonVtxfmtInitChoosers( GLvertexformat *vfmt )
{
vfmt->Color3f = choose_Color3f;
vfmt->Color3fv = choose_Color3fv;
vfmt->Color4f = choose_Color4f;
vfmt->Color4fv = choose_Color4fv;
vfmt->SecondaryColor3fEXT = choose_SecondaryColor3fEXT;
vfmt->SecondaryColor3fvEXT = choose_SecondaryColor3fvEXT;
vfmt->MultiTexCoord1fARB = choose_MultiTexCoord1fARB;
vfmt->MultiTexCoord1fvARB = choose_MultiTexCoord1fvARB;
vfmt->MultiTexCoord2fARB = choose_MultiTexCoord2fARB;
vfmt->MultiTexCoord2fvARB = choose_MultiTexCoord2fvARB;
vfmt->Normal3f = choose_Normal3f;
vfmt->Normal3fv = choose_Normal3fv;
vfmt->TexCoord1f = choose_TexCoord1f;
vfmt->TexCoord1fv = choose_TexCoord1fv;
vfmt->TexCoord2f = choose_TexCoord2f;
vfmt->TexCoord2fv = choose_TexCoord2fv;
vfmt->Vertex2f = choose_Vertex2f;
vfmt->Vertex2fv = choose_Vertex2fv;
vfmt->Vertex3f = choose_Vertex3f;
vfmt->Vertex3fv = choose_Vertex3fv;
#if 0
vfmt->Color3ub = choose_Color3ub;
vfmt->Color3ubv = choose_Color3ubv;
vfmt->Color4ub = choose_Color4ub;
vfmt->Color4ubv = choose_Color4ubv;
vfmt->SecondaryColor3ubEXT = choose_SecondaryColor3ubEXT;
vfmt->SecondaryColor3ubvEXT = choose_SecondaryColor3ubvEXT;
#endif
}
static struct dynfn *codegen_noop( GLcontext *ctx, int key )
{
(void) ctx; (void) key;
return NULL;
}
void radeonInitCodegen( struct dfn_generators *gen, GLboolean useCodegen )
{
gen->Vertex3f = codegen_noop;
gen->Vertex3fv = codegen_noop;
gen->Color4ub = codegen_noop;
gen->Color4ubv = codegen_noop;
gen->Normal3f = codegen_noop;
gen->Normal3fv = codegen_noop;
gen->TexCoord2f = codegen_noop;
gen->TexCoord2fv = codegen_noop;
gen->MultiTexCoord2fARB = codegen_noop;
gen->MultiTexCoord2fvARB = codegen_noop;
gen->Vertex2f = codegen_noop;
gen->Vertex2fv = codegen_noop;
gen->Color3ub = codegen_noop;
gen->Color3ubv = codegen_noop;
gen->Color4f = codegen_noop;
gen->Color4fv = codegen_noop;
gen->Color3f = codegen_noop;
gen->Color3fv = codegen_noop;
gen->SecondaryColor3fEXT = codegen_noop;
gen->SecondaryColor3fvEXT = codegen_noop;
gen->SecondaryColor3ubEXT = codegen_noop;
gen->SecondaryColor3ubvEXT = codegen_noop;
gen->TexCoord1f = codegen_noop;
gen->TexCoord1fv = codegen_noop;
gen->MultiTexCoord1fARB = codegen_noop;
gen->MultiTexCoord1fvARB = codegen_noop;
if (useCodegen) {
#if defined(USE_X86_ASM)
radeonInitX86Codegen( gen );
#endif
#if defined(USE_SSE_ASM)
radeonInitSSECodegen( gen );
#endif
}
}

View file

@ -1,236 +0,0 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_sse.c,v 1.1 2002/10/30 12:51:58 alanh Exp $ */
/**************************************************************************
Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
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, sublicense, 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 NONINFRINGEMENT.
IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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.
**************************************************************************/
/*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
*/
#include "glheader.h"
#include "imports.h"
#include "simple_list.h"
#include "radeon_vtxfmt.h"
#if defined(USE_SSE_ASM)
#include "x86/common_x86_asm.h"
#define EXTERN( FUNC ) \
extern const char *FUNC; \
extern const char *FUNC##_end
EXTERN( _sse_Attribute2fv );
EXTERN( _sse_Attribute2f );
EXTERN( _sse_Attribute3fv );
EXTERN( _sse_Attribute3f );
EXTERN( _sse_MultiTexCoord2fv );
EXTERN( _sse_MultiTexCoord2f );
EXTERN( _sse_MultiTexCoord2fv_2 );
EXTERN( _sse_MultiTexCoord2f_2 );
/* Build specialized versions of the immediate calls on the fly for
* the current state.
*/
static struct dynfn *radeon_makeSSEAttribute2fv( struct dynfn * cache, int key,
const char * name, void * dest)
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key );
DFN ( _sse_Attribute2fv, (*cache) );
FIXUP(dfn->code, 10, 0x0, (int)dest);
return dfn;
}
static struct dynfn *radeon_makeSSEAttribute2f( struct dynfn * cache, int key,
const char * name, void * dest )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key );
DFN ( _sse_Attribute2f, (*cache) );
FIXUP(dfn->code, 8, 0x0, (int)dest);
return dfn;
}
static struct dynfn *radeon_makeSSEAttribute3fv( struct dynfn * cache, int key,
const char * name, void * dest)
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key );
DFN ( _sse_Attribute3fv, (*cache) );
FIXUP(dfn->code, 13, 0x0, (int)dest);
FIXUP(dfn->code, 18, 0x8, 8+(int)dest);
return dfn;
}
static struct dynfn *radeon_makeSSEAttribute3f( struct dynfn * cache, int key,
const char * name, void * dest )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key );
DFN ( _sse_Attribute3f, (*cache) );
FIXUP(dfn->code, 12, 0x0, (int)dest);
FIXUP(dfn->code, 17, 0x8, 8+(int)dest);
return dfn;
}
static struct dynfn * radeon_makeSSENormal3fv( GLcontext *ctx, int key )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
return radeon_makeSSEAttribute3fv( & rmesa->vb.dfn_cache.Normal3fv, key,
__FUNCTION__, rmesa->vb.normalptr );
}
static struct dynfn *radeon_makeSSENormal3f( GLcontext *ctx, int key )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
return radeon_makeSSEAttribute3f( & rmesa->vb.dfn_cache.Normal3f, key,
__FUNCTION__, rmesa->vb.normalptr );
}
static struct dynfn *radeon_makeSSEColor3fv( GLcontext *ctx, int key )
{
if (key & (RADEON_CP_VC_FRMT_PKCOLOR|RADEON_CP_VC_FRMT_FPALPHA))
return NULL;
else
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
return radeon_makeSSEAttribute3fv( & rmesa->vb.dfn_cache.Color3fv, key,
__FUNCTION__, rmesa->vb.floatcolorptr );
}
}
static struct dynfn *radeon_makeSSEColor3f( GLcontext *ctx, int key )
{
if (key & (RADEON_CP_VC_FRMT_PKCOLOR|RADEON_CP_VC_FRMT_FPALPHA))
return NULL;
else
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
return radeon_makeSSEAttribute3f( & rmesa->vb.dfn_cache.Color3f, key,
__FUNCTION__, rmesa->vb.floatcolorptr );
}
}
static struct dynfn *radeon_makeSSETexCoord2fv( GLcontext *ctx, int key )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
return radeon_makeSSEAttribute2fv( & rmesa->vb.dfn_cache.TexCoord2fv, key,
__FUNCTION__, rmesa->vb.texcoordptr[0] );
}
static struct dynfn *radeon_makeSSETexCoord2f( GLcontext *ctx, int key )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
return radeon_makeSSEAttribute2f( & rmesa->vb.dfn_cache.TexCoord2f, key,
__FUNCTION__, rmesa->vb.texcoordptr[0] );
}
#if 0 /* Temporarily disabled - probably needs adjustments for more than 2 tex units -rs */
static struct dynfn *radeon_makeSSEMultiTexCoord2fv( GLcontext *ctx, int key )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key );
if ((key & (RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) ==
(RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) {
DFN ( _sse_MultiTexCoord2fv, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
FIXUP(dfn->code, 18, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
} else {
DFN ( _sse_MultiTexCoord2fv_2, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
FIXUP(dfn->code, 14, 0x0, (int)rmesa->vb.texcoordptr);
}
return dfn;
}
static struct dynfn *radeon_makeSSEMultiTexCoord2f( GLcontext *ctx, int key )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key );
if ((key & (RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) ==
(RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) {
DFN ( _sse_MultiTexCoord2f, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
FIXUP(dfn->code, 16, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
} else {
DFN ( _sse_MultiTexCoord2f_2, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
FIXUP(dfn->code, 15, 0x0, (int)rmesa->vb.texcoordptr);
}
return dfn;
}
#endif
void radeonInitSSECodegen( struct dfn_generators *gen )
{
if ( cpu_has_xmm ) {
gen->Normal3fv = (void *) radeon_makeSSENormal3fv;
gen->Normal3f = (void *) radeon_makeSSENormal3f;
gen->Color3fv = (void *) radeon_makeSSEColor3fv;
gen->Color3f = (void *) radeon_makeSSEColor3f;
gen->TexCoord2fv = (void *) radeon_makeSSETexCoord2fv;
gen->TexCoord2f = (void *) radeon_makeSSETexCoord2f;
#if 0 /* Temporarily disabled - probably needs adjustments for more than 2 tex units -rs */
gen->MultiTexCoord2fvARB = (void *) radeon_makeSSEMultiTexCoord2fv;
gen->MultiTexCoord2fARB = (void *) radeon_makeSSEMultiTexCoord2f;
#endif
}
}
#else
void radeonInitSSECodegen( struct dfn_generators *gen )
{
(void) gen;
}
#endif

View file

@ -1,440 +0,0 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_x86.c,v 1.2 2002/12/21 17:02:16 dawes Exp $ */
/**************************************************************************
Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
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, sublicense, 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 NONINFRINGEMENT.
IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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.
**************************************************************************/
/*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
*/
#include "glheader.h"
#include "imports.h"
#include "simple_list.h"
#include "radeon_vtxfmt.h"
#if defined(USE_X86_ASM)
#define EXTERN( FUNC ) \
extern const char *FUNC; \
extern const char *FUNC##_end
EXTERN ( _x86_Attribute2fv );
EXTERN ( _x86_Attribute2f );
EXTERN ( _x86_Attribute3fv );
EXTERN ( _x86_Attribute3f );
EXTERN ( _x86_Vertex3fv_6 );
EXTERN ( _x86_Vertex3fv_8 );
EXTERN ( _x86_Vertex3fv );
EXTERN ( _x86_Vertex3f_4 );
EXTERN ( _x86_Vertex3f_6 );
EXTERN ( _x86_Vertex3f );
EXTERN ( _x86_Color4ubv_ub );
EXTERN ( _x86_Color4ubv_4f );
EXTERN ( _x86_Color4ub_ub );
EXTERN ( _x86_MultiTexCoord2fv );
EXTERN ( _x86_MultiTexCoord2fv_2 );
EXTERN ( _x86_MultiTexCoord2f );
EXTERN ( _x86_MultiTexCoord2f_2 );
/* Build specialized versions of the immediate calls on the fly for
* the current state. Generic x86 versions.
*/
struct dynfn *radeon_makeX86Vertex3f( GLcontext *ctx, int key )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x %d\n", __FUNCTION__, key, rmesa->vb.vertex_size );
switch (rmesa->vb.vertex_size) {
case 4: {
DFN ( _x86_Vertex3f_4, rmesa->vb.dfn_cache.Vertex3f );
FIXUP(dfn->code, 2, 0x0, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 25, 0x0, (int)&rmesa->vb.vertex[3]);
FIXUP(dfn->code, 36, 0x0, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 46, 0x0, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 51, 0x0, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 60, 0x0, (int)&rmesa->vb.notify);
break;
}
case 6: {
DFN ( _x86_Vertex3f_6, rmesa->vb.dfn_cache.Vertex3f );
FIXUP(dfn->code, 3, 0x0, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 28, 0x0, (int)&rmesa->vb.vertex[3]);
FIXUP(dfn->code, 34, 0x0, (int)&rmesa->vb.vertex[4]);
FIXUP(dfn->code, 40, 0x0, (int)&rmesa->vb.vertex[5]);
FIXUP(dfn->code, 57, 0x0, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 63, 0x0, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 70, 0x0, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 79, 0x0, (int)&rmesa->vb.notify);
break;
}
default: {
DFN ( _x86_Vertex3f, rmesa->vb.dfn_cache.Vertex3f );
FIXUP(dfn->code, 3, 0x0, (int)&rmesa->vb.vertex[3]);
FIXUP(dfn->code, 9, 0x0, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 37, 0x0, rmesa->vb.vertex_size-3);
FIXUP(dfn->code, 44, 0x0, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 50, 0x0, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 56, 0x0, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 67, 0x0, (int)&rmesa->vb.notify);
break;
}
}
return dfn;
}
struct dynfn *radeon_makeX86Vertex3fv( GLcontext *ctx, int key )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x %d\n", __FUNCTION__, key, rmesa->vb.vertex_size );
switch (rmesa->vb.vertex_size) {
case 6: {
DFN ( _x86_Vertex3fv_6, rmesa->vb.dfn_cache.Vertex3fv );
FIXUP(dfn->code, 1, 0x00000000, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 27, 0x0000001c, (int)&rmesa->vb.vertex[3]);
FIXUP(dfn->code, 33, 0x00000020, (int)&rmesa->vb.vertex[4]);
FIXUP(dfn->code, 45, 0x00000024, (int)&rmesa->vb.vertex[5]);
FIXUP(dfn->code, 56, 0x00000000, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 61, 0x00000004, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 67, 0x00000004, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 76, 0x00000008, (int)&rmesa->vb.notify);
break;
}
case 8: {
DFN ( _x86_Vertex3fv_8, rmesa->vb.dfn_cache.Vertex3fv );
FIXUP(dfn->code, 1, 0x00000000, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 27, 0x0000001c, (int)&rmesa->vb.vertex[3]);
FIXUP(dfn->code, 33, 0x00000020, (int)&rmesa->vb.vertex[4]);
FIXUP(dfn->code, 45, 0x0000001c, (int)&rmesa->vb.vertex[5]);
FIXUP(dfn->code, 51, 0x00000020, (int)&rmesa->vb.vertex[6]);
FIXUP(dfn->code, 63, 0x00000024, (int)&rmesa->vb.vertex[7]);
FIXUP(dfn->code, 74, 0x00000000, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 79, 0x00000004, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 85, 0x00000004, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 94, 0x00000008, (int)&rmesa->vb.notify);
break;
}
default: {
DFN ( _x86_Vertex3fv, rmesa->vb.dfn_cache.Vertex3fv );
FIXUP(dfn->code, 8, 0x01010101, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 32, 0x00000006, rmesa->vb.vertex_size-3);
FIXUP(dfn->code, 37, 0x00000058, (int)&rmesa->vb.vertex[3]);
FIXUP(dfn->code, 45, 0x01010101, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 50, 0x02020202, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 58, 0x02020202, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 67, 0x0, (int)&rmesa->vb.notify);
break;
}
}
return dfn;
}
static struct dynfn *
radeon_makeX86Attribute2fv( struct dynfn * cache, int key,
const char * name, void * dest )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key );
DFN ( _x86_Attribute2fv, (*cache) );
FIXUP(dfn->code, 11, 0x0, (int)dest);
FIXUP(dfn->code, 16, 0x4, 4+(int)dest);
return dfn;
}
static struct dynfn *
radeon_makeX86Attribute2f( struct dynfn * cache, int key,
const char * name, void * dest )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key );
DFN ( _x86_Attribute2f, (*cache) );
FIXUP(dfn->code, 1, 0x0, (int)dest);
return dfn;
}
static struct dynfn *
radeon_makeX86Attribute3fv( struct dynfn * cache, int key,
const char * name, void * dest )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key );
DFN ( _x86_Attribute3fv, (*cache) );
FIXUP(dfn->code, 14, 0x0, (int)dest);
FIXUP(dfn->code, 20, 0x4, 4+(int)dest);
FIXUP(dfn->code, 25, 0x8, 8+(int)dest);
return dfn;
}
static struct dynfn *
radeon_makeX86Attribute3f( struct dynfn * cache, int key,
const char * name, void * dest )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key );
DFN ( _x86_Attribute3f, (*cache) );
FIXUP(dfn->code, 14, 0x0, (int)dest);
FIXUP(dfn->code, 20, 0x4, 4+(int)dest);
FIXUP(dfn->code, 25, 0x8, 8+(int)dest);
return dfn;
}
struct dynfn *radeon_makeX86Normal3fv( GLcontext *ctx, int key )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
return radeon_makeX86Attribute3fv( & rmesa->vb.dfn_cache.Normal3fv, key,
__FUNCTION__, rmesa->vb.normalptr );
}
struct dynfn *radeon_makeX86Normal3f( GLcontext *ctx, int key )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
return radeon_makeX86Attribute3f( & rmesa->vb.dfn_cache.Normal3f, key,
__FUNCTION__, rmesa->vb.normalptr );
}
struct dynfn *radeon_makeX86Color4ubv( GLcontext *ctx, int key )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key );
if (key & RADEON_CP_VC_FRMT_PKCOLOR) {
DFN ( _x86_Color4ubv_ub, rmesa->vb.dfn_cache.Color4ubv);
FIXUP(dfn->code, 5, 0x12345678, (int)rmesa->vb.colorptr);
return dfn;
}
else {
DFN ( _x86_Color4ubv_4f, rmesa->vb.dfn_cache.Color4ubv);
FIXUP(dfn->code, 2, 0x00000000, (int)_mesa_ubyte_to_float_color_tab);
FIXUP(dfn->code, 27, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr);
FIXUP(dfn->code, 33, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr+4);
FIXUP(dfn->code, 55, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr+8);
FIXUP(dfn->code, 61, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr+12);
return dfn;
}
}
struct dynfn *radeon_makeX86Color4ub( GLcontext *ctx, int key )
{
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key );
if (key & RADEON_CP_VC_FRMT_PKCOLOR) {
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
DFN ( _x86_Color4ub_ub, rmesa->vb.dfn_cache.Color4ub );
FIXUP(dfn->code, 18, 0x0, (int)rmesa->vb.colorptr);
FIXUP(dfn->code, 24, 0x0, (int)rmesa->vb.colorptr+1);
FIXUP(dfn->code, 30, 0x0, (int)rmesa->vb.colorptr+2);
FIXUP(dfn->code, 36, 0x0, (int)rmesa->vb.colorptr+3);
return dfn;
}
else
return NULL;
}
struct dynfn *radeon_makeX86Color3fv( GLcontext *ctx, int key )
{
if (key & (RADEON_CP_VC_FRMT_PKCOLOR|RADEON_CP_VC_FRMT_FPALPHA))
return NULL;
else
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
return radeon_makeX86Attribute3fv( & rmesa->vb.dfn_cache.Color3fv, key,
__FUNCTION__, rmesa->vb.floatcolorptr );
}
}
struct dynfn *radeon_makeX86Color3f( GLcontext *ctx, int key )
{
if (key & (RADEON_CP_VC_FRMT_PKCOLOR|RADEON_CP_VC_FRMT_FPALPHA))
return NULL;
else
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
return radeon_makeX86Attribute3f( & rmesa->vb.dfn_cache.Color3f, key,
__FUNCTION__, rmesa->vb.floatcolorptr );
}
}
struct dynfn *radeon_makeX86TexCoord2fv( GLcontext *ctx, int key )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
return radeon_makeX86Attribute2fv( & rmesa->vb.dfn_cache.TexCoord2fv, key,
__FUNCTION__, rmesa->vb.texcoordptr[0] );
}
struct dynfn *radeon_makeX86TexCoord2f( GLcontext *ctx, int key )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
return radeon_makeX86Attribute2f( & rmesa->vb.dfn_cache.TexCoord2f, key,
__FUNCTION__, rmesa->vb.texcoordptr[0] );
}
#if 0 /* Temporarily disabled - probably needs adjustments for more than 2 tex units -rs */
struct dynfn *radeon_makeX86MultiTexCoord2fvARB( GLcontext *ctx, int key )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key );
if ((key & (RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) ==
(RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) {
DFN ( _x86_MultiTexCoord2fv, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
FIXUP(dfn->code, 21, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
FIXUP(dfn->code, 27, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]+4);
} else {
DFN ( _x86_MultiTexCoord2fv_2, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
FIXUP(dfn->code, 14, 0x0, (int)rmesa->vb.texcoordptr);
}
return dfn;
}
struct dynfn *radeon_makeX86MultiTexCoord2fARB( GLcontext *ctx,
int key )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key );
if ((key & (RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) ==
(RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) {
DFN ( _x86_MultiTexCoord2f, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
FIXUP(dfn->code, 20, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
FIXUP(dfn->code, 26, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]+4);
}
else {
/* Note: this might get generated multiple times, even though the
* actual emitted code is the same.
*/
DFN ( _x86_MultiTexCoord2f_2, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
FIXUP(dfn->code, 18, 0x0, (int)rmesa->vb.texcoordptr);
}
return dfn;
}
#endif
void radeonInitX86Codegen( struct dfn_generators *gen )
{
gen->Vertex3f = radeon_makeX86Vertex3f;
gen->Vertex3fv = radeon_makeX86Vertex3fv;
gen->Color4ub = radeon_makeX86Color4ub; /* PKCOLOR only */
gen->Color4ubv = radeon_makeX86Color4ubv; /* PKCOLOR only */
gen->Normal3f = radeon_makeX86Normal3f;
gen->Normal3fv = radeon_makeX86Normal3fv;
gen->TexCoord2f = radeon_makeX86TexCoord2f;
gen->TexCoord2fv = radeon_makeX86TexCoord2fv;
#if 0 /* Temporarily disabled - probably needs adjustments for more than 2 tex units -rs */
gen->MultiTexCoord2fARB = radeon_makeX86MultiTexCoord2fARB;
gen->MultiTexCoord2fvARB = radeon_makeX86MultiTexCoord2fvARB;
#endif
gen->Color3f = radeon_makeX86Color3f;
gen->Color3fv = radeon_makeX86Color3fv;
/* Not done:
*/
/* gen->Vertex2f = radeon_makeX86Vertex2f; */
/* gen->Vertex2fv = radeon_makeX86Vertex2fv; */
/* gen->Color3ub = radeon_makeX86Color3ub; */
/* gen->Color3ubv = radeon_makeX86Color3ubv; */
/* gen->Color4f = radeon_makeX86Color4f; */
/* gen->Color4fv = radeon_makeX86Color4fv; */
/* gen->TexCoord1f = radeon_makeX86TexCoord1f; */
/* gen->TexCoord1fv = radeon_makeX86TexCoord1fv; */
/* gen->MultiTexCoord1fARB = radeon_makeX86MultiTexCoord1fARB; */
/* gen->MultiTexCoord1fvARB = radeon_makeX86MultiTexCoord1fvARB; */
}
#else
void radeonInitX86Codegen( struct dfn_generators *gen )
{
(void) gen;
}
#endif

View file

@ -1,498 +0,0 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_vtxtmp_x86.S,v 1.1 2002/10/30 12:51:58 alanh Exp $ */
/**************************************************************************
Copyright 2002 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
on the rights to use, copy, modify, merge, publish, distribute, sub
license, and/or sell copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
ATI, TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
#define GLOBL( x ) \
.globl x; \
x:
.data
.align 4
/*
vertex 3f vertex size 4
*/
GLOBL ( _x86_Vertex3f_4 )
movl (0), %ecx
movl 4(%esp), %eax
movl 8(%esp), %edx
movl %eax, (%ecx)
movl %edx, 4(%ecx)
movl 12(%esp), %eax
movl (0), %edx
movl %eax, 8(%ecx)
movl %edx, 12(%ecx)
movl (0), %eax
addl $16, %ecx
dec %eax
movl %ecx, (0)
movl %eax, (0)
je .1
ret
.1: jmp *0
GLOBL ( _x86_Vertex3f_4_end )
/*
vertex 3f vertex size 6
*/
GLOBL ( _x86_Vertex3f_6 )
push %edi
movl (0), %edi
movl 8(%esp), %eax
movl 12(%esp), %edx
movl 16(%esp), %ecx
movl %eax, (%edi)
movl %edx, 4(%edi)
movl %ecx, 8(%edi)
movl (0), %eax
movl (0), %edx
movl (0), %ecx
movl %eax, 12(%edi)
movl %edx, 16(%edi)
movl %ecx, 20(%edi)
addl $24, %edi
movl (0), %eax
movl %edi, (0)
dec %eax
pop %edi
movl %eax, (0)
je .2
ret
.2: jmp *0
GLOBL ( _x86_Vertex3f_6_end )
/*
vertex 3f generic size
*/
GLOBL ( _x86_Vertex3f )
push %edi
push %esi
movl $0, %esi
movl (0), %edi
movl 12(%esp), %eax
movl 16(%esp), %edx
movl 20(%esp), %ecx
movl %eax, (%edi)
movl %edx, 4(%edi)
movl %ecx, 8(%edi)
addl $12, %edi
movl $0, %ecx
repz
movsl %ds:(%esi), %es:(%edi)
movl (0), %eax
movl %edi, (0)
dec %eax
movl %eax, (0)
pop %esi
pop %edi
je .3
ret
.3: jmp *0
GLOBL ( _x86_Vertex3f_end )
/*
Vertex 3fv vertex size 6
*/
GLOBL ( _x86_Vertex3fv_6 )
movl (0), %eax
movl 4(%esp), %ecx
movl (%ecx), %edx
movl %edx, (%eax)
movl 4(%ecx), %edx
movl 8(%ecx), %ecx
movl %edx, 4(%eax)
movl %ecx, 8(%eax)
movl (28), %edx
movl (32), %ecx
movl %edx, 12(%eax)
movl %ecx, 16(%eax)
movl (36), %edx
movl %edx, 20(%eax)
addl $24, %eax
movl %eax, 0
movl 4, %eax
dec %eax
movl %eax, 4
je .4
ret
.4: jmp *8
GLOBL ( _x86_Vertex3fv_6_end )
/*
Vertex 3fv vertex size 8
*/
GLOBL ( _x86_Vertex3fv_8 )
movl (0), %eax
movl 4(%esp), %ecx
movl (%ecx), %edx
movl %edx ,(%eax)
movl 4(%ecx) ,%edx
movl 8(%ecx) ,%ecx
movl %edx, 4(%eax)
movl %ecx, 8(%eax)
movl (28), %edx
movl (32), %ecx
movl %edx, 12(%eax)
movl %ecx, 16(%eax)
movl (28), %edx
movl (32), %ecx
movl %edx, 20(%eax)
movl %ecx, 24(%eax)
movl (36), %edx
movl %edx, 28(%eax)
addl $32, %eax
movl %eax, (0)
movl 4, %eax
dec %eax
movl %eax, (4)
je .5
ret
.5: jmp *8
GLOBL ( _x86_Vertex3fv_8_end )
/*
Vertex 3fv generic vertex size
*/
GLOBL ( _x86_Vertex3fv )
movl 4(%esp), %edx
push %edi
push %esi
movl (0x1010101), %edi
movl (%edx), %eax
movl 4(%edx), %ecx
movl 8(%edx), %esi
movl %eax, (%edi)
movl %ecx, 4(%edi)
movl %esi, 8(%edi)
addl $12, %edi
movl $6, %ecx
movl $0x58, %esi
repz
movsl %ds:(%esi), %es:(%edi)
movl %edi, (0x1010101)
movl (0x2020202), %eax
pop %esi
pop %edi
dec %eax
movl %eax, (0x2020202)
je .6
ret
.6: jmp *0
GLOBL ( _x86_Vertex3fv_end )
/**
* Generic handler for 2 float format data. This can be used for
* TexCoord2f and possibly other functions.
*/
GLOBL ( _x86_Attribute2f )
movl $0x0, %edx
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl %eax, (%edx)
movl %ecx, 4(%edx)
ret
GLOBL ( _x86_Attribute2f_end )
/**
* Generic handler for 2 float vector format data. This can be used for
* TexCoord2fv and possibly other functions.
*/
GLOBL( _x86_Attribute2fv)
movl 4(%esp), %eax /* load 'v' off stack */
movl (%eax), %ecx /* load v[0] */
movl 4(%eax), %eax /* load v[1] */
movl %ecx, 0 /* store v[0] to current vertex */
movl %eax, 4 /* store v[1] to current vertex */
ret
GLOBL ( _x86_Attribute2fv_end )
/**
* Generic handler for 3 float format data. This can be used for
* Normal3f, Color3f (when the color target is also float), or
* TexCoord3f.
*/
GLOBL ( _x86_Attribute3f )
movl 4(%esp), %ecx
movl 8(%esp), %edx
movl 12(%esp), %eax
movl %ecx, 0
movl %edx, 4
movl %eax, 8
ret
GLOBL ( _x86_Attribute3f_end )
/**
* Generic handler for 3 float vector format data. This can be used for
* Normal3f, Color3f (when the color target is also float), or
* TexCoord3f.
*/
GLOBL( _x86_Attribute3fv)
movl 4(%esp), %eax /* load 'v' off stack */
movl (%eax), %ecx /* load v[0] */
movl 4(%eax), %edx /* load v[1] */
movl 8(%eax), %eax /* load v[2] */
movl %ecx, 0 /* store v[0] to current vertex */
movl %edx, 4 /* store v[1] to current vertex */
movl %eax, 8 /* store v[2] to current vertex */
ret
GLOBL ( _x86_Attribute3fv_end )
/*
Color 4ubv_ub
*/
GLOBL ( _x86_Color4ubv_ub )
movl 4(%esp), %eax
movl $0x12345678, %edx
movl (%eax), %eax
movl %eax, (%edx)
ret
GLOBL ( _x86_Color4ubv_ub_end )
/*
Color 4ubv 4f
*/
GLOBL ( _x86_Color4ubv_4f )
push %ebx
movl $0, %edx
xor %eax, %eax
xor %ecx, %ecx
movl 8(%esp), %ebx
movl (%ebx), %ebx
mov %bl, %al
mov %bh, %cl
movl (%edx,%eax,4),%eax
movl (%edx,%ecx,4),%ecx
movl %eax, (0xdeadbeaf)
movl %ecx, (0xdeadbeaf)
xor %eax, %eax
xor %ecx, %ecx
shr $16, %ebx
mov %bl, %al
mov %bh, %cl
movl (%edx,%eax,4), %eax
movl (%edx,%ecx,4), %ecx
movl %eax, (0xdeadbeaf)
movl %ecx, (0xdeadbeaf)
pop %ebx
ret
GLOBL ( _x86_Color4ubv_4f_end )
/*
Color4ub_ub
*/
GLOBL( _x86_Color4ub_ub )
push %ebx
movl 8(%esp), %eax
movl 12(%esp), %edx
movl 16(%esp), %ecx
movl 20(%esp), %ebx
mov %al, (0)
mov %dl, (0)
mov %cl, (0)
mov %bl, (0)
pop %ebx
ret
GLOBL( _x86_Color4ub_ub_end )
/*
MultiTexCoord2fv st0/st1
*/
GLOBL( _x86_MultiTexCoord2fv )
movl 4(%esp), %eax
movl 8(%esp), %ecx
and $3, %eax
movl (%ecx), %edx
shl $3, %eax
movl 4(%ecx), %ecx
movl %edx, 0xdeadbeef(%eax)
movl %ecx, 0xdeadbeef(%eax)
ret
GLOBL( _x86_MultiTexCoord2fv_end )
/*
MultiTexCoord2fv
*/
GLOBL( _x86_MultiTexCoord2fv_2 )
movl 4(%esp,1), %eax
movl 8(%esp,1), %ecx
and $3, %eax
movl 0(,%eax,4), %edx
movl (%ecx), %eax
movl %eax, (%edx)
movl 4(%ecx), %eax
movl %eax, 4(%edx)
ret
GLOBL( _x86_MultiTexCoord2fv_2_end )
/*
MultiTexCoord2f st0/st1
*/
GLOBL( _x86_MultiTexCoord2f )
movl 4(%esp), %eax
movl 8(%esp), %edx
movl 12(%esp), %ecx
and $3, %eax
shl $3, %eax
movl %edx, 0xdeadbeef(%eax)
movl %ecx, 0xdeadbeef(%eax)
ret
GLOBL( _x86_MultiTexCoord2f_end )
/*
MultiTexCoord2f
*/
GLOBL( _x86_MultiTexCoord2f_2 )
movl 4(%esp), %eax
movl 8(%esp), %edx
movl 12(%esp,1), %ecx
and $3,%eax
movl 0(,%eax,4), %eax
movl %edx, (%eax)
movl %ecx, 4(%eax)
ret
GLOBL( _x86_MultiTexCoord2f_2_end )
#if defined(USE_SSE_ASM)
/**
* This can be used as a template for either Color3fv (when the color
* target is also a 3f) or Normal3fv.
*/
GLOBL( _sse_Attribute3fv )
movl 4(%esp), %eax
movlps (%eax), %xmm0
movl 8(%eax), %eax
movlps %xmm0, 0
movl %eax, 8
ret
GLOBL( _sse_Attribute3fv_end )
/**
* This can be used as a template for either Color3f (when the color
* target is also a 3f) or Normal3f.
*/
GLOBL( _sse_Attribute3f )
movlps 4(%esp), %xmm0
movl 12(%esp), %eax
movlps %xmm0, 0
movl %eax, 8
ret
GLOBL( _sse_Attribute3f_end )
/**
* Generic handler for 2 float vector format data. This can be used for
* TexCoord2fv and possibly other functions.
*/
GLOBL( _sse_Attribute2fv )
movl 4(%esp), %eax
movlps (%eax), %xmm0
movlps %xmm0, 0
ret
GLOBL( _sse_Attribute2fv_end )
/**
* Generic handler for 2 float format data. This can be used for
* TexCoord2f and possibly other functions.
*/
GLOBL( _sse_Attribute2f )
movlps 4(%esp), %xmm0
movlps %xmm0, 0
ret
GLOBL( _sse_Attribute2f_end )
/*
MultiTexCoord2fv st0/st1
*/
GLOBL( _sse_MultiTexCoord2fv )
movl 4(%esp), %eax
movl 8(%esp), %ecx
and $3, %eax
movlps (%ecx), %xmm0
movlps %xmm0, 0xdeadbeef(,%eax,8)
ret
GLOBL( _sse_MultiTexCoord2fv_end )
/*
MultiTexCoord2fv
*/
GLOBL( _sse_MultiTexCoord2fv_2 )
movl 4(%esp), %eax
movl 8(%esp), %ecx
and $3, %eax
movl 0(,%eax,4), %edx
movlps (%ecx), %xmm0
movlps %xmm0, (%edx)
ret
GLOBL( _sse_MultiTexCoord2fv_2_end )
/*
MultiTexCoord2f st0/st1
*/
GLOBL( _sse_MultiTexCoord2f )
movl 4(%esp), %eax
and $3, %eax
movlps 8(%esp), %xmm0
movlps %xmm0, 0xdeadbeef(,%eax,8)
ret
GLOBL( _sse_MultiTexCoord2f_end )
/*
MultiTexCoord2f
*/
GLOBL( _sse_MultiTexCoord2f_2 )
movl 4(%esp), %eax
movlps 8(%esp), %xmm0
and $3,%eax
movl 0(,%eax,4), %eax
movlps %xmm0, (%eax)
ret
GLOBL( _sse_MultiTexCoord2f_2_end )
#endif
#if defined (__ELF__) && defined (__linux__)
.section .note.GNU-stack,"",%progbits
#endif

View file

@ -6,7 +6,7 @@
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
#include "tnl/t_pipeline.h"
@ -139,7 +139,7 @@ GLboolean s3vCreateContext(const __GLcontextModes *glVisual,
/* Initialize the software rasterizer and helper modules.
*/
_swrast_CreateContext( ctx );
_ac_CreateContext( ctx );
_vbo_CreateContext( ctx );
_tnl_CreateContext( ctx );
_swsetup_CreateContext( ctx );

View file

@ -10,7 +10,7 @@
#include "colormac.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
/* #define DEBUG(str) printf str */
@ -825,7 +825,7 @@ static void s3vDDUpdateState( GLcontext *ctx, GLuint new_state )
{
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
_ac_InvalidateState( ctx, new_state );
_vbo_InvalidateState( ctx, new_state );
_tnl_InvalidateState( ctx, new_state );
S3V_CONTEXT(ctx)->new_gl_state |= new_state;
}

View file

@ -13,7 +13,7 @@
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
/* #define DEBUG(str) printf str */
@ -38,7 +38,7 @@ s3vDestroyContext(__DRIcontextPrivate *driContextPriv)
if (vmesa) {
_swsetup_DestroyContext( vmesa->glCtx );
_tnl_DestroyContext( vmesa->glCtx );
_ac_DestroyContext( vmesa->glCtx );
_vbo_DestroyContext( vmesa->glCtx );
_swrast_DestroyContext( vmesa->glCtx );
s3vFreeVB( vmesa->glCtx );

View file

@ -40,7 +40,7 @@
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/t_pipeline.h"
@ -509,7 +509,7 @@ savageCreateContext( const __GLcontextModes *mesaVis,
/* Initialize the software rasterizer and helper modules.
*/
_swrast_CreateContext( ctx );
_ac_CreateContext( ctx );
_vbo_CreateContext( ctx );
_tnl_CreateContext( ctx );
_swsetup_CreateContext( ctx );
@ -599,7 +599,7 @@ savageDestroyContext(__DRIcontextPrivate *driContextPriv)
_swsetup_DestroyContext(imesa->glCtx );
_tnl_DestroyContext( imesa->glCtx );
_ac_DestroyContext( imesa->glCtx );
_vbo_DestroyContext( imesa->glCtx );
_swrast_DestroyContext( imesa->glCtx );
/* free the Mesa context */

View file

@ -41,7 +41,7 @@
#include "savage_bci.h"
#include "swrast/swrast.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
#include "swrast_setup/swrast_setup.h"
@ -1673,7 +1673,7 @@ static void savageDDInvalidateState( GLcontext *ctx, GLuint new_state )
{
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
_ac_InvalidateState( ctx, new_state );
_vbo_InvalidateState( ctx, new_state );
_tnl_InvalidateState( ctx, new_state );
SAVAGE_CONTEXT(ctx)->new_gl_state |= new_state;
}

View file

@ -37,7 +37,7 @@
#include "enums.h"
#include "colormac.h"
#include "swrast/swrast.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
#include "swrast_setup/swrast_setup.h"
@ -645,7 +645,7 @@ sis6326DDInvalidateState( GLcontext *ctx, GLuint new_state )
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
_ac_InvalidateState( ctx, new_state );
_vbo_InvalidateState( ctx, new_state );
_tnl_InvalidateState( ctx, new_state );
smesa->NewGLState |= new_state;
}

View file

@ -53,7 +53,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
#include "tnl/t_pipeline.h"
@ -306,7 +306,7 @@ sisCreateContext( const __GLcontextModes *glVisual,
/* Initialize the software rasterizer and helper modules.
*/
_swrast_CreateContext( ctx );
_ac_CreateContext( ctx );
_vbo_CreateContext( ctx );
_tnl_CreateContext( ctx );
_swsetup_CreateContext( ctx );
@ -353,7 +353,7 @@ sisDestroyContext ( __DRIcontextPrivate *driContextPriv )
if ( smesa != NULL ) {
_swsetup_DestroyContext( smesa->glCtx );
_tnl_DestroyContext( smesa->glCtx );
_ac_DestroyContext( smesa->glCtx );
_vbo_DestroyContext( smesa->glCtx );
_swrast_DestroyContext( smesa->glCtx );
if (smesa->using_agp)

View file

@ -42,7 +42,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "enums.h"
#include "colormac.h"
#include "swrast/swrast.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
#include "swrast_setup/swrast_setup.h"
@ -707,7 +707,7 @@ sisDDInvalidateState( GLcontext *ctx, GLuint new_state )
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
_ac_InvalidateState( ctx, new_state );
_vbo_InvalidateState( ctx, new_state );
_tnl_InvalidateState( ctx, new_state );
smesa->NewGLState |= new_state;
}

Some files were not shown because too many files have changed in this diff Show more