diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2008-05-31 16:36:50 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2008-05-31 16:36:50 +0000 |
commit | edbbb30acbaac6dea32efa3b4c4e7e8889abff8c (patch) | |
tree | 3cb8e3971ac4700aab604f90adf30c0fc2dabd87 /dist/Mesa/src | |
parent | 793dbf86dba9abbe60b4cff5b0049e603ab61e7e (diff) |
Update to Mesa 7.0.3. tested my oga@ and johan@
Diffstat (limited to 'dist/Mesa/src')
143 files changed, 24745 insertions, 8822 deletions
diff --git a/dist/Mesa/src/glx/x11/indirect_dispatch.c b/dist/Mesa/src/glx/x11/indirect_dispatch.c new file mode 100644 index 000000000..00a9f9659 --- /dev/null +++ b/dist/Mesa/src/glx/x11/indirect_dispatch.c @@ -0,0 +1,5914 @@ +/* DO NOT EDIT - This file generated automatically by glX_proto_recv.py (from Mesa) script */ + +/* + * (C) Copyright IBM Corporation 2005 + * 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 + * IBM, + * 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. + */ + +#include <X11/Xmd.h> +#include <GL/gl.h> +#include <GL/glxproto.h> +#include <inttypes.h> +#include "indirect_size.h" +#include "indirect_size_get.h" +#include "indirect_dispatch.h" +#include "glxserver.h" +#include "glxbyteorder.h" +#include "indirect_util.h" +#include "singlesize.h" +#include "glapitable.h" +#include "glapi.h" +#include "glthread.h" +#include "dispatch.h" + +#define __GLX_PAD(x) (((x) + 3) & ~3) + +typedef struct { + __GLX_PIXEL_3D_HDR; +} __GLXpixel3DHeader; + +extern GLboolean __glXErrorOccured( void ); +extern void __glXClearErrorOccured( void ); + +static const unsigned dummy_answer[2] = {0, 0}; + +int __glXDisp_NewList(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + CALL_NewList( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + *(GLenum *)(pc + 4) + ) ); + error = Success; + } + + return error; +} + +int __glXDisp_EndList(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + CALL_EndList( GET_DISPATCH(), () ); + error = Success; + } + + return error; +} + +void __glXDisp_CallList(GLbyte * pc) +{ + CALL_CallList( GET_DISPATCH(), ( + *(GLuint *)(pc + 0) + ) ); +} + +void __glXDisp_CallLists(GLbyte * pc) +{ + const GLsizei n = *(GLsizei *)(pc + 0); + const GLenum type = *(GLenum *)(pc + 4); + const GLvoid * lists = (const GLvoid *)(pc + 8); + + lists = (const GLvoid *) (pc + 8); + + CALL_CallLists( GET_DISPATCH(), ( + n, + type, + lists + ) ); +} + +int __glXDisp_DeleteLists(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + CALL_DeleteLists( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + *(GLsizei *)(pc + 4) + ) ); + error = Success; + } + + return error; +} + +int __glXDisp_GenLists(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + GLuint retval; + retval = CALL_GenLists( GET_DISPATCH(), ( + *(GLsizei *)(pc + 0) + ) ); + __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); + error = Success; + } + + return error; +} + +void __glXDisp_ListBase(GLbyte * pc) +{ + CALL_ListBase( GET_DISPATCH(), ( + *(GLuint *)(pc + 0) + ) ); +} + +void __glXDisp_Begin(GLbyte * pc) +{ + CALL_Begin( GET_DISPATCH(), ( + *(GLenum *)(pc + 0) + ) ); +} + +void __glXDisp_Bitmap(GLbyte * pc) +{ + const GLubyte * const bitmap = (const GLubyte *) (pc + 44); + __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); + + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); + + CALL_Bitmap( GET_DISPATCH(), ( + *(GLsizei *)(pc + 20), + *(GLsizei *)(pc + 24), + *(GLfloat *)(pc + 28), + *(GLfloat *)(pc + 32), + *(GLfloat *)(pc + 36), + *(GLfloat *)(pc + 40), + bitmap + ) ); +} + +void __glXDisp_Color3bv(GLbyte * pc) +{ + CALL_Color3bv( GET_DISPATCH(), ( + (const GLbyte *)(pc + 0) + ) ); +} + +void __glXDisp_Color3dv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 24); + pc -= 4; + } +#endif + + CALL_Color3dv( GET_DISPATCH(), ( + (const GLdouble *)(pc + 0) + ) ); +} + +void __glXDisp_Color3fv(GLbyte * pc) +{ + CALL_Color3fv( GET_DISPATCH(), ( + (const GLfloat *)(pc + 0) + ) ); +} + +void __glXDisp_Color3iv(GLbyte * pc) +{ + CALL_Color3iv( GET_DISPATCH(), ( + (const GLint *)(pc + 0) + ) ); +} + +void __glXDisp_Color3sv(GLbyte * pc) +{ + CALL_Color3sv( GET_DISPATCH(), ( + (const GLshort *)(pc + 0) + ) ); +} + +void __glXDisp_Color3ubv(GLbyte * pc) +{ + CALL_Color3ubv( GET_DISPATCH(), ( + (const GLubyte *)(pc + 0) + ) ); +} + +void __glXDisp_Color3uiv(GLbyte * pc) +{ + CALL_Color3uiv( GET_DISPATCH(), ( + (const GLuint *)(pc + 0) + ) ); +} + +void __glXDisp_Color3usv(GLbyte * pc) +{ + CALL_Color3usv( GET_DISPATCH(), ( + (const GLushort *)(pc + 0) + ) ); +} + +void __glXDisp_Color4bv(GLbyte * pc) +{ + CALL_Color4bv( GET_DISPATCH(), ( + (const GLbyte *)(pc + 0) + ) ); +} + +void __glXDisp_Color4dv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 32); + pc -= 4; + } +#endif + + CALL_Color4dv( GET_DISPATCH(), ( + (const GLdouble *)(pc + 0) + ) ); +} + +void __glXDisp_Color4fv(GLbyte * pc) +{ + CALL_Color4fv( GET_DISPATCH(), ( + (const GLfloat *)(pc + 0) + ) ); +} + +void __glXDisp_Color4iv(GLbyte * pc) +{ + CALL_Color4iv( GET_DISPATCH(), ( + (const GLint *)(pc + 0) + ) ); +} + +void __glXDisp_Color4sv(GLbyte * pc) +{ + CALL_Color4sv( GET_DISPATCH(), ( + (const GLshort *)(pc + 0) + ) ); +} + +void __glXDisp_Color4ubv(GLbyte * pc) +{ + CALL_Color4ubv( GET_DISPATCH(), ( + (const GLubyte *)(pc + 0) + ) ); +} + +void __glXDisp_Color4uiv(GLbyte * pc) +{ + CALL_Color4uiv( GET_DISPATCH(), ( + (const GLuint *)(pc + 0) + ) ); +} + +void __glXDisp_Color4usv(GLbyte * pc) +{ + CALL_Color4usv( GET_DISPATCH(), ( + (const GLushort *)(pc + 0) + ) ); +} + +void __glXDisp_EdgeFlagv(GLbyte * pc) +{ + CALL_EdgeFlagv( GET_DISPATCH(), ( + (const GLboolean *)(pc + 0) + ) ); +} + +void __glXDisp_End(GLbyte * pc) +{ + CALL_End( GET_DISPATCH(), () ); +} + +void __glXDisp_Indexdv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 8); + pc -= 4; + } +#endif + + CALL_Indexdv( GET_DISPATCH(), ( + (const GLdouble *)(pc + 0) + ) ); +} + +void __glXDisp_Indexfv(GLbyte * pc) +{ + CALL_Indexfv( GET_DISPATCH(), ( + (const GLfloat *)(pc + 0) + ) ); +} + +void __glXDisp_Indexiv(GLbyte * pc) +{ + CALL_Indexiv( GET_DISPATCH(), ( + (const GLint *)(pc + 0) + ) ); +} + +void __glXDisp_Indexsv(GLbyte * pc) +{ + CALL_Indexsv( GET_DISPATCH(), ( + (const GLshort *)(pc + 0) + ) ); +} + +void __glXDisp_Normal3bv(GLbyte * pc) +{ + CALL_Normal3bv( GET_DISPATCH(), ( + (const GLbyte *)(pc + 0) + ) ); +} + +void __glXDisp_Normal3dv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 24); + pc -= 4; + } +#endif + + CALL_Normal3dv( GET_DISPATCH(), ( + (const GLdouble *)(pc + 0) + ) ); +} + +void __glXDisp_Normal3fv(GLbyte * pc) +{ + CALL_Normal3fv( GET_DISPATCH(), ( + (const GLfloat *)(pc + 0) + ) ); +} + +void __glXDisp_Normal3iv(GLbyte * pc) +{ + CALL_Normal3iv( GET_DISPATCH(), ( + (const GLint *)(pc + 0) + ) ); +} + +void __glXDisp_Normal3sv(GLbyte * pc) +{ + CALL_Normal3sv( GET_DISPATCH(), ( + (const GLshort *)(pc + 0) + ) ); +} + +void __glXDisp_RasterPos2dv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 16); + pc -= 4; + } +#endif + + CALL_RasterPos2dv( GET_DISPATCH(), ( + (const GLdouble *)(pc + 0) + ) ); +} + +void __glXDisp_RasterPos2fv(GLbyte * pc) +{ + CALL_RasterPos2fv( GET_DISPATCH(), ( + (const GLfloat *)(pc + 0) + ) ); +} + +void __glXDisp_RasterPos2iv(GLbyte * pc) +{ + CALL_RasterPos2iv( GET_DISPATCH(), ( + (const GLint *)(pc + 0) + ) ); +} + +void __glXDisp_RasterPos2sv(GLbyte * pc) +{ + CALL_RasterPos2sv( GET_DISPATCH(), ( + (const GLshort *)(pc + 0) + ) ); +} + +void __glXDisp_RasterPos3dv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 24); + pc -= 4; + } +#endif + + CALL_RasterPos3dv( GET_DISPATCH(), ( + (const GLdouble *)(pc + 0) + ) ); +} + +void __glXDisp_RasterPos3fv(GLbyte * pc) +{ + CALL_RasterPos3fv( GET_DISPATCH(), ( + (const GLfloat *)(pc + 0) + ) ); +} + +void __glXDisp_RasterPos3iv(GLbyte * pc) +{ + CALL_RasterPos3iv( GET_DISPATCH(), ( + (const GLint *)(pc + 0) + ) ); +} + +void __glXDisp_RasterPos3sv(GLbyte * pc) +{ + CALL_RasterPos3sv( GET_DISPATCH(), ( + (const GLshort *)(pc + 0) + ) ); +} + +void __glXDisp_RasterPos4dv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 32); + pc -= 4; + } +#endif + + CALL_RasterPos4dv( GET_DISPATCH(), ( + (const GLdouble *)(pc + 0) + ) ); +} + +void __glXDisp_RasterPos4fv(GLbyte * pc) +{ + CALL_RasterPos4fv( GET_DISPATCH(), ( + (const GLfloat *)(pc + 0) + ) ); +} + +void __glXDisp_RasterPos4iv(GLbyte * pc) +{ + CALL_RasterPos4iv( GET_DISPATCH(), ( + (const GLint *)(pc + 0) + ) ); +} + +void __glXDisp_RasterPos4sv(GLbyte * pc) +{ + CALL_RasterPos4sv( GET_DISPATCH(), ( + (const GLshort *)(pc + 0) + ) ); +} + +void __glXDisp_Rectdv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 32); + pc -= 4; + } +#endif + + CALL_Rectdv( GET_DISPATCH(), ( + (const GLdouble *)(pc + 0), + (const GLdouble *)(pc + 16) + ) ); +} + +void __glXDisp_Rectfv(GLbyte * pc) +{ + CALL_Rectfv( GET_DISPATCH(), ( + (const GLfloat *)(pc + 0), + (const GLfloat *)(pc + 8) + ) ); +} + +void __glXDisp_Rectiv(GLbyte * pc) +{ + CALL_Rectiv( GET_DISPATCH(), ( + (const GLint *)(pc + 0), + (const GLint *)(pc + 8) + ) ); +} + +void __glXDisp_Rectsv(GLbyte * pc) +{ + CALL_Rectsv( GET_DISPATCH(), ( + (const GLshort *)(pc + 0), + (const GLshort *)(pc + 4) + ) ); +} + +void __glXDisp_TexCoord1dv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 8); + pc -= 4; + } +#endif + + CALL_TexCoord1dv( GET_DISPATCH(), ( + (const GLdouble *)(pc + 0) + ) ); +} + +void __glXDisp_TexCoord1fv(GLbyte * pc) +{ + CALL_TexCoord1fv( GET_DISPATCH(), ( + (const GLfloat *)(pc + 0) + ) ); +} + +void __glXDisp_TexCoord1iv(GLbyte * pc) +{ + CALL_TexCoord1iv( GET_DISPATCH(), ( + (const GLint *)(pc + 0) + ) ); +} + +void __glXDisp_TexCoord1sv(GLbyte * pc) +{ + CALL_TexCoord1sv( GET_DISPATCH(), ( + (const GLshort *)(pc + 0) + ) ); +} + +void __glXDisp_TexCoord2dv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 16); + pc -= 4; + } +#endif + + CALL_TexCoord2dv( GET_DISPATCH(), ( + (const GLdouble *)(pc + 0) + ) ); +} + +void __glXDisp_TexCoord2fv(GLbyte * pc) +{ + CALL_TexCoord2fv( GET_DISPATCH(), ( + (const GLfloat *)(pc + 0) + ) ); +} + +void __glXDisp_TexCoord2iv(GLbyte * pc) +{ + CALL_TexCoord2iv( GET_DISPATCH(), ( + (const GLint *)(pc + 0) + ) ); +} + +void __glXDisp_TexCoord2sv(GLbyte * pc) +{ + CALL_TexCoord2sv( GET_DISPATCH(), ( + (const GLshort *)(pc + 0) + ) ); +} + +void __glXDisp_TexCoord3dv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 24); + pc -= 4; + } +#endif + + CALL_TexCoord3dv( GET_DISPATCH(), ( + (const GLdouble *)(pc + 0) + ) ); +} + +void __glXDisp_TexCoord3fv(GLbyte * pc) +{ + CALL_TexCoord3fv( GET_DISPATCH(), ( + (const GLfloat *)(pc + 0) + ) ); +} + +void __glXDisp_TexCoord3iv(GLbyte * pc) +{ + CALL_TexCoord3iv( GET_DISPATCH(), ( + (const GLint *)(pc + 0) + ) ); +} + +void __glXDisp_TexCoord3sv(GLbyte * pc) +{ + CALL_TexCoord3sv( GET_DISPATCH(), ( + (const GLshort *)(pc + 0) + ) ); +} + +void __glXDisp_TexCoord4dv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 32); + pc -= 4; + } +#endif + + CALL_TexCoord4dv( GET_DISPATCH(), ( + (const GLdouble *)(pc + 0) + ) ); +} + +void __glXDisp_TexCoord4fv(GLbyte * pc) +{ + CALL_TexCoord4fv( GET_DISPATCH(), ( + (const GLfloat *)(pc + 0) + ) ); +} + +void __glXDisp_TexCoord4iv(GLbyte * pc) +{ + CALL_TexCoord4iv( GET_DISPATCH(), ( + (const GLint *)(pc + 0) + ) ); +} + +void __glXDisp_TexCoord4sv(GLbyte * pc) +{ + CALL_TexCoord4sv( GET_DISPATCH(), ( + (const GLshort *)(pc + 0) + ) ); +} + +void __glXDisp_Vertex2dv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 16); + pc -= 4; + } +#endif + + CALL_Vertex2dv( GET_DISPATCH(), ( + (const GLdouble *)(pc + 0) + ) ); +} + +void __glXDisp_Vertex2fv(GLbyte * pc) +{ + CALL_Vertex2fv( GET_DISPATCH(), ( + (const GLfloat *)(pc + 0) + ) ); +} + +void __glXDisp_Vertex2iv(GLbyte * pc) +{ + CALL_Vertex2iv( GET_DISPATCH(), ( + (const GLint *)(pc + 0) + ) ); +} + +void __glXDisp_Vertex2sv(GLbyte * pc) +{ + CALL_Vertex2sv( GET_DISPATCH(), ( + (const GLshort *)(pc + 0) + ) ); +} + +void __glXDisp_Vertex3dv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 24); + pc -= 4; + } +#endif + + CALL_Vertex3dv( GET_DISPATCH(), ( + (const GLdouble *)(pc + 0) + ) ); +} + +void __glXDisp_Vertex3fv(GLbyte * pc) +{ + CALL_Vertex3fv( GET_DISPATCH(), ( + (const GLfloat *)(pc + 0) + ) ); +} + +void __glXDisp_Vertex3iv(GLbyte * pc) +{ + CALL_Vertex3iv( GET_DISPATCH(), ( + (const GLint *)(pc + 0) + ) ); +} + +void __glXDisp_Vertex3sv(GLbyte * pc) +{ + CALL_Vertex3sv( GET_DISPATCH(), ( + (const GLshort *)(pc + 0) + ) ); +} + +void __glXDisp_Vertex4dv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 32); + pc -= 4; + } +#endif + + CALL_Vertex4dv( GET_DISPATCH(), ( + (const GLdouble *)(pc + 0) + ) ); +} + +void __glXDisp_Vertex4fv(GLbyte * pc) +{ + CALL_Vertex4fv( GET_DISPATCH(), ( + (const GLfloat *)(pc + 0) + ) ); +} + +void __glXDisp_Vertex4iv(GLbyte * pc) +{ + CALL_Vertex4iv( GET_DISPATCH(), ( + (const GLint *)(pc + 0) + ) ); +} + +void __glXDisp_Vertex4sv(GLbyte * pc) +{ + CALL_Vertex4sv( GET_DISPATCH(), ( + (const GLshort *)(pc + 0) + ) ); +} + +void __glXDisp_ClipPlane(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 36); + pc -= 4; + } +#endif + + CALL_ClipPlane( GET_DISPATCH(), ( + *(GLenum *)(pc + 32), + (const GLdouble *)(pc + 0) + ) ); +} + +void __glXDisp_ColorMaterial(GLbyte * pc) +{ + CALL_ColorMaterial( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4) + ) ); +} + +void __glXDisp_CullFace(GLbyte * pc) +{ + CALL_CullFace( GET_DISPATCH(), ( + *(GLenum *)(pc + 0) + ) ); +} + +void __glXDisp_Fogf(GLbyte * pc) +{ + CALL_Fogf( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLfloat *)(pc + 4) + ) ); +} + +void __glXDisp_Fogfv(GLbyte * pc) +{ + const GLenum pname = *(GLenum *)(pc + 0); + const GLfloat * params; + + params = (const GLfloat *) (pc + 4); + + CALL_Fogfv( GET_DISPATCH(), ( + pname, + params + ) ); +} + +void __glXDisp_Fogi(GLbyte * pc) +{ + CALL_Fogi( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLint *)(pc + 4) + ) ); +} + +void __glXDisp_Fogiv(GLbyte * pc) +{ + const GLenum pname = *(GLenum *)(pc + 0); + const GLint * params; + + params = (const GLint *) (pc + 4); + + CALL_Fogiv( GET_DISPATCH(), ( + pname, + params + ) ); +} + +void __glXDisp_FrontFace(GLbyte * pc) +{ + CALL_FrontFace( GET_DISPATCH(), ( + *(GLenum *)(pc + 0) + ) ); +} + +void __glXDisp_Hint(GLbyte * pc) +{ + CALL_Hint( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4) + ) ); +} + +void __glXDisp_Lightf(GLbyte * pc) +{ + CALL_Lightf( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLfloat *)(pc + 8) + ) ); +} + +void __glXDisp_Lightfv(GLbyte * pc) +{ + const GLenum pname = *(GLenum *)(pc + 4); + const GLfloat * params; + + params = (const GLfloat *) (pc + 8); + + CALL_Lightfv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); +} + +void __glXDisp_Lighti(GLbyte * pc) +{ + CALL_Lighti( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8) + ) ); +} + +void __glXDisp_Lightiv(GLbyte * pc) +{ + const GLenum pname = *(GLenum *)(pc + 4); + const GLint * params; + + params = (const GLint *) (pc + 8); + + CALL_Lightiv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); +} + +void __glXDisp_LightModelf(GLbyte * pc) +{ + CALL_LightModelf( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLfloat *)(pc + 4) + ) ); +} + +void __glXDisp_LightModelfv(GLbyte * pc) +{ + const GLenum pname = *(GLenum *)(pc + 0); + const GLfloat * params; + + params = (const GLfloat *) (pc + 4); + + CALL_LightModelfv( GET_DISPATCH(), ( + pname, + params + ) ); +} + +void __glXDisp_LightModeli(GLbyte * pc) +{ + CALL_LightModeli( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLint *)(pc + 4) + ) ); +} + +void __glXDisp_LightModeliv(GLbyte * pc) +{ + const GLenum pname = *(GLenum *)(pc + 0); + const GLint * params; + + params = (const GLint *) (pc + 4); + + CALL_LightModeliv( GET_DISPATCH(), ( + pname, + params + ) ); +} + +void __glXDisp_LineStipple(GLbyte * pc) +{ + CALL_LineStipple( GET_DISPATCH(), ( + *(GLint *)(pc + 0), + *(GLushort *)(pc + 4) + ) ); +} + +void __glXDisp_LineWidth(GLbyte * pc) +{ + CALL_LineWidth( GET_DISPATCH(), ( + *(GLfloat *)(pc + 0) + ) ); +} + +void __glXDisp_Materialf(GLbyte * pc) +{ + CALL_Materialf( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLfloat *)(pc + 8) + ) ); +} + +void __glXDisp_Materialfv(GLbyte * pc) +{ + const GLenum pname = *(GLenum *)(pc + 4); + const GLfloat * params; + + params = (const GLfloat *) (pc + 8); + + CALL_Materialfv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); +} + +void __glXDisp_Materiali(GLbyte * pc) +{ + CALL_Materiali( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8) + ) ); +} + +void __glXDisp_Materialiv(GLbyte * pc) +{ + const GLenum pname = *(GLenum *)(pc + 4); + const GLint * params; + + params = (const GLint *) (pc + 8); + + CALL_Materialiv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); +} + +void __glXDisp_PointSize(GLbyte * pc) +{ + CALL_PointSize( GET_DISPATCH(), ( + *(GLfloat *)(pc + 0) + ) ); +} + +void __glXDisp_PolygonMode(GLbyte * pc) +{ + CALL_PolygonMode( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4) + ) ); +} + +void __glXDisp_PolygonStipple(GLbyte * pc) +{ + const GLubyte * const mask = (const GLubyte *) (pc + 20); + __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); + + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); + + CALL_PolygonStipple( GET_DISPATCH(), ( + mask + ) ); +} + +void __glXDisp_Scissor(GLbyte * pc) +{ + CALL_Scissor( GET_DISPATCH(), ( + *(GLint *)(pc + 0), + *(GLint *)(pc + 4), + *(GLsizei *)(pc + 8), + *(GLsizei *)(pc + 12) + ) ); +} + +void __glXDisp_ShadeModel(GLbyte * pc) +{ + CALL_ShadeModel( GET_DISPATCH(), ( + *(GLenum *)(pc + 0) + ) ); +} + +void __glXDisp_TexParameterf(GLbyte * pc) +{ + CALL_TexParameterf( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLfloat *)(pc + 8) + ) ); +} + +void __glXDisp_TexParameterfv(GLbyte * pc) +{ + const GLenum pname = *(GLenum *)(pc + 4); + const GLfloat * params; + + params = (const GLfloat *) (pc + 8); + + CALL_TexParameterfv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); +} + +void __glXDisp_TexParameteri(GLbyte * pc) +{ + CALL_TexParameteri( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8) + ) ); +} + +void __glXDisp_TexParameteriv(GLbyte * pc) +{ + const GLenum pname = *(GLenum *)(pc + 4); + const GLint * params; + + params = (const GLint *) (pc + 8); + + CALL_TexParameteriv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); +} + +void __glXDisp_TexImage1D(GLbyte * pc) +{ + const GLvoid * const pixels = (const GLvoid *) (pc + 52); + __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); + + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); + + CALL_TexImage1D( GET_DISPATCH(), ( + *(GLenum *)(pc + 20), + *(GLint *)(pc + 24), + *(GLint *)(pc + 28), + *(GLsizei *)(pc + 32), + *(GLint *)(pc + 40), + *(GLenum *)(pc + 44), + *(GLenum *)(pc + 48), + pixels + ) ); +} + +void __glXDisp_TexImage2D(GLbyte * pc) +{ + const GLvoid * const pixels = (const GLvoid *) (pc + 52); + __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); + + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); + + CALL_TexImage2D( GET_DISPATCH(), ( + *(GLenum *)(pc + 20), + *(GLint *)(pc + 24), + *(GLint *)(pc + 28), + *(GLsizei *)(pc + 32), + *(GLsizei *)(pc + 36), + *(GLint *)(pc + 40), + *(GLenum *)(pc + 44), + *(GLenum *)(pc + 48), + pixels + ) ); +} + +void __glXDisp_TexEnvf(GLbyte * pc) +{ + CALL_TexEnvf( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLfloat *)(pc + 8) + ) ); +} + +void __glXDisp_TexEnvfv(GLbyte * pc) +{ + const GLenum pname = *(GLenum *)(pc + 4); + const GLfloat * params; + + params = (const GLfloat *) (pc + 8); + + CALL_TexEnvfv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); +} + +void __glXDisp_TexEnvi(GLbyte * pc) +{ + CALL_TexEnvi( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8) + ) ); +} + +void __glXDisp_TexEnviv(GLbyte * pc) +{ + const GLenum pname = *(GLenum *)(pc + 4); + const GLint * params; + + params = (const GLint *) (pc + 8); + + CALL_TexEnviv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); +} + +void __glXDisp_TexGend(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 16); + pc -= 4; + } +#endif + + CALL_TexGend( GET_DISPATCH(), ( + *(GLenum *)(pc + 8), + *(GLenum *)(pc + 12), + *(GLdouble *)(pc + 0) + ) ); +} + +void __glXDisp_TexGendv(GLbyte * pc) +{ + const GLenum pname = *(GLenum *)(pc + 4); + const GLdouble * params; + +#ifdef __GLX_ALIGN64 + const GLuint compsize = __glTexGendv_size(pname); + const GLuint cmdlen = 12 + __GLX_PAD((compsize * 8)) - 4; + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, cmdlen); + pc -= 4; + } +#endif + + params = (const GLdouble *) (pc + 8); + + CALL_TexGendv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); +} + +void __glXDisp_TexGenf(GLbyte * pc) +{ + CALL_TexGenf( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLfloat *)(pc + 8) + ) ); +} + +void __glXDisp_TexGenfv(GLbyte * pc) +{ + const GLenum pname = *(GLenum *)(pc + 4); + const GLfloat * params; + + params = (const GLfloat *) (pc + 8); + + CALL_TexGenfv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); +} + +void __glXDisp_TexGeni(GLbyte * pc) +{ + CALL_TexGeni( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8) + ) ); +} + +void __glXDisp_TexGeniv(GLbyte * pc) +{ + const GLenum pname = *(GLenum *)(pc + 4); + const GLint * params; + + params = (const GLint *) (pc + 8); + + CALL_TexGeniv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); +} + +void __glXDisp_InitNames(GLbyte * pc) +{ + CALL_InitNames( GET_DISPATCH(), () ); +} + +void __glXDisp_LoadName(GLbyte * pc) +{ + CALL_LoadName( GET_DISPATCH(), ( + *(GLuint *)(pc + 0) + ) ); +} + +void __glXDisp_PassThrough(GLbyte * pc) +{ + CALL_PassThrough( GET_DISPATCH(), ( + *(GLfloat *)(pc + 0) + ) ); +} + +void __glXDisp_PopName(GLbyte * pc) +{ + CALL_PopName( GET_DISPATCH(), () ); +} + +void __glXDisp_PushName(GLbyte * pc) +{ + CALL_PushName( GET_DISPATCH(), ( + *(GLuint *)(pc + 0) + ) ); +} + +void __glXDisp_DrawBuffer(GLbyte * pc) +{ + CALL_DrawBuffer( GET_DISPATCH(), ( + *(GLenum *)(pc + 0) + ) ); +} + +void __glXDisp_Clear(GLbyte * pc) +{ + CALL_Clear( GET_DISPATCH(), ( + *(GLbitfield *)(pc + 0) + ) ); +} + +void __glXDisp_ClearAccum(GLbyte * pc) +{ + CALL_ClearAccum( GET_DISPATCH(), ( + *(GLfloat *)(pc + 0), + *(GLfloat *)(pc + 4), + *(GLfloat *)(pc + 8), + *(GLfloat *)(pc + 12) + ) ); +} + +void __glXDisp_ClearIndex(GLbyte * pc) +{ + CALL_ClearIndex( GET_DISPATCH(), ( + *(GLfloat *)(pc + 0) + ) ); +} + +void __glXDisp_ClearColor(GLbyte * pc) +{ + CALL_ClearColor( GET_DISPATCH(), ( + *(GLclampf *)(pc + 0), + *(GLclampf *)(pc + 4), + *(GLclampf *)(pc + 8), + *(GLclampf *)(pc + 12) + ) ); +} + +void __glXDisp_ClearStencil(GLbyte * pc) +{ + CALL_ClearStencil( GET_DISPATCH(), ( + *(GLint *)(pc + 0) + ) ); +} + +void __glXDisp_ClearDepth(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 8); + pc -= 4; + } +#endif + + CALL_ClearDepth( GET_DISPATCH(), ( + *(GLclampd *)(pc + 0) + ) ); +} + +void __glXDisp_StencilMask(GLbyte * pc) +{ + CALL_StencilMask( GET_DISPATCH(), ( + *(GLuint *)(pc + 0) + ) ); +} + +void __glXDisp_ColorMask(GLbyte * pc) +{ + CALL_ColorMask( GET_DISPATCH(), ( + *(GLboolean *)(pc + 0), + *(GLboolean *)(pc + 1), + *(GLboolean *)(pc + 2), + *(GLboolean *)(pc + 3) + ) ); +} + +void __glXDisp_DepthMask(GLbyte * pc) +{ + CALL_DepthMask( GET_DISPATCH(), ( + *(GLboolean *)(pc + 0) + ) ); +} + +void __glXDisp_IndexMask(GLbyte * pc) +{ + CALL_IndexMask( GET_DISPATCH(), ( + *(GLuint *)(pc + 0) + ) ); +} + +void __glXDisp_Accum(GLbyte * pc) +{ + CALL_Accum( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLfloat *)(pc + 4) + ) ); +} + +void __glXDisp_Disable(GLbyte * pc) +{ + CALL_Disable( GET_DISPATCH(), ( + *(GLenum *)(pc + 0) + ) ); +} + +void __glXDisp_Enable(GLbyte * pc) +{ + CALL_Enable( GET_DISPATCH(), ( + *(GLenum *)(pc + 0) + ) ); +} + +void __glXDisp_PopAttrib(GLbyte * pc) +{ + CALL_PopAttrib( GET_DISPATCH(), () ); +} + +void __glXDisp_PushAttrib(GLbyte * pc) +{ + CALL_PushAttrib( GET_DISPATCH(), ( + *(GLbitfield *)(pc + 0) + ) ); +} + +void __glXDisp_MapGrid1d(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 20); + pc -= 4; + } +#endif + + CALL_MapGrid1d( GET_DISPATCH(), ( + *(GLint *)(pc + 16), + *(GLdouble *)(pc + 0), + *(GLdouble *)(pc + 8) + ) ); +} + +void __glXDisp_MapGrid1f(GLbyte * pc) +{ + CALL_MapGrid1f( GET_DISPATCH(), ( + *(GLint *)(pc + 0), + *(GLfloat *)(pc + 4), + *(GLfloat *)(pc + 8) + ) ); +} + +void __glXDisp_MapGrid2d(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 40); + pc -= 4; + } +#endif + + CALL_MapGrid2d( GET_DISPATCH(), ( + *(GLint *)(pc + 32), + *(GLdouble *)(pc + 0), + *(GLdouble *)(pc + 8), + *(GLint *)(pc + 36), + *(GLdouble *)(pc + 16), + *(GLdouble *)(pc + 24) + ) ); +} + +void __glXDisp_MapGrid2f(GLbyte * pc) +{ + CALL_MapGrid2f( GET_DISPATCH(), ( + *(GLint *)(pc + 0), + *(GLfloat *)(pc + 4), + *(GLfloat *)(pc + 8), + *(GLint *)(pc + 12), + *(GLfloat *)(pc + 16), + *(GLfloat *)(pc + 20) + ) ); +} + +void __glXDisp_EvalCoord1dv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 8); + pc -= 4; + } +#endif + + CALL_EvalCoord1dv( GET_DISPATCH(), ( + (const GLdouble *)(pc + 0) + ) ); +} + +void __glXDisp_EvalCoord1fv(GLbyte * pc) +{ + CALL_EvalCoord1fv( GET_DISPATCH(), ( + (const GLfloat *)(pc + 0) + ) ); +} + +void __glXDisp_EvalCoord2dv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 16); + pc -= 4; + } +#endif + + CALL_EvalCoord2dv( GET_DISPATCH(), ( + (const GLdouble *)(pc + 0) + ) ); +} + +void __glXDisp_EvalCoord2fv(GLbyte * pc) +{ + CALL_EvalCoord2fv( GET_DISPATCH(), ( + (const GLfloat *)(pc + 0) + ) ); +} + +void __glXDisp_EvalMesh1(GLbyte * pc) +{ + CALL_EvalMesh1( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLint *)(pc + 4), + *(GLint *)(pc + 8) + ) ); +} + +void __glXDisp_EvalPoint1(GLbyte * pc) +{ + CALL_EvalPoint1( GET_DISPATCH(), ( + *(GLint *)(pc + 0) + ) ); +} + +void __glXDisp_EvalMesh2(GLbyte * pc) +{ + CALL_EvalMesh2( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLint *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLint *)(pc + 16) + ) ); +} + +void __glXDisp_EvalPoint2(GLbyte * pc) +{ + CALL_EvalPoint2( GET_DISPATCH(), ( + *(GLint *)(pc + 0), + *(GLint *)(pc + 4) + ) ); +} + +void __glXDisp_AlphaFunc(GLbyte * pc) +{ + CALL_AlphaFunc( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLclampf *)(pc + 4) + ) ); +} + +void __glXDisp_BlendFunc(GLbyte * pc) +{ + CALL_BlendFunc( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4) + ) ); +} + +void __glXDisp_LogicOp(GLbyte * pc) +{ + CALL_LogicOp( GET_DISPATCH(), ( + *(GLenum *)(pc + 0) + ) ); +} + +void __glXDisp_StencilFunc(GLbyte * pc) +{ + CALL_StencilFunc( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLint *)(pc + 4), + *(GLuint *)(pc + 8) + ) ); +} + +void __glXDisp_StencilOp(GLbyte * pc) +{ + CALL_StencilOp( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLenum *)(pc + 8) + ) ); +} + +void __glXDisp_DepthFunc(GLbyte * pc) +{ + CALL_DepthFunc( GET_DISPATCH(), ( + *(GLenum *)(pc + 0) + ) ); +} + +void __glXDisp_PixelZoom(GLbyte * pc) +{ + CALL_PixelZoom( GET_DISPATCH(), ( + *(GLfloat *)(pc + 0), + *(GLfloat *)(pc + 4) + ) ); +} + +void __glXDisp_PixelTransferf(GLbyte * pc) +{ + CALL_PixelTransferf( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLfloat *)(pc + 4) + ) ); +} + +void __glXDisp_PixelTransferi(GLbyte * pc) +{ + CALL_PixelTransferi( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLint *)(pc + 4) + ) ); +} + +int __glXDisp_PixelStoref(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + CALL_PixelStoref( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLfloat *)(pc + 4) + ) ); + error = Success; + } + + return error; +} + +int __glXDisp_PixelStorei(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + CALL_PixelStorei( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLint *)(pc + 4) + ) ); + error = Success; + } + + return error; +} + +void __glXDisp_PixelMapfv(GLbyte * pc) +{ + const GLsizei mapsize = *(GLsizei *)(pc + 4); + + CALL_PixelMapfv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + mapsize, + (const GLfloat *)(pc + 8) + ) ); +} + +void __glXDisp_PixelMapuiv(GLbyte * pc) +{ + const GLsizei mapsize = *(GLsizei *)(pc + 4); + + CALL_PixelMapuiv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + mapsize, + (const GLuint *)(pc + 8) + ) ); +} + +void __glXDisp_PixelMapusv(GLbyte * pc) +{ + const GLsizei mapsize = *(GLsizei *)(pc + 4); + + CALL_PixelMapusv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + mapsize, + (const GLushort *)(pc + 8) + ) ); +} + +void __glXDisp_ReadBuffer(GLbyte * pc) +{ + CALL_ReadBuffer( GET_DISPATCH(), ( + *(GLenum *)(pc + 0) + ) ); +} + +void __glXDisp_CopyPixels(GLbyte * pc) +{ + CALL_CopyPixels( GET_DISPATCH(), ( + *(GLint *)(pc + 0), + *(GLint *)(pc + 4), + *(GLsizei *)(pc + 8), + *(GLsizei *)(pc + 12), + *(GLenum *)(pc + 16) + ) ); +} + +void __glXDisp_DrawPixels(GLbyte * pc) +{ + const GLvoid * const pixels = (const GLvoid *) (pc + 36); + __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); + + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); + + CALL_DrawPixels( GET_DISPATCH(), ( + *(GLsizei *)(pc + 20), + *(GLsizei *)(pc + 24), + *(GLenum *)(pc + 28), + *(GLenum *)(pc + 32), + pixels + ) ); +} + +int __glXDisp_GetBooleanv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 0); + + const GLuint compsize = __glGetBooleanv_size(pname); + GLboolean answerBuffer[200]; + GLboolean * params = __glXGetAnswerBuffer(cl, compsize, answerBuffer, sizeof(answerBuffer), 1); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetBooleanv( GET_DISPATCH(), ( + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 1, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetClipPlane(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + GLdouble equation[4]; + CALL_GetClipPlane( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + equation + ) ); + __glXSendReply(cl->client, equation, 4, 8, GL_TRUE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetDoublev(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 0); + + const GLuint compsize = __glGetDoublev_size(pname); + GLdouble answerBuffer[200]; + GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetDoublev( GET_DISPATCH(), ( + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 8, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetError(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + GLenum retval; + retval = CALL_GetError( GET_DISPATCH(), () ); + __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); + error = Success; + } + + return error; +} + +int __glXDisp_GetFloatv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 0); + + const GLuint compsize = __glGetFloatv_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetFloatv( GET_DISPATCH(), ( + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetIntegerv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 0); + + const GLuint compsize = __glGetIntegerv_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetIntegerv( GET_DISPATCH(), ( + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetLightfv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetLightfv_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetLightfv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetLightiv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetLightiv_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetLightiv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetMapdv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum target = *(GLenum *)(pc + 0); + const GLenum query = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetMapdv_size(target,query); + GLdouble answerBuffer[200]; + GLdouble * v = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); + + if (v == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetMapdv( GET_DISPATCH(), ( + target, + query, + v + ) ); + __glXSendReply(cl->client, v, compsize, 8, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetMapfv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum target = *(GLenum *)(pc + 0); + const GLenum query = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetMapfv_size(target,query); + GLfloat answerBuffer[200]; + GLfloat * v = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (v == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetMapfv( GET_DISPATCH(), ( + target, + query, + v + ) ); + __glXSendReply(cl->client, v, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetMapiv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum target = *(GLenum *)(pc + 0); + const GLenum query = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetMapiv_size(target,query); + GLint answerBuffer[200]; + GLint * v = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (v == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetMapiv( GET_DISPATCH(), ( + target, + query, + v + ) ); + __glXSendReply(cl->client, v, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetMaterialfv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetMaterialfv_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetMaterialfv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetMaterialiv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetMaterialiv_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetMaterialiv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetPixelMapfv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum map = *(GLenum *)(pc + 0); + + const GLuint compsize = __glGetPixelMapfv_size(map); + GLfloat answerBuffer[200]; + GLfloat * values = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (values == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetPixelMapfv( GET_DISPATCH(), ( + map, + values + ) ); + __glXSendReply(cl->client, values, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetPixelMapuiv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum map = *(GLenum *)(pc + 0); + + const GLuint compsize = __glGetPixelMapuiv_size(map); + GLuint answerBuffer[200]; + GLuint * values = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (values == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetPixelMapuiv( GET_DISPATCH(), ( + map, + values + ) ); + __glXSendReply(cl->client, values, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetPixelMapusv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum map = *(GLenum *)(pc + 0); + + const GLuint compsize = __glGetPixelMapusv_size(map); + GLushort answerBuffer[200]; + GLushort * values = __glXGetAnswerBuffer(cl, compsize * 2, answerBuffer, sizeof(answerBuffer), 2); + + if (values == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetPixelMapusv( GET_DISPATCH(), ( + map, + values + ) ); + __glXSendReply(cl->client, values, compsize, 2, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetTexEnvfv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetTexEnvfv_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetTexEnvfv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetTexEnviv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetTexEnviv_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetTexEnviv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetTexGendv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetTexGendv_size(pname); + GLdouble answerBuffer[200]; + GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetTexGendv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 8, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetTexGenfv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetTexGenfv_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetTexGenfv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetTexGeniv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetTexGeniv_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetTexGeniv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetTexParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetTexParameterfv_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetTexParameterfv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetTexParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetTexParameteriv_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetTexParameteriv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetTexLevelParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 8); + + const GLuint compsize = __glGetTexLevelParameterfv_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetTexLevelParameterfv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLint *)(pc + 4), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetTexLevelParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 8); + + const GLuint compsize = __glGetTexLevelParameteriv_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetTexLevelParameteriv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLint *)(pc + 4), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_IsEnabled(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + GLboolean retval; + retval = CALL_IsEnabled( GET_DISPATCH(), ( + *(GLenum *)(pc + 0) + ) ); + __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); + error = Success; + } + + return error; +} + +int __glXDisp_IsList(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + GLboolean retval; + retval = CALL_IsList( GET_DISPATCH(), ( + *(GLuint *)(pc + 0) + ) ); + __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); + error = Success; + } + + return error; +} + +void __glXDisp_DepthRange(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 16); + pc -= 4; + } +#endif + + CALL_DepthRange( GET_DISPATCH(), ( + *(GLclampd *)(pc + 0), + *(GLclampd *)(pc + 8) + ) ); +} + +void __glXDisp_Frustum(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 48); + pc -= 4; + } +#endif + + CALL_Frustum( GET_DISPATCH(), ( + *(GLdouble *)(pc + 0), + *(GLdouble *)(pc + 8), + *(GLdouble *)(pc + 16), + *(GLdouble *)(pc + 24), + *(GLdouble *)(pc + 32), + *(GLdouble *)(pc + 40) + ) ); +} + +void __glXDisp_LoadIdentity(GLbyte * pc) +{ + CALL_LoadIdentity( GET_DISPATCH(), () ); +} + +void __glXDisp_LoadMatrixf(GLbyte * pc) +{ + CALL_LoadMatrixf( GET_DISPATCH(), ( + (const GLfloat *)(pc + 0) + ) ); +} + +void __glXDisp_LoadMatrixd(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 128); + pc -= 4; + } +#endif + + CALL_LoadMatrixd( GET_DISPATCH(), ( + (const GLdouble *)(pc + 0) + ) ); +} + +void __glXDisp_MatrixMode(GLbyte * pc) +{ + CALL_MatrixMode( GET_DISPATCH(), ( + *(GLenum *)(pc + 0) + ) ); +} + +void __glXDisp_MultMatrixf(GLbyte * pc) +{ + CALL_MultMatrixf( GET_DISPATCH(), ( + (const GLfloat *)(pc + 0) + ) ); +} + +void __glXDisp_MultMatrixd(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 128); + pc -= 4; + } +#endif + + CALL_MultMatrixd( GET_DISPATCH(), ( + (const GLdouble *)(pc + 0) + ) ); +} + +void __glXDisp_Ortho(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 48); + pc -= 4; + } +#endif + + CALL_Ortho( GET_DISPATCH(), ( + *(GLdouble *)(pc + 0), + *(GLdouble *)(pc + 8), + *(GLdouble *)(pc + 16), + *(GLdouble *)(pc + 24), + *(GLdouble *)(pc + 32), + *(GLdouble *)(pc + 40) + ) ); +} + +void __glXDisp_PopMatrix(GLbyte * pc) +{ + CALL_PopMatrix( GET_DISPATCH(), () ); +} + +void __glXDisp_PushMatrix(GLbyte * pc) +{ + CALL_PushMatrix( GET_DISPATCH(), () ); +} + +void __glXDisp_Rotated(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 32); + pc -= 4; + } +#endif + + CALL_Rotated( GET_DISPATCH(), ( + *(GLdouble *)(pc + 0), + *(GLdouble *)(pc + 8), + *(GLdouble *)(pc + 16), + *(GLdouble *)(pc + 24) + ) ); +} + +void __glXDisp_Rotatef(GLbyte * pc) +{ + CALL_Rotatef( GET_DISPATCH(), ( + *(GLfloat *)(pc + 0), + *(GLfloat *)(pc + 4), + *(GLfloat *)(pc + 8), + *(GLfloat *)(pc + 12) + ) ); +} + +void __glXDisp_Scaled(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 24); + pc -= 4; + } +#endif + + CALL_Scaled( GET_DISPATCH(), ( + *(GLdouble *)(pc + 0), + *(GLdouble *)(pc + 8), + *(GLdouble *)(pc + 16) + ) ); +} + +void __glXDisp_Scalef(GLbyte * pc) +{ + CALL_Scalef( GET_DISPATCH(), ( + *(GLfloat *)(pc + 0), + *(GLfloat *)(pc + 4), + *(GLfloat *)(pc + 8) + ) ); +} + +void __glXDisp_Translated(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 24); + pc -= 4; + } +#endif + + CALL_Translated( GET_DISPATCH(), ( + *(GLdouble *)(pc + 0), + *(GLdouble *)(pc + 8), + *(GLdouble *)(pc + 16) + ) ); +} + +void __glXDisp_Translatef(GLbyte * pc) +{ + CALL_Translatef( GET_DISPATCH(), ( + *(GLfloat *)(pc + 0), + *(GLfloat *)(pc + 4), + *(GLfloat *)(pc + 8) + ) ); +} + +void __glXDisp_Viewport(GLbyte * pc) +{ + CALL_Viewport( GET_DISPATCH(), ( + *(GLint *)(pc + 0), + *(GLint *)(pc + 4), + *(GLsizei *)(pc + 8), + *(GLsizei *)(pc + 12) + ) ); +} + +void __glXDisp_BindTexture(GLbyte * pc) +{ + CALL_BindTexture( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLuint *)(pc + 4) + ) ); +} + +void __glXDisp_Indexubv(GLbyte * pc) +{ + CALL_Indexubv( GET_DISPATCH(), ( + (const GLubyte *)(pc + 0) + ) ); +} + +void __glXDisp_PolygonOffset(GLbyte * pc) +{ + CALL_PolygonOffset( GET_DISPATCH(), ( + *(GLfloat *)(pc + 0), + *(GLfloat *)(pc + 4) + ) ); +} + +int __glXDisp_AreTexturesResident(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLsizei n = *(GLsizei *)(pc + 0); + + GLboolean retval; + GLboolean answerBuffer[200]; + GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1); + retval = CALL_AreTexturesResident( GET_DISPATCH(), ( + n, + (const GLuint *)(pc + 4), + residences + ) ); + __glXSendReply(cl->client, residences, n, 1, GL_TRUE, retval); + error = Success; + } + + return error; +} + +int __glXDisp_AreTexturesResidentEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLsizei n = *(GLsizei *)(pc + 0); + + GLboolean retval; + GLboolean answerBuffer[200]; + GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1); + retval = CALL_AreTexturesResident( GET_DISPATCH(), ( + n, + (const GLuint *)(pc + 4), + residences + ) ); + __glXSendReply(cl->client, residences, n, 1, GL_TRUE, retval); + error = Success; + } + + return error; +} + +void __glXDisp_CopyTexImage1D(GLbyte * pc) +{ + CALL_CopyTexImage1D( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLint *)(pc + 4), + *(GLenum *)(pc + 8), + *(GLint *)(pc + 12), + *(GLint *)(pc + 16), + *(GLsizei *)(pc + 20), + *(GLint *)(pc + 24) + ) ); +} + +void __glXDisp_CopyTexImage2D(GLbyte * pc) +{ + CALL_CopyTexImage2D( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLint *)(pc + 4), + *(GLenum *)(pc + 8), + *(GLint *)(pc + 12), + *(GLint *)(pc + 16), + *(GLsizei *)(pc + 20), + *(GLsizei *)(pc + 24), + *(GLint *)(pc + 28) + ) ); +} + +void __glXDisp_CopyTexSubImage1D(GLbyte * pc) +{ + CALL_CopyTexSubImage1D( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLint *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLint *)(pc + 16), + *(GLsizei *)(pc + 20) + ) ); +} + +void __glXDisp_CopyTexSubImage2D(GLbyte * pc) +{ + CALL_CopyTexSubImage2D( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLint *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLint *)(pc + 16), + *(GLint *)(pc + 20), + *(GLsizei *)(pc + 24), + *(GLsizei *)(pc + 28) + ) ); +} + +int __glXDisp_DeleteTextures(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLsizei n = *(GLsizei *)(pc + 0); + + CALL_DeleteTextures( GET_DISPATCH(), ( + n, + (const GLuint *)(pc + 4) + ) ); + error = Success; + } + + return error; +} + +int __glXDisp_DeleteTexturesEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLsizei n = *(GLsizei *)(pc + 0); + + CALL_DeleteTextures( GET_DISPATCH(), ( + n, + (const GLuint *)(pc + 4) + ) ); + error = Success; + } + + return error; +} + +int __glXDisp_GenTextures(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLsizei n = *(GLsizei *)(pc + 0); + + GLuint answerBuffer[200]; + GLuint * textures = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); + CALL_GenTextures( GET_DISPATCH(), ( + n, + textures + ) ); + __glXSendReply(cl->client, textures, n, 4, GL_TRUE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GenTexturesEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLsizei n = *(GLsizei *)(pc + 0); + + GLuint answerBuffer[200]; + GLuint * textures = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); + CALL_GenTextures( GET_DISPATCH(), ( + n, + textures + ) ); + __glXSendReply(cl->client, textures, n, 4, GL_TRUE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_IsTexture(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + GLboolean retval; + retval = CALL_IsTexture( GET_DISPATCH(), ( + *(GLuint *)(pc + 0) + ) ); + __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); + error = Success; + } + + return error; +} + +int __glXDisp_IsTextureEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + GLboolean retval; + retval = CALL_IsTexture( GET_DISPATCH(), ( + *(GLuint *)(pc + 0) + ) ); + __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); + error = Success; + } + + return error; +} + +void __glXDisp_PrioritizeTextures(GLbyte * pc) +{ + const GLsizei n = *(GLsizei *)(pc + 0); + + CALL_PrioritizeTextures( GET_DISPATCH(), ( + n, + (const GLuint *)(pc + 4), + (const GLclampf *)(pc + 4) + ) ); +} + +void __glXDisp_TexSubImage1D(GLbyte * pc) +{ + const CARD32 ptr_is_null = *(CARD32 *)(pc + 52); + const GLvoid * const pixels = (const GLvoid *) (ptr_is_null != 0) ? NULL : (pc + 56); + __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); + + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); + + CALL_TexSubImage1D( GET_DISPATCH(), ( + *(GLenum *)(pc + 20), + *(GLint *)(pc + 24), + *(GLint *)(pc + 28), + *(GLsizei *)(pc + 36), + *(GLenum *)(pc + 44), + *(GLenum *)(pc + 48), + pixels + ) ); +} + +void __glXDisp_TexSubImage2D(GLbyte * pc) +{ + const CARD32 ptr_is_null = *(CARD32 *)(pc + 52); + const GLvoid * const pixels = (const GLvoid *) (ptr_is_null != 0) ? NULL : (pc + 56); + __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); + + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); + + CALL_TexSubImage2D( GET_DISPATCH(), ( + *(GLenum *)(pc + 20), + *(GLint *)(pc + 24), + *(GLint *)(pc + 28), + *(GLint *)(pc + 32), + *(GLsizei *)(pc + 36), + *(GLsizei *)(pc + 40), + *(GLenum *)(pc + 44), + *(GLenum *)(pc + 48), + pixels + ) ); +} + +void __glXDisp_BlendColor(GLbyte * pc) +{ + CALL_BlendColor( GET_DISPATCH(), ( + *(GLclampf *)(pc + 0), + *(GLclampf *)(pc + 4), + *(GLclampf *)(pc + 8), + *(GLclampf *)(pc + 12) + ) ); +} + +void __glXDisp_BlendEquation(GLbyte * pc) +{ + CALL_BlendEquation( GET_DISPATCH(), ( + *(GLenum *)(pc + 0) + ) ); +} + +void __glXDisp_ColorTable(GLbyte * pc) +{ + const GLvoid * const table = (const GLvoid *) (pc + 40); + __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); + + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); + + CALL_ColorTable( GET_DISPATCH(), ( + *(GLenum *)(pc + 20), + *(GLenum *)(pc + 24), + *(GLsizei *)(pc + 28), + *(GLenum *)(pc + 32), + *(GLenum *)(pc + 36), + table + ) ); +} + +void __glXDisp_ColorTableParameterfv(GLbyte * pc) +{ + const GLenum pname = *(GLenum *)(pc + 4); + const GLfloat * params; + + params = (const GLfloat *) (pc + 8); + + CALL_ColorTableParameterfv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); +} + +void __glXDisp_ColorTableParameteriv(GLbyte * pc) +{ + const GLenum pname = *(GLenum *)(pc + 4); + const GLint * params; + + params = (const GLint *) (pc + 8); + + CALL_ColorTableParameteriv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); +} + +void __glXDisp_CopyColorTable(GLbyte * pc) +{ + CALL_CopyColorTable( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLsizei *)(pc + 16) + ) ); +} + +int __glXDisp_GetColorTableParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetColorTableParameterfv_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetColorTableParameterfv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetColorTableParameterfvSGI(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetColorTableParameterfv_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetColorTableParameterfv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetColorTableParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetColorTableParameteriv_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetColorTableParameteriv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetColorTableParameterivSGI(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetColorTableParameteriv_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetColorTableParameteriv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +void __glXDisp_ColorSubTable(GLbyte * pc) +{ + const GLvoid * const data = (const GLvoid *) (pc + 40); + __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); + + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); + + CALL_ColorSubTable( GET_DISPATCH(), ( + *(GLenum *)(pc + 20), + *(GLsizei *)(pc + 24), + *(GLsizei *)(pc + 28), + *(GLenum *)(pc + 32), + *(GLenum *)(pc + 36), + data + ) ); +} + +void __glXDisp_CopyColorSubTable(GLbyte * pc) +{ + CALL_CopyColorSubTable( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLsizei *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLsizei *)(pc + 16) + ) ); +} + +void __glXDisp_ConvolutionFilter1D(GLbyte * pc) +{ + const GLvoid * const image = (const GLvoid *) (pc + 44); + __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); + + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); + + CALL_ConvolutionFilter1D( GET_DISPATCH(), ( + *(GLenum *)(pc + 20), + *(GLenum *)(pc + 24), + *(GLsizei *)(pc + 28), + *(GLenum *)(pc + 36), + *(GLenum *)(pc + 40), + image + ) ); +} + +void __glXDisp_ConvolutionFilter2D(GLbyte * pc) +{ + const GLvoid * const image = (const GLvoid *) (pc + 44); + __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); + + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); + + CALL_ConvolutionFilter2D( GET_DISPATCH(), ( + *(GLenum *)(pc + 20), + *(GLenum *)(pc + 24), + *(GLsizei *)(pc + 28), + *(GLsizei *)(pc + 32), + *(GLenum *)(pc + 36), + *(GLenum *)(pc + 40), + image + ) ); +} + +void __glXDisp_ConvolutionParameterf(GLbyte * pc) +{ + CALL_ConvolutionParameterf( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLfloat *)(pc + 8) + ) ); +} + +void __glXDisp_ConvolutionParameterfv(GLbyte * pc) +{ + const GLenum pname = *(GLenum *)(pc + 4); + const GLfloat * params; + + params = (const GLfloat *) (pc + 8); + + CALL_ConvolutionParameterfv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); +} + +void __glXDisp_ConvolutionParameteri(GLbyte * pc) +{ + CALL_ConvolutionParameteri( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8) + ) ); +} + +void __glXDisp_ConvolutionParameteriv(GLbyte * pc) +{ + const GLenum pname = *(GLenum *)(pc + 4); + const GLint * params; + + params = (const GLint *) (pc + 8); + + CALL_ConvolutionParameteriv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); +} + +void __glXDisp_CopyConvolutionFilter1D(GLbyte * pc) +{ + CALL_CopyConvolutionFilter1D( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLsizei *)(pc + 16) + ) ); +} + +void __glXDisp_CopyConvolutionFilter2D(GLbyte * pc) +{ + CALL_CopyConvolutionFilter2D( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLsizei *)(pc + 16), + *(GLsizei *)(pc + 20) + ) ); +} + +int __glXDisp_GetConvolutionParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetConvolutionParameterfv_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetConvolutionParameterfv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetConvolutionParameterfvEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetConvolutionParameterfv_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetConvolutionParameterfv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetConvolutionParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetConvolutionParameteriv_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetConvolutionParameteriv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetConvolutionParameterivEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetConvolutionParameteriv_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetConvolutionParameteriv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetHistogramParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetHistogramParameterfv_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetHistogramParameterfv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetHistogramParameterfvEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetHistogramParameterfv_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetHistogramParameterfv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetHistogramParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetHistogramParameteriv_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetHistogramParameteriv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetHistogramParameterivEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetHistogramParameteriv_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetHistogramParameteriv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetMinmaxParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetMinmaxParameterfv_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetMinmaxParameterfv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetMinmaxParameterfvEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetMinmaxParameterfv_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetMinmaxParameterfv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetMinmaxParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetMinmaxParameteriv_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetMinmaxParameteriv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetMinmaxParameterivEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetMinmaxParameteriv_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetMinmaxParameteriv( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +void __glXDisp_Histogram(GLbyte * pc) +{ + CALL_Histogram( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLsizei *)(pc + 4), + *(GLenum *)(pc + 8), + *(GLboolean *)(pc + 12) + ) ); +} + +void __glXDisp_Minmax(GLbyte * pc) +{ + CALL_Minmax( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLboolean *)(pc + 8) + ) ); +} + +void __glXDisp_ResetHistogram(GLbyte * pc) +{ + CALL_ResetHistogram( GET_DISPATCH(), ( + *(GLenum *)(pc + 0) + ) ); +} + +void __glXDisp_ResetMinmax(GLbyte * pc) +{ + CALL_ResetMinmax( GET_DISPATCH(), ( + *(GLenum *)(pc + 0) + ) ); +} + +void __glXDisp_TexImage3D(GLbyte * pc) +{ + const CARD32 ptr_is_null = *(CARD32 *)(pc + 76); + const GLvoid * const pixels = (const GLvoid *) (ptr_is_null != 0) ? NULL : (pc + 80); + __GLXpixel3DHeader * const hdr = (__GLXpixel3DHeader *)(pc); + + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_IMAGE_HEIGHT, (GLint) hdr->imageHeight) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_IMAGES, (GLint) hdr->skipImages) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); + + CALL_TexImage3D( GET_DISPATCH(), ( + *(GLenum *)(pc + 36), + *(GLint *)(pc + 40), + *(GLint *)(pc + 44), + *(GLsizei *)(pc + 48), + *(GLsizei *)(pc + 52), + *(GLsizei *)(pc + 56), + *(GLint *)(pc + 64), + *(GLenum *)(pc + 68), + *(GLenum *)(pc + 72), + pixels + ) ); +} + +void __glXDisp_TexSubImage3D(GLbyte * pc) +{ + const CARD32 ptr_is_null = *(CARD32 *)(pc + 84); + const GLvoid * const pixels = (const GLvoid *) (ptr_is_null != 0) ? NULL : (pc + 88); + __GLXpixel3DHeader * const hdr = (__GLXpixel3DHeader *)(pc); + + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_IMAGE_HEIGHT, (GLint) hdr->imageHeight) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_IMAGES, (GLint) hdr->skipImages) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); + + CALL_TexSubImage3D( GET_DISPATCH(), ( + *(GLenum *)(pc + 36), + *(GLint *)(pc + 40), + *(GLint *)(pc + 44), + *(GLint *)(pc + 48), + *(GLint *)(pc + 52), + *(GLsizei *)(pc + 60), + *(GLsizei *)(pc + 64), + *(GLsizei *)(pc + 68), + *(GLenum *)(pc + 76), + *(GLenum *)(pc + 80), + pixels + ) ); +} + +void __glXDisp_CopyTexSubImage3D(GLbyte * pc) +{ + CALL_CopyTexSubImage3D( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLint *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLint *)(pc + 16), + *(GLint *)(pc + 20), + *(GLint *)(pc + 24), + *(GLsizei *)(pc + 28), + *(GLsizei *)(pc + 32) + ) ); +} + +void __glXDisp_ActiveTextureARB(GLbyte * pc) +{ + CALL_ActiveTextureARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0) + ) ); +} + +void __glXDisp_MultiTexCoord1dvARB(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 12); + pc -= 4; + } +#endif + + CALL_MultiTexCoord1dvARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 8), + (const GLdouble *)(pc + 0) + ) ); +} + +void __glXDisp_MultiTexCoord1fvARB(GLbyte * pc) +{ + CALL_MultiTexCoord1fvARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + (const GLfloat *)(pc + 4) + ) ); +} + +void __glXDisp_MultiTexCoord1ivARB(GLbyte * pc) +{ + CALL_MultiTexCoord1ivARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + (const GLint *)(pc + 4) + ) ); +} + +void __glXDisp_MultiTexCoord1svARB(GLbyte * pc) +{ + CALL_MultiTexCoord1svARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + (const GLshort *)(pc + 4) + ) ); +} + +void __glXDisp_MultiTexCoord2dvARB(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 20); + pc -= 4; + } +#endif + + CALL_MultiTexCoord2dvARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 16), + (const GLdouble *)(pc + 0) + ) ); +} + +void __glXDisp_MultiTexCoord2fvARB(GLbyte * pc) +{ + CALL_MultiTexCoord2fvARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + (const GLfloat *)(pc + 4) + ) ); +} + +void __glXDisp_MultiTexCoord2ivARB(GLbyte * pc) +{ + CALL_MultiTexCoord2ivARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + (const GLint *)(pc + 4) + ) ); +} + +void __glXDisp_MultiTexCoord2svARB(GLbyte * pc) +{ + CALL_MultiTexCoord2svARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + (const GLshort *)(pc + 4) + ) ); +} + +void __glXDisp_MultiTexCoord3dvARB(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 28); + pc -= 4; + } +#endif + + CALL_MultiTexCoord3dvARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 24), + (const GLdouble *)(pc + 0) + ) ); +} + +void __glXDisp_MultiTexCoord3fvARB(GLbyte * pc) +{ + CALL_MultiTexCoord3fvARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + (const GLfloat *)(pc + 4) + ) ); +} + +void __glXDisp_MultiTexCoord3ivARB(GLbyte * pc) +{ + CALL_MultiTexCoord3ivARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + (const GLint *)(pc + 4) + ) ); +} + +void __glXDisp_MultiTexCoord3svARB(GLbyte * pc) +{ + CALL_MultiTexCoord3svARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + (const GLshort *)(pc + 4) + ) ); +} + +void __glXDisp_MultiTexCoord4dvARB(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 36); + pc -= 4; + } +#endif + + CALL_MultiTexCoord4dvARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 32), + (const GLdouble *)(pc + 0) + ) ); +} + +void __glXDisp_MultiTexCoord4fvARB(GLbyte * pc) +{ + CALL_MultiTexCoord4fvARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + (const GLfloat *)(pc + 4) + ) ); +} + +void __glXDisp_MultiTexCoord4ivARB(GLbyte * pc) +{ + CALL_MultiTexCoord4ivARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + (const GLint *)(pc + 4) + ) ); +} + +void __glXDisp_MultiTexCoord4svARB(GLbyte * pc) +{ + CALL_MultiTexCoord4svARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + (const GLshort *)(pc + 4) + ) ); +} + +void __glXDisp_SampleCoverageARB(GLbyte * pc) +{ + CALL_SampleCoverageARB( GET_DISPATCH(), ( + *(GLclampf *)(pc + 0), + *(GLboolean *)(pc + 4) + ) ); +} + +void __glXDisp_CompressedTexImage1DARB(GLbyte * pc) +{ + const GLsizei imageSize = *(GLsizei *)(pc + 20); + + CALL_CompressedTexImage1DARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLint *)(pc + 4), + *(GLenum *)(pc + 8), + *(GLsizei *)(pc + 12), + *(GLint *)(pc + 16), + imageSize, + (const GLvoid *)(pc + 24) + ) ); +} + +void __glXDisp_CompressedTexImage2DARB(GLbyte * pc) +{ + const GLsizei imageSize = *(GLsizei *)(pc + 24); + + CALL_CompressedTexImage2DARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLint *)(pc + 4), + *(GLenum *)(pc + 8), + *(GLsizei *)(pc + 12), + *(GLsizei *)(pc + 16), + *(GLint *)(pc + 20), + imageSize, + (const GLvoid *)(pc + 28) + ) ); +} + +void __glXDisp_CompressedTexImage3DARB(GLbyte * pc) +{ + const GLsizei imageSize = *(GLsizei *)(pc + 28); + + CALL_CompressedTexImage3DARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLint *)(pc + 4), + *(GLenum *)(pc + 8), + *(GLsizei *)(pc + 12), + *(GLsizei *)(pc + 16), + *(GLsizei *)(pc + 20), + *(GLint *)(pc + 24), + imageSize, + (const GLvoid *)(pc + 32) + ) ); +} + +void __glXDisp_CompressedTexSubImage1DARB(GLbyte * pc) +{ + const GLsizei imageSize = *(GLsizei *)(pc + 20); + + CALL_CompressedTexSubImage1DARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLint *)(pc + 4), + *(GLint *)(pc + 8), + *(GLsizei *)(pc + 12), + *(GLenum *)(pc + 16), + imageSize, + (const GLvoid *)(pc + 24) + ) ); +} + +void __glXDisp_CompressedTexSubImage2DARB(GLbyte * pc) +{ + const GLsizei imageSize = *(GLsizei *)(pc + 28); + + CALL_CompressedTexSubImage2DARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLint *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLsizei *)(pc + 16), + *(GLsizei *)(pc + 20), + *(GLenum *)(pc + 24), + imageSize, + (const GLvoid *)(pc + 32) + ) ); +} + +void __glXDisp_CompressedTexSubImage3DARB(GLbyte * pc) +{ + const GLsizei imageSize = *(GLsizei *)(pc + 36); + + CALL_CompressedTexSubImage3DARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLint *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLint *)(pc + 16), + *(GLsizei *)(pc + 20), + *(GLsizei *)(pc + 24), + *(GLsizei *)(pc + 28), + *(GLenum *)(pc + 32), + imageSize, + (const GLvoid *)(pc + 40) + ) ); +} + +int __glXDisp_GetProgramEnvParameterdvARB(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + GLdouble params[4]; + CALL_GetProgramEnvParameterdvARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLuint *)(pc + 4), + params + ) ); + __glXSendReply(cl->client, params, 4, 8, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetProgramEnvParameterfvARB(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + GLfloat params[4]; + CALL_GetProgramEnvParameterfvARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLuint *)(pc + 4), + params + ) ); + __glXSendReply(cl->client, params, 4, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetProgramLocalParameterdvARB(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + GLdouble params[4]; + CALL_GetProgramLocalParameterdvARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLuint *)(pc + 4), + params + ) ); + __glXSendReply(cl->client, params, 4, 8, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetProgramLocalParameterfvARB(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + GLfloat params[4]; + CALL_GetProgramLocalParameterfvARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLuint *)(pc + 4), + params + ) ); + __glXSendReply(cl->client, params, 4, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetProgramivARB(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetProgramivARB_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetProgramivARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetVertexAttribdvARB(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetVertexAttribdvARB_size(pname); + GLdouble answerBuffer[200]; + GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetVertexAttribdvARB( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 8, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetVertexAttribfvARB(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetVertexAttribfvARB_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetVertexAttribfvARB( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetVertexAttribivARB(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetVertexAttribivARB_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetVertexAttribivARB( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +void __glXDisp_ProgramEnvParameter4dvARB(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 40); + pc -= 4; + } +#endif + + CALL_ProgramEnvParameter4dvARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLuint *)(pc + 4), + (const GLdouble *)(pc + 8) + ) ); +} + +void __glXDisp_ProgramEnvParameter4fvARB(GLbyte * pc) +{ + CALL_ProgramEnvParameter4fvARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLuint *)(pc + 4), + (const GLfloat *)(pc + 8) + ) ); +} + +void __glXDisp_ProgramLocalParameter4dvARB(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 40); + pc -= 4; + } +#endif + + CALL_ProgramLocalParameter4dvARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLuint *)(pc + 4), + (const GLdouble *)(pc + 8) + ) ); +} + +void __glXDisp_ProgramLocalParameter4fvARB(GLbyte * pc) +{ + CALL_ProgramLocalParameter4fvARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLuint *)(pc + 4), + (const GLfloat *)(pc + 8) + ) ); +} + +void __glXDisp_ProgramStringARB(GLbyte * pc) +{ + const GLsizei len = *(GLsizei *)(pc + 8); + + CALL_ProgramStringARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + len, + (const GLvoid *)(pc + 12) + ) ); +} + +void __glXDisp_VertexAttrib1dvARB(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 12); + pc -= 4; + } +#endif + + CALL_VertexAttrib1dvARB( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLdouble *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib1fvARB(GLbyte * pc) +{ + CALL_VertexAttrib1fvARB( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLfloat *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib1svARB(GLbyte * pc) +{ + CALL_VertexAttrib1svARB( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLshort *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib2dvARB(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 20); + pc -= 4; + } +#endif + + CALL_VertexAttrib2dvARB( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLdouble *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib2fvARB(GLbyte * pc) +{ + CALL_VertexAttrib2fvARB( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLfloat *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib2svARB(GLbyte * pc) +{ + CALL_VertexAttrib2svARB( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLshort *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib3dvARB(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 28); + pc -= 4; + } +#endif + + CALL_VertexAttrib3dvARB( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLdouble *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib3fvARB(GLbyte * pc) +{ + CALL_VertexAttrib3fvARB( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLfloat *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib3svARB(GLbyte * pc) +{ + CALL_VertexAttrib3svARB( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLshort *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib4NbvARB(GLbyte * pc) +{ + CALL_VertexAttrib4NbvARB( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLbyte *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib4NivARB(GLbyte * pc) +{ + CALL_VertexAttrib4NivARB( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLint *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib4NsvARB(GLbyte * pc) +{ + CALL_VertexAttrib4NsvARB( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLshort *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib4NubvARB(GLbyte * pc) +{ + CALL_VertexAttrib4NubvARB( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLubyte *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib4NuivARB(GLbyte * pc) +{ + CALL_VertexAttrib4NuivARB( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLuint *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib4NusvARB(GLbyte * pc) +{ + CALL_VertexAttrib4NusvARB( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLushort *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib4bvARB(GLbyte * pc) +{ + CALL_VertexAttrib4bvARB( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLbyte *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib4dvARB(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 36); + pc -= 4; + } +#endif + + CALL_VertexAttrib4dvARB( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLdouble *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib4fvARB(GLbyte * pc) +{ + CALL_VertexAttrib4fvARB( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLfloat *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib4ivARB(GLbyte * pc) +{ + CALL_VertexAttrib4ivARB( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLint *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib4svARB(GLbyte * pc) +{ + CALL_VertexAttrib4svARB( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLshort *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib4ubvARB(GLbyte * pc) +{ + CALL_VertexAttrib4ubvARB( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLubyte *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib4uivARB(GLbyte * pc) +{ + CALL_VertexAttrib4uivARB( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLuint *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib4usvARB(GLbyte * pc) +{ + CALL_VertexAttrib4usvARB( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLushort *)(pc + 4) + ) ); +} + +void __glXDisp_BeginQueryARB(GLbyte * pc) +{ + CALL_BeginQueryARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLuint *)(pc + 4) + ) ); +} + +int __glXDisp_DeleteQueriesARB(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLsizei n = *(GLsizei *)(pc + 0); + + CALL_DeleteQueriesARB( GET_DISPATCH(), ( + n, + (const GLuint *)(pc + 4) + ) ); + error = Success; + } + + return error; +} + +void __glXDisp_EndQueryARB(GLbyte * pc) +{ + CALL_EndQueryARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0) + ) ); +} + +int __glXDisp_GenQueriesARB(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLsizei n = *(GLsizei *)(pc + 0); + + GLuint answerBuffer[200]; + GLuint * ids = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); + CALL_GenQueriesARB( GET_DISPATCH(), ( + n, + ids + ) ); + __glXSendReply(cl->client, ids, n, 4, GL_TRUE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetQueryObjectivARB(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetQueryObjectivARB_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetQueryObjectivARB( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetQueryObjectuivARB(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetQueryObjectuivARB_size(pname); + GLuint answerBuffer[200]; + GLuint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetQueryObjectuivARB( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetQueryivARB(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetQueryivARB_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetQueryivARB( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_IsQueryARB(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + GLboolean retval; + retval = CALL_IsQueryARB( GET_DISPATCH(), ( + *(GLuint *)(pc + 0) + ) ); + __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); + error = Success; + } + + return error; +} + +void __glXDisp_DrawBuffersARB(GLbyte * pc) +{ + const GLsizei n = *(GLsizei *)(pc + 0); + + CALL_DrawBuffersARB( GET_DISPATCH(), ( + n, + (const GLenum *)(pc + 4) + ) ); +} + +void __glXDisp_SampleMaskSGIS(GLbyte * pc) +{ + CALL_SampleMaskSGIS( GET_DISPATCH(), ( + *(GLclampf *)(pc + 0), + *(GLboolean *)(pc + 4) + ) ); +} + +void __glXDisp_SamplePatternSGIS(GLbyte * pc) +{ + CALL_SamplePatternSGIS( GET_DISPATCH(), ( + *(GLenum *)(pc + 0) + ) ); +} + +void __glXDisp_PointParameterfEXT(GLbyte * pc) +{ + CALL_PointParameterfEXT( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLfloat *)(pc + 4) + ) ); +} + +void __glXDisp_PointParameterfvEXT(GLbyte * pc) +{ + const GLenum pname = *(GLenum *)(pc + 0); + const GLfloat * params; + + params = (const GLfloat *) (pc + 4); + + CALL_PointParameterfvEXT( GET_DISPATCH(), ( + pname, + params + ) ); +} + +void __glXDisp_SecondaryColor3bvEXT(GLbyte * pc) +{ + CALL_SecondaryColor3bvEXT( GET_DISPATCH(), ( + (const GLbyte *)(pc + 0) + ) ); +} + +void __glXDisp_SecondaryColor3dvEXT(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 24); + pc -= 4; + } +#endif + + CALL_SecondaryColor3dvEXT( GET_DISPATCH(), ( + (const GLdouble *)(pc + 0) + ) ); +} + +void __glXDisp_SecondaryColor3fvEXT(GLbyte * pc) +{ + CALL_SecondaryColor3fvEXT( GET_DISPATCH(), ( + (const GLfloat *)(pc + 0) + ) ); +} + +void __glXDisp_SecondaryColor3ivEXT(GLbyte * pc) +{ + CALL_SecondaryColor3ivEXT( GET_DISPATCH(), ( + (const GLint *)(pc + 0) + ) ); +} + +void __glXDisp_SecondaryColor3svEXT(GLbyte * pc) +{ + CALL_SecondaryColor3svEXT( GET_DISPATCH(), ( + (const GLshort *)(pc + 0) + ) ); +} + +void __glXDisp_SecondaryColor3ubvEXT(GLbyte * pc) +{ + CALL_SecondaryColor3ubvEXT( GET_DISPATCH(), ( + (const GLubyte *)(pc + 0) + ) ); +} + +void __glXDisp_SecondaryColor3uivEXT(GLbyte * pc) +{ + CALL_SecondaryColor3uivEXT( GET_DISPATCH(), ( + (const GLuint *)(pc + 0) + ) ); +} + +void __glXDisp_SecondaryColor3usvEXT(GLbyte * pc) +{ + CALL_SecondaryColor3usvEXT( GET_DISPATCH(), ( + (const GLushort *)(pc + 0) + ) ); +} + +void __glXDisp_FogCoorddvEXT(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 8); + pc -= 4; + } +#endif + + CALL_FogCoorddvEXT( GET_DISPATCH(), ( + (const GLdouble *)(pc + 0) + ) ); +} + +void __glXDisp_FogCoordfvEXT(GLbyte * pc) +{ + CALL_FogCoordfvEXT( GET_DISPATCH(), ( + (const GLfloat *)(pc + 0) + ) ); +} + +void __glXDisp_BlendFuncSeparateEXT(GLbyte * pc) +{ + CALL_BlendFuncSeparateEXT( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLenum *)(pc + 8), + *(GLenum *)(pc + 12) + ) ); +} + +void __glXDisp_WindowPos3fvMESA(GLbyte * pc) +{ + CALL_WindowPos3fvMESA( GET_DISPATCH(), ( + (const GLfloat *)(pc + 0) + ) ); +} + +int __glXDisp_AreProgramsResidentNV(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLsizei n = *(GLsizei *)(pc + 0); + + GLboolean retval; + GLboolean answerBuffer[200]; + GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1); + retval = CALL_AreProgramsResidentNV( GET_DISPATCH(), ( + n, + (const GLuint *)(pc + 4), + residences + ) ); + __glXSendReply(cl->client, residences, n, 1, GL_FALSE, retval); + error = Success; + } + + return error; +} + +void __glXDisp_BindProgramNV(GLbyte * pc) +{ + CALL_BindProgramNV( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLuint *)(pc + 4) + ) ); +} + +int __glXDisp_DeleteProgramsNV(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLsizei n = *(GLsizei *)(pc + 0); + + CALL_DeleteProgramsNV( GET_DISPATCH(), ( + n, + (const GLuint *)(pc + 4) + ) ); + error = Success; + } + + return error; +} + +void __glXDisp_ExecuteProgramNV(GLbyte * pc) +{ + CALL_ExecuteProgramNV( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLuint *)(pc + 4), + (const GLfloat *)(pc + 8) + ) ); +} + +int __glXDisp_GenProgramsNV(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLsizei n = *(GLsizei *)(pc + 0); + + GLuint answerBuffer[200]; + GLuint * programs = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); + CALL_GenProgramsNV( GET_DISPATCH(), ( + n, + programs + ) ); + __glXSendReply(cl->client, programs, n, 4, GL_TRUE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetProgramParameterdvNV(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + GLdouble params[4]; + CALL_GetProgramParameterdvNV( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLuint *)(pc + 4), + *(GLenum *)(pc + 8), + params + ) ); + __glXSendReply(cl->client, params, 4, 8, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetProgramParameterfvNV(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + GLfloat params[4]; + CALL_GetProgramParameterfvNV( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLuint *)(pc + 4), + *(GLenum *)(pc + 8), + params + ) ); + __glXSendReply(cl->client, params, 4, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetProgramivNV(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetProgramivNV_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetProgramivNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetTrackMatrixivNV(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + GLint params[1]; + CALL_GetTrackMatrixivNV( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLuint *)(pc + 4), + *(GLenum *)(pc + 8), + params + ) ); + __glXSendReply(cl->client, params, 1, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetVertexAttribdvNV(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetVertexAttribdvNV_size(pname); + GLdouble answerBuffer[200]; + GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetVertexAttribdvNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 8, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetVertexAttribfvNV(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetVertexAttribfvNV_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetVertexAttribfvNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetVertexAttribivNV(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = *(GLenum *)(pc + 4); + + const GLuint compsize = __glGetVertexAttribivNV_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetVertexAttribivNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + pname, + params + ) ); + __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_IsProgramNV(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + GLboolean retval; + retval = CALL_IsProgramNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0) + ) ); + __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); + error = Success; + } + + return error; +} + +void __glXDisp_LoadProgramNV(GLbyte * pc) +{ + const GLsizei len = *(GLsizei *)(pc + 8); + + CALL_LoadProgramNV( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLuint *)(pc + 4), + len, + (const GLubyte *)(pc + 12) + ) ); +} + +void __glXDisp_ProgramParameter4dvNV(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 40); + pc -= 4; + } +#endif + + CALL_ProgramParameter4dvNV( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLuint *)(pc + 4), + (const GLdouble *)(pc + 8) + ) ); +} + +void __glXDisp_ProgramParameter4fvNV(GLbyte * pc) +{ + CALL_ProgramParameter4fvNV( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLuint *)(pc + 4), + (const GLfloat *)(pc + 8) + ) ); +} + +void __glXDisp_ProgramParameters4dvNV(GLbyte * pc) +{ + const GLuint num = *(GLuint *)(pc + 8); + +#ifdef __GLX_ALIGN64 + const GLuint cmdlen = 16 + __GLX_PAD((num * 32)) - 4; + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, cmdlen); + pc -= 4; + } +#endif + + CALL_ProgramParameters4dvNV( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLuint *)(pc + 4), + num, + (const GLdouble *)(pc + 12) + ) ); +} + +void __glXDisp_ProgramParameters4fvNV(GLbyte * pc) +{ + const GLuint num = *(GLuint *)(pc + 8); + + CALL_ProgramParameters4fvNV( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLuint *)(pc + 4), + num, + (const GLfloat *)(pc + 12) + ) ); +} + +void __glXDisp_RequestResidentProgramsNV(GLbyte * pc) +{ + const GLsizei n = *(GLsizei *)(pc + 0); + + CALL_RequestResidentProgramsNV( GET_DISPATCH(), ( + n, + (const GLuint *)(pc + 4) + ) ); +} + +void __glXDisp_TrackMatrixNV(GLbyte * pc) +{ + CALL_TrackMatrixNV( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLuint *)(pc + 4), + *(GLenum *)(pc + 8), + *(GLenum *)(pc + 12) + ) ); +} + +void __glXDisp_VertexAttrib1dvNV(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 12); + pc -= 4; + } +#endif + + CALL_VertexAttrib1dvNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLdouble *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib1fvNV(GLbyte * pc) +{ + CALL_VertexAttrib1fvNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLfloat *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib1svNV(GLbyte * pc) +{ + CALL_VertexAttrib1svNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLshort *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib2dvNV(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 20); + pc -= 4; + } +#endif + + CALL_VertexAttrib2dvNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLdouble *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib2fvNV(GLbyte * pc) +{ + CALL_VertexAttrib2fvNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLfloat *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib2svNV(GLbyte * pc) +{ + CALL_VertexAttrib2svNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLshort *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib3dvNV(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 28); + pc -= 4; + } +#endif + + CALL_VertexAttrib3dvNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLdouble *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib3fvNV(GLbyte * pc) +{ + CALL_VertexAttrib3fvNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLfloat *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib3svNV(GLbyte * pc) +{ + CALL_VertexAttrib3svNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLshort *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib4dvNV(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 36); + pc -= 4; + } +#endif + + CALL_VertexAttrib4dvNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLdouble *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib4fvNV(GLbyte * pc) +{ + CALL_VertexAttrib4fvNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLfloat *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib4svNV(GLbyte * pc) +{ + CALL_VertexAttrib4svNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLshort *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttrib4ubvNV(GLbyte * pc) +{ + CALL_VertexAttrib4ubvNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + (const GLubyte *)(pc + 4) + ) ); +} + +void __glXDisp_VertexAttribs1dvNV(GLbyte * pc) +{ + const GLsizei n = *(GLsizei *)(pc + 4); + +#ifdef __GLX_ALIGN64 + const GLuint cmdlen = 12 + __GLX_PAD((n * 8)) - 4; + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, cmdlen); + pc -= 4; + } +#endif + + CALL_VertexAttribs1dvNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + n, + (const GLdouble *)(pc + 8) + ) ); +} + +void __glXDisp_VertexAttribs1fvNV(GLbyte * pc) +{ + const GLsizei n = *(GLsizei *)(pc + 4); + + CALL_VertexAttribs1fvNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + n, + (const GLfloat *)(pc + 8) + ) ); +} + +void __glXDisp_VertexAttribs1svNV(GLbyte * pc) +{ + const GLsizei n = *(GLsizei *)(pc + 4); + + CALL_VertexAttribs1svNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + n, + (const GLshort *)(pc + 8) + ) ); +} + +void __glXDisp_VertexAttribs2dvNV(GLbyte * pc) +{ + const GLsizei n = *(GLsizei *)(pc + 4); + +#ifdef __GLX_ALIGN64 + const GLuint cmdlen = 12 + __GLX_PAD((n * 16)) - 4; + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, cmdlen); + pc -= 4; + } +#endif + + CALL_VertexAttribs2dvNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + n, + (const GLdouble *)(pc + 8) + ) ); +} + +void __glXDisp_VertexAttribs2fvNV(GLbyte * pc) +{ + const GLsizei n = *(GLsizei *)(pc + 4); + + CALL_VertexAttribs2fvNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + n, + (const GLfloat *)(pc + 8) + ) ); +} + +void __glXDisp_VertexAttribs2svNV(GLbyte * pc) +{ + const GLsizei n = *(GLsizei *)(pc + 4); + + CALL_VertexAttribs2svNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + n, + (const GLshort *)(pc + 8) + ) ); +} + +void __glXDisp_VertexAttribs3dvNV(GLbyte * pc) +{ + const GLsizei n = *(GLsizei *)(pc + 4); + +#ifdef __GLX_ALIGN64 + const GLuint cmdlen = 12 + __GLX_PAD((n * 24)) - 4; + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, cmdlen); + pc -= 4; + } +#endif + + CALL_VertexAttribs3dvNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + n, + (const GLdouble *)(pc + 8) + ) ); +} + +void __glXDisp_VertexAttribs3fvNV(GLbyte * pc) +{ + const GLsizei n = *(GLsizei *)(pc + 4); + + CALL_VertexAttribs3fvNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + n, + (const GLfloat *)(pc + 8) + ) ); +} + +void __glXDisp_VertexAttribs3svNV(GLbyte * pc) +{ + const GLsizei n = *(GLsizei *)(pc + 4); + + CALL_VertexAttribs3svNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + n, + (const GLshort *)(pc + 8) + ) ); +} + +void __glXDisp_VertexAttribs4dvNV(GLbyte * pc) +{ + const GLsizei n = *(GLsizei *)(pc + 4); + +#ifdef __GLX_ALIGN64 + const GLuint cmdlen = 12 + __GLX_PAD((n * 32)) - 4; + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, cmdlen); + pc -= 4; + } +#endif + + CALL_VertexAttribs4dvNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + n, + (const GLdouble *)(pc + 8) + ) ); +} + +void __glXDisp_VertexAttribs4fvNV(GLbyte * pc) +{ + const GLsizei n = *(GLsizei *)(pc + 4); + + CALL_VertexAttribs4fvNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + n, + (const GLfloat *)(pc + 8) + ) ); +} + +void __glXDisp_VertexAttribs4svNV(GLbyte * pc) +{ + const GLsizei n = *(GLsizei *)(pc + 4); + + CALL_VertexAttribs4svNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + n, + (const GLshort *)(pc + 8) + ) ); +} + +void __glXDisp_VertexAttribs4ubvNV(GLbyte * pc) +{ + const GLsizei n = *(GLsizei *)(pc + 4); + + CALL_VertexAttribs4ubvNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + n, + (const GLubyte *)(pc + 8) + ) ); +} + +void __glXDisp_PointParameteriNV(GLbyte * pc) +{ + CALL_PointParameteriNV( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLint *)(pc + 4) + ) ); +} + +void __glXDisp_PointParameterivNV(GLbyte * pc) +{ + const GLenum pname = *(GLenum *)(pc + 0); + const GLint * params; + + params = (const GLint *) (pc + 4); + + CALL_PointParameterivNV( GET_DISPATCH(), ( + pname, + params + ) ); +} + +void __glXDisp_ActiveStencilFaceEXT(GLbyte * pc) +{ + CALL_ActiveStencilFaceEXT( GET_DISPATCH(), ( + *(GLenum *)(pc + 0) + ) ); +} + +int __glXDisp_GetProgramNamedParameterdvNV(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLsizei len = *(GLsizei *)(pc + 4); + + GLdouble params[4]; + CALL_GetProgramNamedParameterdvNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + len, + (const GLubyte *)(pc + 8), + params + ) ); + __glXSendReply(cl->client, params, 4, 8, GL_TRUE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetProgramNamedParameterfvNV(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLsizei len = *(GLsizei *)(pc + 4); + + GLfloat params[4]; + CALL_GetProgramNamedParameterfvNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + len, + (const GLubyte *)(pc + 8), + params + ) ); + __glXSendReply(cl->client, params, 4, 4, GL_TRUE, 0); + error = Success; + } + + return error; +} + +void __glXDisp_ProgramNamedParameter4dvNV(GLbyte * pc) +{ + const GLsizei len = *(GLsizei *)(pc + 36); + +#ifdef __GLX_ALIGN64 + const GLuint cmdlen = 44 + __GLX_PAD(len) - 4; + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, cmdlen); + pc -= 4; + } +#endif + + CALL_ProgramNamedParameter4dvNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 32), + len, + (const GLubyte *)(pc + 40), + (const GLdouble *)(pc + 0) + ) ); +} + +void __glXDisp_ProgramNamedParameter4fvNV(GLbyte * pc) +{ + const GLsizei len = *(GLsizei *)(pc + 4); + + CALL_ProgramNamedParameter4fvNV( GET_DISPATCH(), ( + *(GLuint *)(pc + 0), + len, + (const GLubyte *)(pc + 24), + (const GLfloat *)(pc + 8) + ) ); +} + +void __glXDisp_BlendEquationSeparateEXT(GLbyte * pc) +{ + CALL_BlendEquationSeparateEXT( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4) + ) ); +} + +void __glXDisp_BindFramebufferEXT(GLbyte * pc) +{ + CALL_BindFramebufferEXT( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLuint *)(pc + 4) + ) ); +} + +void __glXDisp_BindRenderbufferEXT(GLbyte * pc) +{ + CALL_BindRenderbufferEXT( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLuint *)(pc + 4) + ) ); +} + +int __glXDisp_CheckFramebufferStatusEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + GLenum retval; + retval = CALL_CheckFramebufferStatusEXT( GET_DISPATCH(), ( + *(GLenum *)(pc + 0) + ) ); + __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); + error = Success; + } + + return error; +} + +void __glXDisp_DeleteFramebuffersEXT(GLbyte * pc) +{ + const GLsizei n = *(GLsizei *)(pc + 0); + + CALL_DeleteFramebuffersEXT( GET_DISPATCH(), ( + n, + (const GLuint *)(pc + 4) + ) ); +} + +void __glXDisp_DeleteRenderbuffersEXT(GLbyte * pc) +{ + const GLsizei n = *(GLsizei *)(pc + 0); + + CALL_DeleteRenderbuffersEXT( GET_DISPATCH(), ( + n, + (const GLuint *)(pc + 4) + ) ); +} + +void __glXDisp_FramebufferRenderbufferEXT(GLbyte * pc) +{ + CALL_FramebufferRenderbufferEXT( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLenum *)(pc + 8), + *(GLuint *)(pc + 12) + ) ); +} + +void __glXDisp_FramebufferTexture1DEXT(GLbyte * pc) +{ + CALL_FramebufferTexture1DEXT( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLenum *)(pc + 8), + *(GLuint *)(pc + 12), + *(GLint *)(pc + 16) + ) ); +} + +void __glXDisp_FramebufferTexture2DEXT(GLbyte * pc) +{ + CALL_FramebufferTexture2DEXT( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLenum *)(pc + 8), + *(GLuint *)(pc + 12), + *(GLint *)(pc + 16) + ) ); +} + +void __glXDisp_FramebufferTexture3DEXT(GLbyte * pc) +{ + CALL_FramebufferTexture3DEXT( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLenum *)(pc + 8), + *(GLuint *)(pc + 12), + *(GLint *)(pc + 16), + *(GLint *)(pc + 20) + ) ); +} + +int __glXDisp_GenFramebuffersEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLsizei n = *(GLsizei *)(pc + 0); + + GLuint answerBuffer[200]; + GLuint * framebuffers = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); + CALL_GenFramebuffersEXT( GET_DISPATCH(), ( + n, + framebuffers + ) ); + __glXSendReply(cl->client, framebuffers, n, 4, GL_TRUE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GenRenderbuffersEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLsizei n = *(GLsizei *)(pc + 0); + + GLuint answerBuffer[200]; + GLuint * renderbuffers = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); + CALL_GenRenderbuffersEXT( GET_DISPATCH(), ( + n, + renderbuffers + ) ); + __glXSendReply(cl->client, renderbuffers, n, 4, GL_TRUE, 0); + error = Success; + } + + return error; +} + +void __glXDisp_GenerateMipmapEXT(GLbyte * pc) +{ + CALL_GenerateMipmapEXT( GET_DISPATCH(), ( + *(GLenum *)(pc + 0) + ) ); +} + +int __glXDisp_GetFramebufferAttachmentParameterivEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + GLint params[1]; + CALL_GetFramebufferAttachmentParameterivEXT( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLenum *)(pc + 8), + params + ) ); + __glXSendReply(cl->client, params, 1, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_GetRenderbufferParameterivEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + GLint params[1]; + CALL_GetRenderbufferParameterivEXT( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + params + ) ); + __glXSendReply(cl->client, params, 1, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDisp_IsFramebufferEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + GLboolean retval; + retval = CALL_IsFramebufferEXT( GET_DISPATCH(), ( + *(GLuint *)(pc + 0) + ) ); + __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); + error = Success; + } + + return error; +} + +int __glXDisp_IsRenderbufferEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + GLboolean retval; + retval = CALL_IsRenderbufferEXT( GET_DISPATCH(), ( + *(GLuint *)(pc + 0) + ) ); + __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); + error = Success; + } + + return error; +} + +void __glXDisp_RenderbufferStorageEXT(GLbyte * pc) +{ + CALL_RenderbufferStorageEXT( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLsizei *)(pc + 8), + *(GLsizei *)(pc + 12) + ) ); +} + diff --git a/dist/Mesa/src/glx/x11/indirect_dispatch.h b/dist/Mesa/src/glx/x11/indirect_dispatch.h new file mode 100644 index 000000000..17a372f91 --- /dev/null +++ b/dist/Mesa/src/glx/x11/indirect_dispatch.h @@ -0,0 +1,1043 @@ +/* DO NOT EDIT - This file generated automatically by glX_proto_recv.py (from Mesa) script */ + +/* + * (C) Copyright IBM Corporation 2005 + * 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 + * IBM, + * 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. + */ + +#if !defined( _INDIRECT_DISPATCH_H_ ) +# define _INDIRECT_DISPATCH_H_ + +# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) +# define HIDDEN __attribute__((visibility("hidden"))) +# else +# define HIDDEN +# endif +struct __GLXclientStateRec; + +extern HIDDEN void __glXDisp_MapGrid1d(GLbyte * pc); +extern HIDDEN void __glXDispSwap_MapGrid1d(GLbyte * pc); +extern HIDDEN void __glXDisp_MapGrid1f(GLbyte * pc); +extern HIDDEN void __glXDispSwap_MapGrid1f(GLbyte * pc); +extern HIDDEN int __glXDisp_NewList(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_NewList(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_LoadIdentity(GLbyte * pc); +extern HIDDEN void __glXDispSwap_LoadIdentity(GLbyte * pc); +extern HIDDEN void __glXDisp_SampleCoverageARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_SampleCoverageARB(GLbyte * pc); +extern HIDDEN void __glXDisp_ConvolutionFilter1D(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ConvolutionFilter1D(GLbyte * pc); +extern HIDDEN void __glXDisp_BeginQueryARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_BeginQueryARB(GLbyte * pc); +extern HIDDEN void __glXDisp_RasterPos3dv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_RasterPos3dv(GLbyte * pc); +extern HIDDEN void __glXDisp_PointParameteriNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_PointParameteriNV(GLbyte * pc); +extern HIDDEN void __glXDisp_TexCoord1iv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexCoord1iv(GLbyte * pc); +extern HIDDEN void __glXDisp_TexCoord4sv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexCoord4sv(GLbyte * pc); +extern HIDDEN void __glXDisp_ActiveTextureARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ActiveTextureARB(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttrib4ubvNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib4ubvNV(GLbyte * pc); +extern HIDDEN int __glXDisp_GetProgramNamedParameterdvNV(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetProgramNamedParameterdvNV(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_Histogram(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Histogram(GLbyte * pc); +extern HIDDEN int __glXDisp_GetMapfv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetMapfv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_RasterPos4dv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_RasterPos4dv(GLbyte * pc); +extern HIDDEN void __glXDisp_PolygonStipple(GLbyte * pc); +extern HIDDEN void __glXDispSwap_PolygonStipple(GLbyte * pc); +extern HIDDEN void __glXDisp_BlendEquationSeparateEXT(GLbyte * pc); +extern HIDDEN void __glXDispSwap_BlendEquationSeparateEXT(GLbyte * pc); +extern HIDDEN int __glXDisp_GetPixelMapfv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetPixelMapfv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_Color3uiv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Color3uiv(GLbyte * pc); +extern HIDDEN int __glXDisp_IsEnabled(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_IsEnabled(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_VertexAttrib4svNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib4svNV(GLbyte * pc); +extern HIDDEN void __glXDisp_EvalCoord2fv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_EvalCoord2fv(GLbyte * pc); +extern HIDDEN int __glXDisp_DestroyPixmap(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_DestroyPixmap(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetMapiv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetMapiv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_SwapBuffers(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_SwapBuffers(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_Indexubv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Indexubv(GLbyte * pc); +extern HIDDEN int __glXDisp_Render(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_Render(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetQueryivARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetQueryivARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_TexImage3D(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexImage3D(GLbyte * pc); +extern HIDDEN int __glXDisp_MakeContextCurrent(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_MakeContextCurrent(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetFBConfigs(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetFBConfigs(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_Color3ubv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Color3ubv(GLbyte * pc); +extern HIDDEN int __glXDisp_GetQueryObjectivARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetQueryObjectivARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_Vertex3dv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Vertex3dv(GLbyte * pc); +extern HIDDEN void __glXDisp_CompressedTexSubImage2DARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_CompressedTexSubImage2DARB(GLbyte * pc); +extern HIDDEN void __glXDisp_LightModeliv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_LightModeliv(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttrib1svARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib1svARB(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttribs1dvNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttribs1dvNV(GLbyte * pc); +extern HIDDEN void __glXDisp_Normal3bv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Normal3bv(GLbyte * pc); +extern HIDDEN int __glXDisp_VendorPrivate(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_VendorPrivate(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_CreateGLXPixmapWithConfigSGIX(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_CreateGLXPixmapWithConfigSGIX(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_VertexAttrib1fvNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib1fvNV(GLbyte * pc); +extern HIDDEN void __glXDisp_Vertex3iv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Vertex3iv(GLbyte * pc); +extern HIDDEN void __glXDisp_CopyConvolutionFilter1D(GLbyte * pc); +extern HIDDEN void __glXDispSwap_CopyConvolutionFilter1D(GLbyte * pc); +extern HIDDEN void __glXDisp_BlendColor(GLbyte * pc); +extern HIDDEN void __glXDispSwap_BlendColor(GLbyte * pc); +extern HIDDEN void __glXDisp_Scalef(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Scalef(GLbyte * pc); +extern HIDDEN void __glXDisp_Normal3iv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Normal3iv(GLbyte * pc); +extern HIDDEN void __glXDisp_PassThrough(GLbyte * pc); +extern HIDDEN void __glXDispSwap_PassThrough(GLbyte * pc); +extern HIDDEN void __glXDisp_Viewport(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Viewport(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttrib4NusvARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib4NusvARB(GLbyte * pc); +extern HIDDEN void __glXDisp_CopyTexSubImage2D(GLbyte * pc); +extern HIDDEN void __glXDispSwap_CopyTexSubImage2D(GLbyte * pc); +extern HIDDEN void __glXDisp_DepthRange(GLbyte * pc); +extern HIDDEN void __glXDispSwap_DepthRange(GLbyte * pc); +extern HIDDEN void __glXDisp_ResetHistogram(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ResetHistogram(GLbyte * pc); +extern HIDDEN int __glXDisp_GetProgramNamedParameterfvNV(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetProgramNamedParameterfvNV(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_PointParameterfEXT(GLbyte * pc); +extern HIDDEN void __glXDispSwap_PointParameterfEXT(GLbyte * pc); +extern HIDDEN void __glXDisp_ProgramParameter4dvNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ProgramParameter4dvNV(GLbyte * pc); +extern HIDDEN void __glXDisp_TexCoord2sv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexCoord2sv(GLbyte * pc); +extern HIDDEN void __glXDisp_Vertex4dv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Vertex4dv(GLbyte * pc); +extern HIDDEN void __glXDisp_CompressedTexImage3DARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_CompressedTexImage3DARB(GLbyte * pc); +extern HIDDEN void __glXDisp_Color3sv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Color3sv(GLbyte * pc); +extern HIDDEN int __glXDisp_GetConvolutionParameteriv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetConvolutionParameteriv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetConvolutionParameterivEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetConvolutionParameterivEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_Vertex2dv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Vertex2dv(GLbyte * pc); +extern HIDDEN int __glXDisp_GetVisualConfigs(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetVisualConfigs(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_MultiTexCoord1fvARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_MultiTexCoord1fvARB(GLbyte * pc); +extern HIDDEN void __glXDisp_TexCoord3iv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexCoord3iv(GLbyte * pc); +extern HIDDEN int __glXDisp_CopyContext(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_CopyContext(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_Color3fv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Color3fv(GLbyte * pc); +extern HIDDEN void __glXDisp_PointSize(GLbyte * pc); +extern HIDDEN void __glXDispSwap_PointSize(GLbyte * pc); +extern HIDDEN void __glXDisp_PopName(GLbyte * pc); +extern HIDDEN void __glXDispSwap_PopName(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttrib4NbvARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib4NbvARB(GLbyte * pc); +extern HIDDEN void __glXDisp_Vertex4sv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Vertex4sv(GLbyte * pc); +extern HIDDEN int __glXDisp_GetTexEnvfv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetTexEnvfv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_LineStipple(GLbyte * pc); +extern HIDDEN void __glXDispSwap_LineStipple(GLbyte * pc); +extern HIDDEN void __glXDisp_TexEnvi(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexEnvi(GLbyte * pc); +extern HIDDEN int __glXDisp_GetClipPlane(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetClipPlane(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_VertexAttribs3dvNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttribs3dvNV(GLbyte * pc); +extern HIDDEN void __glXDisp_LightModeli(GLbyte * pc); +extern HIDDEN void __glXDispSwap_LightModeli(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttribs4fvNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttribs4fvNV(GLbyte * pc); +extern HIDDEN void __glXDisp_Scaled(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Scaled(GLbyte * pc); +extern HIDDEN void __glXDisp_CallLists(GLbyte * pc); +extern HIDDEN void __glXDispSwap_CallLists(GLbyte * pc); +extern HIDDEN void __glXDisp_AlphaFunc(GLbyte * pc); +extern HIDDEN void __glXDispSwap_AlphaFunc(GLbyte * pc); +extern HIDDEN void __glXDisp_TexCoord2iv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexCoord2iv(GLbyte * pc); +extern HIDDEN void __glXDisp_CompressedTexImage1DARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_CompressedTexImage1DARB(GLbyte * pc); +extern HIDDEN int __glXDisp_ReadPixels(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_ReadPixels(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_EdgeFlagv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_EdgeFlagv(GLbyte * pc); +extern HIDDEN void __glXDisp_Rotatef(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Rotatef(GLbyte * pc); +extern HIDDEN void __glXDisp_TexParameterf(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexParameterf(GLbyte * pc); +extern HIDDEN void __glXDisp_TexParameteri(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexParameteri(GLbyte * pc); +extern HIDDEN int __glXDisp_DestroyContext(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_DestroyContext(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_DrawPixels(GLbyte * pc); +extern HIDDEN void __glXDispSwap_DrawPixels(GLbyte * pc); +extern HIDDEN void __glXDisp_MultiTexCoord2svARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_MultiTexCoord2svARB(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttribs3fvNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttribs3fvNV(GLbyte * pc); +extern HIDDEN void __glXDisp_GenerateMipmapEXT(GLbyte * pc); +extern HIDDEN void __glXDispSwap_GenerateMipmapEXT(GLbyte * pc); +extern HIDDEN int __glXDisp_GenLists(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GenLists(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_MapGrid2d(GLbyte * pc); +extern HIDDEN void __glXDispSwap_MapGrid2d(GLbyte * pc); +extern HIDDEN void __glXDisp_MapGrid2f(GLbyte * pc); +extern HIDDEN void __glXDispSwap_MapGrid2f(GLbyte * pc); +extern HIDDEN void __glXDisp_Scissor(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Scissor(GLbyte * pc); +extern HIDDEN void __glXDisp_Fogf(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Fogf(GLbyte * pc); +extern HIDDEN void __glXDisp_TexSubImage1D(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexSubImage1D(GLbyte * pc); +extern HIDDEN void __glXDisp_Color4usv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Color4usv(GLbyte * pc); +extern HIDDEN void __glXDisp_Fogi(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Fogi(GLbyte * pc); +extern HIDDEN void __glXDisp_RasterPos3iv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_RasterPos3iv(GLbyte * pc); +extern HIDDEN void __glXDisp_PixelMapfv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_PixelMapfv(GLbyte * pc); +extern HIDDEN void __glXDisp_Color3usv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Color3usv(GLbyte * pc); +extern HIDDEN int __glXDisp_AreTexturesResident(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_AreTexturesResident(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_AreTexturesResidentEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_AreTexturesResidentEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_IsRenderbufferEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_IsRenderbufferEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_PointParameterfvEXT(GLbyte * pc); +extern HIDDEN void __glXDispSwap_PointParameterfvEXT(GLbyte * pc); +extern HIDDEN void __glXDisp_Color3bv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Color3bv(GLbyte * pc); +extern HIDDEN void __glXDisp_SecondaryColor3bvEXT(GLbyte * pc); +extern HIDDEN void __glXDispSwap_SecondaryColor3bvEXT(GLbyte * pc); +extern HIDDEN int __glXDisp_GetProgramLocalParameterfvARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetProgramLocalParameterfvARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_RenderbufferStorageEXT(GLbyte * pc); +extern HIDDEN void __glXDispSwap_RenderbufferStorageEXT(GLbyte * pc); +extern HIDDEN void __glXDisp_ColorTable(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ColorTable(GLbyte * pc); +extern HIDDEN void __glXDisp_Accum(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Accum(GLbyte * pc); +extern HIDDEN int __glXDisp_GetTexImage(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetTexImage(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_ConvolutionFilter2D(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ConvolutionFilter2D(GLbyte * pc); +extern HIDDEN int __glXDisp_Finish(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_Finish(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_ClearStencil(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ClearStencil(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttrib3dvARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib3dvARB(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttribs4ubvNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttribs4ubvNV(GLbyte * pc); +extern HIDDEN void __glXDisp_ConvolutionParameteriv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ConvolutionParameteriv(GLbyte * pc); +extern HIDDEN void __glXDisp_RasterPos2fv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_RasterPos2fv(GLbyte * pc); +extern HIDDEN void __glXDisp_TexCoord1fv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexCoord1fv(GLbyte * pc); +extern HIDDEN void __glXDisp_ProgramEnvParameter4fvARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ProgramEnvParameter4fvARB(GLbyte * pc); +extern HIDDEN void __glXDisp_RasterPos4fv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_RasterPos4fv(GLbyte * pc); +extern HIDDEN void __glXDisp_ClearIndex(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ClearIndex(GLbyte * pc); +extern HIDDEN void __glXDisp_LoadMatrixd(GLbyte * pc); +extern HIDDEN void __glXDispSwap_LoadMatrixd(GLbyte * pc); +extern HIDDEN void __glXDisp_RasterPos2dv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_RasterPos2dv(GLbyte * pc); +extern HIDDEN void __glXDisp_ConvolutionParameterfv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ConvolutionParameterfv(GLbyte * pc); +extern HIDDEN int __glXDisp_GetTexGendv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetTexGendv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_LoadProgramNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_LoadProgramNV(GLbyte * pc); +extern HIDDEN int __glXDisp_EndList(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_EndList(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_VertexAttrib4fvNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib4fvNV(GLbyte * pc); +extern HIDDEN void __glXDisp_EvalCoord1fv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_EvalCoord1fv(GLbyte * pc); +extern HIDDEN void __glXDisp_EvalMesh2(GLbyte * pc); +extern HIDDEN void __glXDispSwap_EvalMesh2(GLbyte * pc); +extern HIDDEN void __glXDisp_Vertex4fv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Vertex4fv(GLbyte * pc); +extern HIDDEN int __glXDisp_CheckFramebufferStatusEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_CheckFramebufferStatusEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetVertexAttribivARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetVertexAttribivARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetFBConfigsSGIX(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetFBConfigsSGIX(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_CreateNewContext(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_CreateNewContext(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetMinmax(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetMinmax(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetMinmaxEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetMinmaxEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetVertexAttribdvNV(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetVertexAttribdvNV(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_Normal3fv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Normal3fv(GLbyte * pc); +extern HIDDEN void __glXDisp_ProgramEnvParameter4dvARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ProgramEnvParameter4dvARB(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttrib4ivARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib4ivARB(GLbyte * pc); +extern HIDDEN void __glXDisp_End(GLbyte * pc); +extern HIDDEN void __glXDispSwap_End(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttribs2dvNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttribs2dvNV(GLbyte * pc); +extern HIDDEN void __glXDisp_MultiTexCoord3fvARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_MultiTexCoord3fvARB(GLbyte * pc); +extern HIDDEN int __glXDisp_GetProgramParameterfvNV(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetProgramParameterfvNV(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_BindTexture(GLbyte * pc); +extern HIDDEN void __glXDispSwap_BindTexture(GLbyte * pc); +extern HIDDEN void __glXDisp_TexSubImage2D(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexSubImage2D(GLbyte * pc); +extern HIDDEN void __glXDisp_DeleteRenderbuffersEXT(GLbyte * pc); +extern HIDDEN void __glXDispSwap_DeleteRenderbuffersEXT(GLbyte * pc); +extern HIDDEN void __glXDisp_TexGenfv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexGenfv(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttrib4bvARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib4bvARB(GLbyte * pc); +extern HIDDEN int __glXDisp_CreateContextWithConfigSGIX(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_CreateContextWithConfigSGIX(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_FramebufferTexture3DEXT(GLbyte * pc); +extern HIDDEN void __glXDispSwap_FramebufferTexture3DEXT(GLbyte * pc); +extern HIDDEN int __glXDisp_CopySubBufferMESA(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_CopySubBufferMESA(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_BlendEquation(GLbyte * pc); +extern HIDDEN void __glXDispSwap_BlendEquation(GLbyte * pc); +extern HIDDEN int __glXDisp_GetError(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetError(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_TexCoord3dv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexCoord3dv(GLbyte * pc); +extern HIDDEN void __glXDisp_Indexdv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Indexdv(GLbyte * pc); +extern HIDDEN void __glXDisp_PushName(GLbyte * pc); +extern HIDDEN void __glXDispSwap_PushName(GLbyte * pc); +extern HIDDEN void __glXDisp_MultiTexCoord2dvARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_MultiTexCoord2dvARB(GLbyte * pc); +extern HIDDEN void __glXDisp_ProgramNamedParameter4fvNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ProgramNamedParameter4fvNV(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttrib4fvARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib4fvARB(GLbyte * pc); +extern HIDDEN void __glXDisp_MultiTexCoord1svARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_MultiTexCoord1svARB(GLbyte * pc); +extern HIDDEN void __glXDisp_EndQueryARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_EndQueryARB(GLbyte * pc); +extern HIDDEN void __glXDisp_DepthMask(GLbyte * pc); +extern HIDDEN void __glXDispSwap_DepthMask(GLbyte * pc); +extern HIDDEN void __glXDisp_Rotated(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Rotated(GLbyte * pc); +extern HIDDEN int __glXDisp_GetMaterialiv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetMaterialiv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_StencilOp(GLbyte * pc); +extern HIDDEN void __glXDispSwap_StencilOp(GLbyte * pc); +extern HIDDEN void __glXDisp_MultiTexCoord3svARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_MultiTexCoord3svARB(GLbyte * pc); +extern HIDDEN void __glXDisp_TexEnvfv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexEnvfv(GLbyte * pc); +extern HIDDEN int __glXDisp_QueryServerString(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_QueryServerString(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_LoadMatrixf(GLbyte * pc); +extern HIDDEN void __glXDispSwap_LoadMatrixf(GLbyte * pc); +extern HIDDEN void __glXDisp_Color4bv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Color4bv(GLbyte * pc); +extern HIDDEN void __glXDisp_SecondaryColor3usvEXT(GLbyte * pc); +extern HIDDEN void __glXDispSwap_SecondaryColor3usvEXT(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttrib2fvNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib2fvNV(GLbyte * pc); +extern HIDDEN void __glXDisp_ProgramLocalParameter4dvARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ProgramLocalParameter4dvARB(GLbyte * pc); +extern HIDDEN int __glXDisp_DeleteLists(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_DeleteLists(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_LogicOp(GLbyte * pc); +extern HIDDEN void __glXDispSwap_LogicOp(GLbyte * pc); +extern HIDDEN void __glXDisp_TexCoord4fv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexCoord4fv(GLbyte * pc); +extern HIDDEN int __glXDisp_WaitX(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_WaitX(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_SecondaryColor3uivEXT(GLbyte * pc); +extern HIDDEN void __glXDispSwap_SecondaryColor3uivEXT(GLbyte * pc); +extern HIDDEN void __glXDisp_FramebufferRenderbufferEXT(GLbyte * pc); +extern HIDDEN void __glXDispSwap_FramebufferRenderbufferEXT(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttrib1dvNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib1dvNV(GLbyte * pc); +extern HIDDEN int __glXDisp_GenTextures(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GenTextures(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GenTexturesEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GenTexturesEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_FramebufferTexture1DEXT(GLbyte * pc); +extern HIDDEN void __glXDispSwap_FramebufferTexture1DEXT(GLbyte * pc); +extern HIDDEN int __glXDisp_GetDrawableAttributes(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetDrawableAttributes(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_ProgramParameter4fvNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ProgramParameter4fvNV(GLbyte * pc); +extern HIDDEN void __glXDisp_RasterPos2sv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_RasterPos2sv(GLbyte * pc); +extern HIDDEN void __glXDisp_Color4ubv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Color4ubv(GLbyte * pc); +extern HIDDEN void __glXDisp_DrawBuffer(GLbyte * pc); +extern HIDDEN void __glXDispSwap_DrawBuffer(GLbyte * pc); +extern HIDDEN void __glXDisp_TexCoord2fv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexCoord2fv(GLbyte * pc); +extern HIDDEN void __glXDisp_TexCoord1sv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexCoord1sv(GLbyte * pc); +extern HIDDEN void __glXDisp_TexGeniv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexGeniv(GLbyte * pc); +extern HIDDEN void __glXDisp_DepthFunc(GLbyte * pc); +extern HIDDEN void __glXDispSwap_DepthFunc(GLbyte * pc); +extern HIDDEN void __glXDisp_PixelMapusv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_PixelMapusv(GLbyte * pc); +extern HIDDEN void __glXDisp_PointParameterivNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_PointParameterivNV(GLbyte * pc); +extern HIDDEN void __glXDisp_BlendFunc(GLbyte * pc); +extern HIDDEN void __glXDispSwap_BlendFunc(GLbyte * pc); +extern HIDDEN int __glXDisp_WaitGL(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_WaitGL(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_MultiTexCoord3dvARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_MultiTexCoord3dvARB(GLbyte * pc); +extern HIDDEN void __glXDisp_ProgramNamedParameter4dvNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ProgramNamedParameter4dvNV(GLbyte * pc); +extern HIDDEN int __glXDisp_Flush(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_Flush(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_Color4uiv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Color4uiv(GLbyte * pc); +extern HIDDEN void __glXDisp_RasterPos3sv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_RasterPos3sv(GLbyte * pc); +extern HIDDEN void __glXDisp_BindFramebufferEXT(GLbyte * pc); +extern HIDDEN void __glXDispSwap_BindFramebufferEXT(GLbyte * pc); +extern HIDDEN void __glXDisp_PushAttrib(GLbyte * pc); +extern HIDDEN void __glXDispSwap_PushAttrib(GLbyte * pc); +extern HIDDEN int __glXDisp_DestroyPbuffer(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_DestroyPbuffer(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_TexParameteriv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexParameteriv(GLbyte * pc); +extern HIDDEN void __glXDisp_WindowPos3fvMESA(GLbyte * pc); +extern HIDDEN void __glXDispSwap_WindowPos3fvMESA(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttrib1svNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib1svNV(GLbyte * pc); +extern HIDDEN int __glXDisp_QueryExtensionsString(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_QueryExtensionsString(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_RasterPos3fv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_RasterPos3fv(GLbyte * pc); +extern HIDDEN void __glXDisp_CopyTexSubImage3D(GLbyte * pc); +extern HIDDEN void __glXDispSwap_CopyTexSubImage3D(GLbyte * pc); +extern HIDDEN int __glXDisp_GetColorTable(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetColorTable(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetColorTableSGI(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetColorTableSGI(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_Indexiv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Indexiv(GLbyte * pc); +extern HIDDEN int __glXDisp_CreateContext(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_CreateContext(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_CopyColorTable(GLbyte * pc); +extern HIDDEN void __glXDispSwap_CopyColorTable(GLbyte * pc); +extern HIDDEN int __glXDisp_GetHistogramParameterfv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetHistogramParameterfv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetHistogramParameterfvEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetHistogramParameterfvEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_Frustum(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Frustum(GLbyte * pc); +extern HIDDEN int __glXDisp_GetString(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetString(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_CreateGLXPixmap(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_CreateGLXPixmap(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_TexEnvf(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexEnvf(GLbyte * pc); +extern HIDDEN int __glXDisp_GetProgramStringARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetProgramStringARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_MultiTexCoord3ivARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_MultiTexCoord3ivARB(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttrib1dvARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib1dvARB(GLbyte * pc); +extern HIDDEN int __glXDisp_DeleteTextures(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_DeleteTextures(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_DeleteTexturesEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_DeleteTexturesEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetTexLevelParameteriv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetTexLevelParameteriv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_ClearAccum(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ClearAccum(GLbyte * pc); +extern HIDDEN int __glXDisp_QueryVersion(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_QueryVersion(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetVertexAttribfvARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetVertexAttribfvARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_SecondaryColor3ivEXT(GLbyte * pc); +extern HIDDEN void __glXDispSwap_SecondaryColor3ivEXT(GLbyte * pc); +extern HIDDEN void __glXDisp_TexCoord4iv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexCoord4iv(GLbyte * pc); +extern HIDDEN void __glXDisp_SampleMaskSGIS(GLbyte * pc); +extern HIDDEN void __glXDispSwap_SampleMaskSGIS(GLbyte * pc); +extern HIDDEN void __glXDisp_ColorTableParameteriv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ColorTableParameteriv(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttrib4ubvARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib4ubvARB(GLbyte * pc); +extern HIDDEN void __glXDisp_CopyTexImage2D(GLbyte * pc); +extern HIDDEN void __glXDispSwap_CopyTexImage2D(GLbyte * pc); +extern HIDDEN void __glXDisp_Lightfv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Lightfv(GLbyte * pc); +extern HIDDEN void __glXDisp_ClearDepth(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ClearDepth(GLbyte * pc); +extern HIDDEN void __glXDisp_ColorSubTable(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ColorSubTable(GLbyte * pc); +extern HIDDEN void __glXDisp_Color4fv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Color4fv(GLbyte * pc); +extern HIDDEN void __glXDisp_MultiTexCoord4ivARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_MultiTexCoord4ivARB(GLbyte * pc); +extern HIDDEN int __glXDisp_CreatePixmap(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_CreatePixmap(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_Lightiv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Lightiv(GLbyte * pc); +extern HIDDEN int __glXDisp_GetQueryObjectuivARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetQueryObjectuivARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetTexParameteriv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetTexParameteriv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GenRenderbuffersEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GenRenderbuffersEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_VertexAttrib2dvARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib2dvARB(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttribs2svNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttribs2svNV(GLbyte * pc); +extern HIDDEN void __glXDisp_Rectdv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Rectdv(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttrib4NivARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib4NivARB(GLbyte * pc); +extern HIDDEN void __glXDisp_Materialiv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Materialiv(GLbyte * pc); +extern HIDDEN void __glXDisp_SecondaryColor3fvEXT(GLbyte * pc); +extern HIDDEN void __glXDispSwap_SecondaryColor3fvEXT(GLbyte * pc); +extern HIDDEN void __glXDisp_PolygonMode(GLbyte * pc); +extern HIDDEN void __glXDispSwap_PolygonMode(GLbyte * pc); +extern HIDDEN void __glXDisp_CompressedTexSubImage1DARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_CompressedTexSubImage1DARB(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttrib2dvNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib2dvNV(GLbyte * pc); +extern HIDDEN int __glXDisp_GetVertexAttribivNV(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetVertexAttribivNV(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_IsQueryARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_IsQueryARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_TexGeni(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexGeni(GLbyte * pc); +extern HIDDEN void __glXDisp_TexGenf(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexGenf(GLbyte * pc); +extern HIDDEN void __glXDisp_TexGend(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexGend(GLbyte * pc); +extern HIDDEN int __glXDisp_GetPolygonStipple(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetPolygonStipple(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetVertexAttribfvNV(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetVertexAttribfvNV(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_VertexAttrib2svNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib2svNV(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttribs1fvNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttribs1fvNV(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttrib4NuivARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib4NuivARB(GLbyte * pc); +extern HIDDEN int __glXDisp_DestroyWindow(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_DestroyWindow(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_Color4sv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Color4sv(GLbyte * pc); +extern HIDDEN int __glXDisp_IsProgramNV(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_IsProgramNV(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_PixelZoom(GLbyte * pc); +extern HIDDEN void __glXDispSwap_PixelZoom(GLbyte * pc); +extern HIDDEN void __glXDisp_ColorTableParameterfv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ColorTableParameterfv(GLbyte * pc); +extern HIDDEN void __glXDisp_PixelMapuiv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_PixelMapuiv(GLbyte * pc); +extern HIDDEN void __glXDisp_Color3dv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Color3dv(GLbyte * pc); +extern HIDDEN int __glXDisp_IsTexture(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_IsTexture(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_IsTextureEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_IsTextureEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_DeleteQueriesARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_DeleteQueriesARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetMapdv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetMapdv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_DestroyGLXPixmap(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_DestroyGLXPixmap(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_SamplePatternSGIS(GLbyte * pc); +extern HIDDEN void __glXDispSwap_SamplePatternSGIS(GLbyte * pc); +extern HIDDEN int __glXDisp_PixelStoref(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_PixelStoref(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_PrioritizeTextures(GLbyte * pc); +extern HIDDEN void __glXDispSwap_PrioritizeTextures(GLbyte * pc); +extern HIDDEN int __glXDisp_PixelStorei(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_PixelStorei(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_VertexAttrib4usvARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib4usvARB(GLbyte * pc); +extern HIDDEN void __glXDisp_Color4iv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Color4iv(GLbyte * pc); +extern HIDDEN void __glXDisp_EvalCoord2dv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_EvalCoord2dv(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttrib3svARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib3svARB(GLbyte * pc); +extern HIDDEN void __glXDisp_ColorMaterial(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ColorMaterial(GLbyte * pc); +extern HIDDEN void __glXDisp_CompressedTexSubImage3DARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_CompressedTexSubImage3DARB(GLbyte * pc); +extern HIDDEN int __glXDisp_IsFramebufferEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_IsFramebufferEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetVertexAttribdvARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetVertexAttribdvARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetSeparableFilter(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetSeparableFilter(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetSeparableFilterEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetSeparableFilterEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_RequestResidentProgramsNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_RequestResidentProgramsNV(GLbyte * pc); +extern HIDDEN int __glXDisp_FeedbackBuffer(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_FeedbackBuffer(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_RasterPos2iv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_RasterPos2iv(GLbyte * pc); +extern HIDDEN void __glXDisp_TexImage1D(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexImage1D(GLbyte * pc); +extern HIDDEN void __glXDisp_FrontFace(GLbyte * pc); +extern HIDDEN void __glXDispSwap_FrontFace(GLbyte * pc); +extern HIDDEN int __glXDisp_RenderLarge(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_RenderLarge(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_VertexAttrib4dvARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib4dvARB(GLbyte * pc); +extern HIDDEN void __glXDisp_PolygonOffset(GLbyte * pc); +extern HIDDEN void __glXDispSwap_PolygonOffset(GLbyte * pc); +extern HIDDEN void __glXDisp_ExecuteProgramNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ExecuteProgramNV(GLbyte * pc); +extern HIDDEN void __glXDisp_Normal3dv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Normal3dv(GLbyte * pc); +extern HIDDEN void __glXDisp_Lightf(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Lightf(GLbyte * pc); +extern HIDDEN void __glXDisp_MatrixMode(GLbyte * pc); +extern HIDDEN void __glXDispSwap_MatrixMode(GLbyte * pc); +extern HIDDEN void __glXDisp_FramebufferTexture2DEXT(GLbyte * pc); +extern HIDDEN void __glXDispSwap_FramebufferTexture2DEXT(GLbyte * pc); +extern HIDDEN int __glXDisp_GetPixelMapusv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetPixelMapusv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_Lighti(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Lighti(GLbyte * pc); +extern HIDDEN int __glXDisp_GetFramebufferAttachmentParameterivEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetFramebufferAttachmentParameterivEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_MultiTexCoord4dvARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_MultiTexCoord4dvARB(GLbyte * pc); +extern HIDDEN int __glXDisp_CreatePbuffer(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_CreatePbuffer(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetDoublev(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetDoublev(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_MultMatrixd(GLbyte * pc); +extern HIDDEN void __glXDispSwap_MultMatrixd(GLbyte * pc); +extern HIDDEN void __glXDisp_MultMatrixf(GLbyte * pc); +extern HIDDEN void __glXDispSwap_MultMatrixf(GLbyte * pc); +extern HIDDEN void __glXDisp_MultiTexCoord4fvARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_MultiTexCoord4fvARB(GLbyte * pc); +extern HIDDEN void __glXDisp_TrackMatrixNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TrackMatrixNV(GLbyte * pc); +extern HIDDEN void __glXDisp_RasterPos4sv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_RasterPos4sv(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttrib4NsvARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib4NsvARB(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttrib3fvARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib3fvARB(GLbyte * pc); +extern HIDDEN void __glXDisp_ClearColor(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ClearColor(GLbyte * pc); +extern HIDDEN int __glXDisp_IsDirect(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_IsDirect(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_DeleteFramebuffersEXT(GLbyte * pc); +extern HIDDEN void __glXDispSwap_DeleteFramebuffersEXT(GLbyte * pc); +extern HIDDEN void __glXDisp_TexEnviv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexEnviv(GLbyte * pc); +extern HIDDEN void __glXDisp_TexSubImage3D(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexSubImage3D(GLbyte * pc); +extern HIDDEN int __glXDisp_SwapIntervalSGI(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_SwapIntervalSGI(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetColorTableParameterfv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetColorTableParameterfv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetColorTableParameterfvSGI(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetColorTableParameterfvSGI(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_Bitmap(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Bitmap(GLbyte * pc); +extern HIDDEN int __glXDisp_GetTexLevelParameterfv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetTexLevelParameterfv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GenFramebuffersEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GenFramebuffersEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetProgramParameterdvNV(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetProgramParameterdvNV(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_Vertex2sv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Vertex2sv(GLbyte * pc); +extern HIDDEN int __glXDisp_GetIntegerv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetIntegerv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetProgramEnvParameterfvARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetProgramEnvParameterfvARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetTrackMatrixivNV(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetTrackMatrixivNV(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_VertexAttrib3svNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib3svNV(GLbyte * pc); +extern HIDDEN int __glXDisp_GetTexEnviv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetTexEnviv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_VendorPrivateWithReply(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_VendorPrivateWithReply(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_SeparableFilter2D(GLbyte * pc); +extern HIDDEN void __glXDispSwap_SeparableFilter2D(GLbyte * pc); +extern HIDDEN void __glXDisp_Map1d(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Map1d(GLbyte * pc); +extern HIDDEN void __glXDisp_Map1f(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Map1f(GLbyte * pc); +extern HIDDEN void __glXDisp_CompressedTexImage2DARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_CompressedTexImage2DARB(GLbyte * pc); +extern HIDDEN void __glXDisp_TexImage2D(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexImage2D(GLbyte * pc); +extern HIDDEN void __glXDisp_ProgramParameters4fvNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ProgramParameters4fvNV(GLbyte * pc); +extern HIDDEN int __glXDisp_GetProgramivNV(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetProgramivNV(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_ChangeDrawableAttributes(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_ChangeDrawableAttributes(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetMinmaxParameteriv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetMinmaxParameteriv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetMinmaxParameterivEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetMinmaxParameterivEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_PixelTransferf(GLbyte * pc); +extern HIDDEN void __glXDispSwap_PixelTransferf(GLbyte * pc); +extern HIDDEN void __glXDisp_CopyTexImage1D(GLbyte * pc); +extern HIDDEN void __glXDispSwap_CopyTexImage1D(GLbyte * pc); +extern HIDDEN void __glXDisp_PushMatrix(GLbyte * pc); +extern HIDDEN void __glXDispSwap_PushMatrix(GLbyte * pc); +extern HIDDEN void __glXDisp_Fogiv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Fogiv(GLbyte * pc); +extern HIDDEN void __glXDisp_TexCoord1dv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexCoord1dv(GLbyte * pc); +extern HIDDEN void __glXDisp_PixelTransferi(GLbyte * pc); +extern HIDDEN void __glXDispSwap_PixelTransferi(GLbyte * pc); +extern HIDDEN void __glXDisp_SecondaryColor3ubvEXT(GLbyte * pc); +extern HIDDEN void __glXDispSwap_SecondaryColor3ubvEXT(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttrib3fvNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib3fvNV(GLbyte * pc); +extern HIDDEN void __glXDisp_Clear(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Clear(GLbyte * pc); +extern HIDDEN void __glXDisp_ReadBuffer(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ReadBuffer(GLbyte * pc); +extern HIDDEN void __glXDisp_ConvolutionParameteri(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ConvolutionParameteri(GLbyte * pc); +extern HIDDEN void __glXDisp_Ortho(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Ortho(GLbyte * pc); +extern HIDDEN void __glXDisp_ListBase(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ListBase(GLbyte * pc); +extern HIDDEN void __glXDisp_ConvolutionParameterf(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ConvolutionParameterf(GLbyte * pc); +extern HIDDEN int __glXDisp_GetColorTableParameteriv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetColorTableParameteriv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetColorTableParameterivSGI(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetColorTableParameterivSGI(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_ReleaseTexImageEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_ReleaseTexImageEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_CallList(GLbyte * pc); +extern HIDDEN void __glXDispSwap_CallList(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttribs2fvNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttribs2fvNV(GLbyte * pc); +extern HIDDEN void __glXDisp_Rectiv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Rectiv(GLbyte * pc); +extern HIDDEN void __glXDisp_SecondaryColor3dvEXT(GLbyte * pc); +extern HIDDEN void __glXDispSwap_SecondaryColor3dvEXT(GLbyte * pc); +extern HIDDEN void __glXDisp_Vertex2fv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Vertex2fv(GLbyte * pc); +extern HIDDEN void __glXDisp_BindRenderbufferEXT(GLbyte * pc); +extern HIDDEN void __glXDispSwap_BindRenderbufferEXT(GLbyte * pc); +extern HIDDEN void __glXDisp_Vertex3sv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Vertex3sv(GLbyte * pc); +extern HIDDEN int __glXDisp_BindTexImageEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_BindTexImageEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_ProgramLocalParameter4fvARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ProgramLocalParameter4fvARB(GLbyte * pc); +extern HIDDEN int __glXDisp_DeleteProgramsNV(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_DeleteProgramsNV(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_EvalMesh1(GLbyte * pc); +extern HIDDEN void __glXDispSwap_EvalMesh1(GLbyte * pc); +extern HIDDEN void __glXDisp_MultiTexCoord1dvARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_MultiTexCoord1dvARB(GLbyte * pc); +extern HIDDEN void __glXDisp_Vertex2iv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Vertex2iv(GLbyte * pc); +extern HIDDEN int __glXDisp_GetProgramStringNV(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetProgramStringNV(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_LineWidth(GLbyte * pc); +extern HIDDEN void __glXDispSwap_LineWidth(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttrib2fvARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib2fvARB(GLbyte * pc); +extern HIDDEN void __glXDisp_TexGendv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexGendv(GLbyte * pc); +extern HIDDEN void __glXDisp_ResetMinmax(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ResetMinmax(GLbyte * pc); +extern HIDDEN int __glXDisp_GetConvolutionParameterfv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetConvolutionParameterfv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetConvolutionParameterfvEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetConvolutionParameterfvEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_VertexAttribs4dvNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttribs4dvNV(GLbyte * pc); +extern HIDDEN int __glXDisp_GetMaterialfv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetMaterialfv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_UseXFont(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_UseXFont(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_ShadeModel(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ShadeModel(GLbyte * pc); +extern HIDDEN void __glXDisp_Materialfv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Materialfv(GLbyte * pc); +extern HIDDEN void __glXDisp_TexCoord3fv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexCoord3fv(GLbyte * pc); +extern HIDDEN void __glXDisp_FogCoordfvEXT(GLbyte * pc); +extern HIDDEN void __glXDispSwap_FogCoordfvEXT(GLbyte * pc); +extern HIDDEN void __glXDisp_MultiTexCoord1ivARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_MultiTexCoord1ivARB(GLbyte * pc); +extern HIDDEN void __glXDisp_MultiTexCoord2ivARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_MultiTexCoord2ivARB(GLbyte * pc); +extern HIDDEN void __glXDisp_DrawArrays(GLbyte * pc); +extern HIDDEN void __glXDispSwap_DrawArrays(GLbyte * pc); +extern HIDDEN void __glXDisp_Color3iv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Color3iv(GLbyte * pc); +extern HIDDEN int __glXDisp_GetProgramLocalParameterdvARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetProgramLocalParameterdvARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetHistogramParameteriv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetHistogramParameteriv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetHistogramParameterivEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetHistogramParameterivEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetConvolutionFilter(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetConvolutionFilter(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetConvolutionFilterEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetConvolutionFilterEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetProgramivARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetProgramivARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_BlendFuncSeparateEXT(GLbyte * pc); +extern HIDDEN void __glXDispSwap_BlendFuncSeparateEXT(GLbyte * pc); +extern HIDDEN void __glXDisp_ProgramParameters4dvNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ProgramParameters4dvNV(GLbyte * pc); +extern HIDDEN void __glXDisp_EvalPoint2(GLbyte * pc); +extern HIDDEN void __glXDispSwap_EvalPoint2(GLbyte * pc); +extern HIDDEN void __glXDisp_EvalPoint1(GLbyte * pc); +extern HIDDEN void __glXDispSwap_EvalPoint1(GLbyte * pc); +extern HIDDEN void __glXDisp_PopMatrix(GLbyte * pc); +extern HIDDEN void __glXDispSwap_PopMatrix(GLbyte * pc); +extern HIDDEN int __glXDisp_MakeCurrentReadSGI(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_MakeCurrentReadSGI(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetTexGeniv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetTexGeniv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_MakeCurrent(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_MakeCurrent(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_Map2d(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Map2d(GLbyte * pc); +extern HIDDEN void __glXDisp_Map2f(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Map2f(GLbyte * pc); +extern HIDDEN void __glXDisp_ProgramStringARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ProgramStringARB(GLbyte * pc); +extern HIDDEN int __glXDisp_GetCompressedTexImageARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetCompressedTexImageARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetTexGenfv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetTexGenfv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetHistogram(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetHistogram(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetHistogramEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetHistogramEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_ActiveStencilFaceEXT(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ActiveStencilFaceEXT(GLbyte * pc); +extern HIDDEN void __glXDisp_Materialf(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Materialf(GLbyte * pc); +extern HIDDEN void __glXDisp_Materiali(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Materiali(GLbyte * pc); +extern HIDDEN void __glXDisp_Indexsv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Indexsv(GLbyte * pc); +extern HIDDEN void __glXDisp_MultiTexCoord4svARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_MultiTexCoord4svARB(GLbyte * pc); +extern HIDDEN void __glXDisp_LightModelfv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_LightModelfv(GLbyte * pc); +extern HIDDEN void __glXDisp_TexCoord2dv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexCoord2dv(GLbyte * pc); +extern HIDDEN int __glXDisp_GenQueriesARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GenQueriesARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_EvalCoord1dv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_EvalCoord1dv(GLbyte * pc); +extern HIDDEN void __glXDisp_Translated(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Translated(GLbyte * pc); +extern HIDDEN void __glXDisp_Translatef(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Translatef(GLbyte * pc); +extern HIDDEN void __glXDisp_StencilMask(GLbyte * pc); +extern HIDDEN void __glXDispSwap_StencilMask(GLbyte * pc); +extern HIDDEN int __glXDisp_CreateWindow(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_CreateWindow(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetLightiv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetLightiv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_IsList(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_IsList(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_RenderMode(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_RenderMode(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_DrawBuffersARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_DrawBuffersARB(GLbyte * pc); +extern HIDDEN void __glXDisp_LoadName(GLbyte * pc); +extern HIDDEN void __glXDispSwap_LoadName(GLbyte * pc); +extern HIDDEN void __glXDisp_CopyTexSubImage1D(GLbyte * pc); +extern HIDDEN void __glXDispSwap_CopyTexSubImage1D(GLbyte * pc); +extern HIDDEN void __glXDisp_CullFace(GLbyte * pc); +extern HIDDEN void __glXDispSwap_CullFace(GLbyte * pc); +extern HIDDEN int __glXDisp_QueryContextInfoEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_QueryContextInfoEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_VertexAttribs3svNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttribs3svNV(GLbyte * pc); +extern HIDDEN void __glXDisp_StencilFunc(GLbyte * pc); +extern HIDDEN void __glXDispSwap_StencilFunc(GLbyte * pc); +extern HIDDEN void __glXDisp_CopyPixels(GLbyte * pc); +extern HIDDEN void __glXDispSwap_CopyPixels(GLbyte * pc); +extern HIDDEN void __glXDisp_Rectsv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Rectsv(GLbyte * pc); +extern HIDDEN void __glXDisp_CopyConvolutionFilter2D(GLbyte * pc); +extern HIDDEN void __glXDispSwap_CopyConvolutionFilter2D(GLbyte * pc); +extern HIDDEN void __glXDisp_TexParameterfv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexParameterfv(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttrib4uivARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib4uivARB(GLbyte * pc); +extern HIDDEN void __glXDisp_ClipPlane(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ClipPlane(GLbyte * pc); +extern HIDDEN int __glXDisp_GetPixelMapuiv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetPixelMapuiv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_Indexfv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Indexfv(GLbyte * pc); +extern HIDDEN int __glXDisp_QueryContext(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_QueryContext(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_SecondaryColor3svEXT(GLbyte * pc); +extern HIDDEN void __glXDispSwap_SecondaryColor3svEXT(GLbyte * pc); +extern HIDDEN void __glXDisp_IndexMask(GLbyte * pc); +extern HIDDEN void __glXDispSwap_IndexMask(GLbyte * pc); +extern HIDDEN void __glXDisp_BindProgramNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_BindProgramNV(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttrib4svARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib4svARB(GLbyte * pc); +extern HIDDEN int __glXDisp_GetFloatv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetFloatv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_TexCoord3sv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexCoord3sv(GLbyte * pc); +extern HIDDEN void __glXDisp_PopAttrib(GLbyte * pc); +extern HIDDEN void __glXDispSwap_PopAttrib(GLbyte * pc); +extern HIDDEN void __glXDisp_Fogfv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Fogfv(GLbyte * pc); +extern HIDDEN void __glXDisp_InitNames(GLbyte * pc); +extern HIDDEN void __glXDispSwap_InitNames(GLbyte * pc); +extern HIDDEN void __glXDisp_Normal3sv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Normal3sv(GLbyte * pc); +extern HIDDEN void __glXDisp_Minmax(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Minmax(GLbyte * pc); +extern HIDDEN void __glXDisp_FogCoorddvEXT(GLbyte * pc); +extern HIDDEN void __glXDispSwap_FogCoorddvEXT(GLbyte * pc); +extern HIDDEN int __glXDisp_GetBooleanv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetBooleanv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_Hint(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Hint(GLbyte * pc); +extern HIDDEN void __glXDisp_Color4dv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Color4dv(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttrib2svARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib2svARB(GLbyte * pc); +extern HIDDEN int __glXDisp_AreProgramsResidentNV(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_AreProgramsResidentNV(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_CopyColorSubTable(GLbyte * pc); +extern HIDDEN void __glXDispSwap_CopyColorSubTable(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttrib4NubvARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib4NubvARB(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttrib3dvNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib3dvNV(GLbyte * pc); +extern HIDDEN void __glXDisp_Vertex4iv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Vertex4iv(GLbyte * pc); +extern HIDDEN int __glXDisp_GetProgramEnvParameterdvARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetProgramEnvParameterdvARB(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_TexCoord4dv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_TexCoord4dv(GLbyte * pc); +extern HIDDEN void __glXDisp_Begin(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Begin(GLbyte * pc); +extern HIDDEN int __glXDisp_ClientInfo(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_ClientInfo(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_Rectfv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Rectfv(GLbyte * pc); +extern HIDDEN void __glXDisp_LightModelf(GLbyte * pc); +extern HIDDEN void __glXDispSwap_LightModelf(GLbyte * pc); +extern HIDDEN int __glXDisp_GetTexParameterfv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetTexParameterfv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetLightfv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetLightfv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_Disable(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Disable(GLbyte * pc); +extern HIDDEN void __glXDisp_MultiTexCoord2fvARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_MultiTexCoord2fvARB(GLbyte * pc); +extern HIDDEN int __glXDisp_GetRenderbufferParameterivEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetRenderbufferParameterivEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_SelectBuffer(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_SelectBuffer(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_ColorMask(GLbyte * pc); +extern HIDDEN void __glXDispSwap_ColorMask(GLbyte * pc); +extern HIDDEN void __glXDisp_RasterPos4iv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_RasterPos4iv(GLbyte * pc); +extern HIDDEN void __glXDisp_Enable(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Enable(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttribs4svNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttribs4svNV(GLbyte * pc); +extern HIDDEN int __glXDisp_GetMinmaxParameterfv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetMinmaxParameterfv(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_GetMinmaxParameterfvEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GetMinmaxParameterfvEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_VertexAttrib1fvARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib1fvARB(GLbyte * pc); +extern HIDDEN void __glXDisp_VertexAttribs1svNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttribs1svNV(GLbyte * pc); +extern HIDDEN void __glXDisp_Vertex3fv(GLbyte * pc); +extern HIDDEN void __glXDispSwap_Vertex3fv(GLbyte * pc); +extern HIDDEN int __glXDisp_GenProgramsNV(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_GenProgramsNV(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_VertexAttrib4dvNV(GLbyte * pc); +extern HIDDEN void __glXDispSwap_VertexAttrib4dvNV(GLbyte * pc); + +# undef HIDDEN + +#endif /* !defined( _INDIRECT_DISPATCH_H_ ) */ diff --git a/dist/Mesa/src/glx/x11/indirect_dispatch_swap.c b/dist/Mesa/src/glx/x11/indirect_dispatch_swap.c new file mode 100644 index 000000000..c0bb71cc4 --- /dev/null +++ b/dist/Mesa/src/glx/x11/indirect_dispatch_swap.c @@ -0,0 +1,6076 @@ +/* DO NOT EDIT - This file generated automatically by glX_proto_recv.py (from Mesa) script */ + +/* + * (C) Copyright IBM Corporation 2005 + * 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 + * IBM, + * 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. + */ + +#include <X11/Xmd.h> +#include <GL/gl.h> +#include <GL/glxproto.h> +#include <inttypes.h> +#include "indirect_size.h" +#include "indirect_size_get.h" +#include "indirect_dispatch.h" +#include "glxserver.h" +#include "glxbyteorder.h" +#include "indirect_util.h" +#include "singlesize.h" +#include "glapitable.h" +#include "glapi.h" +#include "glthread.h" +#include "dispatch.h" + +#define __GLX_PAD(x) (((x) + 3) & ~3) + +typedef struct { + __GLX_PIXEL_3D_HDR; +} __GLXpixel3DHeader; + +extern GLboolean __glXErrorOccured( void ); +extern void __glXClearErrorOccured( void ); + +static const unsigned dummy_answer[2] = {0, 0}; + +static GLsizei +bswap_CARD32( const void * src ) +{ + union { uint32_t dst; GLsizei ret; } x; + x.dst = bswap_32( *(uint32_t *) src ); + return x.ret; +} + +static GLshort +bswap_CARD16( const void * src ) +{ + union { uint16_t dst; GLshort ret; } x; + x.dst = bswap_16( *(uint16_t *) src ); + return x.ret; +} + +static GLenum +bswap_ENUM( const void * src ) +{ + union { uint32_t dst; GLenum ret; } x; + x.dst = bswap_32( *(uint32_t *) src ); + return x.ret; +} + +static GLdouble +bswap_FLOAT64( const void * src ) +{ + union { uint64_t dst; GLdouble ret; } x; + x.dst = bswap_64( *(uint64_t *) src ); + return x.ret; +} + +static GLfloat +bswap_FLOAT32( const void * src ) +{ + union { uint32_t dst; GLfloat ret; } x; + x.dst = bswap_32( *(uint32_t *) src ); + return x.ret; +} + +static void * +bswap_16_array( uint16_t * src, unsigned count ) +{ + unsigned i; + + for ( i = 0 ; i < count ; i++ ) { + uint16_t temp = bswap_16( src[i] ); + src[i] = temp; + } + + return src; +} + +static void * +bswap_32_array( uint32_t * src, unsigned count ) +{ + unsigned i; + + for ( i = 0 ; i < count ; i++ ) { + uint32_t temp = bswap_32( src[i] ); + src[i] = temp; + } + + return src; +} + +static void * +bswap_64_array( uint64_t * src, unsigned count ) +{ + unsigned i; + + for ( i = 0 ; i < count ; i++ ) { + uint64_t temp = bswap_64( src[i] ); + src[i] = temp; + } + + return src; +} + +int __glXDispSwap_NewList(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + CALL_NewList( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ) + ) ); + error = Success; + } + + return error; +} + +int __glXDispSwap_EndList(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + CALL_EndList( GET_DISPATCH(), () ); + error = Success; + } + + return error; +} + +void __glXDispSwap_CallList(GLbyte * pc) +{ + CALL_CallList( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ) + ) ); +} + +void __glXDispSwap_CallLists(GLbyte * pc) +{ + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); + const GLenum type = (GLenum )bswap_ENUM ( pc + 4 ); + const GLvoid * lists; + + switch(type) { + case GL_BYTE: + case GL_UNSIGNED_BYTE: + case GL_2_BYTES: + case GL_3_BYTES: + case GL_4_BYTES: + lists = (const GLvoid *) (pc + 8); break; + case GL_SHORT: + case GL_UNSIGNED_SHORT: + lists = (const GLvoid *) bswap_16_array( (uint16_t *) (pc + 8), n ); break; + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + lists = (const GLvoid *) bswap_32_array( (uint32_t *) (pc + 8), n ); break; + default: + return; + } + + CALL_CallLists( GET_DISPATCH(), ( + n, + type, + lists + ) ); +} + +int __glXDispSwap_DeleteLists(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + CALL_DeleteLists( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (GLsizei )bswap_CARD32 ( pc + 4 ) + ) ); + error = Success; + } + + return error; +} + +int __glXDispSwap_GenLists(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + GLuint retval; + retval = CALL_GenLists( GET_DISPATCH(), ( + (GLsizei )bswap_CARD32 ( pc + 0 ) + ) ); + __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); + error = Success; + } + + return error; +} + +void __glXDispSwap_ListBase(GLbyte * pc) +{ + CALL_ListBase( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ) + ) ); +} + +void __glXDispSwap_Begin(GLbyte * pc) +{ + CALL_Begin( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ) + ) ); +} + +void __glXDispSwap_Bitmap(GLbyte * pc) +{ + const GLubyte * const bitmap = (const GLubyte *) (pc + 44); + __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); + + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); + + CALL_Bitmap( GET_DISPATCH(), ( + (GLsizei )bswap_CARD32 ( pc + 20 ), + (GLsizei )bswap_CARD32 ( pc + 24 ), + (GLfloat )bswap_FLOAT32( pc + 28 ), + (GLfloat )bswap_FLOAT32( pc + 32 ), + (GLfloat )bswap_FLOAT32( pc + 36 ), + (GLfloat )bswap_FLOAT32( pc + 40 ), + bitmap + ) ); +} + +void __glXDispSwap_Color3bv(GLbyte * pc) +{ + CALL_Color3bv( GET_DISPATCH(), ( + (const GLbyte *)(pc + 0) + ) ); +} + +void __glXDispSwap_Color3dv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 24); + pc -= 4; + } +#endif + + CALL_Color3dv( GET_DISPATCH(), ( + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 ) + ) ); +} + +void __glXDispSwap_Color3fv(GLbyte * pc) +{ + CALL_Color3fv( GET_DISPATCH(), ( + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) + ) ); +} + +void __glXDispSwap_Color3iv(GLbyte * pc) +{ + CALL_Color3iv( GET_DISPATCH(), ( + (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) + ) ); +} + +void __glXDispSwap_Color3sv(GLbyte * pc) +{ + CALL_Color3sv( GET_DISPATCH(), ( + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 3 ) + ) ); +} + +void __glXDispSwap_Color3ubv(GLbyte * pc) +{ + CALL_Color3ubv( GET_DISPATCH(), ( + (const GLubyte *)(pc + 0) + ) ); +} + +void __glXDispSwap_Color3uiv(GLbyte * pc) +{ + CALL_Color3uiv( GET_DISPATCH(), ( + (const GLuint *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) + ) ); +} + +void __glXDispSwap_Color3usv(GLbyte * pc) +{ + CALL_Color3usv( GET_DISPATCH(), ( + (const GLushort *)bswap_16_array( (uint16_t *) (pc + 0), 3 ) + ) ); +} + +void __glXDispSwap_Color4bv(GLbyte * pc) +{ + CALL_Color4bv( GET_DISPATCH(), ( + (const GLbyte *)(pc + 0) + ) ); +} + +void __glXDispSwap_Color4dv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 32); + pc -= 4; + } +#endif + + CALL_Color4dv( GET_DISPATCH(), ( + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 ) + ) ); +} + +void __glXDispSwap_Color4fv(GLbyte * pc) +{ + CALL_Color4fv( GET_DISPATCH(), ( + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 4 ) + ) ); +} + +void __glXDispSwap_Color4iv(GLbyte * pc) +{ + CALL_Color4iv( GET_DISPATCH(), ( + (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 4 ) + ) ); +} + +void __glXDispSwap_Color4sv(GLbyte * pc) +{ + CALL_Color4sv( GET_DISPATCH(), ( + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 4 ) + ) ); +} + +void __glXDispSwap_Color4ubv(GLbyte * pc) +{ + CALL_Color4ubv( GET_DISPATCH(), ( + (const GLubyte *)(pc + 0) + ) ); +} + +void __glXDispSwap_Color4uiv(GLbyte * pc) +{ + CALL_Color4uiv( GET_DISPATCH(), ( + (const GLuint *)bswap_32_array( (uint32_t *) (pc + 0), 4 ) + ) ); +} + +void __glXDispSwap_Color4usv(GLbyte * pc) +{ + CALL_Color4usv( GET_DISPATCH(), ( + (const GLushort *)bswap_16_array( (uint16_t *) (pc + 0), 4 ) + ) ); +} + +void __glXDispSwap_EdgeFlagv(GLbyte * pc) +{ + CALL_EdgeFlagv( GET_DISPATCH(), ( + (const GLboolean *)(pc + 0) + ) ); +} + +void __glXDispSwap_End(GLbyte * pc) +{ + CALL_End( GET_DISPATCH(), () ); +} + +void __glXDispSwap_Indexdv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 8); + pc -= 4; + } +#endif + + CALL_Indexdv( GET_DISPATCH(), ( + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 1 ) + ) ); +} + +void __glXDispSwap_Indexfv(GLbyte * pc) +{ + CALL_Indexfv( GET_DISPATCH(), ( + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 1 ) + ) ); +} + +void __glXDispSwap_Indexiv(GLbyte * pc) +{ + CALL_Indexiv( GET_DISPATCH(), ( + (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 1 ) + ) ); +} + +void __glXDispSwap_Indexsv(GLbyte * pc) +{ + CALL_Indexsv( GET_DISPATCH(), ( + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 1 ) + ) ); +} + +void __glXDispSwap_Normal3bv(GLbyte * pc) +{ + CALL_Normal3bv( GET_DISPATCH(), ( + (const GLbyte *)(pc + 0) + ) ); +} + +void __glXDispSwap_Normal3dv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 24); + pc -= 4; + } +#endif + + CALL_Normal3dv( GET_DISPATCH(), ( + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 ) + ) ); +} + +void __glXDispSwap_Normal3fv(GLbyte * pc) +{ + CALL_Normal3fv( GET_DISPATCH(), ( + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) + ) ); +} + +void __glXDispSwap_Normal3iv(GLbyte * pc) +{ + CALL_Normal3iv( GET_DISPATCH(), ( + (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) + ) ); +} + +void __glXDispSwap_Normal3sv(GLbyte * pc) +{ + CALL_Normal3sv( GET_DISPATCH(), ( + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 3 ) + ) ); +} + +void __glXDispSwap_RasterPos2dv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 16); + pc -= 4; + } +#endif + + CALL_RasterPos2dv( GET_DISPATCH(), ( + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 2 ) + ) ); +} + +void __glXDispSwap_RasterPos2fv(GLbyte * pc) +{ + CALL_RasterPos2fv( GET_DISPATCH(), ( + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 2 ) + ) ); +} + +void __glXDispSwap_RasterPos2iv(GLbyte * pc) +{ + CALL_RasterPos2iv( GET_DISPATCH(), ( + (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 2 ) + ) ); +} + +void __glXDispSwap_RasterPos2sv(GLbyte * pc) +{ + CALL_RasterPos2sv( GET_DISPATCH(), ( + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 2 ) + ) ); +} + +void __glXDispSwap_RasterPos3dv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 24); + pc -= 4; + } +#endif + + CALL_RasterPos3dv( GET_DISPATCH(), ( + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 ) + ) ); +} + +void __glXDispSwap_RasterPos3fv(GLbyte * pc) +{ + CALL_RasterPos3fv( GET_DISPATCH(), ( + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) + ) ); +} + +void __glXDispSwap_RasterPos3iv(GLbyte * pc) +{ + CALL_RasterPos3iv( GET_DISPATCH(), ( + (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) + ) ); +} + +void __glXDispSwap_RasterPos3sv(GLbyte * pc) +{ + CALL_RasterPos3sv( GET_DISPATCH(), ( + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 3 ) + ) ); +} + +void __glXDispSwap_RasterPos4dv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 32); + pc -= 4; + } +#endif + + CALL_RasterPos4dv( GET_DISPATCH(), ( + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 ) + ) ); +} + +void __glXDispSwap_RasterPos4fv(GLbyte * pc) +{ + CALL_RasterPos4fv( GET_DISPATCH(), ( + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 4 ) + ) ); +} + +void __glXDispSwap_RasterPos4iv(GLbyte * pc) +{ + CALL_RasterPos4iv( GET_DISPATCH(), ( + (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 4 ) + ) ); +} + +void __glXDispSwap_RasterPos4sv(GLbyte * pc) +{ + CALL_RasterPos4sv( GET_DISPATCH(), ( + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 4 ) + ) ); +} + +void __glXDispSwap_Rectdv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 32); + pc -= 4; + } +#endif + + CALL_Rectdv( GET_DISPATCH(), ( + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 2 ), + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 16), 2 ) + ) ); +} + +void __glXDispSwap_Rectfv(GLbyte * pc) +{ + CALL_Rectfv( GET_DISPATCH(), ( + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 2 ), + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 2 ) + ) ); +} + +void __glXDispSwap_Rectiv(GLbyte * pc) +{ + CALL_Rectiv( GET_DISPATCH(), ( + (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 2 ), + (const GLint *)bswap_32_array( (uint32_t *) (pc + 8), 2 ) + ) ); +} + +void __glXDispSwap_Rectsv(GLbyte * pc) +{ + CALL_Rectsv( GET_DISPATCH(), ( + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 2 ), + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 2 ) + ) ); +} + +void __glXDispSwap_TexCoord1dv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 8); + pc -= 4; + } +#endif + + CALL_TexCoord1dv( GET_DISPATCH(), ( + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 1 ) + ) ); +} + +void __glXDispSwap_TexCoord1fv(GLbyte * pc) +{ + CALL_TexCoord1fv( GET_DISPATCH(), ( + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 1 ) + ) ); +} + +void __glXDispSwap_TexCoord1iv(GLbyte * pc) +{ + CALL_TexCoord1iv( GET_DISPATCH(), ( + (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 1 ) + ) ); +} + +void __glXDispSwap_TexCoord1sv(GLbyte * pc) +{ + CALL_TexCoord1sv( GET_DISPATCH(), ( + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 1 ) + ) ); +} + +void __glXDispSwap_TexCoord2dv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 16); + pc -= 4; + } +#endif + + CALL_TexCoord2dv( GET_DISPATCH(), ( + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 2 ) + ) ); +} + +void __glXDispSwap_TexCoord2fv(GLbyte * pc) +{ + CALL_TexCoord2fv( GET_DISPATCH(), ( + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 2 ) + ) ); +} + +void __glXDispSwap_TexCoord2iv(GLbyte * pc) +{ + CALL_TexCoord2iv( GET_DISPATCH(), ( + (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 2 ) + ) ); +} + +void __glXDispSwap_TexCoord2sv(GLbyte * pc) +{ + CALL_TexCoord2sv( GET_DISPATCH(), ( + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 2 ) + ) ); +} + +void __glXDispSwap_TexCoord3dv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 24); + pc -= 4; + } +#endif + + CALL_TexCoord3dv( GET_DISPATCH(), ( + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 ) + ) ); +} + +void __glXDispSwap_TexCoord3fv(GLbyte * pc) +{ + CALL_TexCoord3fv( GET_DISPATCH(), ( + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) + ) ); +} + +void __glXDispSwap_TexCoord3iv(GLbyte * pc) +{ + CALL_TexCoord3iv( GET_DISPATCH(), ( + (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) + ) ); +} + +void __glXDispSwap_TexCoord3sv(GLbyte * pc) +{ + CALL_TexCoord3sv( GET_DISPATCH(), ( + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 3 ) + ) ); +} + +void __glXDispSwap_TexCoord4dv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 32); + pc -= 4; + } +#endif + + CALL_TexCoord4dv( GET_DISPATCH(), ( + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 ) + ) ); +} + +void __glXDispSwap_TexCoord4fv(GLbyte * pc) +{ + CALL_TexCoord4fv( GET_DISPATCH(), ( + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 4 ) + ) ); +} + +void __glXDispSwap_TexCoord4iv(GLbyte * pc) +{ + CALL_TexCoord4iv( GET_DISPATCH(), ( + (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 4 ) + ) ); +} + +void __glXDispSwap_TexCoord4sv(GLbyte * pc) +{ + CALL_TexCoord4sv( GET_DISPATCH(), ( + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 4 ) + ) ); +} + +void __glXDispSwap_Vertex2dv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 16); + pc -= 4; + } +#endif + + CALL_Vertex2dv( GET_DISPATCH(), ( + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 2 ) + ) ); +} + +void __glXDispSwap_Vertex2fv(GLbyte * pc) +{ + CALL_Vertex2fv( GET_DISPATCH(), ( + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 2 ) + ) ); +} + +void __glXDispSwap_Vertex2iv(GLbyte * pc) +{ + CALL_Vertex2iv( GET_DISPATCH(), ( + (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 2 ) + ) ); +} + +void __glXDispSwap_Vertex2sv(GLbyte * pc) +{ + CALL_Vertex2sv( GET_DISPATCH(), ( + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 2 ) + ) ); +} + +void __glXDispSwap_Vertex3dv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 24); + pc -= 4; + } +#endif + + CALL_Vertex3dv( GET_DISPATCH(), ( + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 ) + ) ); +} + +void __glXDispSwap_Vertex3fv(GLbyte * pc) +{ + CALL_Vertex3fv( GET_DISPATCH(), ( + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) + ) ); +} + +void __glXDispSwap_Vertex3iv(GLbyte * pc) +{ + CALL_Vertex3iv( GET_DISPATCH(), ( + (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) + ) ); +} + +void __glXDispSwap_Vertex3sv(GLbyte * pc) +{ + CALL_Vertex3sv( GET_DISPATCH(), ( + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 3 ) + ) ); +} + +void __glXDispSwap_Vertex4dv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 32); + pc -= 4; + } +#endif + + CALL_Vertex4dv( GET_DISPATCH(), ( + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 ) + ) ); +} + +void __glXDispSwap_Vertex4fv(GLbyte * pc) +{ + CALL_Vertex4fv( GET_DISPATCH(), ( + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 4 ) + ) ); +} + +void __glXDispSwap_Vertex4iv(GLbyte * pc) +{ + CALL_Vertex4iv( GET_DISPATCH(), ( + (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 4 ) + ) ); +} + +void __glXDispSwap_Vertex4sv(GLbyte * pc) +{ + CALL_Vertex4sv( GET_DISPATCH(), ( + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 4 ) + ) ); +} + +void __glXDispSwap_ClipPlane(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 36); + pc -= 4; + } +#endif + + CALL_ClipPlane( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 32 ), + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 ) + ) ); +} + +void __glXDispSwap_ColorMaterial(GLbyte * pc) +{ + CALL_ColorMaterial( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ) + ) ); +} + +void __glXDispSwap_CullFace(GLbyte * pc) +{ + CALL_CullFace( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ) + ) ); +} + +void __glXDispSwap_Fogf(GLbyte * pc) +{ + CALL_Fogf( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLfloat )bswap_FLOAT32( pc + 4 ) + ) ); +} + +void __glXDispSwap_Fogfv(GLbyte * pc) +{ + const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 ); + const GLfloat * params; + + params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 4), __glFogfv_size(pname) ); + + CALL_Fogfv( GET_DISPATCH(), ( + pname, + params + ) ); +} + +void __glXDispSwap_Fogi(GLbyte * pc) +{ + CALL_Fogi( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLint )bswap_CARD32 ( pc + 4 ) + ) ); +} + +void __glXDispSwap_Fogiv(GLbyte * pc) +{ + const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 ); + const GLint * params; + + params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 4), __glFogiv_size(pname) ); + + CALL_Fogiv( GET_DISPATCH(), ( + pname, + params + ) ); +} + +void __glXDispSwap_FrontFace(GLbyte * pc) +{ + CALL_FrontFace( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ) + ) ); +} + +void __glXDispSwap_Hint(GLbyte * pc) +{ + CALL_Hint( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ) + ) ); +} + +void __glXDispSwap_Lightf(GLbyte * pc) +{ + CALL_Lightf( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ), + (GLfloat )bswap_FLOAT32( pc + 8 ) + ) ); +} + +void __glXDispSwap_Lightfv(GLbyte * pc) +{ + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + const GLfloat * params; + + params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glLightfv_size(pname) ); + + CALL_Lightfv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); +} + +void __glXDispSwap_Lighti(GLbyte * pc) +{ + CALL_Lighti( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ), + (GLint )bswap_CARD32 ( pc + 8 ) + ) ); +} + +void __glXDispSwap_Lightiv(GLbyte * pc) +{ + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + const GLint * params; + + params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glLightiv_size(pname) ); + + CALL_Lightiv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); +} + +void __glXDispSwap_LightModelf(GLbyte * pc) +{ + CALL_LightModelf( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLfloat )bswap_FLOAT32( pc + 4 ) + ) ); +} + +void __glXDispSwap_LightModelfv(GLbyte * pc) +{ + const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 ); + const GLfloat * params; + + params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 4), __glLightModelfv_size(pname) ); + + CALL_LightModelfv( GET_DISPATCH(), ( + pname, + params + ) ); +} + +void __glXDispSwap_LightModeli(GLbyte * pc) +{ + CALL_LightModeli( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLint )bswap_CARD32 ( pc + 4 ) + ) ); +} + +void __glXDispSwap_LightModeliv(GLbyte * pc) +{ + const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 ); + const GLint * params; + + params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 4), __glLightModeliv_size(pname) ); + + CALL_LightModeliv( GET_DISPATCH(), ( + pname, + params + ) ); +} + +void __glXDispSwap_LineStipple(GLbyte * pc) +{ + CALL_LineStipple( GET_DISPATCH(), ( + (GLint )bswap_CARD32 ( pc + 0 ), + (GLushort)bswap_CARD16 ( pc + 4 ) + ) ); +} + +void __glXDispSwap_LineWidth(GLbyte * pc) +{ + CALL_LineWidth( GET_DISPATCH(), ( + (GLfloat )bswap_FLOAT32( pc + 0 ) + ) ); +} + +void __glXDispSwap_Materialf(GLbyte * pc) +{ + CALL_Materialf( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ), + (GLfloat )bswap_FLOAT32( pc + 8 ) + ) ); +} + +void __glXDispSwap_Materialfv(GLbyte * pc) +{ + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + const GLfloat * params; + + params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glMaterialfv_size(pname) ); + + CALL_Materialfv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); +} + +void __glXDispSwap_Materiali(GLbyte * pc) +{ + CALL_Materiali( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ), + (GLint )bswap_CARD32 ( pc + 8 ) + ) ); +} + +void __glXDispSwap_Materialiv(GLbyte * pc) +{ + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + const GLint * params; + + params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glMaterialiv_size(pname) ); + + CALL_Materialiv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); +} + +void __glXDispSwap_PointSize(GLbyte * pc) +{ + CALL_PointSize( GET_DISPATCH(), ( + (GLfloat )bswap_FLOAT32( pc + 0 ) + ) ); +} + +void __glXDispSwap_PolygonMode(GLbyte * pc) +{ + CALL_PolygonMode( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ) + ) ); +} + +void __glXDispSwap_PolygonStipple(GLbyte * pc) +{ + const GLubyte * const mask = (const GLubyte *) (pc + 20); + __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); + + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); + + CALL_PolygonStipple( GET_DISPATCH(), ( + mask + ) ); +} + +void __glXDispSwap_Scissor(GLbyte * pc) +{ + CALL_Scissor( GET_DISPATCH(), ( + (GLint )bswap_CARD32 ( pc + 0 ), + (GLint )bswap_CARD32 ( pc + 4 ), + (GLsizei )bswap_CARD32 ( pc + 8 ), + (GLsizei )bswap_CARD32 ( pc + 12 ) + ) ); +} + +void __glXDispSwap_ShadeModel(GLbyte * pc) +{ + CALL_ShadeModel( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ) + ) ); +} + +void __glXDispSwap_TexParameterf(GLbyte * pc) +{ + CALL_TexParameterf( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ), + (GLfloat )bswap_FLOAT32( pc + 8 ) + ) ); +} + +void __glXDispSwap_TexParameterfv(GLbyte * pc) +{ + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + const GLfloat * params; + + params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glTexParameterfv_size(pname) ); + + CALL_TexParameterfv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); +} + +void __glXDispSwap_TexParameteri(GLbyte * pc) +{ + CALL_TexParameteri( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ), + (GLint )bswap_CARD32 ( pc + 8 ) + ) ); +} + +void __glXDispSwap_TexParameteriv(GLbyte * pc) +{ + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + const GLint * params; + + params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glTexParameteriv_size(pname) ); + + CALL_TexParameteriv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); +} + +void __glXDispSwap_TexImage1D(GLbyte * pc) +{ + const GLvoid * const pixels = (const GLvoid *) (pc + 52); + __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); + + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); + + CALL_TexImage1D( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 20 ), + (GLint )bswap_CARD32 ( pc + 24 ), + (GLint )bswap_CARD32 ( pc + 28 ), + (GLsizei )bswap_CARD32 ( pc + 32 ), + (GLint )bswap_CARD32 ( pc + 40 ), + (GLenum )bswap_ENUM ( pc + 44 ), + (GLenum )bswap_ENUM ( pc + 48 ), + pixels + ) ); +} + +void __glXDispSwap_TexImage2D(GLbyte * pc) +{ + const GLvoid * const pixels = (const GLvoid *) (pc + 52); + __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); + + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); + + CALL_TexImage2D( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 20 ), + (GLint )bswap_CARD32 ( pc + 24 ), + (GLint )bswap_CARD32 ( pc + 28 ), + (GLsizei )bswap_CARD32 ( pc + 32 ), + (GLsizei )bswap_CARD32 ( pc + 36 ), + (GLint )bswap_CARD32 ( pc + 40 ), + (GLenum )bswap_ENUM ( pc + 44 ), + (GLenum )bswap_ENUM ( pc + 48 ), + pixels + ) ); +} + +void __glXDispSwap_TexEnvf(GLbyte * pc) +{ + CALL_TexEnvf( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ), + (GLfloat )bswap_FLOAT32( pc + 8 ) + ) ); +} + +void __glXDispSwap_TexEnvfv(GLbyte * pc) +{ + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + const GLfloat * params; + + params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glTexEnvfv_size(pname) ); + + CALL_TexEnvfv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); +} + +void __glXDispSwap_TexEnvi(GLbyte * pc) +{ + CALL_TexEnvi( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ), + (GLint )bswap_CARD32 ( pc + 8 ) + ) ); +} + +void __glXDispSwap_TexEnviv(GLbyte * pc) +{ + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + const GLint * params; + + params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glTexEnviv_size(pname) ); + + CALL_TexEnviv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); +} + +void __glXDispSwap_TexGend(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 16); + pc -= 4; + } +#endif + + CALL_TexGend( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 8 ), + (GLenum )bswap_ENUM ( pc + 12 ), + (GLdouble)bswap_FLOAT64( pc + 0 ) + ) ); +} + +void __glXDispSwap_TexGendv(GLbyte * pc) +{ + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + const GLdouble * params; + +#ifdef __GLX_ALIGN64 + const GLuint compsize = __glTexGendv_size(pname); + const GLuint cmdlen = 12 + __GLX_PAD((compsize * 8)) - 4; + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, cmdlen); + pc -= 4; + } +#endif + + params = (const GLdouble *) bswap_64_array( (uint64_t *) (pc + 8), __glTexGendv_size(pname) ); + + CALL_TexGendv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); +} + +void __glXDispSwap_TexGenf(GLbyte * pc) +{ + CALL_TexGenf( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ), + (GLfloat )bswap_FLOAT32( pc + 8 ) + ) ); +} + +void __glXDispSwap_TexGenfv(GLbyte * pc) +{ + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + const GLfloat * params; + + params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glTexGenfv_size(pname) ); + + CALL_TexGenfv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); +} + +void __glXDispSwap_TexGeni(GLbyte * pc) +{ + CALL_TexGeni( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ), + (GLint )bswap_CARD32 ( pc + 8 ) + ) ); +} + +void __glXDispSwap_TexGeniv(GLbyte * pc) +{ + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + const GLint * params; + + params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glTexGeniv_size(pname) ); + + CALL_TexGeniv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); +} + +void __glXDispSwap_InitNames(GLbyte * pc) +{ + CALL_InitNames( GET_DISPATCH(), () ); +} + +void __glXDispSwap_LoadName(GLbyte * pc) +{ + CALL_LoadName( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ) + ) ); +} + +void __glXDispSwap_PassThrough(GLbyte * pc) +{ + CALL_PassThrough( GET_DISPATCH(), ( + (GLfloat )bswap_FLOAT32( pc + 0 ) + ) ); +} + +void __glXDispSwap_PopName(GLbyte * pc) +{ + CALL_PopName( GET_DISPATCH(), () ); +} + +void __glXDispSwap_PushName(GLbyte * pc) +{ + CALL_PushName( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ) + ) ); +} + +void __glXDispSwap_DrawBuffer(GLbyte * pc) +{ + CALL_DrawBuffer( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ) + ) ); +} + +void __glXDispSwap_Clear(GLbyte * pc) +{ + CALL_Clear( GET_DISPATCH(), ( + (GLbitfield)bswap_CARD32 ( pc + 0 ) + ) ); +} + +void __glXDispSwap_ClearAccum(GLbyte * pc) +{ + CALL_ClearAccum( GET_DISPATCH(), ( + (GLfloat )bswap_FLOAT32( pc + 0 ), + (GLfloat )bswap_FLOAT32( pc + 4 ), + (GLfloat )bswap_FLOAT32( pc + 8 ), + (GLfloat )bswap_FLOAT32( pc + 12 ) + ) ); +} + +void __glXDispSwap_ClearIndex(GLbyte * pc) +{ + CALL_ClearIndex( GET_DISPATCH(), ( + (GLfloat )bswap_FLOAT32( pc + 0 ) + ) ); +} + +void __glXDispSwap_ClearColor(GLbyte * pc) +{ + CALL_ClearColor( GET_DISPATCH(), ( + (GLclampf)bswap_FLOAT32( pc + 0 ), + (GLclampf)bswap_FLOAT32( pc + 4 ), + (GLclampf)bswap_FLOAT32( pc + 8 ), + (GLclampf)bswap_FLOAT32( pc + 12 ) + ) ); +} + +void __glXDispSwap_ClearStencil(GLbyte * pc) +{ + CALL_ClearStencil( GET_DISPATCH(), ( + (GLint )bswap_CARD32 ( pc + 0 ) + ) ); +} + +void __glXDispSwap_ClearDepth(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 8); + pc -= 4; + } +#endif + + CALL_ClearDepth( GET_DISPATCH(), ( + (GLclampd)bswap_FLOAT64( pc + 0 ) + ) ); +} + +void __glXDispSwap_StencilMask(GLbyte * pc) +{ + CALL_StencilMask( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ) + ) ); +} + +void __glXDispSwap_ColorMask(GLbyte * pc) +{ + CALL_ColorMask( GET_DISPATCH(), ( + *(GLboolean *)(pc + 0), + *(GLboolean *)(pc + 1), + *(GLboolean *)(pc + 2), + *(GLboolean *)(pc + 3) + ) ); +} + +void __glXDispSwap_DepthMask(GLbyte * pc) +{ + CALL_DepthMask( GET_DISPATCH(), ( + *(GLboolean *)(pc + 0) + ) ); +} + +void __glXDispSwap_IndexMask(GLbyte * pc) +{ + CALL_IndexMask( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ) + ) ); +} + +void __glXDispSwap_Accum(GLbyte * pc) +{ + CALL_Accum( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLfloat )bswap_FLOAT32( pc + 4 ) + ) ); +} + +void __glXDispSwap_Disable(GLbyte * pc) +{ + CALL_Disable( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ) + ) ); +} + +void __glXDispSwap_Enable(GLbyte * pc) +{ + CALL_Enable( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ) + ) ); +} + +void __glXDispSwap_PopAttrib(GLbyte * pc) +{ + CALL_PopAttrib( GET_DISPATCH(), () ); +} + +void __glXDispSwap_PushAttrib(GLbyte * pc) +{ + CALL_PushAttrib( GET_DISPATCH(), ( + (GLbitfield)bswap_CARD32 ( pc + 0 ) + ) ); +} + +void __glXDispSwap_MapGrid1d(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 20); + pc -= 4; + } +#endif + + CALL_MapGrid1d( GET_DISPATCH(), ( + (GLint )bswap_CARD32 ( pc + 16 ), + (GLdouble)bswap_FLOAT64( pc + 0 ), + (GLdouble)bswap_FLOAT64( pc + 8 ) + ) ); +} + +void __glXDispSwap_MapGrid1f(GLbyte * pc) +{ + CALL_MapGrid1f( GET_DISPATCH(), ( + (GLint )bswap_CARD32 ( pc + 0 ), + (GLfloat )bswap_FLOAT32( pc + 4 ), + (GLfloat )bswap_FLOAT32( pc + 8 ) + ) ); +} + +void __glXDispSwap_MapGrid2d(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 40); + pc -= 4; + } +#endif + + CALL_MapGrid2d( GET_DISPATCH(), ( + (GLint )bswap_CARD32 ( pc + 32 ), + (GLdouble)bswap_FLOAT64( pc + 0 ), + (GLdouble)bswap_FLOAT64( pc + 8 ), + (GLint )bswap_CARD32 ( pc + 36 ), + (GLdouble)bswap_FLOAT64( pc + 16 ), + (GLdouble)bswap_FLOAT64( pc + 24 ) + ) ); +} + +void __glXDispSwap_MapGrid2f(GLbyte * pc) +{ + CALL_MapGrid2f( GET_DISPATCH(), ( + (GLint )bswap_CARD32 ( pc + 0 ), + (GLfloat )bswap_FLOAT32( pc + 4 ), + (GLfloat )bswap_FLOAT32( pc + 8 ), + (GLint )bswap_CARD32 ( pc + 12 ), + (GLfloat )bswap_FLOAT32( pc + 16 ), + (GLfloat )bswap_FLOAT32( pc + 20 ) + ) ); +} + +void __glXDispSwap_EvalCoord1dv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 8); + pc -= 4; + } +#endif + + CALL_EvalCoord1dv( GET_DISPATCH(), ( + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 1 ) + ) ); +} + +void __glXDispSwap_EvalCoord1fv(GLbyte * pc) +{ + CALL_EvalCoord1fv( GET_DISPATCH(), ( + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 1 ) + ) ); +} + +void __glXDispSwap_EvalCoord2dv(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 16); + pc -= 4; + } +#endif + + CALL_EvalCoord2dv( GET_DISPATCH(), ( + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 2 ) + ) ); +} + +void __glXDispSwap_EvalCoord2fv(GLbyte * pc) +{ + CALL_EvalCoord2fv( GET_DISPATCH(), ( + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 2 ) + ) ); +} + +void __glXDispSwap_EvalMesh1(GLbyte * pc) +{ + CALL_EvalMesh1( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLint )bswap_CARD32 ( pc + 4 ), + (GLint )bswap_CARD32 ( pc + 8 ) + ) ); +} + +void __glXDispSwap_EvalPoint1(GLbyte * pc) +{ + CALL_EvalPoint1( GET_DISPATCH(), ( + (GLint )bswap_CARD32 ( pc + 0 ) + ) ); +} + +void __glXDispSwap_EvalMesh2(GLbyte * pc) +{ + CALL_EvalMesh2( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLint )bswap_CARD32 ( pc + 4 ), + (GLint )bswap_CARD32 ( pc + 8 ), + (GLint )bswap_CARD32 ( pc + 12 ), + (GLint )bswap_CARD32 ( pc + 16 ) + ) ); +} + +void __glXDispSwap_EvalPoint2(GLbyte * pc) +{ + CALL_EvalPoint2( GET_DISPATCH(), ( + (GLint )bswap_CARD32 ( pc + 0 ), + (GLint )bswap_CARD32 ( pc + 4 ) + ) ); +} + +void __glXDispSwap_AlphaFunc(GLbyte * pc) +{ + CALL_AlphaFunc( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLclampf)bswap_FLOAT32( pc + 4 ) + ) ); +} + +void __glXDispSwap_BlendFunc(GLbyte * pc) +{ + CALL_BlendFunc( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ) + ) ); +} + +void __glXDispSwap_LogicOp(GLbyte * pc) +{ + CALL_LogicOp( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ) + ) ); +} + +void __glXDispSwap_StencilFunc(GLbyte * pc) +{ + CALL_StencilFunc( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLint )bswap_CARD32 ( pc + 4 ), + (GLuint )bswap_CARD32 ( pc + 8 ) + ) ); +} + +void __glXDispSwap_StencilOp(GLbyte * pc) +{ + CALL_StencilOp( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ), + (GLenum )bswap_ENUM ( pc + 8 ) + ) ); +} + +void __glXDispSwap_DepthFunc(GLbyte * pc) +{ + CALL_DepthFunc( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ) + ) ); +} + +void __glXDispSwap_PixelZoom(GLbyte * pc) +{ + CALL_PixelZoom( GET_DISPATCH(), ( + (GLfloat )bswap_FLOAT32( pc + 0 ), + (GLfloat )bswap_FLOAT32( pc + 4 ) + ) ); +} + +void __glXDispSwap_PixelTransferf(GLbyte * pc) +{ + CALL_PixelTransferf( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLfloat )bswap_FLOAT32( pc + 4 ) + ) ); +} + +void __glXDispSwap_PixelTransferi(GLbyte * pc) +{ + CALL_PixelTransferi( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLint )bswap_CARD32 ( pc + 4 ) + ) ); +} + +int __glXDispSwap_PixelStoref(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + CALL_PixelStoref( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLfloat )bswap_FLOAT32( pc + 4 ) + ) ); + error = Success; + } + + return error; +} + +int __glXDispSwap_PixelStorei(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + CALL_PixelStorei( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLint )bswap_CARD32 ( pc + 4 ) + ) ); + error = Success; + } + + return error; +} + +void __glXDispSwap_PixelMapfv(GLbyte * pc) +{ + const GLsizei mapsize = (GLsizei )bswap_CARD32 ( pc + 4 ); + + CALL_PixelMapfv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + mapsize, + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 0 ) + ) ); +} + +void __glXDispSwap_PixelMapuiv(GLbyte * pc) +{ + const GLsizei mapsize = (GLsizei )bswap_CARD32 ( pc + 4 ); + + CALL_PixelMapuiv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + mapsize, + (const GLuint *)bswap_32_array( (uint32_t *) (pc + 8), 0 ) + ) ); +} + +void __glXDispSwap_PixelMapusv(GLbyte * pc) +{ + const GLsizei mapsize = (GLsizei )bswap_CARD32 ( pc + 4 ); + + CALL_PixelMapusv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + mapsize, + (const GLushort *)bswap_16_array( (uint16_t *) (pc + 8), 0 ) + ) ); +} + +void __glXDispSwap_ReadBuffer(GLbyte * pc) +{ + CALL_ReadBuffer( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ) + ) ); +} + +void __glXDispSwap_CopyPixels(GLbyte * pc) +{ + CALL_CopyPixels( GET_DISPATCH(), ( + (GLint )bswap_CARD32 ( pc + 0 ), + (GLint )bswap_CARD32 ( pc + 4 ), + (GLsizei )bswap_CARD32 ( pc + 8 ), + (GLsizei )bswap_CARD32 ( pc + 12 ), + (GLenum )bswap_ENUM ( pc + 16 ) + ) ); +} + +void __glXDispSwap_DrawPixels(GLbyte * pc) +{ + const GLvoid * const pixels = (const GLvoid *) (pc + 36); + __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); + + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); + + CALL_DrawPixels( GET_DISPATCH(), ( + (GLsizei )bswap_CARD32 ( pc + 20 ), + (GLsizei )bswap_CARD32 ( pc + 24 ), + (GLenum )bswap_ENUM ( pc + 28 ), + (GLenum )bswap_ENUM ( pc + 32 ), + pixels + ) ); +} + +int __glXDispSwap_GetBooleanv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 ); + + const GLuint compsize = __glGetBooleanv_size(pname); + GLboolean answerBuffer[200]; + GLboolean * params = __glXGetAnswerBuffer(cl, compsize, answerBuffer, sizeof(answerBuffer), 1); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetBooleanv( GET_DISPATCH(), ( + pname, + params + ) ); + __glXSendReplySwap(cl->client, params, compsize, 1, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetClipPlane(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + GLdouble equation[4]; + CALL_GetClipPlane( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + equation + ) ); + (void) bswap_64_array( (uint64_t *) equation, 4 ); + __glXSendReplySwap(cl->client, equation, 4, 8, GL_TRUE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetDoublev(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 ); + + const GLuint compsize = __glGetDoublev_size(pname); + GLdouble answerBuffer[200]; + GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetDoublev( GET_DISPATCH(), ( + pname, + params + ) ); + (void) bswap_64_array( (uint64_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 8, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetError(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + GLenum retval; + retval = CALL_GetError( GET_DISPATCH(), () ); + __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetFloatv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 ); + + const GLuint compsize = __glGetFloatv_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetFloatv( GET_DISPATCH(), ( + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetIntegerv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 ); + + const GLuint compsize = __glGetIntegerv_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetIntegerv( GET_DISPATCH(), ( + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetLightfv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetLightfv_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetLightfv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetLightiv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetLightiv_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetLightiv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetMapdv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum target = (GLenum )bswap_ENUM ( pc + 0 ); + const GLenum query = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetMapdv_size(target,query); + GLdouble answerBuffer[200]; + GLdouble * v = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); + + if (v == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetMapdv( GET_DISPATCH(), ( + target, + query, + v + ) ); + (void) bswap_64_array( (uint64_t *) v, compsize ); + __glXSendReplySwap(cl->client, v, compsize, 8, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetMapfv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum target = (GLenum )bswap_ENUM ( pc + 0 ); + const GLenum query = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetMapfv_size(target,query); + GLfloat answerBuffer[200]; + GLfloat * v = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (v == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetMapfv( GET_DISPATCH(), ( + target, + query, + v + ) ); + (void) bswap_32_array( (uint32_t *) v, compsize ); + __glXSendReplySwap(cl->client, v, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetMapiv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum target = (GLenum )bswap_ENUM ( pc + 0 ); + const GLenum query = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetMapiv_size(target,query); + GLint answerBuffer[200]; + GLint * v = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (v == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetMapiv( GET_DISPATCH(), ( + target, + query, + v + ) ); + (void) bswap_32_array( (uint32_t *) v, compsize ); + __glXSendReplySwap(cl->client, v, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetMaterialfv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetMaterialfv_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetMaterialfv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetMaterialiv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetMaterialiv_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetMaterialiv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetPixelMapfv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum map = (GLenum )bswap_ENUM ( pc + 0 ); + + const GLuint compsize = __glGetPixelMapfv_size(map); + GLfloat answerBuffer[200]; + GLfloat * values = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (values == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetPixelMapfv( GET_DISPATCH(), ( + map, + values + ) ); + (void) bswap_32_array( (uint32_t *) values, compsize ); + __glXSendReplySwap(cl->client, values, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetPixelMapuiv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum map = (GLenum )bswap_ENUM ( pc + 0 ); + + const GLuint compsize = __glGetPixelMapuiv_size(map); + GLuint answerBuffer[200]; + GLuint * values = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (values == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetPixelMapuiv( GET_DISPATCH(), ( + map, + values + ) ); + (void) bswap_32_array( (uint32_t *) values, compsize ); + __glXSendReplySwap(cl->client, values, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetPixelMapusv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum map = (GLenum )bswap_ENUM ( pc + 0 ); + + const GLuint compsize = __glGetPixelMapusv_size(map); + GLushort answerBuffer[200]; + GLushort * values = __glXGetAnswerBuffer(cl, compsize * 2, answerBuffer, sizeof(answerBuffer), 2); + + if (values == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetPixelMapusv( GET_DISPATCH(), ( + map, + values + ) ); + (void) bswap_16_array( (uint16_t *) values, compsize ); + __glXSendReplySwap(cl->client, values, compsize, 2, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetTexEnvfv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetTexEnvfv_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetTexEnvfv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetTexEnviv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetTexEnviv_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetTexEnviv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetTexGendv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetTexGendv_size(pname); + GLdouble answerBuffer[200]; + GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetTexGendv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); + (void) bswap_64_array( (uint64_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 8, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetTexGenfv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetTexGenfv_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetTexGenfv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetTexGeniv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetTexGeniv_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetTexGeniv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetTexParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetTexParameterfv_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetTexParameterfv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetTexParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetTexParameteriv_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetTexParameteriv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetTexLevelParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 8 ); + + const GLuint compsize = __glGetTexLevelParameterfv_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetTexLevelParameterfv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLint )bswap_CARD32 ( pc + 4 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetTexLevelParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 8 ); + + const GLuint compsize = __glGetTexLevelParameteriv_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetTexLevelParameteriv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLint )bswap_CARD32 ( pc + 4 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_IsEnabled(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + GLboolean retval; + retval = CALL_IsEnabled( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ) + ) ); + __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); + error = Success; + } + + return error; +} + +int __glXDispSwap_IsList(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + GLboolean retval; + retval = CALL_IsList( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ) + ) ); + __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); + error = Success; + } + + return error; +} + +void __glXDispSwap_DepthRange(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 16); + pc -= 4; + } +#endif + + CALL_DepthRange( GET_DISPATCH(), ( + (GLclampd)bswap_FLOAT64( pc + 0 ), + (GLclampd)bswap_FLOAT64( pc + 8 ) + ) ); +} + +void __glXDispSwap_Frustum(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 48); + pc -= 4; + } +#endif + + CALL_Frustum( GET_DISPATCH(), ( + (GLdouble)bswap_FLOAT64( pc + 0 ), + (GLdouble)bswap_FLOAT64( pc + 8 ), + (GLdouble)bswap_FLOAT64( pc + 16 ), + (GLdouble)bswap_FLOAT64( pc + 24 ), + (GLdouble)bswap_FLOAT64( pc + 32 ), + (GLdouble)bswap_FLOAT64( pc + 40 ) + ) ); +} + +void __glXDispSwap_LoadIdentity(GLbyte * pc) +{ + CALL_LoadIdentity( GET_DISPATCH(), () ); +} + +void __glXDispSwap_LoadMatrixf(GLbyte * pc) +{ + CALL_LoadMatrixf( GET_DISPATCH(), ( + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 16 ) + ) ); +} + +void __glXDispSwap_LoadMatrixd(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 128); + pc -= 4; + } +#endif + + CALL_LoadMatrixd( GET_DISPATCH(), ( + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 16 ) + ) ); +} + +void __glXDispSwap_MatrixMode(GLbyte * pc) +{ + CALL_MatrixMode( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ) + ) ); +} + +void __glXDispSwap_MultMatrixf(GLbyte * pc) +{ + CALL_MultMatrixf( GET_DISPATCH(), ( + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 16 ) + ) ); +} + +void __glXDispSwap_MultMatrixd(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 128); + pc -= 4; + } +#endif + + CALL_MultMatrixd( GET_DISPATCH(), ( + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 16 ) + ) ); +} + +void __glXDispSwap_Ortho(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 48); + pc -= 4; + } +#endif + + CALL_Ortho( GET_DISPATCH(), ( + (GLdouble)bswap_FLOAT64( pc + 0 ), + (GLdouble)bswap_FLOAT64( pc + 8 ), + (GLdouble)bswap_FLOAT64( pc + 16 ), + (GLdouble)bswap_FLOAT64( pc + 24 ), + (GLdouble)bswap_FLOAT64( pc + 32 ), + (GLdouble)bswap_FLOAT64( pc + 40 ) + ) ); +} + +void __glXDispSwap_PopMatrix(GLbyte * pc) +{ + CALL_PopMatrix( GET_DISPATCH(), () ); +} + +void __glXDispSwap_PushMatrix(GLbyte * pc) +{ + CALL_PushMatrix( GET_DISPATCH(), () ); +} + +void __glXDispSwap_Rotated(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 32); + pc -= 4; + } +#endif + + CALL_Rotated( GET_DISPATCH(), ( + (GLdouble)bswap_FLOAT64( pc + 0 ), + (GLdouble)bswap_FLOAT64( pc + 8 ), + (GLdouble)bswap_FLOAT64( pc + 16 ), + (GLdouble)bswap_FLOAT64( pc + 24 ) + ) ); +} + +void __glXDispSwap_Rotatef(GLbyte * pc) +{ + CALL_Rotatef( GET_DISPATCH(), ( + (GLfloat )bswap_FLOAT32( pc + 0 ), + (GLfloat )bswap_FLOAT32( pc + 4 ), + (GLfloat )bswap_FLOAT32( pc + 8 ), + (GLfloat )bswap_FLOAT32( pc + 12 ) + ) ); +} + +void __glXDispSwap_Scaled(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 24); + pc -= 4; + } +#endif + + CALL_Scaled( GET_DISPATCH(), ( + (GLdouble)bswap_FLOAT64( pc + 0 ), + (GLdouble)bswap_FLOAT64( pc + 8 ), + (GLdouble)bswap_FLOAT64( pc + 16 ) + ) ); +} + +void __glXDispSwap_Scalef(GLbyte * pc) +{ + CALL_Scalef( GET_DISPATCH(), ( + (GLfloat )bswap_FLOAT32( pc + 0 ), + (GLfloat )bswap_FLOAT32( pc + 4 ), + (GLfloat )bswap_FLOAT32( pc + 8 ) + ) ); +} + +void __glXDispSwap_Translated(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 24); + pc -= 4; + } +#endif + + CALL_Translated( GET_DISPATCH(), ( + (GLdouble)bswap_FLOAT64( pc + 0 ), + (GLdouble)bswap_FLOAT64( pc + 8 ), + (GLdouble)bswap_FLOAT64( pc + 16 ) + ) ); +} + +void __glXDispSwap_Translatef(GLbyte * pc) +{ + CALL_Translatef( GET_DISPATCH(), ( + (GLfloat )bswap_FLOAT32( pc + 0 ), + (GLfloat )bswap_FLOAT32( pc + 4 ), + (GLfloat )bswap_FLOAT32( pc + 8 ) + ) ); +} + +void __glXDispSwap_Viewport(GLbyte * pc) +{ + CALL_Viewport( GET_DISPATCH(), ( + (GLint )bswap_CARD32 ( pc + 0 ), + (GLint )bswap_CARD32 ( pc + 4 ), + (GLsizei )bswap_CARD32 ( pc + 8 ), + (GLsizei )bswap_CARD32 ( pc + 12 ) + ) ); +} + +void __glXDispSwap_BindTexture(GLbyte * pc) +{ + CALL_BindTexture( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLuint )bswap_CARD32 ( pc + 4 ) + ) ); +} + +void __glXDispSwap_Indexubv(GLbyte * pc) +{ + CALL_Indexubv( GET_DISPATCH(), ( + (const GLubyte *)(pc + 0) + ) ); +} + +void __glXDispSwap_PolygonOffset(GLbyte * pc) +{ + CALL_PolygonOffset( GET_DISPATCH(), ( + (GLfloat )bswap_FLOAT32( pc + 0 ), + (GLfloat )bswap_FLOAT32( pc + 4 ) + ) ); +} + +int __glXDispSwap_AreTexturesResident(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); + + GLboolean retval; + GLboolean answerBuffer[200]; + GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1); + retval = CALL_AreTexturesResident( GET_DISPATCH(), ( + n, + (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ), + residences + ) ); + __glXSendReplySwap(cl->client, residences, n, 1, GL_TRUE, retval); + error = Success; + } + + return error; +} + +int __glXDispSwap_AreTexturesResidentEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); + + GLboolean retval; + GLboolean answerBuffer[200]; + GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1); + retval = CALL_AreTexturesResident( GET_DISPATCH(), ( + n, + (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ), + residences + ) ); + __glXSendReplySwap(cl->client, residences, n, 1, GL_TRUE, retval); + error = Success; + } + + return error; +} + +void __glXDispSwap_CopyTexImage1D(GLbyte * pc) +{ + CALL_CopyTexImage1D( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLint )bswap_CARD32 ( pc + 4 ), + (GLenum )bswap_ENUM ( pc + 8 ), + (GLint )bswap_CARD32 ( pc + 12 ), + (GLint )bswap_CARD32 ( pc + 16 ), + (GLsizei )bswap_CARD32 ( pc + 20 ), + (GLint )bswap_CARD32 ( pc + 24 ) + ) ); +} + +void __glXDispSwap_CopyTexImage2D(GLbyte * pc) +{ + CALL_CopyTexImage2D( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLint )bswap_CARD32 ( pc + 4 ), + (GLenum )bswap_ENUM ( pc + 8 ), + (GLint )bswap_CARD32 ( pc + 12 ), + (GLint )bswap_CARD32 ( pc + 16 ), + (GLsizei )bswap_CARD32 ( pc + 20 ), + (GLsizei )bswap_CARD32 ( pc + 24 ), + (GLint )bswap_CARD32 ( pc + 28 ) + ) ); +} + +void __glXDispSwap_CopyTexSubImage1D(GLbyte * pc) +{ + CALL_CopyTexSubImage1D( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLint )bswap_CARD32 ( pc + 4 ), + (GLint )bswap_CARD32 ( pc + 8 ), + (GLint )bswap_CARD32 ( pc + 12 ), + (GLint )bswap_CARD32 ( pc + 16 ), + (GLsizei )bswap_CARD32 ( pc + 20 ) + ) ); +} + +void __glXDispSwap_CopyTexSubImage2D(GLbyte * pc) +{ + CALL_CopyTexSubImage2D( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLint )bswap_CARD32 ( pc + 4 ), + (GLint )bswap_CARD32 ( pc + 8 ), + (GLint )bswap_CARD32 ( pc + 12 ), + (GLint )bswap_CARD32 ( pc + 16 ), + (GLint )bswap_CARD32 ( pc + 20 ), + (GLsizei )bswap_CARD32 ( pc + 24 ), + (GLsizei )bswap_CARD32 ( pc + 28 ) + ) ); +} + +int __glXDispSwap_DeleteTextures(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); + + CALL_DeleteTextures( GET_DISPATCH(), ( + n, + (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ) + ) ); + error = Success; + } + + return error; +} + +int __glXDispSwap_DeleteTexturesEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); + + CALL_DeleteTextures( GET_DISPATCH(), ( + n, + (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ) + ) ); + error = Success; + } + + return error; +} + +int __glXDispSwap_GenTextures(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); + + GLuint answerBuffer[200]; + GLuint * textures = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); + CALL_GenTextures( GET_DISPATCH(), ( + n, + textures + ) ); + (void) bswap_32_array( (uint32_t *) textures, n ); + __glXSendReplySwap(cl->client, textures, n, 4, GL_TRUE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GenTexturesEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); + + GLuint answerBuffer[200]; + GLuint * textures = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); + CALL_GenTextures( GET_DISPATCH(), ( + n, + textures + ) ); + (void) bswap_32_array( (uint32_t *) textures, n ); + __glXSendReplySwap(cl->client, textures, n, 4, GL_TRUE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_IsTexture(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + GLboolean retval; + retval = CALL_IsTexture( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ) + ) ); + __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); + error = Success; + } + + return error; +} + +int __glXDispSwap_IsTextureEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + GLboolean retval; + retval = CALL_IsTexture( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ) + ) ); + __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); + error = Success; + } + + return error; +} + +void __glXDispSwap_PrioritizeTextures(GLbyte * pc) +{ + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); + + CALL_PrioritizeTextures( GET_DISPATCH(), ( + n, + (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ), + (const GLclampf *)bswap_32_array( (uint32_t *) (pc + 4), 0 ) + ) ); +} + +void __glXDispSwap_TexSubImage1D(GLbyte * pc) +{ + const CARD32 ptr_is_null = *(CARD32 *)(pc + 52); + const GLvoid * const pixels = (const GLvoid *) (ptr_is_null != 0) ? NULL : (pc + 56); + __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); + + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); + + CALL_TexSubImage1D( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 20 ), + (GLint )bswap_CARD32 ( pc + 24 ), + (GLint )bswap_CARD32 ( pc + 28 ), + (GLsizei )bswap_CARD32 ( pc + 36 ), + (GLenum )bswap_ENUM ( pc + 44 ), + (GLenum )bswap_ENUM ( pc + 48 ), + pixels + ) ); +} + +void __glXDispSwap_TexSubImage2D(GLbyte * pc) +{ + const CARD32 ptr_is_null = *(CARD32 *)(pc + 52); + const GLvoid * const pixels = (const GLvoid *) (ptr_is_null != 0) ? NULL : (pc + 56); + __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); + + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); + + CALL_TexSubImage2D( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 20 ), + (GLint )bswap_CARD32 ( pc + 24 ), + (GLint )bswap_CARD32 ( pc + 28 ), + (GLint )bswap_CARD32 ( pc + 32 ), + (GLsizei )bswap_CARD32 ( pc + 36 ), + (GLsizei )bswap_CARD32 ( pc + 40 ), + (GLenum )bswap_ENUM ( pc + 44 ), + (GLenum )bswap_ENUM ( pc + 48 ), + pixels + ) ); +} + +void __glXDispSwap_BlendColor(GLbyte * pc) +{ + CALL_BlendColor( GET_DISPATCH(), ( + (GLclampf)bswap_FLOAT32( pc + 0 ), + (GLclampf)bswap_FLOAT32( pc + 4 ), + (GLclampf)bswap_FLOAT32( pc + 8 ), + (GLclampf)bswap_FLOAT32( pc + 12 ) + ) ); +} + +void __glXDispSwap_BlendEquation(GLbyte * pc) +{ + CALL_BlendEquation( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ) + ) ); +} + +void __glXDispSwap_ColorTable(GLbyte * pc) +{ + const GLvoid * const table = (const GLvoid *) (pc + 40); + __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); + + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); + + CALL_ColorTable( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 20 ), + (GLenum )bswap_ENUM ( pc + 24 ), + (GLsizei )bswap_CARD32 ( pc + 28 ), + (GLenum )bswap_ENUM ( pc + 32 ), + (GLenum )bswap_ENUM ( pc + 36 ), + table + ) ); +} + +void __glXDispSwap_ColorTableParameterfv(GLbyte * pc) +{ + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + const GLfloat * params; + + params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glColorTableParameterfv_size(pname) ); + + CALL_ColorTableParameterfv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); +} + +void __glXDispSwap_ColorTableParameteriv(GLbyte * pc) +{ + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + const GLint * params; + + params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glColorTableParameteriv_size(pname) ); + + CALL_ColorTableParameteriv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); +} + +void __glXDispSwap_CopyColorTable(GLbyte * pc) +{ + CALL_CopyColorTable( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ), + (GLint )bswap_CARD32 ( pc + 8 ), + (GLint )bswap_CARD32 ( pc + 12 ), + (GLsizei )bswap_CARD32 ( pc + 16 ) + ) ); +} + +int __glXDispSwap_GetColorTableParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetColorTableParameterfv_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetColorTableParameterfv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetColorTableParameterfvSGI(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetColorTableParameterfv_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetColorTableParameterfv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetColorTableParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetColorTableParameteriv_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetColorTableParameteriv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetColorTableParameterivSGI(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetColorTableParameteriv_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetColorTableParameteriv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +void __glXDispSwap_ColorSubTable(GLbyte * pc) +{ + const GLvoid * const data = (const GLvoid *) (pc + 40); + __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); + + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); + + CALL_ColorSubTable( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 20 ), + (GLsizei )bswap_CARD32 ( pc + 24 ), + (GLsizei )bswap_CARD32 ( pc + 28 ), + (GLenum )bswap_ENUM ( pc + 32 ), + (GLenum )bswap_ENUM ( pc + 36 ), + data + ) ); +} + +void __glXDispSwap_CopyColorSubTable(GLbyte * pc) +{ + CALL_CopyColorSubTable( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLsizei )bswap_CARD32 ( pc + 4 ), + (GLint )bswap_CARD32 ( pc + 8 ), + (GLint )bswap_CARD32 ( pc + 12 ), + (GLsizei )bswap_CARD32 ( pc + 16 ) + ) ); +} + +void __glXDispSwap_ConvolutionFilter1D(GLbyte * pc) +{ + const GLvoid * const image = (const GLvoid *) (pc + 44); + __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); + + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); + + CALL_ConvolutionFilter1D( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 20 ), + (GLenum )bswap_ENUM ( pc + 24 ), + (GLsizei )bswap_CARD32 ( pc + 28 ), + (GLenum )bswap_ENUM ( pc + 36 ), + (GLenum )bswap_ENUM ( pc + 40 ), + image + ) ); +} + +void __glXDispSwap_ConvolutionFilter2D(GLbyte * pc) +{ + const GLvoid * const image = (const GLvoid *) (pc + 44); + __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); + + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); + + CALL_ConvolutionFilter2D( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 20 ), + (GLenum )bswap_ENUM ( pc + 24 ), + (GLsizei )bswap_CARD32 ( pc + 28 ), + (GLsizei )bswap_CARD32 ( pc + 32 ), + (GLenum )bswap_ENUM ( pc + 36 ), + (GLenum )bswap_ENUM ( pc + 40 ), + image + ) ); +} + +void __glXDispSwap_ConvolutionParameterf(GLbyte * pc) +{ + CALL_ConvolutionParameterf( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ), + (GLfloat )bswap_FLOAT32( pc + 8 ) + ) ); +} + +void __glXDispSwap_ConvolutionParameterfv(GLbyte * pc) +{ + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + const GLfloat * params; + + params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glConvolutionParameterfv_size(pname) ); + + CALL_ConvolutionParameterfv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); +} + +void __glXDispSwap_ConvolutionParameteri(GLbyte * pc) +{ + CALL_ConvolutionParameteri( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ), + (GLint )bswap_CARD32 ( pc + 8 ) + ) ); +} + +void __glXDispSwap_ConvolutionParameteriv(GLbyte * pc) +{ + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + const GLint * params; + + params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glConvolutionParameteriv_size(pname) ); + + CALL_ConvolutionParameteriv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); +} + +void __glXDispSwap_CopyConvolutionFilter1D(GLbyte * pc) +{ + CALL_CopyConvolutionFilter1D( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ), + (GLint )bswap_CARD32 ( pc + 8 ), + (GLint )bswap_CARD32 ( pc + 12 ), + (GLsizei )bswap_CARD32 ( pc + 16 ) + ) ); +} + +void __glXDispSwap_CopyConvolutionFilter2D(GLbyte * pc) +{ + CALL_CopyConvolutionFilter2D( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ), + (GLint )bswap_CARD32 ( pc + 8 ), + (GLint )bswap_CARD32 ( pc + 12 ), + (GLsizei )bswap_CARD32 ( pc + 16 ), + (GLsizei )bswap_CARD32 ( pc + 20 ) + ) ); +} + +int __glXDispSwap_GetConvolutionParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetConvolutionParameterfv_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetConvolutionParameterfv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetConvolutionParameterfvEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetConvolutionParameterfv_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetConvolutionParameterfv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetConvolutionParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetConvolutionParameteriv_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetConvolutionParameteriv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetConvolutionParameterivEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetConvolutionParameteriv_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetConvolutionParameteriv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetHistogramParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetHistogramParameterfv_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetHistogramParameterfv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetHistogramParameterfvEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetHistogramParameterfv_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetHistogramParameterfv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetHistogramParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetHistogramParameteriv_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetHistogramParameteriv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetHistogramParameterivEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetHistogramParameteriv_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetHistogramParameteriv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetMinmaxParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetMinmaxParameterfv_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetMinmaxParameterfv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetMinmaxParameterfvEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetMinmaxParameterfv_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetMinmaxParameterfv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetMinmaxParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetMinmaxParameteriv_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetMinmaxParameteriv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetMinmaxParameterivEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetMinmaxParameteriv_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetMinmaxParameteriv( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +void __glXDispSwap_Histogram(GLbyte * pc) +{ + CALL_Histogram( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLsizei )bswap_CARD32 ( pc + 4 ), + (GLenum )bswap_ENUM ( pc + 8 ), + *(GLboolean *)(pc + 12) + ) ); +} + +void __glXDispSwap_Minmax(GLbyte * pc) +{ + CALL_Minmax( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ), + *(GLboolean *)(pc + 8) + ) ); +} + +void __glXDispSwap_ResetHistogram(GLbyte * pc) +{ + CALL_ResetHistogram( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ) + ) ); +} + +void __glXDispSwap_ResetMinmax(GLbyte * pc) +{ + CALL_ResetMinmax( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ) + ) ); +} + +void __glXDispSwap_TexImage3D(GLbyte * pc) +{ + const CARD32 ptr_is_null = *(CARD32 *)(pc + 76); + const GLvoid * const pixels = (const GLvoid *) (ptr_is_null != 0) ? NULL : (pc + 80); + __GLXpixel3DHeader * const hdr = (__GLXpixel3DHeader *)(pc); + + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_IMAGE_HEIGHT, (GLint) bswap_CARD32( & hdr->imageHeight )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_IMAGES, (GLint) bswap_CARD32( & hdr->skipImages )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); + + CALL_TexImage3D( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 36 ), + (GLint )bswap_CARD32 ( pc + 40 ), + (GLint )bswap_CARD32 ( pc + 44 ), + (GLsizei )bswap_CARD32 ( pc + 48 ), + (GLsizei )bswap_CARD32 ( pc + 52 ), + (GLsizei )bswap_CARD32 ( pc + 56 ), + (GLint )bswap_CARD32 ( pc + 64 ), + (GLenum )bswap_ENUM ( pc + 68 ), + (GLenum )bswap_ENUM ( pc + 72 ), + pixels + ) ); +} + +void __glXDispSwap_TexSubImage3D(GLbyte * pc) +{ + const CARD32 ptr_is_null = *(CARD32 *)(pc + 84); + const GLvoid * const pixels = (const GLvoid *) (ptr_is_null != 0) ? NULL : (pc + 88); + __GLXpixel3DHeader * const hdr = (__GLXpixel3DHeader *)(pc); + + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_IMAGE_HEIGHT, (GLint) bswap_CARD32( & hdr->imageHeight )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_IMAGES, (GLint) bswap_CARD32( & hdr->skipImages )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); + + CALL_TexSubImage3D( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 36 ), + (GLint )bswap_CARD32 ( pc + 40 ), + (GLint )bswap_CARD32 ( pc + 44 ), + (GLint )bswap_CARD32 ( pc + 48 ), + (GLint )bswap_CARD32 ( pc + 52 ), + (GLsizei )bswap_CARD32 ( pc + 60 ), + (GLsizei )bswap_CARD32 ( pc + 64 ), + (GLsizei )bswap_CARD32 ( pc + 68 ), + (GLenum )bswap_ENUM ( pc + 76 ), + (GLenum )bswap_ENUM ( pc + 80 ), + pixels + ) ); +} + +void __glXDispSwap_CopyTexSubImage3D(GLbyte * pc) +{ + CALL_CopyTexSubImage3D( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLint )bswap_CARD32 ( pc + 4 ), + (GLint )bswap_CARD32 ( pc + 8 ), + (GLint )bswap_CARD32 ( pc + 12 ), + (GLint )bswap_CARD32 ( pc + 16 ), + (GLint )bswap_CARD32 ( pc + 20 ), + (GLint )bswap_CARD32 ( pc + 24 ), + (GLsizei )bswap_CARD32 ( pc + 28 ), + (GLsizei )bswap_CARD32 ( pc + 32 ) + ) ); +} + +void __glXDispSwap_ActiveTextureARB(GLbyte * pc) +{ + CALL_ActiveTextureARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ) + ) ); +} + +void __glXDispSwap_MultiTexCoord1dvARB(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 12); + pc -= 4; + } +#endif + + CALL_MultiTexCoord1dvARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 8 ), + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 1 ) + ) ); +} + +void __glXDispSwap_MultiTexCoord1fvARB(GLbyte * pc) +{ + CALL_MultiTexCoord1fvARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 1 ) + ) ); +} + +void __glXDispSwap_MultiTexCoord1ivARB(GLbyte * pc) +{ + CALL_MultiTexCoord1ivARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (const GLint *)bswap_32_array( (uint32_t *) (pc + 4), 1 ) + ) ); +} + +void __glXDispSwap_MultiTexCoord1svARB(GLbyte * pc) +{ + CALL_MultiTexCoord1svARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 1 ) + ) ); +} + +void __glXDispSwap_MultiTexCoord2dvARB(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 20); + pc -= 4; + } +#endif + + CALL_MultiTexCoord2dvARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 16 ), + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 2 ) + ) ); +} + +void __glXDispSwap_MultiTexCoord2fvARB(GLbyte * pc) +{ + CALL_MultiTexCoord2fvARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 2 ) + ) ); +} + +void __glXDispSwap_MultiTexCoord2ivARB(GLbyte * pc) +{ + CALL_MultiTexCoord2ivARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (const GLint *)bswap_32_array( (uint32_t *) (pc + 4), 2 ) + ) ); +} + +void __glXDispSwap_MultiTexCoord2svARB(GLbyte * pc) +{ + CALL_MultiTexCoord2svARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 2 ) + ) ); +} + +void __glXDispSwap_MultiTexCoord3dvARB(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 28); + pc -= 4; + } +#endif + + CALL_MultiTexCoord3dvARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 24 ), + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 ) + ) ); +} + +void __glXDispSwap_MultiTexCoord3fvARB(GLbyte * pc) +{ + CALL_MultiTexCoord3fvARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 3 ) + ) ); +} + +void __glXDispSwap_MultiTexCoord3ivARB(GLbyte * pc) +{ + CALL_MultiTexCoord3ivARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (const GLint *)bswap_32_array( (uint32_t *) (pc + 4), 3 ) + ) ); +} + +void __glXDispSwap_MultiTexCoord3svARB(GLbyte * pc) +{ + CALL_MultiTexCoord3svARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 3 ) + ) ); +} + +void __glXDispSwap_MultiTexCoord4dvARB(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 36); + pc -= 4; + } +#endif + + CALL_MultiTexCoord4dvARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 32 ), + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 ) + ) ); +} + +void __glXDispSwap_MultiTexCoord4fvARB(GLbyte * pc) +{ + CALL_MultiTexCoord4fvARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 4 ) + ) ); +} + +void __glXDispSwap_MultiTexCoord4ivARB(GLbyte * pc) +{ + CALL_MultiTexCoord4ivARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (const GLint *)bswap_32_array( (uint32_t *) (pc + 4), 4 ) + ) ); +} + +void __glXDispSwap_MultiTexCoord4svARB(GLbyte * pc) +{ + CALL_MultiTexCoord4svARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 4 ) + ) ); +} + +void __glXDispSwap_SampleCoverageARB(GLbyte * pc) +{ + CALL_SampleCoverageARB( GET_DISPATCH(), ( + (GLclampf)bswap_FLOAT32( pc + 0 ), + *(GLboolean *)(pc + 4) + ) ); +} + +void __glXDispSwap_CompressedTexImage1DARB(GLbyte * pc) +{ + const GLsizei imageSize = (GLsizei )bswap_CARD32 ( pc + 20 ); + + CALL_CompressedTexImage1DARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLint )bswap_CARD32 ( pc + 4 ), + (GLenum )bswap_ENUM ( pc + 8 ), + (GLsizei )bswap_CARD32 ( pc + 12 ), + (GLint )bswap_CARD32 ( pc + 16 ), + imageSize, + (const GLvoid *)(pc + 24) + ) ); +} + +void __glXDispSwap_CompressedTexImage2DARB(GLbyte * pc) +{ + const GLsizei imageSize = (GLsizei )bswap_CARD32 ( pc + 24 ); + + CALL_CompressedTexImage2DARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLint )bswap_CARD32 ( pc + 4 ), + (GLenum )bswap_ENUM ( pc + 8 ), + (GLsizei )bswap_CARD32 ( pc + 12 ), + (GLsizei )bswap_CARD32 ( pc + 16 ), + (GLint )bswap_CARD32 ( pc + 20 ), + imageSize, + (const GLvoid *)(pc + 28) + ) ); +} + +void __glXDispSwap_CompressedTexImage3DARB(GLbyte * pc) +{ + const GLsizei imageSize = (GLsizei )bswap_CARD32 ( pc + 28 ); + + CALL_CompressedTexImage3DARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLint )bswap_CARD32 ( pc + 4 ), + (GLenum )bswap_ENUM ( pc + 8 ), + (GLsizei )bswap_CARD32 ( pc + 12 ), + (GLsizei )bswap_CARD32 ( pc + 16 ), + (GLsizei )bswap_CARD32 ( pc + 20 ), + (GLint )bswap_CARD32 ( pc + 24 ), + imageSize, + (const GLvoid *)(pc + 32) + ) ); +} + +void __glXDispSwap_CompressedTexSubImage1DARB(GLbyte * pc) +{ + const GLsizei imageSize = (GLsizei )bswap_CARD32 ( pc + 20 ); + + CALL_CompressedTexSubImage1DARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLint )bswap_CARD32 ( pc + 4 ), + (GLint )bswap_CARD32 ( pc + 8 ), + (GLsizei )bswap_CARD32 ( pc + 12 ), + (GLenum )bswap_ENUM ( pc + 16 ), + imageSize, + (const GLvoid *)(pc + 24) + ) ); +} + +void __glXDispSwap_CompressedTexSubImage2DARB(GLbyte * pc) +{ + const GLsizei imageSize = (GLsizei )bswap_CARD32 ( pc + 28 ); + + CALL_CompressedTexSubImage2DARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLint )bswap_CARD32 ( pc + 4 ), + (GLint )bswap_CARD32 ( pc + 8 ), + (GLint )bswap_CARD32 ( pc + 12 ), + (GLsizei )bswap_CARD32 ( pc + 16 ), + (GLsizei )bswap_CARD32 ( pc + 20 ), + (GLenum )bswap_ENUM ( pc + 24 ), + imageSize, + (const GLvoid *)(pc + 32) + ) ); +} + +void __glXDispSwap_CompressedTexSubImage3DARB(GLbyte * pc) +{ + const GLsizei imageSize = (GLsizei )bswap_CARD32 ( pc + 36 ); + + CALL_CompressedTexSubImage3DARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLint )bswap_CARD32 ( pc + 4 ), + (GLint )bswap_CARD32 ( pc + 8 ), + (GLint )bswap_CARD32 ( pc + 12 ), + (GLint )bswap_CARD32 ( pc + 16 ), + (GLsizei )bswap_CARD32 ( pc + 20 ), + (GLsizei )bswap_CARD32 ( pc + 24 ), + (GLsizei )bswap_CARD32 ( pc + 28 ), + (GLenum )bswap_ENUM ( pc + 32 ), + imageSize, + (const GLvoid *)(pc + 40) + ) ); +} + +int __glXDispSwap_GetProgramEnvParameterdvARB(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + GLdouble params[4]; + CALL_GetProgramEnvParameterdvARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLuint )bswap_CARD32 ( pc + 4 ), + params + ) ); + (void) bswap_64_array( (uint64_t *) params, 4 ); + __glXSendReplySwap(cl->client, params, 4, 8, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetProgramEnvParameterfvARB(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + GLfloat params[4]; + CALL_GetProgramEnvParameterfvARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLuint )bswap_CARD32 ( pc + 4 ), + params + ) ); + (void) bswap_32_array( (uint32_t *) params, 4 ); + __glXSendReplySwap(cl->client, params, 4, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetProgramLocalParameterdvARB(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + GLdouble params[4]; + CALL_GetProgramLocalParameterdvARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLuint )bswap_CARD32 ( pc + 4 ), + params + ) ); + (void) bswap_64_array( (uint64_t *) params, 4 ); + __glXSendReplySwap(cl->client, params, 4, 8, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetProgramLocalParameterfvARB(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + GLfloat params[4]; + CALL_GetProgramLocalParameterfvARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLuint )bswap_CARD32 ( pc + 4 ), + params + ) ); + (void) bswap_32_array( (uint32_t *) params, 4 ); + __glXSendReplySwap(cl->client, params, 4, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetProgramivARB(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetProgramivARB_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetProgramivARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetVertexAttribdvARB(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetVertexAttribdvARB_size(pname); + GLdouble answerBuffer[200]; + GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetVertexAttribdvARB( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + pname, + params + ) ); + (void) bswap_64_array( (uint64_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 8, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetVertexAttribfvARB(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetVertexAttribfvARB_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetVertexAttribfvARB( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetVertexAttribivARB(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetVertexAttribivARB_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetVertexAttribivARB( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +void __glXDispSwap_ProgramEnvParameter4dvARB(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 40); + pc -= 4; + } +#endif + + CALL_ProgramEnvParameter4dvARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLuint )bswap_CARD32 ( pc + 4 ), + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 4 ) + ) ); +} + +void __glXDispSwap_ProgramEnvParameter4fvARB(GLbyte * pc) +{ + CALL_ProgramEnvParameter4fvARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLuint )bswap_CARD32 ( pc + 4 ), + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 4 ) + ) ); +} + +void __glXDispSwap_ProgramLocalParameter4dvARB(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 40); + pc -= 4; + } +#endif + + CALL_ProgramLocalParameter4dvARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLuint )bswap_CARD32 ( pc + 4 ), + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 4 ) + ) ); +} + +void __glXDispSwap_ProgramLocalParameter4fvARB(GLbyte * pc) +{ + CALL_ProgramLocalParameter4fvARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLuint )bswap_CARD32 ( pc + 4 ), + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 4 ) + ) ); +} + +void __glXDispSwap_ProgramStringARB(GLbyte * pc) +{ + const GLsizei len = (GLsizei )bswap_CARD32 ( pc + 8 ); + + CALL_ProgramStringARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ), + len, + (const GLvoid *)(pc + 12) + ) ); +} + +void __glXDispSwap_VertexAttrib1dvARB(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 12); + pc -= 4; + } +#endif + + CALL_VertexAttrib1dvARB( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 1 ) + ) ); +} + +void __glXDispSwap_VertexAttrib1fvARB(GLbyte * pc) +{ + CALL_VertexAttrib1fvARB( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 1 ) + ) ); +} + +void __glXDispSwap_VertexAttrib1svARB(GLbyte * pc) +{ + CALL_VertexAttrib1svARB( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 1 ) + ) ); +} + +void __glXDispSwap_VertexAttrib2dvARB(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 20); + pc -= 4; + } +#endif + + CALL_VertexAttrib2dvARB( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 2 ) + ) ); +} + +void __glXDispSwap_VertexAttrib2fvARB(GLbyte * pc) +{ + CALL_VertexAttrib2fvARB( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 2 ) + ) ); +} + +void __glXDispSwap_VertexAttrib2svARB(GLbyte * pc) +{ + CALL_VertexAttrib2svARB( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 2 ) + ) ); +} + +void __glXDispSwap_VertexAttrib3dvARB(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 28); + pc -= 4; + } +#endif + + CALL_VertexAttrib3dvARB( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 3 ) + ) ); +} + +void __glXDispSwap_VertexAttrib3fvARB(GLbyte * pc) +{ + CALL_VertexAttrib3fvARB( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 3 ) + ) ); +} + +void __glXDispSwap_VertexAttrib3svARB(GLbyte * pc) +{ + CALL_VertexAttrib3svARB( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 3 ) + ) ); +} + +void __glXDispSwap_VertexAttrib4NbvARB(GLbyte * pc) +{ + CALL_VertexAttrib4NbvARB( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLbyte *)(pc + 4) + ) ); +} + +void __glXDispSwap_VertexAttrib4NivARB(GLbyte * pc) +{ + CALL_VertexAttrib4NivARB( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLint *)bswap_32_array( (uint32_t *) (pc + 4), 4 ) + ) ); +} + +void __glXDispSwap_VertexAttrib4NsvARB(GLbyte * pc) +{ + CALL_VertexAttrib4NsvARB( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 4 ) + ) ); +} + +void __glXDispSwap_VertexAttrib4NubvARB(GLbyte * pc) +{ + CALL_VertexAttrib4NubvARB( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLubyte *)(pc + 4) + ) ); +} + +void __glXDispSwap_VertexAttrib4NuivARB(GLbyte * pc) +{ + CALL_VertexAttrib4NuivARB( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 4 ) + ) ); +} + +void __glXDispSwap_VertexAttrib4NusvARB(GLbyte * pc) +{ + CALL_VertexAttrib4NusvARB( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLushort *)bswap_16_array( (uint16_t *) (pc + 4), 4 ) + ) ); +} + +void __glXDispSwap_VertexAttrib4bvARB(GLbyte * pc) +{ + CALL_VertexAttrib4bvARB( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLbyte *)(pc + 4) + ) ); +} + +void __glXDispSwap_VertexAttrib4dvARB(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 36); + pc -= 4; + } +#endif + + CALL_VertexAttrib4dvARB( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 4 ) + ) ); +} + +void __glXDispSwap_VertexAttrib4fvARB(GLbyte * pc) +{ + CALL_VertexAttrib4fvARB( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 4 ) + ) ); +} + +void __glXDispSwap_VertexAttrib4ivARB(GLbyte * pc) +{ + CALL_VertexAttrib4ivARB( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLint *)bswap_32_array( (uint32_t *) (pc + 4), 4 ) + ) ); +} + +void __glXDispSwap_VertexAttrib4svARB(GLbyte * pc) +{ + CALL_VertexAttrib4svARB( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 4 ) + ) ); +} + +void __glXDispSwap_VertexAttrib4ubvARB(GLbyte * pc) +{ + CALL_VertexAttrib4ubvARB( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLubyte *)(pc + 4) + ) ); +} + +void __glXDispSwap_VertexAttrib4uivARB(GLbyte * pc) +{ + CALL_VertexAttrib4uivARB( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 4 ) + ) ); +} + +void __glXDispSwap_VertexAttrib4usvARB(GLbyte * pc) +{ + CALL_VertexAttrib4usvARB( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLushort *)bswap_16_array( (uint16_t *) (pc + 4), 4 ) + ) ); +} + +void __glXDispSwap_BeginQueryARB(GLbyte * pc) +{ + CALL_BeginQueryARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLuint )bswap_CARD32 ( pc + 4 ) + ) ); +} + +int __glXDispSwap_DeleteQueriesARB(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); + + CALL_DeleteQueriesARB( GET_DISPATCH(), ( + n, + (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ) + ) ); + error = Success; + } + + return error; +} + +void __glXDispSwap_EndQueryARB(GLbyte * pc) +{ + CALL_EndQueryARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ) + ) ); +} + +int __glXDispSwap_GenQueriesARB(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); + + GLuint answerBuffer[200]; + GLuint * ids = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); + CALL_GenQueriesARB( GET_DISPATCH(), ( + n, + ids + ) ); + (void) bswap_32_array( (uint32_t *) ids, n ); + __glXSendReplySwap(cl->client, ids, n, 4, GL_TRUE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetQueryObjectivARB(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetQueryObjectivARB_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetQueryObjectivARB( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetQueryObjectuivARB(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetQueryObjectuivARB_size(pname); + GLuint answerBuffer[200]; + GLuint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetQueryObjectuivARB( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetQueryivARB(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetQueryivARB_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetQueryivARB( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_IsQueryARB(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + GLboolean retval; + retval = CALL_IsQueryARB( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ) + ) ); + __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); + error = Success; + } + + return error; +} + +void __glXDispSwap_DrawBuffersARB(GLbyte * pc) +{ + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); + + CALL_DrawBuffersARB( GET_DISPATCH(), ( + n, + (const GLenum *)bswap_32_array( (uint32_t *) (pc + 4), 0 ) + ) ); +} + +void __glXDispSwap_SampleMaskSGIS(GLbyte * pc) +{ + CALL_SampleMaskSGIS( GET_DISPATCH(), ( + (GLclampf)bswap_FLOAT32( pc + 0 ), + *(GLboolean *)(pc + 4) + ) ); +} + +void __glXDispSwap_SamplePatternSGIS(GLbyte * pc) +{ + CALL_SamplePatternSGIS( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ) + ) ); +} + +void __glXDispSwap_PointParameterfEXT(GLbyte * pc) +{ + CALL_PointParameterfEXT( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLfloat )bswap_FLOAT32( pc + 4 ) + ) ); +} + +void __glXDispSwap_PointParameterfvEXT(GLbyte * pc) +{ + const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 ); + const GLfloat * params; + + params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 4), __glPointParameterfvEXT_size(pname) ); + + CALL_PointParameterfvEXT( GET_DISPATCH(), ( + pname, + params + ) ); +} + +void __glXDispSwap_SecondaryColor3bvEXT(GLbyte * pc) +{ + CALL_SecondaryColor3bvEXT( GET_DISPATCH(), ( + (const GLbyte *)(pc + 0) + ) ); +} + +void __glXDispSwap_SecondaryColor3dvEXT(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 24); + pc -= 4; + } +#endif + + CALL_SecondaryColor3dvEXT( GET_DISPATCH(), ( + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 ) + ) ); +} + +void __glXDispSwap_SecondaryColor3fvEXT(GLbyte * pc) +{ + CALL_SecondaryColor3fvEXT( GET_DISPATCH(), ( + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) + ) ); +} + +void __glXDispSwap_SecondaryColor3ivEXT(GLbyte * pc) +{ + CALL_SecondaryColor3ivEXT( GET_DISPATCH(), ( + (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) + ) ); +} + +void __glXDispSwap_SecondaryColor3svEXT(GLbyte * pc) +{ + CALL_SecondaryColor3svEXT( GET_DISPATCH(), ( + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 3 ) + ) ); +} + +void __glXDispSwap_SecondaryColor3ubvEXT(GLbyte * pc) +{ + CALL_SecondaryColor3ubvEXT( GET_DISPATCH(), ( + (const GLubyte *)(pc + 0) + ) ); +} + +void __glXDispSwap_SecondaryColor3uivEXT(GLbyte * pc) +{ + CALL_SecondaryColor3uivEXT( GET_DISPATCH(), ( + (const GLuint *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) + ) ); +} + +void __glXDispSwap_SecondaryColor3usvEXT(GLbyte * pc) +{ + CALL_SecondaryColor3usvEXT( GET_DISPATCH(), ( + (const GLushort *)bswap_16_array( (uint16_t *) (pc + 0), 3 ) + ) ); +} + +void __glXDispSwap_FogCoorddvEXT(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 8); + pc -= 4; + } +#endif + + CALL_FogCoorddvEXT( GET_DISPATCH(), ( + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 1 ) + ) ); +} + +void __glXDispSwap_FogCoordfvEXT(GLbyte * pc) +{ + CALL_FogCoordfvEXT( GET_DISPATCH(), ( + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 1 ) + ) ); +} + +void __glXDispSwap_BlendFuncSeparateEXT(GLbyte * pc) +{ + CALL_BlendFuncSeparateEXT( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ), + (GLenum )bswap_ENUM ( pc + 8 ), + (GLenum )bswap_ENUM ( pc + 12 ) + ) ); +} + +void __glXDispSwap_WindowPos3fvMESA(GLbyte * pc) +{ + CALL_WindowPos3fvMESA( GET_DISPATCH(), ( + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) + ) ); +} + +int __glXDispSwap_AreProgramsResidentNV(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); + + GLboolean retval; + GLboolean answerBuffer[200]; + GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1); + retval = CALL_AreProgramsResidentNV( GET_DISPATCH(), ( + n, + (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ), + residences + ) ); + __glXSendReplySwap(cl->client, residences, n, 1, GL_FALSE, retval); + error = Success; + } + + return error; +} + +void __glXDispSwap_BindProgramNV(GLbyte * pc) +{ + CALL_BindProgramNV( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLuint )bswap_CARD32 ( pc + 4 ) + ) ); +} + +int __glXDispSwap_DeleteProgramsNV(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); + + CALL_DeleteProgramsNV( GET_DISPATCH(), ( + n, + (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ) + ) ); + error = Success; + } + + return error; +} + +void __glXDispSwap_ExecuteProgramNV(GLbyte * pc) +{ + CALL_ExecuteProgramNV( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLuint )bswap_CARD32 ( pc + 4 ), + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 4 ) + ) ); +} + +int __glXDispSwap_GenProgramsNV(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); + + GLuint answerBuffer[200]; + GLuint * programs = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); + CALL_GenProgramsNV( GET_DISPATCH(), ( + n, + programs + ) ); + (void) bswap_32_array( (uint32_t *) programs, n ); + __glXSendReplySwap(cl->client, programs, n, 4, GL_TRUE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetProgramParameterdvNV(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + GLdouble params[4]; + CALL_GetProgramParameterdvNV( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLuint )bswap_CARD32 ( pc + 4 ), + (GLenum )bswap_ENUM ( pc + 8 ), + params + ) ); + (void) bswap_64_array( (uint64_t *) params, 4 ); + __glXSendReplySwap(cl->client, params, 4, 8, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetProgramParameterfvNV(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + GLfloat params[4]; + CALL_GetProgramParameterfvNV( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLuint )bswap_CARD32 ( pc + 4 ), + (GLenum )bswap_ENUM ( pc + 8 ), + params + ) ); + (void) bswap_32_array( (uint32_t *) params, 4 ); + __glXSendReplySwap(cl->client, params, 4, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetProgramivNV(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetProgramivNV_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetProgramivNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetTrackMatrixivNV(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + GLint params[1]; + CALL_GetTrackMatrixivNV( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLuint )bswap_CARD32 ( pc + 4 ), + (GLenum )bswap_ENUM ( pc + 8 ), + params + ) ); + (void) bswap_32_array( (uint32_t *) params, 1 ); + __glXSendReplySwap(cl->client, params, 1, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetVertexAttribdvNV(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetVertexAttribdvNV_size(pname); + GLdouble answerBuffer[200]; + GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetVertexAttribdvNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + pname, + params + ) ); + (void) bswap_64_array( (uint64_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 8, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetVertexAttribfvNV(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetVertexAttribfvNV_size(pname); + GLfloat answerBuffer[200]; + GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetVertexAttribfvNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetVertexAttribivNV(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); + + const GLuint compsize = __glGetVertexAttribivNV_size(pname); + GLint answerBuffer[200]; + GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); + + if (params == NULL) return BadAlloc; + __glXClearErrorOccured(); + + CALL_GetVertexAttribivNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + pname, + params + ) ); + (void) bswap_32_array( (uint32_t *) params, compsize ); + __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_IsProgramNV(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + GLboolean retval; + retval = CALL_IsProgramNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ) + ) ); + __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); + error = Success; + } + + return error; +} + +void __glXDispSwap_LoadProgramNV(GLbyte * pc) +{ + const GLsizei len = (GLsizei )bswap_CARD32 ( pc + 8 ); + + CALL_LoadProgramNV( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLuint )bswap_CARD32 ( pc + 4 ), + len, + (const GLubyte *)(pc + 12) + ) ); +} + +void __glXDispSwap_ProgramParameter4dvNV(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 40); + pc -= 4; + } +#endif + + CALL_ProgramParameter4dvNV( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLuint )bswap_CARD32 ( pc + 4 ), + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 4 ) + ) ); +} + +void __glXDispSwap_ProgramParameter4fvNV(GLbyte * pc) +{ + CALL_ProgramParameter4fvNV( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLuint )bswap_CARD32 ( pc + 4 ), + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 4 ) + ) ); +} + +void __glXDispSwap_ProgramParameters4dvNV(GLbyte * pc) +{ + const GLuint num = (GLuint )bswap_CARD32 ( pc + 8 ); + +#ifdef __GLX_ALIGN64 + const GLuint cmdlen = 16 + __GLX_PAD((num * 32)) - 4; + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, cmdlen); + pc -= 4; + } +#endif + + CALL_ProgramParameters4dvNV( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLuint )bswap_CARD32 ( pc + 4 ), + num, + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 12), 0 ) + ) ); +} + +void __glXDispSwap_ProgramParameters4fvNV(GLbyte * pc) +{ + const GLuint num = (GLuint )bswap_CARD32 ( pc + 8 ); + + CALL_ProgramParameters4fvNV( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLuint )bswap_CARD32 ( pc + 4 ), + num, + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 12), 0 ) + ) ); +} + +void __glXDispSwap_RequestResidentProgramsNV(GLbyte * pc) +{ + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); + + CALL_RequestResidentProgramsNV( GET_DISPATCH(), ( + n, + (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ) + ) ); +} + +void __glXDispSwap_TrackMatrixNV(GLbyte * pc) +{ + CALL_TrackMatrixNV( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLuint )bswap_CARD32 ( pc + 4 ), + (GLenum )bswap_ENUM ( pc + 8 ), + (GLenum )bswap_ENUM ( pc + 12 ) + ) ); +} + +void __glXDispSwap_VertexAttrib1dvNV(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 12); + pc -= 4; + } +#endif + + CALL_VertexAttrib1dvNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 1 ) + ) ); +} + +void __glXDispSwap_VertexAttrib1fvNV(GLbyte * pc) +{ + CALL_VertexAttrib1fvNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 1 ) + ) ); +} + +void __glXDispSwap_VertexAttrib1svNV(GLbyte * pc) +{ + CALL_VertexAttrib1svNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 1 ) + ) ); +} + +void __glXDispSwap_VertexAttrib2dvNV(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 20); + pc -= 4; + } +#endif + + CALL_VertexAttrib2dvNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 2 ) + ) ); +} + +void __glXDispSwap_VertexAttrib2fvNV(GLbyte * pc) +{ + CALL_VertexAttrib2fvNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 2 ) + ) ); +} + +void __glXDispSwap_VertexAttrib2svNV(GLbyte * pc) +{ + CALL_VertexAttrib2svNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 2 ) + ) ); +} + +void __glXDispSwap_VertexAttrib3dvNV(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 28); + pc -= 4; + } +#endif + + CALL_VertexAttrib3dvNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 3 ) + ) ); +} + +void __glXDispSwap_VertexAttrib3fvNV(GLbyte * pc) +{ + CALL_VertexAttrib3fvNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 3 ) + ) ); +} + +void __glXDispSwap_VertexAttrib3svNV(GLbyte * pc) +{ + CALL_VertexAttrib3svNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 3 ) + ) ); +} + +void __glXDispSwap_VertexAttrib4dvNV(GLbyte * pc) +{ +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, 36); + pc -= 4; + } +#endif + + CALL_VertexAttrib4dvNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 4 ) + ) ); +} + +void __glXDispSwap_VertexAttrib4fvNV(GLbyte * pc) +{ + CALL_VertexAttrib4fvNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 4 ) + ) ); +} + +void __glXDispSwap_VertexAttrib4svNV(GLbyte * pc) +{ + CALL_VertexAttrib4svNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 4 ) + ) ); +} + +void __glXDispSwap_VertexAttrib4ubvNV(GLbyte * pc) +{ + CALL_VertexAttrib4ubvNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + (const GLubyte *)(pc + 4) + ) ); +} + +void __glXDispSwap_VertexAttribs1dvNV(GLbyte * pc) +{ + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); + +#ifdef __GLX_ALIGN64 + const GLuint cmdlen = 12 + __GLX_PAD((n * 8)) - 4; + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, cmdlen); + pc -= 4; + } +#endif + + CALL_VertexAttribs1dvNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + n, + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 0 ) + ) ); +} + +void __glXDispSwap_VertexAttribs1fvNV(GLbyte * pc) +{ + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); + + CALL_VertexAttribs1fvNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + n, + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 0 ) + ) ); +} + +void __glXDispSwap_VertexAttribs1svNV(GLbyte * pc) +{ + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); + + CALL_VertexAttribs1svNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + n, + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 8), 0 ) + ) ); +} + +void __glXDispSwap_VertexAttribs2dvNV(GLbyte * pc) +{ + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); + +#ifdef __GLX_ALIGN64 + const GLuint cmdlen = 12 + __GLX_PAD((n * 16)) - 4; + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, cmdlen); + pc -= 4; + } +#endif + + CALL_VertexAttribs2dvNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + n, + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 0 ) + ) ); +} + +void __glXDispSwap_VertexAttribs2fvNV(GLbyte * pc) +{ + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); + + CALL_VertexAttribs2fvNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + n, + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 0 ) + ) ); +} + +void __glXDispSwap_VertexAttribs2svNV(GLbyte * pc) +{ + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); + + CALL_VertexAttribs2svNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + n, + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 8), 0 ) + ) ); +} + +void __glXDispSwap_VertexAttribs3dvNV(GLbyte * pc) +{ + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); + +#ifdef __GLX_ALIGN64 + const GLuint cmdlen = 12 + __GLX_PAD((n * 24)) - 4; + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, cmdlen); + pc -= 4; + } +#endif + + CALL_VertexAttribs3dvNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + n, + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 0 ) + ) ); +} + +void __glXDispSwap_VertexAttribs3fvNV(GLbyte * pc) +{ + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); + + CALL_VertexAttribs3fvNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + n, + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 0 ) + ) ); +} + +void __glXDispSwap_VertexAttribs3svNV(GLbyte * pc) +{ + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); + + CALL_VertexAttribs3svNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + n, + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 8), 0 ) + ) ); +} + +void __glXDispSwap_VertexAttribs4dvNV(GLbyte * pc) +{ + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); + +#ifdef __GLX_ALIGN64 + const GLuint cmdlen = 12 + __GLX_PAD((n * 32)) - 4; + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, cmdlen); + pc -= 4; + } +#endif + + CALL_VertexAttribs4dvNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + n, + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 0 ) + ) ); +} + +void __glXDispSwap_VertexAttribs4fvNV(GLbyte * pc) +{ + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); + + CALL_VertexAttribs4fvNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + n, + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 0 ) + ) ); +} + +void __glXDispSwap_VertexAttribs4svNV(GLbyte * pc) +{ + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); + + CALL_VertexAttribs4svNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + n, + (const GLshort *)bswap_16_array( (uint16_t *) (pc + 8), 0 ) + ) ); +} + +void __glXDispSwap_VertexAttribs4ubvNV(GLbyte * pc) +{ + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); + + CALL_VertexAttribs4ubvNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + n, + (const GLubyte *)(pc + 8) + ) ); +} + +void __glXDispSwap_PointParameteriNV(GLbyte * pc) +{ + CALL_PointParameteriNV( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLint )bswap_CARD32 ( pc + 4 ) + ) ); +} + +void __glXDispSwap_PointParameterivNV(GLbyte * pc) +{ + const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 ); + const GLint * params; + + params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 4), __glPointParameterivNV_size(pname) ); + + CALL_PointParameterivNV( GET_DISPATCH(), ( + pname, + params + ) ); +} + +void __glXDispSwap_ActiveStencilFaceEXT(GLbyte * pc) +{ + CALL_ActiveStencilFaceEXT( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ) + ) ); +} + +int __glXDispSwap_GetProgramNamedParameterdvNV(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLsizei len = (GLsizei )bswap_CARD32 ( pc + 4 ); + + GLdouble params[4]; + CALL_GetProgramNamedParameterdvNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + len, + (const GLubyte *)(pc + 8), + params + ) ); + (void) bswap_64_array( (uint64_t *) params, 4 ); + __glXSendReplySwap(cl->client, params, 4, 8, GL_TRUE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetProgramNamedParameterfvNV(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLsizei len = (GLsizei )bswap_CARD32 ( pc + 4 ); + + GLfloat params[4]; + CALL_GetProgramNamedParameterfvNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + len, + (const GLubyte *)(pc + 8), + params + ) ); + (void) bswap_32_array( (uint32_t *) params, 4 ); + __glXSendReplySwap(cl->client, params, 4, 4, GL_TRUE, 0); + error = Success; + } + + return error; +} + +void __glXDispSwap_ProgramNamedParameter4dvNV(GLbyte * pc) +{ + const GLsizei len = (GLsizei )bswap_CARD32 ( pc + 36 ); + +#ifdef __GLX_ALIGN64 + const GLuint cmdlen = 44 + __GLX_PAD(len) - 4; + if ((unsigned long)(pc) & 7) { + (void) memmove(pc-4, pc, cmdlen); + pc -= 4; + } +#endif + + CALL_ProgramNamedParameter4dvNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 32 ), + len, + (const GLubyte *)(pc + 40), + (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 ) + ) ); +} + +void __glXDispSwap_ProgramNamedParameter4fvNV(GLbyte * pc) +{ + const GLsizei len = (GLsizei )bswap_CARD32 ( pc + 4 ); + + CALL_ProgramNamedParameter4fvNV( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ), + len, + (const GLubyte *)(pc + 24), + (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 4 ) + ) ); +} + +void __glXDispSwap_BlendEquationSeparateEXT(GLbyte * pc) +{ + CALL_BlendEquationSeparateEXT( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ) + ) ); +} + +void __glXDispSwap_BindFramebufferEXT(GLbyte * pc) +{ + CALL_BindFramebufferEXT( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLuint )bswap_CARD32 ( pc + 4 ) + ) ); +} + +void __glXDispSwap_BindRenderbufferEXT(GLbyte * pc) +{ + CALL_BindRenderbufferEXT( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLuint )bswap_CARD32 ( pc + 4 ) + ) ); +} + +int __glXDispSwap_CheckFramebufferStatusEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + GLenum retval; + retval = CALL_CheckFramebufferStatusEXT( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ) + ) ); + __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); + error = Success; + } + + return error; +} + +void __glXDispSwap_DeleteFramebuffersEXT(GLbyte * pc) +{ + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); + + CALL_DeleteFramebuffersEXT( GET_DISPATCH(), ( + n, + (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ) + ) ); +} + +void __glXDispSwap_DeleteRenderbuffersEXT(GLbyte * pc) +{ + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); + + CALL_DeleteRenderbuffersEXT( GET_DISPATCH(), ( + n, + (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ) + ) ); +} + +void __glXDispSwap_FramebufferRenderbufferEXT(GLbyte * pc) +{ + CALL_FramebufferRenderbufferEXT( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ), + (GLenum )bswap_ENUM ( pc + 8 ), + (GLuint )bswap_CARD32 ( pc + 12 ) + ) ); +} + +void __glXDispSwap_FramebufferTexture1DEXT(GLbyte * pc) +{ + CALL_FramebufferTexture1DEXT( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ), + (GLenum )bswap_ENUM ( pc + 8 ), + (GLuint )bswap_CARD32 ( pc + 12 ), + (GLint )bswap_CARD32 ( pc + 16 ) + ) ); +} + +void __glXDispSwap_FramebufferTexture2DEXT(GLbyte * pc) +{ + CALL_FramebufferTexture2DEXT( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ), + (GLenum )bswap_ENUM ( pc + 8 ), + (GLuint )bswap_CARD32 ( pc + 12 ), + (GLint )bswap_CARD32 ( pc + 16 ) + ) ); +} + +void __glXDispSwap_FramebufferTexture3DEXT(GLbyte * pc) +{ + CALL_FramebufferTexture3DEXT( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ), + (GLenum )bswap_ENUM ( pc + 8 ), + (GLuint )bswap_CARD32 ( pc + 12 ), + (GLint )bswap_CARD32 ( pc + 16 ), + (GLint )bswap_CARD32 ( pc + 20 ) + ) ); +} + +int __glXDispSwap_GenFramebuffersEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); + + GLuint answerBuffer[200]; + GLuint * framebuffers = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); + CALL_GenFramebuffersEXT( GET_DISPATCH(), ( + n, + framebuffers + ) ); + (void) bswap_32_array( (uint32_t *) framebuffers, n ); + __glXSendReplySwap(cl->client, framebuffers, n, 4, GL_TRUE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GenRenderbuffersEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); + + GLuint answerBuffer[200]; + GLuint * renderbuffers = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); + CALL_GenRenderbuffersEXT( GET_DISPATCH(), ( + n, + renderbuffers + ) ); + (void) bswap_32_array( (uint32_t *) renderbuffers, n ); + __glXSendReplySwap(cl->client, renderbuffers, n, 4, GL_TRUE, 0); + error = Success; + } + + return error; +} + +void __glXDispSwap_GenerateMipmapEXT(GLbyte * pc) +{ + CALL_GenerateMipmapEXT( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ) + ) ); +} + +int __glXDispSwap_GetFramebufferAttachmentParameterivEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + GLint params[1]; + CALL_GetFramebufferAttachmentParameterivEXT( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ), + (GLenum )bswap_ENUM ( pc + 8 ), + params + ) ); + (void) bswap_32_array( (uint32_t *) params, 1 ); + __glXSendReplySwap(cl->client, params, 1, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_GetRenderbufferParameterivEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + GLint params[1]; + CALL_GetRenderbufferParameterivEXT( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ), + params + ) ); + (void) bswap_32_array( (uint32_t *) params, 1 ); + __glXSendReplySwap(cl->client, params, 1, 4, GL_FALSE, 0); + error = Success; + } + + return error; +} + +int __glXDispSwap_IsFramebufferEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + GLboolean retval; + retval = CALL_IsFramebufferEXT( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ) + ) ); + __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); + error = Success; + } + + return error; +} + +int __glXDispSwap_IsRenderbufferEXT(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); + + pc += __GLX_VENDPRIV_HDR_SIZE; + if ( cx != NULL ) { + GLboolean retval; + retval = CALL_IsRenderbufferEXT( GET_DISPATCH(), ( + (GLuint )bswap_CARD32 ( pc + 0 ) + ) ); + __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); + error = Success; + } + + return error; +} + +void __glXDispSwap_RenderbufferStorageEXT(GLbyte * pc) +{ + CALL_RenderbufferStorageEXT( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ), + (GLsizei )bswap_CARD32 ( pc + 8 ), + (GLsizei )bswap_CARD32 ( pc + 12 ) + ) ); +} + diff --git a/dist/Mesa/src/glx/x11/indirect_reqsize.c b/dist/Mesa/src/glx/x11/indirect_reqsize.c new file mode 100644 index 000000000..954eecd97 --- /dev/null +++ b/dist/Mesa/src/glx/x11/indirect_reqsize.c @@ -0,0 +1,832 @@ +/* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */ + +/* + * (C) Copyright IBM Corporation 2005 + * 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 + * IBM, + * 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. + */ + + +#include <GL/gl.h> +#include "glxserver.h" +#include "glxbyteorder.h" +#include "indirect_size.h" +#include "indirect_reqsize.h" + +#define __GLX_PAD(x) (((x) + 3) & ~3) + +#if defined(__CYGWIN__) || defined(__MINGW32__) +# undef HAVE_ALIAS +#endif +#ifdef HAVE_ALIAS +# define ALIAS2(from,to) \ + GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap ) \ + __attribute__ ((alias( # to ))); +# define ALIAS(from,to) ALIAS2( from, __glX ## to ## ReqSize ) +#else +# define ALIAS(from,to) \ + GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap ) \ + { return __glX ## to ## ReqSize( pc, swap ); } +#endif + + +int +__glXCallListsReqSize(const GLbyte *pc, Bool swap) +{ + GLsizei n = *(GLsizei *) (pc + 0); + GLenum type = *(GLenum *) (pc + 4); + GLsizei compsize; + + if (swap) { + n = bswap_32(n); + type = bswap_32(type); + } + + compsize = __glCallLists_size(type); + return __GLX_PAD((compsize * n)); +} + +int +__glXBitmapReqSize(const GLbyte *pc, Bool swap) +{ + GLint row_length = *(GLint *) (pc + 4); + GLint image_height = 0; + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); + GLsizei width = *(GLsizei *) (pc + 20); + GLsizei height = *(GLsizei *) (pc + 24); + + if (swap) { + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); + width = bswap_32(width); + height = bswap_32(height); + } + + return __glXImageSize(GL_COLOR_INDEX, GL_BITMAP, 0, width, height, 1, + image_height, row_length, skip_images, + skip_rows, alignment); +} + +int +__glXFogfvReqSize(const GLbyte *pc, Bool swap) +{ + GLenum pname = *(GLenum *) (pc + 0); + GLsizei compsize; + + if (swap) { + pname = bswap_32(pname); + } + + compsize = __glFogfv_size(pname); + return __GLX_PAD((compsize * 4)); +} + +int +__glXLightfvReqSize(const GLbyte *pc, Bool swap) +{ + GLenum pname = *(GLenum *) (pc + 4); + GLsizei compsize; + + if (swap) { + pname = bswap_32(pname); + } + + compsize = __glLightfv_size(pname); + return __GLX_PAD((compsize * 4)); +} + +int +__glXLightModelfvReqSize(const GLbyte *pc, Bool swap) +{ + GLenum pname = *(GLenum *) (pc + 0); + GLsizei compsize; + + if (swap) { + pname = bswap_32(pname); + } + + compsize = __glLightModelfv_size(pname); + return __GLX_PAD((compsize * 4)); +} + +int +__glXMaterialfvReqSize(const GLbyte *pc, Bool swap) +{ + GLenum pname = *(GLenum *) (pc + 4); + GLsizei compsize; + + if (swap) { + pname = bswap_32(pname); + } + + compsize = __glMaterialfv_size(pname); + return __GLX_PAD((compsize * 4)); +} + +int +__glXPolygonStippleReqSize(const GLbyte *pc, Bool swap) +{ + GLint row_length = *(GLint *) (pc + 4); + GLint image_height = 0; + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); + + if (swap) { + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); + } + + return __glXImageSize(GL_COLOR_INDEX, GL_BITMAP, 0, 32, 32, 1, + image_height, row_length, skip_images, + skip_rows, alignment); +} + +int +__glXTexParameterfvReqSize(const GLbyte *pc, Bool swap) +{ + GLenum pname = *(GLenum *) (pc + 4); + GLsizei compsize; + + if (swap) { + pname = bswap_32(pname); + } + + compsize = __glTexParameterfv_size(pname); + return __GLX_PAD((compsize * 4)); +} + +int +__glXTexImage1DReqSize(const GLbyte *pc, Bool swap) +{ + GLint row_length = *(GLint *) (pc + 4); + GLint image_height = 0; + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); + GLenum target = *(GLenum *) (pc + 20); + GLsizei width = *(GLsizei *) (pc + 32); + GLenum format = *(GLenum *) (pc + 44); + GLenum type = *(GLenum *) (pc + 48); + + if (swap) { + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); + target = bswap_32(target); + width = bswap_32(width); + format = bswap_32(format); + type = bswap_32(type); + } + + return __glXImageSize(format, type, target, width, 1, 1, + image_height, row_length, skip_images, + skip_rows, alignment); +} + +int +__glXTexImage2DReqSize(const GLbyte *pc, Bool swap) +{ + GLint row_length = *(GLint *) (pc + 4); + GLint image_height = 0; + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); + GLenum target = *(GLenum *) (pc + 20); + GLsizei width = *(GLsizei *) (pc + 32); + GLsizei height = *(GLsizei *) (pc + 36); + GLenum format = *(GLenum *) (pc + 44); + GLenum type = *(GLenum *) (pc + 48); + + if (swap) { + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); + target = bswap_32(target); + width = bswap_32(width); + height = bswap_32(height); + format = bswap_32(format); + type = bswap_32(type); + } + + return __glXImageSize(format, type, target, width, height, 1, + image_height, row_length, skip_images, + skip_rows, alignment); +} + +int +__glXTexEnvfvReqSize(const GLbyte *pc, Bool swap) +{ + GLenum pname = *(GLenum *) (pc + 4); + GLsizei compsize; + + if (swap) { + pname = bswap_32(pname); + } + + compsize = __glTexEnvfv_size(pname); + return __GLX_PAD((compsize * 4)); +} + +int +__glXTexGendvReqSize(const GLbyte *pc, Bool swap) +{ + GLenum pname = *(GLenum *) (pc + 4); + GLsizei compsize; + + if (swap) { + pname = bswap_32(pname); + } + + compsize = __glTexGendv_size(pname); + return __GLX_PAD((compsize * 8)); +} + +int +__glXTexGenfvReqSize(const GLbyte *pc, Bool swap) +{ + GLenum pname = *(GLenum *) (pc + 4); + GLsizei compsize; + + if (swap) { + pname = bswap_32(pname); + } + + compsize = __glTexGenfv_size(pname); + return __GLX_PAD((compsize * 4)); +} + +int +__glXPixelMapfvReqSize(const GLbyte *pc, Bool swap) +{ + GLsizei mapsize = *(GLsizei *) (pc + 4); + + if (swap) { + mapsize = bswap_32(mapsize); + } + + return __GLX_PAD((mapsize * 4)); +} + +int +__glXPixelMapusvReqSize(const GLbyte *pc, Bool swap) +{ + GLsizei mapsize = *(GLsizei *) (pc + 4); + + if (swap) { + mapsize = bswap_32(mapsize); + } + + return __GLX_PAD((mapsize * 2)); +} + +int +__glXDrawPixelsReqSize(const GLbyte *pc, Bool swap) +{ + GLint row_length = *(GLint *) (pc + 4); + GLint image_height = 0; + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); + GLsizei width = *(GLsizei *) (pc + 20); + GLsizei height = *(GLsizei *) (pc + 24); + GLenum format = *(GLenum *) (pc + 28); + GLenum type = *(GLenum *) (pc + 32); + + if (swap) { + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); + width = bswap_32(width); + height = bswap_32(height); + format = bswap_32(format); + type = bswap_32(type); + } + + return __glXImageSize(format, type, 0, width, height, 1, + image_height, row_length, skip_images, + skip_rows, alignment); +} + +int +__glXPrioritizeTexturesReqSize(const GLbyte *pc, Bool swap) +{ + GLsizei n = *(GLsizei *) (pc + 0); + + if (swap) { + n = bswap_32(n); + } + + return __GLX_PAD((n * 4) + (n * 4)); +} + +int +__glXTexSubImage1DReqSize(const GLbyte *pc, Bool swap) +{ + GLint row_length = *(GLint *) (pc + 4); + GLint image_height = 0; + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); + GLenum target = *(GLenum *) (pc + 20); + GLsizei width = *(GLsizei *) (pc + 36); + GLenum format = *(GLenum *) (pc + 44); + GLenum type = *(GLenum *) (pc + 48); + + if (swap) { + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); + target = bswap_32(target); + width = bswap_32(width); + format = bswap_32(format); + type = bswap_32(type); + } + + return __glXImageSize(format, type, target, width, 1, 1, + image_height, row_length, skip_images, + skip_rows, alignment); +} + +int +__glXTexSubImage2DReqSize(const GLbyte *pc, Bool swap) +{ + GLint row_length = *(GLint *) (pc + 4); + GLint image_height = 0; + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); + GLenum target = *(GLenum *) (pc + 20); + GLsizei width = *(GLsizei *) (pc + 36); + GLsizei height = *(GLsizei *) (pc + 40); + GLenum format = *(GLenum *) (pc + 44); + GLenum type = *(GLenum *) (pc + 48); + + if (swap) { + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); + target = bswap_32(target); + width = bswap_32(width); + height = bswap_32(height); + format = bswap_32(format); + type = bswap_32(type); + } + + return __glXImageSize(format, type, target, width, height, 1, + image_height, row_length, skip_images, + skip_rows, alignment); +} + +int +__glXColorTableReqSize(const GLbyte *pc, Bool swap) +{ + GLint row_length = *(GLint *) (pc + 4); + GLint image_height = 0; + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); + GLenum target = *(GLenum *) (pc + 20); + GLsizei width = *(GLsizei *) (pc + 28); + GLenum format = *(GLenum *) (pc + 32); + GLenum type = *(GLenum *) (pc + 36); + + if (swap) { + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); + target = bswap_32(target); + width = bswap_32(width); + format = bswap_32(format); + type = bswap_32(type); + } + + return __glXImageSize(format, type, target, width, 1, 1, + image_height, row_length, skip_images, + skip_rows, alignment); +} + +int +__glXColorTableParameterfvReqSize(const GLbyte *pc, Bool swap) +{ + GLenum pname = *(GLenum *) (pc + 4); + GLsizei compsize; + + if (swap) { + pname = bswap_32(pname); + } + + compsize = __glColorTableParameterfv_size(pname); + return __GLX_PAD((compsize * 4)); +} + +int +__glXColorSubTableReqSize(const GLbyte *pc, Bool swap) +{ + GLint row_length = *(GLint *) (pc + 4); + GLint image_height = 0; + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); + GLenum target = *(GLenum *) (pc + 20); + GLsizei count = *(GLsizei *) (pc + 28); + GLenum format = *(GLenum *) (pc + 32); + GLenum type = *(GLenum *) (pc + 36); + + if (swap) { + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); + target = bswap_32(target); + count = bswap_32(count); + format = bswap_32(format); + type = bswap_32(type); + } + + return __glXImageSize(format, type, target, count, 1, 1, + image_height, row_length, skip_images, + skip_rows, alignment); +} + +int +__glXConvolutionFilter1DReqSize(const GLbyte *pc, Bool swap) +{ + GLint row_length = *(GLint *) (pc + 4); + GLint image_height = 0; + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); + GLenum target = *(GLenum *) (pc + 20); + GLsizei width = *(GLsizei *) (pc + 28); + GLenum format = *(GLenum *) (pc + 36); + GLenum type = *(GLenum *) (pc + 40); + + if (swap) { + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); + target = bswap_32(target); + width = bswap_32(width); + format = bswap_32(format); + type = bswap_32(type); + } + + return __glXImageSize(format, type, target, width, 1, 1, + image_height, row_length, skip_images, + skip_rows, alignment); +} + +int +__glXConvolutionFilter2DReqSize(const GLbyte *pc, Bool swap) +{ + GLint row_length = *(GLint *) (pc + 4); + GLint image_height = 0; + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); + GLenum target = *(GLenum *) (pc + 20); + GLsizei width = *(GLsizei *) (pc + 28); + GLsizei height = *(GLsizei *) (pc + 32); + GLenum format = *(GLenum *) (pc + 36); + GLenum type = *(GLenum *) (pc + 40); + + if (swap) { + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); + target = bswap_32(target); + width = bswap_32(width); + height = bswap_32(height); + format = bswap_32(format); + type = bswap_32(type); + } + + return __glXImageSize(format, type, target, width, height, 1, + image_height, row_length, skip_images, + skip_rows, alignment); +} + +int +__glXConvolutionParameterfvReqSize(const GLbyte *pc, Bool swap) +{ + GLenum pname = *(GLenum *) (pc + 4); + GLsizei compsize; + + if (swap) { + pname = bswap_32(pname); + } + + compsize = __glConvolutionParameterfv_size(pname); + return __GLX_PAD((compsize * 4)); +} + +int +__glXTexImage3DReqSize(const GLbyte *pc, Bool swap) +{ + GLint row_length = *(GLint *) (pc + 4); + GLint image_height = *(GLint *) (pc + 8); + GLint skip_rows = *(GLint *) (pc + 16); + GLint skip_images = *(GLint *) (pc + 20); + GLint alignment = *(GLint *) (pc + 32); + GLenum target = *(GLenum *) (pc + 36); + GLsizei width = *(GLsizei *) (pc + 48); + GLsizei height = *(GLsizei *) (pc + 52); + GLsizei depth = *(GLsizei *) (pc + 56); + GLenum format = *(GLenum *) (pc + 68); + GLenum type = *(GLenum *) (pc + 72); + + if (swap) { + row_length = bswap_32(row_length); + image_height = bswap_32(image_height); + skip_rows = bswap_32(skip_rows); + skip_images = bswap_32(skip_images); + alignment = bswap_32(alignment); + target = bswap_32(target); + width = bswap_32(width); + height = bswap_32(height); + depth = bswap_32(depth); + format = bswap_32(format); + type = bswap_32(type); + } + + return __glXImageSize(format, type, target, width, height, depth, + image_height, row_length, skip_images, + skip_rows, alignment); +} + +int +__glXTexSubImage3DReqSize(const GLbyte *pc, Bool swap) +{ + GLint row_length = *(GLint *) (pc + 4); + GLint image_height = *(GLint *) (pc + 8); + GLint skip_rows = *(GLint *) (pc + 16); + GLint skip_images = *(GLint *) (pc + 20); + GLint alignment = *(GLint *) (pc + 32); + GLenum target = *(GLenum *) (pc + 36); + GLsizei width = *(GLsizei *) (pc + 60); + GLsizei height = *(GLsizei *) (pc + 64); + GLsizei depth = *(GLsizei *) (pc + 68); + GLenum format = *(GLenum *) (pc + 76); + GLenum type = *(GLenum *) (pc + 80); + + if (swap) { + row_length = bswap_32(row_length); + image_height = bswap_32(image_height); + skip_rows = bswap_32(skip_rows); + skip_images = bswap_32(skip_images); + alignment = bswap_32(alignment); + target = bswap_32(target); + width = bswap_32(width); + height = bswap_32(height); + depth = bswap_32(depth); + format = bswap_32(format); + type = bswap_32(type); + } + + return __glXImageSize(format, type, target, width, height, depth, + image_height, row_length, skip_images, + skip_rows, alignment); +} + +int +__glXCompressedTexImage1DARBReqSize(const GLbyte *pc, Bool swap) +{ + GLsizei imageSize = *(GLsizei *) (pc + 20); + + if (swap) { + imageSize = bswap_32(imageSize); + } + + return __GLX_PAD(imageSize); +} + +int +__glXCompressedTexImage2DARBReqSize(const GLbyte *pc, Bool swap) +{ + GLsizei imageSize = *(GLsizei *) (pc + 24); + + if (swap) { + imageSize = bswap_32(imageSize); + } + + return __GLX_PAD(imageSize); +} + +int +__glXCompressedTexImage3DARBReqSize(const GLbyte *pc, Bool swap) +{ + GLsizei imageSize = *(GLsizei *) (pc + 28); + + if (swap) { + imageSize = bswap_32(imageSize); + } + + return __GLX_PAD(imageSize); +} + +int +__glXCompressedTexSubImage3DARBReqSize(const GLbyte *pc, Bool swap) +{ + GLsizei imageSize = *(GLsizei *) (pc + 36); + + if (swap) { + imageSize = bswap_32(imageSize); + } + + return __GLX_PAD(imageSize); +} + +int +__glXProgramStringARBReqSize(const GLbyte *pc, Bool swap) +{ + GLsizei len = *(GLsizei *) (pc + 8); + + if (swap) { + len = bswap_32(len); + } + + return __GLX_PAD(len); +} + +int +__glXDrawBuffersARBReqSize(const GLbyte *pc, Bool swap) +{ + GLsizei n = *(GLsizei *) (pc + 0); + + if (swap) { + n = bswap_32(n); + } + + return __GLX_PAD((n * 4)); +} + +int +__glXPointParameterfvEXTReqSize(const GLbyte *pc, Bool swap) +{ + GLenum pname = *(GLenum *) (pc + 0); + GLsizei compsize; + + if (swap) { + pname = bswap_32(pname); + } + + compsize = __glPointParameterfvEXT_size(pname); + return __GLX_PAD((compsize * 4)); +} + +int +__glXProgramParameters4dvNVReqSize(const GLbyte *pc, Bool swap) +{ + GLuint num = *(GLuint *) (pc + 8); + + if (swap) { + num = bswap_32(num); + } + + return __GLX_PAD((num * 32)); +} + +int +__glXProgramParameters4fvNVReqSize(const GLbyte *pc, Bool swap) +{ + GLuint num = *(GLuint *) (pc + 8); + + if (swap) { + num = bswap_32(num); + } + + return __GLX_PAD((num * 16)); +} + +int +__glXVertexAttribs1dvNVReqSize(const GLbyte *pc, Bool swap) +{ + GLsizei n = *(GLsizei *) (pc + 4); + + if (swap) { + n = bswap_32(n); + } + + return __GLX_PAD((n * 8)); +} + +int +__glXVertexAttribs2dvNVReqSize(const GLbyte *pc, Bool swap) +{ + GLsizei n = *(GLsizei *) (pc + 4); + + if (swap) { + n = bswap_32(n); + } + + return __GLX_PAD((n * 16)); +} + +int +__glXVertexAttribs3dvNVReqSize(const GLbyte *pc, Bool swap) +{ + GLsizei n = *(GLsizei *) (pc + 4); + + if (swap) { + n = bswap_32(n); + } + + return __GLX_PAD((n * 24)); +} + +int +__glXVertexAttribs3fvNVReqSize(const GLbyte *pc, Bool swap) +{ + GLsizei n = *(GLsizei *) (pc + 4); + + if (swap) { + n = bswap_32(n); + } + + return __GLX_PAD((n * 12)); +} + +int +__glXVertexAttribs3svNVReqSize(const GLbyte *pc, Bool swap) +{ + GLsizei n = *(GLsizei *) (pc + 4); + + if (swap) { + n = bswap_32(n); + } + + return __GLX_PAD((n * 6)); +} + +int +__glXVertexAttribs4dvNVReqSize(const GLbyte *pc, Bool swap) +{ + GLsizei n = *(GLsizei *) (pc + 4); + + if (swap) { + n = bswap_32(n); + } + + return __GLX_PAD((n * 32)); +} + +int +__glXProgramNamedParameter4fvNVReqSize(const GLbyte *pc, Bool swap) +{ + GLsizei len = *(GLsizei *) (pc + 4); + + if (swap) { + len = bswap_32(len); + } + + return __GLX_PAD(len); +} + +ALIAS(Fogiv, Fogfv) + ALIAS(Lightiv, Lightfv) + ALIAS(LightModeliv, LightModelfv) + ALIAS(Materialiv, Materialfv) + ALIAS(TexParameteriv, TexParameterfv) + ALIAS(TexEnviv, TexEnvfv) + ALIAS(TexGeniv, TexGenfv) + ALIAS(PixelMapuiv, PixelMapfv) + ALIAS(ColorTableParameteriv, ColorTableParameterfv) + ALIAS(ConvolutionParameteriv, ConvolutionParameterfv) + ALIAS(CompressedTexSubImage1DARB, CompressedTexImage1DARB) + ALIAS(CompressedTexSubImage2DARB, CompressedTexImage3DARB) + ALIAS(LoadProgramNV, ProgramStringARB) + ALIAS(RequestResidentProgramsNV, DrawBuffersARB) + ALIAS(VertexAttribs1fvNV, PixelMapfv) + ALIAS(VertexAttribs1svNV, PixelMapusv) + ALIAS(VertexAttribs2fvNV, VertexAttribs1dvNV) + ALIAS(VertexAttribs2svNV, PixelMapfv) + ALIAS(VertexAttribs4fvNV, VertexAttribs2dvNV) + ALIAS(VertexAttribs4svNV, VertexAttribs1dvNV) + ALIAS(VertexAttribs4ubvNV, PixelMapfv) + ALIAS(PointParameterivNV, PointParameterfvEXT) + ALIAS(ProgramNamedParameter4dvNV, CompressedTexSubImage3DARB) + ALIAS(DeleteFramebuffersEXT, DrawBuffersARB) + ALIAS(DeleteRenderbuffersEXT, DrawBuffersARB) diff --git a/dist/Mesa/src/glx/x11/indirect_reqsize.h b/dist/Mesa/src/glx/x11/indirect_reqsize.h new file mode 100644 index 000000000..26211ee5c --- /dev/null +++ b/dist/Mesa/src/glx/x11/indirect_reqsize.h @@ -0,0 +1,121 @@ +/* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */ + +/* + * (C) Copyright IBM Corporation 2005 + * 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 + * IBM, + * 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. + */ + +#if !defined( _INDIRECT_REQSIZE_H_ ) +# define _INDIRECT_REQSIZE_H_ + +# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) +# define HIDDEN __attribute__((visibility("hidden"))) +# else +# define HIDDEN +# endif + +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define PURE __attribute__((pure)) +# else +# define PURE +# endif + +extern PURE HIDDEN int __glXCallListsReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXBitmapReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXFogfvReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXFogivReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXLightfvReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXLightivReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXLightModelfvReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXLightModelivReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXMaterialfvReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXMaterialivReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXPolygonStippleReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXTexParameterfvReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXTexParameterivReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXTexImage1DReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXTexImage2DReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXTexEnvfvReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXTexEnvivReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXTexGendvReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXTexGenfvReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXTexGenivReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXMap1dReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXMap1fReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXMap2dReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXMap2fReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXPixelMapfvReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXPixelMapuivReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXPixelMapusvReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXDrawPixelsReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXDrawArraysReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXPrioritizeTexturesReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXTexSubImage1DReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXTexSubImage2DReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXColorTableReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXColorTableParameterfvReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXColorTableParameterivReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXColorSubTableReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXConvolutionFilter1DReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXConvolutionFilter2DReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXConvolutionParameterfvReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXConvolutionParameterivReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXSeparableFilter2DReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXTexImage3DReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXTexSubImage3DReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXCompressedTexImage1DARBReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXCompressedTexImage2DARBReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXCompressedTexImage3DARBReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXCompressedTexSubImage1DARBReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXCompressedTexSubImage2DARBReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXCompressedTexSubImage3DARBReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXProgramStringARBReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXDrawBuffersARBReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXPointParameterfvEXTReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXLoadProgramNVReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXProgramParameters4dvNVReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXProgramParameters4fvNVReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXRequestResidentProgramsNVReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXVertexAttribs1dvNVReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXVertexAttribs1fvNVReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXVertexAttribs1svNVReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXVertexAttribs2dvNVReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXVertexAttribs2fvNVReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXVertexAttribs2svNVReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXVertexAttribs3dvNVReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXVertexAttribs3fvNVReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXVertexAttribs3svNVReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXVertexAttribs4dvNVReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXVertexAttribs4fvNVReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXVertexAttribs4svNVReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXVertexAttribs4ubvNVReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXPointParameterivNVReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXProgramNamedParameter4dvNVReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXProgramNamedParameter4fvNVReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXDeleteFramebuffersEXTReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXDeleteRenderbuffersEXTReqSize(const GLbyte *pc, Bool swap); + +# undef HIDDEN +# undef PURE + +#endif /* !defined( _INDIRECT_REQSIZE_H_ ) */ diff --git a/dist/Mesa/src/glx/x11/indirect_size_get.c b/dist/Mesa/src/glx/x11/indirect_size_get.c new file mode 100644 index 000000000..70ba8c02e --- /dev/null +++ b/dist/Mesa/src/glx/x11/indirect_size_get.c @@ -0,0 +1,1206 @@ +/* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */ + +/* + * (C) Copyright IBM Corporation 2004 + * 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 + * IBM, + * 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. + */ + + +#include <GL/gl.h> +#include "indirect_size_get.h" +#include "glxserver.h" +#include "indirect_util.h" +#include "indirect_size.h" + +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define PURE __attribute__((pure)) +# else +# define PURE +# endif + +# if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__) +# define FASTCALL __attribute__((fastcall)) +# else +# define FASTCALL +# endif + +# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) +# define INTERNAL __attribute__((visibility("internal"))) +# else +# define INTERNAL +# endif + + +#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__APPLE__) +# undef HAVE_ALIAS +#endif +#ifdef HAVE_ALIAS +# define ALIAS2(from,to) \ + INTERNAL PURE FASTCALL GLint __gl ## from ## _size( GLenum e ) \ + __attribute__ ((alias( # to ))); +# define ALIAS(from,to) ALIAS2( from, __gl ## to ## _size ) +#else +# define ALIAS(from,to) \ + INTERNAL PURE FASTCALL GLint __gl ## from ## _size( GLenum e ) \ + { return __gl ## to ## _size( e ); } +#endif + + +INTERNAL PURE FASTCALL GLint +__glCallLists_size(GLenum e) +{ + switch (e) { + case GL_BYTE: + case GL_UNSIGNED_BYTE: + return 1; + case GL_SHORT: + case GL_UNSIGNED_SHORT: + case GL_2_BYTES: + return 2; + case GL_3_BYTES: + return 3; + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + case GL_4_BYTES: + return 4; + default: + return 0; + } +} + +INTERNAL PURE FASTCALL GLint +__glFogfv_size(GLenum e) +{ + switch (e) { + case GL_FOG_INDEX: + case GL_FOG_DENSITY: + case GL_FOG_START: + case GL_FOG_END: + case GL_FOG_MODE: + case GL_FOG_OFFSET_VALUE_SGIX: + case GL_FOG_DISTANCE_MODE_NV: + return 1; + case GL_FOG_COLOR: + return 4; + default: + return 0; + } +} + +INTERNAL PURE FASTCALL GLint +__glLightfv_size(GLenum e) +{ + switch (e) { + case GL_SPOT_EXPONENT: + case GL_SPOT_CUTOFF: + case GL_CONSTANT_ATTENUATION: + case GL_LINEAR_ATTENUATION: + case GL_QUADRATIC_ATTENUATION: + return 1; + case GL_SPOT_DIRECTION: + return 3; + case GL_AMBIENT: + case GL_DIFFUSE: + case GL_SPECULAR: + case GL_POSITION: + return 4; + default: + return 0; + } +} + +INTERNAL PURE FASTCALL GLint +__glLightModelfv_size(GLenum e) +{ + switch (e) { + case GL_LIGHT_MODEL_LOCAL_VIEWER: + case GL_LIGHT_MODEL_TWO_SIDE: + case GL_LIGHT_MODEL_COLOR_CONTROL: +/* case GL_LIGHT_MODEL_COLOR_CONTROL_EXT:*/ + return 1; + case GL_LIGHT_MODEL_AMBIENT: + return 4; + default: + return 0; + } +} + +INTERNAL PURE FASTCALL GLint +__glMaterialfv_size(GLenum e) +{ + switch (e) { + case GL_SHININESS: + return 1; + case GL_COLOR_INDEXES: + return 3; + case GL_AMBIENT: + case GL_DIFFUSE: + case GL_SPECULAR: + case GL_EMISSION: + case GL_AMBIENT_AND_DIFFUSE: + return 4; + default: + return 0; + } +} + +INTERNAL PURE FASTCALL GLint +__glTexParameterfv_size(GLenum e) +{ + switch (e) { + case GL_TEXTURE_MAG_FILTER: + case GL_TEXTURE_MIN_FILTER: + case GL_TEXTURE_WRAP_S: + case GL_TEXTURE_WRAP_T: + case GL_TEXTURE_PRIORITY: + case GL_TEXTURE_WRAP_R: + case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: +/* case GL_SHADOW_AMBIENT_SGIX:*/ + case GL_TEXTURE_MIN_LOD: + case GL_TEXTURE_MAX_LOD: + case GL_TEXTURE_BASE_LEVEL: + case GL_TEXTURE_MAX_LEVEL: + case GL_TEXTURE_CLIPMAP_FRAME_SGIX: + case GL_TEXTURE_LOD_BIAS_S_SGIX: + case GL_TEXTURE_LOD_BIAS_T_SGIX: + case GL_TEXTURE_LOD_BIAS_R_SGIX: + case GL_GENERATE_MIPMAP: +/* case GL_GENERATE_MIPMAP_SGIS:*/ + case GL_TEXTURE_COMPARE_SGIX: + case GL_TEXTURE_COMPARE_OPERATOR_SGIX: + case GL_TEXTURE_MAX_CLAMP_S_SGIX: + case GL_TEXTURE_MAX_CLAMP_T_SGIX: + case GL_TEXTURE_MAX_CLAMP_R_SGIX: + case GL_TEXTURE_MAX_ANISOTROPY_EXT: + case GL_TEXTURE_LOD_BIAS: +/* case GL_TEXTURE_LOD_BIAS_EXT:*/ + case GL_DEPTH_TEXTURE_MODE: +/* case GL_DEPTH_TEXTURE_MODE_ARB:*/ + case GL_TEXTURE_COMPARE_MODE: +/* case GL_TEXTURE_COMPARE_MODE_ARB:*/ + case GL_TEXTURE_COMPARE_FUNC: +/* case GL_TEXTURE_COMPARE_FUNC_ARB:*/ + case GL_TEXTURE_UNSIGNED_REMAP_MODE_NV: + return 1; + case GL_TEXTURE_CLIPMAP_CENTER_SGIX: + case GL_TEXTURE_CLIPMAP_OFFSET_SGIX: + return 2; + case GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX: + return 3; + case GL_TEXTURE_BORDER_COLOR: + case GL_POST_TEXTURE_FILTER_BIAS_SGIX: + case GL_POST_TEXTURE_FILTER_SCALE_SGIX: + return 4; + default: + return 0; + } +} + +INTERNAL PURE FASTCALL GLint +__glTexEnvfv_size(GLenum e) +{ + switch (e) { + case GL_ALPHA_SCALE: + case GL_TEXTURE_ENV_MODE: + case GL_TEXTURE_LOD_BIAS: + case GL_COMBINE_RGB: + case GL_COMBINE_ALPHA: + case GL_RGB_SCALE: + case GL_SOURCE0_RGB: + case GL_SOURCE1_RGB: + case GL_SOURCE2_RGB: + case GL_SOURCE3_RGB_NV: + case GL_SOURCE0_ALPHA: + case GL_SOURCE1_ALPHA: + case GL_SOURCE2_ALPHA: + case GL_SOURCE3_ALPHA_NV: + case GL_OPERAND0_RGB: + case GL_OPERAND1_RGB: + case GL_OPERAND2_RGB: + case GL_OPERAND3_RGB_NV: + case GL_OPERAND0_ALPHA: + case GL_OPERAND1_ALPHA: + case GL_OPERAND2_ALPHA: + case GL_OPERAND3_ALPHA_NV: + case GL_COORD_REPLACE_ARB: +/* case GL_COORD_REPLACE_NV:*/ + return 1; + case GL_TEXTURE_ENV_COLOR: + return 4; + default: + return 0; + } +} + +INTERNAL PURE FASTCALL GLint +__glTexGendv_size(GLenum e) +{ + switch (e) { + case GL_TEXTURE_GEN_MODE: + return 1; + case GL_OBJECT_PLANE: + case GL_EYE_PLANE: + return 4; + default: + return 0; + } +} + +INTERNAL PURE FASTCALL GLint +__glMap1d_size(GLenum e) +{ + switch (e) { + case GL_MAP1_INDEX: + case GL_MAP1_TEXTURE_COORD_1: + return 1; + case GL_MAP1_TEXTURE_COORD_2: + return 2; + case GL_MAP1_NORMAL: + case GL_MAP1_TEXTURE_COORD_3: + case GL_MAP1_VERTEX_3: + return 3; + case GL_MAP1_COLOR_4: + case GL_MAP1_TEXTURE_COORD_4: + case GL_MAP1_VERTEX_4: + return 4; + default: + return 0; + } +} + +INTERNAL PURE FASTCALL GLint +__glMap2d_size(GLenum e) +{ + switch (e) { + case GL_MAP2_INDEX: + case GL_MAP2_TEXTURE_COORD_1: + return 1; + case GL_MAP2_TEXTURE_COORD_2: + return 2; + case GL_MAP2_NORMAL: + case GL_MAP2_TEXTURE_COORD_3: + case GL_MAP2_VERTEX_3: + return 3; + case GL_MAP2_COLOR_4: + case GL_MAP2_TEXTURE_COORD_4: + case GL_MAP2_VERTEX_4: + return 4; + default: + return 0; + } +} + +INTERNAL PURE FASTCALL GLint +__glGetBooleanv_size(GLenum e) +{ + switch (e) { + case GL_CURRENT_INDEX: + case GL_CURRENT_RASTER_INDEX: + case GL_CURRENT_RASTER_POSITION_VALID: + case GL_CURRENT_RASTER_DISTANCE: + case GL_POINT_SMOOTH: + case GL_POINT_SIZE: + case GL_SMOOTH_POINT_SIZE_GRANULARITY: + case GL_LINE_SMOOTH: + case GL_LINE_WIDTH: + case GL_LINE_WIDTH_GRANULARITY: + case GL_LINE_STIPPLE: + case GL_LINE_STIPPLE_PATTERN: + case GL_LINE_STIPPLE_REPEAT: + case GL_LIST_MODE: + case GL_MAX_LIST_NESTING: + case GL_LIST_BASE: + case GL_LIST_INDEX: + case GL_POLYGON_SMOOTH: + case GL_POLYGON_STIPPLE: + case GL_EDGE_FLAG: + case GL_CULL_FACE: + case GL_CULL_FACE_MODE: + case GL_FRONT_FACE: + case GL_LIGHTING: + case GL_LIGHT_MODEL_LOCAL_VIEWER: + case GL_LIGHT_MODEL_TWO_SIDE: + case GL_SHADE_MODEL: + case GL_COLOR_MATERIAL_FACE: + case GL_COLOR_MATERIAL_PARAMETER: + case GL_COLOR_MATERIAL: + case GL_FOG: + case GL_FOG_INDEX: + case GL_FOG_DENSITY: + case GL_FOG_START: + case GL_FOG_END: + case GL_FOG_MODE: + case GL_DEPTH_TEST: + case GL_DEPTH_WRITEMASK: + case GL_DEPTH_CLEAR_VALUE: + case GL_DEPTH_FUNC: + case GL_STENCIL_TEST: + case GL_STENCIL_CLEAR_VALUE: + case GL_STENCIL_FUNC: + case GL_STENCIL_VALUE_MASK: + case GL_STENCIL_FAIL: + case GL_STENCIL_PASS_DEPTH_FAIL: + case GL_STENCIL_PASS_DEPTH_PASS: + case GL_STENCIL_REF: + case GL_STENCIL_WRITEMASK: + case GL_MATRIX_MODE: + case GL_NORMALIZE: + case GL_MODELVIEW_STACK_DEPTH: + case GL_PROJECTION_STACK_DEPTH: + case GL_TEXTURE_STACK_DEPTH: + case GL_ATTRIB_STACK_DEPTH: + case GL_CLIENT_ATTRIB_STACK_DEPTH: + case GL_ALPHA_TEST: + case GL_ALPHA_TEST_FUNC: + case GL_ALPHA_TEST_REF: + case GL_DITHER: + case GL_BLEND_DST: + case GL_BLEND_SRC: + case GL_BLEND: + case GL_LOGIC_OP_MODE: + case GL_LOGIC_OP: + case GL_AUX_BUFFERS: + case GL_DRAW_BUFFER: + case GL_READ_BUFFER: + case GL_SCISSOR_TEST: + case GL_INDEX_CLEAR_VALUE: + case GL_INDEX_WRITEMASK: + case GL_INDEX_MODE: + case GL_RGBA_MODE: + case GL_DOUBLEBUFFER: + case GL_STEREO: + case GL_RENDER_MODE: + case GL_PERSPECTIVE_CORRECTION_HINT: + case GL_POINT_SMOOTH_HINT: + case GL_LINE_SMOOTH_HINT: + case GL_POLYGON_SMOOTH_HINT: + case GL_FOG_HINT: + case GL_TEXTURE_GEN_S: + case GL_TEXTURE_GEN_T: + case GL_TEXTURE_GEN_R: + case GL_TEXTURE_GEN_Q: + case GL_PIXEL_MAP_I_TO_I: + case GL_PIXEL_MAP_I_TO_I_SIZE: + case GL_PIXEL_MAP_S_TO_S_SIZE: + case GL_PIXEL_MAP_I_TO_R_SIZE: + case GL_PIXEL_MAP_I_TO_G_SIZE: + case GL_PIXEL_MAP_I_TO_B_SIZE: + case GL_PIXEL_MAP_I_TO_A_SIZE: + case GL_PIXEL_MAP_R_TO_R_SIZE: + case GL_PIXEL_MAP_G_TO_G_SIZE: + case GL_PIXEL_MAP_B_TO_B_SIZE: + case GL_PIXEL_MAP_A_TO_A_SIZE: + case GL_UNPACK_SWAP_BYTES: + case GL_UNPACK_LSB_FIRST: + case GL_UNPACK_ROW_LENGTH: + case GL_UNPACK_SKIP_ROWS: + case GL_UNPACK_SKIP_PIXELS: + case GL_UNPACK_ALIGNMENT: + case GL_PACK_SWAP_BYTES: + case GL_PACK_LSB_FIRST: + case GL_PACK_ROW_LENGTH: + case GL_PACK_SKIP_ROWS: + case GL_PACK_SKIP_PIXELS: + case GL_PACK_ALIGNMENT: + case GL_MAP_COLOR: + case GL_MAP_STENCIL: + case GL_INDEX_SHIFT: + case GL_INDEX_OFFSET: + case GL_RED_SCALE: + case GL_RED_BIAS: + case GL_ZOOM_X: + case GL_ZOOM_Y: + case GL_GREEN_SCALE: + case GL_GREEN_BIAS: + case GL_BLUE_SCALE: + case GL_BLUE_BIAS: + case GL_ALPHA_SCALE: + case GL_ALPHA_BIAS: + case GL_DEPTH_SCALE: + case GL_DEPTH_BIAS: + case GL_MAX_EVAL_ORDER: + case GL_MAX_LIGHTS: + case GL_MAX_CLIP_PLANES: + case GL_MAX_TEXTURE_SIZE: + case GL_MAX_PIXEL_MAP_TABLE: + case GL_MAX_ATTRIB_STACK_DEPTH: + case GL_MAX_MODELVIEW_STACK_DEPTH: + case GL_MAX_NAME_STACK_DEPTH: + case GL_MAX_PROJECTION_STACK_DEPTH: + case GL_MAX_TEXTURE_STACK_DEPTH: + case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: + case GL_SUBPIXEL_BITS: + case GL_INDEX_BITS: + case GL_RED_BITS: + case GL_GREEN_BITS: + case GL_BLUE_BITS: + case GL_ALPHA_BITS: + case GL_DEPTH_BITS: + case GL_STENCIL_BITS: + case GL_ACCUM_RED_BITS: + case GL_ACCUM_GREEN_BITS: + case GL_ACCUM_BLUE_BITS: + case GL_ACCUM_ALPHA_BITS: + case GL_NAME_STACK_DEPTH: + case GL_AUTO_NORMAL: + case GL_MAP1_COLOR_4: + case GL_MAP1_INDEX: + case GL_MAP1_NORMAL: + case GL_MAP1_TEXTURE_COORD_1: + case GL_MAP1_TEXTURE_COORD_2: + case GL_MAP1_TEXTURE_COORD_3: + case GL_MAP1_TEXTURE_COORD_4: + case GL_MAP1_VERTEX_3: + case GL_MAP1_VERTEX_4: + case GL_MAP2_COLOR_4: + case GL_MAP2_INDEX: + case GL_MAP2_NORMAL: + case GL_MAP2_TEXTURE_COORD_1: + case GL_MAP2_TEXTURE_COORD_2: + case GL_MAP2_TEXTURE_COORD_3: + case GL_MAP2_TEXTURE_COORD_4: + case GL_MAP2_VERTEX_3: + case GL_MAP2_VERTEX_4: + case GL_MAP1_GRID_SEGMENTS: + case GL_TEXTURE_1D: + case GL_TEXTURE_2D: + case GL_POLYGON_OFFSET_UNITS: + case GL_CLIP_PLANE0: + case GL_CLIP_PLANE1: + case GL_CLIP_PLANE2: + case GL_CLIP_PLANE3: + case GL_CLIP_PLANE4: + case GL_CLIP_PLANE5: + case GL_LIGHT0: + case GL_LIGHT1: + case GL_LIGHT2: + case GL_LIGHT3: + case GL_LIGHT4: + case GL_LIGHT5: + case GL_LIGHT6: + case GL_LIGHT7: + case GL_BLEND_EQUATION: +/* case GL_BLEND_EQUATION_EXT:*/ + case GL_CONVOLUTION_1D: + case GL_CONVOLUTION_2D: + case GL_SEPARABLE_2D: + case GL_MAX_CONVOLUTION_WIDTH: +/* case GL_MAX_CONVOLUTION_WIDTH_EXT:*/ + case GL_MAX_CONVOLUTION_HEIGHT: +/* case GL_MAX_CONVOLUTION_HEIGHT_EXT:*/ + case GL_POST_CONVOLUTION_RED_SCALE: +/* case GL_POST_CONVOLUTION_RED_SCALE_EXT:*/ + case GL_POST_CONVOLUTION_GREEN_SCALE: +/* case GL_POST_CONVOLUTION_GREEN_SCALE_EXT:*/ + case GL_POST_CONVOLUTION_BLUE_SCALE: +/* case GL_POST_CONVOLUTION_BLUE_SCALE_EXT:*/ + case GL_POST_CONVOLUTION_ALPHA_SCALE: +/* case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT:*/ + case GL_POST_CONVOLUTION_RED_BIAS: +/* case GL_POST_CONVOLUTION_RED_BIAS_EXT:*/ + case GL_POST_CONVOLUTION_GREEN_BIAS: +/* case GL_POST_CONVOLUTION_GREEN_BIAS_EXT:*/ + case GL_POST_CONVOLUTION_BLUE_BIAS: +/* case GL_POST_CONVOLUTION_BLUE_BIAS_EXT:*/ + case GL_POST_CONVOLUTION_ALPHA_BIAS: +/* case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT:*/ + case GL_HISTOGRAM: + case GL_MINMAX: + case GL_POLYGON_OFFSET_FACTOR: + case GL_RESCALE_NORMAL: +/* case GL_RESCALE_NORMAL_EXT:*/ + case GL_TEXTURE_BINDING_1D: + case GL_TEXTURE_BINDING_2D: + case GL_TEXTURE_BINDING_3D: + case GL_PACK_SKIP_IMAGES: + case GL_PACK_IMAGE_HEIGHT: + case GL_UNPACK_SKIP_IMAGES: + case GL_UNPACK_IMAGE_HEIGHT: + case GL_TEXTURE_3D: + case GL_MAX_3D_TEXTURE_SIZE: + case GL_VERTEX_ARRAY: + case GL_NORMAL_ARRAY: + case GL_COLOR_ARRAY: + case GL_INDEX_ARRAY: + case GL_TEXTURE_COORD_ARRAY: + case GL_EDGE_FLAG_ARRAY: + case GL_VERTEX_ARRAY_SIZE: + case GL_VERTEX_ARRAY_TYPE: + case GL_VERTEX_ARRAY_STRIDE: + case GL_NORMAL_ARRAY_TYPE: + case GL_NORMAL_ARRAY_STRIDE: + case GL_COLOR_ARRAY_SIZE: + case GL_COLOR_ARRAY_TYPE: + case GL_COLOR_ARRAY_STRIDE: + case GL_INDEX_ARRAY_TYPE: + case GL_INDEX_ARRAY_STRIDE: + case GL_TEXTURE_COORD_ARRAY_SIZE: + case GL_TEXTURE_COORD_ARRAY_TYPE: + case GL_TEXTURE_COORD_ARRAY_STRIDE: + case GL_EDGE_FLAG_ARRAY_STRIDE: + case GL_MULTISAMPLE: +/* case GL_MULTISAMPLE_ARB:*/ + case GL_SAMPLE_ALPHA_TO_COVERAGE: +/* case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB:*/ + case GL_SAMPLE_ALPHA_TO_ONE: +/* case GL_SAMPLE_ALPHA_TO_ONE_ARB:*/ + case GL_SAMPLE_COVERAGE: +/* case GL_SAMPLE_COVERAGE_ARB:*/ + case GL_SAMPLE_BUFFERS: +/* case GL_SAMPLE_BUFFERS_ARB:*/ + case GL_SAMPLES: +/* case GL_SAMPLES_ARB:*/ + case GL_SAMPLE_COVERAGE_VALUE: +/* case GL_SAMPLE_COVERAGE_VALUE_ARB:*/ + case GL_SAMPLE_COVERAGE_INVERT: +/* case GL_SAMPLE_COVERAGE_INVERT_ARB:*/ + case GL_COLOR_MATRIX_STACK_DEPTH: + case GL_MAX_COLOR_MATRIX_STACK_DEPTH: + case GL_POST_COLOR_MATRIX_RED_SCALE: + case GL_POST_COLOR_MATRIX_GREEN_SCALE: + case GL_POST_COLOR_MATRIX_BLUE_SCALE: + case GL_POST_COLOR_MATRIX_ALPHA_SCALE: + case GL_POST_COLOR_MATRIX_RED_BIAS: + case GL_POST_COLOR_MATRIX_GREEN_BIAS: + case GL_POST_COLOR_MATRIX_BLUE_BIAS: + case GL_POST_COLOR_MATRIX_ALPHA_BIAS: + case GL_BLEND_DST_RGB: + case GL_BLEND_SRC_RGB: + case GL_BLEND_DST_ALPHA: + case GL_BLEND_SRC_ALPHA: + case GL_COLOR_TABLE: + case GL_POST_CONVOLUTION_COLOR_TABLE: + case GL_POST_COLOR_MATRIX_COLOR_TABLE: + case GL_MAX_ELEMENTS_VERTICES: + case GL_MAX_ELEMENTS_INDICES: + case GL_CLIP_VOLUME_CLIPPING_HINT_EXT: + case GL_POINT_SIZE_MIN: + case GL_POINT_SIZE_MAX: + case GL_POINT_FADE_THRESHOLD_SIZE: + case GL_OCCLUSION_TEST_HP: + case GL_OCCLUSION_TEST_RESULT_HP: + case GL_LIGHT_MODEL_COLOR_CONTROL: + case GL_CURRENT_FOG_COORD: + case GL_FOG_COORDINATE_ARRAY_TYPE: + case GL_FOG_COORDINATE_ARRAY_STRIDE: + case GL_FOG_COORD_ARRAY: + case GL_COLOR_SUM_ARB: + case GL_SECONDARY_COLOR_ARRAY_SIZE: + case GL_SECONDARY_COLOR_ARRAY_TYPE: + case GL_SECONDARY_COLOR_ARRAY_STRIDE: + case GL_SECONDARY_COLOR_ARRAY: + case GL_ACTIVE_TEXTURE: +/* case GL_ACTIVE_TEXTURE_ARB:*/ + case GL_CLIENT_ACTIVE_TEXTURE: +/* case GL_CLIENT_ACTIVE_TEXTURE_ARB:*/ + case GL_MAX_TEXTURE_UNITS: +/* case GL_MAX_TEXTURE_UNITS_ARB:*/ + case GL_MAX_RENDERBUFFER_SIZE_EXT: + case GL_TEXTURE_COMPRESSION_HINT: +/* case GL_TEXTURE_COMPRESSION_HINT_ARB:*/ + case GL_TEXTURE_RECTANGLE_ARB: +/* case GL_TEXTURE_RECTANGLE_NV:*/ + case GL_TEXTURE_BINDING_RECTANGLE_ARB: +/* case GL_TEXTURE_BINDING_RECTANGLE_NV:*/ + case GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB: +/* case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV:*/ + case GL_MAX_TEXTURE_LOD_BIAS: + case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: + case GL_MAX_SHININESS_NV: + case GL_MAX_SPOT_EXPONENT_NV: + case GL_TEXTURE_CUBE_MAP: +/* case GL_TEXTURE_CUBE_MAP_ARB:*/ + case GL_TEXTURE_BINDING_CUBE_MAP: +/* case GL_TEXTURE_BINDING_CUBE_MAP_ARB:*/ + case GL_MAX_CUBE_MAP_TEXTURE_SIZE: +/* case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB:*/ + case GL_MULTISAMPLE_FILTER_HINT_NV: + case GL_FOG_DISTANCE_MODE_NV: + case GL_VERTEX_PROGRAM_ARB: + case GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB: + case GL_MAX_PROGRAM_MATRICES_ARB: + case GL_CURRENT_MATRIX_STACK_DEPTH_ARB: + case GL_VERTEX_PROGRAM_POINT_SIZE_ARB: + case GL_VERTEX_PROGRAM_TWO_SIDE_ARB: + case GL_PROGRAM_ERROR_POSITION_ARB: + case GL_DEPTH_CLAMP_NV: + case GL_NUM_COMPRESSED_TEXTURE_FORMATS: +/* case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB:*/ + case GL_MAX_VERTEX_UNITS_ARB: + case GL_ACTIVE_VERTEX_UNITS_ARB: + case GL_WEIGHT_SUM_UNITY_ARB: + case GL_VERTEX_BLEND_ARB: + case GL_CURRENT_WEIGHT_ARB: + case GL_WEIGHT_ARRAY_TYPE_ARB: + case GL_WEIGHT_ARRAY_STRIDE_ARB: + case GL_WEIGHT_ARRAY_SIZE_ARB: + case GL_WEIGHT_ARRAY_ARB: + case GL_PACK_INVERT_MESA: + case GL_STENCIL_BACK_FUNC_ATI: + case GL_STENCIL_BACK_FAIL_ATI: + case GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI: + case GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI: + case GL_FRAGMENT_PROGRAM_ARB: + case GL_MAX_DRAW_BUFFERS_ARB: +/* case GL_MAX_DRAW_BUFFERS_ATI:*/ + case GL_DRAW_BUFFER0_ARB: +/* case GL_DRAW_BUFFER0_ATI:*/ + case GL_DRAW_BUFFER1_ARB: +/* case GL_DRAW_BUFFER1_ATI:*/ + case GL_DRAW_BUFFER2_ARB: +/* case GL_DRAW_BUFFER2_ATI:*/ + case GL_DRAW_BUFFER3_ARB: +/* case GL_DRAW_BUFFER3_ATI:*/ + case GL_DRAW_BUFFER4_ARB: +/* case GL_DRAW_BUFFER4_ATI:*/ + case GL_DRAW_BUFFER5_ARB: +/* case GL_DRAW_BUFFER5_ATI:*/ + case GL_DRAW_BUFFER6_ARB: +/* case GL_DRAW_BUFFER6_ATI:*/ + case GL_DRAW_BUFFER7_ARB: +/* case GL_DRAW_BUFFER7_ATI:*/ + case GL_DRAW_BUFFER8_ARB: +/* case GL_DRAW_BUFFER8_ATI:*/ + case GL_DRAW_BUFFER9_ARB: +/* case GL_DRAW_BUFFER9_ATI:*/ + case GL_DRAW_BUFFER10_ARB: +/* case GL_DRAW_BUFFER10_ATI:*/ + case GL_DRAW_BUFFER11_ARB: +/* case GL_DRAW_BUFFER11_ATI:*/ + case GL_DRAW_BUFFER12_ARB: +/* case GL_DRAW_BUFFER12_ATI:*/ + case GL_DRAW_BUFFER13_ARB: +/* case GL_DRAW_BUFFER13_ATI:*/ + case GL_DRAW_BUFFER14_ARB: +/* case GL_DRAW_BUFFER14_ATI:*/ + case GL_DRAW_BUFFER15_ARB: +/* case GL_DRAW_BUFFER15_ATI:*/ + case GL_BLEND_EQUATION_ALPHA_EXT: + case GL_MATRIX_PALETTE_ARB: + case GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB: + case GL_MAX_PALETTE_MATRICES_ARB: + case GL_CURRENT_PALETTE_MATRIX_ARB: + case GL_MATRIX_INDEX_ARRAY_ARB: + case GL_CURRENT_MATRIX_INDEX_ARB: + case GL_MATRIX_INDEX_ARRAY_SIZE_ARB: + case GL_MATRIX_INDEX_ARRAY_TYPE_ARB: + case GL_MATRIX_INDEX_ARRAY_STRIDE_ARB: + case GL_POINT_SPRITE_ARB: +/* case GL_POINT_SPRITE_NV:*/ + case GL_POINT_SPRITE_R_MODE_NV: + case GL_MAX_VERTEX_ATTRIBS_ARB: + case GL_MAX_TEXTURE_COORDS_ARB: + case GL_MAX_TEXTURE_IMAGE_UNITS_ARB: + case GL_DEPTH_BOUNDS_TEST_EXT: + case GL_STENCIL_TEST_TWO_SIDE_EXT: + case GL_ACTIVE_STENCIL_FACE_EXT: + case GL_DRAW_FRAMEBUFFER_BINDING_EXT: + case GL_RENDERBUFFER_BINDING_EXT: + case GL_READ_FRAMEBUFFER_BINDING_EXT: + case GL_MAX_COLOR_ATTACHMENTS_EXT: + case GL_RASTER_POSITION_UNCLIPPED_IBM: + return 1; + case GL_SMOOTH_POINT_SIZE_RANGE: + case GL_LINE_WIDTH_RANGE: + case GL_POLYGON_MODE: + case GL_DEPTH_RANGE: + case GL_MAX_VIEWPORT_DIMS: + case GL_MAP1_GRID_DOMAIN: + case GL_MAP2_GRID_SEGMENTS: + case GL_ALIASED_POINT_SIZE_RANGE: + case GL_ALIASED_LINE_WIDTH_RANGE: + case GL_DEPTH_BOUNDS_EXT: + return 2; + case GL_CURRENT_NORMAL: + case GL_POINT_DISTANCE_ATTENUATION: + return 3; + case GL_CURRENT_COLOR: + case GL_CURRENT_TEXTURE_COORDS: + case GL_CURRENT_RASTER_COLOR: + case GL_CURRENT_RASTER_TEXTURE_COORDS: + case GL_CURRENT_RASTER_POSITION: + case GL_LIGHT_MODEL_AMBIENT: + case GL_FOG_COLOR: + case GL_ACCUM_CLEAR_VALUE: + case GL_VIEWPORT: + case GL_SCISSOR_BOX: + case GL_COLOR_CLEAR_VALUE: + case GL_COLOR_WRITEMASK: + case GL_MAP2_GRID_DOMAIN: + case GL_BLEND_COLOR: +/* case GL_BLEND_COLOR_EXT:*/ + case GL_CURRENT_SECONDARY_COLOR: + return 4; + case GL_MODELVIEW_MATRIX: + case GL_PROJECTION_MATRIX: + case GL_TEXTURE_MATRIX: + case GL_MODELVIEW0_ARB: + case GL_COLOR_MATRIX: + case GL_MODELVIEW1_ARB: + case GL_CURRENT_MATRIX_ARB: + case GL_MODELVIEW2_ARB: + case GL_MODELVIEW3_ARB: + case GL_MODELVIEW4_ARB: + case GL_MODELVIEW5_ARB: + case GL_MODELVIEW6_ARB: + case GL_MODELVIEW7_ARB: + case GL_MODELVIEW8_ARB: + case GL_MODELVIEW9_ARB: + case GL_MODELVIEW10_ARB: + case GL_MODELVIEW11_ARB: + case GL_MODELVIEW12_ARB: + case GL_MODELVIEW13_ARB: + case GL_MODELVIEW14_ARB: + case GL_MODELVIEW15_ARB: + case GL_MODELVIEW16_ARB: + case GL_MODELVIEW17_ARB: + case GL_MODELVIEW18_ARB: + case GL_MODELVIEW19_ARB: + case GL_MODELVIEW20_ARB: + case GL_MODELVIEW21_ARB: + case GL_MODELVIEW22_ARB: + case GL_MODELVIEW23_ARB: + case GL_MODELVIEW24_ARB: + case GL_MODELVIEW25_ARB: + case GL_MODELVIEW26_ARB: + case GL_MODELVIEW27_ARB: + case GL_MODELVIEW28_ARB: + case GL_MODELVIEW29_ARB: + case GL_MODELVIEW30_ARB: + case GL_MODELVIEW31_ARB: + case GL_TRANSPOSE_CURRENT_MATRIX_ARB: + return 16; + case GL_FOG_COORDINATE_SOURCE: + case GL_COMPRESSED_TEXTURE_FORMATS: + return __glGetBooleanv_variable_size(e); + default: + return 0; + } +} + +INTERNAL PURE FASTCALL GLint +__glGetTexParameterfv_size(GLenum e) +{ + switch (e) { + case GL_TEXTURE_MAG_FILTER: + case GL_TEXTURE_MIN_FILTER: + case GL_TEXTURE_WRAP_S: + case GL_TEXTURE_WRAP_T: + case GL_TEXTURE_PRIORITY: + case GL_TEXTURE_RESIDENT: + case GL_TEXTURE_WRAP_R: + case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: +/* case GL_SHADOW_AMBIENT_SGIX:*/ + case GL_TEXTURE_MIN_LOD: + case GL_TEXTURE_MAX_LOD: + case GL_TEXTURE_BASE_LEVEL: + case GL_TEXTURE_MAX_LEVEL: + case GL_TEXTURE_CLIPMAP_FRAME_SGIX: + case GL_TEXTURE_LOD_BIAS_S_SGIX: + case GL_TEXTURE_LOD_BIAS_T_SGIX: + case GL_TEXTURE_LOD_BIAS_R_SGIX: + case GL_GENERATE_MIPMAP: +/* case GL_GENERATE_MIPMAP_SGIS:*/ + case GL_TEXTURE_COMPARE_SGIX: + case GL_TEXTURE_COMPARE_OPERATOR_SGIX: + case GL_TEXTURE_MAX_CLAMP_S_SGIX: + case GL_TEXTURE_MAX_CLAMP_T_SGIX: + case GL_TEXTURE_MAX_CLAMP_R_SGIX: + case GL_TEXTURE_MAX_ANISOTROPY_EXT: + case GL_TEXTURE_LOD_BIAS: +/* case GL_TEXTURE_LOD_BIAS_EXT:*/ + case GL_DEPTH_TEXTURE_MODE: +/* case GL_DEPTH_TEXTURE_MODE_ARB:*/ + case GL_TEXTURE_COMPARE_MODE: +/* case GL_TEXTURE_COMPARE_MODE_ARB:*/ + case GL_TEXTURE_COMPARE_FUNC: +/* case GL_TEXTURE_COMPARE_FUNC_ARB:*/ + case GL_TEXTURE_UNSIGNED_REMAP_MODE_NV: + return 1; + case GL_TEXTURE_CLIPMAP_CENTER_SGIX: + case GL_TEXTURE_CLIPMAP_OFFSET_SGIX: + return 2; + case GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX: + return 3; + case GL_TEXTURE_BORDER_COLOR: + case GL_POST_TEXTURE_FILTER_BIAS_SGIX: + case GL_POST_TEXTURE_FILTER_SCALE_SGIX: + return 4; + default: + return 0; + } +} + +INTERNAL PURE FASTCALL GLint +__glGetTexLevelParameterfv_size(GLenum e) +{ + switch (e) { + case GL_TEXTURE_WIDTH: + case GL_TEXTURE_HEIGHT: + case GL_TEXTURE_COMPONENTS: + case GL_TEXTURE_BORDER: + case GL_TEXTURE_RED_SIZE: +/* case GL_TEXTURE_RED_SIZE_EXT:*/ + case GL_TEXTURE_GREEN_SIZE: +/* case GL_TEXTURE_GREEN_SIZE_EXT:*/ + case GL_TEXTURE_BLUE_SIZE: +/* case GL_TEXTURE_BLUE_SIZE_EXT:*/ + case GL_TEXTURE_ALPHA_SIZE: +/* case GL_TEXTURE_ALPHA_SIZE_EXT:*/ + case GL_TEXTURE_LUMINANCE_SIZE: +/* case GL_TEXTURE_LUMINANCE_SIZE_EXT:*/ + case GL_TEXTURE_INTENSITY_SIZE: +/* case GL_TEXTURE_INTENSITY_SIZE_EXT:*/ + case GL_TEXTURE_DEPTH: + case GL_TEXTURE_INDEX_SIZE_EXT: + case GL_TEXTURE_COMPRESSED_IMAGE_SIZE: +/* case GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB:*/ + case GL_TEXTURE_COMPRESSED: +/* case GL_TEXTURE_COMPRESSED_ARB:*/ + case GL_TEXTURE_DEPTH_SIZE: +/* case GL_TEXTURE_DEPTH_SIZE_ARB:*/ + return 1; + default: + return 0; + } +} + +INTERNAL PURE FASTCALL GLint +__glColorTableParameterfv_size(GLenum e) +{ + switch (e) { + case GL_COLOR_TABLE_SCALE: + case GL_COLOR_TABLE_BIAS: + return 4; + default: + return 0; + } +} + +INTERNAL PURE FASTCALL GLint +__glGetColorTableParameterfv_size(GLenum e) +{ + switch (e) { + case GL_COLOR_TABLE_FORMAT: +/* case GL_COLOR_TABLE_FORMAT_EXT:*/ + case GL_COLOR_TABLE_WIDTH: +/* case GL_COLOR_TABLE_WIDTH_EXT:*/ + case GL_COLOR_TABLE_RED_SIZE: +/* case GL_COLOR_TABLE_RED_SIZE_EXT:*/ + case GL_COLOR_TABLE_GREEN_SIZE: +/* case GL_COLOR_TABLE_GREEN_SIZE_EXT:*/ + case GL_COLOR_TABLE_BLUE_SIZE: +/* case GL_COLOR_TABLE_BLUE_SIZE_EXT:*/ + case GL_COLOR_TABLE_ALPHA_SIZE: +/* case GL_COLOR_TABLE_ALPHA_SIZE_EXT:*/ + case GL_COLOR_TABLE_LUMINANCE_SIZE: +/* case GL_COLOR_TABLE_LUMINANCE_SIZE_EXT:*/ + case GL_COLOR_TABLE_INTENSITY_SIZE: +/* case GL_COLOR_TABLE_INTENSITY_SIZE_EXT:*/ + return 1; + case GL_COLOR_TABLE_SCALE: + case GL_COLOR_TABLE_BIAS: + return 4; + default: + return 0; + } +} + +INTERNAL PURE FASTCALL GLint +__glConvolutionParameterfv_size(GLenum e) +{ + switch (e) { + case GL_CONVOLUTION_BORDER_MODE: +/* case GL_CONVOLUTION_BORDER_MODE_EXT:*/ + return 1; + case GL_CONVOLUTION_FILTER_SCALE: +/* case GL_CONVOLUTION_FILTER_SCALE_EXT:*/ + case GL_CONVOLUTION_FILTER_BIAS: +/* case GL_CONVOLUTION_FILTER_BIAS_EXT:*/ + case GL_CONVOLUTION_BORDER_COLOR: +/* case GL_CONVOLUTION_BORDER_COLOR_HP:*/ + return 4; + default: + return 0; + } +} + +INTERNAL PURE FASTCALL GLint +__glGetConvolutionParameterfv_size(GLenum e) +{ + switch (e) { + case GL_CONVOLUTION_BORDER_MODE: +/* case GL_CONVOLUTION_BORDER_MODE_EXT:*/ + case GL_CONVOLUTION_FORMAT: +/* case GL_CONVOLUTION_FORMAT_EXT:*/ + case GL_CONVOLUTION_WIDTH: +/* case GL_CONVOLUTION_WIDTH_EXT:*/ + case GL_CONVOLUTION_HEIGHT: +/* case GL_CONVOLUTION_HEIGHT_EXT:*/ + case GL_MAX_CONVOLUTION_WIDTH: +/* case GL_MAX_CONVOLUTION_WIDTH_EXT:*/ + case GL_MAX_CONVOLUTION_HEIGHT: +/* case GL_MAX_CONVOLUTION_HEIGHT_EXT:*/ + return 1; + case GL_CONVOLUTION_FILTER_SCALE: +/* case GL_CONVOLUTION_FILTER_SCALE_EXT:*/ + case GL_CONVOLUTION_FILTER_BIAS: +/* case GL_CONVOLUTION_FILTER_BIAS_EXT:*/ + case GL_CONVOLUTION_BORDER_COLOR: +/* case GL_CONVOLUTION_BORDER_COLOR_HP:*/ + return 4; + default: + return 0; + } +} + +INTERNAL PURE FASTCALL GLint +__glGetHistogramParameterfv_size(GLenum e) +{ + switch (e) { + case GL_HISTOGRAM_WIDTH: + case GL_HISTOGRAM_FORMAT: + case GL_HISTOGRAM_RED_SIZE: + case GL_HISTOGRAM_GREEN_SIZE: + case GL_HISTOGRAM_BLUE_SIZE: + case GL_HISTOGRAM_ALPHA_SIZE: + case GL_HISTOGRAM_LUMINANCE_SIZE: + case GL_HISTOGRAM_SINK: + return 1; + default: + return 0; + } +} + +INTERNAL PURE FASTCALL GLint +__glGetMinmaxParameterfv_size(GLenum e) +{ + switch (e) { + case GL_MINMAX_FORMAT: + case GL_MINMAX_SINK: + return 1; + default: + return 0; + } +} + +INTERNAL PURE FASTCALL GLint +__glGetProgramivARB_size(GLenum e) +{ + switch (e) { + case GL_PROGRAM_LENGTH_ARB: + case GL_PROGRAM_BINDING_ARB: + case GL_PROGRAM_ALU_INSTRUCTIONS_ARB: + case GL_PROGRAM_TEX_INSTRUCTIONS_ARB: + case GL_PROGRAM_TEX_INDIRECTIONS_ARB: + case GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB: + case GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB: + case GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB: + case GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB: + case GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB: + case GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB: + case GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB: + case GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB: + case GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB: + case GL_PROGRAM_FORMAT_ARB: + case GL_PROGRAM_INSTRUCTIONS_ARB: + case GL_MAX_PROGRAM_INSTRUCTIONS_ARB: + case GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB: + case GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB: + case GL_PROGRAM_TEMPORARIES_ARB: + case GL_MAX_PROGRAM_TEMPORARIES_ARB: + case GL_PROGRAM_NATIVE_TEMPORARIES_ARB: + case GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB: + case GL_PROGRAM_PARAMETERS_ARB: + case GL_MAX_PROGRAM_PARAMETERS_ARB: + case GL_PROGRAM_NATIVE_PARAMETERS_ARB: + case GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB: + case GL_PROGRAM_ATTRIBS_ARB: + case GL_MAX_PROGRAM_ATTRIBS_ARB: + case GL_PROGRAM_NATIVE_ATTRIBS_ARB: + case GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB: + case GL_PROGRAM_ADDRESS_REGISTERS_ARB: + case GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB: + case GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB: + case GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB: + case GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB: + case GL_MAX_PROGRAM_ENV_PARAMETERS_ARB: + case GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB: + case GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV: + case GL_MAX_PROGRAM_CALL_DEPTH_NV: + case GL_MAX_PROGRAM_IF_DEPTH_NV: + case GL_MAX_PROGRAM_LOOP_DEPTH_NV: + case GL_MAX_PROGRAM_LOOP_COUNT_NV: + return 1; + default: + return 0; + } +} + +INTERNAL PURE FASTCALL GLint +__glGetVertexAttribdvARB_size(GLenum e) +{ + switch (e) { + case GL_VERTEX_PROGRAM_ARB: + case GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB: + case GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB: + case GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB: + case GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB: + case GL_CURRENT_VERTEX_ATTRIB_ARB: + return 1; + default: + return 0; + } +} + +INTERNAL PURE FASTCALL GLint +__glGetQueryObjectivARB_size(GLenum e) +{ + switch (e) { + case GL_QUERY_RESULT_ARB: + case GL_QUERY_RESULT_AVAILABLE_ARB: + return 1; + default: + return 0; + } +} + +INTERNAL PURE FASTCALL GLint +__glGetQueryivARB_size(GLenum e) +{ + switch (e) { + case GL_QUERY_COUNTER_BITS_ARB: + case GL_CURRENT_QUERY_ARB: + return 1; + default: + return 0; + } +} + +INTERNAL PURE FASTCALL GLint +__glPointParameterfvEXT_size(GLenum e) +{ + switch (e) { + case GL_POINT_SIZE_MIN: +/* case GL_POINT_SIZE_MIN_ARB:*/ +/* case GL_POINT_SIZE_MIN_SGIS:*/ + case GL_POINT_SIZE_MAX: +/* case GL_POINT_SIZE_MAX_ARB:*/ +/* case GL_POINT_SIZE_MAX_SGIS:*/ + case GL_POINT_FADE_THRESHOLD_SIZE: +/* case GL_POINT_FADE_THRESHOLD_SIZE_ARB:*/ +/* case GL_POINT_FADE_THRESHOLD_SIZE_SGIS:*/ + case GL_POINT_SPRITE_R_MODE_NV: + case GL_POINT_SPRITE_COORD_ORIGIN: + return 1; + case GL_POINT_DISTANCE_ATTENUATION: +/* case GL_POINT_DISTANCE_ATTENUATION_ARB:*/ +/* case GL_POINT_DISTANCE_ATTENUATION_SGIS:*/ + return 3; + default: + return 0; + } +} + +INTERNAL PURE FASTCALL GLint +__glGetProgramivNV_size(GLenum e) +{ + switch (e) { + case GL_PROGRAM_LENGTH_NV: + case GL_PROGRAM_TARGET_NV: + case GL_PROGRAM_RESIDENT_NV: + return 1; + default: + return 0; + } +} + +INTERNAL PURE FASTCALL GLint +__glGetVertexAttribdvNV_size(GLenum e) +{ + switch (e) { + case GL_ATTRIB_ARRAY_SIZE_NV: + case GL_ATTRIB_ARRAY_STRIDE_NV: + case GL_ATTRIB_ARRAY_TYPE_NV: + case GL_CURRENT_ATTRIB_NV: + return 1; + default: + return 0; + } +} + +INTERNAL PURE FASTCALL GLint +__glGetFramebufferAttachmentParameterivEXT_size(GLenum e) +{ + switch (e) { + case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT: + case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT: + case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT: + case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT: + case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT: + return 1; + default: + return 0; + } +} + +ALIAS(Fogiv, Fogfv) + ALIAS(Lightiv, Lightfv) + ALIAS(LightModeliv, LightModelfv) + ALIAS(Materialiv, Materialfv) + ALIAS(TexParameteriv, TexParameterfv) + ALIAS(TexEnviv, TexEnvfv) + ALIAS(TexGenfv, TexGendv) + ALIAS(TexGeniv, TexGendv) + ALIAS(Map1f, Map1d) + ALIAS(Map2f, Map2d) + ALIAS(GetDoublev, GetBooleanv) + ALIAS(GetFloatv, GetBooleanv) + ALIAS(GetIntegerv, GetBooleanv) + ALIAS(GetLightfv, Lightfv) + ALIAS(GetLightiv, Lightfv) + ALIAS(GetMaterialfv, Materialfv) + ALIAS(GetMaterialiv, Materialfv) + ALIAS(GetTexEnvfv, TexEnvfv) + ALIAS(GetTexEnviv, TexEnvfv) + ALIAS(GetTexGendv, TexGendv) + ALIAS(GetTexGenfv, TexGendv) + ALIAS(GetTexGeniv, TexGendv) + ALIAS(GetTexParameteriv, GetTexParameterfv) + ALIAS(GetTexLevelParameteriv, GetTexLevelParameterfv) + ALIAS(ColorTableParameteriv, ColorTableParameterfv) + ALIAS(GetColorTableParameteriv, GetColorTableParameterfv) + ALIAS(ConvolutionParameteriv, ConvolutionParameterfv) + ALIAS(GetConvolutionParameteriv, GetConvolutionParameterfv) + ALIAS(GetHistogramParameteriv, GetHistogramParameterfv) + ALIAS(GetMinmaxParameteriv, GetMinmaxParameterfv) + ALIAS(GetVertexAttribfvARB, GetVertexAttribdvARB) + ALIAS(GetVertexAttribivARB, GetVertexAttribdvARB) + ALIAS(GetQueryObjectuivARB, GetQueryObjectivARB) + ALIAS(GetVertexAttribfvNV, GetVertexAttribdvNV) + ALIAS(GetVertexAttribivNV, GetVertexAttribdvNV) + ALIAS(PointParameterivNV, PointParameterfvEXT) +# undef PURE +# undef FASTCALL +# undef INTERNAL diff --git a/dist/Mesa/src/glx/x11/indirect_size_get.h b/dist/Mesa/src/glx/x11/indirect_size_get.h new file mode 100644 index 000000000..4fcb55b4e --- /dev/null +++ b/dist/Mesa/src/glx/x11/indirect_size_get.h @@ -0,0 +1,102 @@ +/* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */ + +/* + * (C) Copyright IBM Corporation 2004 + * 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 + * IBM, + * 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. + */ + +#if !defined( _INDIRECT_SIZE_GET_H_ ) +# define _INDIRECT_SIZE_GET_H_ + +/** + * \file + * Prototypes for functions used to determine the number of data elements in + * various GLX protocol messages. + * + * \author Ian Romanick <idr@us.ibm.com> + */ + +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define PURE __attribute__((pure)) +# else +# define PURE +# endif + +# if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__) +# define FASTCALL __attribute__((fastcall)) +# else +# define FASTCALL +# endif + +# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) +# define INTERNAL __attribute__((visibility("internal"))) +# else +# define INTERNAL +# endif + +extern INTERNAL PURE FASTCALL GLint __glGetBooleanv_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetDoublev_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetFloatv_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetIntegerv_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetLightfv_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetLightiv_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetMaterialfv_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetMaterialiv_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetTexEnvfv_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetTexEnviv_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetTexGendv_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetTexGenfv_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetTexGeniv_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetTexParameterfv_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetTexParameteriv_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetTexLevelParameterfv_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetTexLevelParameteriv_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetColorTableParameterfv_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetColorTableParameteriv_size(GLenum); +extern INTERNAL PURE FASTCALL GLint +__glGetConvolutionParameterfv_size(GLenum); +extern INTERNAL PURE FASTCALL GLint +__glGetConvolutionParameteriv_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetHistogramParameterfv_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetHistogramParameteriv_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetMinmaxParameterfv_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetMinmaxParameteriv_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetProgramivARB_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribdvARB_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribfvARB_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribivARB_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetQueryObjectivARB_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetQueryObjectuivARB_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetQueryivARB_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetProgramivNV_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribdvNV_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribfvNV_size(GLenum); +extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribivNV_size(GLenum); +extern INTERNAL PURE FASTCALL GLint +__glGetFramebufferAttachmentParameterivEXT_size(GLenum); + +# undef PURE +# undef FASTCALL +# undef INTERNAL + +#endif /* !defined( _INDIRECT_SIZE_GET_H_ ) */ diff --git a/dist/Mesa/src/glx/x11/indirect_table.c b/dist/Mesa/src/glx/x11/indirect_table.c new file mode 100644 index 000000000..60d676064 --- /dev/null +++ b/dist/Mesa/src/glx/x11/indirect_table.c @@ -0,0 +1,1593 @@ +/* DO NOT EDIT - This file generated automatically by glX_server_table.py (from Mesa) script */ + +/* + * (C) Copyright IBM Corporation 2005, 2006 + * 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 + * IBM, + * 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. + */ + +#include <inttypes.h> +#include "glxserver.h" +#include "glxext.h" +#include "indirect_dispatch.h" +#include "indirect_reqsize.h" +#include "g_disptab.h" +#include "indirect_table.h" + +/*****************************************************************/ +/* tree depth = 3 */ +static const int_fast16_t Single_dispatch_tree[24] = { + /* [0] -> opcode range [0, 256], node depth 1 */ + 2, + 5, + 13, + 16, + EMPTY_LEAF, + + /* [5] -> opcode range [0, 64], node depth 2 */ + 2, + LEAF(0), + LEAF(16), + 10, + EMPTY_LEAF, + + /* [10] -> opcode range [32, 48], node depth 3 */ + 1, + LEAF(32), + EMPTY_LEAF, + + /* [13] -> opcode range [64, 128], node depth 2 */ + 1, + EMPTY_LEAF, + LEAF(40), + + /* [16] -> opcode range [128, 192], node depth 2 */ + 2, + LEAF(72), + LEAF(88), + 21, + EMPTY_LEAF, + + /* [21] -> opcode range [160, 176], node depth 3 */ + 1, + LEAF(104), + EMPTY_LEAF, + +}; + +static const void *Single_function_table[112][2] = { + /* [ 0] = 0 */ {NULL, NULL}, + /* [ 1] = 1 */ {__glXDisp_Render, __glXDispSwap_Render}, + /* [ 2] = 2 */ {__glXDisp_RenderLarge, __glXDispSwap_RenderLarge}, + /* [ 3] = 3 */ {__glXDisp_CreateContext, __glXDispSwap_CreateContext}, + /* [ 4] = 4 */ {__glXDisp_DestroyContext, __glXDispSwap_DestroyContext}, + /* [ 5] = 5 */ {__glXDisp_MakeCurrent, __glXDispSwap_MakeCurrent}, + /* [ 6] = 6 */ {__glXDisp_IsDirect, __glXDispSwap_IsDirect}, + /* [ 7] = 7 */ {__glXDisp_QueryVersion, __glXDispSwap_QueryVersion}, + /* [ 8] = 8 */ {__glXDisp_WaitGL, __glXDispSwap_WaitGL}, + /* [ 9] = 9 */ {__glXDisp_WaitX, __glXDispSwap_WaitX}, + /* [ 10] = 10 */ {__glXDisp_CopyContext, __glXDispSwap_CopyContext}, + /* [ 11] = 11 */ {__glXDisp_SwapBuffers, __glXDispSwap_SwapBuffers}, + /* [ 12] = 12 */ {__glXDisp_UseXFont, __glXDispSwap_UseXFont}, + /* [ 13] = 13 */ {__glXDisp_CreateGLXPixmap, __glXDispSwap_CreateGLXPixmap}, + /* [ 14] = 14 */ {__glXDisp_GetVisualConfigs, __glXDispSwap_GetVisualConfigs}, + /* [ 15] = 15 */ {__glXDisp_DestroyGLXPixmap, __glXDispSwap_DestroyGLXPixmap}, + /* [ 16] = 16 */ {__glXDisp_VendorPrivate, __glXDispSwap_VendorPrivate}, + /* [ 17] = 17 */ {__glXDisp_VendorPrivateWithReply, __glXDispSwap_VendorPrivateWithReply}, + /* [ 18] = 18 */ {__glXDisp_QueryExtensionsString, __glXDispSwap_QueryExtensionsString}, + /* [ 19] = 19 */ {__glXDisp_QueryServerString, __glXDispSwap_QueryServerString}, + /* [ 20] = 20 */ {__glXDisp_ClientInfo, __glXDispSwap_ClientInfo}, + /* [ 21] = 21 */ {__glXDisp_GetFBConfigs, __glXDispSwap_GetFBConfigs}, + /* [ 22] = 22 */ {__glXDisp_CreatePixmap, __glXDispSwap_CreatePixmap}, + /* [ 23] = 23 */ {__glXDisp_DestroyPixmap, __glXDispSwap_DestroyPixmap}, + /* [ 24] = 24 */ {__glXDisp_CreateNewContext, __glXDispSwap_CreateNewContext}, + /* [ 25] = 25 */ {__glXDisp_QueryContext, __glXDispSwap_QueryContext}, + /* [ 26] = 26 */ {__glXDisp_MakeContextCurrent, __glXDispSwap_MakeContextCurrent}, + /* [ 27] = 27 */ {__glXDisp_CreatePbuffer, __glXDispSwap_CreatePbuffer}, + /* [ 28] = 28 */ {__glXDisp_DestroyPbuffer, __glXDispSwap_DestroyPbuffer}, + /* [ 29] = 29 */ {__glXDisp_GetDrawableAttributes, __glXDispSwap_GetDrawableAttributes}, + /* [ 30] = 30 */ {__glXDisp_ChangeDrawableAttributes, __glXDispSwap_ChangeDrawableAttributes}, + /* [ 31] = 31 */ {__glXDisp_CreateWindow, __glXDispSwap_CreateWindow}, + /* [ 32] = 32 */ {__glXDisp_DestroyWindow, __glXDispSwap_DestroyWindow}, + /* [ 33] = 33 */ {NULL, NULL}, + /* [ 34] = 34 */ {NULL, NULL}, + /* [ 35] = 35 */ {NULL, NULL}, + /* [ 36] = 36 */ {NULL, NULL}, + /* [ 37] = 37 */ {NULL, NULL}, + /* [ 38] = 38 */ {NULL, NULL}, + /* [ 39] = 39 */ {NULL, NULL}, + /* [ 40] = 96 */ {NULL, NULL}, + /* [ 41] = 97 */ {NULL, NULL}, + /* [ 42] = 98 */ {NULL, NULL}, + /* [ 43] = 99 */ {NULL, NULL}, + /* [ 44] = 100 */ {NULL, NULL}, + /* [ 45] = 101 */ {__glXDisp_NewList, __glXDispSwap_NewList}, + /* [ 46] = 102 */ {__glXDisp_EndList, __glXDispSwap_EndList}, + /* [ 47] = 103 */ {__glXDisp_DeleteLists, __glXDispSwap_DeleteLists}, + /* [ 48] = 104 */ {__glXDisp_GenLists, __glXDispSwap_GenLists}, + /* [ 49] = 105 */ {__glXDisp_FeedbackBuffer, __glXDispSwap_FeedbackBuffer}, + /* [ 50] = 106 */ {__glXDisp_SelectBuffer, __glXDispSwap_SelectBuffer}, + /* [ 51] = 107 */ {__glXDisp_RenderMode, __glXDispSwap_RenderMode}, + /* [ 52] = 108 */ {__glXDisp_Finish, __glXDispSwap_Finish}, + /* [ 53] = 109 */ {__glXDisp_PixelStoref, __glXDispSwap_PixelStoref}, + /* [ 54] = 110 */ {__glXDisp_PixelStorei, __glXDispSwap_PixelStorei}, + /* [ 55] = 111 */ {__glXDisp_ReadPixels, __glXDispSwap_ReadPixels}, + /* [ 56] = 112 */ {__glXDisp_GetBooleanv, __glXDispSwap_GetBooleanv}, + /* [ 57] = 113 */ {__glXDisp_GetClipPlane, __glXDispSwap_GetClipPlane}, + /* [ 58] = 114 */ {__glXDisp_GetDoublev, __glXDispSwap_GetDoublev}, + /* [ 59] = 115 */ {__glXDisp_GetError, __glXDispSwap_GetError}, + /* [ 60] = 116 */ {__glXDisp_GetFloatv, __glXDispSwap_GetFloatv}, + /* [ 61] = 117 */ {__glXDisp_GetIntegerv, __glXDispSwap_GetIntegerv}, + /* [ 62] = 118 */ {__glXDisp_GetLightfv, __glXDispSwap_GetLightfv}, + /* [ 63] = 119 */ {__glXDisp_GetLightiv, __glXDispSwap_GetLightiv}, + /* [ 64] = 120 */ {__glXDisp_GetMapdv, __glXDispSwap_GetMapdv}, + /* [ 65] = 121 */ {__glXDisp_GetMapfv, __glXDispSwap_GetMapfv}, + /* [ 66] = 122 */ {__glXDisp_GetMapiv, __glXDispSwap_GetMapiv}, + /* [ 67] = 123 */ {__glXDisp_GetMaterialfv, __glXDispSwap_GetMaterialfv}, + /* [ 68] = 124 */ {__glXDisp_GetMaterialiv, __glXDispSwap_GetMaterialiv}, + /* [ 69] = 125 */ {__glXDisp_GetPixelMapfv, __glXDispSwap_GetPixelMapfv}, + /* [ 70] = 126 */ {__glXDisp_GetPixelMapuiv, __glXDispSwap_GetPixelMapuiv}, + /* [ 71] = 127 */ {__glXDisp_GetPixelMapusv, __glXDispSwap_GetPixelMapusv}, + /* [ 72] = 128 */ {__glXDisp_GetPolygonStipple, __glXDispSwap_GetPolygonStipple}, + /* [ 73] = 129 */ {__glXDisp_GetString, __glXDispSwap_GetString}, + /* [ 74] = 130 */ {__glXDisp_GetTexEnvfv, __glXDispSwap_GetTexEnvfv}, + /* [ 75] = 131 */ {__glXDisp_GetTexEnviv, __glXDispSwap_GetTexEnviv}, + /* [ 76] = 132 */ {__glXDisp_GetTexGendv, __glXDispSwap_GetTexGendv}, + /* [ 77] = 133 */ {__glXDisp_GetTexGenfv, __glXDispSwap_GetTexGenfv}, + /* [ 78] = 134 */ {__glXDisp_GetTexGeniv, __glXDispSwap_GetTexGeniv}, + /* [ 79] = 135 */ {__glXDisp_GetTexImage, __glXDispSwap_GetTexImage}, + /* [ 80] = 136 */ {__glXDisp_GetTexParameterfv, __glXDispSwap_GetTexParameterfv}, + /* [ 81] = 137 */ {__glXDisp_GetTexParameteriv, __glXDispSwap_GetTexParameteriv}, + /* [ 82] = 138 */ {__glXDisp_GetTexLevelParameterfv, __glXDispSwap_GetTexLevelParameterfv}, + /* [ 83] = 139 */ {__glXDisp_GetTexLevelParameteriv, __glXDispSwap_GetTexLevelParameteriv}, + /* [ 84] = 140 */ {__glXDisp_IsEnabled, __glXDispSwap_IsEnabled}, + /* [ 85] = 141 */ {__glXDisp_IsList, __glXDispSwap_IsList}, + /* [ 86] = 142 */ {__glXDisp_Flush, __glXDispSwap_Flush}, + /* [ 87] = 143 */ {__glXDisp_AreTexturesResident, __glXDispSwap_AreTexturesResident}, + /* [ 88] = 144 */ {__glXDisp_DeleteTextures, __glXDispSwap_DeleteTextures}, + /* [ 89] = 145 */ {__glXDisp_GenTextures, __glXDispSwap_GenTextures}, + /* [ 90] = 146 */ {__glXDisp_IsTexture, __glXDispSwap_IsTexture}, + /* [ 91] = 147 */ {__glXDisp_GetColorTable, __glXDispSwap_GetColorTable}, + /* [ 92] = 148 */ {__glXDisp_GetColorTableParameterfv, __glXDispSwap_GetColorTableParameterfv}, + /* [ 93] = 149 */ {__glXDisp_GetColorTableParameteriv, __glXDispSwap_GetColorTableParameteriv}, + /* [ 94] = 150 */ {__glXDisp_GetConvolutionFilter, __glXDispSwap_GetConvolutionFilter}, + /* [ 95] = 151 */ {__glXDisp_GetConvolutionParameterfv, __glXDispSwap_GetConvolutionParameterfv}, + /* [ 96] = 152 */ {__glXDisp_GetConvolutionParameteriv, __glXDispSwap_GetConvolutionParameteriv}, + /* [ 97] = 153 */ {__glXDisp_GetSeparableFilter, __glXDispSwap_GetSeparableFilter}, + /* [ 98] = 154 */ {__glXDisp_GetHistogram, __glXDispSwap_GetHistogram}, + /* [ 99] = 155 */ {__glXDisp_GetHistogramParameterfv, __glXDispSwap_GetHistogramParameterfv}, + /* [ 100] = 156 */ {__glXDisp_GetHistogramParameteriv, __glXDispSwap_GetHistogramParameteriv}, + /* [ 101] = 157 */ {__glXDisp_GetMinmax, __glXDispSwap_GetMinmax}, + /* [ 102] = 158 */ {__glXDisp_GetMinmaxParameterfv, __glXDispSwap_GetMinmaxParameterfv}, + /* [ 103] = 159 */ {__glXDisp_GetMinmaxParameteriv, __glXDispSwap_GetMinmaxParameteriv}, + /* [ 104] = 160 */ {__glXDisp_GetCompressedTexImageARB, __glXDispSwap_GetCompressedTexImageARB}, + /* [ 105] = 161 */ {__glXDisp_DeleteQueriesARB, __glXDispSwap_DeleteQueriesARB}, + /* [ 106] = 162 */ {__glXDisp_GenQueriesARB, __glXDispSwap_GenQueriesARB}, + /* [ 107] = 163 */ {__glXDisp_IsQueryARB, __glXDispSwap_IsQueryARB}, + /* [ 108] = 164 */ {__glXDisp_GetQueryivARB, __glXDispSwap_GetQueryivARB}, + /* [ 109] = 165 */ {__glXDisp_GetQueryObjectivARB, __glXDispSwap_GetQueryObjectivARB}, + /* [ 110] = 166 */ {__glXDisp_GetQueryObjectuivARB, __glXDispSwap_GetQueryObjectuivARB}, + /* [ 111] = 167 */ {NULL, NULL}, +}; + +const struct __glXDispatchInfo Single_dispatch_info = { + 8, + Single_dispatch_tree, + Single_function_table, + NULL, + NULL +}; + +/*****************************************************************/ +/* tree depth = 8 */ +static const int_fast16_t Render_dispatch_tree[95] = { + /* [0] -> opcode range [0, 8192], node depth 1 */ + 2, + 5, + 31, + 54, + EMPTY_LEAF, + + /* [5] -> opcode range [0, 2048], node depth 2 */ + 1, + 8, + EMPTY_LEAF, + + /* [8] -> opcode range [0, 1024], node depth 3 */ + 1, + 11, + EMPTY_LEAF, + + /* [11] -> opcode range [0, 512], node depth 4 */ + 1, + 14, + EMPTY_LEAF, + + /* [14] -> opcode range [0, 256], node depth 5 */ + 4, + LEAF(0), + LEAF(16), + LEAF(32), + LEAF(48), + LEAF(64), + LEAF(80), + LEAF(96), + LEAF(112), + LEAF(128), + LEAF(144), + LEAF(160), + LEAF(176), + LEAF(192), + LEAF(208), + LEAF(224), + EMPTY_LEAF, + + /* [31] -> opcode range [2048, 4096], node depth 2 */ + 1, + 34, + EMPTY_LEAF, + + /* [34] -> opcode range [2048, 3072], node depth 3 */ + 1, + 37, + EMPTY_LEAF, + + /* [37] -> opcode range [2048, 2560], node depth 4 */ + 1, + 40, + EMPTY_LEAF, + + /* [40] -> opcode range [2048, 2304], node depth 5 */ + 1, + 43, + EMPTY_LEAF, + + /* [43] -> opcode range [2048, 2176], node depth 6 */ + 1, + 46, + EMPTY_LEAF, + + /* [46] -> opcode range [2048, 2112], node depth 7 */ + 1, + 49, + EMPTY_LEAF, + + /* [49] -> opcode range [2048, 2080], node depth 8 */ + 2, + LEAF(240), + LEAF(248), + LEAF(256), + EMPTY_LEAF, + + /* [54] -> opcode range [4096, 6144], node depth 2 */ + 1, + 57, + EMPTY_LEAF, + + /* [57] -> opcode range [4096, 5120], node depth 3 */ + 1, + 60, + EMPTY_LEAF, + + /* [60] -> opcode range [4096, 4608], node depth 4 */ + 1, + 63, + EMPTY_LEAF, + + /* [63] -> opcode range [4096, 4352], node depth 5 */ + 4, + LEAF(264), + LEAF(280), + 80, + EMPTY_LEAF, + EMPTY_LEAF, + LEAF(296), + LEAF(312), + LEAF(328), + LEAF(344), + EMPTY_LEAF, + 83, + 86, + EMPTY_LEAF, + 89, + 92, + EMPTY_LEAF, + + /* [80] -> opcode range [4128, 4144], node depth 6 */ + 1, + LEAF(360), + EMPTY_LEAF, + + /* [83] -> opcode range [4256, 4272], node depth 6 */ + 1, + EMPTY_LEAF, + LEAF(368), + + /* [86] -> opcode range [4272, 4288], node depth 6 */ + 1, + LEAF(376), + EMPTY_LEAF, + + /* [89] -> opcode range [4304, 4320], node depth 6 */ + 1, + EMPTY_LEAF, + LEAF(384), + + /* [92] -> opcode range [4320, 4336], node depth 6 */ + 1, + LEAF(392), + EMPTY_LEAF, + +}; + +static const void *Render_function_table[400][2] = { + /* [ 0] = 0 */ {NULL, NULL}, + /* [ 1] = 1 */ {__glXDisp_CallList, __glXDispSwap_CallList}, + /* [ 2] = 2 */ {__glXDisp_CallLists, __glXDispSwap_CallLists}, + /* [ 3] = 3 */ {__glXDisp_ListBase, __glXDispSwap_ListBase}, + /* [ 4] = 4 */ {__glXDisp_Begin, __glXDispSwap_Begin}, + /* [ 5] = 5 */ {__glXDisp_Bitmap, __glXDispSwap_Bitmap}, + /* [ 6] = 6 */ {__glXDisp_Color3bv, __glXDispSwap_Color3bv}, + /* [ 7] = 7 */ {__glXDisp_Color3dv, __glXDispSwap_Color3dv}, + /* [ 8] = 8 */ {__glXDisp_Color3fv, __glXDispSwap_Color3fv}, + /* [ 9] = 9 */ {__glXDisp_Color3iv, __glXDispSwap_Color3iv}, + /* [ 10] = 10 */ {__glXDisp_Color3sv, __glXDispSwap_Color3sv}, + /* [ 11] = 11 */ {__glXDisp_Color3ubv, __glXDispSwap_Color3ubv}, + /* [ 12] = 12 */ {__glXDisp_Color3uiv, __glXDispSwap_Color3uiv}, + /* [ 13] = 13 */ {__glXDisp_Color3usv, __glXDispSwap_Color3usv}, + /* [ 14] = 14 */ {__glXDisp_Color4bv, __glXDispSwap_Color4bv}, + /* [ 15] = 15 */ {__glXDisp_Color4dv, __glXDispSwap_Color4dv}, + /* [ 16] = 16 */ {__glXDisp_Color4fv, __glXDispSwap_Color4fv}, + /* [ 17] = 17 */ {__glXDisp_Color4iv, __glXDispSwap_Color4iv}, + /* [ 18] = 18 */ {__glXDisp_Color4sv, __glXDispSwap_Color4sv}, + /* [ 19] = 19 */ {__glXDisp_Color4ubv, __glXDispSwap_Color4ubv}, + /* [ 20] = 20 */ {__glXDisp_Color4uiv, __glXDispSwap_Color4uiv}, + /* [ 21] = 21 */ {__glXDisp_Color4usv, __glXDispSwap_Color4usv}, + /* [ 22] = 22 */ {__glXDisp_EdgeFlagv, __glXDispSwap_EdgeFlagv}, + /* [ 23] = 23 */ {__glXDisp_End, __glXDispSwap_End}, + /* [ 24] = 24 */ {__glXDisp_Indexdv, __glXDispSwap_Indexdv}, + /* [ 25] = 25 */ {__glXDisp_Indexfv, __glXDispSwap_Indexfv}, + /* [ 26] = 26 */ {__glXDisp_Indexiv, __glXDispSwap_Indexiv}, + /* [ 27] = 27 */ {__glXDisp_Indexsv, __glXDispSwap_Indexsv}, + /* [ 28] = 28 */ {__glXDisp_Normal3bv, __glXDispSwap_Normal3bv}, + /* [ 29] = 29 */ {__glXDisp_Normal3dv, __glXDispSwap_Normal3dv}, + /* [ 30] = 30 */ {__glXDisp_Normal3fv, __glXDispSwap_Normal3fv}, + /* [ 31] = 31 */ {__glXDisp_Normal3iv, __glXDispSwap_Normal3iv}, + /* [ 32] = 32 */ {__glXDisp_Normal3sv, __glXDispSwap_Normal3sv}, + /* [ 33] = 33 */ {__glXDisp_RasterPos2dv, __glXDispSwap_RasterPos2dv}, + /* [ 34] = 34 */ {__glXDisp_RasterPos2fv, __glXDispSwap_RasterPos2fv}, + /* [ 35] = 35 */ {__glXDisp_RasterPos2iv, __glXDispSwap_RasterPos2iv}, + /* [ 36] = 36 */ {__glXDisp_RasterPos2sv, __glXDispSwap_RasterPos2sv}, + /* [ 37] = 37 */ {__glXDisp_RasterPos3dv, __glXDispSwap_RasterPos3dv}, + /* [ 38] = 38 */ {__glXDisp_RasterPos3fv, __glXDispSwap_RasterPos3fv}, + /* [ 39] = 39 */ {__glXDisp_RasterPos3iv, __glXDispSwap_RasterPos3iv}, + /* [ 40] = 40 */ {__glXDisp_RasterPos3sv, __glXDispSwap_RasterPos3sv}, + /* [ 41] = 41 */ {__glXDisp_RasterPos4dv, __glXDispSwap_RasterPos4dv}, + /* [ 42] = 42 */ {__glXDisp_RasterPos4fv, __glXDispSwap_RasterPos4fv}, + /* [ 43] = 43 */ {__glXDisp_RasterPos4iv, __glXDispSwap_RasterPos4iv}, + /* [ 44] = 44 */ {__glXDisp_RasterPos4sv, __glXDispSwap_RasterPos4sv}, + /* [ 45] = 45 */ {__glXDisp_Rectdv, __glXDispSwap_Rectdv}, + /* [ 46] = 46 */ {__glXDisp_Rectfv, __glXDispSwap_Rectfv}, + /* [ 47] = 47 */ {__glXDisp_Rectiv, __glXDispSwap_Rectiv}, + /* [ 48] = 48 */ {__glXDisp_Rectsv, __glXDispSwap_Rectsv}, + /* [ 49] = 49 */ {__glXDisp_TexCoord1dv, __glXDispSwap_TexCoord1dv}, + /* [ 50] = 50 */ {__glXDisp_TexCoord1fv, __glXDispSwap_TexCoord1fv}, + /* [ 51] = 51 */ {__glXDisp_TexCoord1iv, __glXDispSwap_TexCoord1iv}, + /* [ 52] = 52 */ {__glXDisp_TexCoord1sv, __glXDispSwap_TexCoord1sv}, + /* [ 53] = 53 */ {__glXDisp_TexCoord2dv, __glXDispSwap_TexCoord2dv}, + /* [ 54] = 54 */ {__glXDisp_TexCoord2fv, __glXDispSwap_TexCoord2fv}, + /* [ 55] = 55 */ {__glXDisp_TexCoord2iv, __glXDispSwap_TexCoord2iv}, + /* [ 56] = 56 */ {__glXDisp_TexCoord2sv, __glXDispSwap_TexCoord2sv}, + /* [ 57] = 57 */ {__glXDisp_TexCoord3dv, __glXDispSwap_TexCoord3dv}, + /* [ 58] = 58 */ {__glXDisp_TexCoord3fv, __glXDispSwap_TexCoord3fv}, + /* [ 59] = 59 */ {__glXDisp_TexCoord3iv, __glXDispSwap_TexCoord3iv}, + /* [ 60] = 60 */ {__glXDisp_TexCoord3sv, __glXDispSwap_TexCoord3sv}, + /* [ 61] = 61 */ {__glXDisp_TexCoord4dv, __glXDispSwap_TexCoord4dv}, + /* [ 62] = 62 */ {__glXDisp_TexCoord4fv, __glXDispSwap_TexCoord4fv}, + /* [ 63] = 63 */ {__glXDisp_TexCoord4iv, __glXDispSwap_TexCoord4iv}, + /* [ 64] = 64 */ {__glXDisp_TexCoord4sv, __glXDispSwap_TexCoord4sv}, + /* [ 65] = 65 */ {__glXDisp_Vertex2dv, __glXDispSwap_Vertex2dv}, + /* [ 66] = 66 */ {__glXDisp_Vertex2fv, __glXDispSwap_Vertex2fv}, + /* [ 67] = 67 */ {__glXDisp_Vertex2iv, __glXDispSwap_Vertex2iv}, + /* [ 68] = 68 */ {__glXDisp_Vertex2sv, __glXDispSwap_Vertex2sv}, + /* [ 69] = 69 */ {__glXDisp_Vertex3dv, __glXDispSwap_Vertex3dv}, + /* [ 70] = 70 */ {__glXDisp_Vertex3fv, __glXDispSwap_Vertex3fv}, + /* [ 71] = 71 */ {__glXDisp_Vertex3iv, __glXDispSwap_Vertex3iv}, + /* [ 72] = 72 */ {__glXDisp_Vertex3sv, __glXDispSwap_Vertex3sv}, + /* [ 73] = 73 */ {__glXDisp_Vertex4dv, __glXDispSwap_Vertex4dv}, + /* [ 74] = 74 */ {__glXDisp_Vertex4fv, __glXDispSwap_Vertex4fv}, + /* [ 75] = 75 */ {__glXDisp_Vertex4iv, __glXDispSwap_Vertex4iv}, + /* [ 76] = 76 */ {__glXDisp_Vertex4sv, __glXDispSwap_Vertex4sv}, + /* [ 77] = 77 */ {__glXDisp_ClipPlane, __glXDispSwap_ClipPlane}, + /* [ 78] = 78 */ {__glXDisp_ColorMaterial, __glXDispSwap_ColorMaterial}, + /* [ 79] = 79 */ {__glXDisp_CullFace, __glXDispSwap_CullFace}, + /* [ 80] = 80 */ {__glXDisp_Fogf, __glXDispSwap_Fogf}, + /* [ 81] = 81 */ {__glXDisp_Fogfv, __glXDispSwap_Fogfv}, + /* [ 82] = 82 */ {__glXDisp_Fogi, __glXDispSwap_Fogi}, + /* [ 83] = 83 */ {__glXDisp_Fogiv, __glXDispSwap_Fogiv}, + /* [ 84] = 84 */ {__glXDisp_FrontFace, __glXDispSwap_FrontFace}, + /* [ 85] = 85 */ {__glXDisp_Hint, __glXDispSwap_Hint}, + /* [ 86] = 86 */ {__glXDisp_Lightf, __glXDispSwap_Lightf}, + /* [ 87] = 87 */ {__glXDisp_Lightfv, __glXDispSwap_Lightfv}, + /* [ 88] = 88 */ {__glXDisp_Lighti, __glXDispSwap_Lighti}, + /* [ 89] = 89 */ {__glXDisp_Lightiv, __glXDispSwap_Lightiv}, + /* [ 90] = 90 */ {__glXDisp_LightModelf, __glXDispSwap_LightModelf}, + /* [ 91] = 91 */ {__glXDisp_LightModelfv, __glXDispSwap_LightModelfv}, + /* [ 92] = 92 */ {__glXDisp_LightModeli, __glXDispSwap_LightModeli}, + /* [ 93] = 93 */ {__glXDisp_LightModeliv, __glXDispSwap_LightModeliv}, + /* [ 94] = 94 */ {__glXDisp_LineStipple, __glXDispSwap_LineStipple}, + /* [ 95] = 95 */ {__glXDisp_LineWidth, __glXDispSwap_LineWidth}, + /* [ 96] = 96 */ {__glXDisp_Materialf, __glXDispSwap_Materialf}, + /* [ 97] = 97 */ {__glXDisp_Materialfv, __glXDispSwap_Materialfv}, + /* [ 98] = 98 */ {__glXDisp_Materiali, __glXDispSwap_Materiali}, + /* [ 99] = 99 */ {__glXDisp_Materialiv, __glXDispSwap_Materialiv}, + /* [ 100] = 100 */ {__glXDisp_PointSize, __glXDispSwap_PointSize}, + /* [ 101] = 101 */ {__glXDisp_PolygonMode, __glXDispSwap_PolygonMode}, + /* [ 102] = 102 */ {__glXDisp_PolygonStipple, __glXDispSwap_PolygonStipple}, + /* [ 103] = 103 */ {__glXDisp_Scissor, __glXDispSwap_Scissor}, + /* [ 104] = 104 */ {__glXDisp_ShadeModel, __glXDispSwap_ShadeModel}, + /* [ 105] = 105 */ {__glXDisp_TexParameterf, __glXDispSwap_TexParameterf}, + /* [ 106] = 106 */ {__glXDisp_TexParameterfv, __glXDispSwap_TexParameterfv}, + /* [ 107] = 107 */ {__glXDisp_TexParameteri, __glXDispSwap_TexParameteri}, + /* [ 108] = 108 */ {__glXDisp_TexParameteriv, __glXDispSwap_TexParameteriv}, + /* [ 109] = 109 */ {__glXDisp_TexImage1D, __glXDispSwap_TexImage1D}, + /* [ 110] = 110 */ {__glXDisp_TexImage2D, __glXDispSwap_TexImage2D}, + /* [ 111] = 111 */ {__glXDisp_TexEnvf, __glXDispSwap_TexEnvf}, + /* [ 112] = 112 */ {__glXDisp_TexEnvfv, __glXDispSwap_TexEnvfv}, + /* [ 113] = 113 */ {__glXDisp_TexEnvi, __glXDispSwap_TexEnvi}, + /* [ 114] = 114 */ {__glXDisp_TexEnviv, __glXDispSwap_TexEnviv}, + /* [ 115] = 115 */ {__glXDisp_TexGend, __glXDispSwap_TexGend}, + /* [ 116] = 116 */ {__glXDisp_TexGendv, __glXDispSwap_TexGendv}, + /* [ 117] = 117 */ {__glXDisp_TexGenf, __glXDispSwap_TexGenf}, + /* [ 118] = 118 */ {__glXDisp_TexGenfv, __glXDispSwap_TexGenfv}, + /* [ 119] = 119 */ {__glXDisp_TexGeni, __glXDispSwap_TexGeni}, + /* [ 120] = 120 */ {__glXDisp_TexGeniv, __glXDispSwap_TexGeniv}, + /* [ 121] = 121 */ {__glXDisp_InitNames, __glXDispSwap_InitNames}, + /* [ 122] = 122 */ {__glXDisp_LoadName, __glXDispSwap_LoadName}, + /* [ 123] = 123 */ {__glXDisp_PassThrough, __glXDispSwap_PassThrough}, + /* [ 124] = 124 */ {__glXDisp_PopName, __glXDispSwap_PopName}, + /* [ 125] = 125 */ {__glXDisp_PushName, __glXDispSwap_PushName}, + /* [ 126] = 126 */ {__glXDisp_DrawBuffer, __glXDispSwap_DrawBuffer}, + /* [ 127] = 127 */ {__glXDisp_Clear, __glXDispSwap_Clear}, + /* [ 128] = 128 */ {__glXDisp_ClearAccum, __glXDispSwap_ClearAccum}, + /* [ 129] = 129 */ {__glXDisp_ClearIndex, __glXDispSwap_ClearIndex}, + /* [ 130] = 130 */ {__glXDisp_ClearColor, __glXDispSwap_ClearColor}, + /* [ 131] = 131 */ {__glXDisp_ClearStencil, __glXDispSwap_ClearStencil}, + /* [ 132] = 132 */ {__glXDisp_ClearDepth, __glXDispSwap_ClearDepth}, + /* [ 133] = 133 */ {__glXDisp_StencilMask, __glXDispSwap_StencilMask}, + /* [ 134] = 134 */ {__glXDisp_ColorMask, __glXDispSwap_ColorMask}, + /* [ 135] = 135 */ {__glXDisp_DepthMask, __glXDispSwap_DepthMask}, + /* [ 136] = 136 */ {__glXDisp_IndexMask, __glXDispSwap_IndexMask}, + /* [ 137] = 137 */ {__glXDisp_Accum, __glXDispSwap_Accum}, + /* [ 138] = 138 */ {__glXDisp_Disable, __glXDispSwap_Disable}, + /* [ 139] = 139 */ {__glXDisp_Enable, __glXDispSwap_Enable}, + /* [ 140] = 140 */ {NULL, NULL}, + /* [ 141] = 141 */ {__glXDisp_PopAttrib, __glXDispSwap_PopAttrib}, + /* [ 142] = 142 */ {__glXDisp_PushAttrib, __glXDispSwap_PushAttrib}, + /* [ 143] = 143 */ {__glXDisp_Map1d, __glXDispSwap_Map1d}, + /* [ 144] = 144 */ {__glXDisp_Map1f, __glXDispSwap_Map1f}, + /* [ 145] = 145 */ {__glXDisp_Map2d, __glXDispSwap_Map2d}, + /* [ 146] = 146 */ {__glXDisp_Map2f, __glXDispSwap_Map2f}, + /* [ 147] = 147 */ {__glXDisp_MapGrid1d, __glXDispSwap_MapGrid1d}, + /* [ 148] = 148 */ {__glXDisp_MapGrid1f, __glXDispSwap_MapGrid1f}, + /* [ 149] = 149 */ {__glXDisp_MapGrid2d, __glXDispSwap_MapGrid2d}, + /* [ 150] = 150 */ {__glXDisp_MapGrid2f, __glXDispSwap_MapGrid2f}, + /* [ 151] = 151 */ {__glXDisp_EvalCoord1dv, __glXDispSwap_EvalCoord1dv}, + /* [ 152] = 152 */ {__glXDisp_EvalCoord1fv, __glXDispSwap_EvalCoord1fv}, + /* [ 153] = 153 */ {__glXDisp_EvalCoord2dv, __glXDispSwap_EvalCoord2dv}, + /* [ 154] = 154 */ {__glXDisp_EvalCoord2fv, __glXDispSwap_EvalCoord2fv}, + /* [ 155] = 155 */ {__glXDisp_EvalMesh1, __glXDispSwap_EvalMesh1}, + /* [ 156] = 156 */ {__glXDisp_EvalPoint1, __glXDispSwap_EvalPoint1}, + /* [ 157] = 157 */ {__glXDisp_EvalMesh2, __glXDispSwap_EvalMesh2}, + /* [ 158] = 158 */ {__glXDisp_EvalPoint2, __glXDispSwap_EvalPoint2}, + /* [ 159] = 159 */ {__glXDisp_AlphaFunc, __glXDispSwap_AlphaFunc}, + /* [ 160] = 160 */ {__glXDisp_BlendFunc, __glXDispSwap_BlendFunc}, + /* [ 161] = 161 */ {__glXDisp_LogicOp, __glXDispSwap_LogicOp}, + /* [ 162] = 162 */ {__glXDisp_StencilFunc, __glXDispSwap_StencilFunc}, + /* [ 163] = 163 */ {__glXDisp_StencilOp, __glXDispSwap_StencilOp}, + /* [ 164] = 164 */ {__glXDisp_DepthFunc, __glXDispSwap_DepthFunc}, + /* [ 165] = 165 */ {__glXDisp_PixelZoom, __glXDispSwap_PixelZoom}, + /* [ 166] = 166 */ {__glXDisp_PixelTransferf, __glXDispSwap_PixelTransferf}, + /* [ 167] = 167 */ {__glXDisp_PixelTransferi, __glXDispSwap_PixelTransferi}, + /* [ 168] = 168 */ {__glXDisp_PixelMapfv, __glXDispSwap_PixelMapfv}, + /* [ 169] = 169 */ {__glXDisp_PixelMapuiv, __glXDispSwap_PixelMapuiv}, + /* [ 170] = 170 */ {__glXDisp_PixelMapusv, __glXDispSwap_PixelMapusv}, + /* [ 171] = 171 */ {__glXDisp_ReadBuffer, __glXDispSwap_ReadBuffer}, + /* [ 172] = 172 */ {__glXDisp_CopyPixels, __glXDispSwap_CopyPixels}, + /* [ 173] = 173 */ {__glXDisp_DrawPixels, __glXDispSwap_DrawPixels}, + /* [ 174] = 174 */ {__glXDisp_DepthRange, __glXDispSwap_DepthRange}, + /* [ 175] = 175 */ {__glXDisp_Frustum, __glXDispSwap_Frustum}, + /* [ 176] = 176 */ {__glXDisp_LoadIdentity, __glXDispSwap_LoadIdentity}, + /* [ 177] = 177 */ {__glXDisp_LoadMatrixf, __glXDispSwap_LoadMatrixf}, + /* [ 178] = 178 */ {__glXDisp_LoadMatrixd, __glXDispSwap_LoadMatrixd}, + /* [ 179] = 179 */ {__glXDisp_MatrixMode, __glXDispSwap_MatrixMode}, + /* [ 180] = 180 */ {__glXDisp_MultMatrixf, __glXDispSwap_MultMatrixf}, + /* [ 181] = 181 */ {__glXDisp_MultMatrixd, __glXDispSwap_MultMatrixd}, + /* [ 182] = 182 */ {__glXDisp_Ortho, __glXDispSwap_Ortho}, + /* [ 183] = 183 */ {__glXDisp_PopMatrix, __glXDispSwap_PopMatrix}, + /* [ 184] = 184 */ {__glXDisp_PushMatrix, __glXDispSwap_PushMatrix}, + /* [ 185] = 185 */ {__glXDisp_Rotated, __glXDispSwap_Rotated}, + /* [ 186] = 186 */ {__glXDisp_Rotatef, __glXDispSwap_Rotatef}, + /* [ 187] = 187 */ {__glXDisp_Scaled, __glXDispSwap_Scaled}, + /* [ 188] = 188 */ {__glXDisp_Scalef, __glXDispSwap_Scalef}, + /* [ 189] = 189 */ {__glXDisp_Translated, __glXDispSwap_Translated}, + /* [ 190] = 190 */ {__glXDisp_Translatef, __glXDispSwap_Translatef}, + /* [ 191] = 191 */ {__glXDisp_Viewport, __glXDispSwap_Viewport}, + /* [ 192] = 192 */ {__glXDisp_PolygonOffset, __glXDispSwap_PolygonOffset}, + /* [ 193] = 193 */ {__glXDisp_DrawArrays, __glXDispSwap_DrawArrays}, + /* [ 194] = 194 */ {__glXDisp_Indexubv, __glXDispSwap_Indexubv}, + /* [ 195] = 195 */ {__glXDisp_ColorSubTable, __glXDispSwap_ColorSubTable}, + /* [ 196] = 196 */ {__glXDisp_CopyColorSubTable, __glXDispSwap_CopyColorSubTable}, + /* [ 197] = 197 */ {__glXDisp_ActiveTextureARB, __glXDispSwap_ActiveTextureARB}, + /* [ 198] = 198 */ {__glXDisp_MultiTexCoord1dvARB, __glXDispSwap_MultiTexCoord1dvARB}, + /* [ 199] = 199 */ {__glXDisp_MultiTexCoord1fvARB, __glXDispSwap_MultiTexCoord1fvARB}, + /* [ 200] = 200 */ {__glXDisp_MultiTexCoord1ivARB, __glXDispSwap_MultiTexCoord1ivARB}, + /* [ 201] = 201 */ {__glXDisp_MultiTexCoord1svARB, __glXDispSwap_MultiTexCoord1svARB}, + /* [ 202] = 202 */ {__glXDisp_MultiTexCoord2dvARB, __glXDispSwap_MultiTexCoord2dvARB}, + /* [ 203] = 203 */ {__glXDisp_MultiTexCoord2fvARB, __glXDispSwap_MultiTexCoord2fvARB}, + /* [ 204] = 204 */ {__glXDisp_MultiTexCoord2ivARB, __glXDispSwap_MultiTexCoord2ivARB}, + /* [ 205] = 205 */ {__glXDisp_MultiTexCoord2svARB, __glXDispSwap_MultiTexCoord2svARB}, + /* [ 206] = 206 */ {__glXDisp_MultiTexCoord3dvARB, __glXDispSwap_MultiTexCoord3dvARB}, + /* [ 207] = 207 */ {__glXDisp_MultiTexCoord3fvARB, __glXDispSwap_MultiTexCoord3fvARB}, + /* [ 208] = 208 */ {__glXDisp_MultiTexCoord3ivARB, __glXDispSwap_MultiTexCoord3ivARB}, + /* [ 209] = 209 */ {__glXDisp_MultiTexCoord3svARB, __glXDispSwap_MultiTexCoord3svARB}, + /* [ 210] = 210 */ {__glXDisp_MultiTexCoord4dvARB, __glXDispSwap_MultiTexCoord4dvARB}, + /* [ 211] = 211 */ {__glXDisp_MultiTexCoord4fvARB, __glXDispSwap_MultiTexCoord4fvARB}, + /* [ 212] = 212 */ {__glXDisp_MultiTexCoord4ivARB, __glXDispSwap_MultiTexCoord4ivARB}, + /* [ 213] = 213 */ {__glXDisp_MultiTexCoord4svARB, __glXDispSwap_MultiTexCoord4svARB}, + /* [ 214] = 214 */ {__glXDisp_CompressedTexImage1DARB, __glXDispSwap_CompressedTexImage1DARB}, + /* [ 215] = 215 */ {__glXDisp_CompressedTexImage2DARB, __glXDispSwap_CompressedTexImage2DARB}, + /* [ 216] = 216 */ {__glXDisp_CompressedTexImage3DARB, __glXDispSwap_CompressedTexImage3DARB}, + /* [ 217] = 217 */ {__glXDisp_CompressedTexSubImage1DARB, __glXDispSwap_CompressedTexSubImage1DARB}, + /* [ 218] = 218 */ {__glXDisp_CompressedTexSubImage2DARB, __glXDispSwap_CompressedTexSubImage2DARB}, + /* [ 219] = 219 */ {__glXDisp_CompressedTexSubImage3DARB, __glXDispSwap_CompressedTexSubImage3DARB}, + /* [ 220] = 220 */ {NULL, NULL}, + /* [ 221] = 221 */ {NULL, NULL}, + /* [ 222] = 222 */ {NULL, NULL}, + /* [ 223] = 223 */ {NULL, NULL}, + /* [ 224] = 224 */ {NULL, NULL}, + /* [ 225] = 225 */ {NULL, NULL}, + /* [ 226] = 226 */ {NULL, NULL}, + /* [ 227] = 227 */ {NULL, NULL}, + /* [ 228] = 228 */ {NULL, NULL}, + /* [ 229] = 229 */ {__glXDisp_SampleCoverageARB, __glXDispSwap_SampleCoverageARB}, + /* [ 230] = 230 */ {__glXDisp_WindowPos3fvMESA, __glXDispSwap_WindowPos3fvMESA}, + /* [ 231] = 231 */ {__glXDisp_BeginQueryARB, __glXDispSwap_BeginQueryARB}, + /* [ 232] = 232 */ {__glXDisp_EndQueryARB, __glXDispSwap_EndQueryARB}, + /* [ 233] = 233 */ {__glXDisp_DrawBuffersARB, __glXDispSwap_DrawBuffersARB}, + /* [ 234] = 234 */ {NULL, NULL}, + /* [ 235] = 235 */ {NULL, NULL}, + /* [ 236] = 236 */ {NULL, NULL}, + /* [ 237] = 237 */ {NULL, NULL}, + /* [ 238] = 238 */ {NULL, NULL}, + /* [ 239] = 239 */ {NULL, NULL}, + /* [ 240] = 2048 */ {__glXDisp_SampleMaskSGIS, __glXDispSwap_SampleMaskSGIS}, + /* [ 241] = 2049 */ {__glXDisp_SamplePatternSGIS, __glXDispSwap_SamplePatternSGIS}, + /* [ 242] = 2050 */ {NULL, NULL}, + /* [ 243] = 2051 */ {NULL, NULL}, + /* [ 244] = 2052 */ {NULL, NULL}, + /* [ 245] = 2053 */ {__glXDisp_ColorTable, __glXDispSwap_ColorTable}, + /* [ 246] = 2054 */ {__glXDisp_ColorTableParameterfv, __glXDispSwap_ColorTableParameterfv}, + /* [ 247] = 2055 */ {__glXDisp_ColorTableParameteriv, __glXDispSwap_ColorTableParameteriv}, + /* [ 248] = 2056 */ {__glXDisp_CopyColorTable, __glXDispSwap_CopyColorTable}, + /* [ 249] = 2057 */ {NULL, NULL}, + /* [ 250] = 2058 */ {NULL, NULL}, + /* [ 251] = 2059 */ {NULL, NULL}, + /* [ 252] = 2060 */ {NULL, NULL}, + /* [ 253] = 2061 */ {NULL, NULL}, + /* [ 254] = 2062 */ {NULL, NULL}, + /* [ 255] = 2063 */ {NULL, NULL}, + /* [ 256] = 2064 */ {NULL, NULL}, + /* [ 257] = 2065 */ {__glXDisp_PointParameterfEXT, __glXDispSwap_PointParameterfEXT}, + /* [ 258] = 2066 */ {__glXDisp_PointParameterfvEXT, __glXDispSwap_PointParameterfvEXT}, + /* [ 259] = 2067 */ {NULL, NULL}, + /* [ 260] = 2068 */ {NULL, NULL}, + /* [ 261] = 2069 */ {NULL, NULL}, + /* [ 262] = 2070 */ {NULL, NULL}, + /* [ 263] = 2071 */ {NULL, NULL}, + /* [ 264] = 4096 */ {__glXDisp_BlendColor, __glXDispSwap_BlendColor}, + /* [ 265] = 4097 */ {__glXDisp_BlendEquation, __glXDispSwap_BlendEquation}, + /* [ 266] = 4098 */ {NULL, NULL}, + /* [ 267] = 4099 */ {__glXDisp_TexSubImage1D, __glXDispSwap_TexSubImage1D}, + /* [ 268] = 4100 */ {__glXDisp_TexSubImage2D, __glXDispSwap_TexSubImage2D}, + /* [ 269] = 4101 */ {__glXDisp_ConvolutionFilter1D, __glXDispSwap_ConvolutionFilter1D}, + /* [ 270] = 4102 */ {__glXDisp_ConvolutionFilter2D, __glXDispSwap_ConvolutionFilter2D}, + /* [ 271] = 4103 */ {__glXDisp_ConvolutionParameterf, __glXDispSwap_ConvolutionParameterf}, + /* [ 272] = 4104 */ {__glXDisp_ConvolutionParameterfv, __glXDispSwap_ConvolutionParameterfv}, + /* [ 273] = 4105 */ {__glXDisp_ConvolutionParameteri, __glXDispSwap_ConvolutionParameteri}, + /* [ 274] = 4106 */ {__glXDisp_ConvolutionParameteriv, __glXDispSwap_ConvolutionParameteriv}, + /* [ 275] = 4107 */ {__glXDisp_CopyConvolutionFilter1D, __glXDispSwap_CopyConvolutionFilter1D}, + /* [ 276] = 4108 */ {__glXDisp_CopyConvolutionFilter2D, __glXDispSwap_CopyConvolutionFilter2D}, + /* [ 277] = 4109 */ {__glXDisp_SeparableFilter2D, __glXDispSwap_SeparableFilter2D}, + /* [ 278] = 4110 */ {__glXDisp_Histogram, __glXDispSwap_Histogram}, + /* [ 279] = 4111 */ {__glXDisp_Minmax, __glXDispSwap_Minmax}, + /* [ 280] = 4112 */ {__glXDisp_ResetHistogram, __glXDispSwap_ResetHistogram}, + /* [ 281] = 4113 */ {__glXDisp_ResetMinmax, __glXDispSwap_ResetMinmax}, + /* [ 282] = 4114 */ {__glXDisp_TexImage3D, __glXDispSwap_TexImage3D}, + /* [ 283] = 4115 */ {__glXDisp_TexSubImage3D, __glXDispSwap_TexSubImage3D}, + /* [ 284] = 4116 */ {NULL, NULL}, + /* [ 285] = 4117 */ {__glXDisp_BindTexture, __glXDispSwap_BindTexture}, + /* [ 286] = 4118 */ {__glXDisp_PrioritizeTextures, __glXDispSwap_PrioritizeTextures}, + /* [ 287] = 4119 */ {__glXDisp_CopyTexImage1D, __glXDispSwap_CopyTexImage1D}, + /* [ 288] = 4120 */ {__glXDisp_CopyTexImage2D, __glXDispSwap_CopyTexImage2D}, + /* [ 289] = 4121 */ {__glXDisp_CopyTexSubImage1D, __glXDispSwap_CopyTexSubImage1D}, + /* [ 290] = 4122 */ {__glXDisp_CopyTexSubImage2D, __glXDispSwap_CopyTexSubImage2D}, + /* [ 291] = 4123 */ {__glXDisp_CopyTexSubImage3D, __glXDispSwap_CopyTexSubImage3D}, + /* [ 292] = 4124 */ {__glXDisp_FogCoordfvEXT, __glXDispSwap_FogCoordfvEXT}, + /* [ 293] = 4125 */ {__glXDisp_FogCoorddvEXT, __glXDispSwap_FogCoorddvEXT}, + /* [ 294] = 4126 */ {__glXDisp_SecondaryColor3bvEXT, __glXDispSwap_SecondaryColor3bvEXT}, + /* [ 295] = 4127 */ {__glXDisp_SecondaryColor3svEXT, __glXDispSwap_SecondaryColor3svEXT}, + /* [ 296] = 4176 */ {NULL, NULL}, + /* [ 297] = 4177 */ {NULL, NULL}, + /* [ 298] = 4178 */ {NULL, NULL}, + /* [ 299] = 4179 */ {NULL, NULL}, + /* [ 300] = 4180 */ {__glXDisp_BindProgramNV, __glXDispSwap_BindProgramNV}, + /* [ 301] = 4181 */ {__glXDisp_ExecuteProgramNV, __glXDispSwap_ExecuteProgramNV}, + /* [ 302] = 4182 */ {__glXDisp_RequestResidentProgramsNV, __glXDispSwap_RequestResidentProgramsNV}, + /* [ 303] = 4183 */ {__glXDisp_LoadProgramNV, __glXDispSwap_LoadProgramNV}, + /* [ 304] = 4184 */ {__glXDisp_ProgramParameter4fvNV, __glXDispSwap_ProgramParameter4fvNV}, + /* [ 305] = 4185 */ {__glXDisp_ProgramEnvParameter4dvARB, __glXDispSwap_ProgramEnvParameter4dvARB}, + /* [ 306] = 4186 */ {__glXDisp_ProgramParameters4fvNV, __glXDispSwap_ProgramParameters4fvNV}, + /* [ 307] = 4187 */ {__glXDisp_ProgramParameters4dvNV, __glXDispSwap_ProgramParameters4dvNV}, + /* [ 308] = 4188 */ {__glXDisp_TrackMatrixNV, __glXDispSwap_TrackMatrixNV}, + /* [ 309] = 4189 */ {__glXDisp_VertexAttrib1svARB, __glXDispSwap_VertexAttrib1svARB}, + /* [ 310] = 4190 */ {__glXDisp_VertexAttrib2svARB, __glXDispSwap_VertexAttrib2svARB}, + /* [ 311] = 4191 */ {__glXDisp_VertexAttrib3svARB, __glXDispSwap_VertexAttrib3svARB}, + /* [ 312] = 4192 */ {__glXDisp_VertexAttrib4svARB, __glXDispSwap_VertexAttrib4svARB}, + /* [ 313] = 4193 */ {__glXDisp_VertexAttrib1fvARB, __glXDispSwap_VertexAttrib1fvARB}, + /* [ 314] = 4194 */ {__glXDisp_VertexAttrib2fvARB, __glXDispSwap_VertexAttrib2fvARB}, + /* [ 315] = 4195 */ {__glXDisp_VertexAttrib3fvARB, __glXDispSwap_VertexAttrib3fvARB}, + /* [ 316] = 4196 */ {__glXDisp_VertexAttrib4fvARB, __glXDispSwap_VertexAttrib4fvARB}, + /* [ 317] = 4197 */ {__glXDisp_VertexAttrib1dvARB, __glXDispSwap_VertexAttrib1dvARB}, + /* [ 318] = 4198 */ {__glXDisp_VertexAttrib2dvARB, __glXDispSwap_VertexAttrib2dvARB}, + /* [ 319] = 4199 */ {__glXDisp_VertexAttrib3dvARB, __glXDispSwap_VertexAttrib3dvARB}, + /* [ 320] = 4200 */ {__glXDisp_VertexAttrib4dvARB, __glXDispSwap_VertexAttrib4dvARB}, + /* [ 321] = 4201 */ {__glXDisp_VertexAttrib4NubvARB, __glXDispSwap_VertexAttrib4NubvARB}, + /* [ 322] = 4202 */ {__glXDisp_VertexAttribs1svNV, __glXDispSwap_VertexAttribs1svNV}, + /* [ 323] = 4203 */ {__glXDisp_VertexAttribs2svNV, __glXDispSwap_VertexAttribs2svNV}, + /* [ 324] = 4204 */ {__glXDisp_VertexAttribs3svNV, __glXDispSwap_VertexAttribs3svNV}, + /* [ 325] = 4205 */ {__glXDisp_VertexAttribs4svNV, __glXDispSwap_VertexAttribs4svNV}, + /* [ 326] = 4206 */ {__glXDisp_VertexAttribs1fvNV, __glXDispSwap_VertexAttribs1fvNV}, + /* [ 327] = 4207 */ {__glXDisp_VertexAttribs2fvNV, __glXDispSwap_VertexAttribs2fvNV}, + /* [ 328] = 4208 */ {__glXDisp_VertexAttribs3fvNV, __glXDispSwap_VertexAttribs3fvNV}, + /* [ 329] = 4209 */ {__glXDisp_VertexAttribs4fvNV, __glXDispSwap_VertexAttribs4fvNV}, + /* [ 330] = 4210 */ {__glXDisp_VertexAttribs1dvNV, __glXDispSwap_VertexAttribs1dvNV}, + /* [ 331] = 4211 */ {__glXDisp_VertexAttribs2dvNV, __glXDispSwap_VertexAttribs2dvNV}, + /* [ 332] = 4212 */ {__glXDisp_VertexAttribs3dvNV, __glXDispSwap_VertexAttribs3dvNV}, + /* [ 333] = 4213 */ {__glXDisp_VertexAttribs4dvNV, __glXDispSwap_VertexAttribs4dvNV}, + /* [ 334] = 4214 */ {__glXDisp_VertexAttribs4ubvNV, __glXDispSwap_VertexAttribs4ubvNV}, + /* [ 335] = 4215 */ {__glXDisp_ProgramLocalParameter4fvARB, __glXDispSwap_ProgramLocalParameter4fvARB}, + /* [ 336] = 4216 */ {__glXDisp_ProgramLocalParameter4dvARB, __glXDispSwap_ProgramLocalParameter4dvARB}, + /* [ 337] = 4217 */ {__glXDisp_ProgramStringARB, __glXDispSwap_ProgramStringARB}, + /* [ 338] = 4218 */ {__glXDisp_ProgramNamedParameter4fvNV, __glXDispSwap_ProgramNamedParameter4fvNV}, + /* [ 339] = 4219 */ {__glXDisp_ProgramNamedParameter4dvNV, __glXDispSwap_ProgramNamedParameter4dvNV}, + /* [ 340] = 4220 */ {__glXDisp_ActiveStencilFaceEXT, __glXDispSwap_ActiveStencilFaceEXT}, + /* [ 341] = 4221 */ {__glXDisp_PointParameteriNV, __glXDispSwap_PointParameteriNV}, + /* [ 342] = 4222 */ {__glXDisp_PointParameterivNV, __glXDispSwap_PointParameterivNV}, + /* [ 343] = 4223 */ {NULL, NULL}, + /* [ 344] = 4224 */ {NULL, NULL}, + /* [ 345] = 4225 */ {NULL, NULL}, + /* [ 346] = 4226 */ {NULL, NULL}, + /* [ 347] = 4227 */ {NULL, NULL}, + /* [ 348] = 4228 */ {__glXDisp_BlendEquationSeparateEXT, __glXDispSwap_BlendEquationSeparateEXT}, + /* [ 349] = 4229 */ {NULL, NULL}, + /* [ 350] = 4230 */ {__glXDisp_VertexAttrib4bvARB, __glXDispSwap_VertexAttrib4bvARB}, + /* [ 351] = 4231 */ {__glXDisp_VertexAttrib4ivARB, __glXDispSwap_VertexAttrib4ivARB}, + /* [ 352] = 4232 */ {__glXDisp_VertexAttrib4ubvARB, __glXDispSwap_VertexAttrib4ubvARB}, + /* [ 353] = 4233 */ {__glXDisp_VertexAttrib4usvARB, __glXDispSwap_VertexAttrib4usvARB}, + /* [ 354] = 4234 */ {__glXDisp_VertexAttrib4uivARB, __glXDispSwap_VertexAttrib4uivARB}, + /* [ 355] = 4235 */ {__glXDisp_VertexAttrib4NbvARB, __glXDispSwap_VertexAttrib4NbvARB}, + /* [ 356] = 4236 */ {__glXDisp_VertexAttrib4NsvARB, __glXDispSwap_VertexAttrib4NsvARB}, + /* [ 357] = 4237 */ {__glXDisp_VertexAttrib4NivARB, __glXDispSwap_VertexAttrib4NivARB}, + /* [ 358] = 4238 */ {__glXDisp_VertexAttrib4NusvARB, __glXDispSwap_VertexAttrib4NusvARB}, + /* [ 359] = 4239 */ {__glXDisp_VertexAttrib4NuivARB, __glXDispSwap_VertexAttrib4NuivARB}, + /* [ 360] = 4128 */ {__glXDisp_SecondaryColor3ivEXT, __glXDispSwap_SecondaryColor3ivEXT}, + /* [ 361] = 4129 */ {__glXDisp_SecondaryColor3fvEXT, __glXDispSwap_SecondaryColor3fvEXT}, + /* [ 362] = 4130 */ {__glXDisp_SecondaryColor3dvEXT, __glXDispSwap_SecondaryColor3dvEXT}, + /* [ 363] = 4131 */ {__glXDisp_SecondaryColor3ubvEXT, __glXDispSwap_SecondaryColor3ubvEXT}, + /* [ 364] = 4132 */ {__glXDisp_SecondaryColor3usvEXT, __glXDispSwap_SecondaryColor3usvEXT}, + /* [ 365] = 4133 */ {__glXDisp_SecondaryColor3uivEXT, __glXDispSwap_SecondaryColor3uivEXT}, + /* [ 366] = 4134 */ {__glXDisp_BlendFuncSeparateEXT, __glXDispSwap_BlendFuncSeparateEXT}, + /* [ 367] = 4135 */ {NULL, NULL}, + /* [ 368] = 4264 */ {NULL, NULL}, + /* [ 369] = 4265 */ {__glXDisp_VertexAttrib1svNV, __glXDispSwap_VertexAttrib1svNV}, + /* [ 370] = 4266 */ {__glXDisp_VertexAttrib2svNV, __glXDispSwap_VertexAttrib2svNV}, + /* [ 371] = 4267 */ {__glXDisp_VertexAttrib3svNV, __glXDispSwap_VertexAttrib3svNV}, + /* [ 372] = 4268 */ {__glXDisp_VertexAttrib4svNV, __glXDispSwap_VertexAttrib4svNV}, + /* [ 373] = 4269 */ {__glXDisp_VertexAttrib1fvNV, __glXDispSwap_VertexAttrib1fvNV}, + /* [ 374] = 4270 */ {__glXDisp_VertexAttrib2fvNV, __glXDispSwap_VertexAttrib2fvNV}, + /* [ 375] = 4271 */ {__glXDisp_VertexAttrib3fvNV, __glXDispSwap_VertexAttrib3fvNV}, + /* [ 376] = 4272 */ {__glXDisp_VertexAttrib4fvNV, __glXDispSwap_VertexAttrib4fvNV}, + /* [ 377] = 4273 */ {__glXDisp_VertexAttrib1dvNV, __glXDispSwap_VertexAttrib1dvNV}, + /* [ 378] = 4274 */ {__glXDisp_VertexAttrib2dvNV, __glXDispSwap_VertexAttrib2dvNV}, + /* [ 379] = 4275 */ {__glXDisp_VertexAttrib3dvNV, __glXDispSwap_VertexAttrib3dvNV}, + /* [ 380] = 4276 */ {__glXDisp_VertexAttrib4dvNV, __glXDispSwap_VertexAttrib4dvNV}, + /* [ 381] = 4277 */ {__glXDisp_VertexAttrib4ubvNV, __glXDispSwap_VertexAttrib4ubvNV}, + /* [ 382] = 4278 */ {NULL, NULL}, + /* [ 383] = 4279 */ {NULL, NULL}, + /* [ 384] = 4312 */ {NULL, NULL}, + /* [ 385] = 4313 */ {NULL, NULL}, + /* [ 386] = 4314 */ {NULL, NULL}, + /* [ 387] = 4315 */ {NULL, NULL}, + /* [ 388] = 4316 */ {__glXDisp_BindRenderbufferEXT, __glXDispSwap_BindRenderbufferEXT}, + /* [ 389] = 4317 */ {__glXDisp_DeleteRenderbuffersEXT, __glXDispSwap_DeleteRenderbuffersEXT}, + /* [ 390] = 4318 */ {__glXDisp_RenderbufferStorageEXT, __glXDispSwap_RenderbufferStorageEXT}, + /* [ 391] = 4319 */ {__glXDisp_BindFramebufferEXT, __glXDispSwap_BindFramebufferEXT}, + /* [ 392] = 4320 */ {__glXDisp_DeleteFramebuffersEXT, __glXDispSwap_DeleteFramebuffersEXT}, + /* [ 393] = 4321 */ {__glXDisp_FramebufferTexture1DEXT, __glXDispSwap_FramebufferTexture1DEXT}, + /* [ 394] = 4322 */ {__glXDisp_FramebufferTexture2DEXT, __glXDispSwap_FramebufferTexture2DEXT}, + /* [ 395] = 4323 */ {__glXDisp_FramebufferTexture3DEXT, __glXDispSwap_FramebufferTexture3DEXT}, + /* [ 396] = 4324 */ {__glXDisp_FramebufferRenderbufferEXT, __glXDispSwap_FramebufferRenderbufferEXT}, + /* [ 397] = 4325 */ {__glXDisp_GenerateMipmapEXT, __glXDispSwap_GenerateMipmapEXT}, + /* [ 398] = 4326 */ {NULL, NULL}, + /* [ 399] = 4327 */ {NULL, NULL}, +}; + +static const int_fast16_t Render_size_table[400][2] = { + /* [ 0] = 0 */ { 0, ~0}, + /* [ 1] = 1 */ { 8, ~0}, + /* [ 2] = 2 */ { 12, 0}, + /* [ 3] = 3 */ { 8, ~0}, + /* [ 4] = 4 */ { 8, ~0}, + /* [ 5] = 5 */ { 48, 1}, + /* [ 6] = 6 */ { 8, ~0}, + /* [ 7] = 7 */ { 28, ~0}, + /* [ 8] = 8 */ { 16, ~0}, + /* [ 9] = 9 */ { 16, ~0}, + /* [ 10] = 10 */ { 12, ~0}, + /* [ 11] = 11 */ { 8, ~0}, + /* [ 12] = 12 */ { 16, ~0}, + /* [ 13] = 13 */ { 12, ~0}, + /* [ 14] = 14 */ { 8, ~0}, + /* [ 15] = 15 */ { 36, ~0}, + /* [ 16] = 16 */ { 20, ~0}, + /* [ 17] = 17 */ { 20, ~0}, + /* [ 18] = 18 */ { 12, ~0}, + /* [ 19] = 19 */ { 8, ~0}, + /* [ 20] = 20 */ { 20, ~0}, + /* [ 21] = 21 */ { 12, ~0}, + /* [ 22] = 22 */ { 8, ~0}, + /* [ 23] = 23 */ { 4, ~0}, + /* [ 24] = 24 */ { 12, ~0}, + /* [ 25] = 25 */ { 8, ~0}, + /* [ 26] = 26 */ { 8, ~0}, + /* [ 27] = 27 */ { 8, ~0}, + /* [ 28] = 28 */ { 8, ~0}, + /* [ 29] = 29 */ { 28, ~0}, + /* [ 30] = 30 */ { 16, ~0}, + /* [ 31] = 31 */ { 16, ~0}, + /* [ 32] = 32 */ { 12, ~0}, + /* [ 33] = 33 */ { 20, ~0}, + /* [ 34] = 34 */ { 12, ~0}, + /* [ 35] = 35 */ { 12, ~0}, + /* [ 36] = 36 */ { 8, ~0}, + /* [ 37] = 37 */ { 28, ~0}, + /* [ 38] = 38 */ { 16, ~0}, + /* [ 39] = 39 */ { 16, ~0}, + /* [ 40] = 40 */ { 12, ~0}, + /* [ 41] = 41 */ { 36, ~0}, + /* [ 42] = 42 */ { 20, ~0}, + /* [ 43] = 43 */ { 20, ~0}, + /* [ 44] = 44 */ { 12, ~0}, + /* [ 45] = 45 */ { 36, ~0}, + /* [ 46] = 46 */ { 20, ~0}, + /* [ 47] = 47 */ { 20, ~0}, + /* [ 48] = 48 */ { 12, ~0}, + /* [ 49] = 49 */ { 12, ~0}, + /* [ 50] = 50 */ { 8, ~0}, + /* [ 51] = 51 */ { 8, ~0}, + /* [ 52] = 52 */ { 8, ~0}, + /* [ 53] = 53 */ { 20, ~0}, + /* [ 54] = 54 */ { 12, ~0}, + /* [ 55] = 55 */ { 12, ~0}, + /* [ 56] = 56 */ { 8, ~0}, + /* [ 57] = 57 */ { 28, ~0}, + /* [ 58] = 58 */ { 16, ~0}, + /* [ 59] = 59 */ { 16, ~0}, + /* [ 60] = 60 */ { 12, ~0}, + /* [ 61] = 61 */ { 36, ~0}, + /* [ 62] = 62 */ { 20, ~0}, + /* [ 63] = 63 */ { 20, ~0}, + /* [ 64] = 64 */ { 12, ~0}, + /* [ 65] = 65 */ { 20, ~0}, + /* [ 66] = 66 */ { 12, ~0}, + /* [ 67] = 67 */ { 12, ~0}, + /* [ 68] = 68 */ { 8, ~0}, + /* [ 69] = 69 */ { 28, ~0}, + /* [ 70] = 70 */ { 16, ~0}, + /* [ 71] = 71 */ { 16, ~0}, + /* [ 72] = 72 */ { 12, ~0}, + /* [ 73] = 73 */ { 36, ~0}, + /* [ 74] = 74 */ { 20, ~0}, + /* [ 75] = 75 */ { 20, ~0}, + /* [ 76] = 76 */ { 12, ~0}, + /* [ 77] = 77 */ { 40, ~0}, + /* [ 78] = 78 */ { 12, ~0}, + /* [ 79] = 79 */ { 8, ~0}, + /* [ 80] = 80 */ { 12, ~0}, + /* [ 81] = 81 */ { 8, 2}, + /* [ 82] = 82 */ { 12, ~0}, + /* [ 83] = 83 */ { 8, 3}, + /* [ 84] = 84 */ { 8, ~0}, + /* [ 85] = 85 */ { 12, ~0}, + /* [ 86] = 86 */ { 16, ~0}, + /* [ 87] = 87 */ { 12, 4}, + /* [ 88] = 88 */ { 16, ~0}, + /* [ 89] = 89 */ { 12, 5}, + /* [ 90] = 90 */ { 12, ~0}, + /* [ 91] = 91 */ { 8, 6}, + /* [ 92] = 92 */ { 12, ~0}, + /* [ 93] = 93 */ { 8, 7}, + /* [ 94] = 94 */ { 12, ~0}, + /* [ 95] = 95 */ { 8, ~0}, + /* [ 96] = 96 */ { 16, ~0}, + /* [ 97] = 97 */ { 12, 8}, + /* [ 98] = 98 */ { 16, ~0}, + /* [ 99] = 99 */ { 12, 9}, + /* [100] = 100 */ { 8, ~0}, + /* [101] = 101 */ { 12, ~0}, + /* [102] = 102 */ { 24, 10}, + /* [103] = 103 */ { 20, ~0}, + /* [104] = 104 */ { 8, ~0}, + /* [105] = 105 */ { 16, ~0}, + /* [106] = 106 */ { 12, 11}, + /* [107] = 107 */ { 16, ~0}, + /* [108] = 108 */ { 12, 12}, + /* [109] = 109 */ { 56, 13}, + /* [110] = 110 */ { 56, 14}, + /* [111] = 111 */ { 16, ~0}, + /* [112] = 112 */ { 12, 15}, + /* [113] = 113 */ { 16, ~0}, + /* [114] = 114 */ { 12, 16}, + /* [115] = 115 */ { 20, ~0}, + /* [116] = 116 */ { 12, 17}, + /* [117] = 117 */ { 16, ~0}, + /* [118] = 118 */ { 12, 18}, + /* [119] = 119 */ { 16, ~0}, + /* [120] = 120 */ { 12, 19}, + /* [121] = 121 */ { 4, ~0}, + /* [122] = 122 */ { 8, ~0}, + /* [123] = 123 */ { 8, ~0}, + /* [124] = 124 */ { 4, ~0}, + /* [125] = 125 */ { 8, ~0}, + /* [126] = 126 */ { 8, ~0}, + /* [127] = 127 */ { 8, ~0}, + /* [128] = 128 */ { 20, ~0}, + /* [129] = 129 */ { 8, ~0}, + /* [130] = 130 */ { 20, ~0}, + /* [131] = 131 */ { 8, ~0}, + /* [132] = 132 */ { 12, ~0}, + /* [133] = 133 */ { 8, ~0}, + /* [134] = 134 */ { 8, ~0}, + /* [135] = 135 */ { 8, ~0}, + /* [136] = 136 */ { 8, ~0}, + /* [137] = 137 */ { 12, ~0}, + /* [138] = 138 */ { 8, ~0}, + /* [139] = 139 */ { 8, ~0}, + /* [140] = 140 */ { 0, ~0}, + /* [141] = 141 */ { 4, ~0}, + /* [142] = 142 */ { 8, ~0}, + /* [143] = 143 */ { 28, 20}, + /* [144] = 144 */ { 20, 21}, + /* [145] = 145 */ { 48, 22}, + /* [146] = 146 */ { 32, 23}, + /* [147] = 147 */ { 24, ~0}, + /* [148] = 148 */ { 16, ~0}, + /* [149] = 149 */ { 44, ~0}, + /* [150] = 150 */ { 28, ~0}, + /* [151] = 151 */ { 12, ~0}, + /* [152] = 152 */ { 8, ~0}, + /* [153] = 153 */ { 20, ~0}, + /* [154] = 154 */ { 12, ~0}, + /* [155] = 155 */ { 16, ~0}, + /* [156] = 156 */ { 8, ~0}, + /* [157] = 157 */ { 24, ~0}, + /* [158] = 158 */ { 12, ~0}, + /* [159] = 159 */ { 12, ~0}, + /* [160] = 160 */ { 12, ~0}, + /* [161] = 161 */ { 8, ~0}, + /* [162] = 162 */ { 16, ~0}, + /* [163] = 163 */ { 16, ~0}, + /* [164] = 164 */ { 8, ~0}, + /* [165] = 165 */ { 12, ~0}, + /* [166] = 166 */ { 12, ~0}, + /* [167] = 167 */ { 12, ~0}, + /* [168] = 168 */ { 12, 24}, + /* [169] = 169 */ { 12, 25}, + /* [170] = 170 */ { 12, 26}, + /* [171] = 171 */ { 8, ~0}, + /* [172] = 172 */ { 24, ~0}, + /* [173] = 173 */ { 40, 27}, + /* [174] = 174 */ { 20, ~0}, + /* [175] = 175 */ { 52, ~0}, + /* [176] = 176 */ { 4, ~0}, + /* [177] = 177 */ { 68, ~0}, + /* [178] = 178 */ {132, ~0}, + /* [179] = 179 */ { 8, ~0}, + /* [180] = 180 */ { 68, ~0}, + /* [181] = 181 */ {132, ~0}, + /* [182] = 182 */ { 52, ~0}, + /* [183] = 183 */ { 4, ~0}, + /* [184] = 184 */ { 4, ~0}, + /* [185] = 185 */ { 36, ~0}, + /* [186] = 186 */ { 20, ~0}, + /* [187] = 187 */ { 28, ~0}, + /* [188] = 188 */ { 16, ~0}, + /* [189] = 189 */ { 28, ~0}, + /* [190] = 190 */ { 16, ~0}, + /* [191] = 191 */ { 20, ~0}, + /* [192] = 192 */ { 12, ~0}, + /* [193] = 193 */ { 16, 28}, + /* [194] = 194 */ { 8, ~0}, + /* [195] = 195 */ { 44, 29}, + /* [196] = 196 */ { 24, ~0}, + /* [197] = 197 */ { 8, ~0}, + /* [198] = 198 */ { 16, ~0}, + /* [199] = 199 */ { 12, ~0}, + /* [200] = 200 */ { 12, ~0}, + /* [201] = 201 */ { 12, ~0}, + /* [202] = 202 */ { 24, ~0}, + /* [203] = 203 */ { 16, ~0}, + /* [204] = 204 */ { 16, ~0}, + /* [205] = 205 */ { 12, ~0}, + /* [206] = 206 */ { 32, ~0}, + /* [207] = 207 */ { 20, ~0}, + /* [208] = 208 */ { 20, ~0}, + /* [209] = 209 */ { 16, ~0}, + /* [210] = 210 */ { 40, ~0}, + /* [211] = 211 */ { 24, ~0}, + /* [212] = 212 */ { 24, ~0}, + /* [213] = 213 */ { 16, ~0}, + /* [214] = 214 */ { 28, 30}, + /* [215] = 215 */ { 32, 31}, + /* [216] = 216 */ { 36, 32}, + /* [217] = 217 */ { 28, 33}, + /* [218] = 218 */ { 36, 34}, + /* [219] = 219 */ { 44, 35}, + /* [220] = 220 */ { 0, ~0}, + /* [221] = 221 */ { 0, ~0}, + /* [222] = 222 */ { 0, ~0}, + /* [223] = 223 */ { 0, ~0}, + /* [224] = 224 */ { 0, ~0}, + /* [225] = 225 */ { 0, ~0}, + /* [226] = 226 */ { 0, ~0}, + /* [227] = 227 */ { 0, ~0}, + /* [228] = 228 */ { 0, ~0}, + /* [229] = 229 */ { 12, ~0}, + /* [230] = 230 */ { 16, ~0}, + /* [231] = 231 */ { 12, ~0}, + /* [232] = 232 */ { 8, ~0}, + /* [233] = 233 */ { 8, 36}, + /* [234] = 234 */ { 0, ~0}, + /* [235] = 235 */ { 0, ~0}, + /* [236] = 236 */ { 0, ~0}, + /* [237] = 237 */ { 0, ~0}, + /* [238] = 238 */ { 0, ~0}, + /* [239] = 239 */ { 0, ~0}, + /* [240] = 2048 */ { 12, ~0}, + /* [241] = 2049 */ { 8, ~0}, + /* [242] = 2050 */ { 0, ~0}, + /* [243] = 2051 */ { 0, ~0}, + /* [244] = 2052 */ { 0, ~0}, + /* [245] = 2053 */ { 44, 37}, + /* [246] = 2054 */ { 12, 38}, + /* [247] = 2055 */ { 12, 39}, + /* [248] = 2056 */ { 24, ~0}, + /* [249] = 2057 */ { 0, ~0}, + /* [250] = 2058 */ { 0, ~0}, + /* [251] = 2059 */ { 0, ~0}, + /* [252] = 2060 */ { 0, ~0}, + /* [253] = 2061 */ { 0, ~0}, + /* [254] = 2062 */ { 0, ~0}, + /* [255] = 2063 */ { 0, ~0}, + /* [256] = 2064 */ { 0, ~0}, + /* [257] = 2065 */ { 12, ~0}, + /* [258] = 2066 */ { 8, 40}, + /* [259] = 2067 */ { 0, ~0}, + /* [260] = 2068 */ { 0, ~0}, + /* [261] = 2069 */ { 0, ~0}, + /* [262] = 2070 */ { 0, ~0}, + /* [263] = 2071 */ { 0, ~0}, + /* [264] = 4096 */ { 20, ~0}, + /* [265] = 4097 */ { 8, ~0}, + /* [266] = 4098 */ { 0, ~0}, + /* [267] = 4099 */ { 60, 41}, + /* [268] = 4100 */ { 60, 42}, + /* [269] = 4101 */ { 48, 43}, + /* [270] = 4102 */ { 48, 44}, + /* [271] = 4103 */ { 16, ~0}, + /* [272] = 4104 */ { 12, 45}, + /* [273] = 4105 */ { 16, ~0}, + /* [274] = 4106 */ { 12, 46}, + /* [275] = 4107 */ { 24, ~0}, + /* [276] = 4108 */ { 28, ~0}, + /* [277] = 4109 */ { 32, 47}, + /* [278] = 4110 */ { 20, ~0}, + /* [279] = 4111 */ { 16, ~0}, + /* [280] = 4112 */ { 8, ~0}, + /* [281] = 4113 */ { 8, ~0}, + /* [282] = 4114 */ { 84, 48}, + /* [283] = 4115 */ { 92, 49}, + /* [284] = 4116 */ { 0, ~0}, + /* [285] = 4117 */ { 12, ~0}, + /* [286] = 4118 */ { 8, 50}, + /* [287] = 4119 */ { 32, ~0}, + /* [288] = 4120 */ { 36, ~0}, + /* [289] = 4121 */ { 28, ~0}, + /* [290] = 4122 */ { 36, ~0}, + /* [291] = 4123 */ { 40, ~0}, + /* [292] = 4124 */ { 8, ~0}, + /* [293] = 4125 */ { 12, ~0}, + /* [294] = 4126 */ { 8, ~0}, + /* [295] = 4127 */ { 12, ~0}, + /* [296] = 4176 */ { 0, ~0}, + /* [297] = 4177 */ { 0, ~0}, + /* [298] = 4178 */ { 0, ~0}, + /* [299] = 4179 */ { 0, ~0}, + /* [300] = 4180 */ { 12, ~0}, + /* [301] = 4181 */ { 28, ~0}, + /* [302] = 4182 */ { 8, 51}, + /* [303] = 4183 */ { 16, 52}, + /* [304] = 4184 */ { 28, ~0}, + /* [305] = 4185 */ { 44, ~0}, + /* [306] = 4186 */ { 16, 53}, + /* [307] = 4187 */ { 16, 54}, + /* [308] = 4188 */ { 20, ~0}, + /* [309] = 4189 */ { 12, ~0}, + /* [310] = 4190 */ { 12, ~0}, + /* [311] = 4191 */ { 16, ~0}, + /* [312] = 4192 */ { 16, ~0}, + /* [313] = 4193 */ { 12, ~0}, + /* [314] = 4194 */ { 16, ~0}, + /* [315] = 4195 */ { 20, ~0}, + /* [316] = 4196 */ { 24, ~0}, + /* [317] = 4197 */ { 16, ~0}, + /* [318] = 4198 */ { 24, ~0}, + /* [319] = 4199 */ { 32, ~0}, + /* [320] = 4200 */ { 40, ~0}, + /* [321] = 4201 */ { 12, ~0}, + /* [322] = 4202 */ { 12, 55}, + /* [323] = 4203 */ { 12, 56}, + /* [324] = 4204 */ { 12, 57}, + /* [325] = 4205 */ { 12, 58}, + /* [326] = 4206 */ { 12, 59}, + /* [327] = 4207 */ { 12, 60}, + /* [328] = 4208 */ { 12, 61}, + /* [329] = 4209 */ { 12, 62}, + /* [330] = 4210 */ { 12, 63}, + /* [331] = 4211 */ { 12, 64}, + /* [332] = 4212 */ { 12, 65}, + /* [333] = 4213 */ { 12, 66}, + /* [334] = 4214 */ { 12, 67}, + /* [335] = 4215 */ { 28, ~0}, + /* [336] = 4216 */ { 44, ~0}, + /* [337] = 4217 */ { 16, 68}, + /* [338] = 4218 */ { 28, 69}, + /* [339] = 4219 */ { 44, 70}, + /* [340] = 4220 */ { 8, ~0}, + /* [341] = 4221 */ { 12, ~0}, + /* [342] = 4222 */ { 8, 71}, + /* [343] = 4223 */ { 0, ~0}, + /* [344] = 4224 */ { 0, ~0}, + /* [345] = 4225 */ { 0, ~0}, + /* [346] = 4226 */ { 0, ~0}, + /* [347] = 4227 */ { 0, ~0}, + /* [348] = 4228 */ { 12, ~0}, + /* [349] = 4229 */ { 0, ~0}, + /* [350] = 4230 */ { 12, ~0}, + /* [351] = 4231 */ { 24, ~0}, + /* [352] = 4232 */ { 12, ~0}, + /* [353] = 4233 */ { 16, ~0}, + /* [354] = 4234 */ { 24, ~0}, + /* [355] = 4235 */ { 12, ~0}, + /* [356] = 4236 */ { 16, ~0}, + /* [357] = 4237 */ { 24, ~0}, + /* [358] = 4238 */ { 16, ~0}, + /* [359] = 4239 */ { 24, ~0}, + /* [360] = 4128 */ { 16, ~0}, + /* [361] = 4129 */ { 16, ~0}, + /* [362] = 4130 */ { 28, ~0}, + /* [363] = 4131 */ { 8, ~0}, + /* [364] = 4132 */ { 12, ~0}, + /* [365] = 4133 */ { 16, ~0}, + /* [366] = 4134 */ { 20, ~0}, + /* [367] = 4135 */ { 0, ~0}, + /* [368] = 4264 */ { 0, ~0}, + /* [369] = 4265 */ { 12, ~0}, + /* [370] = 4266 */ { 12, ~0}, + /* [371] = 4267 */ { 16, ~0}, + /* [372] = 4268 */ { 16, ~0}, + /* [373] = 4269 */ { 12, ~0}, + /* [374] = 4270 */ { 16, ~0}, + /* [375] = 4271 */ { 20, ~0}, + /* [376] = 4272 */ { 24, ~0}, + /* [377] = 4273 */ { 16, ~0}, + /* [378] = 4274 */ { 24, ~0}, + /* [379] = 4275 */ { 32, ~0}, + /* [380] = 4276 */ { 40, ~0}, + /* [381] = 4277 */ { 12, ~0}, + /* [382] = 4278 */ { 0, ~0}, + /* [383] = 4279 */ { 0, ~0}, + /* [384] = 4312 */ { 0, ~0}, + /* [385] = 4313 */ { 0, ~0}, + /* [386] = 4314 */ { 0, ~0}, + /* [387] = 4315 */ { 0, ~0}, + /* [388] = 4316 */ { 12, ~0}, + /* [389] = 4317 */ { 8, 72}, + /* [390] = 4318 */ { 20, ~0}, + /* [391] = 4319 */ { 12, ~0}, + /* [392] = 4320 */ { 8, 73}, + /* [393] = 4321 */ { 24, ~0}, + /* [394] = 4322 */ { 24, ~0}, + /* [395] = 4323 */ { 28, ~0}, + /* [396] = 4324 */ { 20, ~0}, + /* [397] = 4325 */ { 8, ~0}, + /* [398] = 4326 */ { 0, ~0}, + /* [399] = 4327 */ { 0, ~0}, +}; + +static const gl_proto_size_func Render_size_func_table[74] = { + __glXCallListsReqSize, + __glXBitmapReqSize, + __glXFogfvReqSize, + __glXFogivReqSize, + __glXLightfvReqSize, + __glXLightivReqSize, + __glXLightModelfvReqSize, + __glXLightModelivReqSize, + __glXMaterialfvReqSize, + __glXMaterialivReqSize, + __glXPolygonStippleReqSize, + __glXTexParameterfvReqSize, + __glXTexParameterivReqSize, + __glXTexImage1DReqSize, + __glXTexImage2DReqSize, + __glXTexEnvfvReqSize, + __glXTexEnvivReqSize, + __glXTexGendvReqSize, + __glXTexGenfvReqSize, + __glXTexGenivReqSize, + __glXMap1dReqSize, + __glXMap1fReqSize, + __glXMap2dReqSize, + __glXMap2fReqSize, + __glXPixelMapfvReqSize, + __glXPixelMapuivReqSize, + __glXPixelMapusvReqSize, + __glXDrawPixelsReqSize, + __glXDrawArraysReqSize, + __glXColorSubTableReqSize, + __glXCompressedTexImage1DARBReqSize, + __glXCompressedTexImage2DARBReqSize, + __glXCompressedTexImage3DARBReqSize, + __glXCompressedTexSubImage1DARBReqSize, + __glXCompressedTexSubImage2DARBReqSize, + __glXCompressedTexSubImage3DARBReqSize, + __glXDrawBuffersARBReqSize, + __glXColorTableReqSize, + __glXColorTableParameterfvReqSize, + __glXColorTableParameterivReqSize, + __glXPointParameterfvEXTReqSize, + __glXTexSubImage1DReqSize, + __glXTexSubImage2DReqSize, + __glXConvolutionFilter1DReqSize, + __glXConvolutionFilter2DReqSize, + __glXConvolutionParameterfvReqSize, + __glXConvolutionParameterivReqSize, + __glXSeparableFilter2DReqSize, + __glXTexImage3DReqSize, + __glXTexSubImage3DReqSize, + __glXPrioritizeTexturesReqSize, + __glXRequestResidentProgramsNVReqSize, + __glXLoadProgramNVReqSize, + __glXProgramParameters4fvNVReqSize, + __glXProgramParameters4dvNVReqSize, + __glXVertexAttribs1svNVReqSize, + __glXVertexAttribs2svNVReqSize, + __glXVertexAttribs3svNVReqSize, + __glXVertexAttribs4svNVReqSize, + __glXVertexAttribs1fvNVReqSize, + __glXVertexAttribs2fvNVReqSize, + __glXVertexAttribs3fvNVReqSize, + __glXVertexAttribs4fvNVReqSize, + __glXVertexAttribs1dvNVReqSize, + __glXVertexAttribs2dvNVReqSize, + __glXVertexAttribs3dvNVReqSize, + __glXVertexAttribs4dvNVReqSize, + __glXVertexAttribs4ubvNVReqSize, + __glXProgramStringARBReqSize, + __glXProgramNamedParameter4fvNVReqSize, + __glXProgramNamedParameter4dvNVReqSize, + __glXPointParameterivNVReqSize, + __glXDeleteRenderbuffersEXTReqSize, + __glXDeleteFramebuffersEXTReqSize, +}; + +const struct __glXDispatchInfo Render_dispatch_info = { + 13, + Render_dispatch_tree, + Render_function_table, + Render_size_table, + Render_size_func_table +}; + +/*****************************************************************/ +/* tree depth = 13 */ +static const int_fast16_t VendorPriv_dispatch_tree[155] = { + /* [0] -> opcode range [0, 131072], node depth 1 */ + 2, + 5, + EMPTY_LEAF, + 119, + EMPTY_LEAF, + + /* [5] -> opcode range [0, 32768], node depth 2 */ + 1, + 8, + EMPTY_LEAF, + + /* [8] -> opcode range [0, 16384], node depth 3 */ + 1, + 11, + EMPTY_LEAF, + + /* [11] -> opcode range [0, 8192], node depth 4 */ + 2, + 16, + EMPTY_LEAF, + 78, + EMPTY_LEAF, + + /* [16] -> opcode range [0, 2048], node depth 5 */ + 2, + 21, + EMPTY_LEAF, + 36, + EMPTY_LEAF, + + /* [21] -> opcode range [0, 512], node depth 6 */ + 1, + 24, + EMPTY_LEAF, + + /* [24] -> opcode range [0, 256], node depth 7 */ + 1, + 27, + EMPTY_LEAF, + + /* [27] -> opcode range [0, 128], node depth 8 */ + 1, + 30, + EMPTY_LEAF, + + /* [30] -> opcode range [0, 64], node depth 9 */ + 1, + 33, + EMPTY_LEAF, + + /* [33] -> opcode range [0, 32], node depth 10 */ + 1, + LEAF(0), + EMPTY_LEAF, + + /* [36] -> opcode range [1024, 1536], node depth 6 */ + 2, + 41, + EMPTY_LEAF, + 53, + 67, + + /* [41] -> opcode range [1024, 1152], node depth 7 */ + 1, + 44, + EMPTY_LEAF, + + /* [44] -> opcode range [1024, 1088], node depth 8 */ + 1, + 47, + EMPTY_LEAF, + + /* [47] -> opcode range [1024, 1056], node depth 9 */ + 1, + 50, + EMPTY_LEAF, + + /* [50] -> opcode range [1024, 1040], node depth 10 */ + 1, + LEAF(16), + EMPTY_LEAF, + + /* [53] -> opcode range [1280, 1408], node depth 7 */ + 1, + 56, + EMPTY_LEAF, + + /* [56] -> opcode range [1280, 1344], node depth 8 */ + 2, + 61, + LEAF(24), + EMPTY_LEAF, + 64, + + /* [61] -> opcode range [1280, 1296], node depth 9 */ + 1, + EMPTY_LEAF, + LEAF(40), + + /* [64] -> opcode range [1328, 1344], node depth 9 */ + 1, + LEAF(48), + EMPTY_LEAF, + + /* [67] -> opcode range [1408, 1536], node depth 7 */ + 1, + 70, + EMPTY_LEAF, + + /* [70] -> opcode range [1408, 1472], node depth 8 */ + 1, + 73, + EMPTY_LEAF, + + /* [73] -> opcode range [1408, 1440], node depth 9 */ + 2, + EMPTY_LEAF, + LEAF(56), + LEAF(64), + EMPTY_LEAF, + + /* [78] -> opcode range [4096, 6144], node depth 5 */ + 2, + 83, + EMPTY_LEAF, + 101, + EMPTY_LEAF, + + /* [83] -> opcode range [4096, 4608], node depth 6 */ + 1, + 86, + EMPTY_LEAF, + + /* [86] -> opcode range [4096, 4352], node depth 7 */ + 1, + 89, + EMPTY_LEAF, + + /* [89] -> opcode range [4096, 4224], node depth 8 */ + 1, + 92, + EMPTY_LEAF, + + /* [92] -> opcode range [4096, 4160], node depth 9 */ + 1, + 95, + EMPTY_LEAF, + + /* [95] -> opcode range [4096, 4128], node depth 10 */ + 1, + 98, + EMPTY_LEAF, + + /* [98] -> opcode range [4096, 4112], node depth 11 */ + 1, + LEAF(72), + EMPTY_LEAF, + + /* [101] -> opcode range [5120, 5632], node depth 6 */ + 1, + 104, + EMPTY_LEAF, + + /* [104] -> opcode range [5120, 5376], node depth 7 */ + 1, + 107, + EMPTY_LEAF, + + /* [107] -> opcode range [5120, 5248], node depth 8 */ + 1, + 110, + EMPTY_LEAF, + + /* [110] -> opcode range [5120, 5184], node depth 9 */ + 1, + EMPTY_LEAF, + 113, + + /* [113] -> opcode range [5152, 5184], node depth 10 */ + 1, + 116, + EMPTY_LEAF, + + /* [116] -> opcode range [5152, 5168], node depth 11 */ + 1, + LEAF(80), + EMPTY_LEAF, + + /* [119] -> opcode range [65536, 98304], node depth 2 */ + 1, + 122, + EMPTY_LEAF, + + /* [122] -> opcode range [65536, 81920], node depth 3 */ + 1, + 125, + EMPTY_LEAF, + + /* [125] -> opcode range [65536, 73728], node depth 4 */ + 1, + 128, + EMPTY_LEAF, + + /* [128] -> opcode range [65536, 69632], node depth 5 */ + 1, + 131, + EMPTY_LEAF, + + /* [131] -> opcode range [65536, 67584], node depth 6 */ + 1, + 134, + EMPTY_LEAF, + + /* [134] -> opcode range [65536, 66560], node depth 7 */ + 1, + 137, + EMPTY_LEAF, + + /* [137] -> opcode range [65536, 66048], node depth 8 */ + 1, + 140, + EMPTY_LEAF, + + /* [140] -> opcode range [65536, 65792], node depth 9 */ + 1, + 143, + EMPTY_LEAF, + + /* [143] -> opcode range [65536, 65664], node depth 10 */ + 1, + 146, + EMPTY_LEAF, + + /* [146] -> opcode range [65536, 65600], node depth 11 */ + 1, + 149, + EMPTY_LEAF, + + /* [149] -> opcode range [65536, 65568], node depth 12 */ + 1, + 152, + EMPTY_LEAF, + + /* [152] -> opcode range [65536, 65552], node depth 13 */ + 1, + LEAF(88), + EMPTY_LEAF, + +}; + +static const void *VendorPriv_function_table[96][2] = { + /* [ 0] = 0 */ {NULL, NULL}, + /* [ 1] = 1 */ {__glXDisp_GetConvolutionFilterEXT, __glXDispSwap_GetConvolutionFilterEXT}, + /* [ 2] = 2 */ {__glXDisp_GetConvolutionParameterfvEXT, __glXDispSwap_GetConvolutionParameterfvEXT}, + /* [ 3] = 3 */ {__glXDisp_GetConvolutionParameterivEXT, __glXDispSwap_GetConvolutionParameterivEXT}, + /* [ 4] = 4 */ {__glXDisp_GetSeparableFilterEXT, __glXDispSwap_GetSeparableFilterEXT}, + /* [ 5] = 5 */ {__glXDisp_GetHistogramEXT, __glXDispSwap_GetHistogramEXT}, + /* [ 6] = 6 */ {__glXDisp_GetHistogramParameterfvEXT, __glXDispSwap_GetHistogramParameterfvEXT}, + /* [ 7] = 7 */ {__glXDisp_GetHistogramParameterivEXT, __glXDispSwap_GetHistogramParameterivEXT}, + /* [ 8] = 8 */ {__glXDisp_GetMinmaxEXT, __glXDispSwap_GetMinmaxEXT}, + /* [ 9] = 9 */ {__glXDisp_GetMinmaxParameterfvEXT, __glXDispSwap_GetMinmaxParameterfvEXT}, + /* [ 10] = 10 */ {__glXDisp_GetMinmaxParameterivEXT, __glXDispSwap_GetMinmaxParameterivEXT}, + /* [ 11] = 11 */ {__glXDisp_AreTexturesResidentEXT, __glXDispSwap_AreTexturesResidentEXT}, + /* [ 12] = 12 */ {__glXDisp_DeleteTexturesEXT, __glXDispSwap_DeleteTexturesEXT}, + /* [ 13] = 13 */ {__glXDisp_GenTexturesEXT, __glXDispSwap_GenTexturesEXT}, + /* [ 14] = 14 */ {__glXDisp_IsTextureEXT, __glXDispSwap_IsTextureEXT}, + /* [ 15] = 15 */ {NULL, NULL}, + /* [ 16] = 1024 */ {__glXDisp_QueryContextInfoEXT, __glXDispSwap_QueryContextInfoEXT}, + /* [ 17] = 1025 */ {NULL, NULL}, + /* [ 18] = 1026 */ {NULL, NULL}, + /* [ 19] = 1027 */ {NULL, NULL}, + /* [ 20] = 1028 */ {NULL, NULL}, + /* [ 21] = 1029 */ {NULL, NULL}, + /* [ 22] = 1030 */ {NULL, NULL}, + /* [ 23] = 1031 */ {NULL, NULL}, + /* [ 24] = 1296 */ {__glXDisp_GetProgramEnvParameterfvARB, __glXDispSwap_GetProgramEnvParameterfvARB}, + /* [ 25] = 1297 */ {__glXDisp_GetProgramEnvParameterdvARB, __glXDispSwap_GetProgramEnvParameterdvARB}, + /* [ 26] = 1298 */ {__glXDisp_GetProgramivNV, __glXDispSwap_GetProgramivNV}, + /* [ 27] = 1299 */ {__glXDisp_GetProgramStringNV, __glXDispSwap_GetProgramStringNV}, + /* [ 28] = 1300 */ {__glXDisp_GetTrackMatrixivNV, __glXDispSwap_GetTrackMatrixivNV}, + /* [ 29] = 1301 */ {__glXDisp_GetVertexAttribdvARB, __glXDispSwap_GetVertexAttribdvARB}, + /* [ 30] = 1302 */ {__glXDisp_GetVertexAttribfvNV, __glXDispSwap_GetVertexAttribfvNV}, + /* [ 31] = 1303 */ {__glXDisp_GetVertexAttribivNV, __glXDispSwap_GetVertexAttribivNV}, + /* [ 32] = 1304 */ {__glXDisp_IsProgramNV, __glXDispSwap_IsProgramNV}, + /* [ 33] = 1305 */ {__glXDisp_GetProgramLocalParameterfvARB, __glXDispSwap_GetProgramLocalParameterfvARB}, + /* [ 34] = 1306 */ {__glXDisp_GetProgramLocalParameterdvARB, __glXDispSwap_GetProgramLocalParameterdvARB}, + /* [ 35] = 1307 */ {__glXDisp_GetProgramivARB, __glXDispSwap_GetProgramivARB}, + /* [ 36] = 1308 */ {__glXDisp_GetProgramStringARB, __glXDispSwap_GetProgramStringARB}, + /* [ 37] = 1309 */ {NULL, NULL}, + /* [ 38] = 1310 */ {__glXDisp_GetProgramNamedParameterfvNV, __glXDispSwap_GetProgramNamedParameterfvNV}, + /* [ 39] = 1311 */ {__glXDisp_GetProgramNamedParameterdvNV, __glXDispSwap_GetProgramNamedParameterdvNV}, + /* [ 40] = 1288 */ {NULL, NULL}, + /* [ 41] = 1289 */ {NULL, NULL}, + /* [ 42] = 1290 */ {NULL, NULL}, + /* [ 43] = 1291 */ {NULL, NULL}, + /* [ 44] = 1292 */ {NULL, NULL}, + /* [ 45] = 1293 */ {__glXDisp_AreProgramsResidentNV, __glXDispSwap_AreProgramsResidentNV}, + /* [ 46] = 1294 */ {__glXDisp_DeleteProgramsNV, __glXDispSwap_DeleteProgramsNV}, + /* [ 47] = 1295 */ {__glXDisp_GenProgramsNV, __glXDispSwap_GenProgramsNV}, + /* [ 48] = 1328 */ {NULL, NULL}, + /* [ 49] = 1329 */ {NULL, NULL}, + /* [ 50] = 1330 */ {__glXDisp_BindTexImageEXT, __glXDispSwap_BindTexImageEXT}, + /* [ 51] = 1331 */ {__glXDisp_ReleaseTexImageEXT, __glXDispSwap_ReleaseTexImageEXT}, + /* [ 52] = 1332 */ {NULL, NULL}, + /* [ 53] = 1333 */ {NULL, NULL}, + /* [ 54] = 1334 */ {NULL, NULL}, + /* [ 55] = 1335 */ {NULL, NULL}, + /* [ 56] = 1416 */ {NULL, NULL}, + /* [ 57] = 1417 */ {NULL, NULL}, + /* [ 58] = 1418 */ {NULL, NULL}, + /* [ 59] = 1419 */ {NULL, NULL}, + /* [ 60] = 1420 */ {NULL, NULL}, + /* [ 61] = 1421 */ {NULL, NULL}, + /* [ 62] = 1422 */ {__glXDisp_IsRenderbufferEXT, __glXDispSwap_IsRenderbufferEXT}, + /* [ 63] = 1423 */ {__glXDisp_GenRenderbuffersEXT, __glXDispSwap_GenRenderbuffersEXT}, + /* [ 64] = 1424 */ {__glXDisp_GetRenderbufferParameterivEXT, __glXDispSwap_GetRenderbufferParameterivEXT}, + /* [ 65] = 1425 */ {__glXDisp_IsFramebufferEXT, __glXDispSwap_IsFramebufferEXT}, + /* [ 66] = 1426 */ {__glXDisp_GenFramebuffersEXT, __glXDispSwap_GenFramebuffersEXT}, + /* [ 67] = 1427 */ {__glXDisp_CheckFramebufferStatusEXT, __glXDispSwap_CheckFramebufferStatusEXT}, + /* [ 68] = 1428 */ {__glXDisp_GetFramebufferAttachmentParameterivEXT, __glXDispSwap_GetFramebufferAttachmentParameterivEXT}, + /* [ 69] = 1429 */ {NULL, NULL}, + /* [ 70] = 1430 */ {NULL, NULL}, + /* [ 71] = 1431 */ {NULL, NULL}, + /* [ 72] = 4096 */ {NULL, NULL}, + /* [ 73] = 4097 */ {NULL, NULL}, + /* [ 74] = 4098 */ {__glXDisp_GetColorTableSGI, __glXDispSwap_GetColorTableSGI}, + /* [ 75] = 4099 */ {__glXDisp_GetColorTableParameterfvSGI, __glXDispSwap_GetColorTableParameterfvSGI}, + /* [ 76] = 4100 */ {__glXDisp_GetColorTableParameterivSGI, __glXDispSwap_GetColorTableParameterivSGI}, + /* [ 77] = 4101 */ {NULL, NULL}, + /* [ 78] = 4102 */ {NULL, NULL}, + /* [ 79] = 4103 */ {NULL, NULL}, + /* [ 80] = 5152 */ {NULL, NULL}, + /* [ 81] = 5153 */ {NULL, NULL}, + /* [ 82] = 5154 */ {__glXDisp_CopySubBufferMESA, __glXDispSwap_CopySubBufferMESA}, + /* [ 83] = 5155 */ {NULL, NULL}, + /* [ 84] = 5156 */ {NULL, NULL}, + /* [ 85] = 5157 */ {NULL, NULL}, + /* [ 86] = 5158 */ {NULL, NULL}, + /* [ 87] = 5159 */ {NULL, NULL}, + /* [ 88] = 65536 */ {__glXDisp_SwapIntervalSGI, __glXDispSwap_SwapIntervalSGI}, + /* [ 89] = 65537 */ {__glXDisp_MakeCurrentReadSGI, __glXDispSwap_MakeCurrentReadSGI}, + /* [ 90] = 65538 */ {NULL, NULL}, + /* [ 91] = 65539 */ {NULL, NULL}, + /* [ 92] = 65540 */ {__glXDisp_GetFBConfigsSGIX, __glXDispSwap_GetFBConfigsSGIX}, + /* [ 93] = 65541 */ {__glXDisp_CreateContextWithConfigSGIX, __glXDispSwap_CreateContextWithConfigSGIX}, + /* [ 94] = 65542 */ {__glXDisp_CreateGLXPixmapWithConfigSGIX, __glXDispSwap_CreateGLXPixmapWithConfigSGIX}, + /* [ 95] = 65543 */ {NULL, NULL}, +}; + +const struct __glXDispatchInfo VendorPriv_dispatch_info = { + 17, + VendorPriv_dispatch_tree, + VendorPriv_function_table, + NULL, + NULL +}; + diff --git a/dist/Mesa/src/glx/x11/indirect_vertex_array.c b/dist/Mesa/src/glx/x11/indirect_vertex_array.c index 120fd826c..4f8284576 100644 --- a/dist/Mesa/src/glx/x11/indirect_vertex_array.c +++ b/dist/Mesa/src/glx/x11/indirect_vertex_array.c @@ -485,14 +485,14 @@ emit_DrawArrays_none( GLenum mode, GLint first, GLsizei count ) for ( i = 0 ; i < count ; i++ ) { if ( (pc + single_vertex_size) >= gc->bufEnd ) { - pc = __glXFlushRenderBuffer(gc, gc->pc); + pc = __glXFlushRenderBuffer(gc, pc); } pc = emit_element_none( pc, arrays, first + i ); } if ( (pc + 4) >= gc->bufEnd ) { - pc = __glXFlushRenderBuffer(gc, gc->pc); + pc = __glXFlushRenderBuffer(gc, pc); } (void) memcpy( pc, end_cmd, 4 ); @@ -726,7 +726,7 @@ emit_DrawElements_none( GLenum mode, GLsizei count, GLenum type, unsigned index = 0; if ( (pc + single_vertex_size) >= gc->bufEnd ) { - pc = __glXFlushRenderBuffer(gc, gc->pc); + pc = __glXFlushRenderBuffer(gc, pc); } switch( type ) { @@ -744,7 +744,7 @@ emit_DrawElements_none( GLenum mode, GLsizei count, GLenum type, } if ( (pc + 4) >= gc->bufEnd ) { - pc = __glXFlushRenderBuffer(gc, gc->pc); + pc = __glXFlushRenderBuffer(gc, pc); } (void) memcpy( pc, end_cmd, 4 ); diff --git a/dist/Mesa/src/mesa/Makefile b/dist/Mesa/src/mesa/Makefile index eea8eb9bd..d0c19f52a 100644 --- a/dist/Mesa/src/mesa/Makefile +++ b/dist/Mesa/src/mesa/Makefile @@ -65,7 +65,7 @@ linux-solo: depend subdirs libmesa.a # Stand-alone Mesa libGL, no built-in drivers (DirectFB) libgl-core: $(CORE_OBJECTS) - @ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS) \ + @ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ -major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \ -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) $(CORE_OBJECTS) \ $(GL_LIB_DEPS) diff --git a/dist/Mesa/src/mesa/drivers/common/driverfuncs.c b/dist/Mesa/src/mesa/drivers/common/driverfuncs.c index 3ccbe5481..e9b364e14 100644 --- a/dist/Mesa/src/mesa/drivers/common/driverfuncs.c +++ b/dist/Mesa/src/mesa/drivers/common/driverfuncs.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 6.5.3 * - * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 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"), @@ -28,8 +28,9 @@ #include "buffers.h" #include "context.h" #include "framebuffer.h" -#include "occlude.h" #include "program.h" +#include "prog_execute.h" +#include "queryobj.h" #include "renderbuffer.h" #include "texcompress.h" #include "texformat.h" @@ -43,6 +44,7 @@ #include "fbobject.h" #include "texrender.h" #endif +#include "shader_api.h" #include "arrayobj.h" #include "driverfuncs.h" @@ -110,6 +112,8 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->DeleteTexture = _mesa_delete_texture_object; driver->NewTextureImage = _mesa_new_texture_image; driver->FreeTexImageData = _mesa_free_texture_image_data; + driver->MapTexture = NULL; + driver->UnmapTexture = NULL; driver->TextureMemCpy = _mesa_memcpy; driver->IsTextureResident = NULL; driver->PrioritizeTexture = NULL; @@ -126,6 +130,9 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->BindProgram = NULL; driver->NewProgram = _mesa_new_program; driver->DeleteProgram = _mesa_delete_program; +#if FEATURE_MESA_program_debug + driver->GetProgramRegister = _mesa_get_program_register; +#endif /* FEATURE_MESA_program_debug */ /* simple state commands */ driver->AlphaFunc = NULL; @@ -245,4 +252,45 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->EndList = NULL; driver->BeginCallList = NULL; driver->EndCallList = NULL; + + + /* XXX temporary here */ + _mesa_init_glsl_driver_functions(driver); +} + + +/** + * Plug in Mesa's GLSL functions. + */ +void +_mesa_init_glsl_driver_functions(struct dd_function_table *driver) +{ + driver->AttachShader = _mesa_attach_shader; + driver->BindAttribLocation = _mesa_bind_attrib_location; + driver->CompileShader = _mesa_compile_shader; + driver->CreateProgram = _mesa_create_program; + driver->CreateShader = _mesa_create_shader; + driver->DeleteProgram2 = _mesa_delete_program2; + driver->DeleteShader = _mesa_delete_shader; + driver->DetachShader = _mesa_detach_shader; + driver->GetActiveAttrib = _mesa_get_active_attrib; + driver->GetActiveUniform = _mesa_get_active_uniform; + driver->GetAttachedShaders = _mesa_get_attached_shaders; + driver->GetAttribLocation = _mesa_get_attrib_location; + driver->GetHandle = _mesa_get_handle; + driver->GetProgramiv = _mesa_get_programiv; + driver->GetProgramInfoLog = _mesa_get_program_info_log; + driver->GetShaderiv = _mesa_get_shaderiv; + driver->GetShaderInfoLog = _mesa_get_shader_info_log; + driver->GetShaderSource = _mesa_get_shader_source; + driver->GetUniformfv = _mesa_get_uniformfv; + driver->GetUniformLocation = _mesa_get_uniform_location; + driver->IsProgram = _mesa_is_program; + driver->IsShader = _mesa_is_shader; + driver->LinkProgram = _mesa_link_program; + driver->ShaderSource = _mesa_shader_source; + driver->Uniform = _mesa_uniform; + driver->UniformMatrix = _mesa_uniform_matrix; + driver->UseProgram = _mesa_use_program; + driver->ValidateProgram = _mesa_validate_program; } diff --git a/dist/Mesa/src/mesa/drivers/dri/Makefile.template b/dist/Mesa/src/mesa/drivers/dri/Makefile.template index 9e84dbca4..aeeb267fb 100644 --- a/dist/Mesa/src/mesa/drivers/dri/Makefile.template +++ b/dist/Mesa/src/mesa/drivers/dri/Makefile.template @@ -50,7 +50,6 @@ SHARED_INCLUDES = \ -I$(TOP)/src/mesa/main \ -I$(TOP)/src/mesa/glapi \ -I$(TOP)/src/mesa/math \ - -I$(TOP)/src/mesa/transform \ -I$(TOP)/src/mesa/shader \ -I$(TOP)/src/mesa/swrast \ -I$(TOP)/src/mesa/swrast_setup \ diff --git a/dist/Mesa/src/mesa/drivers/dri/common/dri_util.c b/dist/Mesa/src/mesa/drivers/dri/common/dri_util.c index b5c20a066..77cbd8109 100644 --- a/dist/Mesa/src/mesa/drivers/dri/common/dri_util.c +++ b/dist/Mesa/src/mesa/drivers/dri/common/dri_util.c @@ -323,6 +323,7 @@ static GLboolean DoBindContext(__DRInativeDisplay *dpy, /* Bind the drawable to the context */ pcp->driDrawablePriv = pdp; + pcp->driReadablePriv = prp; pdp->driContextPriv = pcp; pdp->refcount++; if ( pdp != prp ) { @@ -339,6 +340,12 @@ static GLboolean DoBindContext(__DRInativeDisplay *dpy, DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); } + if ((pdp != prp) && (!prp->pStamp || *prp->pStamp != prp->lastStamp)) { + DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); + __driUtilUpdateDrawableInfo(prp); + DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); + } + /* Call device-specific MakeCurrent */ (*psp->DriverAPI.MakeCurrent)(pcp, pdp, prp); @@ -402,23 +409,31 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp) __DRIscreenPrivate *psp; __DRIcontextPrivate *pcp = pdp->driContextPriv; - if (!pcp || (pdp != pcp->driDrawablePriv)) { - /* ERROR!!! */ - return; + if (!pcp + || ((pdp != pcp->driDrawablePriv) && (pdp != pcp->driReadablePriv))) { + /* ERROR!!! + * ...but we must ignore it. There can be many contexts bound to a + * drawable. + */ } psp = pdp->driScreenPriv; if (!psp) { /* ERROR!!! */ + _mesa_problem(NULL, "Warning! Possible infinite loop due to bug " + "in file %s, line %d\n", + __FILE__, __LINE__); return; } if (pdp->pClipRects) { _mesa_free(pdp->pClipRects); + pdp->pClipRects = NULL; } if (pdp->pBackClipRects) { _mesa_free(pdp->pBackClipRects); + pdp->pBackClipRects = NULL; } DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); @@ -469,8 +484,30 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp) static void driSwapBuffers( __DRInativeDisplay *dpy, void *drawablePrivate ) { __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate; + drm_clip_rect_t rect; + + if (!dPriv->numClipRects) + return; + dPriv->swapBuffers(dPriv); - (void) dpy; + + /* Check that we actually have the new damage report method */ + if (api_ver < 20070105 || dri_interface->reportDamage == NULL) + return; + + /* Assume it's affecting the whole drawable for now */ + rect.x1 = 0; + rect.y1 = 0; + rect.x2 = rect.x1 + dPriv->w; + rect.y2 = rect.y1 + dPriv->h; + + /* Report the damage. Currently, all our drivers draw directly to the + * front buffer, so we report the damage there rather than to the backing + * store (if any). + */ + (*dri_interface->reportDamage)(dpy, dPriv->screen, dPriv->draw, + dPriv->x, dPriv->y, + &rect, 1, GL_TRUE); } /** @@ -841,7 +878,7 @@ static void driDestroyScreen(__DRInativeDisplay *dpy, int scrn, void *screenPriv (void)drmUnmap((drmAddress)psp->pSAREA, SAREA_MAX); (void)drmUnmap((drmAddress)psp->pFB, psp->fbSize); _mesa_free(psp->pDevPriv); - (void)drmClose(psp->fd); + (void)drmCloseOnce(psp->fd); if ( psp->modes != NULL ) { (*dri_interface->destroyContextModes)( psp->modes ); } @@ -963,6 +1000,9 @@ __driUtilCreateNewScreen(__DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, psc->getMSC = driGetMSC; psc->createNewContext = driCreateNewContext; + if (internal_api_version >= 20070121) + psc->setTexOffset = psp->DriverAPI.setTexOffset; + if ( (psp->DriverAPI.InitDriver != NULL) && !(*psp->DriverAPI.InitDriver)(psp) ) { _mesa_free( psp ); diff --git a/dist/Mesa/src/mesa/drivers/dri/gamma/gamma_render.c b/dist/Mesa/src/mesa/drivers/dri/gamma/gamma_render.c index 4b462f225..a8fba499a 100644 --- a/dist/Mesa/src/mesa/drivers/dri/gamma/gamma_render.c +++ b/dist/Mesa/src/mesa/drivers/dri/gamma/gamma_render.c @@ -193,7 +193,7 @@ static GLboolean gamma_run_render( GLcontext *ctx, 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; diff --git a/dist/Mesa/src/mesa/drivers/dri/i810/i810render.c b/dist/Mesa/src/mesa/drivers/dri/i810/i810render.c index a31d54236..d0225969b 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i810/i810render.c +++ b/dist/Mesa/src/mesa/drivers/dri/i810/i810render.c @@ -144,7 +144,7 @@ static GLboolean i810_run_render( GLcontext *ctx, 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; diff --git a/dist/Mesa/src/mesa/drivers/dri/i915/intel_render.c b/dist/Mesa/src/mesa/drivers/dri/i915/intel_render.c index d9438ba0f..773779a1f 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i915/intel_render.c +++ b/dist/Mesa/src/mesa/drivers/dri/i915/intel_render.c @@ -213,7 +213,7 @@ static GLboolean intel_run_render( GLcontext *ctx, 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; diff --git a/dist/Mesa/src/mesa/drivers/dri/i915tex/i830_vtbl.c b/dist/Mesa/src/mesa/drivers/dri/i915tex/i830_vtbl.c index 5555b7466..e76e2e77d 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i915tex/i830_vtbl.c +++ b/dist/Mesa/src/mesa/drivers/dri/i915tex/i830_vtbl.c @@ -378,9 +378,15 @@ do { \ } while (0) static GLuint +get_dirty(struct i830_hw_state *state) +{ + return state->active & ~state->emitted; +} + +static GLuint get_state_size(struct i830_hw_state *state) { - GLuint dirty = state->active & ~state->emitted; + GLuint dirty = get_dirty(state); GLuint sz = 0; GLuint i; @@ -411,7 +417,7 @@ get_state_size(struct i830_hw_state *state) /* Push the state into the sarea and/or texture memory. */ static void -i830_emit_state(struct intel_context *intel) +i830_do_emit_state(struct intel_context *intel) { struct i830_context *i830 = i830_context(&intel->ctx); struct i830_hw_state *state = i830->current; @@ -428,10 +434,32 @@ i830_emit_state(struct intel_context *intel) */ intel_batchbuffer_require_space(intel->batch, get_state_size(state), 0); + /* Workaround. There are cases I haven't been able to track down + * where we aren't emitting a full state at the start of a new + * batchbuffer. This code spots that we are on a new batchbuffer + * and forces a full state emit no matter what. + * + * In the normal case state->emitted is already zero, this code is + * another set of checks to make sure it really is. + */ + if (intel->batch->id != intel->last_state_batch_id || + intel->batch->map == intel->batch->ptr) + { + state->emitted = 0; + intel_batchbuffer_require_space(intel->batch, get_state_size(state), 0); + } + /* Do this here as we may have flushed the batchbuffer above, * causing more state to be dirty! */ - dirty = state->active & ~state->emitted; + dirty = get_dirty(state); + state->emitted |= dirty; + assert(get_dirty(state) == 0); + + if (intel->batch->id != intel->last_state_batch_id) { + assert(dirty & I830_UPLOAD_CTX); + intel->last_state_batch_id = intel->batch->id; + } if (dirty & I830_UPLOAD_INVARIENT) { DBG("I830_UPLOAD_INVARIENT:\n"); @@ -513,7 +541,30 @@ i830_emit_state(struct intel_context *intel) } } - state->emitted |= dirty; + intel->batch->dirty_state &= ~dirty; + assert(get_dirty(state) == 0); +} + +static void +i830_emit_state(struct intel_context *intel) +{ + struct i830_context *i830 = i830_context(&intel->ctx); + + i830_do_emit_state( intel ); + + /* Second chance - catch batchbuffer wrap in the middle of state + * emit. This shouldn't happen but it has been observed in + * testing. + */ + if (get_dirty( i830->current )) { + /* Force a full re-emit if this happens. + */ + i830->current->emitted = 0; + i830_do_emit_state( intel ); + } + + assert(get_dirty(i830->current) == 0); + assert((intel->batch->dirty_state & (1<<1)) == 0); } static void @@ -650,8 +701,7 @@ i830_assert_not_dirty( struct intel_context *intel ) { struct i830_context *i830 = i830_context(&intel->ctx); struct i830_hw_state *state = i830->current; - GLuint dirty = state->active & ~state->emitted; - assert(!dirty); + assert(!get_dirty(state)); } diff --git a/dist/Mesa/src/mesa/drivers/dri/i915tex/i915_tex_layout.c b/dist/Mesa/src/mesa/drivers/dri/i915tex/i915_tex_layout.c index 7b761a7b2..dfd02112b 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i915tex/i915_tex_layout.c +++ b/dist/Mesa/src/mesa/drivers/dri/i915tex/i915_tex_layout.c @@ -54,7 +54,7 @@ static GLint step_offsets[6][2] = { {0, 2}, }; GLboolean -i915_miptree_layout(struct intel_mipmap_tree * mt) +i915_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree * mt) { GLint level; @@ -67,7 +67,7 @@ i915_miptree_layout(struct intel_mipmap_tree * mt) assert(lvlWidth == lvlHeight); /* cubemap images are square */ /* double pitch for cube layouts */ - mt->pitch = ((dim * mt->cpp * 2 + 3) & ~3) / mt->cpp; + mt->pitch = intel_miptree_pitch_align (intel, mt, dim * 2); mt->total_height = dim * 4; for (level = mt->first_level; level <= mt->last_level; level++) { @@ -107,7 +107,7 @@ i915_miptree_layout(struct intel_mipmap_tree * mt) /* Calculate the size of a single slice. */ - mt->pitch = ((mt->width0 * mt->cpp + 3) & ~3) / mt->cpp; + mt->pitch = intel_miptree_pitch_align (intel, mt, mt->width0); /* XXX: hardware expects/requires 9 levels at minimum. */ @@ -150,7 +150,7 @@ i915_miptree_layout(struct intel_mipmap_tree * mt) GLuint height = mt->height0; GLuint img_height; - mt->pitch = ((mt->width0 * mt->cpp + 3) & ~3) / mt->cpp; + mt->pitch = intel_miptree_pitch_align (intel, mt, mt->width0); mt->total_height = 0; for (level = mt->first_level; level <= mt->last_level; level++) { @@ -180,7 +180,7 @@ i915_miptree_layout(struct intel_mipmap_tree * mt) GLboolean -i945_miptree_layout(struct intel_mipmap_tree * mt) +i945_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree * mt) { GLint level; @@ -197,7 +197,7 @@ i945_miptree_layout(struct intel_mipmap_tree * mt) * or the final row of 4x4, 2x2 and 1x1 faces below this. */ if (dim > 32) - mt->pitch = ((dim * mt->cpp * 2 + 3) & ~3) / mt->cpp; + mt->pitch = intel_miptree_pitch_align (intel, mt, dim); else mt->pitch = 14 * 8; @@ -279,7 +279,7 @@ i945_miptree_layout(struct intel_mipmap_tree * mt) GLuint pack_y_pitch; GLuint level; - mt->pitch = ((mt->width0 * mt->cpp + 3) & ~3) / mt->cpp; + mt->pitch = intel_miptree_pitch_align (intel, mt, mt->width0); mt->total_height = 0; pack_y_pitch = MAX2(mt->height0, 2); @@ -329,7 +329,7 @@ i945_miptree_layout(struct intel_mipmap_tree * mt) case GL_TEXTURE_1D: case GL_TEXTURE_2D: case GL_TEXTURE_RECTANGLE_ARB: - i945_miptree_layout_2d(mt); + i945_miptree_layout_2d(intel, mt); break; default: _mesa_problem(NULL, "Unexpected tex target in i945_miptree_layout()"); diff --git a/dist/Mesa/src/mesa/drivers/dri/i915tex/i915_vtbl.c b/dist/Mesa/src/mesa/drivers/dri/i915tex/i915_vtbl.c index e911fc400..1b055f66d 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i915tex/i915_vtbl.c +++ b/dist/Mesa/src/mesa/drivers/dri/i915tex/i915_vtbl.c @@ -198,7 +198,7 @@ i915_emit_invarient_state(struct intel_context *intel) /* Need to initialize this to zero. */ - OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | I1_LOAD_S(3) | (1)); + OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | I1_LOAD_S(3) | (0)); OUT_BATCH(0); /* XXX: Use this */ @@ -216,6 +216,7 @@ i915_emit_invarient_state(struct intel_context *intel) /* Don't support twosided stencil yet */ OUT_BATCH(_3DSTATE_BACKFACE_STENCIL_OPS | BFO_ENABLE_STENCIL_TWO_SIDE | 0); + OUT_BATCH(0); ADVANCE_BATCH(); } @@ -247,6 +248,9 @@ get_state_size(struct i915_hw_state *state) GLuint i; GLuint sz = 0; + if (dirty & I915_UPLOAD_INVARIENT) + sz += 30 * 4; + if (dirty & I915_UPLOAD_CTX) sz += sizeof(state->Ctx); @@ -281,7 +285,7 @@ get_state_size(struct i915_hw_state *state) /* Push the state into the sarea and/or texture memory. */ static void -i915_emit_state(struct intel_context *intel) +i915_do_emit_state(struct intel_context *intel) { struct i915_context *i915 = i915_context(&intel->ctx); struct i915_hw_state *state = i915->current; @@ -298,10 +302,33 @@ i915_emit_state(struct intel_context *intel) */ intel_batchbuffer_require_space(intel->batch, get_state_size(state), 0); + + /* Workaround. There are cases I haven't been able to track down + * where we aren't emitting a full state at the start of a new + * batchbuffer. This code spots that we are on a new batchbuffer + * and forces a full state emit no matter what. + * + * In the normal case state->emitted is already zero, this code is + * another set of checks to make sure it really is. + */ + if (intel->batch->id != intel->last_state_batch_id || + intel->batch->map == intel->batch->ptr) + { + state->emitted = 0; + intel_batchbuffer_require_space(intel->batch, get_state_size(state), 0); + } + /* Do this here as we may have flushed the batchbuffer above, * causing more state to be dirty! */ dirty = get_dirty(state); + state->emitted |= dirty; + assert(get_dirty(state) == 0); + + if (intel->batch->id != intel->last_state_batch_id) { + assert(dirty & I915_UPLOAD_CTX); + intel->last_state_batch_id = intel->batch->id; + } if (INTEL_DEBUG & DEBUG_STATE) fprintf(stderr, "%s dirty: %x\n", __FUNCTION__, dirty); @@ -424,7 +451,29 @@ i915_emit_state(struct intel_context *intel) i915_disassemble_program(state->Program, state->ProgramSize); } - state->emitted |= dirty; + intel->batch->dirty_state &= ~dirty; +} + +static void +i915_emit_state(struct intel_context *intel) +{ + struct i915_context *i915 = i915_context(&intel->ctx); + + i915_do_emit_state( intel ); + + /* Second chance - catch batchbuffer wrap in the middle of state + * emit. This shouldn't happen but it has been observed in + * testing. + */ + if (get_dirty( i915->current )) { + /* Force a full re-emit if this happens. + */ + i915->current->emitted = 0; + i915_do_emit_state( intel ); + } + + assert(get_dirty(i915->current) == 0); + assert((intel->batch->dirty_state & (1<<1)) == 0); } static void diff --git a/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_batchbuffer.c b/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_batchbuffer.c index b4e0b74f1..d7079a285 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_batchbuffer.c +++ b/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_batchbuffer.c @@ -118,6 +118,8 @@ intel_batchbuffer_reset(struct intel_batchbuffer *batch) batch->map = driBOMap(batch->buffer, DRM_BO_FLAG_WRITE, 0); batch->ptr = batch->map; + batch->dirty_state = ~0; + batch->id = batch->intel->intelScreen->batch_id++; } /*====================================================================== @@ -252,6 +254,7 @@ intel_batchbuffer_flush(struct intel_batchbuffer *batch) { struct intel_context *intel = batch->intel; GLuint used = batch->ptr - batch->map; + GLboolean was_locked = intel->locked; if (used == 0) return batch->last_fence; @@ -278,17 +281,14 @@ intel_batchbuffer_flush(struct intel_batchbuffer *batch) /* TODO: Just pass the relocation list and dma buffer up to the * kernel. */ - if (!intel->locked) { - assert(!(batch->flags & INTEL_BATCH_NO_CLIPRECTS)); - + if (!was_locked) LOCK_HARDWARE(intel); - do_flush_locked(batch, used, GL_FALSE, GL_TRUE); + + do_flush_locked(batch, used, !(batch->flags & INTEL_BATCH_CLIPRECTS), + GL_FALSE); + + if (!was_locked) UNLOCK_HARDWARE(intel); - } - else { - GLboolean ignore_cliprects = !(batch->flags & INTEL_BATCH_CLIPRECTS); - do_flush_locked(batch, used, ignore_cliprects, GL_FALSE); - } /* Reset the buffer: */ @@ -313,7 +313,7 @@ intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch, struct _DriBufferObject *buffer, GLuint flags, GLuint mask, GLuint delta) { - assert(batch->nr_relocs <= MAX_RELOCS); + assert(batch->nr_relocs < MAX_RELOCS); driBOAddListItem(&batch->list, buffer, flags, mask); diff --git a/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_batchbuffer.h b/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_batchbuffer.h index a83dbf423..76e5b3043 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_batchbuffer.h +++ b/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_batchbuffer.h @@ -9,7 +9,7 @@ struct intel_context; #define BATCH_SZ 16384 #define BATCH_RESERVED 16 -#define MAX_RELOCS 100 +#define MAX_RELOCS 400 #define INTEL_BATCH_NO_CLIPRECTS 0x1 #define INTEL_BATCH_CLIPRECTS 0x2 @@ -38,6 +38,9 @@ struct intel_batchbuffer struct buffer_reloc reloc[MAX_RELOCS]; GLuint nr_relocs; GLuint size; + + GLuint dirty_state; + GLuint id; }; struct intel_batchbuffer *intel_batchbuffer_alloc(struct intel_context diff --git a/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_blit.c b/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_blit.c index a0601515c..eef94c7fc 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_blit.c +++ b/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_blit.c @@ -112,8 +112,8 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv, for (i = 0; i < nbox; i++, pbox++) { drm_clip_rect_t box; - if (pbox->x1 > pbox->x2 || - pbox->y1 > pbox->y2 || + if (pbox->x1 >= pbox->x2 || + pbox->y1 >= pbox->y2 || pbox->x2 > intelScreen->width || pbox->y2 > intelScreen->height) continue; @@ -129,19 +129,22 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv, if (rect->y2 < box.y2) box.y2 = rect->y2; - if (box.x1 > box.x2 || box.y1 > box.y2) + if (box.x1 >= box.x2 || box.y1 >= box.y2) continue; } + assert(box.x1 < box.x2); + assert(box.y1 < box.y2); + BEGIN_BATCH(8, INTEL_BATCH_NO_CLIPRECTS); OUT_BATCH(CMD); OUT_BATCH(BR13); - OUT_BATCH((pbox->y1 << 16) | pbox->x1); - OUT_BATCH((pbox->y2 << 16) | pbox->x2); + OUT_BATCH((box.y1 << 16) | box.x1); + OUT_BATCH((box.y2 << 16) | box.x2); OUT_RELOC(frontRegion->buffer, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_WRITE, DRM_BO_MASK_MEM | DRM_BO_FLAG_WRITE, 0); - OUT_BATCH((pbox->y1 << 16) | pbox->x1); + OUT_BATCH((box.y1 << 16) | box.x1); OUT_BATCH(BR13 & 0xffff); OUT_RELOC(backRegion->buffer, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_READ, DRM_BO_MASK_MEM | DRM_BO_FLAG_READ, 0); @@ -152,7 +155,8 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv, if (intel->first_swap_fence) driFenceUnReference(intel->first_swap_fence); intel->first_swap_fence = intel_batchbuffer_flush(intel->batch); - driFenceReference(intel->first_swap_fence); + if (intel->first_swap_fence) + driFenceReference(intel->first_swap_fence); } UNLOCK_HARDWARE(intel); @@ -193,6 +197,8 @@ intelEmitFillBlit(struct intel_context *intel, DBG("%s dst:buf(%p)/%d+%d %d,%d sz:%dx%d\n", __FUNCTION__, dst_buffer, dst_pitch, dst_offset, x, y, w, h); + assert(w > 0); + assert(h > 0); BEGIN_BATCH(6, INTEL_BATCH_NO_CLIPRECTS); OUT_BATCH(CMD); @@ -280,10 +286,11 @@ intelEmitCopyBlit(struct intel_context *intel, return; } - if (dst_y2 < dst_y || dst_x2 < dst_x) { + if (dst_y2 <= dst_y || dst_x2 <= dst_x) { return; } + /* Initial y values don't seem to work with negative pitches. If * we adjust the offsets manually (below), it seems to work fine. * @@ -292,6 +299,9 @@ intelEmitCopyBlit(struct intel_context *intel, * the wrong result. */ if (dst_pitch > 0 && src_pitch > 0) { + assert(dst_x < dst_x2); + assert(dst_y < dst_y2); + BEGIN_BATCH(8, INTEL_BATCH_NO_CLIPRECTS); OUT_BATCH(CMD); OUT_BATCH(BR13); @@ -306,6 +316,9 @@ intelEmitCopyBlit(struct intel_context *intel, ADVANCE_BATCH(); } else { + assert(dst_x < dst_x2); + assert(h > 0); + BEGIN_BATCH(8, INTEL_BATCH_NO_CLIPRECTS); OUT_BATCH(CMD); OUT_BATCH(BR13); @@ -480,6 +493,9 @@ intelClearWithBlit(GLcontext * ctx, GLbitfield mask) */ intel_wait_flips(intel, INTEL_BATCH_NO_CLIPRECTS); + assert(b.x1 < b.x2); + assert(b.y1 < b.y2); + BEGIN_BATCH(6, INTEL_BATCH_NO_CLIPRECTS); OUT_BATCH(CMD); OUT_BATCH(BR13); diff --git a/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_buffers.c b/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_buffers.c index 78fb720b6..6778fdf43 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_buffers.c +++ b/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_buffers.c @@ -714,7 +714,8 @@ intel_wait_flips(struct intel_context *intel, GLuint batch_flags) BUFFER_BIT_FRONT_LEFT ? BUFFER_FRONT_LEFT : BUFFER_BACK_LEFT); - if (intel_fb->Base.Name == 0 && intel_rb->pf_pending == intel_fb->pf_seq) { + if (intel_fb->Base.Name == 0 && intel_rb && + intel_rb->pf_pending == intel_fb->pf_seq) { GLint pf_pipes = intel_fb->pf_pipes; BATCH_LOCALS; @@ -1019,16 +1020,11 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb) /* * How many color buffers are we drawing into? */ - if (fb->_NumColorDrawBuffers[0] != 1 -#if 0 - /* XXX FBO temporary - always use software rendering */ - || 1 -#endif - ) { + if (fb->_NumColorDrawBuffers[0] != 1) { /* writing to 0 or 2 or 4 color buffers */ /*_mesa_debug(ctx, "Software rendering\n");*/ FALLBACK(intel, INTEL_FALLBACK_DRAW_BUFFER, GL_TRUE); - front = 1; /* might not have back color buffer */ + colorRegion = NULL; } else { /* draw to exactly one color buffer */ @@ -1037,30 +1033,30 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb) if (fb->_ColorDrawBufferMask[0] == BUFFER_BIT_FRONT_LEFT) { front = 1; } - } - /* - * Get the intel_renderbuffer for the colorbuffer we're drawing into. - * And set up cliprects. - */ - if (fb->Name == 0) { - /* drawing to window system buffer */ - if (front) { - intelSetFrontClipRects(intel); - colorRegion = intel_get_rb_region(fb, BUFFER_FRONT_LEFT); + /* + * Get the intel_renderbuffer for the colorbuffer we're drawing into. + * And set up cliprects. + */ + if (fb->Name == 0) { + /* drawing to window system buffer */ + if (front) { + intelSetFrontClipRects(intel); + colorRegion = intel_get_rb_region(fb, BUFFER_FRONT_LEFT); + } + else { + intelSetBackClipRects(intel); + colorRegion = intel_get_rb_region(fb, BUFFER_BACK_LEFT); + } } else { - intelSetBackClipRects(intel); - colorRegion = intel_get_rb_region(fb, BUFFER_BACK_LEFT); + /* drawing to user-created FBO */ + struct intel_renderbuffer *irb; + intelSetRenderbufferClipRects(intel); + irb = intel_renderbuffer(fb->_ColorDrawBuffers[0][0]); + colorRegion = (irb && irb->region) ? irb->region : NULL; } } - else { - /* drawing to user-created FBO */ - struct intel_renderbuffer *irb; - intelSetRenderbufferClipRects(intel); - irb = intel_renderbuffer(fb->_ColorDrawBuffers[0][0]); - colorRegion = (irb && irb->region) ? irb->region : NULL; - } /* Update culling direction which changes depending on the * orientation of the buffer: diff --git a/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_context.c b/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_context.c index 40ea75641..722ef28cd 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_context.c +++ b/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_context.c @@ -315,7 +315,7 @@ intelFinish(GLcontext * ctx) intelFlush(ctx); if (intel->batch->last_fence) { driFenceFinish(intel->batch->last_fence, - 0, GL_FALSE); + DRM_FENCE_TYPE_EXE | DRM_I915_FENCE_TYPE_RW, GL_FALSE); driFenceUnReference(intel->batch->last_fence); intel->batch->last_fence = NULL; } diff --git a/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_context.h b/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_context.h index 5fc8eb3e3..6f893bd70 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_context.h +++ b/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_context.h @@ -189,6 +189,7 @@ struct intel_context struct _DriFenceObject *first_swap_fence; struct intel_batchbuffer *batch; + GLuint last_state_batch_id; struct { diff --git a/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_mipmap_tree.c b/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_mipmap_tree.c index 564eb9e01..d33a7d409 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_mipmap_tree.c +++ b/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_mipmap_tree.c @@ -75,6 +75,7 @@ intel_miptree_create(struct intel_context *intel, mt->cpp = compress_byte ? compress_byte : cpp; mt->compressed = compress_byte ? 1 : 0; mt->refcount = 1; + mt->pitch = 0; switch (intel->intelScreen->deviceID) { case PCI_CHIP_I945_G: @@ -83,7 +84,7 @@ intel_miptree_create(struct intel_context *intel, case PCI_CHIP_G33_G: case PCI_CHIP_Q33_G: case PCI_CHIP_Q35_G: - ok = i945_miptree_layout(mt); + ok = i945_miptree_layout(intel, mt); break; case PCI_CHIP_I915_G: case PCI_CHIP_I915_GM: @@ -93,28 +94,12 @@ intel_miptree_create(struct intel_context *intel, default: /* All the i830 chips and the i915 use this layout: */ - ok = i915_miptree_layout(mt); + ok = i915_miptree_layout(intel, mt); break; } if (ok) { - if (!mt->compressed) { - /* XXX: Align pitch to multiple of 64 bytes for now to allow - * render-to-texture to work in all cases. This should probably be - * replaced at some point by some scheme to only do this when really - * necessary. - */ - mt->pitch = (mt->pitch * cpp + 63) & ~63; - - /* XXX: At least the i915 seems very upset when the pitch is a multiple - * of 1024 and sometimes 512 bytes - performance can drop by several - * times. Go to the next multiple of 64 for now. - */ - if (!(mt->pitch & 511)) - mt->pitch += 64; - - mt->pitch /= cpp; - } + assert (mt->pitch); mt->region = intel_region_alloc(intel->intelScreen, mt->cpp, mt->pitch, mt->total_height); @@ -128,6 +113,42 @@ intel_miptree_create(struct intel_context *intel, return mt; } +/** + * intel_miptree_pitch_align: + * + * @intel: intel context pointer + * + * @mt: the miptree to compute pitch alignment for + * + * @pitch: the natural pitch value + * + * Given @pitch, compute a larger value which accounts for + * any necessary alignment required by the device + */ + +int intel_miptree_pitch_align (struct intel_context *intel, + struct intel_mipmap_tree *mt, + int pitch) +{ + if (!mt->compressed) { + /* XXX: Align pitch to multiple of 64 bytes for now to allow + * render-to-texture to work in all cases. This should probably be + * replaced at some point by some scheme to only do this when really + * necessary. + */ + pitch = (pitch * mt->cpp + 63) & ~63; + + /* XXX: At least the i915 seems very upset when the pitch is a multiple + * of 1024 and sometimes 512 bytes - performance can drop by several + * times. Go to the next multiple of the required alignment for now. + */ + if (!(pitch & 511)) + pitch += 64; + + pitch /= mt->cpp; + } + return pitch; +} void intel_miptree_reference(struct intel_mipmap_tree **dst, diff --git a/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_mipmap_tree.h b/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_mipmap_tree.h index ecdb7be24..0f068fb57 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_mipmap_tree.h +++ b/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_mipmap_tree.h @@ -123,6 +123,10 @@ struct intel_mipmap_tree *intel_miptree_create(struct intel_context *intel, GLuint cpp, GLuint compress_byte); +int intel_miptree_pitch_align (struct intel_context *intel, + struct intel_mipmap_tree *mt, + int pitch); + void intel_miptree_reference(struct intel_mipmap_tree **dst, struct intel_mipmap_tree *src); @@ -190,8 +194,10 @@ void intel_miptree_image_copy(struct intel_context *intel, /* i915_mipmap_tree.c: */ -GLboolean i915_miptree_layout(struct intel_mipmap_tree *mt); -GLboolean i945_miptree_layout(struct intel_mipmap_tree *mt); +GLboolean i915_miptree_layout(struct intel_context *intel, + struct intel_mipmap_tree *mt); +GLboolean i945_miptree_layout(struct intel_context *intel, + struct intel_mipmap_tree *mt); diff --git a/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_render.c b/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_render.c index f9fa55051..31624628e 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_render.c +++ b/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_render.c @@ -214,7 +214,7 @@ intel_run_render(GLcontext * ctx, struct tnl_pipeline_stage *stage) tnl->Driver.Render.Start(ctx); 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; diff --git a/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_screen.h b/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_screen.h index 17698773f..760a1eb7f 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_screen.h +++ b/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_screen.h @@ -51,12 +51,14 @@ typedef struct { intelRegion front; intelRegion back; + intelRegion third; intelRegion rotated; intelRegion depth; intelRegion tex; struct intel_region *front_region; struct intel_region *back_region; + struct intel_region *third_region; struct intel_region *depth_region; struct intel_region *rotated_region; @@ -93,6 +95,8 @@ typedef struct struct _DriBufferPool *regionPool; struct _DriBufferPool *staticPool; unsigned int maxBatchSize; + unsigned batch_id; + GLboolean havePools; } intelScreenPrivate; @@ -128,5 +132,7 @@ extern struct intel_context *intelScreenContext(intelScreenPrivate *intelScreen) extern void intelUpdateScreenRotation(__DRIscreenPrivate * sPriv, drmI830Sarea * sarea); +extern GLboolean +intelCreatePools(intelScreenPrivate *intelScreen); #endif diff --git a/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_tris.c b/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_tris.c index 1ba49d8f6..06dd505e9 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_tris.c +++ b/dist/Mesa/src/mesa/drivers/dri/i915tex/intel_tris.c @@ -43,6 +43,7 @@ #include "intel_context.h" #include "intel_tris.h" #include "intel_batchbuffer.h" +#include "intel_buffers.h" #include "intel_reg.h" #include "intel_span.h" #include "intel_tex.h" @@ -102,12 +103,17 @@ intelStartInlinePrimitive(struct intel_context *intel, /* _mesa_printf("%s *", __progname); */ + intel_wait_flips(intel, batch_flags); + /* Emit a slot which will be filled with the inline primitive * command later. */ BEGIN_BATCH(2, batch_flags); OUT_BATCH(0); + assert(intel->batch->id == intel->last_state_batch_id); + assert((intel->batch->dirty_state & (1<<1)) == 0); + intel->prim.start_ptr = intel->batch->ptr; intel->prim.primitive = prim; intel->prim.flush = intel_flush_inline_primitive; diff --git a/dist/Mesa/src/mesa/drivers/dri/i965/brw_aub_playback.c b/dist/Mesa/src/mesa/drivers/dri/i965/brw_aub_playback.c index 49cc96771..99d947551 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i965/brw_aub_playback.c +++ b/dist/Mesa/src/mesa/drivers/dri/i965/brw_aub_playback.c @@ -39,7 +39,7 @@ static void flush_and_fence( struct aub_state *s ) buf[0] = intel->vtbl.flush_cmd(); buf[1] = 0; - intel_cmd_ioctl(intel, (char *)&buf, sizeof(buf), GL_TRUE); + intel_cmd_ioctl(intel, (char *)&buf, sizeof(buf)); intelWaitIrq( intel, intelEmitIrqLocked( intel )); } @@ -64,7 +64,7 @@ static void flush_cmds( struct aub_state *s, * This differs slightly from how the stream was executed * initially as this would have been a batchbuffer. */ - intel_cmd_ioctl(s->intel, (void *)data, len, GL_TRUE); + intel_cmd_ioctl(s->intel, (void *)data, len); if (1) flush_and_fence(s); @@ -143,13 +143,15 @@ static struct { { CMD_CONST_BUFFER, "CONST_BUFFER", 1 }, { CMD_STATE_BASE_ADDRESS, "STATE_BASE_ADDRESS", 1 }, { CMD_STATE_INSN_POINTER, "STATE_INSN_POINTER", 1 }, - { CMD_PIPELINE_SELECT, "PIPELINE_SELECT", 0, }, + { CMD_PIPELINE_SELECT_965, "PIPELINE_SELECT", 0, }, + { CMD_PIPELINE_SELECT_IGD, "PIPELINE_SELECT", 0,}, { CMD_PIPELINED_STATE_POINTERS, "PIPELINED_STATE_POINTERS", 1 }, { CMD_BINDING_TABLE_PTRS, "BINDING_TABLE_PTRS", 1 }, { CMD_VERTEX_BUFFER, "VERTEX_BUFFER", 1 }, { CMD_VERTEX_ELEMENT, "VERTEX_ELEMENT", 1 }, { CMD_INDEX_BUFFER, "INDEX_BUFFER", 1 }, - { CMD_VF_STATISTICS, "VF_STATISTICS", 0 }, + { CMD_VF_STATISTICS_965, "VF_STATISTICS", 0 }, + { CMD_VF_STATISTICS_IGD, "VF_STATISTICS", 0 }, { CMD_DRAW_RECT, "DRAW_RECT", 1 }, { CMD_BLEND_CONSTANT_COLOR, "BLEND_CONSTANT_COLOR", 1 }, { CMD_CHROMA_KEY, "CHROMA_KEY", 1 }, @@ -157,6 +159,7 @@ static struct { { CMD_POLY_STIPPLE_OFFSET, "POLY_STIPPLE_OFFSET", 1 }, { CMD_POLY_STIPPLE_PATTERN, "POLY_STIPPLE_PATTERN", 1 }, { CMD_LINE_STIPPLE_PATTERN, "LINE_STIPPLE_PATTERN", 1 }, + { CMD_AA_LINE_PARAMETERS, "AA_LINE_PARAMETERS", 1}, { CMD_GLOBAL_DEPTH_OFFSET_CLAMP, "GLOBAL_DEPTH_OFFSET_CLAMP", 1 }, { CMD_PIPE_CONTROL, "PIPE_CONTROL", 1 }, { CMD_MI_FLUSH, "MI_FLUSH", 0 }, @@ -345,7 +348,7 @@ static int parse_block_header( struct aub_state *s ) } case BH_COMMAND_WRITE: #if 0 - intel_cmd_ioctl(s->intel, (void *)data, len, GL_TRUE); + intel_cmd_ioctl(s->intel, (void *)data, len); #else if (parse_commands(s, data, len) != 0) _mesa_printf("parse_commands failed\n"); diff --git a/dist/Mesa/src/mesa/drivers/dri/i965/brw_clip.c b/dist/Mesa/src/mesa/drivers/dri/i965/brw_clip.c index 8287fd9ed..8f907bea7 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i965/brw_clip.c +++ b/dist/Mesa/src/mesa/drivers/dri/i965/brw_clip.c @@ -60,7 +60,7 @@ static void compile_clip_prog( struct brw_context *brw, /* Begin the compilation: */ - brw_init_compile(&c.func); + brw_init_compile(brw, &c.func); c.func.single_program_flow = 1; diff --git a/dist/Mesa/src/mesa/drivers/dri/i965/brw_clip_state.c b/dist/Mesa/src/mesa/drivers/dri/i965/brw_clip_state.c index 1e6d6fa17..37a25a98f 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i965/brw_clip_state.c +++ b/dist/Mesa/src/mesa/drivers/dri/i965/brw_clip_state.c @@ -72,6 +72,10 @@ static void upload_clip_unit( struct brw_context *brw ) clip.clip5.viewport_xy_clip_enable = 1; clip.clip5.vertex_position_space = BRW_CLIP_NDCSPACE; clip.clip5.api_mode = BRW_CLIP_API_OGL; + + if (BRW_IS_IGD(brw)) + clip.clip5.negative_w_clip_test = 1; + clip.clip6.clipper_viewport_state_ptr = 0; clip.viewport_xmin = -1; clip.viewport_xmax = 1; diff --git a/dist/Mesa/src/mesa/drivers/dri/i965/brw_clip_tri.c b/dist/Mesa/src/mesa/drivers/dri/i965/brw_clip_tri.c index f62b02ced..0fc7306d3 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i965/brw_clip_tri.c +++ b/dist/Mesa/src/mesa/drivers/dri/i965/brw_clip_tri.c @@ -78,7 +78,7 @@ void brw_clip_tri_alloc_regs( struct brw_clip_compile *c, } c->reg.t = brw_vec1_grf(i, 0); - c->reg.loopcount = retype(brw_vec1_grf(i, 1), BRW_REGISTER_TYPE_UD); + c->reg.loopcount = retype(brw_vec1_grf(i, 1), BRW_REGISTER_TYPE_D); c->reg.nr_verts = retype(brw_vec1_grf(i, 2), BRW_REGISTER_TYPE_UD); c->reg.planemask = retype(brw_vec1_grf(i, 3), BRW_REGISTER_TYPE_UD); c->reg.plane_equation = brw_vec4_grf(i, 4); diff --git a/dist/Mesa/src/mesa/drivers/dri/i965/brw_clip_util.c b/dist/Mesa/src/mesa/drivers/dri/i965/brw_clip_util.c index 19bef1980..41d9b75e9 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i965/brw_clip_util.c +++ b/dist/Mesa/src/mesa/drivers/dri/i965/brw_clip_util.c @@ -262,7 +262,7 @@ void brw_clip_kill_thread(struct brw_clip_compile *c) c->reg.R0, 0, /* allocate */ 0, /* used */ - 0, /* msg len */ + 1, /* msg len */ 0, /* response len */ 1, /* eot */ 1, /* writes complete */ @@ -343,12 +343,14 @@ void brw_clip_init_clipmask( struct brw_clip_compile *c ) release_tmp(c, tmp); } - /* Test for -ve rhw workaround - */ - brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ); - brw_AND(p, vec1(brw_null_reg()), incoming, brw_imm_ud(1<<20)); - brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud(0x3f)); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); + if (!BRW_IS_IGD(p->brw)) { + /* Test for -ve rhw workaround + */ + brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ); + brw_AND(p, vec1(brw_null_reg()), incoming, brw_imm_ud(1<<20)); + brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud(0x3f)); + } + brw_set_predicate_control(p, BRW_PREDICATE_NONE); } diff --git a/dist/Mesa/src/mesa/drivers/dri/i965/brw_defines.h b/dist/Mesa/src/mesa/drivers/dri/i965/brw_defines.h index e8f878a70..101828b8c 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i965/brw_defines.h +++ b/dist/Mesa/src/mesa/drivers/dri/i965/brw_defines.h @@ -815,14 +815,16 @@ #define CMD_STATE_BASE_ADDRESS 0x6101 #define CMD_STATE_INSN_POINTER 0x6102 -#define CMD_PIPELINE_SELECT 0x6104 +#define CMD_PIPELINE_SELECT_965 0x6104 +#define CMD_PIPELINE_SELECT_IGD 0x6904 #define CMD_PIPELINED_STATE_POINTERS 0x7800 #define CMD_BINDING_TABLE_PTRS 0x7801 #define CMD_VERTEX_BUFFER 0x7808 #define CMD_VERTEX_ELEMENT 0x7809 #define CMD_INDEX_BUFFER 0x780a -#define CMD_VF_STATISTICS 0x780b +#define CMD_VF_STATISTICS_965 0x780b +#define CMD_VF_STATISTICS_IGD 0x680b #define CMD_DRAW_RECT 0x7900 #define CMD_BLEND_CONSTANT_COLOR 0x7901 @@ -832,6 +834,7 @@ #define CMD_POLY_STIPPLE_PATTERN 0x7907 #define CMD_LINE_STIPPLE_PATTERN 0x7908 #define CMD_GLOBAL_DEPTH_OFFSET_CLAMP 0x7909 +#define CMD_AA_LINE_PARAMETERS 0x790a #define CMD_PIPE_CONTROL 0x7a00 @@ -845,6 +848,9 @@ #define R02_PRIM_END 0x1 #define R02_PRIM_START 0x2 - +#define BRW_IS_IGD(brw) ((brw)->intel.intelScreen->deviceID == PCI_CHIP_IGD_GM) +#define CMD_PIPELINE_SELECT(brw) ((BRW_IS_IGD(brw)) ? CMD_PIPELINE_SELECT_IGD : CMD_PIPELINE_SELECT_965) +#define CMD_VF_STATISTICS(brw) ((BRW_IS_IGD(brw)) ? CMD_VF_STATISTICS_IGD : CMD_VF_STATISTICS_965) +#define URB_SIZES(brw) ((BRW_IS_IGD(brw)) ? 384 : 256) /* 512 bit unit */ #endif diff --git a/dist/Mesa/src/mesa/drivers/dri/i965/brw_eu.c b/dist/Mesa/src/mesa/drivers/dri/i965/brw_eu.c index d1244befd..b3ae4eef3 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i965/brw_eu.c +++ b/dist/Mesa/src/mesa/drivers/dri/i965/brw_eu.c @@ -101,8 +101,9 @@ void brw_pop_insn_state( struct brw_compile *p ) /*********************************************************************** */ -void brw_init_compile( struct brw_compile *p ) +void brw_init_compile( struct brw_context *brw, struct brw_compile *p ) { + p->brw = brw; p->nr_insn = 0; p->current = p->stack; memset(p->current, 0, sizeof(p->current[0])); diff --git a/dist/Mesa/src/mesa/drivers/dri/i965/brw_eu.h b/dist/Mesa/src/mesa/drivers/dri/i965/brw_eu.h index 1afa0f816..9d46aac26 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i965/brw_eu.h +++ b/dist/Mesa/src/mesa/drivers/dri/i965/brw_eu.h @@ -35,7 +35,7 @@ #include "brw_structs.h" #include "brw_defines.h" -#include "shader/program.h" +#include "shader/prog_instruction.h" #define BRW_SWIZZLE4(a,b,c,d) (((a)<<0) | ((b)<<2) | ((c)<<4) | ((d)<<6)) #define BRW_GET_SWZ(swz, idx) (((swz) >> ((idx)*2)) & 0x3) @@ -104,6 +104,8 @@ struct brw_compile { struct brw_instruction *current; GLuint flag_value; + GLboolean single_program_flow; + struct brw_context *brw; }; @@ -679,7 +681,7 @@ void brw_set_predicate_control_flag_value( struct brw_compile *p, GLuint value ) void brw_set_predicate_control( struct brw_compile *p, GLuint pc ); void brw_set_conditionalmod( struct brw_compile *p, GLuint conditional ); -void brw_init_compile( struct brw_compile *p ); +void brw_init_compile( struct brw_context *, struct brw_compile *p ); const GLuint *brw_get_program( struct brw_compile *p, GLuint *sz ); diff --git a/dist/Mesa/src/mesa/drivers/dri/i965/brw_eu_emit.c b/dist/Mesa/src/mesa/drivers/dri/i965/brw_eu_emit.c index 6425c9145..1c717e418 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/dist/Mesa/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -318,7 +318,8 @@ static void brw_set_dp_read_message( struct brw_instruction *insn, insn->bits3.dp_read.end_of_thread = end_of_thread; } -static void brw_set_sampler_message( struct brw_instruction *insn, +static void brw_set_sampler_message(struct brw_context *brw, + struct brw_instruction *insn, GLuint binding_table_index, GLuint sampler, GLuint msg_type, @@ -328,14 +329,24 @@ static void brw_set_sampler_message( struct brw_instruction *insn, { brw_set_src1(insn, brw_imm_d(0)); - insn->bits3.sampler.binding_table_index = binding_table_index; - insn->bits3.sampler.sampler = sampler; - insn->bits3.sampler.msg_type = msg_type; - insn->bits3.sampler.return_format = BRW_SAMPLER_RETURN_FORMAT_FLOAT32; - insn->bits3.sampler.response_length = response_length; - insn->bits3.sampler.msg_length = msg_length; - insn->bits3.sampler.end_of_thread = eot; - insn->bits3.sampler.msg_target = BRW_MESSAGE_TARGET_SAMPLER; + if (BRW_IS_IGD(brw)) { + insn->bits3.sampler_igd.binding_table_index = binding_table_index; + insn->bits3.sampler_igd.sampler = sampler; + insn->bits3.sampler_igd.msg_type = msg_type; + insn->bits3.sampler_igd.response_length = response_length; + insn->bits3.sampler_igd.msg_length = msg_length; + insn->bits3.sampler_igd.end_of_thread = eot; + insn->bits3.sampler_igd.msg_target = BRW_MESSAGE_TARGET_SAMPLER; + } else { + insn->bits3.sampler.binding_table_index = binding_table_index; + insn->bits3.sampler.sampler = sampler; + insn->bits3.sampler.msg_type = msg_type; + insn->bits3.sampler.return_format = BRW_SAMPLER_RETURN_FORMAT_FLOAT32; + insn->bits3.sampler.response_length = response_length; + insn->bits3.sampler.msg_length = msg_length; + insn->bits3.sampler.end_of_thread = eot; + insn->bits3.sampler.msg_target = BRW_MESSAGE_TARGET_SAMPLER; + } } @@ -464,7 +475,6 @@ struct brw_instruction *brw_JMPI(struct brw_compile *p, return insn; } - /* EU takes the value from the flag register and pushes it onto some * sort of a stack (presumably merging with any flag value already on * the stack). Within an if block, the flags at the top of the stack @@ -482,7 +492,16 @@ struct brw_instruction *brw_JMPI(struct brw_compile *p, */ struct brw_instruction *brw_IF(struct brw_compile *p, GLuint execute_size) { - struct brw_instruction *insn = next_insn(p, BRW_OPCODE_IF); + struct brw_instruction *insn; + + if (p->single_program_flow) { + assert(execute_size == BRW_EXECUTE_1); + + insn = next_insn(p, BRW_OPCODE_ADD); + insn->header.predicate_inverse = 1; + } else { + insn = next_insn(p, BRW_OPCODE_IF); + } /* Override the defaults for this instruction: */ @@ -504,7 +523,13 @@ struct brw_instruction *brw_IF(struct brw_compile *p, GLuint execute_size) struct brw_instruction *brw_ELSE(struct brw_compile *p, struct brw_instruction *if_insn) { - struct brw_instruction *insn = next_insn(p, BRW_OPCODE_ELSE); + struct brw_instruction *insn; + + if (p->single_program_flow) { + insn = next_insn(p, BRW_OPCODE_ADD); + } else { + insn = next_insn(p, BRW_OPCODE_ELSE); + } brw_set_dest(insn, brw_ip_reg()); brw_set_src0(insn, brw_ip_reg()); @@ -516,11 +541,17 @@ struct brw_instruction *brw_ELSE(struct brw_compile *p, /* Patch the if instruction to point at this instruction. */ - assert(if_insn->header.opcode == BRW_OPCODE_IF); + if (p->single_program_flow) { + assert(if_insn->header.opcode == BRW_OPCODE_ADD); - if_insn->bits3.if_else.jump_count = insn - if_insn; - if_insn->bits3.if_else.pop_count = 1; - if_insn->bits3.if_else.pad0 = 0; + if_insn->bits3.ud = (insn - if_insn + 1) * 16; + } else { + assert(if_insn->header.opcode == BRW_OPCODE_IF); + + if_insn->bits3.if_else.jump_count = insn - if_insn; + if_insn->bits3.if_else.pop_count = 1; + if_insn->bits3.if_else.pad0 = 0; + } return insn; } @@ -528,63 +559,76 @@ struct brw_instruction *brw_ELSE(struct brw_compile *p, void brw_ENDIF(struct brw_compile *p, struct brw_instruction *patch_insn) { - struct brw_instruction *insn = next_insn(p, BRW_OPCODE_ENDIF); + if (p->single_program_flow) { + /* In single program flow mode, there's no need to execute an ENDIF, + * since we don't need to do any stack operations, and if we're executing + * currently, we want to just continue executing. + */ + struct brw_instruction *next = &p->store[p->nr_insn]; - brw_set_dest(insn, retype(brw_vec4_grf(0,0), BRW_REGISTER_TYPE_UD)); - brw_set_src0(insn, retype(brw_vec4_grf(0,0), BRW_REGISTER_TYPE_UD)); - brw_set_src1(insn, brw_imm_d(0x0)); + assert(patch_insn->header.opcode == BRW_OPCODE_ADD); - insn->header.compression_control = BRW_COMPRESSION_NONE; - insn->header.execution_size = patch_insn->header.execution_size; - insn->header.mask_control = BRW_MASK_ENABLE; + patch_insn->bits3.ud = (next - patch_insn) * 16; + } else { + struct brw_instruction *insn = next_insn(p, BRW_OPCODE_ENDIF); - assert(patch_insn->bits3.if_else.jump_count == 0); - - /* Patch the if or else instructions to point at this or the next - * instruction respectively. - */ - if (patch_insn->header.opcode == BRW_OPCODE_IF) { - /* Automagically turn it into an IFF: + brw_set_dest(insn, retype(brw_vec4_grf(0,0), BRW_REGISTER_TYPE_UD)); + brw_set_src0(insn, retype(brw_vec4_grf(0,0), BRW_REGISTER_TYPE_UD)); + brw_set_src1(insn, brw_imm_d(0x0)); + + insn->header.compression_control = BRW_COMPRESSION_NONE; + insn->header.execution_size = patch_insn->header.execution_size; + insn->header.mask_control = BRW_MASK_ENABLE; + + assert(patch_insn->bits3.if_else.jump_count == 0); + + /* Patch the if or else instructions to point at this or the next + * instruction respectively. */ - patch_insn->header.opcode = BRW_OPCODE_IFF; - patch_insn->bits3.if_else.jump_count = insn - patch_insn + 1; - patch_insn->bits3.if_else.pop_count = 0; - patch_insn->bits3.if_else.pad0 = 0; + if (patch_insn->header.opcode == BRW_OPCODE_IF) { + /* Automagically turn it into an IFF: + */ + patch_insn->header.opcode = BRW_OPCODE_IFF; + patch_insn->bits3.if_else.jump_count = insn - patch_insn + 1; + patch_insn->bits3.if_else.pop_count = 0; + patch_insn->bits3.if_else.pad0 = 0; + } else if (patch_insn->header.opcode == BRW_OPCODE_ELSE) { + patch_insn->bits3.if_else.jump_count = insn - patch_insn + 1; + patch_insn->bits3.if_else.pop_count = 1; + patch_insn->bits3.if_else.pad0 = 0; + } else { + assert(0); + } + /* Also pop item off the stack in the endif instruction: + */ + insn->bits3.if_else.jump_count = 0; + insn->bits3.if_else.pop_count = 1; + insn->bits3.if_else.pad0 = 0; } - else if (patch_insn->header.opcode == BRW_OPCODE_ELSE) { - patch_insn->bits3.if_else.jump_count = insn - patch_insn + 1; - patch_insn->bits3.if_else.pop_count = 1; - patch_insn->bits3.if_else.pad0 = 0; - } - else { - assert(0); - } - - /* Also pop item off the stack in the endif instruction: - */ - insn->bits3.if_else.jump_count = 0; - insn->bits3.if_else.pop_count = 1; - insn->bits3.if_else.pad0 = 0; } /* DO/WHILE loop: */ struct brw_instruction *brw_DO(struct brw_compile *p, GLuint execute_size) { - struct brw_instruction *insn = next_insn(p, BRW_OPCODE_DO); + if (p->single_program_flow) { + return &p->store[p->nr_insn]; + } else { + struct brw_instruction *insn = next_insn(p, BRW_OPCODE_DO); - /* Override the defaults for this instruction: - */ - brw_set_dest(insn, retype(brw_vec1_grf(0,0), BRW_REGISTER_TYPE_UD)); - brw_set_src0(insn, retype(brw_vec1_grf(0,0), BRW_REGISTER_TYPE_UD)); - brw_set_src1(insn, retype(brw_vec1_grf(0,0), BRW_REGISTER_TYPE_UD)); + /* Override the defaults for this instruction: + */ + brw_set_dest(insn, retype(brw_vec1_grf(0,0), BRW_REGISTER_TYPE_UD)); + brw_set_src0(insn, retype(brw_vec1_grf(0,0), BRW_REGISTER_TYPE_UD)); + brw_set_src1(insn, retype(brw_vec1_grf(0,0), BRW_REGISTER_TYPE_UD)); - insn->header.compression_control = BRW_COMPRESSION_NONE; - insn->header.execution_size = execute_size; -/* insn->header.mask_control = BRW_MASK_ENABLE; */ + insn->header.compression_control = BRW_COMPRESSION_NONE; + insn->header.execution_size = execute_size; + /* insn->header.mask_control = BRW_MASK_ENABLE; */ - return insn; + return insn; + } } @@ -592,19 +636,31 @@ struct brw_instruction *brw_DO(struct brw_compile *p, GLuint execute_size) void brw_WHILE(struct brw_compile *p, struct brw_instruction *do_insn) { - struct brw_instruction *insn = next_insn(p, BRW_OPCODE_WHILE); + struct brw_instruction *insn; + + if (p->single_program_flow) + insn = next_insn(p, BRW_OPCODE_ADD); + else + insn = next_insn(p, BRW_OPCODE_WHILE); brw_set_dest(insn, brw_ip_reg()); brw_set_src0(insn, brw_ip_reg()); brw_set_src1(insn, brw_imm_d(0x0)); insn->header.compression_control = BRW_COMPRESSION_NONE; - insn->header.execution_size = do_insn->header.execution_size; - assert(do_insn->header.opcode == BRW_OPCODE_DO); - insn->bits3.if_else.jump_count = do_insn - insn; - insn->bits3.if_else.pop_count = 0; - insn->bits3.if_else.pad0 = 0; + if (p->single_program_flow) { + insn->header.execution_size = BRW_EXECUTE_1; + + insn->bits3.d = (do_insn - insn) * 16; + } else { + insn->header.execution_size = do_insn->header.execution_size; + + assert(do_insn->header.opcode == BRW_OPCODE_DO); + insn->bits3.if_else.jump_count = do_insn - insn; + insn->bits3.if_else.pop_count = 0; + insn->bits3.if_else.pad0 = 0; + } /* insn->header.mask_control = BRW_MASK_ENABLE; */ @@ -940,7 +996,7 @@ void brw_SAMPLE(struct brw_compile *p, brw_set_dest(insn, dest); brw_set_src0(insn, src0); - brw_set_sampler_message(insn, + brw_set_sampler_message(p->brw, insn, binding_table_index, sampler, msg_type, diff --git a/dist/Mesa/src/mesa/drivers/dri/i965/brw_gs.c b/dist/Mesa/src/mesa/drivers/dri/i965/brw_gs.c index 7d3f9dd5e..119d07d4f 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i965/brw_gs.c +++ b/dist/Mesa/src/mesa/drivers/dri/i965/brw_gs.c @@ -65,8 +65,10 @@ static void compile_gs_prog( struct brw_context *brw, /* Begin the compilation: */ - brw_init_compile(&c.func); - + brw_init_compile(brw, &c.func); + + c.func.single_program_flow = 1; + /* For some reason the thread is spawned with only 4 channels * unmasked. */ @@ -80,6 +82,9 @@ static void compile_gs_prog( struct brw_context *brw, case GL_QUADS: brw_gs_quads( &c ); break; + case GL_QUAD_STRIP: + brw_gs_quad_strip( &c ); + break; case GL_LINE_LOOP: brw_gs_lines( &c ); break; @@ -143,7 +148,7 @@ static const GLenum gs_prim[GL_POLYGON+1] = { GL_TRIANGLES, GL_TRIANGLES, GL_QUADS, - GL_QUADS, + GL_QUAD_STRIP, GL_TRIANGLES }; diff --git a/dist/Mesa/src/mesa/drivers/dri/i965/brw_misc_state.c b/dist/Mesa/src/mesa/drivers/dri/i965/brw_misc_state.c index 29296c17e..fe476c95c 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i965/brw_misc_state.c +++ b/dist/Mesa/src/mesa/drivers/dri/i965/brw_misc_state.c @@ -74,7 +74,6 @@ const struct brw_tracked_state brw_blend_constant_color = { /*********************************************************************** * Drawing rectangle -- Need for AUB file only. */ - static void upload_drawing_rect(struct brw_context *brw) { struct intel_context *intel = &brw->intel; @@ -83,17 +82,16 @@ static void upload_drawing_rect(struct brw_context *brw) int x1, y1; int x2, y2; - if (!brw->intel.aub_file) + /* If there is a single cliprect, set it here. Otherwise iterate + * over them in brw_draw_prim(). + */ + if (brw->intel.numClipRects > 1) return; - /* Basically calculate a single cliprect for the whole window. - * Don't bother iterating over cliprects at the moment. - */ - - x1 = dPriv->x; - y1 = dPriv->y; - x2 = dPriv->x + dPriv->w; - y2 = dPriv->y + dPriv->h; + x1 = brw->intel.pClipRects[0].x1; + y1 = brw->intel.pClipRects[0].y1; + x2 = brw->intel.pClipRects[0].x2; + y2 = brw->intel.pClipRects[0].y2; if (x1 < 0) x1 = 0; if (y1 < 0) y1 = 0; @@ -110,7 +108,10 @@ static void upload_drawing_rect(struct brw_context *brw) bdr.xorg = dPriv->x; bdr.yorg = dPriv->y; - BRW_CACHED_BATCH_STRUCT(brw, &bdr); + /* Can't use BRW_CACHED_BATCH_STRUCT because this is also emitted + * uncached in brw_draw.c: + */ + BRW_BATCH_STRUCT(brw, &bdr); } const struct brw_tracked_state brw_drawing_rect = { @@ -248,7 +249,7 @@ static void upload_depthbuffer(struct brw_context *brw) memset(&bd, 0, sizeof(bd)); bd.header.bits.opcode = CMD_DEPTH_BUFFER; - bd.header.bits.length = sizeof(bd)/4-2; + bd.header.bits.length = BRW_IS_IGD(brw) ? (sizeof(bd)/4-2) : (sizeof(bd)/4-3); bd.dword1.bits.pitch = (region->pitch * region->cpp) - 1; switch (region->cpp) { @@ -358,6 +359,33 @@ const struct brw_tracked_state brw_polygon_stipple_offset = { .update = upload_polygon_stipple_offset }; +/********************************************************************** + * AA Line parameters + */ +static void upload_aa_line_parameters(struct brw_context *brw) +{ + struct brw_aa_line_parameters balp; + + if (!BRW_IS_IGD(brw)) + return; + + /* use legacy aa line coverage computation */ + memset(&balp, 0, sizeof(balp)); + balp.header.opcode = CMD_AA_LINE_PARAMETERS; + balp.header.length = sizeof(balp) / 4 - 2; + + BRW_CACHED_BATCH_STRUCT(brw, &balp); +} + +const struct brw_tracked_state brw_aa_line_parameters = { + .dirty = { + .mesa = 0, + .brw = BRW_NEW_CONTEXT, + .cache = 0 + }, + .update = upload_aa_line_parameters +}; + /*********************************************************************** * Line stipple packet */ @@ -440,7 +468,7 @@ static void upload_invarient_state( struct brw_context *brw ) struct brw_pipeline_select ps; memset(&ps, 0, sizeof(ps)); - ps.header.opcode = CMD_PIPELINE_SELECT; + ps.header.opcode = CMD_PIPELINE_SELECT(brw); ps.header.pipeline_select = 0; BRW_BATCH_STRUCT(brw, &ps); } @@ -476,7 +504,7 @@ static void upload_invarient_state( struct brw_context *brw ) struct brw_vf_statistics vfs; memset(&vfs, 0, sizeof(vfs)); - vfs.opcode = CMD_VF_STATISTICS; + vfs.opcode = CMD_VF_STATISTICS(brw); if (INTEL_DEBUG & DEBUG_STATS) vfs.statistics_enable = 1; diff --git a/dist/Mesa/src/mesa/drivers/dri/i965/brw_sf.c b/dist/Mesa/src/mesa/drivers/dri/i965/brw_sf.c index d5175399d..6dcfa6286 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i965/brw_sf.c +++ b/dist/Mesa/src/mesa/drivers/dri/i965/brw_sf.c @@ -57,7 +57,7 @@ static void compile_sf_prog( struct brw_context *brw, /* Begin the compilation: */ - brw_init_compile(&c.func); + brw_init_compile(brw, &c.func); c.key = *key; c.nr_attrs = brw_count_bits(c.key.attrs); @@ -82,15 +82,15 @@ static void compile_sf_prog( struct brw_context *brw, switch (key->primitive) { case SF_TRIANGLES: c.nr_verts = 3; - brw_emit_tri_setup( &c ); + brw_emit_tri_setup( &c, GL_TRUE ); break; case SF_LINES: c.nr_verts = 2; - brw_emit_line_setup( &c ); + brw_emit_line_setup( &c, GL_TRUE ); break; case SF_POINTS: c.nr_verts = 1; - brw_emit_point_setup( &c ); + brw_emit_point_setup( &c, GL_TRUE ); break; case SF_UNFILLED_TRIS: c.nr_verts = 3; diff --git a/dist/Mesa/src/mesa/drivers/dri/i965/brw_sf.h b/dist/Mesa/src/mesa/drivers/dri/i965/brw_sf.h index fb72b84ba..b321cda8c 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i965/brw_sf.h +++ b/dist/Mesa/src/mesa/drivers/dri/i965/brw_sf.h @@ -97,9 +97,9 @@ struct brw_sf_compile { }; -void brw_emit_tri_setup( struct brw_sf_compile *c ); -void brw_emit_line_setup( struct brw_sf_compile *c ); -void brw_emit_point_setup( struct brw_sf_compile *c ); +void brw_emit_tri_setup( struct brw_sf_compile *c, GLboolean allocate ); +void brw_emit_line_setup( struct brw_sf_compile *c, GLboolean allocate ); +void brw_emit_point_setup( struct brw_sf_compile *c, GLboolean allocate ); void brw_emit_anyprim_setup( struct brw_sf_compile *c ); #endif diff --git a/dist/Mesa/src/mesa/drivers/dri/i965/brw_sf_emit.c b/dist/Mesa/src/mesa/drivers/dri/i965/brw_sf_emit.c index 2ea9816e2..94be81549 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i965/brw_sf_emit.c +++ b/dist/Mesa/src/mesa/drivers/dri/i965/brw_sf_emit.c @@ -343,13 +343,16 @@ static GLboolean calculate_masks( struct brw_sf_compile *c, -void brw_emit_tri_setup( struct brw_sf_compile *c ) +void brw_emit_tri_setup( struct brw_sf_compile *c, GLboolean allocate) { struct brw_compile *p = &c->func; GLuint i; c->nr_verts = 3; - alloc_regs(c); + + if (allocate) + alloc_regs(c); + invert_det(c); copy_z_inv_w(c); @@ -428,14 +431,17 @@ void brw_emit_tri_setup( struct brw_sf_compile *c ) -void brw_emit_line_setup( struct brw_sf_compile *c ) +void brw_emit_line_setup( struct brw_sf_compile *c, GLboolean allocate) { struct brw_compile *p = &c->func; GLuint i; c->nr_verts = 2; - alloc_regs(c); + + if (allocate) + alloc_regs(c); + invert_det(c); copy_z_inv_w(c); @@ -497,17 +503,19 @@ void brw_emit_line_setup( struct brw_sf_compile *c ) } } - /* Points setup - several simplifications as all attributes are * constant across the face of the point (point sprites excluded!) */ -void brw_emit_point_setup( struct brw_sf_compile *c ) +void brw_emit_point_setup( struct brw_sf_compile *c, GLboolean allocate) { struct brw_compile *p = &c->func; GLuint i; c->nr_verts = 1; - alloc_regs(c); + + if (allocate) + alloc_regs(c); + copy_z_inv_w(c); brw_MOV(p, c->m1Cx, brw_imm_ud(0)); /* zero - move out of loop */ @@ -564,7 +572,10 @@ void brw_emit_anyprim_setup( struct brw_sf_compile *c ) struct brw_reg primmask; struct brw_instruction *jmp; struct brw_reg v1_null_ud = vec1(retype(brw_null_reg(), BRW_REGISTER_TYPE_UD)); + + GLuint saveflag; + c->nr_verts = 3; alloc_regs(c); primmask = retype(get_element(c->tmp, 0), BRW_REGISTER_TYPE_UD); @@ -582,10 +593,15 @@ void brw_emit_anyprim_setup( struct brw_sf_compile *c ) (1<<_3DPRIM_TRIFAN_NOSTIPPLE))); jmp = brw_JMPI(p, ip, ip, brw_imm_w(0)); { - brw_push_insn_state(p); - brw_emit_tri_setup( c ); + saveflag = p->flag_value; + brw_push_insn_state(p); + brw_emit_tri_setup( c, GL_FALSE ); brw_pop_insn_state(p); - /* note - thread killed in subroutine */ + p->flag_value = saveflag; + /* note - thread killed in subroutine, so must + * restore the flag which is changed when building + * the subroutine. fix #13240 + */ } brw_land_fwd_jump(p, jmp); @@ -598,14 +614,16 @@ void brw_emit_anyprim_setup( struct brw_sf_compile *c ) (1<<_3DPRIM_LINESTRIP_CONT_BF))); jmp = brw_JMPI(p, ip, ip, brw_imm_w(0)); { + saveflag = p->flag_value; brw_push_insn_state(p); - brw_emit_line_setup( c ); + brw_emit_line_setup( c, GL_FALSE ); brw_pop_insn_state(p); + p->flag_value = saveflag; /* note - thread killed in subroutine */ } brw_land_fwd_jump(p, jmp); - brw_emit_point_setup( c ); + brw_emit_point_setup( c, GL_FALSE ); } diff --git a/dist/Mesa/src/mesa/drivers/dri/i965/brw_sf_state.c b/dist/Mesa/src/mesa/drivers/dri/i965/brw_sf_state.c index bfac52d76..2fd75a0c5 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i965/brw_sf_state.c +++ b/dist/Mesa/src/mesa/drivers/dri/i965/brw_sf_state.c @@ -185,7 +185,8 @@ static void upload_sf_unit( struct brw_context *brw ) sf.sf6.point_rast_rule = 1; /* opengl conventions */ sf.sf7.point_size = brw->attribs.Point->_Size * (1<<3); sf.sf7.use_point_size_state = !brw->attribs.Point->_Attenuated; - + sf.sf7.aa_line_distance_mode = 0; + /* might be BRW_NEW_PRIMITIVE if we have to adjust pv for polygons: */ sf.sf7.trifan_pv = 2; diff --git a/dist/Mesa/src/mesa/drivers/dri/i965/brw_state.h b/dist/Mesa/src/mesa/drivers/dri/i965/brw_state.h index b4cbdd7a3..41ac09514 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i965/brw_state.h +++ b/dist/Mesa/src/mesa/drivers/dri/i965/brw_state.h @@ -50,6 +50,7 @@ const struct brw_tracked_state brw_gs_prog; const struct brw_tracked_state brw_gs_unit; const struct brw_tracked_state brw_drawing_rect; const struct brw_tracked_state brw_line_stipple; +const struct brw_tracked_state brw_aa_line_parameters; const struct brw_tracked_state brw_pipelined_state_pointers; const struct brw_tracked_state brw_binding_table_pointers; const struct brw_tracked_state brw_depthbuffer; diff --git a/dist/Mesa/src/mesa/drivers/dri/i965/brw_state_batch.c b/dist/Mesa/src/mesa/drivers/dri/i965/brw_state_batch.c index 909b0acd1..c93d66a3a 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i965/brw_state_batch.c +++ b/dist/Mesa/src/mesa/drivers/dri/i965/brw_state_batch.c @@ -103,6 +103,7 @@ static void clear_batch_cache( struct brw_context *brw ) void brw_clear_batch_cache_flush( struct brw_context *brw ) { + bmFinishFenceLock(&(brw->intel), bmSetFenceLock(&(brw->intel))); clear_batch_cache(brw); brw->wrap = 0; diff --git a/dist/Mesa/src/mesa/drivers/dri/i965/brw_state_upload.c b/dist/Mesa/src/mesa/drivers/dri/i965/brw_state_upload.c index 92c07c296..9bd28817a 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/dist/Mesa/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -92,7 +92,7 @@ const struct brw_tracked_state *atoms[] = &brw_polygon_stipple_offset, &brw_line_stipple, - + &brw_aa_line_parameters, /* Ordering of the commands below is documented as fixed. */ #if 0 diff --git a/dist/Mesa/src/mesa/drivers/dri/i965/brw_structs.h b/dist/Mesa/src/mesa/drivers/dri/i965/brw_structs.h index 25acdcfe9..a799122cb 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i965/brw_structs.h +++ b/dist/Mesa/src/mesa/drivers/dri/i965/brw_structs.h @@ -141,7 +141,8 @@ struct brw_depthbuffer struct { GLuint pitch:18; GLuint format:3; - GLuint pad:4; + GLuint pad:2; + GLuint software_tiled_rendering_mode:2; GLuint depth_offset_disable:1; GLuint tile_walk:1; GLuint tiled_surface:1; @@ -166,12 +167,20 @@ struct brw_depthbuffer union { struct { - GLuint pad:12; - GLuint min_array_element:9; + GLuint pad:10; + GLuint min_array_element:11; GLuint depth:11; } bits; GLuint dword; } dword4; + + union { + struct { + GLuint xoffset:16; + GLuint yoffset:16; + } bits; + GLuint dword; + } dword5; /* NEW in Integrated Graphics Device */ }; struct brw_drawrect @@ -213,6 +222,25 @@ struct brw_indexbuffer GLuint buffer_end; }; +/* NEW in Integrated Graphics Device */ +struct brw_aa_line_parameters +{ + struct header header; + + struct { + GLuint aa_coverage_scope:8; + GLuint pad0:8; + GLuint aa_coverage_bias:8; + GLuint pad1:8; + } bits0; + + struct { + GLuint aa_coverage_endcap_slope:8; + GLuint pad0:8; + GLuint aa_coverage_endcap_bias:8; + GLuint pad1:8; + } bits1; +}; struct brw_line_stipple { @@ -315,7 +343,8 @@ struct brw_pipe_control { GLuint length:8; GLuint notify_enable:1; - GLuint pad:2; + GLuint texture_cache_flush_enable:1; + GLuint indirect_state_pointers_disable:1; GLuint instruction_state_cache_flush_enable:1; GLuint write_cache_flush_enable:1; GLuint depth_stall_enable:1; @@ -519,7 +548,22 @@ struct thread3 struct brw_clip_unit_state { struct thread0 thread0; - struct thread1 thread1; + struct + { + GLuint pad0:7; + GLuint sw_exception_enable:1; + GLuint pad1:3; + GLuint mask_stack_exception_enable:1; + GLuint pad2:1; + GLuint illegal_op_exception_enable:1; + GLuint pad3:2; + GLuint floating_point_mode:1; + GLuint thread_priority:1; + GLuint binding_table_entry_count:8; + GLuint pad4:5; + GLuint single_program_flow:1; + } thread1; + struct thread2 thread2; struct thread3 thread3; @@ -532,8 +576,8 @@ struct brw_clip_unit_state GLuint pad1:1; GLuint urb_entry_allocation_size:5; GLuint pad2:1; - GLuint max_threads:6; /* may be less */ - GLuint pad3:1; + GLuint max_threads:5; /* may be less */ + GLuint pad3:2; } thread4; struct @@ -542,7 +586,7 @@ struct brw_clip_unit_state GLuint clip_mode:3; GLuint userclip_enable_flags:8; GLuint userclip_must_clip:1; - GLuint pad1:1; + GLuint negative_w_clip_test:1; GLuint guard_band_enable:1; GLuint viewport_z_clip_enable:1; GLuint viewport_xy_clip_enable:1; @@ -709,7 +753,8 @@ struct brw_sf_unit_state GLuint use_point_size_state:1; GLuint subpixel_precision:1; GLuint sprite_point:1; - GLuint pad0:11; + GLuint pad0:10; + GLuint aa_line_distance_mode:1; GLuint trifan_pv:2; GLuint linestrip_pv:2; GLuint tristrip_pv:2; @@ -734,8 +779,8 @@ struct brw_gs_unit_state GLuint pad1:1; GLuint urb_entry_allocation_size:5; GLuint pad2:1; - GLuint max_threads:1; - GLuint pad3:6; + GLuint max_threads:5; + GLuint pad3:2; } thread4; struct @@ -749,9 +794,14 @@ struct brw_gs_unit_state struct { GLuint max_vp_index:4; - GLuint pad0:26; - GLuint reorder_enable:1; + GLuint pad0:12; + GLuint svbi_post_inc_value:10; GLuint pad1:1; + GLuint svbi_post_inc_enable:1; + GLuint svbi_payload:1; + GLuint discard_adjaceny:1; + GLuint reorder_enable:1; + GLuint pad2:1; } gs6; }; @@ -771,8 +821,8 @@ struct brw_vs_unit_state GLuint pad1:1; GLuint urb_entry_allocation_size:5; GLuint pad2:1; - GLuint max_threads:4; - GLuint pad3:3; + GLuint max_threads:6; + GLuint pad3:1; } thread4; struct @@ -800,7 +850,7 @@ struct brw_wm_unit_state struct { GLuint stats_enable:1; - GLuint pad0:1; + GLuint depth_buffer_clear:1; GLuint sampler_count:3; GLuint sampler_state_pointer:27; } wm4; @@ -810,7 +860,9 @@ struct brw_wm_unit_state GLuint enable_8_pix:1; GLuint enable_16_pix:1; GLuint enable_32_pix:1; - GLuint pad0:7; + GLuint enable_con_32_pix:1; + GLuint enable_con_64_pix:1; + GLuint pad0:5; GLuint legacy_global_depth_bias:1; GLuint line_stipple:1; GLuint depth_offset:1; @@ -823,9 +875,8 @@ struct brw_wm_unit_state GLuint program_computes_depth:1; GLuint program_uses_killpixel:1; GLuint legacy_line_rast: 1; - GLuint pad1:1; - GLuint max_threads:6; - GLuint pad2:1; + GLuint transposed_urb_read_enable:1; + GLuint max_threads:7; } wm5; GLfloat global_depth_offset_constant; @@ -963,10 +1014,26 @@ struct brw_surface_state } ss3; struct { - GLuint pad:19; - GLuint min_array_elt:9; + GLuint multisample_position_palette_index:3; + GLuint pad1:1; + GLuint num_multisamples:3; + GLuint pad0:1; + GLuint render_target_view_extent:9; + GLuint min_array_elt:11; GLuint min_lod:4; } ss4; + + struct { + GLuint pad1:16; + GLuint llc_mapping:1; + GLuint mlc_mapping:1; + GLuint gfdt:1; + GLuint gfdt_src:1; + GLuint y_offset:4; + GLuint pad0:1; + GLuint x_offset:7; + } ss5; /* NEW in Integrated Graphics Device */ + }; @@ -1286,6 +1353,17 @@ struct brw_instruction GLuint end_of_thread:1; } sampler; + struct { + GLuint binding_table_index:8; + GLuint sampler:4; + GLuint msg_type:4; + GLuint response_length:4; + GLuint msg_length:4; + GLuint msg_target:4; + GLuint pad1:3; + GLuint end_of_thread:1; + } sampler_igd; + struct brw_urb_immediate urb; struct { @@ -1322,6 +1400,7 @@ struct brw_instruction GLuint end_of_thread:1; } generic; + GLint d; GLuint ud; } bits3; }; diff --git a/dist/Mesa/src/mesa/drivers/dri/i965/brw_tex_layout.c b/dist/Mesa/src/mesa/drivers/dri/i965/brw_tex_layout.c index f8aa06824..d4888a42f 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i965/brw_tex_layout.c +++ b/dist/Mesa/src/mesa/drivers/dri/i965/brw_tex_layout.c @@ -34,21 +34,15 @@ */ #include "intel_mipmap_tree.h" +#include "intel_tex_layout.h" #include "macros.h" -static GLuint minify( GLuint d ) -{ - return MAX2(1, d>>1); -} - -GLboolean brw_miptree_layout( struct intel_mipmap_tree *mt ) +GLboolean brw_miptree_layout( struct intel_context *intel, struct intel_mipmap_tree *mt ) { /* XXX: these vary depending on image format: */ /* GLint align_w = 4; */ - GLint align_h = 2; - switch (mt->target) { case GL_TEXTURE_CUBE_MAP: @@ -107,50 +101,10 @@ GLboolean brw_miptree_layout( struct intel_mipmap_tree *mt ) break; } - default: { - GLuint level; - GLuint x = 0; - GLuint y = 0; - GLuint width = mt->width0; - GLuint height = mt->height0; - - mt->pitch = ((mt->width0 * mt->cpp + 3) & ~3) / mt->cpp; - mt->total_height = 0; - - for ( level = mt->first_level ; level <= mt->last_level ; level++ ) { - GLuint img_height; - - intel_miptree_set_level_info(mt, level, 1, - x, y, - width, - mt->compressed ? height/4 : height, 1); - - if (mt->compressed) - img_height = MAX2(1, height/4); - else - img_height = MAX2(align_h, height); - - - /* Because the images are packed better, the final offset - * might not be the maximal one: - */ - mt->total_height = MAX2(mt->total_height, y + img_height); - - /* Layout_below: step right after second mipmap. - */ - if (level == mt->first_level + 1) - x += mt->pitch / 2; - else { - y += img_height; - } - - - width = minify(width); - height = minify(height); - } + default: + i945_miptree_layout_2d(intel, mt); break; } - } DBG("%s: %dx%dx%d - sz 0x%x\n", __FUNCTION__, mt->pitch, mt->total_height, diff --git a/dist/Mesa/src/mesa/drivers/dri/i965/brw_urb.c b/dist/Mesa/src/mesa/drivers/dri/i965/brw_urb.c index 79ff2b2d4..4ca6e99db 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i965/brw_urb.c +++ b/dist/Mesa/src/mesa/drivers/dri/i965/brw_urb.c @@ -69,7 +69,7 @@ static GLboolean check_urb_layout( struct brw_context *brw ) brw->urb.sf_start = brw->urb.clip_start + brw->urb.nr_clip_entries * brw->urb.vsize; brw->urb.cs_start = brw->urb.sf_start + brw->urb.nr_sf_entries * brw->urb.sfsize; - return brw->urb.cs_start + brw->urb.nr_cs_entries * brw->urb.csize <= 256; + return brw->urb.cs_start + brw->urb.nr_cs_entries * brw->urb.csize <= URB_SIZES(brw); } /* Most minimal update, forces re-emit of URB fence packet after GS @@ -131,7 +131,7 @@ static void recalculate_urb_fence( struct brw_context *brw ) brw->urb.constrained = 1; - if (check_urb_layout(brw)) { + if (!check_urb_layout(brw)) { /* This is impossible, given the maximal sizes of urb * entries and the values for minimum nr of entries * provided above. @@ -153,7 +153,7 @@ static void recalculate_urb_fence( struct brw_context *brw ) brw->urb.clip_start, brw->urb.sf_start, brw->urb.cs_start, - 256); + URB_SIZES(brw)); brw->state.dirty.brw |= BRW_NEW_URB_FENCE; } @@ -191,13 +191,13 @@ void brw_upload_urb_fence(struct brw_context *brw) /* The ordering below is correct, not the layout in the * instruction. * - * There are 256 urb reg pairs in total. + * There are 256/384 urb reg pairs in total. */ uf.bits0.vs_fence = brw->urb.gs_start; uf.bits0.gs_fence = brw->urb.clip_start; uf.bits0.clp_fence = brw->urb.sf_start; uf.bits1.sf_fence = brw->urb.cs_start; - uf.bits1.cs_fence = 256; + uf.bits1.cs_fence = URB_SIZES(brw); BRW_BATCH_STRUCT(brw, &uf); } diff --git a/dist/Mesa/src/mesa/drivers/dri/i965/brw_vs.c b/dist/Mesa/src/mesa/drivers/dri/i965/brw_vs.c index 2a94ac649..50826d906 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i965/brw_vs.c +++ b/dist/Mesa/src/mesa/drivers/dri/i965/brw_vs.c @@ -34,8 +34,7 @@ #include "brw_vs.h" #include "brw_util.h" #include "brw_state.h" -#include "program.h" -#include "shader/arbprogparse.h" +#include "shader/prog_print.h" @@ -50,16 +49,15 @@ static void do_vs_prog( struct brw_context *brw, memset(&c, 0, sizeof(c)); memcpy(&c.key, key, sizeof(*key)); - brw_init_compile(&c.func); + brw_init_compile(brw, &c.func); 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) @@ -105,6 +103,11 @@ static void brw_upload_vs_prog( struct brw_context *brw ) key.copy_edgeflag = (brw->attribs.Polygon->FrontMode != GL_FILL || brw->attribs.Polygon->BackMode != GL_FILL); + /* BRW_NEW_METAOPS + */ + if (brw->metaops.active) + key.know_w_is_one = 1; + /* Make an early check for the key. */ if (brw_search_cache(&brw->cache[BRW_VS_PROG], @@ -122,7 +125,7 @@ static void brw_upload_vs_prog( struct brw_context *brw ) const struct brw_tracked_state brw_vs_prog = { .dirty = { .mesa = _NEW_TRANSFORM | _NEW_POLYGON, - .brw = BRW_NEW_VERTEX_PROGRAM, + .brw = BRW_NEW_VERTEX_PROGRAM | BRW_NEW_METAOPS, .cache = 0 }, .update = brw_upload_vs_prog diff --git a/dist/Mesa/src/mesa/drivers/dri/i965/brw_vs_emit.c b/dist/Mesa/src/mesa/drivers/dri/i965/brw_vs_emit.c index a22740084..c38e998d4 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/dist/Mesa/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -30,10 +30,11 @@ */ -#include "brw_context.h" #include "program.h" -#include "program_instruction.h" #include "macros.h" +#include "shader/prog_parameter.h" +#include "shader/prog_print.h" +#include "brw_context.h" #include "brw_vs.h" @@ -77,7 +78,7 @@ 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++) { + 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); @@ -791,19 +792,27 @@ 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)); } /* Build ndc coords? TODO: Shortcircuit when w is known to be one. */ - ndc = get_tmp(c); - emit_math1(c, BRW_MATH_FUNCTION_INV, ndc, brw_swizzle1(pos, 3), BRW_MATH_PRECISION_FULL); - brw_MUL(p, brw_writemask(ndc, WRITEMASK_XYZ), pos, ndc); + if (!c->key.know_w_is_one) { + ndc = get_tmp(c); + emit_math1(c, BRW_MATH_FUNCTION_INV, ndc, brw_swizzle1(pos, 3), BRW_MATH_PRECISION_FULL); + brw_MUL(p, brw_writemask(ndc, WRITEMASK_XYZ), pos, ndc); + } + else { + ndc = pos; + } /* This includes the workaround for -ve rhw, so is no longer an * optional step: */ + if ((c->prog_data.outputs_written & (1<<VERT_RESULT_PSIZ)) || + c->key.nr_userclip || + !c->key.know_w_is_one) { struct brw_reg header1 = retype(get_tmp(c), BRW_REGISTER_TYPE_UD); GLuint i; @@ -836,20 +845,17 @@ static void emit_vertex_write( struct brw_vs_compile *c) * Later, clipping will detect ucp[6] and ensure the primitive is * clipped against all fixed planes. */ - brw_CMP(p, - vec8(brw_null_reg()), - BRW_CONDITIONAL_L, - brw_swizzle1(ndc, 3), - brw_imm_f(0)); + if (!BRW_IS_IGD(p->brw) && !c->key.know_w_is_one) { + brw_CMP(p, + vec8(brw_null_reg()), + BRW_CONDITIONAL_L, + brw_swizzle1(ndc, 3), + brw_imm_f(0)); - brw_OR(p, brw_writemask(header1, WRITEMASK_W), header1, brw_imm_ud(1<<6)); - brw_MOV(p, ndc, brw_imm_f(0)); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - - - - - + brw_OR(p, brw_writemask(header1, WRITEMASK_W), header1, brw_imm_ud(1<<6)); + brw_MOV(p, ndc, brw_imm_f(0)); + brw_set_predicate_control(p, BRW_PREDICATE_NONE); + } brw_set_access_mode(p, BRW_ALIGN_1); /* why? */ brw_MOV(p, retype(brw_message_reg(1), BRW_REGISTER_TYPE_UD), header1); @@ -857,6 +863,9 @@ static void emit_vertex_write( struct brw_vs_compile *c) release_tmp(c, header1); } + else { + brw_MOV(p, retype(brw_message_reg(1), BRW_REGISTER_TYPE_UD), brw_imm_ud(0)); + } /* Emit the (interleaved) headers for the two vertices - an 8-reg diff --git a/dist/Mesa/src/mesa/drivers/dri/i965/brw_wm.c b/dist/Mesa/src/mesa/drivers/dri/i965/brw_wm.c index 3e2f2d06b..f80ba1780 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i965/brw_wm.c +++ b/dist/Mesa/src/mesa/drivers/dri/i965/brw_wm.c @@ -36,10 +36,6 @@ #include "brw_state.h" #include "brw_hal.h" -#include "program.h" -#include "program_instruction.h" -#include "arbprogparse.h" - GLuint brw_wm_nr_args( GLuint opcode ) { @@ -138,64 +134,74 @@ static void do_wm_prog( struct brw_context *brw, struct brw_fragment_program *fp, struct brw_wm_prog_key *key) { - struct brw_wm_compile c; + struct brw_wm_compile *c; const GLuint *program; GLuint program_size; - memset(&c, 0, sizeof(c)); - memcpy(&c.key, key, sizeof(*key)); - - c.fp = fp; - c.env_param = brw->intel.ctx.FragmentProgram.Parameters; + c = brw->wm.compile_data; + if (c == NULL) { + brw->wm.compile_data = calloc(1, sizeof(*brw->wm.compile_data)); + c = brw->wm.compile_data; + } else { + memset(c, 0, sizeof(*brw->wm.compile_data)); + } + memcpy(&c->key, key, sizeof(*key)); + c->fp = fp; + c->env_param = brw->intel.ctx.FragmentProgram.Parameters; /* Augment fragment program. Add instructions for pre- and * post-fragment-program tasks such as interpolation and fogging. */ - brw_wm_pass_fp(&c); + brw_wm_pass_fp(c); /* Translate to intermediate representation. Build register usage * chains. */ - brw_wm_pass0(&c); + brw_wm_pass0(c); /* Dead code removal. */ - brw_wm_pass1(&c); + brw_wm_pass1(c); /* Hal optimization */ - brw_wm_pass_hal (&c); + brw_wm_pass_hal (c); /* Register allocation. */ - c.grf_limit = BRW_WM_MAX_GRF/2; + c->grf_limit = BRW_WM_MAX_GRF/2; /* This is where we start emitting gen4 code: */ - brw_init_compile(&c.func); + brw_init_compile(brw, &c->func); - brw_wm_pass2(&c); + brw_wm_pass2(c); - c.prog_data.total_grf = c.max_wm_grf; - c.prog_data.total_scratch = c.last_scratch ? c.last_scratch + 0x40 : 0; + c->prog_data.total_grf = c->max_wm_grf; + if (c->last_scratch) { + c->prog_data.total_scratch = + c->last_scratch + 0x40; + } else { + c->prog_data.total_scratch = 0; + } /* Emit GEN4 code. */ - brw_wm_emit(&c); + brw_wm_emit(c); /* get the program */ - program = brw_get_program(&c.func, &program_size); + program = brw_get_program(&c->func, &program_size); /* */ brw->wm.prog_gs_offset = brw_upload_cache( &brw->cache[BRW_WM_PROG], - &c.key, - sizeof(c.key), + &c->key, + sizeof(c->key), program, program_size, - &c.prog_data, + &c->prog_data, &brw->wm.prog_data ); } diff --git a/dist/Mesa/src/mesa/drivers/dri/i965/brw_wm_emit.c b/dist/Mesa/src/mesa/drivers/dri/i965/brw_wm_emit.c index d96a9b717..80bd5763d 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/dist/Mesa/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -30,10 +30,8 @@ */ -#include "brw_context.h" -#include "program.h" -#include "program_instruction.h" #include "macros.h" +#include "brw_context.h" #include "brw_wm.h" #define SATURATE (1<<5) @@ -779,6 +777,7 @@ static void emit_kil( struct brw_wm_compile *c, brw_push_insn_state(p); brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_GE, arg0[i], brw_imm_f(0)); brw_set_predicate_control_flag_value(p, 0xff); + brw_set_compression_control(p, BRW_COMPRESSION_NONE); brw_AND(p, r0uw, brw_flag_reg(), r0uw); brw_pop_insn_state(p); } diff --git a/dist/Mesa/src/mesa/drivers/dri/i965/bufmgr_fake.c b/dist/Mesa/src/mesa/drivers/dri/i965/bufmgr_fake.c index 8f182f3d8..fb4903dbc 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i965/bufmgr_fake.c +++ b/dist/Mesa/src/mesa/drivers/dri/i965/bufmgr_fake.c @@ -117,6 +117,7 @@ struct bufmgr { struct block fenced; /* after bmFenceBuffers (mi_flush, emit irq, write dword) */ /* then to pool->lru or free() */ + unsigned ctxId; unsigned last_fence; unsigned free_on_hardware; @@ -337,7 +338,6 @@ static int evict_mru( struct intel_context *intel, GLuint *pool ) } - static int check_fenced( struct intel_context *intel ) { struct bufmgr *bm = intel->bm; @@ -578,6 +578,12 @@ struct bufmgr *bm_fake_intel_Attach( struct intel_context *intel ) make_empty_list(&bm.referenced); make_empty_list(&bm.fenced); make_empty_list(&bm.on_hardware); + + /* The context id of any of the share group. This won't be used + * in communication with the kernel, so it doesn't matter if + * this context is eventually deleted. + */ + bm.ctxId = intel->hHWContext; } nr_attach++; @@ -698,6 +704,9 @@ void bmDeleteBuffers(struct intel_context *intel, unsigned n, struct buffer **bu if (buf && buf->block) free_block(intel, buf->block); + if (buf && buf->backing_store) + free_backing_store(intel, buf); + if (buf) free(buf); } @@ -1242,7 +1251,6 @@ void bmReleaseBuffers( struct intel_context *intel ) LOCK(bm); { struct block *block, *tmp; - assert(intel->locked); foreach_s (block, tmp, &bm->referenced) { @@ -1301,7 +1309,7 @@ unsigned bmSetFence( struct intel_context *intel ) GLuint dword[2]; dword[0] = intel->vtbl.flush_cmd(); dword[1] = 0; - intel_cmd_ioctl(intel, (char *)&dword, sizeof(dword), GL_TRUE); + intel_cmd_ioctl(intel, (char *)&dword, sizeof(dword)); intel->bm->last_fence = intelEmitIrqLocked( intel ); @@ -1322,11 +1330,21 @@ unsigned bmSetFence( struct intel_context *intel ) return intel->bm->last_fence; } +unsigned bmSetFenceLock( struct intel_context *intel ) +{ + unsigned last; + LOCK(intel->bm); + last = bmSetFence(intel); + UNLOCK(intel->bm); + return last; +} unsigned bmLockAndFence( struct intel_context *intel ) { if (intel->bm->need_fence) { LOCK_HARDWARE(intel); + LOCK(intel->bm); bmSetFence(intel); + UNLOCK(intel->bm); UNLOCK_HARDWARE(intel); } @@ -1344,7 +1362,12 @@ void bmFinishFence( struct intel_context *intel, unsigned fence ) check_fenced(intel); } - +void bmFinishFenceLock( struct intel_context *intel, unsigned fence ) +{ + LOCK(intel->bm); + bmFinishFence(intel, fence); + UNLOCK(intel->bm); +} /* Specifically ignore texture memory sharing. @@ -1432,3 +1455,9 @@ GLboolean bmError( struct intel_context *intel ) return retval; } + + +GLuint bmCtxId( struct intel_context *intel ) +{ + return intel->bm->ctxId; +} diff --git a/dist/Mesa/src/mesa/drivers/dri/i965/intel_context.c b/dist/Mesa/src/mesa/drivers/dri/i965/intel_context.c index 33efed431..5ee528296 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i965/intel_context.c +++ b/dist/Mesa/src/mesa/drivers/dri/i965/intel_context.c @@ -118,6 +118,9 @@ static const GLubyte *intelGetString( GLcontext *ctx, GLenum name ) case PCI_CHIP_I965_GM: chipset = "Intel(R) 965GM"; break; break; + case PCI_CHIP_IGD_GM: + chipset = "Intel(R) Integrated Graphics Device"; + break; default: chipset = "Unknown Intel Chipset"; break; } diff --git a/dist/Mesa/src/mesa/drivers/dri/i965/intel_context.h b/dist/Mesa/src/mesa/drivers/dri/i965/intel_context.h index 9f69f2370..a2447574c 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i965/intel_context.h +++ b/dist/Mesa/src/mesa/drivers/dri/i965/intel_context.h @@ -387,6 +387,8 @@ extern int INTEL_DEBUG; #define PCI_CHIP_I946_GZ 0x2972 #define PCI_CHIP_I965_GM 0x2A02 +#define PCI_CHIP_IGD_GM 0x2A42 + /* ================================================================ * intel_context.c: diff --git a/dist/Mesa/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/dist/Mesa/src/mesa/drivers/dri/i965/intel_mipmap_tree.c index 8486086b2..8548bc88b 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i965/intel_mipmap_tree.c +++ b/dist/Mesa/src/mesa/drivers/dri/i965/intel_mipmap_tree.c @@ -91,7 +91,7 @@ struct intel_mipmap_tree *intel_miptree_create( struct intel_context *intel, default: if (INTEL_DEBUG & DEBUG_TEXTURE) _mesa_printf("assuming BRW texture layouts\n"); - ok = brw_miptree_layout( mt ); + ok = brw_miptree_layout( intel, mt ); break; } @@ -110,6 +110,29 @@ struct intel_mipmap_tree *intel_miptree_create( struct intel_context *intel, } +/** + * intel_miptree_pitch_align: + * + * @intel: intel context pointer + * + * @mt: the miptree to compute pitch alignment for + * + * @pitch: the natural pitch value + * + * Given @pitch, compute a larger value which accounts for + * any necessary alignment required by the device + */ + +int intel_miptree_pitch_align (struct intel_context *intel, + struct intel_mipmap_tree *mt, + int pitch) +{ + if (!mt->compressed) + pitch = ((pitch * mt->cpp + 3) & ~3) / mt->cpp; + + return pitch; +} + void intel_miptree_destroy( struct intel_context *intel, struct intel_mipmap_tree *mt ) diff --git a/dist/Mesa/src/mesa/drivers/dri/i965/intel_mipmap_tree.h b/dist/Mesa/src/mesa/drivers/dri/i965/intel_mipmap_tree.h index dbd7167b7..c67c726cf 100644 --- a/dist/Mesa/src/mesa/drivers/dri/i965/intel_mipmap_tree.h +++ b/dist/Mesa/src/mesa/drivers/dri/i965/intel_mipmap_tree.h @@ -115,6 +115,10 @@ struct intel_mipmap_tree *intel_miptree_create( struct intel_context *intel, GLuint cpp, GLboolean compressed); +int intel_miptree_pitch_align (struct intel_context *intel, + struct intel_mipmap_tree *mt, + int pitch); + void intel_miptree_destroy( struct intel_context *intel, struct intel_mipmap_tree *mt ); @@ -159,7 +163,8 @@ GLboolean intel_miptree_image_data(struct intel_context *intel, */ GLboolean i915_miptree_layout( struct intel_mipmap_tree *mt ); GLboolean i945_miptree_layout( struct intel_mipmap_tree *mt ); -GLboolean brw_miptree_layout( struct intel_mipmap_tree *mt ); +GLboolean brw_miptree_layout( struct intel_context *intel, + struct intel_mipmap_tree *mt ); diff --git a/dist/Mesa/src/mesa/drivers/dri/intel/intel_tex_layout.c b/dist/Mesa/src/mesa/drivers/dri/intel/intel_tex_layout.c index fcb5cc390..39a443c4f 100644 --- a/dist/Mesa/src/mesa/drivers/dri/intel/intel_tex_layout.c +++ b/dist/Mesa/src/mesa/drivers/dri/intel/intel_tex_layout.c @@ -40,7 +40,7 @@ static int align(int value, int alignment) return (value + alignment - 1) & ~(alignment - 1); } -void i945_miptree_layout_2d( struct intel_mipmap_tree *mt ) +void i945_miptree_layout_2d( struct intel_context *intel, struct intel_mipmap_tree *mt ) { GLint align_h = 2, align_w = 4; GLuint level; @@ -67,7 +67,7 @@ void i945_miptree_layout_2d( struct intel_mipmap_tree *mt ) /* Pitch must be a whole number of dwords, even though we * express it in texels. */ - mt->pitch = align(mt->pitch * mt->cpp, 4) / mt->cpp; + mt->pitch = intel_miptree_pitch_align (intel, mt, mt->pitch); mt->total_height = 0; for ( level = mt->first_level ; level <= mt->last_level ; level++ ) { diff --git a/dist/Mesa/src/mesa/drivers/dri/intel/intel_tex_layout.h b/dist/Mesa/src/mesa/drivers/dri/intel/intel_tex_layout.h index 1e37f8f52..46151dbb7 100644 --- a/dist/Mesa/src/mesa/drivers/dri/intel/intel_tex_layout.h +++ b/dist/Mesa/src/mesa/drivers/dri/intel/intel_tex_layout.h @@ -38,4 +38,4 @@ static GLuint minify( GLuint d ) return MAX2(1, d>>1); } -extern void i945_miptree_layout_2d( struct intel_mipmap_tree *mt ); +extern void i945_miptree_layout_2d( struct intel_context *intel, struct intel_mipmap_tree *mt ); diff --git a/dist/Mesa/src/mesa/drivers/dri/mga/mgarender.c b/dist/Mesa/src/mesa/drivers/dri/mga/mgarender.c index 3080cea79..c151f7991 100644 --- a/dist/Mesa/src/mesa/drivers/dri/mga/mgarender.c +++ b/dist/Mesa/src/mesa/drivers/dri/mga/mgarender.c @@ -144,7 +144,7 @@ static GLboolean mga_run_render( GLcontext *ctx, 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; diff --git a/dist/Mesa/src/mesa/drivers/dri/r200/r200_tcl.c b/dist/Mesa/src/mesa/drivers/dri/r200/r200_tcl.c index 18b5458a9..1ff0cf9cb 100644 --- a/dist/Mesa/src/mesa/drivers/dri/r200/r200_tcl.c +++ b/dist/Mesa/src/mesa/drivers/dri/r200/r200_tcl.c @@ -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" @@ -68,7 +68,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define HAVE_ELTS 1 -#define HW_POINTS ((ctx->_TriangleCaps & DD_POINT_SIZE) ? \ +#define HW_POINTS ((ctx->Point.PointSprite || \ + ((ctx->_TriangleCaps & (DD_POINT_SIZE | DD_POINT_ATTEN)) && \ + !(ctx->_TriangleCaps & (DD_POINT_SMOOTH)))) ? \ R200_VF_PRIM_POINT_SPRITES : R200_VF_PRIM_POINTS) #define HW_LINES R200_VF_PRIM_LINES #define HW_LINE_LOOP 0 @@ -268,6 +270,17 @@ void r200TclPrimitive( GLcontext *ctx, if (newprim != rmesa->tcl.hw_primitive || !discrete_prim[hw_prim&0xf]) { + /* need to disable perspective-correct texturing for point sprites */ + if ((prim & PRIM_MODE_MASK) == GL_POINTS && ctx->Point.PointSprite) { + if (rmesa->hw.set.cmd[SET_RE_CNTL] & R200_PERSPECTIVE_ENABLE) { + R200_STATECHANGE( rmesa, set ); + rmesa->hw.set.cmd[SET_RE_CNTL] &= ~R200_PERSPECTIVE_ENABLE; + } + } + else if (!(rmesa->hw.set.cmd[SET_RE_CNTL] & R200_PERSPECTIVE_ENABLE)) { + R200_STATECHANGE( rmesa, set ); + rmesa->hw.set.cmd[SET_RE_CNTL] |= R200_PERSPECTIVE_ENABLE; + } R200_NEWPRIM( rmesa ); rmesa->tcl.hw_primitive = newprim; } @@ -371,8 +384,14 @@ static GLboolean r200_run_tcl_render( GLcontext *ctx, r200ContextPtr rmesa = R200_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; - GLuint inputs = VERT_BIT_POS | VERT_BIT_COLOR0; GLuint i; + GLubyte *vimap_rev; +/* use hw fixed order for simplicity, pos 0, weight 1, normal 2, fog 3, + color0 - color3 4-7, texcoord0 - texcoord5 8-13, pos 1 14. Must not use + more than 12 of those at the same time. */ + GLubyte map_rev_fixed[15] = {255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255}; + /* TODO: separate this from the swtnl pipeline */ @@ -394,95 +413,83 @@ static GLboolean r200_run_tcl_render( GLcontext *ctx, /* NOTE: inputs != tnl->render_inputs - these are the untransformed * inputs. */ + map_rev_fixed[0] = VERT_ATTRIB_POS; + /* technically there is no reason we always need VA_COLOR0. In theory + could disable it depending on lighting, color materials, texturing... */ + map_rev_fixed[4] = VERT_ATTRIB_COLOR0; + if (ctx->Light.Enabled) { - inputs |= VERT_BIT_NORMAL; + map_rev_fixed[2] = VERT_ATTRIB_NORMAL; } + /* this also enables VA_COLOR1 when using separate specular + lighting model, which is unnecessary. + FIXME: OTOH, we're missing the case where a ATI_fragment_shader accesses + the secondary color (if lighting is disabled). The chip seems + misconfigured for that though elsewhere (tcl output, might lock up) */ if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) { - inputs |= VERT_BIT_COLOR1; + map_rev_fixed[5] = VERT_ATTRIB_COLOR1; } if ( (ctx->Fog.FogCoordinateSource == GL_FOG_COORD) && ctx->Fog.Enabled ) { - inputs |= VERT_BIT_FOG; + map_rev_fixed[3] = VERT_ATTRIB_FOG; } for (i = 0 ; i < ctx->Const.MaxTextureUnits; i++) { if (ctx->Texture.Unit[i]._ReallyEnabled) { if (rmesa->TexGenNeedNormals[i]) { - inputs |= VERT_BIT_NORMAL; + map_rev_fixed[2] = VERT_ATTRIB_NORMAL; } - inputs |= VERT_BIT_TEX(i); + map_rev_fixed[8 + i] = VERT_ATTRIB_TEX0 + i; } } + vimap_rev = &map_rev_fixed[0]; } else { - GLuint out_vtxfmt0 = 0; - GLuint out_vtxfmt1 = 0; + /* vtx_tcl_output_vtxfmt_0/1 need to match configuration of "fragment + part", since using some vertex interpolator later which is not in + out_vtxfmt0/1 will lock up. It seems to be ok to write in vertex + prog to a not enabled output however, so just don't mess with it. + We only need to change compsel. */ GLuint out_compsel = 0; GLuint vp_out = rmesa->curr_vp_hw->mesa_program.Base.OutputsWritten; - /* can't handle other inputs, generic attribs etc. currently - should never arrive here */ - assert ((rmesa->curr_vp_hw->mesa_program.Base.InputsRead & - ~(VERT_BIT_POS | VERT_BIT_NORMAL | VERT_BIT_COLOR0 | VERT_BIT_COLOR1 | - VERT_BIT_FOG | VERT_BIT_TEX0 | VERT_BIT_TEX1 | VERT_BIT_TEX2 | - VERT_BIT_TEX3 | VERT_BIT_TEX4 | VERT_BIT_TEX5)) == 0); - inputs |= rmesa->curr_vp_hw->mesa_program.Base.InputsRead; - /* FIXME: this is a mess. Not really sure how to set up TCL_OUTPUT_VTXFMT - in "undefined" cases (e.g. output needed later but not written by vertex program or vice versa) - - however misconfiguration here will almost certainly lock up the chip. - I think at the very least we need to enable tcl outputs which we write to. Maybe even need to - fix up a vertex program so an output needed later always gets written? - For now just set the compsel and output_vtxfmt to the outputs written. - However, for simplicity we assume always all 4 values are written which may not be correct - (but I don't know if it could lead to lockups). */ + + vimap_rev = &rmesa->curr_vp_hw->inputmap_rev[0]; assert(vp_out & (1 << VERT_RESULT_HPOS)); - out_vtxfmt0 = R200_VTX_XY | R200_VTX_Z0 | R200_VTX_W0; - /* FIXME: need to always enable color_0 otherwise doom3's shadow vp (?) will lock up (?) */ - out_vtxfmt0 |= R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT; out_compsel = R200_OUTPUT_XYZW; if (vp_out & (1 << VERT_RESULT_COL0)) { - out_vtxfmt0 |= R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT; out_compsel |= R200_OUTPUT_COLOR_0; } if (vp_out & (1 << VERT_RESULT_COL1)) { - out_vtxfmt0 |= R200_VTX_FP_RGBA << R200_VTX_COLOR_1_SHIFT; out_compsel |= R200_OUTPUT_COLOR_1; } - /* FIXME: probably not everything is set up for fogc and psiz to work correctly */ if (vp_out & (1 << VERT_RESULT_FOGC)) { - out_vtxfmt0 |= R200_VTX_DISCRETE_FOG; out_compsel |= R200_OUTPUT_DISCRETE_FOG; } if (vp_out & (1 << VERT_RESULT_PSIZ)) { - out_vtxfmt0 |= R200_VTX_POINT_SIZE; out_compsel |= R200_OUTPUT_PT_SIZE; } for (i = VERT_RESULT_TEX0; i < VERT_RESULT_TEX6; i++) { if (vp_out & (1 << i)) { - out_vtxfmt1 |= 4 << ((i - VERT_RESULT_TEX0) * 3); out_compsel |= R200_OUTPUT_TEX_0 << (i - VERT_RESULT_TEX0); } } - if ((rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] != out_vtxfmt0) || - (rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_1] != out_vtxfmt1) || - (rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] != out_compsel)) { + if (rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] != out_compsel) { R200_STATECHANGE( rmesa, vtx ); - rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] = out_vtxfmt0; - rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_1] = out_vtxfmt1; rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] = out_compsel; - /* FIXME: should restore this when disabling vertex programs maybe? */ } } /* Do the actual work: */ r200ReleaseArrays( ctx, ~0 /* stage->changed_inputs */ ); - r200EmitArrays( ctx, inputs ); + r200EmitArrays( ctx, vimap_rev ); rmesa->tcl.Elts = VB->Elts; 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; @@ -583,7 +590,7 @@ static void transition_to_hwtnl( GLcontext *ctx ) rmesa->hw.ctx.cmd[CTX_PP_FOG_COLOR] &= ~R200_FOG_USE_MASK; rmesa->hw.ctx.cmd[CTX_PP_FOG_COLOR] |= R200_FOG_USE_VTX_FOG; } - + R200_STATECHANGE( rmesa, vte ); rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL] &= ~(R200_VTX_XY_FMT|R200_VTX_Z_FMT); rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL] |= R200_VTX_W0_FMT; diff --git a/dist/Mesa/src/mesa/drivers/dri/r200/r200_texstate.c b/dist/Mesa/src/mesa/drivers/dri/r200/r200_texstate.c index af5092bb9..d12c3bc66 100644 --- a/dist/Mesa/src/mesa/drivers/dri/r200/r200_texstate.c +++ b/dist/Mesa/src/mesa/drivers/dri/r200/r200_texstate.c @@ -72,7 +72,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define _INVALID(f) \ [ MESA_FORMAT_ ## f ] = { 0xffffffff, 0 } #define VALID_FORMAT(f) ( ((f) <= MESA_FORMAT_RGBA_DXT5) \ - && (tx_table_le[f].format != 0xffffffff) ) + && (tx_table_be[f].format != 0xffffffff) ) struct tx_table { GLuint format, filter; @@ -165,12 +165,15 @@ static void r200SetTexImages( r200ContextPtr rmesa, */ if ( !t->image_override ) { if ( VALID_FORMAT( baseImage->TexFormat->MesaFormat ) ) { + const struct tx_table *table = _mesa_little_endian() ? tx_table_le : + tx_table_be; + t->pp_txformat &= ~(R200_TXFORMAT_FORMAT_MASK | R200_TXFORMAT_ALPHA_IN_MAP); t->pp_txfilter &= ~R200_YUV_TO_RGB; - t->pp_txformat |= tx_table_le[ baseImage->TexFormat->MesaFormat ].format; - t->pp_txfilter |= tx_table_le[ baseImage->TexFormat->MesaFormat ].filter; + t->pp_txformat |= table[ baseImage->TexFormat->MesaFormat ].format; + t->pp_txfilter |= table[ baseImage->TexFormat->MesaFormat ].filter; } else { _mesa_problem(NULL, "unexpected texture format in %s", __FUNCTION__); diff --git a/dist/Mesa/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/dist/Mesa/src/mesa/drivers/dri/r300/r300_cmdbuf.c index ace9b6672..3befa58a3 100644 --- a/dist/Mesa/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/dist/Mesa/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -27,9 +27,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* - * Authors: - * Nicolai Haehnle <prefect_@gmx.net> +/** + * \file + * + * \author Nicolai Haehnle <prefect_@gmx.net> */ #include "glheader.h" @@ -52,15 +53,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_emit.h" #include "r300_state.h" - // Set this to 1 for extremely verbose debugging of command buffers #define DEBUG_CMDBUF 0 - /** * Send the current command buffer via ioctl to the hardware. */ -int r300FlushCmdBufLocked(r300ContextPtr r300, const char* caller) +int r300FlushCmdBufLocked(r300ContextPtr r300, const char *caller) { int ret; int i; @@ -83,22 +82,24 @@ int r300FlushCmdBufLocked(r300ContextPtr r300, const char* caller) r300->cmdbuf.cmd_buf[i]); } - cmd.buf = (char*)(r300->cmdbuf.cmd_buf + start); + cmd.buf = (char *)(r300->cmdbuf.cmd_buf + start); cmd.bufsz = (r300->cmdbuf.count_used - start) * 4; if (r300->radeon.state.scissor.enabled) { cmd.nbox = r300->radeon.state.scissor.numClipRects; - cmd.boxes = (drm_clip_rect_t *)r300->radeon.state.scissor.pClipRects; + cmd.boxes = + (drm_clip_rect_t *) r300->radeon.state.scissor.pClipRects; } else { cmd.nbox = r300->radeon.numClipRects; - cmd.boxes = (drm_clip_rect_t *)r300->radeon.pClipRects; + cmd.boxes = (drm_clip_rect_t *) r300->radeon.pClipRects; } - + ret = drmCommandWrite(r300->radeon.dri.fd, - DRM_RADEON_CMDBUF, &cmd, sizeof(cmd)); - + DRM_RADEON_CMDBUF, &cmd, sizeof(cmd)); + if (RADEON_DEBUG & DEBUG_SYNC) { - fprintf(stderr, "Syncing in %s (from %s)\n\n", __FUNCTION__, caller); + fprintf(stderr, "Syncing in %s (from %s)\n\n", + __FUNCTION__, caller); radeonWaitForIdleLocked(&r300->radeon); } @@ -109,37 +110,36 @@ int r300FlushCmdBufLocked(r300ContextPtr r300, const char* caller) return ret; } - -int r300FlushCmdBuf(r300ContextPtr r300, const char* caller) +int r300FlushCmdBuf(r300ContextPtr r300, const char *caller) { int ret; LOCK_HARDWARE(&r300->radeon); - ret=r300FlushCmdBufLocked(r300, caller); + ret = r300FlushCmdBufLocked(r300, caller); UNLOCK_HARDWARE(&r300->radeon); if (ret) { - fprintf(stderr, "drmRadeonCmdBuffer: %d (exiting)\n", ret); - exit(ret); + fprintf(stderr, "drmRadeonCmdBuffer: %d\n", ret); + _mesa_exit(ret); } return ret; } - -void r300_print_state_atom(r300ContextPtr r300, struct r300_state_atom *state) +static void r300PrintStateAtom(r300ContextPtr r300, struct r300_state_atom *state) { int i; - int dwords = (*state->check)(r300, state); + int dwords = (*state->check) (r300, state); - fprintf(stderr, " emit %s/%d/%d\n", state->name, dwords, state->cmd_size); + fprintf(stderr, " emit %s/%d/%d\n", state->name, dwords, + state->cmd_size); if (RADEON_DEBUG & DEBUG_VERBOSE) for (i = 0; i < dwords; i++) - fprintf(stderr, " %s[%d]: %08X\n", state->name, i, - state->cmd[i]); + fprintf(stderr, " %s[%d]: %08X\n", + state->name, i, state->cmd[i]); } /** @@ -148,22 +148,23 @@ void r300_print_state_atom(r300ContextPtr r300, struct r300_state_atom *state) * The caller must have ensured that there is enough space in the command * buffer. */ -static __inline__ void r300DoEmitState(r300ContextPtr r300, GLboolean dirty) +static __inline__ void r300EmitAtoms(r300ContextPtr r300, GLboolean dirty) { - struct r300_state_atom* atom; - uint32_t* dest; + struct r300_state_atom *atom; + uint32_t *dest; dest = r300->cmdbuf.cmd_buf + r300->cmdbuf.count_used; if (DEBUG_CMDBUF && RADEON_DEBUG & DEBUG_STATE) { foreach(atom, &r300->hw.atomlist) { if ((atom->dirty || r300->hw.all_dirty) == dirty) { - int dwords = (*atom->check)(r300, atom); + int dwords = (*atom->check) (r300, atom); if (dwords) - r300_print_state_atom(r300, atom); + r300PrintStateAtom(r300, atom); else - fprintf(stderr, " skip state %s\n", + fprintf(stderr, + " skip state %s\n", atom->name); } } @@ -171,31 +172,31 @@ static __inline__ void r300DoEmitState(r300ContextPtr r300, GLboolean dirty) /* Emit WAIT */ *dest = cmdwait(R300_WAIT_3D | R300_WAIT_3D_CLEAN); - dest ++; - r300->cmdbuf.count_used ++; + dest++; + r300->cmdbuf.count_used++; + /* Emit cache flush */ *dest = cmdpacket0(R300_TX_CNTL, 1); - dest ++; - r300->cmdbuf.count_used ++; - - *dest = 0x0; - dest ++; - r300->cmdbuf.count_used ++; - + dest++; + r300->cmdbuf.count_used++; + + *dest = R300_TX_FLUSH; + dest++; + r300->cmdbuf.count_used++; + /* Emit END3D */ *dest = cmdpacify(); - dest ++; - r300->cmdbuf.count_used ++; - + dest++; + r300->cmdbuf.count_used++; /* Emit actual atoms */ foreach(atom, &r300->hw.atomlist) { if ((atom->dirty || r300->hw.all_dirty) == dirty) { - int dwords = (*atom->check)(r300, atom); + int dwords = (*atom->check) (r300, atom); if (dwords) { - memcpy(dest, atom->cmd, dwords*4); + memcpy(dest, atom->cmd, dwords * 4); dest += dwords; r300->cmdbuf.count_used += dwords; atom->dirty = GL_FALSE; @@ -215,7 +216,8 @@ void r300EmitState(r300ContextPtr r300) if (RADEON_DEBUG & (DEBUG_STATE | DEBUG_PRIMS)) fprintf(stderr, "%s\n", __FUNCTION__); - if (r300->cmdbuf.count_used && !r300->hw.is_dirty && !r300->hw.all_dirty) + if (r300->cmdbuf.count_used && !r300->hw.is_dirty + && !r300->hw.all_dirty) return; /* To avoid going across the entire set of states multiple times, just check @@ -228,14 +230,14 @@ void r300EmitState(r300ContextPtr r300) if (RADEON_DEBUG & DEBUG_STATE) fprintf(stderr, "Begin reemit state\n"); - r300DoEmitState(r300, GL_FALSE); + r300EmitAtoms(r300, GL_FALSE); r300->cmdbuf.count_reemit = r300->cmdbuf.count_used; } if (RADEON_DEBUG & DEBUG_STATE) fprintf(stderr, "Begin dirty state\n"); - r300DoEmitState(r300, GL_TRUE); + r300EmitAtoms(r300, GL_TRUE); assert(r300->cmdbuf.count_used < r300->cmdbuf.size); @@ -254,25 +256,22 @@ static int check_##NM( r300ContextPtr r300, \ #define packet0_count(ptr) (((drm_r300_cmd_header_t*)(ptr))->packet0.count) #define vpu_count(ptr) (((drm_r300_cmd_header_t*)(ptr))->vpu.count) -CHECK( always, atom->cmd_size ) -CHECK( variable, packet0_count(atom->cmd) ? (1 + packet0_count(atom->cmd)) : 0 ) -CHECK( vpu, vpu_count(atom->cmd) ? (1 + vpu_count(atom->cmd)*4) : 0 ) - +CHECK(always, atom->cmd_size) + CHECK(variable, packet0_count(atom->cmd) ? (1 + packet0_count(atom->cmd)) : 0) + CHECK(vpu, vpu_count(atom->cmd) ? (1 + vpu_count(atom->cmd) * 4) : 0) #undef packet0_count #undef vpu_count - -#define ALLOC_STATE( ATOM, CHK, SZ, NM, IDX ) \ +#define ALLOC_STATE( ATOM, CHK, SZ, IDX ) \ do { \ r300->hw.ATOM.cmd_size = (SZ); \ r300->hw.ATOM.cmd = (uint32_t*)CALLOC((SZ) * sizeof(uint32_t)); \ - r300->hw.ATOM.name = (NM); \ + r300->hw.ATOM.name = #ATOM; \ r300->hw.ATOM.idx = (IDX); \ r300->hw.ATOM.check = check_##CHK; \ r300->hw.ATOM.dirty = GL_FALSE; \ r300->hw.max_state_size += (SZ); \ + insert_at_tail(&r300->hw.atomlist, &r300->hw.ATOM); \ } while (0) - - /** * Allocate memory for the command buffer and initialize the state atom * list. Note that the initial hardware state is set by r300InitState(). @@ -280,292 +279,251 @@ CHECK( vpu, vpu_count(atom->cmd) ? (1 + vpu_count(atom->cmd)*4) : 0 ) void r300InitCmdBuf(r300ContextPtr r300) { int size, mtu; - - r300->hw.max_state_size = 2+2; /* reserve extra space for WAIT_IDLE and tex cache flush */ + int has_tcl = 1; + + if (!(r300->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL)) + has_tcl = 0; + + r300->hw.max_state_size = 2 + 2; /* reserve extra space for WAIT_IDLE and tex cache flush */ mtu = r300->radeon.glCtx->Const.MaxTextureUnits; if (RADEON_DEBUG & DEBUG_TEXTURE) { fprintf(stderr, "Using %d maximum texture units..\n", mtu); } - /* Initialize state atoms */ - ALLOC_STATE( vpt, always, R300_VPT_CMDSIZE, "vpt", 0 ); - r300->hw.vpt.cmd[R300_VPT_CMD_0] = cmdpacket0(R300_SE_VPORT_XSCALE, 6); - ALLOC_STATE( unk2080, always, 2, "unk2080", 0 ); - r300->hw.unk2080.cmd[0] = cmdpacket0(0x2080, 1); - ALLOC_STATE( vte, always, 3, "vte", 0 ); - r300->hw.vte.cmd[0] = cmdpacket0(R300_SE_VTE_CNTL, 2); - ALLOC_STATE( unk2134, always, 3, "unk2134", 0 ); - r300->hw.unk2134.cmd[0] = cmdpacket0(0x2134, 2); - ALLOC_STATE( unk2140, always, 2, "unk2140", 0 ); - r300->hw.unk2140.cmd[0] = cmdpacket0(0x2140, 1); - ALLOC_STATE( vir[0], variable, R300_VIR_CMDSIZE, "vir/0", 0 ); - r300->hw.vir[0].cmd[R300_VIR_CMD_0] = cmdpacket0(R300_VAP_INPUT_ROUTE_0_0, 1); - ALLOC_STATE( vir[1], variable, R300_VIR_CMDSIZE, "vir/1", 1 ); - r300->hw.vir[1].cmd[R300_VIR_CMD_0] = cmdpacket0(R300_VAP_INPUT_ROUTE_1_0, 1); - ALLOC_STATE( vic, always, R300_VIC_CMDSIZE, "vic", 0 ); - r300->hw.vic.cmd[R300_VIC_CMD_0] = cmdpacket0(R300_VAP_INPUT_CNTL_0, 2); - ALLOC_STATE( unk21DC, always, 2, "unk21DC", 0 ); - r300->hw.unk21DC.cmd[0] = cmdpacket0(0x21DC, 1); - ALLOC_STATE( unk221C, always, 2, "unk221C", 0 ); - r300->hw.unk221C.cmd[0] = cmdpacket0(0x221C, 1); - ALLOC_STATE( unk2220, always, 5, "unk2220", 0 ); - r300->hw.unk2220.cmd[0] = cmdpacket0(0x2220, 4); - ALLOC_STATE( unk2288, always, 2, "unk2288", 0 ); - r300->hw.unk2288.cmd[0] = cmdpacket0(0x2288, 1); - ALLOC_STATE( vof, always, R300_VOF_CMDSIZE, "vof", 0 ); - r300->hw.vof.cmd[R300_VOF_CMD_0] = cmdpacket0(R300_VAP_OUTPUT_VTX_FMT_0, 2); - ALLOC_STATE( pvs, always, R300_PVS_CMDSIZE, "pvs", 0 ); - r300->hw.pvs.cmd[R300_PVS_CMD_0] = cmdpacket0(R300_VAP_PVS_CNTL_1, 3); - ALLOC_STATE( gb_enable, always, 2, "gb_enable", 0 ); - r300->hw.gb_enable.cmd[0] = cmdpacket0(R300_GB_ENABLE, 1); - ALLOC_STATE( gb_misc, always, R300_GB_MISC_CMDSIZE, "gb_misc", 0 ); - r300->hw.gb_misc.cmd[0] = cmdpacket0(R300_GB_MSPOS0, 5); - ALLOC_STATE( txe, always, R300_TXE_CMDSIZE, "txe", 0 ); - r300->hw.txe.cmd[R300_TXE_CMD_0] = cmdpacket0(R300_TX_ENABLE, 1); - ALLOC_STATE( unk4200, always, 5, "unk4200", 0 ); - r300->hw.unk4200.cmd[0] = cmdpacket0(0x4200, 4); - ALLOC_STATE( unk4214, always, 2, "unk4214", 0 ); - r300->hw.unk4214.cmd[0] = cmdpacket0(0x4214, 1); - ALLOC_STATE( ps, always, R300_PS_CMDSIZE, "ps", 0 ); - r300->hw.ps.cmd[0] = cmdpacket0(R300_RE_POINTSIZE, 1); - ALLOC_STATE( unk4230, always, 4, "unk4230", 0 ); - r300->hw.unk4230.cmd[0] = cmdpacket0(0x4230, 3); - ALLOC_STATE( lcntl, always, 2, "lcntl", 0 ); - r300->hw.lcntl.cmd[0] = cmdpacket0(R300_RE_LINE_CNT, 1); - ALLOC_STATE( unk4260, always, 4, "unk4260", 0 ); - r300->hw.unk4260.cmd[0] = cmdpacket0(0x4260, 3); - ALLOC_STATE( unk4274, always, 5, "unk4274", 0 ); - r300->hw.unk4274.cmd[0] = cmdpacket0(0x4274, 4); - ALLOC_STATE( unk4288, always, 4, "unk4288", 0 ); - r300->hw.unk4288.cmd[0] = cmdpacket0(0x4288, 3); - ALLOC_STATE( fogp, always, 3, "fogp", 0 ); - r300->hw.fogp.cmd[0] = cmdpacket0(R300_RE_FOG_SCALE, 2); - ALLOC_STATE( unk42A0, always, 2, "unk42A0", 0 ); - r300->hw.unk42A0.cmd[0] = cmdpacket0(0x42A0, 1); - ALLOC_STATE( zbs, always, R300_ZBS_CMDSIZE, "zbs", 0 ); - r300->hw.zbs.cmd[R300_ZBS_CMD_0] = cmdpacket0(R300_RE_ZBIAS_T_FACTOR, 4); - ALLOC_STATE( unk42B4, always, 2, "unk42B4", 0 ); - r300->hw.unk42B4.cmd[0] = cmdpacket0(0x42B4, 1); - ALLOC_STATE( cul, always, R300_CUL_CMDSIZE, "cul", 0 ); - r300->hw.cul.cmd[R300_CUL_CMD_0] = cmdpacket0(R300_RE_CULL_CNTL, 1); - ALLOC_STATE( unk42C0, always, 3, "unk42C0", 0 ); - r300->hw.unk42C0.cmd[0] = cmdpacket0(0x42C0, 2); - ALLOC_STATE( rc, always, R300_RC_CMDSIZE, "rc", 0 ); - r300->hw.rc.cmd[R300_RC_CMD_0] = cmdpacket0(R300_RS_CNTL_0, 2); - ALLOC_STATE( ri, always, R300_RI_CMDSIZE, "ri", 0 ); - r300->hw.ri.cmd[R300_RI_CMD_0] = cmdpacket0(R300_RS_INTERP_0, 8); - ALLOC_STATE( rr, variable, R300_RR_CMDSIZE, "rr", 0 ); - r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(R300_RS_ROUTE_0, 1); - ALLOC_STATE( unk43A4, always, 3, "unk43A4", 0 ); - r300->hw.unk43A4.cmd[0] = cmdpacket0(0x43A4, 2); - ALLOC_STATE( unk43E8, always, 2, "unk43E8", 0 ); - r300->hw.unk43E8.cmd[0] = cmdpacket0(0x43E8, 1); - ALLOC_STATE( fp, always, R300_FP_CMDSIZE, "fp", 0 ); - r300->hw.fp.cmd[R300_FP_CMD_0] = cmdpacket0(R300_PFS_CNTL_0, 3); - r300->hw.fp.cmd[R300_FP_CMD_1] = cmdpacket0(R300_PFS_NODE_0, 4); - ALLOC_STATE( fpt, variable, R300_FPT_CMDSIZE, "fpt", 0 ); - r300->hw.fpt.cmd[R300_FPT_CMD_0] = cmdpacket0(R300_PFS_TEXI_0, 0); - ALLOC_STATE( unk46A4, always, 6, "unk46A4", 0 ); - r300->hw.unk46A4.cmd[0] = cmdpacket0(0x46A4, 5); - ALLOC_STATE( fpi[0], variable, R300_FPI_CMDSIZE, "fpi/0", 0 ); - r300->hw.fpi[0].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR0_0, 1); - ALLOC_STATE( fpi[1], variable, R300_FPI_CMDSIZE, "fpi/1", 1 ); - r300->hw.fpi[1].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR1_0, 1); - ALLOC_STATE( fpi[2], variable, R300_FPI_CMDSIZE, "fpi/2", 2 ); - r300->hw.fpi[2].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR2_0, 1); - ALLOC_STATE( fpi[3], variable, R300_FPI_CMDSIZE, "fpi/3", 3 ); - r300->hw.fpi[3].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR3_0, 1); - ALLOC_STATE( fogs, always, R300_FOGS_CMDSIZE, "fogs", 0 ); - r300->hw.fogs.cmd[R300_FOGS_CMD_0] = cmdpacket0(R300_RE_FOG_STATE, 1); - ALLOC_STATE( fogc, always, R300_FOGC_CMDSIZE, "fogc", 0 ); - r300->hw.fogc.cmd[R300_FOGC_CMD_0] = cmdpacket0(R300_FOG_COLOR_R, 3); - ALLOC_STATE( at, always, R300_AT_CMDSIZE, "at", 0 ); - r300->hw.at.cmd[R300_AT_CMD_0] = cmdpacket0(R300_PP_ALPHA_TEST, 2); - ALLOC_STATE( unk4BD8, always, 2, "unk4BD8", 0 ); - r300->hw.unk4BD8.cmd[0] = cmdpacket0(0x4BD8, 1); - ALLOC_STATE( fpp, variable, R300_FPP_CMDSIZE, "fpp", 0 ); - r300->hw.fpp.cmd[R300_FPP_CMD_0] = cmdpacket0(R300_PFS_PARAM_0_X, 0); - ALLOC_STATE( unk4E00, always, 2, "unk4E00", 0 ); - r300->hw.unk4E00.cmd[0] = cmdpacket0(0x4E00, 1); - ALLOC_STATE( bld, always, R300_BLD_CMDSIZE, "bld", 0 ); - r300->hw.bld.cmd[R300_BLD_CMD_0] = cmdpacket0(R300_RB3D_CBLEND, 2); - ALLOC_STATE( cmk, always, R300_CMK_CMDSIZE, "cmk", 0 ); - r300->hw.cmk.cmd[R300_CMK_CMD_0] = cmdpacket0(R300_RB3D_COLORMASK, 1); - ALLOC_STATE( unk4E10, always, 4, "unk4E10", 0 ); - r300->hw.unk4E10.cmd[0] = cmdpacket0(0x4E10, 3); - ALLOC_STATE( cb, always, R300_CB_CMDSIZE, "cb", 0 ); - r300->hw.cb.cmd[R300_CB_CMD_0] = cmdpacket0(R300_RB3D_COLOROFFSET0, 1); - r300->hw.cb.cmd[R300_CB_CMD_1] = cmdpacket0(R300_RB3D_COLORPITCH0, 1); - ALLOC_STATE( unk4E50, always, 10, "unk4E50", 0 ); - r300->hw.unk4E50.cmd[0] = cmdpacket0(0x4E50, 9); - ALLOC_STATE( unk4E88, always, 2, "unk4E88", 0 ); - r300->hw.unk4E88.cmd[0] = cmdpacket0(0x4E88, 1); - ALLOC_STATE( unk4EA0, always, 3, "unk4EA0 R350 only", 0 ); - r300->hw.unk4EA0.cmd[0] = cmdpacket0(0x4EA0, 2); - ALLOC_STATE( zs, always, R300_ZS_CMDSIZE, "zstencil", 0 ); - r300->hw.zs.cmd[R300_ZS_CMD_0] = cmdpacket0(R300_RB3D_ZSTENCIL_CNTL_0, 3); - ALLOC_STATE( unk4F10, always, 5, "unk4F10", 0 ); - r300->hw.unk4F10.cmd[0] = cmdpacket0(0x4F10, 4); - ALLOC_STATE( zb, always, R300_ZB_CMDSIZE, "zb", 0 ); - r300->hw.zb.cmd[R300_ZB_CMD_0] = cmdpacket0(R300_RB3D_DEPTHOFFSET, 2); - ALLOC_STATE( unk4F28, always, 2, "unk4F28", 0 ); - r300->hw.unk4F28.cmd[0] = cmdpacket0(0x4F28, 1); - ALLOC_STATE( unk4F30, always, 3, "unk4F30", 0 ); - r300->hw.unk4F30.cmd[0] = cmdpacket0(0x4F30, 2); - ALLOC_STATE( unk4F44, always, 2, "unk4F44", 0 ); - r300->hw.unk4F44.cmd[0] = cmdpacket0(0x4F44, 1); - ALLOC_STATE( unk4F54, always, 2, "unk4F54", 0 ); - r300->hw.unk4F54.cmd[0] = cmdpacket0(0x4F54, 1); - - ALLOC_STATE( vpi, vpu, R300_VPI_CMDSIZE, "vpi", 0 ); - r300->hw.vpi.cmd[R300_VPI_CMD_0] = cmdvpu(R300_PVS_UPLOAD_PROGRAM, 0); - ALLOC_STATE( vpp, vpu, R300_VPP_CMDSIZE, "vpp", 0 ); - r300->hw.vpp.cmd[R300_VPP_CMD_0] = cmdvpu(R300_PVS_UPLOAD_PARAMETERS, 0); - ALLOC_STATE( vps, vpu, R300_VPS_CMDSIZE, "vps", 0 ); - r300->hw.vps.cmd[R300_VPS_CMD_0] = cmdvpu(R300_PVS_UPLOAD_POINTSIZE, 1); - - /* Textures */ - ALLOC_STATE( tex.filter, variable, mtu+1, "tex_filter", 0 ); - r300->hw.tex.filter.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_FILTER_0, 0); + /* Setup the atom linked list */ + make_empty_list(&r300->hw.atomlist); + r300->hw.atomlist.name = "atom-list"; - ALLOC_STATE( tex.unknown1, variable, mtu+1, "tex_unknown1", 0 ); - r300->hw.tex.unknown1.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_FILTER1_0, 0); + /* Initialize state atoms */ + ALLOC_STATE(vpt, always, R300_VPT_CMDSIZE, 0); + r300->hw.vpt.cmd[R300_VPT_CMD_0] = cmdpacket0(R300_SE_VPORT_XSCALE, 6); + ALLOC_STATE(vap_cntl, always, 2, 0); + r300->hw.vap_cntl.cmd[0] = cmdpacket0(R300_VAP_CNTL, 1); + ALLOC_STATE(vte, always, 3, 0); + r300->hw.vte.cmd[0] = cmdpacket0(R300_SE_VTE_CNTL, 2); + ALLOC_STATE(unk2134, always, 3, 0); + r300->hw.unk2134.cmd[0] = cmdpacket0(0x2134, 2); + ALLOC_STATE(vap_cntl_status, always, 2, 0); + r300->hw.vap_cntl_status.cmd[0] = cmdpacket0(R300_VAP_CNTL_STATUS, 1); + ALLOC_STATE(vir[0], variable, R300_VIR_CMDSIZE, 0); + r300->hw.vir[0].cmd[R300_VIR_CMD_0] = + cmdpacket0(R300_VAP_INPUT_ROUTE_0_0, 1); + ALLOC_STATE(vir[1], variable, R300_VIR_CMDSIZE, 1); + r300->hw.vir[1].cmd[R300_VIR_CMD_0] = + cmdpacket0(R300_VAP_INPUT_ROUTE_1_0, 1); + ALLOC_STATE(vic, always, R300_VIC_CMDSIZE, 0); + r300->hw.vic.cmd[R300_VIC_CMD_0] = cmdpacket0(R300_VAP_INPUT_CNTL_0, 2); + ALLOC_STATE(unk21DC, always, 2, 0); + r300->hw.unk21DC.cmd[0] = cmdpacket0(0x21DC, 1); + ALLOC_STATE(vap_clip_cntl, always, 2, 0); + r300->hw.vap_clip_cntl.cmd[0] = cmdpacket0(R300_VAP_CLIP_CNTL, 1); + ALLOC_STATE(unk2220, always, 5, 0); + r300->hw.unk2220.cmd[0] = cmdpacket0(0x2220, 4); + ALLOC_STATE(unk2288, always, 2, 0); + r300->hw.unk2288.cmd[0] = cmdpacket0(R300_VAP_UNKNOWN_2288, 1); + ALLOC_STATE(vof, always, R300_VOF_CMDSIZE, 0); + r300->hw.vof.cmd[R300_VOF_CMD_0] = + cmdpacket0(R300_VAP_OUTPUT_VTX_FMT_0, 2); + + if (has_tcl) { + ALLOC_STATE(pvs, always, R300_PVS_CMDSIZE, 0); + r300->hw.pvs.cmd[R300_PVS_CMD_0] = + cmdpacket0(R300_VAP_PVS_CNTL_1, 3); + } - ALLOC_STATE( tex.size, variable, mtu+1, "tex_size", 0 ); - r300->hw.tex.size.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_SIZE_0, 0); + ALLOC_STATE(gb_enable, always, 2, 0); + r300->hw.gb_enable.cmd[0] = cmdpacket0(R300_GB_ENABLE, 1); + ALLOC_STATE(gb_misc, always, R300_GB_MISC_CMDSIZE, 0); + r300->hw.gb_misc.cmd[0] = cmdpacket0(R300_GB_MSPOS0, 5); + ALLOC_STATE(txe, always, R300_TXE_CMDSIZE, 0); + r300->hw.txe.cmd[R300_TXE_CMD_0] = cmdpacket0(R300_TX_ENABLE, 1); + ALLOC_STATE(unk4200, always, 5, 0); + r300->hw.unk4200.cmd[0] = cmdpacket0(0x4200, 4); + ALLOC_STATE(unk4214, always, 2, 0); + r300->hw.unk4214.cmd[0] = cmdpacket0(0x4214, 1); + ALLOC_STATE(ps, always, R300_PS_CMDSIZE, 0); + r300->hw.ps.cmd[0] = cmdpacket0(R300_RE_POINTSIZE, 1); + ALLOC_STATE(unk4230, always, 4, 0); + r300->hw.unk4230.cmd[0] = cmdpacket0(0x4230, 3); + ALLOC_STATE(lcntl, always, 2, 0); + r300->hw.lcntl.cmd[0] = cmdpacket0(R300_RE_LINE_CNT, 1); + ALLOC_STATE(unk4260, always, 4, 0); + r300->hw.unk4260.cmd[0] = cmdpacket0(0x4260, 3); + ALLOC_STATE(shade, always, 5, 0); + r300->hw.shade.cmd[0] = cmdpacket0(R300_RE_SHADE, 4); + ALLOC_STATE(polygon_mode, always, 4, 0); + r300->hw.polygon_mode.cmd[0] = cmdpacket0(R300_RE_POLYGON_MODE, 3); + ALLOC_STATE(fogp, always, 3, 0); + r300->hw.fogp.cmd[0] = cmdpacket0(R300_RE_FOG_SCALE, 2); + ALLOC_STATE(zbias_cntl, always, 2, 0); + r300->hw.zbias_cntl.cmd[0] = cmdpacket0(R300_RE_ZBIAS_CNTL, 1); + ALLOC_STATE(zbs, always, R300_ZBS_CMDSIZE, 0); + r300->hw.zbs.cmd[R300_ZBS_CMD_0] = + cmdpacket0(R300_RE_ZBIAS_T_FACTOR, 4); + ALLOC_STATE(occlusion_cntl, always, 2, 0); + r300->hw.occlusion_cntl.cmd[0] = cmdpacket0(R300_RE_OCCLUSION_CNTL, 1); + ALLOC_STATE(cul, always, R300_CUL_CMDSIZE, 0); + r300->hw.cul.cmd[R300_CUL_CMD_0] = cmdpacket0(R300_RE_CULL_CNTL, 1); + ALLOC_STATE(unk42C0, always, 3, 0); + r300->hw.unk42C0.cmd[0] = cmdpacket0(0x42C0, 2); + ALLOC_STATE(rc, always, R300_RC_CMDSIZE, 0); + r300->hw.rc.cmd[R300_RC_CMD_0] = cmdpacket0(R300_RS_CNTL_0, 2); + ALLOC_STATE(ri, always, R300_RI_CMDSIZE, 0); + r300->hw.ri.cmd[R300_RI_CMD_0] = cmdpacket0(R300_RS_INTERP_0, 8); + ALLOC_STATE(rr, variable, R300_RR_CMDSIZE, 0); + r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(R300_RS_ROUTE_0, 1); + ALLOC_STATE(unk43A4, always, 3, 0); + r300->hw.unk43A4.cmd[0] = cmdpacket0(0x43A4, 2); + ALLOC_STATE(unk43E8, always, 2, 0); + r300->hw.unk43E8.cmd[0] = cmdpacket0(0x43E8, 1); + ALLOC_STATE(fp, always, R300_FP_CMDSIZE, 0); + r300->hw.fp.cmd[R300_FP_CMD_0] = cmdpacket0(R300_PFS_CNTL_0, 3); + r300->hw.fp.cmd[R300_FP_CMD_1] = cmdpacket0(R300_PFS_NODE_0, 4); + ALLOC_STATE(fpt, variable, R300_FPT_CMDSIZE, 0); + r300->hw.fpt.cmd[R300_FPT_CMD_0] = cmdpacket0(R300_PFS_TEXI_0, 0); + ALLOC_STATE(unk46A4, always, 6, 0); + r300->hw.unk46A4.cmd[0] = cmdpacket0(0x46A4, 5); + ALLOC_STATE(fpi[0], variable, R300_FPI_CMDSIZE, 0); + r300->hw.fpi[0].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR0_0, 1); + ALLOC_STATE(fpi[1], variable, R300_FPI_CMDSIZE, 1); + r300->hw.fpi[1].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR1_0, 1); + ALLOC_STATE(fpi[2], variable, R300_FPI_CMDSIZE, 2); + r300->hw.fpi[2].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR2_0, 1); + ALLOC_STATE(fpi[3], variable, R300_FPI_CMDSIZE, 3); + r300->hw.fpi[3].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR3_0, 1); + ALLOC_STATE(fogs, always, R300_FOGS_CMDSIZE, 0); + r300->hw.fogs.cmd[R300_FOGS_CMD_0] = cmdpacket0(R300_RE_FOG_STATE, 1); + ALLOC_STATE(fogc, always, R300_FOGC_CMDSIZE, 0); + r300->hw.fogc.cmd[R300_FOGC_CMD_0] = cmdpacket0(R300_FOG_COLOR_R, 3); + ALLOC_STATE(at, always, R300_AT_CMDSIZE, 0); + r300->hw.at.cmd[R300_AT_CMD_0] = cmdpacket0(R300_PP_ALPHA_TEST, 2); + ALLOC_STATE(unk4BD8, always, 2, 0); + r300->hw.unk4BD8.cmd[0] = cmdpacket0(0x4BD8, 1); + ALLOC_STATE(fpp, variable, R300_FPP_CMDSIZE, 0); + r300->hw.fpp.cmd[R300_FPP_CMD_0] = cmdpacket0(R300_PFS_PARAM_0_X, 0); + ALLOC_STATE(unk4E00, always, 2, 0); + r300->hw.unk4E00.cmd[0] = cmdpacket0(0x4E00, 1); + ALLOC_STATE(bld, always, R300_BLD_CMDSIZE, 0); + r300->hw.bld.cmd[R300_BLD_CMD_0] = cmdpacket0(R300_RB3D_CBLEND, 2); + ALLOC_STATE(cmk, always, R300_CMK_CMDSIZE, 0); + r300->hw.cmk.cmd[R300_CMK_CMD_0] = cmdpacket0(R300_RB3D_COLORMASK, 1); + ALLOC_STATE(blend_color, always, 4, 0); + r300->hw.blend_color.cmd[0] = cmdpacket0(R300_RB3D_BLEND_COLOR, 3); + ALLOC_STATE(cb, always, R300_CB_CMDSIZE, 0); + r300->hw.cb.cmd[R300_CB_CMD_0] = cmdpacket0(R300_RB3D_COLOROFFSET0, 1); + r300->hw.cb.cmd[R300_CB_CMD_1] = cmdpacket0(R300_RB3D_COLORPITCH0, 1); + ALLOC_STATE(unk4E50, always, 10, 0); + r300->hw.unk4E50.cmd[0] = cmdpacket0(0x4E50, 9); + ALLOC_STATE(unk4E88, always, 2, 0); + r300->hw.unk4E88.cmd[0] = cmdpacket0(0x4E88, 1); + ALLOC_STATE(unk4EA0, always, 3, 0); + r300->hw.unk4EA0.cmd[0] = cmdpacket0(0x4EA0, 2); + ALLOC_STATE(zs, always, R300_ZS_CMDSIZE, 0); + r300->hw.zs.cmd[R300_ZS_CMD_0] = + cmdpacket0(R300_RB3D_ZSTENCIL_CNTL_0, 3); + ALLOC_STATE(zstencil_format, always, 5, 0); + r300->hw.zstencil_format.cmd[0] = + cmdpacket0(R300_RB3D_ZSTENCIL_FORMAT, 4); + ALLOC_STATE(zb, always, R300_ZB_CMDSIZE, 0); + r300->hw.zb.cmd[R300_ZB_CMD_0] = cmdpacket0(R300_RB3D_DEPTHOFFSET, 2); + ALLOC_STATE(unk4F28, always, 2, 0); + r300->hw.unk4F28.cmd[0] = cmdpacket0(0x4F28, 1); + ALLOC_STATE(unk4F30, always, 3, 0); + r300->hw.unk4F30.cmd[0] = cmdpacket0(0x4F30, 2); + ALLOC_STATE(unk4F44, always, 2, 0); + r300->hw.unk4F44.cmd[0] = cmdpacket0(0x4F44, 1); + ALLOC_STATE(unk4F54, always, 2, 0); + r300->hw.unk4F54.cmd[0] = cmdpacket0(0x4F54, 1); + + /* VPU only on TCL */ + if (has_tcl) { + int i; + ALLOC_STATE(vpi, vpu, R300_VPI_CMDSIZE, 0); + r300->hw.vpi.cmd[R300_VPI_CMD_0] = + cmdvpu(R300_PVS_UPLOAD_PROGRAM, 0); + + ALLOC_STATE(vpp, vpu, R300_VPP_CMDSIZE, 0); + r300->hw.vpp.cmd[R300_VPP_CMD_0] = + cmdvpu(R300_PVS_UPLOAD_PARAMETERS, 0); + + ALLOC_STATE(vps, vpu, R300_VPS_CMDSIZE, 0); + r300->hw.vps.cmd[R300_VPS_CMD_0] = + cmdvpu(R300_PVS_UPLOAD_POINTSIZE, 1); + + for (i = 0; i < 6; i++) { + ALLOC_STATE(vpucp[i], vpu, R300_VPUCP_CMDSIZE, 0); + r300->hw.vpucp[i].cmd[R300_VPUCP_CMD_0] = + cmdvpu(R300_PVS_UPLOAD_CLIP_PLANE0+i, 1); + } + } - ALLOC_STATE( tex.format, variable, mtu+1, "tex_format", 0 ); - r300->hw.tex.format.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_FORMAT_0, 0); + /* Textures */ + ALLOC_STATE(tex.filter, variable, mtu + 1, 0); + r300->hw.tex.filter.cmd[R300_TEX_CMD_0] = + cmdpacket0(R300_TX_FILTER_0, 0); - ALLOC_STATE( tex.pitch, variable, mtu+1, "tex_pitch", 0 ); - r300->hw.tex.pitch.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_PITCH_0, 0); + ALLOC_STATE(tex.filter_1, variable, mtu + 1, 0); + r300->hw.tex.filter_1.cmd[R300_TEX_CMD_0] = + cmdpacket0(R300_TX_FILTER1_0, 0); - ALLOC_STATE( tex.offset, variable, mtu+1, "tex_offset", 0 ); - r300->hw.tex.offset.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_OFFSET_0, 0); + ALLOC_STATE(tex.size, variable, mtu + 1, 0); + r300->hw.tex.size.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_SIZE_0, 0); - ALLOC_STATE( tex.unknown4, variable, mtu+1, "tex_unknown4", 0 ); - r300->hw.tex.unknown4.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_CHROMA_KEY_0, 0); + ALLOC_STATE(tex.format, variable, mtu + 1, 0); + r300->hw.tex.format.cmd[R300_TEX_CMD_0] = + cmdpacket0(R300_TX_FORMAT_0, 0); - ALLOC_STATE( tex.border_color, variable, mtu+1, "tex_border_color", 0 ); - r300->hw.tex.border_color.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_BORDER_COLOR_0, 0); + ALLOC_STATE(tex.pitch, variable, mtu + 1, 0); + r300->hw.tex.pitch.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_PITCH_0, 0); + ALLOC_STATE(tex.offset, variable, mtu + 1, 0); + r300->hw.tex.offset.cmd[R300_TEX_CMD_0] = + cmdpacket0(R300_TX_OFFSET_0, 0); - /* Setup the atom linked list */ - make_empty_list(&r300->hw.atomlist); - r300->hw.atomlist.name = "atom-list"; + ALLOC_STATE(tex.chroma_key, variable, mtu + 1, 0); + r300->hw.tex.chroma_key.cmd[R300_TEX_CMD_0] = + cmdpacket0(R300_TX_CHROMA_KEY_0, 0); - insert_at_tail(&r300->hw.atomlist, &r300->hw.vpt); - insert_at_tail(&r300->hw.atomlist, &r300->hw.unk2080); - insert_at_tail(&r300->hw.atomlist, &r300->hw.vte); - insert_at_tail(&r300->hw.atomlist, &r300->hw.unk2134); - insert_at_tail(&r300->hw.atomlist, &r300->hw.unk2140); - insert_at_tail(&r300->hw.atomlist, &r300->hw.vir[0]); - insert_at_tail(&r300->hw.atomlist, &r300->hw.vir[1]); - insert_at_tail(&r300->hw.atomlist, &r300->hw.vic); - insert_at_tail(&r300->hw.atomlist, &r300->hw.unk21DC); - insert_at_tail(&r300->hw.atomlist, &r300->hw.unk221C); - insert_at_tail(&r300->hw.atomlist, &r300->hw.unk2220); - insert_at_tail(&r300->hw.atomlist, &r300->hw.unk2288); - insert_at_tail(&r300->hw.atomlist, &r300->hw.vof); - insert_at_tail(&r300->hw.atomlist, &r300->hw.pvs); - insert_at_tail(&r300->hw.atomlist, &r300->hw.gb_enable); - insert_at_tail(&r300->hw.atomlist, &r300->hw.gb_misc); - insert_at_tail(&r300->hw.atomlist, &r300->hw.txe); - insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4200); - insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4214); - insert_at_tail(&r300->hw.atomlist, &r300->hw.ps); - insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4230); - insert_at_tail(&r300->hw.atomlist, &r300->hw.lcntl); - insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4260); - insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4274); - insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4288); - insert_at_tail(&r300->hw.atomlist, &r300->hw.fogp); - insert_at_tail(&r300->hw.atomlist, &r300->hw.unk42A0); - insert_at_tail(&r300->hw.atomlist, &r300->hw.zbs); - insert_at_tail(&r300->hw.atomlist, &r300->hw.unk42B4); - insert_at_tail(&r300->hw.atomlist, &r300->hw.cul); - insert_at_tail(&r300->hw.atomlist, &r300->hw.unk42C0); - insert_at_tail(&r300->hw.atomlist, &r300->hw.rc); - insert_at_tail(&r300->hw.atomlist, &r300->hw.ri); - insert_at_tail(&r300->hw.atomlist, &r300->hw.rr); - insert_at_tail(&r300->hw.atomlist, &r300->hw.unk43A4); - insert_at_tail(&r300->hw.atomlist, &r300->hw.unk43E8); - insert_at_tail(&r300->hw.atomlist, &r300->hw.fp); - insert_at_tail(&r300->hw.atomlist, &r300->hw.fpt); - insert_at_tail(&r300->hw.atomlist, &r300->hw.unk46A4); - insert_at_tail(&r300->hw.atomlist, &r300->hw.fpi[0]); - insert_at_tail(&r300->hw.atomlist, &r300->hw.fpi[1]); - insert_at_tail(&r300->hw.atomlist, &r300->hw.fpi[2]); - insert_at_tail(&r300->hw.atomlist, &r300->hw.fpi[3]); - insert_at_tail(&r300->hw.atomlist, &r300->hw.fogs); - insert_at_tail(&r300->hw.atomlist, &r300->hw.fogc); - insert_at_tail(&r300->hw.atomlist, &r300->hw.at); - insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4BD8); - insert_at_tail(&r300->hw.atomlist, &r300->hw.fpp); - insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4E00); - insert_at_tail(&r300->hw.atomlist, &r300->hw.bld); - insert_at_tail(&r300->hw.atomlist, &r300->hw.cmk); - insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4E10); - insert_at_tail(&r300->hw.atomlist, &r300->hw.cb); - insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4E50); - insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4E88); - insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4EA0); - insert_at_tail(&r300->hw.atomlist, &r300->hw.zs); - insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4F10); - insert_at_tail(&r300->hw.atomlist, &r300->hw.zb); - insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4F28); - insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4F30); - insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4F44); - insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4F54); - - insert_at_tail(&r300->hw.atomlist, &r300->hw.vpi); - insert_at_tail(&r300->hw.atomlist, &r300->hw.vpp); - insert_at_tail(&r300->hw.atomlist, &r300->hw.vps); - - insert_at_tail(&r300->hw.atomlist, &r300->hw.tex.filter); - insert_at_tail(&r300->hw.atomlist, &r300->hw.tex.unknown1); - insert_at_tail(&r300->hw.atomlist, &r300->hw.tex.size); - insert_at_tail(&r300->hw.atomlist, &r300->hw.tex.format); - insert_at_tail(&r300->hw.atomlist, &r300->hw.tex.pitch); - insert_at_tail(&r300->hw.atomlist, &r300->hw.tex.offset); - insert_at_tail(&r300->hw.atomlist, &r300->hw.tex.unknown4); - insert_at_tail(&r300->hw.atomlist, &r300->hw.tex.border_color); + ALLOC_STATE(tex.border_color, variable, mtu + 1, 0); + r300->hw.tex.border_color.cmd[R300_TEX_CMD_0] = + cmdpacket0(R300_TX_BORDER_COLOR_0, 0); r300->hw.is_dirty = GL_TRUE; r300->hw.all_dirty = GL_TRUE; /* Initialize command buffer */ - size = 256 * driQueryOptioni(&r300->radeon.optionCache, "command_buffer_size"); - if (size < 2*r300->hw.max_state_size) { - size = 2*r300->hw.max_state_size+65535; + size = + 256 * driQueryOptioni(&r300->radeon.optionCache, + "command_buffer_size"); + if (size < 2 * r300->hw.max_state_size) { + size = 2 * r300->hw.max_state_size + 65535; } - if (size > 64*256) - size = 64*256; + if (size > 64 * 256) + size = 64 * 256; - if (RADEON_DEBUG & (DEBUG_IOCTL|DEBUG_DMA)) { - fprintf(stderr, "sizeof(drm_r300_cmd_header_t)=%u\n", + if (RADEON_DEBUG & (DEBUG_IOCTL | DEBUG_DMA)) { + fprintf(stderr, "sizeof(drm_r300_cmd_header_t)=%zd\n", sizeof(drm_r300_cmd_header_t)); - fprintf(stderr, "sizeof(drm_radeon_cmd_buffer_t)=%u\n", + fprintf(stderr, "sizeof(drm_radeon_cmd_buffer_t)=%zd\n", sizeof(drm_radeon_cmd_buffer_t)); fprintf(stderr, "Allocating %d bytes command buffer (max state is %d bytes)\n", - size*4, r300->hw.max_state_size*4); + size * 4, r300->hw.max_state_size * 4); } r300->cmdbuf.size = size; - r300->cmdbuf.cmd_buf = (uint32_t*)CALLOC(size*4); + r300->cmdbuf.cmd_buf = (uint32_t *) CALLOC(size * 4); r300->cmdbuf.count_used = 0; r300->cmdbuf.count_reemit = 0; } - /** * Destroy the command buffer and state atoms. */ void r300DestroyCmdBuf(r300ContextPtr r300) { - struct r300_state_atom* atom; + struct r300_state_atom *atom; FREE(r300->cmdbuf.cmd_buf); @@ -598,8 +556,7 @@ void r300EmitBlit(r300ContextPtr rmesa, assert(w < (1 << 16)); assert(h < (1 << 16)); - cmd = (drm_r300_cmd_header_t *) r300AllocCmdBuf(rmesa, 8, - __FUNCTION__); + cmd = (drm_r300_cmd_header_t *) r300AllocCmdBuf(rmesa, 8, __FUNCTION__); cmd[0].header.cmd_type = R300_CMD_PACKET3; cmd[0].header.pad0 = R300_CMD_PACKET3_RAW; @@ -626,44 +583,8 @@ void r300EmitWait(r300ContextPtr rmesa, GLuint flags) assert(!(flags & ~(R300_WAIT_2D | R300_WAIT_3D))); - cmd = (drm_r300_cmd_header_t *) r300AllocCmdBuf(rmesa, 1, - __FUNCTION__); + cmd = (drm_r300_cmd_header_t *) r300AllocCmdBuf(rmesa, 1, __FUNCTION__); cmd[0].u = 0; cmd[0].wait.cmd_type = R300_CMD_WAIT; cmd[0].wait.flags = flags; } - -void r300EmitAOS(r300ContextPtr rmesa, GLuint nr, GLuint offset) -{ - int sz = 1 + (nr >> 1) * 3 + (nr & 1) * 2; - int i; - int cmd_reserved = 0; - int cmd_written = 0; - drm_radeon_cmd_header_t *cmd = NULL; - - if (RADEON_DEBUG & DEBUG_VERTS) - fprintf(stderr, "%s: nr=%d, ofs=0x%08x\n", __func__, nr, offset); - - start_packet3(RADEON_CP_PACKET3_3D_LOAD_VBPNTR, sz-1); - e32(nr); - for(i=0;i+1<nr;i+=2){ - e32( (rmesa->state.aos[i].aos_size << 0) - |(rmesa->state.aos[i].aos_stride << 8) - |(rmesa->state.aos[i+1].aos_size << 16) - |(rmesa->state.aos[i+1].aos_stride << 24) - ); - e32(rmesa->state.aos[i].aos_offset + - offset*4*rmesa->state.aos[i].aos_stride); - e32(rmesa->state.aos[i+1].aos_offset + - offset*4*rmesa->state.aos[i+1].aos_stride); - } - - if(nr & 1){ - e32( (rmesa->state.aos[nr-1].aos_size << 0) - |(rmesa->state.aos[nr-1].aos_stride << 8) - ); - e32(rmesa->state.aos[nr-1].aos_offset + - offset*4*rmesa->state.aos[nr-1].aos_stride); - } -} - diff --git a/dist/Mesa/src/mesa/drivers/dri/r300/r300_context.h b/dist/Mesa/src/mesa/drivers/dri/r300/r300_context.h index df73cdedc..6b0a5887d 100644 --- a/dist/Mesa/src/mesa/drivers/dri/r300/r300_context.h +++ b/dist/Mesa/src/mesa/drivers/dri/r300/r300_context.h @@ -27,10 +27,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* - * Authors: - * Keith Whitwell <keith@tungstengraphics.com> - * Nicolai Haehnle <prefect_@gmx.net> +/** + * \file + * + * \author Keith Whitwell <keith@tungstengraphics.com> + * \author Nicolai Haehnle <prefect_@gmx.net> */ #ifndef __R300_CONTEXT_H__ @@ -45,19 +46,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "macros.h" #include "mtypes.h" #include "colormac.h" -#include "radeon_context.h" #define USER_BUFFERS -#define RADEON_VTXFMT_A -#define HW_VBOS - -/* We don't handle 16 bits elts swapping yet */ -#ifdef MESA_BIG_ENDIAN -#define FORCE_32BITS_ELTS -#endif //#define OPTIMIZE_ELTS -#define CB_DPATH struct r300_context; typedef struct r300_context r300ContextRec; @@ -66,13 +58,10 @@ typedef struct r300_context *r300ContextPtr; #include "radeon_lock.h" #include "mm.h" -/* Checkpoint.. for convenience */ -#define CPT { fprintf(stderr, "%s:%s line %d\n", __FILE__, __FUNCTION__, __LINE__); } /* From http://gcc.gnu.org/onlinedocs/gcc-3.2.3/gcc/Variadic-Macros.html . - I suppose we could inline this and use macro to fetch out __LINE__ and stuff in case we run into trouble + I suppose we could inline this and use macro to fetch out __LINE__ and stuff in case we run into trouble with other compilers ... GLUE! */ -#if 1 #define WARN_ONCE(a, ...) { \ static int warn##__LINE__=1; \ if(warn##__LINE__){ \ @@ -84,32 +73,61 @@ typedef struct r300_context *r300ContextPtr; warn##__LINE__=0;\ } \ } -#else -#define WARN_ONCE(a, ...) {} -#endif - /* We should probably change types within vertex_shader - and pixel_shader structure later on */ -#define CARD32 GLuint -#include "vertex_shader.h" +#include "r300_vertprog.h" #include "r300_fragprog.h" -#undef CARD32 +/** + * This function takes a float and packs it into a uint32_t + */ static __inline__ uint32_t r300PackFloat32(float fl) { - union { float fl; uint32_t u; } u; + union { + float fl; + uint32_t u; + } u; u.fl = fl; return u.u; } +/* This is probably wrong for some values, I need to test this + * some more. Range checking would be a good idea also.. + * + * But it works for most things. I'll fix it later if someone + * else with a better clue doesn't + */ +static __inline__ uint32_t r300PackFloat24(float f) +{ + float mantissa; + int exponent; + uint32_t float24 = 0; + + if (f == 0.0) + return 0; + + mantissa = frexpf(f, &exponent); + + /* Handle -ve */ + if (mantissa < 0) { + float24 |= (1 << 23); + mantissa = mantissa * -1.0; + } + /* Handle exponent, bias of 63 */ + exponent += 62; + float24 |= (exponent << 16); + /* Kill 7 LSB of mantissa */ + float24 |= (r300PackFloat32(mantissa) & 0x7FFFFF) >> 7; + + return float24; +} /************ DMA BUFFERS **************/ /* Need refcounting on dma buffers: */ struct r300_dma_buffer { - int refcount; /* the number of retained regions in buf */ + int refcount; /**< the number of retained regions in buf */ drmBufPtr buf; int id; }; @@ -128,10 +146,10 @@ struct r300_dma_region { char *address; /* == buf->address */ int start, end, ptr; /* offsets from start of buf */ - int aos_offset; /* address in GART memory */ - int aos_stride; /* distance between elements, in dwords */ - int aos_size; /* number of components (1-4) */ - int aos_reg; /* VAP register assignment */ + int aos_offset; /* address in GART memory */ + int aos_stride; /* distance between elements, in dwords */ + int aos_size; /* number of components (1-4) */ + int aos_reg; /* VAP register assignment */ }; struct r300_dma { @@ -173,15 +191,17 @@ struct r300_tex_obj { drm_radeon_tex_image_t image[6][RADEON_MAX_TEXTURE_LEVELS]; /* Six, for the cube faces */ + GLboolean image_override; /* Image overridden by GLX_EXT_tfp */ - GLuint pitch; /* this isn't sent to hardware just used in calculations */ + GLuint pitch; /* this isn't sent to hardware just used in calculations */ /* hardware register values */ /* Note that R200 has 8 registers per texture and R300 only 7 */ GLuint filter; + GLuint filter_1; GLuint pitch_reg; - GLuint size; /* npot only */ + GLuint size; /* npot only */ GLuint format; - GLuint offset; /* Image location in the card's address space. + GLuint offset; /* Image location in the card's address space. All cube faces follow. */ GLuint unknown4; GLuint unknown5; @@ -195,10 +215,9 @@ struct r300_tex_obj { GLuint pp_cubic_faces; /* cube face 1,2,3,4 log2 sizes */ GLuint format_x; - GLboolean border_fallback; - GLuint tile_bits; /* hw texture tile bits used on this texture */ + GLuint tile_bits; /* hw texture tile bits used on this texture */ }; struct r300_texture_env_state { @@ -207,7 +226,6 @@ struct r300_texture_env_state { GLenum envMode; }; - /* The blit width for texture uploads */ #define R300_BLIT_WIDTH_BYTES 1024 @@ -215,7 +233,7 @@ struct r300_texture_env_state { struct r300_texture_state { struct r300_texture_env_state unit[R300_MAX_TEXTURE_UNITS]; - int tc_count; /* number of incoming texture coordinates from VAP */ + int tc_count; /* number of incoming texture coordinates from VAP */ }; /** @@ -227,16 +245,15 @@ struct r300_texture_state { */ struct r300_state_atom { struct r300_state_atom *next, *prev; - const char* name; /* for debug */ + const char *name; /* for debug */ int cmd_size; /* maximum size in dwords */ GLuint idx; /* index in an array (e.g. textures) */ - uint32_t* cmd; + uint32_t *cmd; GLboolean dirty; - int (*check)(r300ContextPtr, struct r300_state_atom* atom); + int (*check) (r300ContextPtr, struct r300_state_atom * atom); }; - #define R300_VPT_CMD_0 0 #define R300_VPT_XSCALE 1 #define R300_VPT_XOFFSET 2 @@ -246,7 +263,7 @@ struct r300_state_atom { #define R300_VPT_ZOFFSET 6 #define R300_VPT_CMDSIZE 7 -#define R300_VIR_CMD_0 0 /* vir is variable size (at least 1) */ +#define R300_VIR_CMD_0 0 /* vir is variable size (at least 1) */ #define R300_VIR_CNTL_0 1 #define R300_VIR_CNTL_1 2 #define R300_VIR_CNTL_2 3 @@ -267,7 +284,6 @@ struct r300_state_atom { #define R300_VOF_CNTL_1 2 #define R300_VOF_CMDSIZE 3 - #define R300_PVS_CMD_0 0 #define R300_PVS_CNTL_1 1 #define R300_PVS_CNTL_2 2 @@ -317,7 +333,7 @@ struct r300_state_atom { #define R300_RI_INTERP_7 8 #define R300_RI_CMDSIZE 9 -#define R300_RR_CMD_0 0 /* rr is variable size (at least 1) */ +#define R300_RR_CMD_0 0 /* rr is variable size (at least 1) */ #define R300_RR_ROUTE_0 1 #define R300_RR_ROUTE_1 2 #define R300_RR_ROUTE_2 3 @@ -399,11 +415,18 @@ struct r300_state_atom { #define R300_VPI_CMD_0 0 #define R300_VPI_INSTR_0 1 -#define R300_VPI_CMDSIZE 1025 /* 256 16 byte instructions */ +#define R300_VPI_CMDSIZE 1025 /* 256 16 byte instructions */ #define R300_VPP_CMD_0 0 #define R300_VPP_PARAM_0 1 -#define R300_VPP_CMDSIZE 1025 /* 256 4-component parameters */ +#define R300_VPP_CMDSIZE 1025 /* 256 4-component parameters */ + +#define R300_VPUCP_CMD_0 0 +#define R300_VPUCP_X 1 +#define R300_VPUCP_Y 2 +#define R300_VPUCP_Z 3 +#define R300_VPUCP_W 4 +#define R300_VPUCP_CMDSIZE 5 /* 256 4-component parameters */ #define R300_VPS_CMD_0 0 #define R300_VPS_ZERO_0 1 @@ -425,64 +448,64 @@ struct r300_state_atom { struct r300_hw_state { struct r300_state_atom atomlist; - GLboolean is_dirty; - GLboolean all_dirty; - int max_state_size; /* in dwords */ + GLboolean is_dirty; + GLboolean all_dirty; + int max_state_size; /* in dwords */ struct r300_state_atom vpt; /* viewport (1D98) */ - struct r300_state_atom unk2080; /* (2080) */ - struct r300_state_atom vof; /* VAP output format register 0x2090 */ + struct r300_state_atom vap_cntl; + struct r300_state_atom vof; /* VAP output format register 0x2090 */ struct r300_state_atom vte; /* (20B0) */ struct r300_state_atom unk2134; /* (2134) */ - struct r300_state_atom unk2140; /* (2140) */ + struct r300_state_atom vap_cntl_status; struct r300_state_atom vir[2]; /* vap input route (2150/21E0) */ struct r300_state_atom vic; /* vap input control (2180) */ - struct r300_state_atom unk21DC; /* (21DC) */ - struct r300_state_atom unk221C; /* (221C) */ - struct r300_state_atom unk2220; /* (2220) */ - struct r300_state_atom unk2288; /* (2288) */ + struct r300_state_atom unk21DC; /* (21DC) */ + struct r300_state_atom vap_clip_cntl; + struct r300_state_atom unk2220; /* (2220) */ + struct r300_state_atom unk2288; /* (2288) */ struct r300_state_atom pvs; /* pvs_cntl (22D0) */ - struct r300_state_atom gb_enable; /* (4008) */ - struct r300_state_atom gb_misc; /* Multisampling position shifts ? (4010) */ - struct r300_state_atom unk4200; /* (4200) */ - struct r300_state_atom unk4214; /* (4214) */ + struct r300_state_atom gb_enable; /* (4008) */ + struct r300_state_atom gb_misc; /* Multisampling position shifts ? (4010) */ + struct r300_state_atom unk4200; /* (4200) */ + struct r300_state_atom unk4214; /* (4214) */ struct r300_state_atom ps; /* pointsize (421C) */ - struct r300_state_atom unk4230; /* (4230) */ + struct r300_state_atom unk4230; /* (4230) */ struct r300_state_atom lcntl; /* line control */ - struct r300_state_atom unk4260; /* (4260) */ - struct r300_state_atom unk4274; /* (4274) */ - struct r300_state_atom unk4288; /* (4288) */ + struct r300_state_atom unk4260; /* (4260) */ + struct r300_state_atom shade; + struct r300_state_atom polygon_mode; struct r300_state_atom fogp; /* fog parameters (4294) */ - struct r300_state_atom unk429C; /* (429C) */ - struct r300_state_atom unk42A0; /* (42A0) */ + struct r300_state_atom unk429C; /* (429C) */ + struct r300_state_atom zbias_cntl; struct r300_state_atom zbs; /* zbias (42A4) */ - struct r300_state_atom unk42B4; /* (42B4) */ + struct r300_state_atom occlusion_cntl; struct r300_state_atom cul; /* cull cntl (42B8) */ - struct r300_state_atom unk42C0; /* (42C0) */ + struct r300_state_atom unk42C0; /* (42C0) */ struct r300_state_atom rc; /* rs control (4300) */ struct r300_state_atom ri; /* rs interpolators (4310) */ struct r300_state_atom rr; /* rs route (4330) */ struct r300_state_atom unk43A4; /* (43A4) */ struct r300_state_atom unk43E8; /* (43E8) */ struct r300_state_atom fp; /* fragment program cntl + nodes (4600) */ - struct r300_state_atom fpt; /* texi - (4620) */ + struct r300_state_atom fpt; /* texi - (4620) */ struct r300_state_atom unk46A4; /* (46A4) */ struct r300_state_atom fpi[4]; /* fp instructions (46C0/47C0/48C0/49C0) */ struct r300_state_atom fogs; /* fog state (4BC0) */ struct r300_state_atom fogc; /* fog color (4BC8) */ struct r300_state_atom at; /* alpha test (4BD4) */ struct r300_state_atom unk4BD8; /* (4BD8) */ - struct r300_state_atom fpp; /* 0x4C00 and following */ + struct r300_state_atom fpp; /* 0x4C00 and following */ struct r300_state_atom unk4E00; /* (4E00) */ struct r300_state_atom bld; /* blending (4E04) */ struct r300_state_atom cmk; /* colormask (4E0C) */ - struct r300_state_atom unk4E10; /* constant blend color + ??? (4E10) */ + struct r300_state_atom blend_color; /* constant blend color */ struct r300_state_atom cb; /* colorbuffer (4E28) */ struct r300_state_atom unk4E50; /* (4E50) */ struct r300_state_atom unk4E88; /* (4E88) */ struct r300_state_atom unk4EA0; /* (4E88) I saw it only written on RV350 hardware.. */ struct r300_state_atom zs; /* zstencil control (4F00) */ - struct r300_state_atom unk4F10; /* (4F10) */ + struct r300_state_atom zstencil_format; struct r300_state_atom zb; /* z buffer (4F20) */ struct r300_state_atom unk4F28; /* (4F28) */ struct r300_state_atom unk4F30; /* (4F30) */ @@ -492,25 +515,25 @@ struct r300_hw_state { struct r300_state_atom vpi; /* vp instructions */ struct r300_state_atom vpp; /* vp parameters */ struct r300_state_atom vps; /* vertex point size (?) */ - /* 8 texture units */ - /* the state is grouped by function and not by - texture unit. This makes single unit updates - really awkward - we are much better off - updating the whole thing at once */ + struct r300_state_atom vpucp[6]; /* vp user clip plane - 6 */ + /* 8 texture units */ + /* the state is grouped by function and not by + texture unit. This makes single unit updates + really awkward - we are much better off + updating the whole thing at once */ struct { struct r300_state_atom filter; - struct r300_state_atom unknown1; + struct r300_state_atom filter_1; struct r300_state_atom size; struct r300_state_atom format; struct r300_state_atom pitch; struct r300_state_atom offset; - struct r300_state_atom unknown4; + struct r300_state_atom chroma_key; struct r300_state_atom border_color; - } tex; + } tex; struct r300_state_atom txe; /* tex enable (4104) */ }; - /** * This structure holds the command buffer while it is being constructed. * @@ -519,13 +542,12 @@ struct r300_hw_state { * otherwise. */ struct r300_cmdbuf { - int size; /* DWORDs allocated for buffer */ - uint32_t* cmd_buf; - int count_used; /* DWORDs filled so far */ - int count_reemit; /* size of re-emission batch */ + int size; /* DWORDs allocated for buffer */ + uint32_t *cmd_buf; + int count_used; /* DWORDs filled so far */ + int count_reemit; /* size of re-emission batch */ }; - /** * State cache */ @@ -545,19 +567,21 @@ struct r300_stencilbuffer_state { /* Perhaps more if we store programs in vmem? */ /* drm_r300_cmd_header_t->vpu->count is unsigned char */ #define VSF_MAX_FRAGMENT_LENGTH (255*4) - + /* Can be tested with colormat currently. */ #define VSF_MAX_FRAGMENT_TEMPS (14) +#define STATE_R300_WINDOW_DIMENSION (STATE_INTERNAL_DRIVER+0) +#define STATE_R300_TEXRECT_FACTOR (STATE_INTERNAL_DRIVER+1) struct r300_vertex_shader_fragment { int length; union { GLuint d[VSF_MAX_FRAGMENT_LENGTH]; float f[VSF_MAX_FRAGMENT_LENGTH]; - VERTEX_SHADER_INSTRUCTION i[VSF_MAX_FRAGMENT_LENGTH/4]; - } body; - }; + VERTEX_SHADER_INSTRUCTION i[VSF_MAX_FRAGMENT_LENGTH / 4]; + } body; +}; #define VSF_DEST_PROGRAM 0x0 #define VSF_DEST_MATRIX0 0x200 @@ -571,51 +595,47 @@ struct r300_vertex_shader_fragment { struct r300_vertex_shader_state { struct r300_vertex_shader_fragment program; - /* a bit of a waste - each uses only a subset of allocated space.. - but easier to program */ - struct r300_vertex_shader_fragment matrix[3]; - struct r300_vertex_shader_fragment vector[2]; - struct r300_vertex_shader_fragment unknown1; struct r300_vertex_shader_fragment unknown2; int program_start; - int unknown_ptr1; /* pointer within program space */ + int unknown_ptr1; /* pointer within program space */ int program_end; int param_offset; int param_count; - int unknown_ptr2; /* pointer within program space */ - int unknown_ptr3; /* pointer within program space */ - }; - + int unknown_ptr2; /* pointer within program space */ + int unknown_ptr3; /* pointer within program space */ +}; + extern int hw_tcl_on; -#define CURRENT_VERTEX_SHADER(ctx) (ctx->VertexProgram._Current) +//#define CURRENT_VERTEX_SHADER(ctx) (ctx->VertexProgram._Current) +#define CURRENT_VERTEX_SHADER(ctx) (R300_CONTEXT(ctx)->selected_vp) /* Should but doesnt work */ //#define CURRENT_VERTEX_SHADER(ctx) (R300_CONTEXT(ctx)->curr_vp) -//#define TMU_ENABLED(ctx, unit) (hw_tcl_on ? ctx->Texture.Unit[unit]._ReallyEnabled && (OutputsWritten & (1<<(VERT_RESULT_TEX0+(unit)))) : -// (r300->state.render_inputs & (_TNL_BIT_TEX0<<(unit)))) -//#define TMU_ENABLED(ctx, unit) (hw_tcl_on ? ctx->Texture.Unit[unit]._ReallyEnabled && OutputsWritten & (1<<(VERT_RESULT_TEX0+(unit))) : -// ctx->Texture.Unit[unit]._ReallyEnabled && r300->state.render_inputs & (_TNL_BIT_TEX0<<(unit))) - -#define TMU_ENABLED(ctx, unit) (ctx->Texture.Unit[unit]._ReallyEnabled) - /* r300_vertex_shader_state and r300_vertex_program should probably be merged together someday. * Keeping them them seperate for now should ensure fixed pipeline keeps functioning properly. - */ + */ + +struct r300_vertex_program_key { + GLuint InputsRead; + GLuint OutputsWritten; +}; + struct r300_vertex_program { - struct gl_vertex_program mesa_program; /* Must be first */ + struct r300_vertex_program *next; + struct r300_vertex_program_key key; int translated; - + struct r300_vertex_shader_fragment program; - struct r300_vertex_shader_fragment params; - + int pos_end; - int num_temporaries; /* Number of temp vars used by program */ + int num_temporaries; /* Number of temp vars used by program */ + int wpos_idx; int inputs[VERT_ATTRIB_MAX]; int outputs[VERT_RESULT_MAX]; int native; @@ -623,44 +643,100 @@ struct r300_vertex_program { int use_ref_count; }; +struct r300_vertex_program_cont { + struct gl_vertex_program mesa_program; /* Must be first */ + struct r300_vertex_shader_fragment params; + struct r300_vertex_program *progs; +}; + #define PFS_MAX_ALU_INST 64 #define PFS_MAX_TEX_INST 64 #define PFS_MAX_TEX_INDIRECT 4 #define PFS_NUM_TEMP_REGS 32 #define PFS_NUM_CONST_REGS 16 -/* Tracking data for Mesa registers */ +/* Mapping Mesa registers to R300 temporaries */ struct reg_acc { - int reg; /* Assigned hw temp */ - unsigned int refcount; /* Number of uses by mesa program */ + int reg; /* Assigned hw temp */ + unsigned int refcount; /* Number of uses by mesa program */ }; +/** + * Describe the current lifetime information for an R300 temporary + */ +struct reg_lifetime { + /* Index of the first slot where this register is free in the sense + that it can be used as a new destination register. + This is -1 if the register has been assigned to a Mesa register + and the last access to the register has not yet been emitted */ + int free; + + /* Index of the first slot where this register is currently reserved. + This is used to stop e.g. a scalar operation from being moved + before the allocation time of a register that was first allocated + for a vector operation. */ + int reserved; + + /* Index of the first slot in which the register can be used as a + source without losing the value that is written by the last + emitted instruction that writes to the register */ + int vector_valid; + int scalar_valid; + + /* Index to the slot where the register was last read. + This is also the first slot in which the register may be written again */ + int vector_lastread; + int scalar_lastread; +}; + +/** + * Store usage information about an ALU instruction slot during the + * compilation of a fragment program. + */ +#define SLOT_SRC_VECTOR (1<<0) +#define SLOT_SRC_SCALAR (1<<3) +#define SLOT_SRC_BOTH (SLOT_SRC_VECTOR | SLOT_SRC_SCALAR) +#define SLOT_OP_VECTOR (1<<16) +#define SLOT_OP_SCALAR (1<<17) +#define SLOT_OP_BOTH (SLOT_OP_VECTOR | SLOT_OP_SCALAR) + +struct r300_pfs_compile_slot { + /* Bitmask indicating which parts of the slot are used, using SLOT_ constants + defined above */ + unsigned int used; + + /* Selected sources */ + int vsrc[3]; + int ssrc[3]; +}; + +/** + * Store information during compilation of fragment programs. + */ struct r300_pfs_compile_state { - int v_pos, s_pos; /* highest ALU slots used */ - - /* Track some information gathered during opcode - * construction. - * - * NOTE: Data is only set by the code, and isn't used yet. - */ - struct { - int vsrc[3]; - int ssrc[3]; - int umask; - } slot[PFS_MAX_ALU_INST]; - - /* Used to map Mesa's inputs/temps onto hardware temps */ - int temp_in_use; - struct reg_acc temps[PFS_NUM_TEMP_REGS]; - struct reg_acc inputs[32]; /* don't actually need 32... */ - - /* Track usage of hardware temps, for register allocation, - * indirection detection, etc. */ - int hwreg_in_use; - GLuint used_in_node; - GLuint dest_in_node; + int nrslots; /* number of ALU slots used so far */ + + /* Track which (parts of) slots are already filled with instructions */ + struct r300_pfs_compile_slot slot[PFS_MAX_ALU_INST]; + + /* Track the validity of R300 temporaries */ + struct reg_lifetime hwtemps[PFS_NUM_TEMP_REGS]; + + /* Used to map Mesa's inputs/temps onto hardware temps */ + int temp_in_use; + struct reg_acc temps[PFS_NUM_TEMP_REGS]; + struct reg_acc inputs[32]; /* don't actually need 32... */ + + /* Track usage of hardware temps, for register allocation, + * indirection detection, etc. */ + GLuint used_in_node; + GLuint dest_in_node; }; +/** + * Store everything about a fragment program that is needed + * to render with that program. + */ struct r300_fragment_program { struct gl_fragment_program mesa_program; @@ -698,19 +774,19 @@ struct r300_fragment_program { int tex_offset; int tex_end; - /* Hardware constants */ - GLfloat constant[PFS_NUM_CONST_REGS][4]; + /* Hardware constants. + * Contains a pointer to the value. The destination of the pointer + * is supposed to be updated when GL state changes. + * Typically, this is either a pointer into + * gl_program_parameter_list::ParameterValues, or a pointer to a + * global constant (e.g. for sin/cos-approximation) + */ + const GLfloat *constant[PFS_NUM_CONST_REGS]; int const_nr; - /* Tracked parameters */ - struct { - int idx; /* hardware index */ - GLfloat *values; /* pointer to values */ - } param[PFS_NUM_CONST_REGS]; - int param_nr; - GLboolean params_uptodate; - int max_temp_idx; + + GLuint optimization; }; #define R300_MAX_AOS_ARRAYS 16 @@ -735,30 +811,17 @@ struct radeon_vertex_buffer { int Count; void *Elts; int elt_size; - int elt_min, elt_max; /* debug */ - + int elt_min, elt_max; /* debug */ + struct dt AttribPtr[VERT_ATTRIB_MAX]; - - struct tnl_prim *Primitive; - GLuint PrimitiveCount; + + const struct _mesa_prim *Primitive; + GLuint PrimitiveCount; GLint LockFirst; GLsizei LockCount; int lock_uptodate; }; -struct r300_aos_rec { - GLuint offset; - int element_size; /* in dwords */ - int stride; /* distance between elements, in dwords */ - - int format; - - int ncomponents; /* number of components - between 1 and 4, inclusive */ - - int reg; /* which register they are assigned to. */ - - }; - struct r300_state { struct r300_depthbuffer_state depth; struct r300_texture_state texture; @@ -771,16 +834,16 @@ struct r300_state { GLuint *Elts; struct r300_dma_region elt_dma; - - DECLARE_RENDERINPUTS(render_inputs_bitset); /* actual render inputs that R300 was configured for. - They are the same as tnl->render_inputs for fixed pipeline */ - + + DECLARE_RENDERINPUTS(render_inputs_bitset); /* actual render inputs that R300 was configured for. + They are the same as tnl->render_inputs for fixed pipeline */ + struct { - int transform_offset; /* Transform matrix offset, -1 if none */ - } vap_param; /* vertex processor parameter allocation - tells where to write parameters */ - + int transform_offset; /* Transform matrix offset, -1 if none */ + } vap_param; /* vertex processor parameter allocation - tells where to write parameters */ + struct r300_stencilbuffer_state stencil; - + }; #define R300_FALLBACK_NONE 0 @@ -788,15 +851,16 @@ struct r300_state { #define R300_FALLBACK_RAST 2 /** - * R300 context structure. + * \brief R300 context structure. */ struct r300_context { - struct radeon_context radeon; /* parent class, must be first */ + struct radeon_context radeon; /* parent class, must be first */ struct r300_hw_state hw; struct r300_cmdbuf cmdbuf; struct r300_state state; struct gl_vertex_program *curr_vp; + struct r300_vertex_program *selected_vp; /* Vertex buffers */ @@ -817,13 +881,12 @@ struct r300_context { GLuint prefer_gart_client_texturing; #ifdef USER_BUFFERS - struct radeon_memory_manager *rmm; + struct r300_memory_manager *rmm; +#endif + GLvector4f dummy_attrib[_TNL_ATTRIB_MAX]; GLvector4f *temp_attrib[_TNL_ATTRIB_MAX]; -#endif - GLboolean texmicrotile; - GLboolean span_dlocking; GLboolean disable_lowimpact_fallback; }; @@ -831,45 +894,19 @@ struct r300_buffer_object { struct gl_buffer_object mesa_obj; int id; }; - + #define R300_CONTEXT(ctx) ((r300ContextPtr)(ctx->DriverCtx)) -static __inline GLuint r300PackColor( GLuint cpp, - GLubyte r, GLubyte g, - GLubyte b, GLubyte a ) -{ - switch ( cpp ) { - case 2: - return PACK_COLOR_565( r, g, b ); - case 4: - return PACK_COLOR_8888( r, g, b, a ); - default: - return 0; - } -} extern void r300DestroyContext(__DRIcontextPrivate * driContextPriv); extern GLboolean r300CreateContext(const __GLcontextModes * glVisual, __DRIcontextPrivate * driContextPriv, void *sharedContextPrivate); -extern int r300_get_num_verts(r300ContextPtr rmesa, int num_verts, int prim); - -void r300_translate_vertex_shader(struct r300_vertex_program *vp); +extern void r300SelectVertexShader(r300ContextPtr r300); extern void r300InitShaderFuncs(struct dd_function_table *functions); -extern int r300VertexProgUpdateParams(GLcontext *ctx, struct r300_vertex_program *vp, float *dst); -extern int r300Fallback(GLcontext *ctx); - -extern void radeon_vb_to_rvb(r300ContextPtr rmesa, struct radeon_vertex_buffer *rvb, struct vertex_buffer *vb); -extern GLboolean r300_run_vb_render(GLcontext *ctx, struct tnl_pipeline_stage *stage); - -#ifdef RADEON_VTXFMT_A -extern void radeon_init_vtxfmt_a(r300ContextPtr rmesa); -#endif - -#ifdef HW_VBOS -extern void r300_init_vbo_funcs(struct dd_function_table *functions); -extern void r300_evict_vbos(GLcontext *ctx, int amount); -#endif +extern int r300VertexProgUpdateParams(GLcontext * ctx, + struct r300_vertex_program_cont *vp, + float *dst); #define RADEON_D_CAPTURE 0 #define RADEON_D_PLAYBACK 1 diff --git a/dist/Mesa/src/mesa/drivers/dri/r300/r300_ioctl.c b/dist/Mesa/src/mesa/drivers/dri/r300/r300_ioctl.c index d0d2def86..ea94ce252 100644 --- a/dist/Mesa/src/mesa/drivers/dri/r300/r300_ioctl.c +++ b/dist/Mesa/src/mesa/drivers/dri/r300/r300_ioctl.c @@ -29,10 +29,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* - * Authors: - * Keith Whitwell <keith@tungstengraphics.com> - * Nicolai Haehnle <prefect_@gmx.net> +/** + * \file + * + * \author Keith Whitwell <keith@tungstengraphics.com> + * + * \author Nicolai Haehnle <prefect_@gmx.net> */ #include <sched.h> @@ -61,19 +63,15 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer) { - GLcontext* ctx = r300->radeon.glCtx; + GLcontext *ctx = r300->radeon.glCtx; __DRIdrawablePrivate *dPriv = r300->radeon.dri.drawable; GLuint cboffset, cbpitch; - drm_r300_cmd_header_t* cmd2; + drm_r300_cmd_header_t *cmd2; int cmd_reserved = 0; int cmd_written = 0; drm_radeon_cmd_header_t *cmd = NULL; - r300ContextPtr rmesa=r300; + r300ContextPtr rmesa = r300; -#ifndef CB_DPATH - int i; -#endif - if (RADEON_DEBUG & DEBUG_IOCTL) fprintf(stderr, "%s: %s buffer (%i,%i %ix%i)\n", __FUNCTION__, buffer ? "back" : "front", @@ -89,233 +87,80 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer) cboffset += r300->radeon.radeonScreen->fbLocation; -#ifndef CB_DPATH - R300_STATECHANGE(r300, vir[0]); - ((drm_r300_cmd_header_t*)r300->hw.vir[0].cmd)->packet0.count = 1; - r300->hw.vir[0].cmd[1] = 0x21030003; - - R300_STATECHANGE(r300, vir[1]); - ((drm_r300_cmd_header_t*)r300->hw.vir[1].cmd)->packet0.count = 1; - r300->hw.vir[1].cmd[1] = 0xF688F688; - - R300_STATECHANGE(r300, vic); - r300->hw.vic.cmd[R300_VIC_CNTL_0] = 0x00000001; - r300->hw.vic.cmd[R300_VIC_CNTL_1] = 0x00000405; - - R300_STATECHANGE(r300, vof); - r300->hw.vof.cmd[R300_VOF_CNTL_0] = R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT - | R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT; - r300->hw.vof.cmd[R300_VOF_CNTL_1] = 0; /* no textures */ - - R300_STATECHANGE(r300, txe); - r300->hw.txe.cmd[R300_TXE_ENABLE] = 0; - - R300_STATECHANGE(r300, vpt); - r300->hw.vpt.cmd[R300_VPT_XSCALE] = r300PackFloat32(1.0); - r300->hw.vpt.cmd[R300_VPT_XOFFSET] = r300PackFloat32(dPriv->x); - r300->hw.vpt.cmd[R300_VPT_YSCALE] = r300PackFloat32(1.0); - r300->hw.vpt.cmd[R300_VPT_YOFFSET] = r300PackFloat32(dPriv->y); - r300->hw.vpt.cmd[R300_VPT_ZSCALE] = r300PackFloat32(1.0); - r300->hw.vpt.cmd[R300_VPT_ZOFFSET] = r300PackFloat32(0.0); - - R300_STATECHANGE(r300, at); - r300->hw.at.cmd[R300_AT_ALPHA_TEST] = 0; - - R300_STATECHANGE(r300, bld); - r300->hw.bld.cmd[R300_BLD_CBLEND] = 0; - r300->hw.bld.cmd[R300_BLD_ABLEND] = 0; - - if (r300->radeon.radeonScreen->cpp == 4) - cbpitch |= R300_COLOR_FORMAT_ARGB8888; - else - cbpitch |= R300_COLOR_FORMAT_RGB565; - - if (r300->radeon.sarea->tiling_enabled) - cbpitch |= R300_COLOR_TILE_ENABLE; - - R300_STATECHANGE(r300, cb); - r300->hw.cb.cmd[R300_CB_OFFSET] = cboffset; - r300->hw.cb.cmd[R300_CB_PITCH] = cbpitch; - - R300_STATECHANGE(r300, unk221C); - r300->hw.unk221C.cmd[1] = R300_221C_CLEAR; - - R300_STATECHANGE(r300, ps); - r300->hw.ps.cmd[R300_PS_POINTSIZE] = - ((dPriv->w * 6) << R300_POINTSIZE_X_SHIFT) | - ((dPriv->h * 6) << R300_POINTSIZE_Y_SHIFT); - - R300_STATECHANGE(r300, ri); - for(i = 1; i <= 8; ++i) - r300->hw.ri.cmd[i] = R300_RS_INTERP_USED; - - R300_STATECHANGE(r300, rc); - /* The second constant is needed to get glxgears display anything .. */ - r300->hw.rc.cmd[1] = (1 << R300_RS_CNTL_CI_CNT_SHIFT) | R300_RS_CNTL_0_UNKNOWN_18; - r300->hw.rc.cmd[2] = 0; - - R300_STATECHANGE(r300, rr); - ((drm_r300_cmd_header_t*)r300->hw.rr.cmd)->packet0.count = 1; - r300->hw.rr.cmd[1] = 0x00004000; - - R300_STATECHANGE(r300, cmk); - if (flags & CLEARBUFFER_COLOR) { - r300->hw.cmk.cmd[R300_CMK_COLORMASK] = - (ctx->Color.ColorMask[BCOMP] ? R300_COLORMASK0_B : 0) | - (ctx->Color.ColorMask[GCOMP] ? R300_COLORMASK0_G : 0) | - (ctx->Color.ColorMask[RCOMP] ? R300_COLORMASK0_R : 0) | - (ctx->Color.ColorMask[ACOMP] ? R300_COLORMASK0_A : 0); - } else { - r300->hw.cmk.cmd[R300_CMK_COLORMASK] = 0; - } - - R300_STATECHANGE(r300, fp); - r300->hw.fp.cmd[R300_FP_CNTL0] = 0; /* 1 pass, no textures */ - r300->hw.fp.cmd[R300_FP_CNTL1] = 0; /* no temporaries */ - r300->hw.fp.cmd[R300_FP_CNTL2] = 0; /* no offset, one ALU instr */ - r300->hw.fp.cmd[R300_FP_NODE0] = 0; - r300->hw.fp.cmd[R300_FP_NODE1] = 0; - r300->hw.fp.cmd[R300_FP_NODE2] = 0; - r300->hw.fp.cmd[R300_FP_NODE3] = R300_PFS_NODE_OUTPUT_COLOR; - - R300_STATECHANGE(r300, fpi[0]); - R300_STATECHANGE(r300, fpi[1]); - R300_STATECHANGE(r300, fpi[2]); - R300_STATECHANGE(r300, fpi[3]); - ((drm_r300_cmd_header_t*)r300->hw.fpi[0].cmd)->packet0.count = 1; - ((drm_r300_cmd_header_t*)r300->hw.fpi[1].cmd)->packet0.count = 1; - ((drm_r300_cmd_header_t*)r300->hw.fpi[2].cmd)->packet0.count = 1; - ((drm_r300_cmd_header_t*)r300->hw.fpi[3].cmd)->packet0.count = 1; - - /* MOV o0, t0 */ - r300->hw.fpi[0].cmd[1] = FP_INSTRC(MAD, FP_ARGC(SRC0C_XYZ), FP_ARGC(ONE), FP_ARGC(ZERO)); - r300->hw.fpi[1].cmd[1] = FP_SELC(0,NO,XYZ,FP_TMP(0),0,0); - r300->hw.fpi[2].cmd[1] = FP_INSTRA(MAD, FP_ARGA(SRC0A), FP_ARGA(ONE), FP_ARGA(ZERO)); - r300->hw.fpi[3].cmd[1] = FP_SELA(0,NO,W,FP_TMP(0),0,0); - - R300_STATECHANGE(r300, pvs); - r300->hw.pvs.cmd[R300_PVS_CNTL_1] = - (0 << R300_PVS_CNTL_1_PROGRAM_START_SHIFT) | - (0 << R300_PVS_CNTL_1_POS_END_SHIFT) | - (1 << R300_PVS_CNTL_1_PROGRAM_END_SHIFT); - r300->hw.pvs.cmd[R300_PVS_CNTL_2] = 0; /* no parameters */ - r300->hw.pvs.cmd[R300_PVS_CNTL_3] = - (1 << R300_PVS_CNTL_3_PROGRAM_UNKNOWN_SHIFT); - - R300_STATECHANGE(r300, vpi); - ((drm_r300_cmd_header_t*)r300->hw.vpi.cmd)->packet0.count = 8; - - /* MOV o0, i0; */ - r300->hw.vpi.cmd[1] = VP_OUT(ADD,OUT,0,XYZW); - r300->hw.vpi.cmd[2] = VP_IN(IN,0); - r300->hw.vpi.cmd[3] = VP_ZERO(); - r300->hw.vpi.cmd[4] = 0; - - /* MOV o1, i1; */ - r300->hw.vpi.cmd[5] = VP_OUT(ADD,OUT,1,XYZW); - r300->hw.vpi.cmd[6] = VP_IN(IN,1); - r300->hw.vpi.cmd[7] = VP_ZERO(); - r300->hw.vpi.cmd[8] = 0; - - R300_STATECHANGE(r300, zs); - r300->hw.zs.cmd[R300_ZS_CNTL_0] = 0; - r300->hw.zs.cmd[R300_ZS_CNTL_1] = 0; - if (flags & CLEARBUFFER_DEPTH) { - r300->hw.zs.cmd[R300_ZS_CNTL_0] |= R300_RB3D_Z_WRITE_ONLY; - r300->hw.zs.cmd[R300_ZS_CNTL_1] |= (R300_ZS_ALWAYS<<R300_RB3D_ZS1_DEPTH_FUNC_SHIFT); - } else { - r300->hw.zs.cmd[R300_ZS_CNTL_0] |= R300_RB3D_Z_DISABLED_1; // disable - } - - R300_STATECHANGE(r300, zs); - if (flags & CLEARBUFFER_STENCIL) { - r300->hw.zs.cmd[R300_ZS_CNTL_0] |= R300_RB3D_STENCIL_ENABLE; - r300->hw.zs.cmd[R300_ZS_CNTL_1] |= - (R300_ZS_ALWAYS<<R300_RB3D_ZS1_FRONT_FUNC_SHIFT) | - (R300_ZS_REPLACE<<R300_RB3D_ZS1_FRONT_FAIL_OP_SHIFT) | - (R300_ZS_REPLACE<<R300_RB3D_ZS1_FRONT_ZPASS_OP_SHIFT) | - (R300_ZS_REPLACE<<R300_RB3D_ZS1_FRONT_ZFAIL_OP_SHIFT) | - (R300_ZS_ALWAYS<<R300_RB3D_ZS1_BACK_FUNC_SHIFT) | - (R300_ZS_REPLACE<<R300_RB3D_ZS1_BACK_FAIL_OP_SHIFT) | - (R300_ZS_REPLACE<<R300_RB3D_ZS1_BACK_ZPASS_OP_SHIFT) | - (R300_ZS_REPLACE<<R300_RB3D_ZS1_BACK_ZFAIL_OP_SHIFT) ; - r300->hw.zs.cmd[R300_ZS_CNTL_2] = r300->state.stencil.clear; - } - - /* Make sure we have enough space */ - r300EnsureCmdBufSpace(r300, r300->hw.max_state_size + 9+8, __FUNCTION__); - - r300EmitState(r300); -#else -#if 1 cp_wait(r300, R300_WAIT_3D | R300_WAIT_3D_CLEAN); end_3d(rmesa); -#endif - + R300_STATECHANGE(r300, cb); reg_start(R300_RB3D_COLOROFFSET0, 0); e32(cboffset); - + if (r300->radeon.radeonScreen->cpp == 4) cbpitch |= R300_COLOR_FORMAT_ARGB8888; else cbpitch |= R300_COLOR_FORMAT_RGB565; - + if (r300->radeon.sarea->tiling_enabled) cbpitch |= R300_COLOR_TILE_ENABLE; - + reg_start(R300_RB3D_COLORPITCH0, 0); e32(cbpitch); R300_STATECHANGE(r300, cmk); reg_start(R300_RB3D_COLORMASK, 0); - + if (flags & CLEARBUFFER_COLOR) { e32((ctx->Color.ColorMask[BCOMP] ? R300_COLORMASK0_B : 0) | - (ctx->Color.ColorMask[GCOMP] ? R300_COLORMASK0_G : 0) | - (ctx->Color.ColorMask[RCOMP] ? R300_COLORMASK0_R : 0) | - (ctx->Color.ColorMask[ACOMP] ? R300_COLORMASK0_A : 0)); + (ctx->Color.ColorMask[GCOMP] ? R300_COLORMASK0_G : 0) | + (ctx->Color.ColorMask[RCOMP] ? R300_COLORMASK0_R : 0) | + (ctx->Color.ColorMask[ACOMP] ? R300_COLORMASK0_A : 0)); } else { - e32(0); + e32(0x0); } - + R300_STATECHANGE(r300, zs); reg_start(R300_RB3D_ZSTENCIL_CNTL_0, 2); - + { - uint32_t t1, t2; - - t1 = 0x0; - t2 = 0x0; - - if (flags & CLEARBUFFER_DEPTH) { - t1 |= R300_RB3D_Z_WRITE_ONLY; - t2 |= (R300_ZS_ALWAYS << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT); - } else { - t1 |= R300_RB3D_Z_DISABLED_1; // disable - } - - if (flags & CLEARBUFFER_STENCIL) { - t1 |= R300_RB3D_STENCIL_ENABLE; - t2 |= - (R300_ZS_ALWAYS<<R300_RB3D_ZS1_FRONT_FUNC_SHIFT) | - (R300_ZS_REPLACE<<R300_RB3D_ZS1_FRONT_FAIL_OP_SHIFT) | - (R300_ZS_REPLACE<<R300_RB3D_ZS1_FRONT_ZPASS_OP_SHIFT) | - (R300_ZS_REPLACE<<R300_RB3D_ZS1_FRONT_ZFAIL_OP_SHIFT) | - (R300_ZS_ALWAYS<<R300_RB3D_ZS1_BACK_FUNC_SHIFT) | - (R300_ZS_REPLACE<<R300_RB3D_ZS1_BACK_FAIL_OP_SHIFT) | - (R300_ZS_REPLACE<<R300_RB3D_ZS1_BACK_ZPASS_OP_SHIFT) | - (R300_ZS_REPLACE<<R300_RB3D_ZS1_BACK_ZFAIL_OP_SHIFT) ; - } - - e32(t1); - e32(t2); - e32(r300->state.stencil.clear); + uint32_t t1, t2; + + t1 = 0x0; + t2 = 0x0; + + if (flags & CLEARBUFFER_DEPTH) { + t1 |= R300_RB3D_Z_WRITE_ONLY; + t2 |= + (R300_ZS_ALWAYS << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT); + } else { + t1 |= R300_RB3D_Z_DISABLED_1; // disable + } + + if (flags & CLEARBUFFER_STENCIL) { + t1 |= R300_RB3D_STENCIL_ENABLE; + t2 |= + (R300_ZS_ALWAYS << + R300_RB3D_ZS1_FRONT_FUNC_SHIFT) | + (R300_ZS_REPLACE << + R300_RB3D_ZS1_FRONT_FAIL_OP_SHIFT) | + (R300_ZS_REPLACE << + R300_RB3D_ZS1_FRONT_ZPASS_OP_SHIFT) | + (R300_ZS_REPLACE << + R300_RB3D_ZS1_FRONT_ZFAIL_OP_SHIFT) | + (R300_ZS_ALWAYS << + R300_RB3D_ZS1_BACK_FUNC_SHIFT) | + (R300_ZS_REPLACE << + R300_RB3D_ZS1_BACK_FAIL_OP_SHIFT) | + (R300_ZS_REPLACE << + R300_RB3D_ZS1_BACK_ZPASS_OP_SHIFT) | + (R300_ZS_REPLACE << + R300_RB3D_ZS1_BACK_ZFAIL_OP_SHIFT); + } + + e32(t1); + e32(t2); + e32(r300->state.stencil.clear); } - -#endif - cmd2 = (drm_r300_cmd_header_t*)r300AllocCmdBuf(r300, 9, __FUNCTION__); + cmd2 = (drm_r300_cmd_header_t *) r300AllocCmdBuf(r300, 9, __FUNCTION__); cmd2[0].packet3.cmd_type = R300_CMD_PACKET3; cmd2[0].packet3.packet = R300_CMD_PACKET3_CLEAR; cmd2[1].u = r300PackFloat32(dPriv->w / 2.0); @@ -327,57 +172,82 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer) cmd2[7].u = r300PackFloat32(ctx->Color.ClearColor[2]); cmd2[8].u = r300PackFloat32(ctx->Color.ClearColor[3]); -#if 1 - reg_start(R300_RB3D_DSTCACHE_CTLSTAT,0); - e32(0x0000000a); - + reg_start(R300_RB3D_DSTCACHE_CTLSTAT, 0); + e32(R300_RB3D_DSTCACHE_UNKNOWN_0A); - reg_start(0x4f18,0); - e32(0x00000003); + reg_start(R300_RB3D_ZCACHE_CTLSTAT, 0); + e32(R300_RB3D_ZCACHE_UNKNOWN_03); cp_wait(rmesa, R300_WAIT_3D | R300_WAIT_3D_CLEAN); -#endif } -#ifdef CB_DPATH static void r300EmitClearState(GLcontext * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); - r300ContextPtr rmesa=r300; + r300ContextPtr rmesa = r300; __DRIdrawablePrivate *dPriv = r300->radeon.dri.drawable; int i; int cmd_reserved = 0; int cmd_written = 0; drm_radeon_cmd_header_t *cmd = NULL; - - + int has_tcl = 1; + + if (!(r300->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL)) + has_tcl = 0; + + /* FIXME: the values written to R300_VAP_INPUT_ROUTE_0_0 and + * R300_VAP_INPUT_ROUTE_0_1 are in fact known, however, the values are + * quite complex; see the functions in r300_emit.c. + * + * I believe it would be a good idea to extend the functions in + * r300_emit.c so that they can be used to setup the default values for + * these registers, as well as the actual values used for rendering. + */ R300_STATECHANGE(r300, vir[0]); reg_start(R300_VAP_INPUT_ROUTE_0_0, 0); - e32(0x21030003); - + if (!has_tcl) + e32(0x22030003); + else + e32(0x21030003); + /* disable fog */ R300_STATECHANGE(r300, fogs); reg_start(R300_RE_FOG_STATE, 0); e32(0x0); - + R300_STATECHANGE(r300, vir[1]); reg_start(R300_VAP_INPUT_ROUTE_1_0, 0); e32(0xF688F688); + /* R300_VAP_INPUT_CNTL_0, R300_VAP_INPUT_CNTL_1 */ R300_STATECHANGE(r300, vic); reg_start(R300_VAP_INPUT_CNTL_0, 1); - e32(0x00000001); - e32(0x00000405); - + e32(R300_INPUT_CNTL_0_COLOR); + e32(R300_INPUT_CNTL_POS | R300_INPUT_CNTL_COLOR | R300_INPUT_CNTL_TC0); + + if (!has_tcl) { + R300_STATECHANGE(r300, vte); + /* comes from fglrx startup of clear */ + reg_start(R300_SE_VTE_CNTL, 1); + e32(R300_VTX_W0_FMT | R300_VPORT_X_SCALE_ENA | + R300_VPORT_X_OFFSET_ENA | R300_VPORT_Y_SCALE_ENA | + R300_VPORT_Y_OFFSET_ENA | R300_VPORT_Z_SCALE_ENA | + R300_VPORT_Z_OFFSET_ENA); + e32(0x8); + + reg_start(0x21dc, 0); + e32(0xaaaaaaaa); + } + R300_STATECHANGE(r300, vof); reg_start(R300_VAP_OUTPUT_VTX_FMT_0, 1); - e32(R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT | R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT); - e32(0); /* no textures */ - - + e32(R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT | + R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT); + e32(0x0); /* no textures */ + R300_STATECHANGE(r300, txe); reg_start(R300_TX_ENABLE, 0); - e32(0); - + e32(0x0); + R300_STATECHANGE(r300, vpt); reg_start(R300_SE_VPORT_XSCALE, 5); efloat(1.0); @@ -386,28 +256,28 @@ static void r300EmitClearState(GLcontext * ctx) efloat(dPriv->y); efloat(1.0); efloat(0.0); - + R300_STATECHANGE(r300, at); reg_start(R300_PP_ALPHA_TEST, 0); - e32(0); - + e32(0x0); + R300_STATECHANGE(r300, bld); reg_start(R300_RB3D_CBLEND, 1); - e32(0); - e32(0); - - R300_STATECHANGE(r300, unk221C); - reg_start(0x221C, 0); + e32(0x0); + e32(0x0); + + R300_STATECHANGE(r300, vap_clip_cntl); + reg_start(R300_VAP_CLIP_CNTL, 0); e32(R300_221C_CLEAR); - + R300_STATECHANGE(r300, ps); reg_start(R300_RE_POINTSIZE, 0); e32(((dPriv->w * 6) << R300_POINTSIZE_X_SHIFT) | - ((dPriv->h * 6) << R300_POINTSIZE_Y_SHIFT)); - + ((dPriv->h * 6) << R300_POINTSIZE_Y_SHIFT)); + R300_STATECHANGE(r300, ri); reg_start(R300_RS_INTERP_0, 8); - for(i = 0; i < 8; ++i){ + for (i = 0; i < 8; ++i) { e32(R300_RS_INTERP_USED); } @@ -415,70 +285,67 @@ static void r300EmitClearState(GLcontext * ctx) /* The second constant is needed to get glxgears display anything .. */ reg_start(R300_RS_CNTL_0, 1); e32((1 << R300_RS_CNTL_CI_CNT_SHIFT) | R300_RS_CNTL_0_UNKNOWN_18); - e32(0); - + e32(0x0); + R300_STATECHANGE(r300, rr); reg_start(R300_RS_ROUTE_0, 0); - e32(0x00004000); - + e32(R300_RS_ROUTE_0_COLOR); + R300_STATECHANGE(r300, fp); reg_start(R300_PFS_CNTL_0, 2); - e32(0); - e32(0); - e32(0); + e32(0x0); + e32(0x0); + e32(0x0); reg_start(R300_PFS_NODE_0, 3); - e32(0); - e32(0); - e32(0); + e32(0x0); + e32(0x0); + e32(0x0); e32(R300_PFS_NODE_OUTPUT_COLOR); - + R300_STATECHANGE(r300, fpi[0]); R300_STATECHANGE(r300, fpi[1]); R300_STATECHANGE(r300, fpi[2]); R300_STATECHANGE(r300, fpi[3]); - + reg_start(R300_PFS_INSTR0_0, 0); e32(FP_INSTRC(MAD, FP_ARGC(SRC0C_XYZ), FP_ARGC(ONE), FP_ARGC(ZERO))); - + reg_start(R300_PFS_INSTR1_0, 0); - e32(FP_SELC(0,NO,XYZ,FP_TMP(0),0,0)); - + e32(FP_SELC(0, NO, XYZ, FP_TMP(0), 0, 0)); + reg_start(R300_PFS_INSTR2_0, 0); e32(FP_INSTRA(MAD, FP_ARGA(SRC0A), FP_ARGA(ONE), FP_ARGA(ZERO))); - + reg_start(R300_PFS_INSTR3_0, 0); - e32(FP_SELA(0,NO,W,FP_TMP(0),0,0)); - - R300_STATECHANGE(r300, pvs); - reg_start(R300_VAP_PVS_CNTL_1, 2); - e32((0 << R300_PVS_CNTL_1_PROGRAM_START_SHIFT) | - (0 << R300_PVS_CNTL_1_POS_END_SHIFT) | - (1 << R300_PVS_CNTL_1_PROGRAM_END_SHIFT)); - e32(0); - e32(1 << R300_PVS_CNTL_3_PROGRAM_UNKNOWN_SHIFT); - - R300_STATECHANGE(r300, vpi); - vsf_start_fragment(0x0, 8); - e32(VP_OUT(ADD,OUT,0,XYZW)); - e32(VP_IN(IN,0)); - e32(VP_ZERO()); - e32(0); - - e32(VP_OUT(ADD,OUT,1,XYZW)); - e32(VP_IN(IN,1)); - e32(VP_ZERO()); - e32(0); - - /*reg_start(0x4500,0); - e32(2560-1);*/ + e32(FP_SELA(0, NO, W, FP_TMP(0), 0, 0)); + + if (has_tcl) { + R300_STATECHANGE(r300, pvs); + reg_start(R300_VAP_PVS_CNTL_1, 2); + e32((0 << R300_PVS_CNTL_1_PROGRAM_START_SHIFT) | + (0 << R300_PVS_CNTL_1_POS_END_SHIFT) | + (1 << R300_PVS_CNTL_1_PROGRAM_END_SHIFT)); + e32(0x0); + e32(1 << R300_PVS_CNTL_3_PROGRAM_UNKNOWN_SHIFT); + + R300_STATECHANGE(r300, vpi); + vsf_start_fragment(0x0, 8); + e32(VP_OUT(ADD, OUT, 0, XYZW)); + e32(VP_IN(IN, 0)); + e32(VP_ZERO()); + e32(0x0); + + e32(VP_OUT(ADD, OUT, 1, XYZW)); + e32(VP_IN(IN, 1)); + e32(VP_ZERO()); + e32(0x0); + } } -#endif /** * Buffer clear */ -static void r300Clear(GLcontext * ctx, GLbitfield mask, GLboolean all, - GLint cx, GLint cy, GLint cw, GLint ch) +static void r300Clear(GLcontext * ctx, GLbitfield mask) { r300ContextPtr r300 = R300_CONTEXT(ctx); __DRIdrawablePrivate *dPriv = r300->radeon.dri.drawable; @@ -487,8 +354,7 @@ static void r300Clear(GLcontext * ctx, GLbitfield mask, GLboolean all, int swapped; if (RADEON_DEBUG & DEBUG_IOCTL) - fprintf(stderr, "%s: all=%d cx=%d cy=%d cw=%d ch=%d\n", - __FUNCTION__, all, cx, cy, cw, ch); + fprintf(stderr, "r300Clear\n"); { LOCK_HARDWARE(&r300->radeon); @@ -511,8 +377,8 @@ static void r300Clear(GLcontext * ctx, GLbitfield mask, GLboolean all, bits |= CLEARBUFFER_DEPTH; mask &= ~BUFFER_BIT_DEPTH; } - - if ( (mask & BUFFER_BIT_STENCIL) && r300->state.stencil.hw_stencil) { + + if ((mask & BUFFER_BIT_STENCIL) && r300->state.stencil.hw_stencil) { bits |= CLEARBUFFER_STENCIL; mask &= ~BUFFER_BIT_STENCIL; } @@ -521,17 +387,15 @@ static void r300Clear(GLcontext * ctx, GLbitfield mask, GLboolean all, if (RADEON_DEBUG & DEBUG_FALLBACKS) fprintf(stderr, "%s: swrast clear, mask: %x\n", __FUNCTION__, mask); - _swrast_Clear(ctx, mask, all, cx, cy, cw, ch); + _swrast_Clear(ctx, mask); } - swapped = r300->radeon.doPageFlip && (r300->radeon.sarea->pfCurrentPage == 1); + swapped = r300->radeon.sarea->pfCurrentPage == 1; -#ifdef CB_DPATH /* Make sure it fits there. */ - r300EnsureCmdBufSpace(r300, 421*3, __FUNCTION__); - if(flags || bits) + r300EnsureCmdBufSpace(r300, 421 * 3, __FUNCTION__); + if (flags || bits) r300EmitClearState(ctx); -#endif if (flags & BUFFER_BIT_FRONT_LEFT) { r300ClearBuffer(r300, bits | CLEARBUFFER_COLOR, swapped); @@ -546,18 +410,8 @@ static void r300Clear(GLcontext * ctx, GLbitfield mask, GLboolean all, if (bits) r300ClearBuffer(r300, bits, 0); -#ifndef CB_DPATH - /* Recalculate the hardware state. This could be done more efficiently, - * but do keep it like this for now. - */ - r300ResetHwState(r300); - - /* r300ClearBuffer has trampled all over the hardware state.. */ - r300->hw.all_dirty=GL_TRUE; -#endif } - void r300Flush(GLcontext * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); @@ -570,12 +424,13 @@ void r300Flush(GLcontext * ctx) } #ifdef USER_BUFFERS -#include "radeon_mm.h" +#include "r300_mem.h" -void r300RefillCurrentDmaRegion(r300ContextPtr rmesa) +static void r300RefillCurrentDmaRegion(r300ContextPtr rmesa, int size) { struct r300_dma_buffer *dmabuf; - + size = MAX2(size, RADEON_BUFFER_SIZE * 16); + if (RADEON_DEBUG & (DEBUG_IOCTL | DEBUG_DMA)) fprintf(stderr, "%s\n", __FUNCTION__); @@ -588,38 +443,32 @@ void r300RefillCurrentDmaRegion(r300ContextPtr rmesa) if (rmesa->dma.nr_released_bufs > 4) r300FlushCmdBuf(rmesa, __FUNCTION__); - + dmabuf = CALLOC_STRUCT(r300_dma_buffer); - dmabuf->buf = (void *)1; /* hack */ + dmabuf->buf = (void *)1; /* hack */ dmabuf->refcount = 1; - dmabuf->id = radeon_mm_alloc(rmesa, 4, RADEON_BUFFER_SIZE*16); + dmabuf->id = r300_mem_alloc(rmesa, 4, size); if (dmabuf->id == 0) { LOCK_HARDWARE(&rmesa->radeon); /* no need to validate */ - + r300FlushCmdBufLocked(rmesa, __FUNCTION__); radeonWaitForIdleLocked(&rmesa->radeon); - - dmabuf->id = radeon_mm_alloc(rmesa, 4, RADEON_BUFFER_SIZE*16); -#ifdef HW_VBOS - if (dmabuf->id == 0) { - /* Just kick all */ - r300_evict_vbos(rmesa->radeon.glCtx, /*RADEON_BUFFER_SIZE*16*/1<<30); - dmabuf->id = radeon_mm_alloc(rmesa, 4, RADEON_BUFFER_SIZE*16); - } -#endif + dmabuf->id = r300_mem_alloc(rmesa, 4, size); + UNLOCK_HARDWARE(&rmesa->radeon); - + if (dmabuf->id == 0) { - fprintf(stderr, "Error: Could not get dma buffer... exiting\n"); - exit(-1); + fprintf(stderr, + "Error: Could not get dma buffer... exiting\n"); + _mesa_exit(-1); } } - + rmesa->dma.current.buf = dmabuf; - rmesa->dma.current.address = radeon_mm_ptr(rmesa, dmabuf->id); - rmesa->dma.current.end = RADEON_BUFFER_SIZE*16; + rmesa->dma.current.address = r300_mem_ptr(rmesa, dmabuf->id); + rmesa->dma.current.end = size; rmesa->dma.current.start = 0; rmesa->dma.current.ptr = 0; } @@ -637,7 +486,7 @@ void r300ReleaseDmaRegion(r300ContextPtr rmesa, rmesa->dma.flush(rmesa); if (--region->buf->refcount == 0) { - radeon_mm_free(rmesa, region->buf->id); + r300_mem_free(rmesa, region->buf->id); FREE(region->buf); rmesa->dma.nr_released_bufs++; } @@ -667,7 +516,7 @@ void r300AllocDmaRegion(r300ContextPtr rmesa, (rmesa->dma.current.ptr + alignment) & ~alignment; if (rmesa->dma.current.ptr + bytes > rmesa->dma.current.end) - r300RefillCurrentDmaRegion(rmesa); + r300RefillCurrentDmaRegion(rmesa, (bytes + 0x7) & ~0x7); region->start = rmesa->dma.current.start; region->ptr = rmesa->dma.current.start; @@ -684,7 +533,7 @@ void r300AllocDmaRegion(r300ContextPtr rmesa, } #else -void r300RefillCurrentDmaRegion(r300ContextPtr rmesa) +static void r300RefillCurrentDmaRegion(r300ContextPtr rmesa) { struct r300_dma_buffer *dmabuf; int fd = rmesa->radeon.dri.fd; @@ -692,7 +541,7 @@ void r300RefillCurrentDmaRegion(r300ContextPtr rmesa) int size = 0; drmDMAReq dma; int ret; - + if (RADEON_DEBUG & (DEBUG_IOCTL | DEBUG_DMA)) fprintf(stderr, "%s\n", __FUNCTION__); @@ -735,8 +584,9 @@ void r300RefillCurrentDmaRegion(r300ContextPtr rmesa) if (ret != 0) { UNLOCK_HARDWARE(&rmesa->radeon); - fprintf(stderr, "Error: Could not get dma buffer... exiting\n"); - exit(-1); + fprintf(stderr, + "Error: Could not get dma buffer... exiting\n"); + _mesa_exit(-1); } } @@ -772,15 +622,16 @@ void r300ReleaseDmaRegion(r300ContextPtr rmesa, drm_radeon_cmd_header_t *cmd; if (RADEON_DEBUG & (DEBUG_IOCTL | DEBUG_DMA)) - fprintf(stderr, "%s -- DISCARD BUF %d\n", __FUNCTION__, - region->buf->buf->idx); + fprintf(stderr, "%s -- DISCARD BUF %d\n", + __FUNCTION__, region->buf->buf->idx); cmd = (drm_radeon_cmd_header_t *) r300AllocCmdBuf(rmesa, - sizeof(*cmd) / 4, + sizeof + (*cmd) / 4, __FUNCTION__); cmd->dma.cmd_type = R300_CMD_DMA_DISCARD; cmd->dma.buf_idx = region->buf->buf->idx; - + FREE(region->buf); rmesa->dma.nr_released_bufs++; } @@ -828,34 +679,15 @@ void r300AllocDmaRegion(r300ContextPtr rmesa, #endif -/* Called via glXGetMemoryOffsetMESA() */ -GLuint r300GetMemoryOffsetMESA(__DRInativeDisplay * dpy, int scrn, - const GLvoid * pointer) -{ - GET_CURRENT_CONTEXT(ctx); - r300ContextPtr rmesa; - GLuint card_offset; - - if (!ctx || !(rmesa = R300_CONTEXT(ctx))) { - fprintf(stderr, "%s: no context\n", __FUNCTION__); - return ~0; - } - - if (!r300IsGartMemory(rmesa, pointer, 0)) - return ~0; - - card_offset = r300GartOffsetFromVirtual(rmesa, pointer); - - return card_offset - rmesa->radeon.radeonScreen->gart_base; -} - GLboolean r300IsGartMemory(r300ContextPtr rmesa, const GLvoid * pointer, GLint size) { int offset = - (char *)pointer - (char *)rmesa->radeon.radeonScreen->gartTextures.map; + (char *)pointer - + (char *)rmesa->radeon.radeonScreen->gartTextures.map; int valid = (size >= 0 && offset >= 0 - && offset + size < rmesa->radeon.radeonScreen->gartTextures.size); + && offset + size < + rmesa->radeon.radeonScreen->gartTextures.size); if (RADEON_DEBUG & DEBUG_IOCTL) fprintf(stderr, "r300IsGartMemory( %p ) : %d\n", pointer, @@ -867,11 +699,13 @@ GLboolean r300IsGartMemory(r300ContextPtr rmesa, const GLvoid * pointer, GLuint r300GartOffsetFromVirtual(r300ContextPtr rmesa, const GLvoid * pointer) { int offset = - (char *)pointer - (char *)rmesa->radeon.radeonScreen->gartTextures.map; + (char *)pointer - + (char *)rmesa->radeon.radeonScreen->gartTextures.map; //fprintf(stderr, "offset=%08x\n", offset); - if (offset < 0 || offset > rmesa->radeon.radeonScreen->gartTextures.size) + if (offset < 0 + || offset > rmesa->radeon.radeonScreen->gartTextures.size) return ~0; else return rmesa->radeon.radeonScreen->gart_texture_offset + offset; diff --git a/dist/Mesa/src/mesa/drivers/dri/r300/r300_reg.h b/dist/Mesa/src/mesa/drivers/dri/r300/r300_reg.h index f3d8fa60f..e5501b650 100644 --- a/dist/Mesa/src/mesa/drivers/dri/r300/r300_reg.h +++ b/dist/Mesa/src/mesa/drivers/dri/r300/r300_reg.h @@ -23,6 +23,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ +/* *INDENT-OFF* */ + #ifndef _R300_REG_H #define _R300_REG_H @@ -63,6 +65,12 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define R300_SE_VPORT_ZOFFSET 0x1DAC +/* + * Vertex Array Processing (VAP) Control + * Stolen from r200 code from Christoph Brill (It's a guess!) + */ +#define R300_VAP_CNTL 0x2080 + /* This register is written directly and also starts data section * in many 3d CP_PACKET3's */ @@ -135,10 +143,11 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* gap */ -#define R300_VAP_CNTL 0x2140 +#define R300_VAP_CNTL_STATUS 0x2140 # define R300_VC_NO_SWAP (0 << 0) # define R300_VC_16BIT_SWAP (1 << 0) # define R300_VC_32BIT_SWAP (2 << 0) +# define R300_VAP_TCL_BYPASS (1 << 8) /* gap */ @@ -272,8 +281,21 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define R300_VAP_PVS_UPLOAD_ADDRESS 0x2200 # define R300_PVS_UPLOAD_PROGRAM 0x00000000 # define R300_PVS_UPLOAD_PARAMETERS 0x00000200 +# define R300_PVS_UPLOAD_CLIP_PLANE0 0x00000400 +# define R300_PVS_UPLOAD_CLIP_PLANE1 0x00000401 +# define R300_PVS_UPLOAD_CLIP_PLANE2 0x00000402 +# define R300_PVS_UPLOAD_CLIP_PLANE3 0x00000403 +# define R300_PVS_UPLOAD_CLIP_PLANE4 0x00000404 +# define R300_PVS_UPLOAD_CLIP_PLANE5 0x00000405 # define R300_PVS_UPLOAD_POINTSIZE 0x00000406 +# define R500_PVS_UPLOAD_CLIP_PLANE0 0x00000600 +# define R500_PVS_UPLOAD_CLIP_PLANE1 0x00000601 +# define R500_PVS_UPLOAD_CLIP_PLANE2 0x00000602 +# define R500_PVS_UPLOAD_CLIP_PLANE3 0x00000603 +# define R500_PVS_UPLOAD_CLIP_PLANE4 0x00000604 +# define R500_PVS_UPLOAD_CLIP_PLANE5 0x00000605 + /* gap */ #define R300_VAP_PVS_UPLOAD_DATA 0x2208 @@ -285,10 +307,16 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* I do not know the purpose of this register. However, I do know that * it is set to 221C_CLEAR for clear operations and to 221C_NORMAL * for normal rendering. + * + * 2007-11-05: This register is the user clip plane control register, but there + * also seems to be a rendering mode control; the NORMAL/CLEAR defines. + * + * See bug #9871. http://bugs.freedesktop.org/attachment.cgi?id=10672&action=view */ -#define R300_VAP_UNKNOWN_221C 0x221C +#define R300_VAP_CLIP_CNTL 0x221C # define R300_221C_NORMAL 0x00000000 # define R300_221C_CLEAR 0x0001C000 +#define R300_VAP_UCP_ENABLE_0 (1 << 0) /* gap */ @@ -319,7 +347,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * Most likely this is used to ignore rest of the program in cases * where group of verts arent visible. For some reason this "section" * is sometimes accepted other instruction that have no relationship with - *position calculations. + *position calculations. */ #define R300_VAP_PVS_CNTL_1 0x22D0 # define R300_PVS_CNTL_1_PROGRAM_START_SHIFT 0 @@ -481,6 +509,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_GB_W_SELECT_1 (1<<4) #define R300_GB_AA_CONFIG 0x4020 +# define R300_AA_DISABLE 0x00 # define R300_AA_ENABLE 0x01 # define R300_AA_SUBSAMPLES_2 0 # define R300_AA_SUBSAMPLES_3 (1<<1) @@ -491,6 +520,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* Zero to flush caches. */ #define R300_TX_CNTL 0x4100 +#define R300_TX_FLUSH 0x0 /* The upper enable bits are guessed, based on fglrx reported limits. */ #define R300_TX_ENABLE 0x4104 @@ -538,6 +568,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* Some sort of scale or clamp value for texcoordless textures. */ #define R300_RE_UNK4238 0x4238 +/* Something shade related */ +#define R300_RE_SHADE 0x4274 + #define R300_RE_SHADE_MODEL 0x4278 # define R300_RE_SHADE_MODEL_SMOOTH 0x3aaaa # define R300_RE_SHADE_MODEL_FLAT 0x39595 @@ -556,12 +589,13 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define R300_RE_FOG_SCALE 0x4294 #define R300_RE_FOG_START 0x4298 -/* Not sure why there are duplicate of factor and constant values. - * My best guess so far is that there are seperate zbiases for test and write. +/* Not sure why there are duplicate of factor and constant values. + * My best guess so far is that there are seperate zbiases for test and write. * Ordering might be wrong. * Some of the tests indicate that fgl has a fallback implementation of zbias * via pixel shaders. */ +#define R300_RE_ZBIAS_CNTL 0x42A0 /* GUESS */ #define R300_RE_ZBIAS_T_FACTOR 0x42A4 #define R300_RE_ZBIAS_T_CONSTANT 0x42A8 #define R300_RE_ZBIAS_W_FACTOR 0x42AC @@ -658,6 +692,11 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* Special handling for color: When the fragment program uses color, * the ROUTE_0_COLOR bit is set and ROUTE_0_COLOR_DEST contains the * color register index. + * + * Apperently you may set the R300_RS_ROUTE_0_COLOR bit, but not provide any + * R300_RS_ROUTE_0_COLOR_DEST value; this setup is used for clearing the state. + * See r300_ioctl.c:r300EmitClearState. I'm not sure if this setup is strictly + * correct or not. - Oliver. */ # define R300_RS_ROUTE_0_COLOR (1 << 14) # define R300_RS_ROUTE_0_COLOR_DEST_SHIFT 17 @@ -898,7 +937,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* 32 bit chroma key */ #define R300_TX_CHROMA_KEY_0 0x4580 /* ff00ff00 == { 0, 1.0, 0, 1.0 } */ -#define R300_TX_BORDER_COLOR_0 0x45C0 +#define R300_TX_BORDER_COLOR_0 0x45C0 /* END: Texture specification */ @@ -988,6 +1027,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_FPITX_OP_KIL 2 # define R300_FPITX_OP_TXP 3 # define R300_FPITX_OP_TXB 4 +# define R300_FPITX_OPCODE_MASK (7 << 15) /* ALU * The ALU instructions register blocks are enumerated according to the order @@ -1001,6 +1041,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * - DP4: Use OUTC_DP4, OUTA_DP4 * - DP3: Use OUTC_DP3, OUTA_DP4, appropriate alpha operands * - DPH: Use OUTC_DP4, OUTA_DP4, appropriate alpha operands + * - CMPH: If ARG2 > 0.5, return ARG0, else return ARG1 * - CMP: If ARG2 < 0, return ARG1, else return ARG0 * - FLR: use FRC+MAD * - XPD: use MAD+MAD @@ -1035,7 +1076,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * WRT swizzling. If, for example, you want to load an R component into an * Alpha operand, this R component is taken from a *color* source, not from * an alpha source. The corresponding register doesn't even have to appear in - * the alpha sources list. (I hope this alll makes sense to you) + * the alpha sources list. (I hope this all makes sense to you) * * Destination selection * The destination register index is in FPI1 (color) and FPI3 (alpha) @@ -1062,6 +1103,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_FPI1_SRC2C_SHIFT 12 # define R300_FPI1_SRC2C_MASK (31 << 12) # define R300_FPI1_SRC2C_CONST (1 << 17) +# define R300_FPI1_SRC_MASK 0x0003ffff # define R300_FPI1_DSTC_SHIFT 18 # define R300_FPI1_DSTC_MASK (31 << 18) # define R300_FPI1_DSTC_REG_MASK_SHIFT 23 @@ -1083,6 +1125,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_FPI3_SRC2A_SHIFT 12 # define R300_FPI3_SRC2A_MASK (31 << 12) # define R300_FPI3_SRC2A_CONST (1 << 17) +# define R300_FPI3_SRC_MASK 0x0003ffff # define R300_FPI3_DSTA_SHIFT 18 # define R300_FPI3_DSTA_MASK (31 << 18) # define R300_FPI3_DSTA_REG (1 << 23) @@ -1138,6 +1181,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_FPI0_OUTC_DP4 (2 << 23) # define R300_FPI0_OUTC_MIN (4 << 23) # define R300_FPI0_OUTC_MAX (5 << 23) +# define R300_FPI0_OUTC_CMPH (7 << 23) # define R300_FPI0_OUTC_CMP (8 << 23) # define R300_FPI0_OUTC_FRC (9 << 23) # define R300_FPI0_OUTC_REPL_ALPHA (10 << 23) @@ -1271,6 +1315,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_BLEND_MASK (63) # define R300_SRC_BLEND_SHIFT (16) # define R300_DST_BLEND_SHIFT (24) +#define R300_RB3D_BLEND_COLOR 0x4E10 #define R300_RB3D_COLORMASK 0x4E0C # define R300_COLORMASK0_B (1<<0) # define R300_COLORMASK0_G (1<<1) @@ -1310,8 +1355,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * Set to 0A before 3D operations, set to 02 afterwards. */ #define R300_RB3D_DSTCACHE_CTLSTAT 0x4E4C -# define R300_RB3D_DSTCACHE_02 0x00000002 -# define R300_RB3D_DSTCACHE_0A 0x0000000A +# define R300_RB3D_DSTCACHE_UNKNOWN_02 0x00000002 +# define R300_RB3D_DSTCACHE_UNKNOWN_0A 0x0000000A /* gap */ /* There seems to be no "write only" setting, so use Z-test = ALWAYS @@ -1376,6 +1421,16 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* 16 bit format or some aditional bit ? */ # define R300_DEPTH_FORMAT_UNK32 (32 << 0) +#define R300_RB3D_EARLY_Z 0x4F14 +# define R300_EARLY_Z_DISABLE (0 << 0) +# define R300_EARLY_Z_ENABLE (1 << 0) + +/* gap */ + +#define R300_RB3D_ZCACHE_CTLSTAT 0x4F18 /* GUESS */ +# define R300_RB3D_ZCACHE_UNKNOWN_01 0x1 +# define R300_RB3D_ZCACHE_UNKNOWN_03 0x3 + /* gap */ #define R300_RB3D_DEPTHOFFSET 0x4F20 @@ -1526,6 +1581,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define R300_PRIM_COLOR_ORDER_BGRA (0 << 6) #define R300_PRIM_COLOR_ORDER_RGBA (1 << 6) #define R300_PRIM_NUM_VERTICES_SHIFT 16 +#define R300_PRIM_NUM_VERTICES_MASK 0xffff /* Draw a primitive from vertex data in arrays loaded via 3D_LOAD_VBPNTR. * Two parameter dwords: @@ -1574,5 +1630,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define R300_CP_CMD_BITBLT_MULTI 0xC0009B00 - #endif /* _R300_REG_H */ + +/* *INDENT-ON* */ diff --git a/dist/Mesa/src/mesa/drivers/dri/r300/r300_state.c b/dist/Mesa/src/mesa/drivers/dri/r300/r300_state.c index bac1bef96..2aaf041d6 100644 --- a/dist/Mesa/src/mesa/drivers/dri/r300/r300_state.c +++ b/dist/Mesa/src/mesa/drivers/dri/r300/r300_state.c @@ -29,9 +29,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* - * Authors: - * Nicolai Haehnle <prefect_@gmx.net> +/** + * \file + * + * \author Nicolai Haehnle <prefect_@gmx.net> */ #include "glheader.h" @@ -46,7 +47,9 @@ 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 "shader/prog_parameter.h" +#include "shader/prog_statevars.h" +#include "vbo/vbo.h" #include "tnl/tnl.h" #include "texformat.h" @@ -56,11 +59,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_ioctl.h" #include "r300_state.h" #include "r300_reg.h" -#include "r300_program.h" #include "r300_emit.h" #include "r300_fragprog.h" #include "r300_tex.h" -#include "r300_maos.h" #include "drirenderbuffer.h" @@ -69,15 +70,15 @@ static void r300BlendColor(GLcontext * ctx, const GLfloat cf[4]) GLubyte color[4]; r300ContextPtr rmesa = R300_CONTEXT(ctx); - R300_STATECHANGE(rmesa, unk4E10); + R300_STATECHANGE(rmesa, blend_color); CLAMPED_FLOAT_TO_UBYTE(color[0], cf[0]); CLAMPED_FLOAT_TO_UBYTE(color[1], cf[1]); CLAMPED_FLOAT_TO_UBYTE(color[2], cf[2]); CLAMPED_FLOAT_TO_UBYTE(color[3], cf[3]); - rmesa->hw.unk4E10.cmd[1] = r300PackColor(4, color[3], color[0], - color[1], color[2]); + rmesa->hw.blend_color.cmd[1] = PACK_COLOR_8888(color[3], color[0], + color[1], color[2]); } /** @@ -96,60 +97,58 @@ static void r300BlendColor(GLcontext * ctx, const GLfloat cf[4]) */ static int blend_factor(GLenum factor, GLboolean is_src) { - int func; - switch (factor) { case GL_ZERO: - func = R300_BLEND_GL_ZERO; + return R300_BLEND_GL_ZERO; break; case GL_ONE: - func = R300_BLEND_GL_ONE; + return R300_BLEND_GL_ONE; break; case GL_DST_COLOR: - func = R300_BLEND_GL_DST_COLOR; + return R300_BLEND_GL_DST_COLOR; break; case GL_ONE_MINUS_DST_COLOR: - func = R300_BLEND_GL_ONE_MINUS_DST_COLOR; + return R300_BLEND_GL_ONE_MINUS_DST_COLOR; break; case GL_SRC_COLOR: - func = R300_BLEND_GL_SRC_COLOR; + return R300_BLEND_GL_SRC_COLOR; break; case GL_ONE_MINUS_SRC_COLOR: - func = R300_BLEND_GL_ONE_MINUS_SRC_COLOR; + return R300_BLEND_GL_ONE_MINUS_SRC_COLOR; break; case GL_SRC_ALPHA: - func = R300_BLEND_GL_SRC_ALPHA; + return R300_BLEND_GL_SRC_ALPHA; break; case GL_ONE_MINUS_SRC_ALPHA: - func = R300_BLEND_GL_ONE_MINUS_SRC_ALPHA; + return R300_BLEND_GL_ONE_MINUS_SRC_ALPHA; break; case GL_DST_ALPHA: - func = R300_BLEND_GL_DST_ALPHA; + return R300_BLEND_GL_DST_ALPHA; break; case GL_ONE_MINUS_DST_ALPHA: - func = R300_BLEND_GL_ONE_MINUS_DST_ALPHA; + return R300_BLEND_GL_ONE_MINUS_DST_ALPHA; break; case GL_SRC_ALPHA_SATURATE: - func = (is_src) ? R300_BLEND_GL_SRC_ALPHA_SATURATE : - R300_BLEND_GL_ZERO; + return (is_src) ? R300_BLEND_GL_SRC_ALPHA_SATURATE : + R300_BLEND_GL_ZERO; break; case GL_CONSTANT_COLOR: - func = R300_BLEND_GL_CONST_COLOR; + return R300_BLEND_GL_CONST_COLOR; break; case GL_ONE_MINUS_CONSTANT_COLOR: - func = R300_BLEND_GL_ONE_MINUS_CONST_COLOR; + return R300_BLEND_GL_ONE_MINUS_CONST_COLOR; break; case GL_CONSTANT_ALPHA: - func = R300_BLEND_GL_CONST_ALPHA; + return R300_BLEND_GL_CONST_ALPHA; break; case GL_ONE_MINUS_CONSTANT_ALPHA: - func = R300_BLEND_GL_ONE_MINUS_CONST_ALPHA; + return R300_BLEND_GL_ONE_MINUS_CONST_ALPHA; break; default: fprintf(stderr, "unknown blend factor %x\n", factor); - func = (is_src) ? R300_BLEND_GL_ONE : R300_BLEND_GL_ZERO; + return (is_src) ? R300_BLEND_GL_ONE : R300_BLEND_GL_ZERO; + break; } - return func; } /** @@ -164,12 +163,15 @@ static int blend_factor(GLenum factor, GLboolean is_src) */ /* helper function */ -static void r300_set_blend_cntl(r300ContextPtr r300, int func, int eqn, int cbits, int funcA, int eqnA) +static void r300SetBlendCntl(r300ContextPtr r300, int func, int eqn, + int cbits, int funcA, int eqnA) { GLuint new_ablend, new_cblend; #if 0 - fprintf(stderr, "eqnA=%08x funcA=%08x eqn=%08x func=%08x cbits=%08x\n", eqnA, funcA, eqn, func, cbits); + fprintf(stderr, + "eqnA=%08x funcA=%08x eqn=%08x func=%08x cbits=%08x\n", + eqnA, funcA, eqn, func, cbits); #endif new_ablend = eqnA | funcA; new_cblend = eqn | func; @@ -182,21 +184,20 @@ static void r300_set_blend_cntl(r300ContextPtr r300, int func, int eqn, int cbit */ #if 0 if (new_ablend == new_cblend) { - new_cblend |= R300_BLEND_NO_SEPARATE; + new_cblend |= R300_BLEND_NO_SEPARATE; } #endif new_cblend |= cbits; - if((new_ablend != r300->hw.bld.cmd[R300_BLD_ABLEND]) || - (new_cblend != r300->hw.bld.cmd[R300_BLD_CBLEND])) { + if ((new_ablend != r300->hw.bld.cmd[R300_BLD_ABLEND]) || + (new_cblend != r300->hw.bld.cmd[R300_BLD_CBLEND])) { R300_STATECHANGE(r300, bld); - r300->hw.bld.cmd[R300_BLD_ABLEND]=new_ablend; - r300->hw.bld.cmd[R300_BLD_CBLEND]=new_cblend; + r300->hw.bld.cmd[R300_BLD_ABLEND] = new_ablend; + r300->hw.bld.cmd[R300_BLD_CBLEND] = new_cblend; } } - -static void r300_set_blend_state(GLcontext * ctx) +static void r300SetBlendState(GLcontext * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); int func = (R300_BLEND_GL_ONE << R300_SRC_BLEND_SHIFT) | @@ -206,15 +207,16 @@ static void r300_set_blend_state(GLcontext * ctx) (R300_BLEND_GL_ZERO << R300_DST_BLEND_SHIFT); int eqnA = R300_COMB_FCN_ADD_CLAMP; - if (ctx->Color._LogicOpEnabled || !ctx->Color.BlendEnabled) { - r300_set_blend_cntl(r300, - func, eqn, 0, - func, eqn); + if (RGBA_LOGICOP_ENABLED(ctx) || !ctx->Color.BlendEnabled) { + r300SetBlendCntl(r300, func, eqn, 0, func, eqn); return; } - func = (blend_factor(ctx->Color.BlendSrcRGB, GL_TRUE) << R300_SRC_BLEND_SHIFT) | - (blend_factor(ctx->Color.BlendDstRGB, GL_FALSE) << R300_DST_BLEND_SHIFT); + func = + (blend_factor(ctx->Color.BlendSrcRGB, GL_TRUE) << + R300_SRC_BLEND_SHIFT) | (blend_factor(ctx->Color.BlendDstRGB, + GL_FALSE) << + R300_DST_BLEND_SHIFT); switch (ctx->Color.BlendEquationRGB) { case GL_FUNC_ADD: @@ -244,13 +246,15 @@ static void r300_set_blend_state(GLcontext * ctx) default: fprintf(stderr, "[%s:%u] Invalid RGB blend equation (0x%04x).\n", - __func__, __LINE__, ctx->Color.BlendEquationRGB); + __FUNCTION__, __LINE__, ctx->Color.BlendEquationRGB); return; } - - funcA = (blend_factor(ctx->Color.BlendSrcA, GL_TRUE) << R300_SRC_BLEND_SHIFT) | - (blend_factor(ctx->Color.BlendDstA, GL_FALSE) << R300_DST_BLEND_SHIFT); + funcA = + (blend_factor(ctx->Color.BlendSrcA, GL_TRUE) << + R300_SRC_BLEND_SHIFT) | (blend_factor(ctx->Color.BlendDstA, + GL_FALSE) << + R300_DST_BLEND_SHIFT); switch (ctx->Color.BlendEquationA) { case GL_FUNC_ADD: @@ -278,33 +282,34 @@ static void r300_set_blend_state(GLcontext * ctx) break; default: - fprintf(stderr, "[%s:%u] Invalid A blend equation (0x%04x).\n", - __func__, __LINE__, ctx->Color.BlendEquationA); + fprintf(stderr, + "[%s:%u] Invalid A blend equation (0x%04x).\n", + __FUNCTION__, __LINE__, ctx->Color.BlendEquationA); return; } - r300_set_blend_cntl(r300, - func, eqn, R300_BLEND_UNKNOWN | R300_BLEND_ENABLE, - funcA, eqnA); + r300SetBlendCntl(r300, + func, eqn, + R300_BLEND_UNKNOWN | R300_BLEND_ENABLE, funcA, eqnA); } static void r300BlendEquationSeparate(GLcontext * ctx, GLenum modeRGB, GLenum modeA) { - r300_set_blend_state(ctx); + r300SetBlendState(ctx); } static void r300BlendFuncSeparate(GLcontext * ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA) { - r300_set_blend_state(ctx); + r300SetBlendState(ctx); } /** * Update our tracked culling state based on Mesa's state. */ -static void r300UpdateCulling(GLcontext* ctx) +static void r300UpdateCulling(GLcontext * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); uint32_t val = 0; @@ -312,7 +317,7 @@ static void r300UpdateCulling(GLcontext* ctx) R300_STATECHANGE(r300, cul); if (ctx->Polygon.CullFlag) { if (ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK) - val = R300_CULL_FRONT|R300_CULL_BACK; + val = R300_CULL_FRONT | R300_CULL_BACK; else if (ctx->Polygon.CullFaceMode == GL_FRONT) val = R300_CULL_FRONT; else @@ -326,30 +331,30 @@ static void r300UpdateCulling(GLcontext* ctx) r300->hw.cul.cmd[R300_CUL_CULL] = val; } -static void update_early_z(GLcontext *ctx) +static void r300SetEarlyZState(GLcontext * ctx) { - /* updates register 0x4f14 - if depth test is not enabled it should be 0x00000000 - if depth is enabled and alpha not it should be 0x00000001 - if depth and alpha is enabled it should be 0x00000000 - */ + /* updates register R300_RB3D_EARLY_Z (0x4F14) + if depth test is not enabled it should be R300_EARLY_Z_DISABLE + if depth is enabled and alpha not it should be R300_EARLY_Z_ENABLE + if depth and alpha is enabled it should be R300_EARLY_Z_DISABLE + */ r300ContextPtr r300 = R300_CONTEXT(ctx); - R300_STATECHANGE(r300, unk4F10); + R300_STATECHANGE(r300, zstencil_format); if (ctx->Color.AlphaEnabled && ctx->Color.AlphaFunc != GL_ALWAYS) /* disable early Z */ - r300->hw.unk4F10.cmd[2] = 0x00000000; + r300->hw.zstencil_format.cmd[2] = R300_EARLY_Z_DISABLE; else { if (ctx->Depth.Test && ctx->Depth.Func != GL_NEVER) /* enable early Z */ - r300->hw.unk4F10.cmd[2] = 0x00000001; + r300->hw.zstencil_format.cmd[2] = R300_EARLY_Z_ENABLE; else /* disable early Z */ - r300->hw.unk4F10.cmd[2] = 0x00000000; + r300->hw.zstencil_format.cmd[2] = R300_EARLY_Z_DISABLE; } } -static void update_alpha(GLcontext *ctx) +static void r300SetAlphaState(GLcontext * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); GLubyte refByte; @@ -357,7 +362,7 @@ static void update_alpha(GLcontext *ctx) GLboolean really_enabled = ctx->Color.AlphaEnabled; CLAMPED_FLOAT_TO_UBYTE(refByte, ctx->Color.AlphaRef); - + switch (ctx->Color.AlphaFunc) { case GL_NEVER: pp_misc |= R300_ALPHA_TEST_FAIL; @@ -381,29 +386,29 @@ static void update_alpha(GLcontext *ctx) pp_misc |= R300_ALPHA_TEST_GEQUAL; break; case GL_ALWAYS: - /*pp_misc |= R300_ALPHA_TEST_PASS;*/ + /*pp_misc |= R300_ALPHA_TEST_PASS; */ really_enabled = GL_FALSE; break; } - + if (really_enabled) { pp_misc |= R300_ALPHA_TEST_ENABLE; pp_misc |= (refByte & R300_REF_ALPHA_MASK); } else { pp_misc = 0x0; } - - + R300_STATECHANGE(r300, at); r300->hw.at.cmd[R300_AT_ALPHA_TEST] = pp_misc; - update_early_z(ctx); + + r300SetEarlyZState(ctx); } static void r300AlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref) { - (void) func; - (void) ref; - update_alpha(ctx); + (void)func; + (void)ref; + r300SetAlphaState(ctx); } static int translate_func(int func) @@ -429,39 +434,45 @@ static int translate_func(int func) return 0; } -static void update_depth(GLcontext* ctx) +static void r300SetDepthState(GLcontext * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); R300_STATECHANGE(r300, zs); r300->hw.zs.cmd[R300_ZS_CNTL_0] &= R300_RB3D_STENCIL_ENABLE; - r300->hw.zs.cmd[R300_ZS_CNTL_1] &= ~(R300_ZS_MASK << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT); - + r300->hw.zs.cmd[R300_ZS_CNTL_1] &= + ~(R300_ZS_MASK << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT); + if (ctx->Depth.Test && ctx->Depth.Func != GL_NEVER) { if (ctx->Depth.Mask) - r300->hw.zs.cmd[R300_ZS_CNTL_0] |= R300_RB3D_Z_TEST_AND_WRITE; + r300->hw.zs.cmd[R300_ZS_CNTL_0] |= + R300_RB3D_Z_TEST_AND_WRITE; else r300->hw.zs.cmd[R300_ZS_CNTL_0] |= R300_RB3D_Z_TEST; - - r300->hw.zs.cmd[R300_ZS_CNTL_1] |= translate_func(ctx->Depth.Func) << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT; + + r300->hw.zs.cmd[R300_ZS_CNTL_1] |= + translate_func(ctx->Depth. + Func) << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT; } else { r300->hw.zs.cmd[R300_ZS_CNTL_0] |= R300_RB3D_Z_DISABLED_1; - r300->hw.zs.cmd[R300_ZS_CNTL_1] |= translate_func(GL_NEVER) << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT; + r300->hw.zs.cmd[R300_ZS_CNTL_1] |= + translate_func(GL_NEVER) << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT; } - - update_early_z(ctx); + + r300SetEarlyZState(ctx); } +static void r300ClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq ); + /** * Handle glEnable()/glDisable(). * * \note Mesa already filters redundant calls to glEnable/glDisable. */ -static void r300Enable(GLcontext* ctx, GLenum cap, GLboolean state) +static void r300Enable(GLcontext * ctx, GLenum cap, GLboolean state) { r300ContextPtr r300 = R300_CONTEXT(ctx); - uint32_t newval; - + GLuint p; if (RADEON_DEBUG & DEBUG_STATE) fprintf(stderr, "%s( %s = %s )\n", __FUNCTION__, _mesa_lookup_enum_by_nr(cap), @@ -478,39 +489,58 @@ static void r300Enable(GLcontext* ctx, GLenum cap, GLboolean state) case GL_FOG: R300_STATECHANGE(r300, fogs); if (state) { - r300->hw.fogs.cmd[R300_FOGS_STATE] |= - R300_FOG_ENABLE; - - ctx->Driver.Fogfv( ctx, GL_FOG_MODE, NULL ); - ctx->Driver.Fogfv( ctx, GL_FOG_DENSITY, &ctx->Fog.Density ); - ctx->Driver.Fogfv( ctx, GL_FOG_START, &ctx->Fog.Start ); - ctx->Driver.Fogfv( ctx, GL_FOG_END, &ctx->Fog.End ); - ctx->Driver.Fogfv( ctx, GL_FOG_COLOR, ctx->Fog.Color ); + r300->hw.fogs.cmd[R300_FOGS_STATE] |= R300_FOG_ENABLE; + + ctx->Driver.Fogfv(ctx, GL_FOG_MODE, NULL); + ctx->Driver.Fogfv(ctx, GL_FOG_DENSITY, + &ctx->Fog.Density); + ctx->Driver.Fogfv(ctx, GL_FOG_START, &ctx->Fog.Start); + ctx->Driver.Fogfv(ctx, GL_FOG_END, &ctx->Fog.End); + ctx->Driver.Fogfv(ctx, GL_FOG_COLOR, ctx->Fog.Color); } else { - r300->hw.fogs.cmd[R300_FOGS_STATE] &= - ~R300_FOG_ENABLE; + r300->hw.fogs.cmd[R300_FOGS_STATE] &= ~R300_FOG_ENABLE; } - + break; case GL_ALPHA_TEST: - update_alpha(ctx); + r300SetAlphaState(ctx); break; case GL_BLEND: case GL_COLOR_LOGIC_OP: - r300_set_blend_state(ctx); + r300SetBlendState(ctx); break; + + case GL_CLIP_PLANE0: + case GL_CLIP_PLANE1: + case GL_CLIP_PLANE2: + case GL_CLIP_PLANE3: + case GL_CLIP_PLANE4: + case GL_CLIP_PLANE5: + /* no VAP UCP on non-TCL chipsets */ + if (!(r300->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL)) + return; + + p = cap-GL_CLIP_PLANE0; + R300_STATECHANGE( r300, vap_clip_cntl ); + if (state) { + r300->hw.vap_clip_cntl.cmd[1] |= (R300_VAP_UCP_ENABLE_0<<p); + r300ClipPlane( ctx, cap, NULL ); + } + else { + r300->hw.vap_clip_cntl.cmd[1] &= ~(R300_VAP_UCP_ENABLE_0<<p); + } + break; case GL_DEPTH_TEST: - update_depth(ctx); + r300SetDepthState(ctx); break; case GL_STENCIL_TEST: if (r300->state.stencil.hw_stencil) { R300_STATECHANGE(r300, zs); if (state) { - WARN_ONCE("TODO - double side stencil !\n"); r300->hw.zs.cmd[R300_ZS_CNTL_0] |= R300_RB3D_STENCIL_ENABLE; } else { @@ -520,7 +550,7 @@ static void r300Enable(GLcontext* ctx, GLenum cap, GLboolean state) } else { #if R200_MERGED FALLBACK(&r300->radeon, RADEON_FALLBACK_STENCIL, state); -#endif +#endif } break; @@ -533,11 +563,11 @@ static void r300Enable(GLcontext* ctx, GLenum cap, GLboolean state) break; case GL_POLYGON_OFFSET_FILL: - R300_STATECHANGE(r300, unk42B4); - if(state){ - r300->hw.unk42B4.cmd[1] |= (3<<0); + R300_STATECHANGE(r300, occlusion_cntl); + if (state) { + r300->hw.occlusion_cntl.cmd[1] |= (3 << 0); } else { - r300->hw.unk42B4.cmd[1] &= ~(3<<0); + r300->hw.occlusion_cntl.cmd[1] &= ~(3 << 0); } break; default: @@ -546,16 +576,15 @@ static void r300Enable(GLcontext* ctx, GLenum cap, GLboolean state) } } - -static void r300UpdatePolygonMode(GLcontext *ctx) +static void r300UpdatePolygonMode(GLcontext * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); - uint32_t hw_mode=0; + uint32_t hw_mode = 0; if (ctx->Polygon.FrontMode != GL_FILL || ctx->Polygon.BackMode != GL_FILL) { GLenum f, b; - + if (ctx->Polygon.FrontFace == GL_CCW) { f = ctx->Polygon.FrontMode; b = ctx->Polygon.BackMode; @@ -569,31 +598,31 @@ static void r300UpdatePolygonMode(GLcontext *ctx) switch (f) { case GL_LINE: hw_mode |= R300_PM_FRONT_LINE; - break; - case GL_POINT: /* noop */ + break; + case GL_POINT: /* noop */ hw_mode |= R300_PM_FRONT_POINT; - break; + break; case GL_FILL: hw_mode |= R300_PM_FRONT_FILL; - break; + break; } switch (b) { case GL_LINE: hw_mode |= R300_PM_BACK_LINE; - break; - case GL_POINT: /* noop */ + break; + case GL_POINT: /* noop */ hw_mode |= R300_PM_BACK_POINT; - break; + break; case GL_FILL: hw_mode |= R300_PM_BACK_FILL; - break; + break; } } - if (r300->hw.unk4288.cmd[1] != hw_mode) { - R300_STATECHANGE(r300, unk4288); - r300->hw.unk4288.cmd[1] = hw_mode; + if (r300->hw.polygon_mode.cmd[1] != hw_mode) { + R300_STATECHANGE(r300, polygon_mode); + r300->hw.polygon_mode.cmd[1] = hw_mode; } } @@ -602,20 +631,19 @@ static void r300UpdatePolygonMode(GLcontext *ctx) * * \note Mesa already filters redundant calls to this function. */ -static void r300CullFace(GLcontext* ctx, GLenum mode) +static void r300CullFace(GLcontext * ctx, GLenum mode) { (void)mode; r300UpdateCulling(ctx); } - /** * Change the polygon orientation. * * \note Mesa already filters redundant calls to this function. */ -static void r300FrontFace(GLcontext* ctx, GLenum mode) +static void r300FrontFace(GLcontext * ctx, GLenum mode) { (void)mode; @@ -623,42 +651,38 @@ static void r300FrontFace(GLcontext* ctx, GLenum mode) r300UpdatePolygonMode(ctx); } - /** * Change the depth testing function. * * \note Mesa already filters redundant calls to this function. */ -static void r300DepthFunc(GLcontext* ctx, GLenum func) +static void r300DepthFunc(GLcontext * ctx, GLenum func) { - (void) func; - update_depth(ctx); + (void)func; + r300SetDepthState(ctx); } - /** * Enable/Disable depth writing. * * \note Mesa already filters redundant calls to this function. */ -static void r300DepthMask(GLcontext* ctx, GLboolean mask) +static void r300DepthMask(GLcontext * ctx, GLboolean mask) { - (void) mask; - update_depth(ctx); + (void)mask; + r300SetDepthState(ctx); } - /** * Handle glColorMask() */ -static void r300ColorMask(GLcontext* ctx, +static void r300ColorMask(GLcontext * ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a) { r300ContextPtr r300 = R300_CONTEXT(ctx); int mask = (r ? R300_COLORMASK0_R : 0) | - (g ? R300_COLORMASK0_G : 0) | - (b ? R300_COLORMASK0_B : 0) | - (a ? R300_COLORMASK0_A : 0); + (g ? R300_COLORMASK0_G : 0) | + (b ? R300_COLORMASK0_B : 0) | (a ? R300_COLORMASK0_A : 0); if (mask != r300->hw.cmk.cmd[R300_CMK_COLORMASK]) { R300_STATECHANGE(r300, cmk); @@ -669,13 +693,16 @@ static void r300ColorMask(GLcontext* ctx, /* ============================================================= * Fog */ -static void r300Fogfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) +static void r300Fogfv(GLcontext * ctx, GLenum pname, const GLfloat * param) { r300ContextPtr r300 = R300_CONTEXT(ctx); - union { int i; float f; } fogScale, fogStart; - - (void) param; - + union { + int i; + float f; + } fogScale, fogStart; + + (void)param; + fogScale.i = r300->hw.fogp.cmd[R300_FOGP_SCALE]; fogStart.i = r300->hw.fogp.cmd[R300_FOGP_START]; @@ -687,29 +714,37 @@ static void r300Fogfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) case GL_LINEAR: R300_STATECHANGE(r300, fogs); r300->hw.fogs.cmd[R300_FOGS_STATE] = - (r300->hw.fogs.cmd[R300_FOGS_STATE] & ~R300_FOG_MODE_MASK) | R300_FOG_MODE_LINEAR; + (r300->hw.fogs. + cmd[R300_FOGS_STATE] & ~R300_FOG_MODE_MASK) | + R300_FOG_MODE_LINEAR; if (ctx->Fog.Start == ctx->Fog.End) { fogScale.f = -1.0; fogStart.f = 1.0; - } - else { - fogScale.f = 1.0 / (ctx->Fog.End-ctx->Fog.Start); - fogStart.f = -ctx->Fog.Start / (ctx->Fog.End-ctx->Fog.Start); + } else { + fogScale.f = + 1.0 / (ctx->Fog.End - ctx->Fog.Start); + fogStart.f = + -ctx->Fog.Start / (ctx->Fog.End - + ctx->Fog.Start); } break; case GL_EXP: R300_STATECHANGE(r300, fogs); r300->hw.fogs.cmd[R300_FOGS_STATE] = - (r300->hw.fogs.cmd[R300_FOGS_STATE] & ~R300_FOG_MODE_MASK) | R300_FOG_MODE_EXP; - fogScale.f = 0.0933*ctx->Fog.Density; + (r300->hw.fogs. + cmd[R300_FOGS_STATE] & ~R300_FOG_MODE_MASK) | + R300_FOG_MODE_EXP; + fogScale.f = 0.0933 * ctx->Fog.Density; fogStart.f = 0.0; break; case GL_EXP2: R300_STATECHANGE(r300, fogs); r300->hw.fogs.cmd[R300_FOGS_STATE] = - (r300->hw.fogs.cmd[R300_FOGS_STATE] & ~R300_FOG_MODE_MASK) | R300_FOG_MODE_EXP2; - fogScale.f = 0.3*ctx->Fog.Density; + (r300->hw.fogs. + cmd[R300_FOGS_STATE] & ~R300_FOG_MODE_MASK) | + R300_FOG_MODE_EXP2; + fogScale.f = 0.3 * ctx->Fog.Density; fogStart.f = 0.0; default: return; @@ -718,11 +753,11 @@ static void r300Fogfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) case GL_FOG_DENSITY: switch (ctx->Fog.Mode) { case GL_EXP: - fogScale.f = 0.0933*ctx->Fog.Density; + fogScale.f = 0.0933 * ctx->Fog.Density; fogStart.f = 0.0; break; case GL_EXP2: - fogScale.f = 0.3*ctx->Fog.Density; + fogScale.f = 0.3 * ctx->Fog.Density; fogStart.f = 0.0; default: break; @@ -734,18 +769,23 @@ static void r300Fogfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) if (ctx->Fog.Start == ctx->Fog.End) { fogScale.f = -1.0; fogStart.f = 1.0; - } - else { - fogScale.f = 1.0 / (ctx->Fog.End-ctx->Fog.Start); - fogStart.f = -ctx->Fog.Start / (ctx->Fog.End-ctx->Fog.Start); + } else { + fogScale.f = + 1.0 / (ctx->Fog.End - ctx->Fog.Start); + fogStart.f = + -ctx->Fog.Start / (ctx->Fog.End - + ctx->Fog.Start); } } break; case GL_FOG_COLOR: R300_STATECHANGE(r300, fogc); - r300->hw.fogc.cmd[R300_FOGC_R] = (GLuint) (ctx->Fog.Color[0]*1023.0F) & 0x3FF; - r300->hw.fogc.cmd[R300_FOGC_G] = (GLuint) (ctx->Fog.Color[1]*1023.0F) & 0x3FF; - r300->hw.fogc.cmd[R300_FOGC_B] = (GLuint) (ctx->Fog.Color[2]*1023.0F) & 0x3FF; + r300->hw.fogc.cmd[R300_FOGC_R] = + (GLuint) (ctx->Fog.Color[0] * 1023.0F) & 0x3FF; + r300->hw.fogc.cmd[R300_FOGC_G] = + (GLuint) (ctx->Fog.Color[1] * 1023.0F) & 0x3FF; + r300->hw.fogc.cmd[R300_FOGC_B] = + (GLuint) (ctx->Fog.Color[2] * 1023.0F) & 0x3FF; break; case GL_FOG_COORD_SRC: break; @@ -771,15 +811,15 @@ static void r300PointSize(GLcontext * ctx, GLfloat size) size = ctx->Point._Size; R300_STATECHANGE(r300, ps); - r300->hw.ps.cmd[R300_PS_POINTSIZE] = - ((int)(size * 6) << R300_POINTSIZE_X_SHIFT) | - ((int)(size * 6) << R300_POINTSIZE_Y_SHIFT); + r300->hw.ps.cmd[R300_PS_POINTSIZE] = + ((int)(size * 6) << R300_POINTSIZE_X_SHIFT) | + ((int)(size * 6) << R300_POINTSIZE_Y_SHIFT); } /* ============================================================= * Line state */ -static void r300LineWidth(GLcontext *ctx, GLfloat widthf) +static void r300LineWidth(GLcontext * ctx, GLfloat widthf) { r300ContextPtr r300 = R300_CONTEXT(ctx); @@ -790,11 +830,11 @@ static void r300LineWidth(GLcontext *ctx, GLfloat widthf) r300->hw.lcntl.cmd[1] |= R300_LINE_CNT_VE; } -static void r300PolygonMode(GLcontext *ctx, GLenum face, GLenum mode) +static void r300PolygonMode(GLcontext * ctx, GLenum face, GLenum mode) { (void)face; (void)mode; - + r300UpdatePolygonMode(ctx); } @@ -831,14 +871,14 @@ static int translate_stencil_op(int op) static void r300ShadeModel(GLcontext * ctx, GLenum mode) { r300ContextPtr rmesa = R300_CONTEXT(ctx); - - R300_STATECHANGE(rmesa, unk4274); + + R300_STATECHANGE(rmesa, shade); switch (mode) { case GL_FLAT: - rmesa->hw.unk4274.cmd[2] = R300_RE_SHADE_MODEL_FLAT; + rmesa->hw.shade.cmd[2] = R300_RE_SHADE_MODEL_FLAT; break; case GL_SMOOTH: - rmesa->hw.unk4274.cmd[2] = R300_RE_SHADE_MODEL_SMOOTH; + rmesa->hw.shade.cmd[2] = R300_RE_SHADE_MODEL_SMOOTH; break; default: return; @@ -846,27 +886,42 @@ static void r300ShadeModel(GLcontext * ctx, GLenum mode) } static void r300StencilFuncSeparate(GLcontext * ctx, GLenum face, - GLenum func, GLint ref, GLuint mask) + GLenum func, GLint ref, GLuint mask) { r300ContextPtr rmesa = R300_CONTEXT(ctx); - GLuint refmask = (((ctx->Stencil.Ref[0] & 0xff) << R300_RB3D_ZS2_STENCIL_REF_SHIFT) | - ((ctx->Stencil.ValueMask[0] & 0xff) << R300_RB3D_ZS2_STENCIL_MASK_SHIFT)); - + GLuint refmask = + (((ctx->Stencil. + Ref[0] & 0xff) << R300_RB3D_ZS2_STENCIL_REF_SHIFT) | ((ctx-> + Stencil. + ValueMask + [0] & + 0xff) + << + R300_RB3D_ZS2_STENCIL_MASK_SHIFT)); + GLuint flag; R300_STATECHANGE(rmesa, zs); - rmesa->hw.zs.cmd[R300_ZS_CNTL_1] &= ~( - (R300_ZS_MASK << R300_RB3D_ZS1_FRONT_FUNC_SHIFT) - | (R300_ZS_MASK << R300_RB3D_ZS1_BACK_FUNC_SHIFT)); - - rmesa->hw.zs.cmd[R300_ZS_CNTL_2] &= ~((R300_RB3D_ZS2_STENCIL_MASK << R300_RB3D_ZS2_STENCIL_REF_SHIFT) | - (R300_RB3D_ZS2_STENCIL_MASK << R300_RB3D_ZS2_STENCIL_MASK_SHIFT)); - + rmesa->hw.zs.cmd[R300_ZS_CNTL_1] &= ~((R300_ZS_MASK << + R300_RB3D_ZS1_FRONT_FUNC_SHIFT) + | (R300_ZS_MASK << + R300_RB3D_ZS1_BACK_FUNC_SHIFT)); + + rmesa->hw.zs.cmd[R300_ZS_CNTL_2] &= + ~((R300_RB3D_ZS2_STENCIL_MASK << + R300_RB3D_ZS2_STENCIL_REF_SHIFT) | + (R300_RB3D_ZS2_STENCIL_MASK << R300_RB3D_ZS2_STENCIL_MASK_SHIFT)); + flag = translate_func(ctx->Stencil.Function[0]); + rmesa->hw.zs.cmd[R300_ZS_CNTL_1] |= + (flag << R300_RB3D_ZS1_FRONT_FUNC_SHIFT); - rmesa->hw.zs.cmd[R300_ZS_CNTL_1] |= (flag << R300_RB3D_ZS1_FRONT_FUNC_SHIFT) - | (flag << R300_RB3D_ZS1_BACK_FUNC_SHIFT); + if (ctx->Stencil._TestTwoSide) + flag = translate_func(ctx->Stencil.Function[1]); + + rmesa->hw.zs.cmd[R300_ZS_CNTL_1] |= + (flag << R300_RB3D_ZS1_BACK_FUNC_SHIFT); rmesa->hw.zs.cmd[R300_ZS_CNTL_2] |= refmask; } @@ -875,30 +930,51 @@ static void r300StencilMaskSeparate(GLcontext * ctx, GLenum face, GLuint mask) r300ContextPtr rmesa = R300_CONTEXT(ctx); R300_STATECHANGE(rmesa, zs); - rmesa->hw.zs.cmd[R300_ZS_CNTL_2] &= ~(R300_RB3D_ZS2_STENCIL_MASK << R300_RB3D_ZS2_STENCIL_WRITE_MASK_SHIFT); - rmesa->hw.zs.cmd[R300_ZS_CNTL_2] |= (ctx->Stencil.WriteMask[0] & 0xff) << R300_RB3D_ZS2_STENCIL_WRITE_MASK_SHIFT; + rmesa->hw.zs.cmd[R300_ZS_CNTL_2] &= + ~(R300_RB3D_ZS2_STENCIL_MASK << + R300_RB3D_ZS2_STENCIL_WRITE_MASK_SHIFT); + rmesa->hw.zs.cmd[R300_ZS_CNTL_2] |= + (ctx->Stencil. + WriteMask[0] & 0xff) << R300_RB3D_ZS2_STENCIL_WRITE_MASK_SHIFT; } - -static void r300StencilOpSeparate(GLcontext * ctx, GLenum face, GLenum fail, - GLenum zfail, GLenum zpass) +static void r300StencilOpSeparate(GLcontext * ctx, GLenum face, + GLenum fail, GLenum zfail, GLenum zpass) { r300ContextPtr rmesa = R300_CONTEXT(ctx); R300_STATECHANGE(rmesa, zs); - /* It is easier to mask what's left.. */ - rmesa->hw.zs.cmd[R300_ZS_CNTL_1] &= - (R300_ZS_MASK << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT) | - (R300_ZS_MASK << R300_RB3D_ZS1_FRONT_FUNC_SHIFT) | + /* It is easier to mask what's left.. */ + rmesa->hw.zs.cmd[R300_ZS_CNTL_1] &= + (R300_ZS_MASK << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT) | + (R300_ZS_MASK << R300_RB3D_ZS1_FRONT_FUNC_SHIFT) | (R300_ZS_MASK << R300_RB3D_ZS1_BACK_FUNC_SHIFT); rmesa->hw.zs.cmd[R300_ZS_CNTL_1] |= - (translate_stencil_op(ctx->Stencil.FailFunc[0]) << R300_RB3D_ZS1_FRONT_FAIL_OP_SHIFT) - |(translate_stencil_op(ctx->Stencil.ZFailFunc[0]) << R300_RB3D_ZS1_FRONT_ZFAIL_OP_SHIFT) - |(translate_stencil_op(ctx->Stencil.ZPassFunc[0]) << R300_RB3D_ZS1_FRONT_ZPASS_OP_SHIFT) - |(translate_stencil_op(ctx->Stencil.FailFunc[0]) << R300_RB3D_ZS1_BACK_FAIL_OP_SHIFT) - |(translate_stencil_op(ctx->Stencil.ZFailFunc[0]) << R300_RB3D_ZS1_BACK_ZFAIL_OP_SHIFT) - |(translate_stencil_op(ctx->Stencil.ZPassFunc[0]) << R300_RB3D_ZS1_BACK_ZPASS_OP_SHIFT); + (translate_stencil_op(ctx->Stencil.FailFunc[0]) << + R300_RB3D_ZS1_FRONT_FAIL_OP_SHIFT) + | (translate_stencil_op(ctx->Stencil.ZFailFunc[0]) << + R300_RB3D_ZS1_FRONT_ZFAIL_OP_SHIFT) + | (translate_stencil_op(ctx->Stencil.ZPassFunc[0]) << + R300_RB3D_ZS1_FRONT_ZPASS_OP_SHIFT); + + if (ctx->Stencil._TestTwoSide) { + rmesa->hw.zs.cmd[R300_ZS_CNTL_1] |= + (translate_stencil_op(ctx->Stencil.FailFunc[1]) << + R300_RB3D_ZS1_BACK_FAIL_OP_SHIFT) + | (translate_stencil_op(ctx->Stencil.ZFailFunc[1]) << + R300_RB3D_ZS1_BACK_ZFAIL_OP_SHIFT) + | (translate_stencil_op(ctx->Stencil.ZPassFunc[1]) << + R300_RB3D_ZS1_BACK_ZPASS_OP_SHIFT); + } else { + rmesa->hw.zs.cmd[R300_ZS_CNTL_1] |= + (translate_stencil_op(ctx->Stencil.FailFunc[0]) << + R300_RB3D_ZS1_BACK_FAIL_OP_SHIFT) + | (translate_stencil_op(ctx->Stencil.ZFailFunc[0]) << + R300_RB3D_ZS1_BACK_ZFAIL_OP_SHIFT) + | (translate_stencil_op(ctx->Stencil.ZPassFunc[0]) << + R300_RB3D_ZS1_BACK_ZPASS_OP_SHIFT); + } } static void r300ClearStencil(GLcontext * ctx, GLint s) @@ -907,8 +983,10 @@ static void r300ClearStencil(GLcontext * ctx, GLint s) rmesa->state.stencil.clear = ((GLuint) (ctx->Stencil.Clear & 0xff) | - (R300_RB3D_ZS2_STENCIL_MASK << R300_RB3D_ZS2_STENCIL_MASK_SHIFT) | - ((ctx->Stencil.WriteMask[0] & 0xff) << R300_RB3D_ZS2_STENCIL_WRITE_MASK_SHIFT)); + (R300_RB3D_ZS2_STENCIL_MASK << + R300_RB3D_ZS2_STENCIL_MASK_SHIFT) | ((ctx->Stencil. + WriteMask[0] & 0xff) << + R300_RB3D_ZS2_STENCIL_WRITE_MASK_SHIFT)); } /* ============================================================= @@ -921,7 +999,7 @@ static void r300ClearStencil(GLcontext * ctx, GLint s) #define SUBPIXEL_X 0.125 #define SUBPIXEL_Y 0.125 -void r300UpdateWindow(GLcontext * ctx) +static void r300UpdateWindow(GLcontext * ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); __DRIdrawablePrivate *dPriv = rmesa->radeon.dri.drawable; @@ -939,11 +1017,11 @@ void r300UpdateWindow(GLcontext * ctx) R300_FIREVERTICES(rmesa); R300_STATECHANGE(rmesa, vpt); - rmesa->hw.vpt.cmd[R300_VPT_XSCALE] = r300PackFloat32(sx); + rmesa->hw.vpt.cmd[R300_VPT_XSCALE] = r300PackFloat32(sx); rmesa->hw.vpt.cmd[R300_VPT_XOFFSET] = r300PackFloat32(tx); - rmesa->hw.vpt.cmd[R300_VPT_YSCALE] = r300PackFloat32(sy); + rmesa->hw.vpt.cmd[R300_VPT_YSCALE] = r300PackFloat32(sy); rmesa->hw.vpt.cmd[R300_VPT_YOFFSET] = r300PackFloat32(ty); - rmesa->hw.vpt.cmd[R300_VPT_ZSCALE] = r300PackFloat32(sz); + rmesa->hw.vpt.cmd[R300_VPT_ZSCALE] = r300PackFloat32(sz); rmesa->hw.vpt.cmd[R300_VPT_ZOFFSET] = r300PackFloat32(tz); } @@ -962,38 +1040,36 @@ static void r300DepthRange(GLcontext * ctx, GLclampd nearval, GLclampd farval) r300UpdateWindow(ctx); } -void r300UpdateViewportOffset( GLcontext *ctx ) +void r300UpdateViewportOffset(GLcontext * ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); - __DRIdrawablePrivate *dPriv = ((radeonContextPtr)rmesa)->dri.drawable; - GLfloat xoffset = (GLfloat)dPriv->x; - GLfloat yoffset = (GLfloat)dPriv->y + dPriv->h; + __DRIdrawablePrivate *dPriv = ((radeonContextPtr) rmesa)->dri.drawable; + GLfloat xoffset = (GLfloat) dPriv->x; + GLfloat yoffset = (GLfloat) dPriv->y + dPriv->h; const GLfloat *v = ctx->Viewport._WindowMap.m; GLfloat tx = v[MAT_TX] + xoffset + SUBPIXEL_X; - GLfloat ty = (- v[MAT_TY]) + yoffset + SUBPIXEL_Y; + GLfloat ty = (-v[MAT_TY]) + yoffset + SUBPIXEL_Y; + + if (rmesa->hw.vpt.cmd[R300_VPT_XOFFSET] != r300PackFloat32(tx) || + rmesa->hw.vpt.cmd[R300_VPT_YOFFSET] != r300PackFloat32(ty)) { + /* Note: this should also modify whatever data the context reset + * code uses... + */ + R300_STATECHANGE(rmesa, vpt); + rmesa->hw.vpt.cmd[R300_VPT_XOFFSET] = r300PackFloat32(tx); + rmesa->hw.vpt.cmd[R300_VPT_YOFFSET] = r300PackFloat32(ty); - if ( rmesa->hw.vpt.cmd[R300_VPT_XOFFSET] != r300PackFloat32(tx) || - rmesa->hw.vpt.cmd[R300_VPT_YOFFSET] != r300PackFloat32(ty)) - { - /* Note: this should also modify whatever data the context reset - * code uses... - */ - R300_STATECHANGE( rmesa, vpt ); - rmesa->hw.vpt.cmd[R300_VPT_XOFFSET] = r300PackFloat32(tx); - rmesa->hw.vpt.cmd[R300_VPT_YOFFSET] = r300PackFloat32(ty); - } - radeonUpdateScissor( ctx ); + radeonUpdateScissor(ctx); } /** * Tell the card where to render (offset, pitch). * Effected by glDrawBuffer, etc */ -void -r300UpdateDrawBuffer(GLcontext *ctx) +void r300UpdateDrawBuffer(GLcontext * ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); r300ContextPtr r300 = rmesa; @@ -1002,13 +1078,15 @@ r300UpdateDrawBuffer(GLcontext *ctx) if (fb->_ColorDrawBufferMask[0] == BUFFER_BIT_FRONT_LEFT) { /* draw to front */ - drb = (driRenderbuffer *) fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer; - } - else if (fb->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT) { + drb = + (driRenderbuffer *) fb->Attachment[BUFFER_FRONT_LEFT]. + Renderbuffer; + } else if (fb->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT) { /* draw to back */ - drb = (driRenderbuffer *) fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer; - } - else { + drb = + (driRenderbuffer *) fb->Attachment[BUFFER_BACK_LEFT]. + Renderbuffer; + } else { /* drawing to multiple buffers, or none */ return; } @@ -1016,35 +1094,112 @@ r300UpdateDrawBuffer(GLcontext *ctx) assert(drb); assert(drb->flippedPitch); + R300_STATECHANGE(rmesa, cb); + + r300->hw.cb.cmd[R300_CB_OFFSET] = drb->flippedOffset + //r300->radeon.state.color.drawOffset + + r300->radeon.radeonScreen->fbLocation; + r300->hw.cb.cmd[R300_CB_PITCH] = drb->flippedPitch; //r300->radeon.state.color.drawPitch; - R300_STATECHANGE( rmesa, cb ); - - r300->hw.cb.cmd[R300_CB_OFFSET] = drb->flippedOffset + //r300->radeon.state.color.drawOffset + - r300->radeon.radeonScreen->fbLocation; - r300->hw.cb.cmd[R300_CB_PITCH] = drb->flippedPitch;//r300->radeon.state.color.drawPitch; - if (r300->radeon.radeonScreen->cpp == 4) r300->hw.cb.cmd[R300_CB_PITCH] |= R300_COLOR_FORMAT_ARGB8888; else r300->hw.cb.cmd[R300_CB_PITCH] |= R300_COLOR_FORMAT_RGB565; - + if (r300->radeon.sarea->tiling_enabled) r300->hw.cb.cmd[R300_CB_PITCH] |= R300_COLOR_TILE_ENABLE; #if 0 - R200_STATECHANGE( rmesa, ctx ); + R200_STATECHANGE(rmesa, ctx); /* Note: we used the (possibly) page-flipped values */ rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] - = ((drb->flippedOffset + rmesa->r200Screen->fbLocation) - & R200_COLOROFFSET_MASK); + = ((drb->flippedOffset + rmesa->r200Screen->fbLocation) + & R200_COLOROFFSET_MASK); rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = drb->flippedPitch; - + if (rmesa->sarea->tiling_enabled) { - rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] |= R200_COLOR_TILE_ENABLE; + rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] |= + R200_COLOR_TILE_ENABLE; } #endif } +static void +r300FetchStateParameter(GLcontext * ctx, + const gl_state_index state[STATE_LENGTH], + GLfloat * value) +{ + r300ContextPtr r300 = R300_CONTEXT(ctx); + + switch (state[0]) { + case STATE_INTERNAL: + switch (state[1]) { + case STATE_R300_WINDOW_DIMENSION: + value[0] = r300->radeon.dri.drawable->w * 0.5f; /* width*0.5 */ + value[1] = r300->radeon.dri.drawable->h * 0.5f; /* height*0.5 */ + value[2] = 0.5F; /* for moving range [-1 1] -> [0 1] */ + value[3] = 1.0F; /* not used */ + break; + + case STATE_R300_TEXRECT_FACTOR:{ + struct gl_texture_object *t = + ctx->Texture.Unit[state[2]].CurrentRect; + + if (t && t->Image[0][t->BaseLevel]) { + struct gl_texture_image *image = + t->Image[0][t->BaseLevel]; + value[0] = 1.0 / image->Width2; + value[1] = 1.0 / image->Height2; + } else { + value[0] = 1.0; + value[1] = 1.0; + } + value[2] = 1.0; + value[3] = 1.0; + break; + } + + default: + break; + } + break; + + default: + break; + } +} + +/** + * Update R300's own internal state parameters. + * For now just STATE_R300_WINDOW_DIMENSION + */ +void r300UpdateStateParameters(GLcontext * ctx, GLuint new_state) +{ + struct r300_fragment_program *fp; + struct gl_program_parameter_list *paramList; + GLuint i; + + if (!(new_state & (_NEW_BUFFERS | _NEW_PROGRAM))) + return; + + fp = (struct r300_fragment_program *)ctx->FragmentProgram._Current; + if (!fp) + return; + + paramList = fp->mesa_program.Base.Parameters; + + if (!paramList) + return; + + for (i = 0; i < paramList->NumParameters; i++) { + if (paramList->Parameters[i].Type == PROGRAM_STATE_VAR) { + r300FetchStateParameter(ctx, + paramList->Parameters[i]. + StateIndexes, + paramList->ParameterValues[i]); + } + } +} + /* ============================================================= * Polygon state */ @@ -1052,14 +1207,14 @@ static void r300PolygonOffset(GLcontext * ctx, GLfloat factor, GLfloat units) { r300ContextPtr rmesa = R300_CONTEXT(ctx); GLfloat constant = units; - + switch (ctx->Visual.depthBits) { case 16: constant *= 4.0; - break; + break; case 24: constant *= 2.0; - break; + break; } factor *= 12.0; @@ -1075,7 +1230,6 @@ static void r300PolygonOffset(GLcontext * ctx, GLfloat factor, GLfloat units) /* Routing and texture-related */ - /* r300 doesnt handle GL_CLAMP and GL_MIRROR_CLAMP_EXT correctly when filter is NEAREST. * Since texwrap produces same results for GL_CLAMP and GL_CLAMP_TO_EDGE we use them instead. * We need to recalculate wrap modes whenever filter mode is changed because someone might do: @@ -1087,193 +1241,236 @@ static void r300PolygonOffset(GLcontext * ctx, GLfloat factor, GLfloat units) */ static unsigned long gen_fixed_filter(unsigned long f) { - unsigned long mag, min, needs_fixing=0; + unsigned long mag, min, needs_fixing = 0; //return f; /* We ignore MIRROR bit so we dont have to do everything twice */ - if((f & ((7-1) << R300_TX_WRAP_S_SHIFT)) == (R300_TX_CLAMP << R300_TX_WRAP_S_SHIFT)){ + if ((f & ((7 - 1) << R300_TX_WRAP_S_SHIFT)) == + (R300_TX_CLAMP << R300_TX_WRAP_S_SHIFT)) { needs_fixing |= 1; } - if((f & ((7-1) << R300_TX_WRAP_T_SHIFT)) == (R300_TX_CLAMP << R300_TX_WRAP_T_SHIFT)){ + if ((f & ((7 - 1) << R300_TX_WRAP_T_SHIFT)) == + (R300_TX_CLAMP << R300_TX_WRAP_T_SHIFT)) { needs_fixing |= 2; } - if((f & ((7-1) << R300_TX_WRAP_Q_SHIFT)) == (R300_TX_CLAMP << R300_TX_WRAP_Q_SHIFT)){ + if ((f & ((7 - 1) << R300_TX_WRAP_Q_SHIFT)) == + (R300_TX_CLAMP << R300_TX_WRAP_Q_SHIFT)) { needs_fixing |= 4; } - if(!needs_fixing) + if (!needs_fixing) return f; - mag=f & R300_TX_MAG_FILTER_MASK; - min=f & R300_TX_MIN_FILTER_MASK; + mag = f & R300_TX_MAG_FILTER_MASK; + min = f & R300_TX_MIN_FILTER_MASK; /* TODO: Check for anisto filters too */ - if((mag != R300_TX_MAG_FILTER_NEAREST) && (min != R300_TX_MIN_FILTER_NEAREST)) + if ((mag != R300_TX_MAG_FILTER_NEAREST) + && (min != R300_TX_MIN_FILTER_NEAREST)) return f; /* r300 cant handle these modes hence we force nearest to linear */ - if((mag == R300_TX_MAG_FILTER_NEAREST) && (min != R300_TX_MIN_FILTER_NEAREST)){ + if ((mag == R300_TX_MAG_FILTER_NEAREST) + && (min != R300_TX_MIN_FILTER_NEAREST)) { f &= ~R300_TX_MAG_FILTER_NEAREST; f |= R300_TX_MAG_FILTER_LINEAR; return f; } - if((min == R300_TX_MIN_FILTER_NEAREST) && (mag != R300_TX_MAG_FILTER_NEAREST)){ + if ((min == R300_TX_MIN_FILTER_NEAREST) + && (mag != R300_TX_MAG_FILTER_NEAREST)) { f &= ~R300_TX_MIN_FILTER_NEAREST; f |= R300_TX_MIN_FILTER_LINEAR; return f; } /* Both are nearest */ - if(needs_fixing & 1){ - f &= ~((7-1) << R300_TX_WRAP_S_SHIFT); + if (needs_fixing & 1) { + f &= ~((7 - 1) << R300_TX_WRAP_S_SHIFT); f |= R300_TX_CLAMP_TO_EDGE << R300_TX_WRAP_S_SHIFT; } - if(needs_fixing & 2){ - f &= ~((7-1) << R300_TX_WRAP_T_SHIFT); + if (needs_fixing & 2) { + f &= ~((7 - 1) << R300_TX_WRAP_T_SHIFT); f |= R300_TX_CLAMP_TO_EDGE << R300_TX_WRAP_T_SHIFT; } - if(needs_fixing & 4){ - f &= ~((7-1) << R300_TX_WRAP_Q_SHIFT); + if (needs_fixing & 4) { + f &= ~((7 - 1) << R300_TX_WRAP_Q_SHIFT); f |= R300_TX_CLAMP_TO_EDGE << R300_TX_WRAP_Q_SHIFT; } return f; } -void r300_setup_textures(GLcontext *ctx) +static void r300SetupTextures(GLcontext * ctx) { int i, mtu; struct r300_tex_obj *t; r300ContextPtr r300 = R300_CONTEXT(ctx); - int hw_tmu=0; - int last_hw_tmu=-1; /* -1 translates into no setup costs for fields */ - int tmu_mappings[R300_MAX_TEXTURE_UNITS] = { -1 }; - struct r300_fragment_program *rp = - (struct r300_fragment_program *) - (char *)ctx->FragmentProgram._Current; + int hw_tmu = 0; + int last_hw_tmu = -1; /* -1 translates into no setup costs for fields */ + int tmu_mappings[R300_MAX_TEXTURE_UNITS] = { -1, }; + struct r300_fragment_program *fp = (struct r300_fragment_program *) + (char *)ctx->FragmentProgram._Current; R300_STATECHANGE(r300, txe); R300_STATECHANGE(r300, tex.filter); - R300_STATECHANGE(r300, tex.unknown1); + R300_STATECHANGE(r300, tex.filter_1); R300_STATECHANGE(r300, tex.size); R300_STATECHANGE(r300, tex.format); R300_STATECHANGE(r300, tex.pitch); R300_STATECHANGE(r300, tex.offset); - R300_STATECHANGE(r300, tex.unknown4); + R300_STATECHANGE(r300, tex.chroma_key); R300_STATECHANGE(r300, tex.border_color); - - r300->hw.txe.cmd[R300_TXE_ENABLE]=0x0; + + r300->hw.txe.cmd[R300_TXE_ENABLE] = 0x0; mtu = r300->radeon.glCtx->Const.MaxTextureUnits; if (RADEON_DEBUG & DEBUG_STATE) fprintf(stderr, "mtu=%d\n", mtu); - if(mtu > R300_MAX_TEXTURE_UNITS) { - fprintf(stderr, "Aiiee ! mtu=%d is greater than R300_MAX_TEXTURE_UNITS=%d\n", + if (mtu > R300_MAX_TEXTURE_UNITS) { + fprintf(stderr, + "Aiiee ! mtu=%d is greater than R300_MAX_TEXTURE_UNITS=%d\n", mtu, R300_MAX_TEXTURE_UNITS); - exit(-1); + _mesa_exit(-1); } /* We cannot let disabled tmu offsets pass DRM */ - for(i=0; i < mtu; i++) { - if(TMU_ENABLED(ctx, i)) { - -#if 0 /* Enables old behaviour */ + for (i = 0; i < mtu; i++) { + if (ctx->Texture.Unit[i]._ReallyEnabled) { + +#if 0 /* Enables old behaviour */ hw_tmu = i; #endif tmu_mappings[i] = hw_tmu; - - t=r300->state.texture.unit[i].texobj; - - if((t->format & 0xffffff00)==0xffffff00) { - WARN_ONCE("unknown texture format (entry %x) encountered. Help me !\n", t->format & 0xff); + + t = r300->state.texture.unit[i].texobj; + /* XXX questionable fix for bug 9170: */ + if (!t) + continue; + + if ((t->format & 0xffffff00) == 0xffffff00) { + WARN_ONCE + ("unknown texture format (entry %x) encountered. Help me !\n", + t->format & 0xff); } - + if (RADEON_DEBUG & DEBUG_STATE) - fprintf(stderr, "Activating texture unit %d\n", i); - + fprintf(stderr, + "Activating texture unit %d\n", i); + r300->hw.txe.cmd[R300_TXE_ENABLE] |= (1 << hw_tmu); - - r300->hw.tex.filter.cmd[R300_TEX_VALUE_0 + hw_tmu] = gen_fixed_filter(t->filter) | (hw_tmu << 28); + + r300->hw.tex.filter.cmd[R300_TEX_VALUE_0 + + hw_tmu] = + gen_fixed_filter(t->filter) | (hw_tmu << 28); /* Currently disabled! */ - r300->hw.tex.unknown1.cmd[R300_TEX_VALUE_0 + hw_tmu] = 0x0; //0x20501f80; - r300->hw.tex.size.cmd[R300_TEX_VALUE_0 + hw_tmu] = t->size; - r300->hw.tex.format.cmd[R300_TEX_VALUE_0 + hw_tmu] = t->format; - r300->hw.tex.pitch.cmd[R300_TEX_VALUE_0 + hw_tmu] = t->pitch_reg; - r300->hw.tex.offset.cmd[R300_TEX_VALUE_0 + hw_tmu] = t->offset; - - if(t->offset & R300_TXO_MACRO_TILE) { + r300->hw.tex.filter_1.cmd[R300_TEX_VALUE_0 + hw_tmu] = 0x0; //0x20501f80; + r300->hw.tex.size.cmd[R300_TEX_VALUE_0 + hw_tmu] = + t->size; + r300->hw.tex.format.cmd[R300_TEX_VALUE_0 + + hw_tmu] = t->format; + r300->hw.tex.pitch.cmd[R300_TEX_VALUE_0 + hw_tmu] = + t->pitch_reg; + r300->hw.tex.offset.cmd[R300_TEX_VALUE_0 + + hw_tmu] = t->offset; + + if (t->offset & R300_TXO_MACRO_TILE) { WARN_ONCE("macro tiling enabled!\n"); } - - if(t->offset & R300_TXO_MICRO_TILE) { + + if (t->offset & R300_TXO_MICRO_TILE) { WARN_ONCE("micro tiling enabled!\n"); } - - r300->hw.tex.unknown4.cmd[R300_TEX_VALUE_0 + hw_tmu] = 0x0; - r300->hw.tex.border_color.cmd[R300_TEX_VALUE_0 + hw_tmu] = t->pp_border_color; - + + r300->hw.tex.chroma_key.cmd[R300_TEX_VALUE_0 + + hw_tmu] = 0x0; + r300->hw.tex.border_color.cmd[R300_TEX_VALUE_0 + + hw_tmu] = + t->pp_border_color; + last_hw_tmu = hw_tmu; - + hw_tmu++; } } - - r300->hw.tex.filter.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_FILTER_0, last_hw_tmu + 1); - r300->hw.tex.unknown1.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_FILTER1_0, last_hw_tmu + 1); - r300->hw.tex.size.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_SIZE_0, last_hw_tmu + 1); - r300->hw.tex.format.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_FORMAT_0, last_hw_tmu + 1); - r300->hw.tex.pitch.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_PITCH_0, last_hw_tmu + 1); - r300->hw.tex.offset.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_OFFSET_0, last_hw_tmu + 1); - r300->hw.tex.unknown4.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_CHROMA_KEY_0, last_hw_tmu + 1); - r300->hw.tex.border_color.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_BORDER_COLOR_0, last_hw_tmu + 1); - - - if (!rp) /* should only happenen once, just after context is created */ + + r300->hw.tex.filter.cmd[R300_TEX_CMD_0] = + cmdpacket0(R300_TX_FILTER_0, last_hw_tmu + 1); + r300->hw.tex.filter_1.cmd[R300_TEX_CMD_0] = + cmdpacket0(R300_TX_FILTER1_0, last_hw_tmu + 1); + r300->hw.tex.size.cmd[R300_TEX_CMD_0] = + cmdpacket0(R300_TX_SIZE_0, last_hw_tmu + 1); + r300->hw.tex.format.cmd[R300_TEX_CMD_0] = + cmdpacket0(R300_TX_FORMAT_0, last_hw_tmu + 1); + r300->hw.tex.pitch.cmd[R300_TEX_CMD_0] = + cmdpacket0(R300_TX_PITCH_0, last_hw_tmu + 1); + r300->hw.tex.offset.cmd[R300_TEX_CMD_0] = + cmdpacket0(R300_TX_OFFSET_0, last_hw_tmu + 1); + r300->hw.tex.chroma_key.cmd[R300_TEX_CMD_0] = + cmdpacket0(R300_TX_CHROMA_KEY_0, last_hw_tmu + 1); + r300->hw.tex.border_color.cmd[R300_TEX_CMD_0] = + cmdpacket0(R300_TX_BORDER_COLOR_0, last_hw_tmu + 1); + + if (!fp) /* should only happenen once, just after context is created */ return; - + R300_STATECHANGE(r300, fpt); - - for(i = 0; i < rp->tex.length; i++){ + + for (i = 0; i < fp->tex.length; i++) { int unit; + int opcode; unsigned long val; - - unit = rp->tex.inst[i] >> R300_FPITX_IMAGE_SHIFT; + + unit = fp->tex.inst[i] >> R300_FPITX_IMAGE_SHIFT; unit &= 15; - - val = rp->tex.inst[i]; + + val = fp->tex.inst[i]; val &= ~R300_FPITX_IMAGE_MASK; - - assert(tmu_mappings[unit] >= 0); - - val |= tmu_mappings[unit] << R300_FPITX_IMAGE_SHIFT; - r300->hw.fpt.cmd[R300_FPT_INSTR_0+i] = val; + + opcode = + (val & R300_FPITX_OPCODE_MASK) >> R300_FPITX_OPCODE_SHIFT; + if (opcode == R300_FPITX_OP_KIL) { + r300->hw.fpt.cmd[R300_FPT_INSTR_0 + i] = val; + } else { + if (tmu_mappings[unit] >= 0) { + val |= + tmu_mappings[unit] << + R300_FPITX_IMAGE_SHIFT; + r300->hw.fpt.cmd[R300_FPT_INSTR_0 + i] = val; + } else { + // We get here when the corresponding texture image is incomplete + // (e.g. incomplete mipmaps etc.) + r300->hw.fpt.cmd[R300_FPT_INSTR_0 + i] = val; + } + } } - - r300->hw.fpt.cmd[R300_FPT_CMD_0] = cmdpacket0(R300_PFS_TEXI_0, rp->tex.length); - + + r300->hw.fpt.cmd[R300_FPT_CMD_0] = + cmdpacket0(R300_PFS_TEXI_0, fp->tex.length); + if (RADEON_DEBUG & DEBUG_STATE) - fprintf(stderr, "TX_ENABLE: %08x last_hw_tmu=%d\n", r300->hw.txe.cmd[R300_TXE_ENABLE], last_hw_tmu); + fprintf(stderr, "TX_ENABLE: %08x last_hw_tmu=%d\n", + r300->hw.txe.cmd[R300_TXE_ENABLE], last_hw_tmu); } union r300_outputs_written { - GLuint vp_outputs; /* hw_tcl_on */ - DECLARE_RENDERINPUTS(index_bitset); /* !hw_tcl_on */ + GLuint vp_outputs; /* hw_tcl_on */ + DECLARE_RENDERINPUTS(index_bitset); /* !hw_tcl_on */ }; #define R300_OUTPUTS_WRITTEN_TEST(ow, vp_result, tnl_attrib) \ ((hw_tcl_on) ? (ow).vp_outputs & (1 << (vp_result)) : \ RENDERINPUTS_TEST( (ow.index_bitset), (tnl_attrib) )) -void r300_setup_rs_unit(GLcontext *ctx) +static void r300SetupRSUnit(GLcontext * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); /* I'm still unsure if these are needed */ GLuint interp_magic[8] = { 0x00, - 0x40, - 0x80, - 0xC0, + R300_RS_INTERP_1_UNKNOWN, + R300_RS_INTERP_2_UNKNOWN, + R300_RS_INTERP_3_UNKNOWN, 0x00, 0x00, 0x00, @@ -1285,104 +1482,129 @@ void r300_setup_rs_unit(GLcontext *ctx) int in_texcoords, col_interp_nr; int i; - if(hw_tcl_on) - OutputsWritten.vp_outputs = CURRENT_VERTEX_SHADER(ctx)->Base.OutputsWritten; + if (hw_tcl_on) + OutputsWritten.vp_outputs = + CURRENT_VERTEX_SHADER(ctx)->key.OutputsWritten; else - RENDERINPUTS_COPY( OutputsWritten.index_bitset, r300->state.render_inputs_bitset ); + RENDERINPUTS_COPY(OutputsWritten.index_bitset, + r300->state.render_inputs_bitset); if (ctx->FragmentProgram._Current) InputsRead = ctx->FragmentProgram._Current->Base.InputsRead; else { fprintf(stderr, "No ctx->FragmentProgram._Current!!\n"); - return; /* This should only ever happen once.. */ + return; /* This should only ever happen once.. */ } R300_STATECHANGE(r300, ri); R300_STATECHANGE(r300, rc); R300_STATECHANGE(r300, rr); - + fp_reg = in_texcoords = col_interp_nr = high_rr = 0; r300->hw.rr.cmd[R300_RR_ROUTE_1] = 0; - - for (i=0;i<ctx->Const.MaxTextureUnits;i++) { - r300->hw.ri.cmd[R300_RI_INTERP_0+i] = 0 - | R300_RS_INTERP_USED - | (in_texcoords << R300_RS_INTERP_SRC_SHIFT) - | interp_magic[i]; + + if (InputsRead & FRAG_BIT_WPOS) { + for (i = 0; i < ctx->Const.MaxTextureUnits; i++) + if (!(InputsRead & (FRAG_BIT_TEX0 << i))) + break; + + if (i == ctx->Const.MaxTextureUnits) { + fprintf(stderr, "\tno free texcoord found...\n"); + _mesa_exit(-1); + } + + InputsRead |= (FRAG_BIT_TEX0 << i); + InputsRead &= ~FRAG_BIT_WPOS; + } + + for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { + r300->hw.ri.cmd[R300_RI_INTERP_0 + i] = 0 + | R300_RS_INTERP_USED + | (in_texcoords << R300_RS_INTERP_SRC_SHIFT) + | interp_magic[i]; r300->hw.rr.cmd[R300_RR_ROUTE_0 + fp_reg] = 0; - if (InputsRead & (FRAG_BIT_TEX0<<i)) { + if (InputsRead & (FRAG_BIT_TEX0 << i)) { //assert(r300->state.texture.tc_count != 0); - r300->hw.rr.cmd[R300_RR_ROUTE_0 + fp_reg] |= - R300_RS_ROUTE_ENABLE - | i /* source INTERP */ - | (fp_reg << R300_RS_ROUTE_DEST_SHIFT); + r300->hw.rr.cmd[R300_RR_ROUTE_0 + fp_reg] |= R300_RS_ROUTE_ENABLE | i /* source INTERP */ + | (fp_reg << R300_RS_ROUTE_DEST_SHIFT); high_rr = fp_reg; - if (!R300_OUTPUTS_WRITTEN_TEST( OutputsWritten, VERT_RESULT_TEX0+i, _TNL_ATTRIB_TEX(i) )) { + if (!R300_OUTPUTS_WRITTEN_TEST + (OutputsWritten, VERT_RESULT_TEX0 + i, + _TNL_ATTRIB_TEX(i))) { /* Passing invalid data here can lock the GPU. */ - WARN_ONCE("fragprog wants coords for tex%d, vp doesn't provide them!\n", i); + WARN_ONCE + ("fragprog wants coords for tex%d, vp doesn't provide them!\n", + i); //_mesa_print_program(&CURRENT_VERTEX_SHADER(ctx)->Base); - //exit(-1); + //_mesa_exit(-1); } - InputsRead &= ~(FRAG_BIT_TEX0<<i); + InputsRead &= ~(FRAG_BIT_TEX0 << i); fp_reg++; - } + } /* Need to count all coords enabled at vof */ - if (R300_OUTPUTS_WRITTEN_TEST( OutputsWritten, VERT_RESULT_TEX0+i, _TNL_ATTRIB_TEX(i) )) + if (R300_OUTPUTS_WRITTEN_TEST + (OutputsWritten, VERT_RESULT_TEX0 + i, _TNL_ATTRIB_TEX(i))) in_texcoords++; } if (InputsRead & FRAG_BIT_COL0) { - if (!R300_OUTPUTS_WRITTEN_TEST( OutputsWritten, VERT_RESULT_COL0, _TNL_ATTRIB_COLOR0 )) { - WARN_ONCE("fragprog wants col0, vp doesn't provide it\n"); - goto out; /* FIXME */ + if (!R300_OUTPUTS_WRITTEN_TEST + (OutputsWritten, VERT_RESULT_COL0, _TNL_ATTRIB_COLOR0)) { + WARN_ONCE + ("fragprog wants col0, vp doesn't provide it\n"); + goto out; /* FIXME */ //_mesa_print_program(&CURRENT_VERTEX_SHADER(ctx)->Base); - //exit(-1); + //_mesa_exit(-1); } r300->hw.rr.cmd[R300_RR_ROUTE_0] |= 0 - | R300_RS_ROUTE_0_COLOR - | (fp_reg++ << R300_RS_ROUTE_0_COLOR_DEST_SHIFT); + | R300_RS_ROUTE_0_COLOR + | (fp_reg++ << R300_RS_ROUTE_0_COLOR_DEST_SHIFT); InputsRead &= ~FRAG_BIT_COL0; col_interp_nr++; } - out: - + out: + if (InputsRead & FRAG_BIT_COL1) { - if (!R300_OUTPUTS_WRITTEN_TEST( OutputsWritten, VERT_RESULT_COL1, _TNL_ATTRIB_COLOR1 )) { - WARN_ONCE("fragprog wants col1, vp doesn't provide it\n"); - //exit(-1); + if (!R300_OUTPUTS_WRITTEN_TEST + (OutputsWritten, VERT_RESULT_COL1, _TNL_ATTRIB_COLOR1)) { + WARN_ONCE + ("fragprog wants col1, vp doesn't provide it\n"); + //_mesa_exit(-1); } - r300->hw.rr.cmd[R300_RR_ROUTE_1] |= R300_RS_ROUTE_1_UNKNOWN11 - | R300_RS_ROUTE_1_COLOR1 - | (fp_reg++ << R300_RS_ROUTE_1_COLOR1_DEST_SHIFT); + r300->hw.rr.cmd[R300_RR_ROUTE_1] |= + R300_RS_ROUTE_1_UNKNOWN11 | R300_RS_ROUTE_1_COLOR1 | + (fp_reg++ << R300_RS_ROUTE_1_COLOR1_DEST_SHIFT); InputsRead &= ~FRAG_BIT_COL1; - if (high_rr < 1) high_rr = 1; + if (high_rr < 1) + high_rr = 1; col_interp_nr++; } - + /* Need at least one. This might still lock as the values are undefined... */ if (in_texcoords == 0 && col_interp_nr == 0) { r300->hw.rr.cmd[R300_RR_ROUTE_0] |= 0 - | R300_RS_ROUTE_0_COLOR - | (fp_reg++ << R300_RS_ROUTE_0_COLOR_DEST_SHIFT); + | R300_RS_ROUTE_0_COLOR + | (fp_reg++ << R300_RS_ROUTE_0_COLOR_DEST_SHIFT); col_interp_nr++; } - - r300->hw.rc.cmd[1] = 0 - | (in_texcoords << R300_RS_CNTL_TC_CNT_SHIFT) - | (col_interp_nr << R300_RS_CNTL_CI_CNT_SHIFT) - | R300_RS_CNTL_0_UNKNOWN_18; + + r300->hw.rc.cmd[1] = 0 | (in_texcoords << R300_RS_CNTL_TC_CNT_SHIFT) + | (col_interp_nr << R300_RS_CNTL_CI_CNT_SHIFT) + | R300_RS_CNTL_0_UNKNOWN_18; assert(high_rr >= 0); - r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(R300_RS_ROUTE_0, high_rr+1); + r300->hw.rr.cmd[R300_RR_CMD_0] = + cmdpacket0(R300_RS_ROUTE_0, high_rr + 1); r300->hw.rc.cmd[2] = 0xC0 | high_rr; if (InputsRead) - WARN_ONCE("Don't know how to satisfy InputsRead=0x%08x\n", InputsRead); + WARN_ONCE("Don't know how to satisfy InputsRead=0x%08x\n", + InputsRead); } #define vpucount(ptr) (((drm_r300_cmd_header_t*)(ptr))->vpu.count) @@ -1394,50 +1616,60 @@ void r300_setup_rs_unit(GLcontext *ctx) if(_nc>_p->vpu.count)_p->vpu.count=_nc;\ }while(0) -void static inline setup_vertex_shader_fragment(r300ContextPtr r300, int dest, struct r300_vertex_shader_fragment *vsf) +void static inline setup_vertex_shader_fragment(r300ContextPtr r300, int dest, struct + r300_vertex_shader_fragment + *vsf) { int i; - if(vsf->length==0)return; + if (vsf->length == 0) + return; - if(vsf->length & 0x3){ - fprintf(stderr,"VERTEX_SHADER_FRAGMENT must have length divisible by 4\n"); - exit(-1); - } + if (vsf->length & 0x3) { + fprintf(stderr, + "VERTEX_SHADER_FRAGMENT must have length divisible by 4\n"); + _mesa_exit(-1); + } - switch((dest>>8) & 0xf){ + switch ((dest >> 8) & 0xf) { case 0: R300_STATECHANGE(r300, vpi); - for(i=0;i<vsf->length;i++) - r300->hw.vpi.cmd[R300_VPI_INSTR_0+i+4*(dest & 0xff)]=(vsf->body.d[i]); - bump_vpu_count(r300->hw.vpi.cmd, vsf->length+4*(dest & 0xff)); + for (i = 0; i < vsf->length; i++) + r300->hw.vpi.cmd[R300_VPI_INSTR_0 + i + + 4 * (dest & 0xff)] = (vsf->body.d[i]); + bump_vpu_count(r300->hw.vpi.cmd, + vsf->length + 4 * (dest & 0xff)); break; case 2: R300_STATECHANGE(r300, vpp); - for(i=0;i<vsf->length;i++) - r300->hw.vpp.cmd[R300_VPP_PARAM_0+i+4*(dest & 0xff)]=(vsf->body.d[i]); - bump_vpu_count(r300->hw.vpp.cmd, vsf->length+4*(dest & 0xff)); + for (i = 0; i < vsf->length; i++) + r300->hw.vpp.cmd[R300_VPP_PARAM_0 + i + + 4 * (dest & 0xff)] = (vsf->body.d[i]); + bump_vpu_count(r300->hw.vpp.cmd, + vsf->length + 4 * (dest & 0xff)); break; case 4: R300_STATECHANGE(r300, vps); - for(i=0;i<vsf->length;i++) - r300->hw.vps.cmd[1+i+4*(dest & 0xff)]=(vsf->body.d[i]); - bump_vpu_count(r300->hw.vps.cmd, vsf->length+4*(dest & 0xff)); + for (i = 0; i < vsf->length; i++) + r300->hw.vps.cmd[1 + i + 4 * (dest & 0xff)] = + (vsf->body.d[i]); + bump_vpu_count(r300->hw.vps.cmd, + vsf->length + 4 * (dest & 0xff)); break; default: - fprintf(stderr, "%s:%s don't know how to handle dest %04x\n", __FILE__, __FUNCTION__, dest); - exit(-1); + fprintf(stderr, + "%s:%s don't know how to handle dest %04x\n", + __FILE__, __FUNCTION__, dest); + _mesa_exit(-1); } } -void r300SetupVertexProgram(r300ContextPtr rmesa); - /* just a skeleton for now.. */ /* Generate a vertex shader that simply transforms vertex and texture coordinates, - while leaving colors intact. Nothing fancy (like lights) - + while leaving colors intact. Nothing fancy (like lights) + If implementing lights make a copy first, so it is easy to switch between the two versions */ static void r300GenerateSimpleVertexShader(r300ContextPtr r300) { @@ -1445,491 +1677,241 @@ static void r300GenerateSimpleVertexShader(r300ContextPtr r300) GLuint o_reg = 0; /* Allocate parameters */ - r300->state.vap_param.transform_offset=0x0; /* transform matrix */ - r300->state.vertex_shader.param_offset=0x0; - r300->state.vertex_shader.param_count=0x4; /* 4 vector values - 4x4 matrix */ - - r300->state.vertex_shader.program_start=0x0; - r300->state.vertex_shader.unknown_ptr1=0x4; /* magic value ? */ - r300->state.vertex_shader.program_end=0x0; - - r300->state.vertex_shader.unknown_ptr2=0x0; /* magic value */ - r300->state.vertex_shader.unknown_ptr3=0x4; /* magic value */ - - /* Initialize matrix and vector parameters.. these should really be restructured */ - /* TODO: fix vertex_shader structure */ - r300->state.vertex_shader.matrix[0].length=16; - r300->state.vertex_shader.matrix[1].length=0; - r300->state.vertex_shader.matrix[2].length=0; - r300->state.vertex_shader.vector[0].length=0; - r300->state.vertex_shader.vector[1].length=0; - r300->state.vertex_shader.unknown1.length=0; - r300->state.vertex_shader.unknown2.length=0; - -#define WRITE_OP(oper,source1,source2,source3) {\ - r300->state.vertex_shader.program.body.i[r300->state.vertex_shader.program_end].op=(oper); \ - r300->state.vertex_shader.program.body.i[r300->state.vertex_shader.program_end].src1=(source1); \ - r300->state.vertex_shader.program.body.i[r300->state.vertex_shader.program_end].src2=(source2); \ - r300->state.vertex_shader.program.body.i[r300->state.vertex_shader.program_end].src3=(source3); \ - r300->state.vertex_shader.program_end++; \ - } - - /* Multiply vertex coordinates with transform matrix */ - - WRITE_OP( - EASY_VSF_OP(MUL, 0, ALL, TMP), - VSF_PARAM(3), - VSF_ATTR_W(0), - EASY_VSF_SOURCE(0, W, W, W, W, NONE, NONE) - ) - - WRITE_OP( - EASY_VSF_OP(MUL, 1, ALL, RESULT), - VSF_REG(1), - VSF_ATTR_UNITY(1), - VSF_UNITY(1) - ) - - WRITE_OP( - EASY_VSF_OP(MAD, 0, ALL, TMP), - VSF_PARAM(2), - VSF_ATTR_Z(0), - VSF_TMP(0) - ) - - WRITE_OP( - EASY_VSF_OP(MAD, 0, ALL, TMP), - VSF_PARAM(1), - VSF_ATTR_Y(0), - VSF_TMP(0) - ) - - WRITE_OP( - EASY_VSF_OP(MAD, 0, ALL, RESULT), - VSF_PARAM(0), - VSF_ATTR_X(0), - VSF_TMP(0) - ) - o_reg += 2; - - for (i = VERT_ATTRIB_COLOR1; i < VERT_ATTRIB_MAX; i++) - if (r300->state.sw_tcl_inputs[i] != -1) { - WRITE_OP( - EASY_VSF_OP(MUL, o_reg++ /* 2+i */, ALL, RESULT), - VSF_REG(r300->state.sw_tcl_inputs[i]), - VSF_ATTR_UNITY(r300->state.sw_tcl_inputs[i]), - VSF_UNITY(r300->state.sw_tcl_inputs[i]) - ) - - } - - r300->state.vertex_shader.program_end--; /* r300 wants program length to be one more - no idea why */ - r300->state.vertex_shader.program.length=(r300->state.vertex_shader.program_end+1)*4; - - r300->state.vertex_shader.unknown_ptr1=r300->state.vertex_shader.program_end; /* magic value ? */ - r300->state.vertex_shader.unknown_ptr2=r300->state.vertex_shader.program_end; /* magic value ? */ - r300->state.vertex_shader.unknown_ptr3=r300->state.vertex_shader.program_end; /* magic value ? */ - -} + r300->state.vap_param.transform_offset = 0x0; /* transform matrix */ + r300->state.vertex_shader.param_offset = 0x0; + r300->state.vertex_shader.param_count = 0x4; /* 4 vector values - 4x4 matrix */ + r300->state.vertex_shader.program_start = 0x0; + r300->state.vertex_shader.unknown_ptr1 = 0x4; /* magic value ? */ + r300->state.vertex_shader.program_end = 0x0; -void r300SetupVertexShader(r300ContextPtr rmesa) -{ - GLcontext* ctx = rmesa->radeon.glCtx; + r300->state.vertex_shader.unknown_ptr2 = 0x0; /* magic value */ + r300->state.vertex_shader.unknown_ptr3 = 0x4; /* magic value */ - /* Reset state, in case we don't use something */ - ((drm_r300_cmd_header_t*)rmesa->hw.vpp.cmd)->vpu.count = 0; - ((drm_r300_cmd_header_t*)rmesa->hw.vpi.cmd)->vpu.count = 0; - ((drm_r300_cmd_header_t*)rmesa->hw.vps.cmd)->vpu.count = 0; + r300->state.vertex_shader.unknown1.length = 0; + r300->state.vertex_shader.unknown2.length = 0; - /* Not sure why this doesnt work... - 0x400 area might have something to do with pixel shaders as it appears right after pfs programming. - 0x406 is set to { 0.0, 0.0, 1.0, 0.0 } most of the time but should change with smooth points and in other rare cases. */ - //setup_vertex_shader_fragment(rmesa, 0x406, &unk4); - if(hw_tcl_on && ((struct r300_vertex_program *)CURRENT_VERTEX_SHADER(ctx))->translated){ - r300SetupVertexProgram(rmesa); - return ; +#define WRITE_OP(oper,source1,source2,source3) {\ + r300->state.vertex_shader.program.body.i[r300->state.vertex_shader.program_end].op=(oper); \ + r300->state.vertex_shader.program.body.i[r300->state.vertex_shader.program_end].src[0]=(source1); \ + r300->state.vertex_shader.program.body.i[r300->state.vertex_shader.program_end].src[1]=(source2); \ + r300->state.vertex_shader.program.body.i[r300->state.vertex_shader.program_end].src[2]=(source3); \ + r300->state.vertex_shader.program_end++; \ } -/* This needs to be replaced by vertex shader generation code */ - + for (i = VERT_ATTRIB_POS; i < VERT_ATTRIB_MAX; i++) + if (r300->state.sw_tcl_inputs[i] != -1) { + WRITE_OP(EASY_VSF_OP(MUL, o_reg++, ALL, RESULT), + VSF_REG(r300->state.sw_tcl_inputs[i]), + VSF_ATTR_UNITY(r300->state. + sw_tcl_inputs[i]), + VSF_UNITY(r300->state.sw_tcl_inputs[i]) + ) -#if 0 - /* textures enabled ? */ - if(rmesa->state.texture.tc_count>0){ - rmesa->state.vertex_shader=SINGLE_TEXTURE_VERTEX_SHADER; - } else { - rmesa->state.vertex_shader=FLAT_COLOR_VERTEX_SHADER; } -#endif - - r300GenerateSimpleVertexShader(rmesa); - rmesa->state.vertex_shader.matrix[0].length=16; - memcpy(rmesa->state.vertex_shader.matrix[0].body.f, ctx->_ModelProjectMatrix.m, 16*4); - - setup_vertex_shader_fragment(rmesa, VSF_DEST_PROGRAM, &(rmesa->state.vertex_shader.program)); - - setup_vertex_shader_fragment(rmesa, VSF_DEST_MATRIX0, &(rmesa->state.vertex_shader.matrix[0])); -#if 0 - setup_vertex_shader_fragment(rmesa, VSF_DEST_MATRIX1, &(rmesa->state.vertex_shader.matrix[0])); - setup_vertex_shader_fragment(rmesa, VSF_DEST_MATRIX2, &(rmesa->state.vertex_shader.matrix[0])); - - setup_vertex_shader_fragment(rmesa, VSF_DEST_VECTOR0, &(rmesa->state.vertex_shader.vector[0])); - setup_vertex_shader_fragment(rmesa, VSF_DEST_VECTOR1, &(rmesa->state.vertex_shader.vector[1])); -#endif - -#if 0 - setup_vertex_shader_fragment(rmesa, VSF_DEST_UNKNOWN1, &(rmesa->state.vertex_shader.unknown1)); - setup_vertex_shader_fragment(rmesa, VSF_DEST_UNKNOWN2, &(rmesa->state.vertex_shader.unknown2)); -#endif + r300->state.vertex_shader.program_end--; /* r300 wants program length to be one more - no idea why */ + r300->state.vertex_shader.program.length = + (r300->state.vertex_shader.program_end + 1) * 4; - R300_STATECHANGE(rmesa, pvs); - rmesa->hw.pvs.cmd[R300_PVS_CNTL_1]=(rmesa->state.vertex_shader.program_start << R300_PVS_CNTL_1_PROGRAM_START_SHIFT) - | (rmesa->state.vertex_shader.unknown_ptr1 << R300_PVS_CNTL_1_POS_END_SHIFT) - | (rmesa->state.vertex_shader.program_end << R300_PVS_CNTL_1_PROGRAM_END_SHIFT); - rmesa->hw.pvs.cmd[R300_PVS_CNTL_2]=(rmesa->state.vertex_shader.param_offset << R300_PVS_CNTL_2_PARAM_OFFSET_SHIFT) - | (rmesa->state.vertex_shader.param_count << R300_PVS_CNTL_2_PARAM_COUNT_SHIFT); - rmesa->hw.pvs.cmd[R300_PVS_CNTL_3]=(rmesa->state.vertex_shader.unknown_ptr2 << R300_PVS_CNTL_3_PROGRAM_UNKNOWN_SHIFT) - | (rmesa->state.vertex_shader.unknown_ptr3 << 0); + r300->state.vertex_shader.unknown_ptr1 = r300->state.vertex_shader.program_end; /* magic value ? */ + r300->state.vertex_shader.unknown_ptr2 = r300->state.vertex_shader.program_end; /* magic value ? */ + r300->state.vertex_shader.unknown_ptr3 = r300->state.vertex_shader.program_end; /* magic value ? */ - /* This is done for vertex shader fragments, but also needs to be done for vap_pvs, - so I leave it as a reminder */ -#if 0 - reg_start(R300_VAP_PVS_WAITIDLE,0); - e32(0x00000000); -#endif } -void r300SetupVertexProgram(r300ContextPtr rmesa) +static void r300SetupVertexProgram(r300ContextPtr rmesa) { - GLcontext* ctx = rmesa->radeon.glCtx; + GLcontext *ctx = rmesa->radeon.glCtx; int inst_count; int param_count; - struct r300_vertex_program *prog=(struct r300_vertex_program *)CURRENT_VERTEX_SHADER(ctx); - + struct r300_vertex_program *prog = + (struct r300_vertex_program *)CURRENT_VERTEX_SHADER(ctx); - ((drm_r300_cmd_header_t*)rmesa->hw.vpp.cmd)->vpu.count = 0; + ((drm_r300_cmd_header_t *) rmesa->hw.vpp.cmd)->vpu.count = 0; R300_STATECHANGE(rmesa, vpp); - param_count = r300VertexProgUpdateParams(ctx, prog, (float *)&rmesa->hw.vpp.cmd[R300_VPP_PARAM_0]); + param_count = + r300VertexProgUpdateParams(ctx, (struct r300_vertex_program_cont *) + ctx->VertexProgram._Current /*prog */ , + (float *)&rmesa->hw.vpp. + cmd[R300_VPP_PARAM_0]); bump_vpu_count(rmesa->hw.vpp.cmd, param_count); param_count /= 4; - + /* Reset state, in case we don't use something */ - ((drm_r300_cmd_header_t*)rmesa->hw.vpi.cmd)->vpu.count = 0; - ((drm_r300_cmd_header_t*)rmesa->hw.vps.cmd)->vpu.count = 0; + ((drm_r300_cmd_header_t *) rmesa->hw.vpi.cmd)->vpu.count = 0; + ((drm_r300_cmd_header_t *) rmesa->hw.vps.cmd)->vpu.count = 0; setup_vertex_shader_fragment(rmesa, VSF_DEST_PROGRAM, &(prog->program)); #if 0 - setup_vertex_shader_fragment(rmesa, VSF_DEST_UNKNOWN1, &(rmesa->state.vertex_shader.unknown1)); - setup_vertex_shader_fragment(rmesa, VSF_DEST_UNKNOWN2, &(rmesa->state.vertex_shader.unknown2)); + setup_vertex_shader_fragment(rmesa, VSF_DEST_UNKNOWN1, + &(rmesa->state.vertex_shader.unknown1)); + setup_vertex_shader_fragment(rmesa, VSF_DEST_UNKNOWN2, + &(rmesa->state.vertex_shader.unknown2)); #endif - inst_count=prog->program.length/4 - 1; + inst_count = prog->program.length / 4 - 1; R300_STATECHANGE(rmesa, pvs); - rmesa->hw.pvs.cmd[R300_PVS_CNTL_1]=(0 << R300_PVS_CNTL_1_PROGRAM_START_SHIFT) - | (inst_count/*pos_end*/ << R300_PVS_CNTL_1_POS_END_SHIFT) - | (inst_count << R300_PVS_CNTL_1_PROGRAM_END_SHIFT); - rmesa->hw.pvs.cmd[R300_PVS_CNTL_2]=(0 << R300_PVS_CNTL_2_PARAM_OFFSET_SHIFT) - | (param_count << R300_PVS_CNTL_2_PARAM_COUNT_SHIFT); - rmesa->hw.pvs.cmd[R300_PVS_CNTL_3]=(0/*rmesa->state.vertex_shader.unknown_ptr2*/ << R300_PVS_CNTL_3_PROGRAM_UNKNOWN_SHIFT) - | (inst_count /*rmesa->state.vertex_shader.unknown_ptr3*/ << 0); + rmesa->hw.pvs.cmd[R300_PVS_CNTL_1] = + (0 << R300_PVS_CNTL_1_PROGRAM_START_SHIFT) + | (inst_count /*pos_end */ << R300_PVS_CNTL_1_POS_END_SHIFT) + | (inst_count << R300_PVS_CNTL_1_PROGRAM_END_SHIFT); + rmesa->hw.pvs.cmd[R300_PVS_CNTL_2] = + (0 << R300_PVS_CNTL_2_PARAM_OFFSET_SHIFT) + | (param_count << R300_PVS_CNTL_2_PARAM_COUNT_SHIFT); + rmesa->hw.pvs.cmd[R300_PVS_CNTL_3] = + (0 /*rmesa->state.vertex_shader.unknown_ptr2 */ << + R300_PVS_CNTL_3_PROGRAM_UNKNOWN_SHIFT) + | (inst_count /*rmesa->state.vertex_shader.unknown_ptr3 */ << + 0); /* This is done for vertex shader fragments, but also needs to be done for vap_pvs, - so I leave it as a reminder */ + so I leave it as a reminder */ #if 0 - reg_start(R300_VAP_PVS_WAITIDLE,0); - e32(0x00000000); -#endif -} - -extern void _tnl_UpdateFixedFunctionProgram( GLcontext *ctx ); - -extern int future_hw_tcl_on; -void r300UpdateShaders(r300ContextPtr rmesa) -{ - GLcontext *ctx; - struct r300_vertex_program *vp; - int i; - - ctx = rmesa->radeon.glCtx; - - if (rmesa->NewGLState && hw_tcl_on) { - rmesa->NewGLState = 0; - - for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) { - rmesa->temp_attrib[i] = TNL_CONTEXT(ctx)->vb.AttribPtr[i]; - TNL_CONTEXT(ctx)->vb.AttribPtr[i] = &rmesa->dummy_attrib[i]; - } - - _tnl_UpdateFixedFunctionProgram(ctx); - - for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) { - TNL_CONTEXT(ctx)->vb.AttribPtr[i] = rmesa->temp_attrib[i]; - } - - vp = (struct r300_vertex_program *)CURRENT_VERTEX_SHADER(ctx); - if (vp->translated == GL_FALSE) - r300_translate_vertex_shader(vp); - if (vp->translated == GL_FALSE) { - fprintf(stderr, "Failing back to sw-tcl\n"); - hw_tcl_on = future_hw_tcl_on = 0; - r300ResetHwState(rmesa); - - return ; - } - } - -} - -void r300UpdateShaderStates(r300ContextPtr rmesa) -{ - GLcontext *ctx; - ctx = rmesa->radeon.glCtx; - -#ifdef CB_DPATH - r300UpdateTextureState(ctx); + reg_start(R300_VAP_PVS_WAITIDLE, 0); + e32(0x00000000); #endif - - r300SetupPixelShader(rmesa); - r300_setup_textures(ctx); - - r300SetupVertexShader(rmesa); - r300_setup_rs_unit(ctx); } -/* This is probably wrong for some values, I need to test this - * some more. Range checking would be a good idea also.. - * - * But it works for most things. I'll fix it later if someone - * else with a better clue doesn't - */ -static unsigned int r300PackFloat24(float f) -{ - float mantissa; - int exponent; - unsigned int float24 = 0; - - if (f == 0.0) return 0; - - mantissa = frexpf(f, &exponent); - - /* Handle -ve */ - if (mantissa < 0) { - float24 |= (1<<23); - mantissa = mantissa * -1.0; - } - /* Handle exponent, bias of 63 */ - exponent += 62; - float24 |= (exponent << 16); - /* Kill 7 LSB of mantissa */ - float24 |= (r300PackFloat32(mantissa) & 0x7FFFFF) >> 7; - - return float24; -} - -void r300SetupPixelShader(r300ContextPtr rmesa) +static void r300SetupVertexShader(r300ContextPtr rmesa) { GLcontext *ctx = rmesa->radeon.glCtx; - struct r300_fragment_program *rp = - (struct r300_fragment_program *) - (char *)ctx->FragmentProgram._Current; - int i,k; - if (!rp) /* should only happenen once, just after context is created */ + /* Reset state, in case we don't use something */ + ((drm_r300_cmd_header_t *) rmesa->hw.vpp.cmd)->vpu.count = 0; + ((drm_r300_cmd_header_t *) rmesa->hw.vpi.cmd)->vpu.count = 0; + ((drm_r300_cmd_header_t *) rmesa->hw.vps.cmd)->vpu.count = 0; + + /* Not sure why this doesnt work... + 0x400 area might have something to do with pixel shaders as it appears right after pfs programming. + 0x406 is set to { 0.0, 0.0, 1.0, 0.0 } most of the time but should change with smooth points and in other rare cases. */ + //setup_vertex_shader_fragment(rmesa, 0x406, &unk4); + if (hw_tcl_on + && ((struct r300_vertex_program *)CURRENT_VERTEX_SHADER(ctx))-> + translated) { + r300SetupVertexProgram(rmesa); return; - - r300_translate_fragment_shader(rp); - if (!rp->translated) { - fprintf(stderr, "%s: No valid fragment shader, exiting\n", __func__); - exit(-1); } - -#define OUTPUT_FIELD(st, reg, field) \ - R300_STATECHANGE(rmesa, st); \ - for(i=0;i<=rp->alu_end;i++) \ - rmesa->hw.st.cmd[R300_FPI_INSTR_0+i]=rp->alu.inst[i].field;\ - rmesa->hw.st.cmd[R300_FPI_CMD_0]=cmdpacket0(reg, rp->alu_end+1); - - OUTPUT_FIELD(fpi[0], R300_PFS_INSTR0_0, inst0); - OUTPUT_FIELD(fpi[1], R300_PFS_INSTR1_0, inst1); - OUTPUT_FIELD(fpi[2], R300_PFS_INSTR2_0, inst2); - OUTPUT_FIELD(fpi[3], R300_PFS_INSTR3_0, inst3); -#undef OUTPUT_FIELD - R300_STATECHANGE(rmesa, fp); - /* I just want to say, the way these nodes are stored.. weird.. */ - for (i=0,k=(4-(rp->cur_node+1));i<4;i++,k++) { - if (i<(rp->cur_node+1)) { - rmesa->hw.fp.cmd[R300_FP_NODE0+k]= - (rp->node[i].alu_offset << R300_PFS_NODE_ALU_OFFSET_SHIFT) - | (rp->node[i].alu_end << R300_PFS_NODE_ALU_END_SHIFT) - | (rp->node[i].tex_offset << R300_PFS_NODE_TEX_OFFSET_SHIFT) - | (rp->node[i].tex_end << R300_PFS_NODE_TEX_END_SHIFT) - | rp->node[i].flags; /* ( (k==3) ? R300_PFS_NODE_LAST_NODE : 0); */ - } else { - rmesa->hw.fp.cmd[R300_FP_NODE0+(3-i)] = 0; - } - } + /* This needs to be replaced by vertex shader generation code */ + r300GenerateSimpleVertexShader(rmesa); - /* PFS_CNTL_0 */ - rmesa->hw.fp.cmd[R300_FP_CNTL0]= - rp->cur_node - | (rp->first_node_has_tex<<3); - /* PFS_CNTL_1 */ - rmesa->hw.fp.cmd[R300_FP_CNTL1]=rp->max_temp_idx; - /* PFS_CNTL_2 */ - rmesa->hw.fp.cmd[R300_FP_CNTL2]= - (rp->alu_offset << R300_PFS_CNTL_ALU_OFFSET_SHIFT) - | (rp->alu_end << R300_PFS_CNTL_ALU_END_SHIFT) - | (rp->tex_offset << R300_PFS_CNTL_TEX_OFFSET_SHIFT) - | (rp->tex_end << R300_PFS_CNTL_TEX_END_SHIFT); + setup_vertex_shader_fragment(rmesa, VSF_DEST_PROGRAM, + &(rmesa->state.vertex_shader.program)); - R300_STATECHANGE(rmesa, fpp); - for(i=0;i<rp->const_nr;i++){ - rmesa->hw.fpp.cmd[R300_FPP_PARAM_0+4*i+0]=r300PackFloat24(rp->constant[i][0]); - rmesa->hw.fpp.cmd[R300_FPP_PARAM_0+4*i+1]=r300PackFloat24(rp->constant[i][1]); - rmesa->hw.fpp.cmd[R300_FPP_PARAM_0+4*i+2]=r300PackFloat24(rp->constant[i][2]); - rmesa->hw.fpp.cmd[R300_FPP_PARAM_0+4*i+3]=r300PackFloat24(rp->constant[i][3]); - } - rmesa->hw.fpp.cmd[R300_FPP_CMD_0]=cmdpacket0(R300_PFS_PARAM_0_X, rp->const_nr*4); -} +#if 0 + setup_vertex_shader_fragment(rmesa, VSF_DEST_UNKNOWN1, + &(rmesa->state.vertex_shader.unknown1)); + setup_vertex_shader_fragment(rmesa, VSF_DEST_UNKNOWN2, + &(rmesa->state.vertex_shader.unknown2)); +#endif -/** - * Called by Mesa after an internal state update. - */ -static void r300InvalidateState(GLcontext * ctx, GLuint new_state) -{ - r300ContextPtr r300 = R300_CONTEXT(ctx); - - _swrast_InvalidateState(ctx, new_state); - _swsetup_InvalidateState(ctx, new_state); - _ac_InvalidateState(ctx, new_state); - _tnl_InvalidateState(ctx, new_state); - _ae_invalidate_state(ctx, new_state); + R300_STATECHANGE(rmesa, pvs); + rmesa->hw.pvs.cmd[R300_PVS_CNTL_1] = + (rmesa->state.vertex_shader. + program_start << R300_PVS_CNTL_1_PROGRAM_START_SHIFT) + | (rmesa->state.vertex_shader. + unknown_ptr1 << R300_PVS_CNTL_1_POS_END_SHIFT) + | (rmesa->state.vertex_shader. + program_end << R300_PVS_CNTL_1_PROGRAM_END_SHIFT); + rmesa->hw.pvs.cmd[R300_PVS_CNTL_2] = + (rmesa->state.vertex_shader. + param_offset << R300_PVS_CNTL_2_PARAM_OFFSET_SHIFT) + | (rmesa->state.vertex_shader. + param_count << R300_PVS_CNTL_2_PARAM_COUNT_SHIFT); + rmesa->hw.pvs.cmd[R300_PVS_CNTL_3] = + (rmesa->state.vertex_shader. + unknown_ptr2 << R300_PVS_CNTL_3_PROGRAM_UNKNOWN_SHIFT) + | (rmesa->state.vertex_shader.unknown_ptr3 << 0); - if (new_state & (_NEW_BUFFERS | _NEW_COLOR | _NEW_PIXEL)) { - r300UpdateDrawBuffer(ctx); - } -#ifndef CB_DPATH - /* Go inefficiency! */ - r300ResetHwState(r300); -#endif -#ifdef HW_VBOS - if(new_state & _NEW_ARRAY) - r300->state.VB.lock_uptodate = GL_FALSE; + /* This is done for vertex shader fragments, but also needs to be done for vap_pvs, + so I leave it as a reminder */ +#if 0 + reg_start(R300_VAP_PVS_WAITIDLE, 0); + e32(0x00000000); #endif - r300->NewGLState |= new_state; } /** * Completely recalculates hardware state based on the Mesa state. */ -void r300ResetHwState(r300ContextPtr r300) +static void r300ResetHwState(r300ContextPtr r300) { - GLcontext* ctx = r300->radeon.glCtx; + GLcontext *ctx = r300->radeon.glCtx; + int has_tcl = 1; + + if (!(r300->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL)) + has_tcl = 0; if (RADEON_DEBUG & DEBUG_STATE) fprintf(stderr, "%s\n", __FUNCTION__); - /* This is a place to initialize registers which - have bitfields accessed by different functions - and not all bits are used */ -#if 0 - /* initialize similiar to r200 */ - r300->hw.zs.cmd[R300_ZS_CNTL_0] = 0; - r300->hw.zs.cmd[R300_ZS_CNTL_1] = - (R300_ZS_ALWAYS << R300_RB3D_ZS1_FRONT_FUNC_SHIFT) | - (R300_ZS_KEEP << R300_RB3D_ZS1_FRONT_FAIL_OP_SHIFT) | - (R300_ZS_KEEP << R300_RB3D_ZS1_FRONT_ZPASS_OP_SHIFT) | - (R300_ZS_KEEP << R300_RB3D_ZS1_FRONT_ZFAIL_OP_SHIFT) | - (R300_ZS_ALWAYS << R300_RB3D_ZS1_BACK_FUNC_SHIFT) | - (R300_ZS_KEEP << R300_RB3D_ZS1_BACK_FAIL_OP_SHIFT) | - (R300_ZS_KEEP << R300_RB3D_ZS1_BACK_ZPASS_OP_SHIFT) | - (R300_ZS_KEEP << R300_RB3D_ZS1_BACK_ZFAIL_OP_SHIFT); - r300->hw.zs.cmd[R300_ZS_CNTL_2] = 0x00ffff00; -#endif + /* This is a place to initialize registers which + have bitfields accessed by different functions + and not all bits are used */ - /* go and compute register values from GL state */ + /* go and compute register values from GL state */ r300UpdateWindow(ctx); r300ColorMask(ctx, - ctx->Color.ColorMask[RCOMP], - ctx->Color.ColorMask[GCOMP], - ctx->Color.ColorMask[BCOMP], - ctx->Color.ColorMask[ACOMP]); + ctx->Color.ColorMask[RCOMP], + ctx->Color.ColorMask[GCOMP], + ctx->Color.ColorMask[BCOMP], ctx->Color.ColorMask[ACOMP]); r300Enable(ctx, GL_DEPTH_TEST, ctx->Depth.Test); r300DepthMask(ctx, ctx->Depth.Mask); r300DepthFunc(ctx, ctx->Depth.Func); - + /* stencil */ r300Enable(ctx, GL_STENCIL_TEST, ctx->Stencil.Enabled); r300StencilMaskSeparate(ctx, 0, ctx->Stencil.WriteMask[0]); - r300StencilFuncSeparate(ctx, 0, ctx->Stencil.Function[0], ctx->Stencil.Ref[0], ctx->Stencil.ValueMask[0]); - r300StencilOpSeparate(ctx, 0, ctx->Stencil.FailFunc[0], ctx->Stencil.ZFailFunc[0], ctx->Stencil.ZPassFunc[0]); + r300StencilFuncSeparate(ctx, 0, ctx->Stencil.Function[0], + ctx->Stencil.Ref[0], ctx->Stencil.ValueMask[0]); + r300StencilOpSeparate(ctx, 0, ctx->Stencil.FailFunc[0], + ctx->Stencil.ZFailFunc[0], + ctx->Stencil.ZPassFunc[0]); r300UpdateCulling(ctx); r300UpdateTextureState(ctx); -// r300_setup_routing(ctx, GL_TRUE); - -#if 0 /* Done in prior to rendering */ - if(hw_tcl_on == GL_FALSE){ - r300EmitArrays(ctx, GL_TRUE); /* Just do the routing */ - r300_setup_textures(ctx); - r300_setup_rs_unit(ctx); - - r300SetupVertexShader(r300); - r300SetupPixelShader(r300); - } -#endif - - r300_set_blend_state(ctx); + r300SetBlendState(ctx); r300AlphaFunc(ctx, ctx->Color.AlphaFunc, ctx->Color.AlphaRef); r300Enable(ctx, GL_ALPHA_TEST, ctx->Color.AlphaEnabled); - - /* Initialize magic registers - TODO : learn what they really do, or get rid of - those we don't have to touch */ - r300->hw.unk2080.cmd[1] = 0x0030045A; //0x0030065a /* Dangerous */ + /* Initialize magic registers + TODO : learn what they really do, or get rid of + those we don't have to touch */ + if (!has_tcl) + r300->hw.vap_cntl.cmd[1] = 0x0014045a; + else + r300->hw.vap_cntl.cmd[1] = 0x0030045A; //0x0030065a /* Dangerous */ r300->hw.vte.cmd[1] = R300_VPORT_X_SCALE_ENA - | R300_VPORT_X_OFFSET_ENA - | R300_VPORT_Y_SCALE_ENA - | R300_VPORT_Y_OFFSET_ENA - | R300_VPORT_Z_SCALE_ENA - | R300_VPORT_Z_OFFSET_ENA - | R300_VTX_W0_FMT; + | R300_VPORT_X_OFFSET_ENA + | R300_VPORT_Y_SCALE_ENA + | R300_VPORT_Y_OFFSET_ENA + | R300_VPORT_Z_SCALE_ENA + | R300_VPORT_Z_OFFSET_ENA | R300_VTX_W0_FMT; r300->hw.vte.cmd[2] = 0x00000008; r300->hw.unk2134.cmd[1] = 0x00FFFFFF; r300->hw.unk2134.cmd[2] = 0x00000000; -#ifdef MESA_BIG_ENDIAN - r300->hw.unk2140.cmd[1] = 0x00000002; -#else - r300->hw.unk2140.cmd[1] = 0x00000000; -#endif - -#if 0 /* Done in setup routing */ - ((drm_r300_cmd_header_t*)r300->hw.vir[0].cmd)->packet0.count = 1; - r300->hw.vir[0].cmd[1] = 0x21030003; - - ((drm_r300_cmd_header_t*)r300->hw.vir[1].cmd)->packet0.count = 1; - r300->hw.vir[1].cmd[1] = 0xF688F688; + if (_mesa_little_endian()) + r300->hw.vap_cntl_status.cmd[1] = R300_VC_NO_SWAP; + else + r300->hw.vap_cntl_status.cmd[1] = R300_VC_32BIT_SWAP; - r300->hw.vic.cmd[R300_VIR_CNTL_0] = 0x00000001; - r300->hw.vic.cmd[R300_VIR_CNTL_1] = 0x00000405; -#endif + /* disable VAP/TCL on non-TCL capable chips */ + if (!has_tcl) + r300->hw.vap_cntl_status.cmd[1] |= R300_VAP_TCL_BYPASS; r300->hw.unk21DC.cmd[1] = 0xAAAAAAAA; - r300->hw.unk221C.cmd[1] = R300_221C_NORMAL; + r300->hw.vap_clip_cntl.cmd[1] = R300_221C_NORMAL; r300->hw.unk2220.cmd[1] = r300PackFloat32(1.0); r300->hw.unk2220.cmd[2] = r300PackFloat32(1.0); @@ -1942,45 +1924,32 @@ void r300ResetHwState(r300ContextPtr r300) else r300->hw.unk2288.cmd[1] = R300_2288_RV350; -#if 0 - r300->hw.vof.cmd[R300_VOF_CNTL_0] = R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT - | R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT; - r300->hw.vof.cmd[R300_VOF_CNTL_1] = 0; /* no textures */ - - - r300->hw.pvs.cmd[R300_PVS_CNTL_1] = 0; - r300->hw.pvs.cmd[R300_PVS_CNTL_2] = 0; - r300->hw.pvs.cmd[R300_PVS_CNTL_3] = 0; -#endif - r300->hw.gb_enable.cmd[1] = R300_GB_POINT_STUFF_ENABLE - | R300_GB_LINE_STUFF_ENABLE - | R300_GB_TRIANGLE_STUFF_ENABLE /*| R300_GB_UNK31*/; + | R300_GB_LINE_STUFF_ENABLE + | R300_GB_TRIANGLE_STUFF_ENABLE /*| R300_GB_UNK31 */ ; r300->hw.gb_misc.cmd[R300_GB_MISC_MSPOS_0] = 0x66666666; r300->hw.gb_misc.cmd[R300_GB_MISC_MSPOS_1] = 0x06666666; - if ((r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_R300) || - (r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_R350)) - r300->hw.gb_misc.cmd[R300_GB_MISC_TILE_CONFIG] = R300_GB_TILE_ENABLE - | R300_GB_TILE_PIPE_COUNT_R300 - | R300_GB_TILE_SIZE_16; + if ((r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_R300) || + (r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_R350)) + r300->hw.gb_misc.cmd[R300_GB_MISC_TILE_CONFIG] = + R300_GB_TILE_ENABLE | R300_GB_TILE_PIPE_COUNT_R300 | + R300_GB_TILE_SIZE_16; else if (r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV410) - r300->hw.gb_misc.cmd[R300_GB_MISC_TILE_CONFIG] = R300_GB_TILE_ENABLE - | R300_GB_TILE_PIPE_COUNT_RV410 - | R300_GB_TILE_SIZE_16; + r300->hw.gb_misc.cmd[R300_GB_MISC_TILE_CONFIG] = + R300_GB_TILE_ENABLE | R300_GB_TILE_PIPE_COUNT_RV410 | + R300_GB_TILE_SIZE_16; else if (r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_R420) - r300->hw.gb_misc.cmd[R300_GB_MISC_TILE_CONFIG] = R300_GB_TILE_ENABLE - | R300_GB_TILE_PIPE_COUNT_R420 - | R300_GB_TILE_SIZE_16; + r300->hw.gb_misc.cmd[R300_GB_MISC_TILE_CONFIG] = + R300_GB_TILE_ENABLE | R300_GB_TILE_PIPE_COUNT_R420 | + R300_GB_TILE_SIZE_16; else - r300->hw.gb_misc.cmd[R300_GB_MISC_TILE_CONFIG] = R300_GB_TILE_ENABLE - | R300_GB_TILE_PIPE_COUNT_RV300 - | R300_GB_TILE_SIZE_16; + r300->hw.gb_misc.cmd[R300_GB_MISC_TILE_CONFIG] = + R300_GB_TILE_ENABLE | R300_GB_TILE_PIPE_COUNT_RV300 | + R300_GB_TILE_SIZE_16; /* set to 0 when fog is disabled? */ r300->hw.gb_misc.cmd[R300_GB_MISC_SELECT] = R300_GB_FOG_SELECT_1_1_W; - r300->hw.gb_misc.cmd[R300_GB_MISC_AA_CONFIG] = 0x00000000; /* No antialiasing */ - - //r300->hw.txe.cmd[R300_TXE_ENABLE] = 0; + r300->hw.gb_misc.cmd[R300_GB_MISC_AA_CONFIG] = R300_AA_DISABLE; /* No antialiasing */ r300->hw.unk4200.cmd[1] = r300PackFloat32(0.0); r300->hw.unk4200.cmd[2] = r300PackFloat32(0.0); @@ -1990,10 +1959,6 @@ void r300ResetHwState(r300ContextPtr r300) r300->hw.unk4214.cmd[1] = 0x00050005; r300PointSize(ctx, 0.0); -#if 0 - r300->hw.ps.cmd[R300_PS_POINTSIZE] = (6 << R300_POINTSIZE_X_SHIFT) | - (6 << R300_POINTSIZE_Y_SHIFT); -#endif r300->hw.unk4230.cmd[1] = 0x18000006; r300->hw.unk4230.cmd[2] = 0x00020006; @@ -2005,89 +1970,66 @@ void r300ResetHwState(r300ContextPtr r300) r300->hw.unk4260.cmd[2] = r300PackFloat32(0.0); r300->hw.unk4260.cmd[3] = r300PackFloat32(1.0); - r300->hw.unk4274.cmd[1] = 0x00000002; + r300->hw.shade.cmd[1] = 0x00000002; r300ShadeModel(ctx, ctx->Light.ShadeModel); - r300->hw.unk4274.cmd[3] = 0x00000000; - r300->hw.unk4274.cmd[4] = 0x00000000; + r300->hw.shade.cmd[3] = 0x00000000; + r300->hw.shade.cmd[4] = 0x00000000; r300PolygonMode(ctx, GL_FRONT, ctx->Polygon.FrontMode); r300PolygonMode(ctx, GL_BACK, ctx->Polygon.BackMode); - r300->hw.unk4288.cmd[2] = 0x00000001; - r300->hw.unk4288.cmd[3] = 0x00000000; - r300->hw.unk42A0.cmd[1] = 0x00000000; + r300->hw.polygon_mode.cmd[2] = 0x00000001; + r300->hw.polygon_mode.cmd[3] = 0x00000000; + r300->hw.zbias_cntl.cmd[1] = 0x00000000; - r300PolygonOffset(ctx, ctx->Polygon.OffsetFactor, ctx->Polygon.OffsetUnits); + r300PolygonOffset(ctx, ctx->Polygon.OffsetFactor, + ctx->Polygon.OffsetUnits); r300Enable(ctx, GL_POLYGON_OFFSET_FILL, ctx->Polygon.OffsetFill); - + r300->hw.unk42C0.cmd[1] = 0x4B7FFFFF; r300->hw.unk42C0.cmd[2] = 0x00000000; - r300->hw.unk43A4.cmd[1] = 0x0000001C; r300->hw.unk43A4.cmd[2] = 0x2DA49525; r300->hw.unk43E8.cmd[1] = 0x00FFFFFF; -#if 0 - r300->hw.fp.cmd[R300_FP_CNTL0] = 0; - r300->hw.fp.cmd[R300_FP_CNTL1] = 0; - r300->hw.fp.cmd[R300_FP_CNTL2] = 0; - r300->hw.fp.cmd[R300_FP_NODE0] = 0; - r300->hw.fp.cmd[R300_FP_NODE1] = 0; - r300->hw.fp.cmd[R300_FP_NODE2] = 0; - r300->hw.fp.cmd[R300_FP_NODE3] = 0; -#endif - r300->hw.unk46A4.cmd[1] = 0x00001B01; r300->hw.unk46A4.cmd[2] = 0x00001B0F; r300->hw.unk46A4.cmd[3] = 0x00001B0F; r300->hw.unk46A4.cmd[4] = 0x00001B0F; r300->hw.unk46A4.cmd[5] = 0x00000001; -#if 0 - for(i = 1; i <= 64; ++i) { - /* create NOP instructions */ - r300->hw.fpi[0].cmd[i] = FP_INSTRC(MAD, FP_ARGC(SRC0C_XYZ), FP_ARGC(ONE), FP_ARGC(ZERO)); - r300->hw.fpi[1].cmd[i] = FP_SELC(0,XYZ,NO,FP_TMP(0),0,0); - r300->hw.fpi[2].cmd[i] = FP_INSTRA(MAD, FP_ARGA(SRC0A), FP_ARGA(ONE), FP_ARGA(ZERO)); - r300->hw.fpi[3].cmd[i] = FP_SELA(0,W,NO,FP_TMP(0),0,0); - } -#endif r300Enable(ctx, GL_FOG, ctx->Fog.Enabled); - ctx->Driver.Fogfv( ctx, GL_FOG_MODE, NULL ); - ctx->Driver.Fogfv( ctx, GL_FOG_DENSITY, &ctx->Fog.Density ); - ctx->Driver.Fogfv( ctx, GL_FOG_START, &ctx->Fog.Start ); - ctx->Driver.Fogfv( ctx, GL_FOG_END, &ctx->Fog.End ); - ctx->Driver.Fogfv( ctx, GL_FOG_COLOR, ctx->Fog.Color ); - ctx->Driver.Fogfv( ctx, GL_FOG_COORDINATE_SOURCE_EXT, NULL ); + ctx->Driver.Fogfv(ctx, GL_FOG_MODE, NULL); + ctx->Driver.Fogfv(ctx, GL_FOG_DENSITY, &ctx->Fog.Density); + ctx->Driver.Fogfv(ctx, GL_FOG_START, &ctx->Fog.Start); + ctx->Driver.Fogfv(ctx, GL_FOG_END, &ctx->Fog.End); + ctx->Driver.Fogfv(ctx, GL_FOG_COLOR, ctx->Fog.Color); + ctx->Driver.Fogfv(ctx, GL_FOG_COORDINATE_SOURCE_EXT, NULL); r300->hw.at.cmd[R300_AT_UNKNOWN] = 0; r300->hw.unk4BD8.cmd[1] = 0; r300->hw.unk4E00.cmd[1] = 0; -#if 0 - r300->hw.bld.cmd[R300_BLD_CBLEND] = 0; - r300->hw.bld.cmd[R300_BLD_ABLEND] = 0; -#endif - r300BlendColor(ctx, ctx->Color.BlendColor); - r300->hw.unk4E10.cmd[2] = 0; - r300->hw.unk4E10.cmd[3] = 0; - + r300->hw.blend_color.cmd[2] = 0; + r300->hw.blend_color.cmd[3] = 0; + /* Again, r300ClearBuffer uses this */ - r300->hw.cb.cmd[R300_CB_OFFSET] = r300->radeon.state.color.drawOffset + - r300->radeon.radeonScreen->fbLocation; + r300->hw.cb.cmd[R300_CB_OFFSET] = + r300->radeon.state.color.drawOffset + + r300->radeon.radeonScreen->fbLocation; r300->hw.cb.cmd[R300_CB_PITCH] = r300->radeon.state.color.drawPitch; - + if (r300->radeon.radeonScreen->cpp == 4) r300->hw.cb.cmd[R300_CB_PITCH] |= R300_COLOR_FORMAT_ARGB8888; else r300->hw.cb.cmd[R300_CB_PITCH] |= R300_COLOR_FORMAT_RGB565; - + if (r300->radeon.sarea->tiling_enabled) r300->hw.cb.cmd[R300_CB_PITCH] |= R300_COLOR_TILE_ENABLE; - + r300->hw.unk4E50.cmd[1] = 0; r300->hw.unk4E50.cmd[2] = 0; r300->hw.unk4E50.cmd[3] = 0; @@ -2105,36 +2047,37 @@ void r300ResetHwState(r300ContextPtr r300) switch (ctx->Visual.depthBits) { case 16: - r300->hw.unk4F10.cmd[1] = R300_DEPTH_FORMAT_16BIT_INT_Z; - break; + r300->hw.zstencil_format.cmd[1] = R300_DEPTH_FORMAT_16BIT_INT_Z; + break; case 24: - r300->hw.unk4F10.cmd[1] = R300_DEPTH_FORMAT_24BIT_INT_Z; - break; + r300->hw.zstencil_format.cmd[1] = R300_DEPTH_FORMAT_24BIT_INT_Z; + break; default: fprintf(stderr, "Error: Unsupported depth %d... exiting\n", ctx->Visual.depthBits); - exit(-1); - + _mesa_exit(-1); + } /* z compress? */ - //r300->hw.unk4F10.cmd[1] |= R300_DEPTH_FORMAT_UNK32; - - r300->hw.unk4F10.cmd[3] = 0x00000003; - r300->hw.unk4F10.cmd[4] = 0x00000000; + //r300->hw.zstencil_format.cmd[1] |= R300_DEPTH_FORMAT_UNK32; + + r300->hw.zstencil_format.cmd[3] = 0x00000003; + r300->hw.zstencil_format.cmd[4] = 0x00000000; r300->hw.zb.cmd[R300_ZB_OFFSET] = - r300->radeon.radeonScreen->depthOffset + - r300->radeon.radeonScreen->fbLocation; + r300->radeon.radeonScreen->depthOffset + + r300->radeon.radeonScreen->fbLocation; r300->hw.zb.cmd[R300_ZB_PITCH] = r300->radeon.radeonScreen->depthPitch; - - if (r300->radeon.sarea->tiling_enabled) { + + if (r300->radeon.sarea->tiling_enabled) { /* Turn off when clearing buffers ? */ r300->hw.zb.cmd[R300_ZB_PITCH] |= R300_DEPTH_TILE_ENABLE; - + if (ctx->Visual.depthBits == 24) - r300->hw.zb.cmd[R300_ZB_PITCH] |= R300_DEPTH_MICROTILE_ENABLE; + r300->hw.zb.cmd[R300_ZB_PITCH] |= + R300_DEPTH_MICROTILE_ENABLE; } - + r300->hw.unk4F28.cmd[1] = 0; r300->hw.unk4F30.cmd[1] = 0; @@ -2144,31 +2087,172 @@ void r300ResetHwState(r300ContextPtr r300) r300->hw.unk4F54.cmd[1] = 0; -#if 0 - ((drm_r300_cmd_header_t*)r300->hw.vpi.cmd)->vpu.count = 0; - for(i = 1; i < R300_VPI_CMDSIZE; i += 4) { - /* MOV t0, t0 */ - r300->hw.vpi.cmd[i+0] = VP_OUT(ADD,TMP,0,XYZW); - r300->hw.vpi.cmd[i+1] = VP_IN(TMP,0); - r300->hw.vpi.cmd[i+2] = VP_ZERO(); - r300->hw.vpi.cmd[i+3] = VP_ZERO(); + if (has_tcl) { + r300->hw.vps.cmd[R300_VPS_ZERO_0] = 0; + r300->hw.vps.cmd[R300_VPS_ZERO_1] = 0; + r300->hw.vps.cmd[R300_VPS_POINTSIZE] = r300PackFloat32(1.0); + r300->hw.vps.cmd[R300_VPS_ZERO_3] = 0; } +//END: TODO + r300->hw.all_dirty = GL_TRUE; +} - ((drm_r300_cmd_header_t*)r300->hw.vpp.cmd)->vpu.count = 0; - for(i = 1; i < R300_VPP_CMDSIZE; ++i) - r300->hw.vpp.cmd[i] = 0; -#endif - r300->hw.vps.cmd[R300_VPS_ZERO_0] = 0; - r300->hw.vps.cmd[R300_VPS_ZERO_1] = 0; - r300->hw.vps.cmd[R300_VPS_POINTSIZE] = r300PackFloat32(1.0); - r300->hw.vps.cmd[R300_VPS_ZERO_3] = 0; +extern void _tnl_UpdateFixedFunctionProgram(GLcontext * ctx); + +extern int future_hw_tcl_on; +void r300UpdateShaders(r300ContextPtr rmesa) +{ + GLcontext *ctx; + struct r300_vertex_program *vp; + int i; + + ctx = rmesa->radeon.glCtx; + + if (rmesa->NewGLState && hw_tcl_on) { + rmesa->NewGLState = 0; + + for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) { + rmesa->temp_attrib[i] = + TNL_CONTEXT(ctx)->vb.AttribPtr[i]; + TNL_CONTEXT(ctx)->vb.AttribPtr[i] = + &rmesa->dummy_attrib[i]; + } + + _tnl_UpdateFixedFunctionProgram(ctx); + + for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) { + TNL_CONTEXT(ctx)->vb.AttribPtr[i] = + rmesa->temp_attrib[i]; + } + + r300SelectVertexShader(rmesa); + vp = (struct r300_vertex_program *) + CURRENT_VERTEX_SHADER(ctx); + /*if (vp->translated == GL_FALSE) + r300TranslateVertexShader(vp); */ + if (vp->translated == GL_FALSE) { + fprintf(stderr, "Failing back to sw-tcl\n"); + hw_tcl_on = future_hw_tcl_on = 0; + r300ResetHwState(rmesa); + + return; + } + r300UpdateStateParameters(ctx, _NEW_PROGRAM); + } -//END: TODO - r300->hw.all_dirty = GL_TRUE; } +static void r300SetupPixelShader(r300ContextPtr rmesa) +{ + GLcontext *ctx = rmesa->radeon.glCtx; + struct r300_fragment_program *fp = (struct r300_fragment_program *) + (char *)ctx->FragmentProgram._Current; + int i, k; + + if (!fp) /* should only happenen once, just after context is created */ + return; + r300TranslateFragmentShader(rmesa, fp); + if (!fp->translated) { + fprintf(stderr, "%s: No valid fragment shader, exiting\n", + __FUNCTION__); + return; + } +#define OUTPUT_FIELD(st, reg, field) \ + R300_STATECHANGE(rmesa, st); \ + for(i=0;i<=fp->alu_end;i++) \ + rmesa->hw.st.cmd[R300_FPI_INSTR_0+i]=fp->alu.inst[i].field;\ + rmesa->hw.st.cmd[R300_FPI_CMD_0]=cmdpacket0(reg, fp->alu_end+1); + + OUTPUT_FIELD(fpi[0], R300_PFS_INSTR0_0, inst0); + OUTPUT_FIELD(fpi[1], R300_PFS_INSTR1_0, inst1); + OUTPUT_FIELD(fpi[2], R300_PFS_INSTR2_0, inst2); + OUTPUT_FIELD(fpi[3], R300_PFS_INSTR3_0, inst3); +#undef OUTPUT_FIELD + + R300_STATECHANGE(rmesa, fp); + /* I just want to say, the way these nodes are stored.. weird.. */ + for (i = 0, k = (4 - (fp->cur_node + 1)); i < 4; i++, k++) { + if (i < (fp->cur_node + 1)) { + rmesa->hw.fp.cmd[R300_FP_NODE0 + k] = + (fp->node[i]. + alu_offset << R300_PFS_NODE_ALU_OFFSET_SHIFT) + | (fp->node[i]. + alu_end << R300_PFS_NODE_ALU_END_SHIFT) + | (fp->node[i]. + tex_offset << R300_PFS_NODE_TEX_OFFSET_SHIFT) + | (fp->node[i]. + tex_end << R300_PFS_NODE_TEX_END_SHIFT) + | fp->node[i].flags; /* ( (k==3) ? R300_PFS_NODE_LAST_NODE : 0); */ + } else { + rmesa->hw.fp.cmd[R300_FP_NODE0 + (3 - i)] = 0; + } + } + + /* PFS_CNTL_0 */ + rmesa->hw.fp.cmd[R300_FP_CNTL0] = + fp->cur_node | (fp->first_node_has_tex << 3); + /* PFS_CNTL_1 */ + rmesa->hw.fp.cmd[R300_FP_CNTL1] = fp->max_temp_idx; + /* PFS_CNTL_2 */ + rmesa->hw.fp.cmd[R300_FP_CNTL2] = + (fp->alu_offset << R300_PFS_CNTL_ALU_OFFSET_SHIFT) + | (fp->alu_end << R300_PFS_CNTL_ALU_END_SHIFT) + | (fp->tex_offset << R300_PFS_CNTL_TEX_OFFSET_SHIFT) + | (fp->tex_end << R300_PFS_CNTL_TEX_END_SHIFT); + + R300_STATECHANGE(rmesa, fpp); + for (i = 0; i < fp->const_nr; i++) { + rmesa->hw.fpp.cmd[R300_FPP_PARAM_0 + 4 * i + 0] = + r300PackFloat24(fp->constant[i][0]); + rmesa->hw.fpp.cmd[R300_FPP_PARAM_0 + 4 * i + 1] = + r300PackFloat24(fp->constant[i][1]); + rmesa->hw.fpp.cmd[R300_FPP_PARAM_0 + 4 * i + 2] = + r300PackFloat24(fp->constant[i][2]); + rmesa->hw.fpp.cmd[R300_FPP_PARAM_0 + 4 * i + 3] = + r300PackFloat24(fp->constant[i][3]); + } + rmesa->hw.fpp.cmd[R300_FPP_CMD_0] = + cmdpacket0(R300_PFS_PARAM_0_X, fp->const_nr * 4); +} + +void r300UpdateShaderStates(r300ContextPtr rmesa) +{ + GLcontext *ctx; + ctx = rmesa->radeon.glCtx; + + r300UpdateTextureState(ctx); + + r300SetupPixelShader(rmesa); + r300SetupTextures(ctx); + + if ((rmesa->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL)) + r300SetupVertexShader(rmesa); + r300SetupRSUnit(ctx); +} + +/** + * Called by Mesa after an internal state update. + */ +static void r300InvalidateState(GLcontext * ctx, GLuint new_state) +{ + r300ContextPtr r300 = R300_CONTEXT(ctx); + + _swrast_InvalidateState(ctx, new_state); + _swsetup_InvalidateState(ctx, new_state); + _vbo_InvalidateState(ctx, new_state); + _tnl_InvalidateState(ctx, new_state); + _ae_invalidate_state(ctx, new_state); + + if (new_state & (_NEW_BUFFERS | _NEW_COLOR | _NEW_PIXEL)) { + r300UpdateDrawBuffer(ctx); + } + + r300UpdateStateParameters(ctx, new_state); + + r300->NewGLState |= new_state; +} /** * Calculate initial hardware state and register state functions. @@ -2193,32 +2277,66 @@ void r300InitState(r300ContextPtr r300) depth_fmt = R300_DEPTH_FORMAT_24BIT_INT_Z; r300->state.stencil.clear = 0x00ff0000; break; + + default: fprintf(stderr, "Error: Unsupported depth %d... exiting\n", ctx->Visual.depthBits); - exit(-1); + _mesa_exit(-1); } /* Only have hw stencil when depth buffer is 24 bits deep */ r300->state.stencil.hw_stencil = (ctx->Visual.stencilBits > 0 && - ctx->Visual.depthBits == 24); + ctx->Visual.depthBits == 24); memset(&(r300->state.texture), 0, sizeof(r300->state.texture)); - + r300ResetHwState(r300); } -static void r300RenderMode( GLcontext *ctx, GLenum mode ) +static void r300RenderMode(GLcontext * ctx, GLenum mode) { r300ContextPtr rmesa = R300_CONTEXT(ctx); (void)rmesa; (void)mode; } +static void r300ClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq ) +{ + r300ContextPtr rmesa = R300_CONTEXT(ctx); + GLint p = (GLint) plane - (GLint) GL_CLIP_PLANE0; + GLint *ip = (GLint *)ctx->Transform._ClipUserPlane[p]; + + R300_STATECHANGE( rmesa, vpucp[p] ); + rmesa->hw.vpucp[p].cmd[R300_VPUCP_X] = ip[0]; + rmesa->hw.vpucp[p].cmd[R300_VPUCP_Y] = ip[1]; + rmesa->hw.vpucp[p].cmd[R300_VPUCP_Z] = ip[2]; + rmesa->hw.vpucp[p].cmd[R300_VPUCP_W] = ip[3]; +} + + +void r300UpdateClipPlanes( GLcontext *ctx ) +{ + r300ContextPtr rmesa = R300_CONTEXT(ctx); + GLuint p; + + for (p = 0; p < ctx->Const.MaxClipPlanes; p++) { + if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { + GLint *ip = (GLint *)ctx->Transform._ClipUserPlane[p]; + + R300_STATECHANGE( rmesa, vpucp[p] ); + rmesa->hw.vpucp[p].cmd[R300_VPUCP_X] = ip[0]; + rmesa->hw.vpucp[p].cmd[R300_VPUCP_Y] = ip[1]; + rmesa->hw.vpucp[p].cmd[R300_VPUCP_Z] = ip[2]; + rmesa->hw.vpucp[p].cmd[R300_VPUCP_W] = ip[3]; + } + } +} + /** * Initialize driver's state callback functions */ -void r300InitStateFuncs(struct dd_function_table* functions) +void r300InitStateFuncs(struct dd_function_table *functions) { radeonInitStateFuncs(functions); @@ -2250,7 +2368,8 @@ void r300InitStateFuncs(struct dd_function_table* functions) functions->PolygonOffset = r300PolygonOffset; functions->PolygonMode = r300PolygonMode; - - functions->RenderMode = r300RenderMode; -} + functions->RenderMode = r300RenderMode; + + functions->ClipPlane = r300ClipPlane; +} diff --git a/dist/Mesa/src/mesa/drivers/dri/radeon/radeon_chipset.h b/dist/Mesa/src/mesa/drivers/dri/radeon/radeon_chipset.h index 731809909..5c17e8fbe 100644 --- a/dist/Mesa/src/mesa/drivers/dri/radeon/radeon_chipset.h +++ b/dist/Mesa/src/mesa/drivers/dri/radeon/radeon_chipset.h @@ -127,6 +127,7 @@ #define PCI_CHIP_RV370_5B63 0x5B63 #define PCI_CHIP_RV370_5B64 0x5B64 #define PCI_CHIP_RV370_5B65 0x5B65 +#define PCI_CHIP_RV370_5657 0x5657 #define PCI_CHIP_RV280_5C61 0x5C61 #define PCI_CHIP_RV280_5C63 0x5C63 #define PCI_CHIP_R430_5D48 0x5D48 diff --git a/dist/Mesa/src/mesa/drivers/dri/radeon/radeon_screen.c b/dist/Mesa/src/mesa/drivers/dri/radeon/radeon_screen.c index 682cf3a5e..907a987fb 100644 --- a/dist/Mesa/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/dist/Mesa/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -585,6 +585,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) case PCI_CHIP_RV370_5B63: case PCI_CHIP_RV370_5B64: case PCI_CHIP_RV370_5B65: + case PCI_CHIP_RV370_5657: case PCI_CHIP_RV380_3150: case PCI_CHIP_RV380_3152: case PCI_CHIP_RV380_3154: @@ -634,6 +635,13 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) screen->chip_flags = RADEON_CHIPSET_TCL; break; + /* RV410 SE chips have half the pipes of regular RV410 */ + case PCI_CHIP_RV410_5E4C: + case PCI_CHIP_RV410_5E4F: + screen->chip_family = CHIP_FAMILY_RV380; + screen->chip_flags = RADEON_CHIPSET_TCL; + break; + case PCI_CHIP_RV410_564A: case PCI_CHIP_RV410_564B: case PCI_CHIP_RV410_564F: @@ -642,9 +650,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) case PCI_CHIP_RV410_5E48: case PCI_CHIP_RV410_5E4A: case PCI_CHIP_RV410_5E4B: - case PCI_CHIP_RV410_5E4C: case PCI_CHIP_RV410_5E4D: - case PCI_CHIP_RV410_5E4F: screen->chip_family = CHIP_FAMILY_RV410; screen->chip_flags = RADEON_CHIPSET_TCL; break; @@ -702,8 +708,11 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) screen->depthPitch = dri_priv->depthPitch; /* Check if ddx has set up a surface reg to cover depth buffer */ - screen->depthHasSurface = ((sPriv->ddxMajor > 4) && - (screen->chip_flags & RADEON_CHIPSET_TCL)); + screen->depthHasSurface = (sPriv->ddxMajor > 4) || + /* these chips don't use tiled z without hyperz. So always pretend + we have set up a surface which will cause linear reads/writes */ + ((screen->chip_family & RADEON_CLASS_R100) && + !(screen->chip_flags & RADEON_CHIPSET_TCL)); if ( dri_priv->textureSize == 0 ) { screen->texOffset[RADEON_LOCAL_TEX_HEAP] = screen->gart_texture_offset; diff --git a/dist/Mesa/src/mesa/drivers/dri/radeon/radeon_tcl.c b/dist/Mesa/src/mesa/drivers/dri/radeon/radeon_tcl.c index ffd49b525..0f4baf2e7 100644 --- a/dist/Mesa/src/mesa/drivers/dri/radeon/radeon_tcl.c +++ b/dist/Mesa/src/mesa/drivers/dri/radeon/radeon_tcl.c @@ -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" @@ -418,7 +418,7 @@ static GLboolean radeon_run_tcl_render( GLcontext *ctx, 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; diff --git a/dist/Mesa/src/mesa/drivers/dri/s3v/s3v_render.c b/dist/Mesa/src/mesa/drivers/dri/s3v/s3v_render.c index 6aaa94976..6b86e0e60 100644 --- a/dist/Mesa/src/mesa/drivers/dri/s3v/s3v_render.c +++ b/dist/Mesa/src/mesa/drivers/dri/s3v/s3v_render.c @@ -170,7 +170,7 @@ static GLboolean s3v_run_render( GLcontext *ctx, 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; diff --git a/dist/Mesa/src/mesa/drivers/dri/savage/savagerender.c b/dist/Mesa/src/mesa/drivers/dri/savage/savagerender.c index 514434c42..f2f19984b 100644 --- a/dist/Mesa/src/mesa/drivers/dri/savage/savagerender.c +++ b/dist/Mesa/src/mesa/drivers/dri/savage/savagerender.c @@ -198,7 +198,7 @@ static GLboolean savage_run_render( GLcontext *ctx, 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; diff --git a/dist/Mesa/src/mesa/drivers/dri/unichrome/via_render.c b/dist/Mesa/src/mesa/drivers/dri/unichrome/via_render.c index 387473ef5..d7e373d7d 100644 --- a/dist/Mesa/src/mesa/drivers/dri/unichrome/via_render.c +++ b/dist/Mesa/src/mesa/drivers/dri/unichrome/via_render.c @@ -106,7 +106,7 @@ static GLboolean via_run_fastrender(GLcontext *ctx, tnl->clipspace.new_inputs |= VERT_BIT_POS; for (i = 0; i < VB->PrimitiveCount; ++i) { - GLuint mode = VB->Primitive[i].mode; + GLuint mode = _tnl_translate_prim(&VB->Primitive[i]); GLuint start = VB->Primitive[i].start; GLuint length = VB->Primitive[i].count; if (length) diff --git a/dist/Mesa/src/mesa/drivers/fbdev/glfbdev.c b/dist/Mesa/src/mesa/drivers/fbdev/glfbdev.c index 3a6b45206..994319ab4 100644 --- a/dist/Mesa/src/mesa/drivers/fbdev/glfbdev.c +++ b/dist/Mesa/src/mesa/drivers/fbdev/glfbdev.c @@ -54,7 +54,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" @@ -143,7 +143,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 ); } @@ -157,11 +157,27 @@ get_buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height ) } +/** + * We only implement this function as a mechanism to check if the + * framebuffer size has changed (and update corresponding state). + */ static void viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) { - /* poll for window size change and realloc software Z/stencil/etc if needed */ - _mesa_ResizeBuffersMESA(); + GLuint newWidth, newHeight; + GLframebuffer *buffer; + + buffer = ctx->WinSysDrawBuffer; + get_buffer_size( buffer, &newWidth, &newHeight ); + if (buffer->Width != newWidth || buffer->Height != newHeight) { + _mesa_resize_framebuffer(ctx, buffer, newWidth, newHeight ); + } + + buffer = ctx->WinSysReadBuffer; + get_buffer_size( buffer, &newWidth, &newHeight ); + if (buffer->Width != newWidth || buffer->Height != newHeight) { + _mesa_resize_framebuffer(ctx, buffer, newWidth, newHeight ); + } } @@ -666,9 +682,16 @@ glFBDevDestroyBuffer( GLFBDevBufferPtr buffer ) if (buffer == curDraw || buffer == curRead) { glFBDevMakeCurrent( NULL, NULL, NULL); } +#if 0 /* free the software depth, stencil, accum buffers */ _mesa_free_framebuffer_data(&buffer->glframebuffer); _mesa_free(buffer); +#else + { + struct gl_framebuffer *fb = &buffer->glframebuffer; + _mesa_unreference_framebuffer(&fb); + } +#endif } } @@ -760,7 +783,7 @@ glFBDevCreateContext( const GLFBDevVisualPtr visual, GLFBDevContextPtr share ) /* Create module contexts */ glctx = (GLcontext *) &ctx->glcontext; _swrast_CreateContext( glctx ); - _ac_CreateContext( glctx ); + _vbo_CreateContext( glctx ); _tnl_CreateContext( glctx ); _swsetup_CreateContext( glctx ); _swsetup_Wakeup( glctx ); @@ -772,6 +795,11 @@ glFBDevCreateContext( const GLFBDevVisualPtr visual, GLFBDevContextPtr share ) } _mesa_enable_sw_extensions(glctx); + _mesa_enable_1_3_extensions(glctx); + _mesa_enable_1_4_extensions(glctx); + _mesa_enable_1_5_extensions(glctx); + _mesa_enable_2_0_extensions(glctx); + _mesa_enable_2_1_extensions(glctx); return ctx; } @@ -783,10 +811,16 @@ glFBDevDestroyContext( GLFBDevContextPtr context ) GLFBDevContextPtr fbdevctx = glFBDevGetCurrentContext(); if (context) { + GLcontext *mesaCtx = &context->glcontext; + + _swsetup_DestroyContext( mesaCtx ); + _swrast_DestroyContext( mesaCtx ); + _tnl_DestroyContext( mesaCtx ); + _vbo_DestroyContext( mesaCtx ); + if (fbdevctx == context) { /* destroying current context */ _mesa_make_current(NULL, NULL, NULL); - _mesa_notifyDestroy(&context->glcontext); } _mesa_free_context_data(&context->glcontext); _mesa_free(context); diff --git a/dist/Mesa/src/mesa/drivers/windows/gdi/wgl.c b/dist/Mesa/src/mesa/drivers/windows/gdi/wgl.c index cdaf5665c..d8d89f3b2 100644 --- a/dist/Mesa/src/mesa/drivers/windows/gdi/wgl.c +++ b/dist/Mesa/src/mesa/drivers/windows/gdi/wgl.c @@ -1,4 +1,4 @@ -/* $Id: wgl.c,v 1.1 2006/11/25 18:51:54 matthieu Exp $ */ +/* $Id: wgl.c,v 1.2 2008/05/31 16:36:48 matthieu Exp $ */ /* * This library is free software; you can redistribute it and/or @@ -32,10 +32,31 @@ /* We're essentially building part of GDI here, so define this so that * we get the right export linkage. */ +#ifdef __MINGW32__ + +#include <stdarg.h> +#include <windef.h> +#include <wincon.h> +#include <winbase.h> + +# if defined(BUILD_GL32) +# define WINGDIAPI __declspec(dllexport) +# else +# define __W32API_USE_DLLIMPORT__ +# endif + +#include <wingdi.h> +#include "GL/mesa_wgl.h" +#include <stdlib.h> + +#else + #define _GDI32_ #include <windows.h> -#include "glapi.h" +#endif +#include "config.h" +#include "glapi.h" #include "GL/wmesa.h" /* protos for wmesa* functions */ /* @@ -49,10 +70,12 @@ struct __pixelformat__ GLboolean doubleBuffered; }; + + /* These are the PFD's supported by this driver. */ struct __pixelformat__ pfd[] = { -#if 0 +#if 0 /* Double Buffer, alpha */ { { @@ -66,7 +89,7 @@ struct __pixelformat__ pfd[] = 8, 16, 8, 24, 0, 0, 0, 0, 0, - 16, 8, + DEFAULT_SOFTWARE_DEPTH_BITS, 8, 0, 0, 0, 0, 0, 0 }, @@ -85,13 +108,13 @@ struct __pixelformat__ pfd[] = 8, 16, 8, 24, 0, 0, 0, 0, 0, - 16, 8, + DEFAULT_SOFTWARE_DEPTH_BITS, 8, 0, 0, 0, 0, 0, 0 }, GL_FALSE }, -#endif +#endif /* Double Buffer, no alpha */ { { @@ -105,7 +128,7 @@ struct __pixelformat__ pfd[] = 8, 16, 0, 0, 0, 0, 0, 0, 0, - 16, 8, + DEFAULT_SOFTWARE_DEPTH_BITS, 8, 0, 0, 0, 0, 0, 0 }, @@ -124,7 +147,7 @@ struct __pixelformat__ pfd[] = 8, 16, 0, 0, 0, 0, 0, 0, 0, - 16, 8, + DEFAULT_SOFTWARE_DEPTH_BITS, 8, 0, 0, 0, 0, 0, 0 }, @@ -333,7 +356,7 @@ WINGDIAPI int GLAPIENTRY wglGetPixelFormat(HDC hdc) } WINGDIAPI BOOL GLAPIENTRY wglSetPixelFormat(HDC hdc,int iPixelFormat, - PIXELFORMATDESCRIPTOR *ppfd) + const PIXELFORMATDESCRIPTOR *ppfd) { (void) hdc; @@ -386,12 +409,12 @@ static BOOL wglUseFontBitmaps_FX(HDC fontDevice, DWORD firstChar, bitDevice = CreateCompatibleDC(fontDevice); - // Swap fore and back colors so the bitmap has the right polarity + /* Swap fore and back colors so the bitmap has the right polarity */ tempColor = GetBkColor(bitDevice); SetBkColor(bitDevice, GetTextColor(bitDevice)); SetTextColor(bitDevice, tempColor); - // Place chars based on base line + /* Place chars based on base line */ VERIFY(SetTextAlign(bitDevice, TA_BASELINE) != GDI_ERROR ? 1 : 0); for(i = 0; i < (int)numChars; i++) { @@ -404,36 +427,36 @@ static BOOL wglUseFontBitmaps_FX(HDC fontDevice, DWORD firstChar, curChar = (char)(i + firstChar); - // Find how high/wide this character is + /* Find how high/wide this character is */ VERIFY(GetTextExtentPoint32(bitDevice, &curChar, 1, &size)); - // Create the output bitmap + /* Create the output bitmap */ charWidth = size.cx; charHeight = size.cy; - // Round up to the next multiple of 32 bits + /* Round up to the next multiple of 32 bits */ bmapWidth = ((charWidth + 31) / 32) * 32; bmapHeight = charHeight; bitObject = CreateCompatibleBitmap(bitDevice, bmapWidth, bmapHeight); - //VERIFY(bitObject); + /* VERIFY(bitObject); */ - // Assign the output bitmap to the device + /* Assign the output bitmap to the device */ origBmap = SelectObject(bitDevice, bitObject); (void) VERIFY(origBmap); VERIFY( PatBlt( bitDevice, 0, 0, bmapWidth, bmapHeight,BLACKNESS ) ); - // Use our source font on the device + /* Use our source font on the device */ VERIFY(SelectObject(bitDevice, GetCurrentObject(fontDevice,OBJ_FONT))); - // Draw the character + /* Draw the character */ VERIFY(TextOut(bitDevice, 0, metric.tmAscent, &curChar, 1)); - // Unselect our bmap object + /* Unselect our bmap object */ VERIFY(SelectObject(bitDevice, origBmap)); - // Convert the display dependant representation to a 1 bit deep DIB + /* Convert the display dependant representation to a 1 bit deep DIB */ numBytes = (bmapWidth * bmapHeight) / 8; bmap = malloc(numBytes); dibInfo->bmiHeader.biWidth = bmapWidth; @@ -441,24 +464,24 @@ static BOOL wglUseFontBitmaps_FX(HDC fontDevice, DWORD firstChar, res = GetDIBits(bitDevice, bitObject, 0, bmapHeight, bmap, dibInfo, DIB_RGB_COLORS); - //VERIFY(res); + /* VERIFY(res); */ - // Create the GL object + /* Create the GL object */ glNewList(i + listBase, GL_COMPILE); glBitmap(bmapWidth, bmapHeight, 0.0, (GLfloat)metric.tmDescent, (GLfloat)charWidth, 0.0, bmap); glEndList(); - // CheckGL(); + /* CheckGL(); */ - // Destroy the bmap object + /* Destroy the bmap object */ DeleteObject(bitObject); - // Deallocate the bitmap data + /* Deallocate the bitmap data */ free(bmap); } - // Destroy the DC + /* Destroy the DC */ VERIFY(DeleteDC(bitDevice)); free(dibInfo); diff --git a/dist/Mesa/src/mesa/drivers/windows/gdi/wmesa.c b/dist/Mesa/src/mesa/drivers/windows/gdi/wmesa.c index c1d26a31a..46fd733be 100644 --- a/dist/Mesa/src/mesa/drivers/windows/gdi/wmesa.c +++ b/dist/Mesa/src/mesa/drivers/windows/gdi/wmesa.c @@ -1500,15 +1500,19 @@ void gl_dispatch_stub_650(void){} void gl_dispatch_stub_651(void){} void gl_dispatch_stub_652(void){} void gl_dispatch_stub_653(void){} +void gl_dispatch_stub_733(void){} void gl_dispatch_stub_734(void){} void gl_dispatch_stub_735(void){} void gl_dispatch_stub_736(void){} void gl_dispatch_stub_737(void){} void gl_dispatch_stub_738(void){} +void gl_dispatch_stub_744(void){} void gl_dispatch_stub_745(void){} void gl_dispatch_stub_746(void){} void gl_dispatch_stub_760(void){} void gl_dispatch_stub_761(void){} +void gl_dispatch_stub_763(void){} +void gl_dispatch_stub_765(void){} void gl_dispatch_stub_766(void){} void gl_dispatch_stub_767(void){} void gl_dispatch_stub_768(void){} @@ -1533,5 +1537,6 @@ void gl_dispatch_stub_749(void){} void gl_dispatch_stub_769(void){} void gl_dispatch_stub_770(void){} void gl_dispatch_stub_771(void){} +void gl_dispatch_stub_772(void){} #endif diff --git a/dist/Mesa/src/mesa/drivers/x11/xm_dd.c b/dist/Mesa/src/mesa/drivers/x11/xm_dd.c index 4c8bf5f65..45df0c5f5 100644 --- a/dist/Mesa/src/mesa/drivers/x11/xm_dd.c +++ b/dist/Mesa/src/mesa/drivers/x11/xm_dd.c @@ -420,7 +420,42 @@ clear_buffers(GLcontext *ctx, GLbitfield buffers) #ifndef XFree86Server -/* XXX this was never tested in the Xserver environment */ +/* XXX these functions haven't been tested in the Xserver environment */ + + +/** + * Check if we can do an optimized glDrawPixels into an 8R8G8B visual. + */ +static GLboolean +can_do_DrawPixels_8R8G8B(GLcontext *ctx, GLenum format, GLenum type) +{ + if (format == GL_BGRA && + type == GL_UNSIGNED_BYTE && + ctx->DrawBuffer && + ctx->DrawBuffer->Name == 0 && + ctx->Pixel.ZoomX == 1.0 && /* no zooming */ + ctx->Pixel.ZoomY == 1.0 && + ctx->_ImageTransferState == 0 /* no color tables, scale/bias, etc */) { + const SWcontext *swrast = SWRAST_CONTEXT(ctx); + + if (swrast->NewState) + _swrast_validate_derived( ctx ); + + if ((swrast->_RasterMask & ~CLIP_BIT) == 0) /* no blend, z-test, etc */ { + struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][0]; + if (rb) { + struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(rb->Wrapped); + if (xrb && + xrb->pixmap && /* drawing to pixmap or window */ + xrb->Base.AlphaBits == 0) { + return GL_TRUE; + } + } + } + } + return GL_FALSE; +} + /** * This function implements glDrawPixels() with an XPutImage call when @@ -434,37 +469,16 @@ xmesa_DrawPixels_8R8G8B( GLcontext *ctx, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels ) { - const SWcontext *swrast = SWRAST_CONTEXT( ctx ); - struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][0]; - struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(rb->Wrapped); - - if (swrast->NewState) - _swrast_validate_derived( ctx ); - - if (ctx->DrawBuffer->Name == 0 && - format == GL_BGRA && - type == GL_UNSIGNED_BYTE && - (swrast->_RasterMask & ~CLIP_BIT) == 0 && /* no blend, z-test, etc */ - ctx->_ImageTransferState == 0 && /* no color tables, scale/bias, etc */ - ctx->Pixel.ZoomX == 1.0 && /* no zooming */ - ctx->Pixel.ZoomY == 1.0 && - xrb->pixmap && /* drawing to pixmap or window */ - xrb->Base.AlphaBits == 0) - { - const XMesaContext xmesa = XMESA_CONTEXT(ctx); - XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); - XMesaDisplay *dpy = xmesa->xm_visual->display; - const XMesaGC gc = xmbuf->cleargc; /* effected by glColorMask */ + if (can_do_DrawPixels_8R8G8B(ctx, format, type)) { + const SWcontext *swrast = SWRAST_CONTEXT( ctx ); + struct gl_pixelstore_attrib clippedUnpack = *unpack; int dstX = x; int dstY = y; int w = width; int h = height; - struct gl_pixelstore_attrib clippedUnpack = *unpack; - ASSERT(xmesa->xm_visual->dithered_pf == PF_8R8G8B); - ASSERT(xmesa->xm_visual->undithered_pf == PF_8R8G8B); - ASSERT(dpy); - ASSERT(gc); + if (swrast->NewState) + _swrast_validate_derived( ctx ); if (unpack->BufferObj->Name) { /* unpack from PBO */ @@ -489,14 +503,26 @@ xmesa_DrawPixels_8R8G8B( GLcontext *ctx, } if (_mesa_clip_drawpixels(ctx, &dstX, &dstY, &w, &h, &clippedUnpack)) { + const XMesaContext xmesa = XMESA_CONTEXT(ctx); + XMesaDisplay *dpy = xmesa->xm_visual->display; + XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); + const XMesaGC gc = xmbuf->cleargc; /* effected by glColorMask */ + struct xmesa_renderbuffer *xrb + = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped); + const int srcX = clippedUnpack.SkipPixels; + const int srcY = clippedUnpack.SkipRows; + const int rowLength = clippedUnpack.RowLength; + XMesaImage ximage; + + ASSERT(xmesa->xm_visual->dithered_pf == PF_8R8G8B); + ASSERT(xmesa->xm_visual->undithered_pf == PF_8R8G8B); + ASSERT(dpy); + ASSERT(gc); + /* This is a little tricky since all coordinates up to now have * been in the OpenGL bottom-to-top orientation. X is top-to-bottom * so we have to carefully compute the Y coordinates/addresses here. */ - int srcX = clippedUnpack.SkipPixels; - int srcY = clippedUnpack.SkipRows; - int rowLength = clippedUnpack.RowLength; - XMesaImage ximage; MEMSET(&ximage, 0, sizeof(XMesaImage)); ximage.width = width; ximage.height = height; @@ -507,9 +533,9 @@ xmesa_DrawPixels_8R8G8B( GLcontext *ctx, ximage.bitmap_unit = 32; ximage.bitmap_bit_order = LSBFirst; ximage.bitmap_pad = 32; - ximage.depth = 24; - ximage.bytes_per_line = -rowLength * 4; /* negative to flip image */ + ximage.depth = 32; ximage.bits_per_pixel = 32; + ximage.bytes_per_line = -rowLength * 4; /* negative to flip image */ /* it seems we don't need to set the ximage.red/green/blue_mask fields */ /* flip Y axis for dest position */ dstY = YFLIP(xrb, dstY) - h + 1; @@ -531,6 +557,41 @@ xmesa_DrawPixels_8R8G8B( GLcontext *ctx, /** + * Check if we can do an optimized glDrawPixels into an 5R6G5B visual. + */ +static GLboolean +can_do_DrawPixels_5R6G5B(GLcontext *ctx, GLenum format, GLenum type) +{ + if (format == GL_RGB && + type == GL_UNSIGNED_SHORT_5_6_5 && + !ctx->Color.DitherFlag && /* no dithering */ + ctx->DrawBuffer && + ctx->DrawBuffer->Name == 0 && + ctx->Pixel.ZoomX == 1.0 && /* no zooming */ + ctx->Pixel.ZoomY == 1.0 && + ctx->_ImageTransferState == 0 /* no color tables, scale/bias, etc */) { + const SWcontext *swrast = SWRAST_CONTEXT(ctx); + + if (swrast->NewState) + _swrast_validate_derived( ctx ); + + if ((swrast->_RasterMask & ~CLIP_BIT) == 0) /* no blend, z-test, etc */ { + struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][0]; + if (rb) { + struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(rb->Wrapped); + if (xrb && + xrb->pixmap && /* drawing to pixmap or window */ + xrb->Base.AlphaBits == 0) { + return GL_TRUE; + } + } + } + } + return GL_FALSE; +} + + +/** * This function implements glDrawPixels() with an XPutImage call when * drawing to the front buffer (X Window drawable). The image format * must be GL_RGB and image type must be GL_UNSIGNED_SHORT_5_6_5 to @@ -543,35 +604,17 @@ xmesa_DrawPixels_5R6G5B( GLcontext *ctx, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels ) { - struct xmesa_renderbuffer *xrb - = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped); - const XMesaContext xmesa = XMESA_CONTEXT(ctx); - const SWcontext *swrast = SWRAST_CONTEXT( ctx ); - XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); - const XMesaGC gc = xmbuf->cleargc; /* effected by glColorMask */ - - ASSERT(dpy); - ASSERT(gc); - ASSERT(xmesa->xm_visual->undithered_pf == PF_5R6G5B); - - if (swrast->NewState) - _swrast_validate_derived( ctx ); - - if (xrb->pixmap && /* drawing to pixmap or window */ - format == GL_RGB && - type == GL_UNSIGNED_SHORT_5_6_5 && - !ctx->Color.DitherFlag && /* no dithering */ - (swrast->_RasterMask & ~CLIP_BIT) == 0 && /* no blend, z-test, etc */ - ctx->_ImageTransferState == 0 && /* no color tables, scale/bias, etc */ - ctx->Pixel.ZoomX == 1.0 && /* no zooming */ - ctx->Pixel.ZoomY == 1.0) { + if (can_do_DrawPixels_5R6G5B(ctx, format, type)) { + const SWcontext *swrast = SWRAST_CONTEXT( ctx ); + struct gl_pixelstore_attrib clippedUnpack = *unpack; int dstX = x; int dstY = y; int w = width; int h = height; - struct gl_pixelstore_attrib clippedUnpack = *unpack; + if (swrast->NewState) + _swrast_validate_derived( ctx ); + if (unpack->BufferObj->Name) { /* unpack from PBO */ GLubyte *buf; @@ -595,14 +638,25 @@ xmesa_DrawPixels_5R6G5B( GLcontext *ctx, } if (_mesa_clip_drawpixels(ctx, &dstX, &dstY, &w, &h, &clippedUnpack)) { + const XMesaContext xmesa = XMESA_CONTEXT(ctx); + XMesaDisplay *dpy = xmesa->xm_visual->display; + XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); + const XMesaGC gc = xmbuf->cleargc; /* effected by glColorMask */ + struct xmesa_renderbuffer *xrb + = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped); + const int srcX = clippedUnpack.SkipPixels; + const int srcY = clippedUnpack.SkipRows; + const int rowLength = clippedUnpack.RowLength; + XMesaImage ximage; + + ASSERT(xmesa->xm_visual->undithered_pf == PF_5R6G5B); + ASSERT(dpy); + ASSERT(gc); + /* This is a little tricky since all coordinates up to now have * been in the OpenGL bottom-to-top orientation. X is top-to-bottom * so we have to carefully compute the Y coordinates/addresses here. */ - int srcX = clippedUnpack.SkipPixels; - int srcY = clippedUnpack.SkipRows; - int rowLength = clippedUnpack.RowLength; - XMesaImage ximage; MEMSET(&ximage, 0, sizeof(XMesaImage)); ximage.width = width; ximage.height = height; @@ -614,8 +668,8 @@ xmesa_DrawPixels_5R6G5B( GLcontext *ctx, ximage.bitmap_bit_order = LSBFirst; ximage.bitmap_pad = 16; ximage.depth = 16; - ximage.bytes_per_line = -rowLength * 2; /* negative to flip image */ ximage.bits_per_pixel = 16; + ximage.bytes_per_line = -rowLength * 2; /* negative to flip image */ /* it seems we don't need to set the ximage.red/green/blue_mask fields */ /* flip Y axis for dest position */ dstY = YFLIP(xrb, dstY) - h + 1; @@ -635,6 +689,42 @@ xmesa_DrawPixels_5R6G5B( GLcontext *ctx, } +/** + * Determine if we can do an optimized glCopyPixels. + */ +static GLboolean +can_do_CopyPixels(GLcontext *ctx, GLenum type) +{ + if (type == GL_COLOR && + ctx->_ImageTransferState == 0 && /* no color tables, scale/bias, etc */ + ctx->Pixel.ZoomX == 1.0 && /* no zooming */ + ctx->Pixel.ZoomY == 1.0 && + ctx->Color.DrawBuffer[0] == GL_FRONT && /* copy to front buf */ + ctx->Pixel.ReadBuffer == GL_FRONT && /* copy from front buf */ + ctx->ReadBuffer->_ColorReadBuffer && + ctx->DrawBuffer->_ColorDrawBuffers[0][0]) { + const SWcontext *swrast = SWRAST_CONTEXT( ctx ); + + if (swrast->NewState) + _swrast_validate_derived( ctx ); + + if ((swrast->_RasterMask & ~CLIP_BIT) == 0x0 && + ctx->ReadBuffer && + ctx->ReadBuffer->_ColorReadBuffer && + ctx->DrawBuffer && + ctx->DrawBuffer->_ColorDrawBuffers[0]) { + struct xmesa_renderbuffer *srcXrb + = xmesa_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer->Wrapped); + struct xmesa_renderbuffer *dstXrb + = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped); + if (srcXrb->pixmap && dstXrb->pixmap) { + return GL_TRUE; + } + } + } + return GL_FALSE; +} + /** * Implement glCopyPixels for the front color buffer (or back buffer Pixmap) @@ -646,31 +736,19 @@ xmesa_CopyPixels( GLcontext *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint destx, GLint desty, GLenum type ) { - const XMesaContext xmesa = XMESA_CONTEXT(ctx); - const SWcontext *swrast = SWRAST_CONTEXT( ctx ); - XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); - const XMesaGC gc = xmbuf->cleargc; /* effected by glColorMask */ - struct xmesa_renderbuffer *srcXrb - = xmesa_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer->Wrapped); - struct xmesa_renderbuffer *dstXrb - = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped); - - ASSERT(dpy); - ASSERT(gc); - - if (swrast->NewState) - _swrast_validate_derived( ctx ); - - if (ctx->Color.DrawBuffer[0] == GL_FRONT && - ctx->Pixel.ReadBuffer == GL_FRONT && - srcXrb->pixmap && - dstXrb->pixmap && - type == GL_COLOR && - (swrast->_RasterMask & ~CLIP_BIT) == 0 && /* no blend, z-test, etc */ - ctx->_ImageTransferState == 0 && /* no color tables, scale/bias, etc */ - ctx->Pixel.ZoomX == 1.0 && /* no zooming */ - ctx->Pixel.ZoomY == 1.0) { + if (can_do_CopyPixels(ctx, type)) { + const XMesaContext xmesa = XMESA_CONTEXT(ctx); + XMesaDisplay *dpy = xmesa->xm_visual->display; + XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); + const XMesaGC gc = xmbuf->cleargc; /* effected by glColorMask */ + struct xmesa_renderbuffer *srcXrb + = xmesa_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer->Wrapped); + struct xmesa_renderbuffer *dstXrb + = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped); + + ASSERT(dpy); + ASSERT(gc); + /* Note: we don't do any special clipping work here. We could, * but X will do it for us. */ @@ -683,6 +761,7 @@ xmesa_CopyPixels( GLcontext *ctx, _swrast_CopyPixels(ctx, srcx, srcy, width, height, destx, desty, type ); } } + #endif /* XFree86Server */ @@ -1072,7 +1151,8 @@ xmesa_init_driver_functions( XMesaVisual xmvisual, #ifndef XFree86Server driver->CopyPixels = xmesa_CopyPixels; if (xmvisual->undithered_pf == PF_8R8G8B && - xmvisual->dithered_pf == PF_8R8G8B) { + xmvisual->dithered_pf == PF_8R8G8B && + xmvisual->BitsPerPixel == 32) { driver->DrawPixels = xmesa_DrawPixels_8R8G8B; } else if (xmvisual->undithered_pf == PF_5R6G5B) { diff --git a/dist/Mesa/src/mesa/main/buffers.c b/dist/Mesa/src/mesa/main/buffers.c index 6f4a51e10..f4d5b23f2 100644 --- a/dist/Mesa/src/mesa/main/buffers.c +++ b/dist/Mesa/src/mesa/main/buffers.c @@ -1,11 +1,6 @@ -/** - * \file buffers.c - * Frame buffer management. - */ - /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 6.5.2 * * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. * @@ -28,6 +23,13 @@ */ +/** + * \file buffers.c + * General framebuffer-related functions, like glClear, glScissor, etc. + */ + + + #include "glheader.h" #include "buffers.h" #include "colormac.h" @@ -138,11 +140,10 @@ _mesa_Clear( GLbitfield mask ) return; } + if (ctx->DrawBuffer->Width == 0 || ctx->DrawBuffer->Height == 0) + return; + if (ctx->RenderMode == GL_RENDER) { - const GLint x = ctx->DrawBuffer->_Xmin; - const GLint y = ctx->DrawBuffer->_Ymin; - const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin; - const GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin; GLbitfield bufferMask; /* don't clear depth buffer if depth writing disabled */ @@ -175,8 +176,7 @@ _mesa_Clear( GLbitfield mask ) } ASSERT(ctx->Driver.Clear); - ctx->Driver.Clear( ctx, bufferMask, (GLboolean) !ctx->Scissor.Enabled, - x, y, width, height ); + ctx->Driver.Clear(ctx, bufferMask); } } @@ -271,6 +271,14 @@ draw_buffer_enum_to_bitmask(GLenum buffer) return BUFFER_BIT_COLOR2; case GL_COLOR_ATTACHMENT3_EXT: return BUFFER_BIT_COLOR3; + case GL_COLOR_ATTACHMENT4_EXT: + return BUFFER_BIT_COLOR4; + case GL_COLOR_ATTACHMENT5_EXT: + return BUFFER_BIT_COLOR5; + case GL_COLOR_ATTACHMENT6_EXT: + return BUFFER_BIT_COLOR6; + case GL_COLOR_ATTACHMENT7_EXT: + return BUFFER_BIT_COLOR7; default: /* error */ return BAD_MASK; @@ -320,6 +328,14 @@ read_buffer_enum_to_index(GLenum buffer) return BUFFER_COLOR2; case GL_COLOR_ATTACHMENT3_EXT: return BUFFER_COLOR3; + case GL_COLOR_ATTACHMENT4_EXT: + return BUFFER_COLOR4; + case GL_COLOR_ATTACHMENT5_EXT: + return BUFFER_COLOR5; + case GL_COLOR_ATTACHMENT6_EXT: + return BUFFER_COLOR6; + case GL_COLOR_ATTACHMENT7_EXT: + return BUFFER_COLOR7; default: /* error */ return -1; @@ -581,6 +597,9 @@ _mesa_ReadBuffer(GLenum buffer) #if _HAVE_FULL_GL /** + * XXX THIS IS OBSOLETE - drivers should take care of detecting window + * size changes and act accordingly, likely calling _mesa_resize_framebuffer(). + * * GL_MESA_resize_buffers extension. * * When this function is called, we'll ask the window system how large @@ -591,16 +610,18 @@ _mesa_ReadBuffer(GLenum buffer) * \note This function should only be called through the GL API, not * from device drivers (as was done in the past). */ -void GLAPIENTRY -_mesa_ResizeBuffersMESA( void ) -{ - GET_CURRENT_CONTEXT(ctx); +void _mesa_resizebuffers( GLcontext *ctx ) +{ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx ); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glResizeBuffersMESA\n"); + if (!ctx->Driver.GetBufferSize) { + return; + } + if (ctx->WinSysDrawBuffer) { GLuint newWidth, newHeight; GLframebuffer *buffer = ctx->WinSysDrawBuffer; @@ -639,6 +660,19 @@ _mesa_ResizeBuffersMESA( void ) /* + * XXX THIS IS OBSOLETE + */ +void GLAPIENTRY +_mesa_ResizeBuffersMESA( void ) +{ + GET_CURRENT_CONTEXT(ctx); + + if (ctx->Extensions.MESA_resize_buffers) + _mesa_resizebuffers( ctx ); +} + + +/* * XXX move somewhere else someday? */ void GLAPIENTRY diff --git a/dist/Mesa/src/mesa/main/config.h b/dist/Mesa/src/mesa/main/config.h index e2ba65ac6..0d9c981d6 100644 --- a/dist/Mesa/src/mesa/main/config.h +++ b/dist/Mesa/src/mesa/main/config.h @@ -5,9 +5,9 @@ /* * Mesa 3-D graphics library - * Version: 6.5.1 + * Version: 7.0 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 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"), @@ -28,8 +28,8 @@ */ -#ifndef CONFIG_H -#define CONFIG_H +#ifndef MESA_CONFIG_H_INCLUDED +#define MESA_CONFIG_H_INCLUDED /** * \name OpenGL implementation limits @@ -196,28 +196,27 @@ /** For any program target/extension */ /*@{*/ #define MAX_PROGRAM_LOCAL_PARAMS 128 /* KW: power of two */ +#define MAX_PROGRAM_ENV_PARAMS 128 #define MAX_PROGRAM_MATRICES 8 #define MAX_PROGRAM_MATRIX_STACK_DEPTH 4 -/*@}*/ - -/** For GL_ARB_fragment_shader */ -/*@{*/ -#define MAX_FRAGMENT_UNIFORM_COMPONENTS 64 +#define MAX_PROGRAM_CALL_DEPTH 8 +#define MAX_PROGRAM_TEMPS 128 +#define MAX_PROGRAM_ADDRESS_REGS 2 +#define MAX_UNIFORMS 128 +#define MAX_VARYING 8 /*@}*/ /** For GL_ARB_vertex_shader */ /*@{*/ #define MAX_VERTEX_ATTRIBS 16 -#define MAX_VERTEX_UNIFORM_COMPONENTS 512 -#define MAX_VARYING_FLOATS 32 -#define MAX_VERTEX_TEXTURE_IMAGE_UNITS 0 +#define MAX_VERTEX_TEXTURE_IMAGE_UNITS MAX_TEXTURE_UNITS #define MAX_COMBINED_TEXTURE_IMAGE_UNITS (MAX_TEXTURE_IMAGE_UNITS + MAX_VERTEX_TEXTURE_IMAGE_UNITS) /*@}*/ /** For GL_ARB_draw_buffers */ /*@{*/ -#define MAX_DRAW_BUFFERS 1 +#define MAX_DRAW_BUFFERS 4 /*@}*/ @@ -241,10 +240,7 @@ /** - * Bits per depth buffer value. - * - * Any reasonable value up to 31 will work. 32 doesn't work because of integer - * overflow problems in the rasterizer code. + * Bits per depth buffer value (max is 32). */ #ifndef DEFAULT_SOFTWARE_DEPTH_BITS #define DEFAULT_SOFTWARE_DEPTH_BITS 16 @@ -301,6 +297,7 @@ #define FEATURE_ARB_fragment_shader _HAVE_FULL_GL #define FEATURE_ARB_shader_objects (FEATURE_ARB_vertex_shader || FEATURE_ARB_fragment_shader) #define FEATURE_ARB_shading_language_100 FEATURE_ARB_shader_objects +#define FEATURE_ARB_shading_language_120 FEATURE_ARB_shader_objects #define FEATURE_EXT_framebuffer_blit _HAVE_FULL_GL #define FEATURE_EXT_framebuffer_object _HAVE_FULL_GL @@ -323,4 +320,4 @@ #define MAX_CLIPPED_VERTICES ((2 * (6 + MAX_CLIP_PLANES))+1) -#endif /* CONFIG_H */ +#endif /* MESA_CONFIG_H_INCLUDED */ diff --git a/dist/Mesa/src/mesa/main/context.c b/dist/Mesa/src/mesa/main/context.c index 754b1a7d8..e79a90534 100644 --- a/dist/Mesa/src/mesa/main/context.c +++ b/dist/Mesa/src/mesa/main/context.c @@ -640,7 +640,12 @@ delete_framebuffer_cb(GLuint id, void *data, void *userData) */ /*assert(fb->RefCount == 1);*/ fb->RefCount = 0; - fb->Delete(fb); + + /* NOTE: Delete should always be defined but there are two reports + * of it being NULL (bugs 13507, 14293). Work-around for now. + */ + if (fb->Delete) + fb->Delete(fb); } /** @@ -682,10 +687,10 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) _mesa_DeleteHashTable(ss->Programs); #endif #if FEATURE_ARB_vertex_program - _mesa_delete_program(ctx, ss->DefaultVertexProgram); + ctx->Driver.DeleteProgram(ctx, ss->DefaultVertexProgram); #endif #if FEATURE_ARB_fragment_program - _mesa_delete_program(ctx, ss->DefaultFragmentProgram); + ctx->Driver.DeleteProgram(ctx, ss->DefaultFragmentProgram); #endif #if FEATURE_ATI_fragment_shader @@ -749,7 +754,7 @@ _mesa_init_current(GLcontext *ctx) } /* redo special cases: */ - ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_WEIGHT], 1.0, 0.0, 0.0, 1.0 ); + ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_WEIGHT], 1.0, 0.0, 0.0, 0.0 ); ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_NORMAL], 0.0, 0.0, 1.0, 1.0 ); ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR0], 1.0, 1.0, 1.0, 1.0 ); ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR1], 0.0, 0.0, 0.0, 1.0 ); @@ -977,7 +982,6 @@ init_attrib_groups(GLcontext *ctx) /* Miscellaneous */ ctx->NewState = _NEW_ALL; ctx->ErrorValue = (GLenum) GL_NO_ERROR; - ctx->_Facing = 0; return GL_TRUE; } diff --git a/dist/Mesa/src/mesa/main/context.h b/dist/Mesa/src/mesa/main/context.h index c72fe8a56..7a9d97ce8 100644 --- a/dist/Mesa/src/mesa/main/context.h +++ b/dist/Mesa/src/mesa/main/context.h @@ -138,47 +138,9 @@ _mesa_get_current_context(void); /*@}*/ -/** \name OpenGL SI-style export functions */ -/*@{*/ - -extern GLboolean -_mesa_destroyContext(__GLcontext *gc); - -extern GLboolean -_mesa_loseCurrent(__GLcontext *gc); - -extern GLboolean -_mesa_makeCurrent(__GLcontext *gc); - -extern GLboolean -_mesa_shareContext(__GLcontext *gc, __GLcontext *gcShare); - -extern GLboolean -_mesa_copyContext(__GLcontext *dst, const __GLcontext *src, GLuint mask); - -extern GLboolean -_mesa_forceCurrent(__GLcontext *gc); - -extern GLboolean -_mesa_notifyResize(__GLcontext *gc); - -extern void -_mesa_notifyDestroy(__GLcontext *gc); - extern void _mesa_notifySwapBuffers(__GLcontext *gc); -extern struct __GLdispatchStateRec * -_mesa_dispatchExec(__GLcontext *gc); - -extern void -_mesa_beginDispatchOverride(__GLcontext *gc); - -extern void -_mesa_endDispatchOverride(__GLcontext *gc); - -/*@}*/ - extern struct _glapi_table * _mesa_get_dispatch(GLcontext *ctx); @@ -310,11 +272,19 @@ do { \ (((CTX)->Light.Enabled && \ (CTX)->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) \ || (CTX)->Fog.ColorSumEnabled \ - || ((CTX)->VertexProgram._Enabled && \ - ((CTX)->VertexProgram.Current->Base.InputsRead & VERT_BIT_COLOR1)) \ - || ((CTX)->FragmentProgram._Enabled && \ - ((CTX)->FragmentProgram.Current->Base.InputsRead & FRAG_BIT_COL1)) \ + || ((CTX)->VertexProgram._Current && \ + ((CTX)->VertexProgram._Current->Base.InputsRead & VERT_BIT_COLOR1)) \ + || ((CTX)->FragmentProgram._Current && \ + ((CTX)->FragmentProgram._Current->Base.InputsRead & FRAG_BIT_COL1)) \ ) +/** + * Is RGBA LogicOp enabled? + */ +#define RGBA_LOGICOP_ENABLED(CTX) \ + ((CTX)->Color.ColorLogicOpEnabled || \ + ((CTX)->Color.BlendEnabled && (CTX)->Color.BlendEquationRGB == GL_LOGIC_OP)) + + #endif /* CONTEXT_H */ diff --git a/dist/Mesa/src/mesa/main/dd.h b/dist/Mesa/src/mesa/main/dd.h index 1b8cf6304..bb47cd4dc 100644 --- a/dist/Mesa/src/mesa/main/dd.h +++ b/dist/Mesa/src/mesa/main/dd.h @@ -5,9 +5,9 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 6.5.2 * - * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * 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"), @@ -52,8 +52,7 @@ struct mesa_display_list; struct dd_function_table { /** * Return a string as needed by glGetString(). - * - * Only the GL_RENDERER token must be implemented. Otherwise, NULL can be + * Only the GL_RENDERER query must be implemented. Otherwise, NULL can be * returned. */ const GLubyte * (*GetString)( GLcontext *ctx, GLenum name ); @@ -70,19 +69,20 @@ struct dd_function_table { * Get the width and height of the named buffer/window. * * Mesa uses this to determine when the driver's window size has changed. + * XXX OBSOLETE: this function will be removed in the future. */ void (*GetBufferSize)( GLframebuffer *buffer, GLuint *width, GLuint *height ); /** * Resize the given framebuffer to the given size. + * XXX OBSOLETE: this function will be removed in the future. */ void (*ResizeBuffers)( GLcontext *ctx, GLframebuffer *fb, GLuint width, GLuint height); /** * Called whenever an error is generated. - * * __GLcontextRec::ErrorValue contains the error value. */ void (*Error)( GLcontext *ctx ); @@ -99,40 +99,24 @@ struct dd_function_table { /** * Clear the color/depth/stencil/accum buffer(s). - * - * \param mask a bitmask of the DD_*_BIT values defined above that indicates - * which buffers need to be cleared. - * \param all if true then clear the whole buffer, else clear only the - * region defined by <tt>(x, y, width, height)</tt>. - * - * This function must obey the glColorMask(), glIndexMask() and - * glStencilMask() settings! - * Software Mesa can do masked clears if the device driver can't. + * \param buffers a bitmask of BUFFER_BIT_* flags indicating which + * renderbuffers need to be cleared. */ - void (*Clear)( GLcontext *ctx, GLbitfield mask, GLboolean all, - GLint x, GLint y, GLint width, GLint height ); - + void (*Clear)( GLcontext *ctx, GLbitfield buffers ); /** - * \name For hardware accumulation buffer + * Execute glAccum command. */ - /*@{*/ - /** - * Execute glAccum command within the given scissor region. - */ - void (*Accum)( GLcontext *ctx, GLenum op, GLfloat value, - GLint xpos, GLint ypos, GLint width, GLint height ); - /*@}*/ + void (*Accum)( GLcontext *ctx, GLenum op, GLfloat value ); /** - * \name glDraw(), glRead(), glCopyPixels() and glBitmap() functions + * \name Image-related functions */ /*@{*/ /** - * This is called by glDrawPixels(). - * + * Called by glDrawPixels(). * \p unpack describes how to unpack the source image data. */ void (*DrawPixels)( GLcontext *ctx, @@ -151,19 +135,14 @@ struct dd_function_table { GLvoid *dest ); /** - * Do a glCopyPixels(). - * - * This function must respect all rasterization state, glPixelTransfer(), - * glPixelZoom(), etc. + * Called by glCopyPixels(). */ void (*CopyPixels)( GLcontext *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type ); /** - * This is called by glBitmap(). - * - * Works the same as dd_function_table::DrawPixels, above. + * Called by glBitmap(). */ void (*Bitmap)( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, @@ -514,6 +493,11 @@ struct dd_function_table { */ void (*FreeTexImageData)( GLcontext *ctx, struct gl_texture_image *tImage ); + /** Map texture image data into user space */ + void (*MapTexture)( GLcontext *ctx, struct gl_texture_object *tObj ); + /** Unmap texture images from user space */ + void (*UnmapTexture)( GLcontext *ctx, struct gl_texture_object *tObj ); + /** * Note: no context argument. This function doesn't initially look * like it belongs here, except that the driver is the only entity @@ -591,8 +575,9 @@ struct dd_function_table { /** Notify driver that a program string has been specified. */ void (*ProgramStringNotify)(GLcontext *ctx, GLenum target, struct gl_program *prog); - - + /** Get value of a program register during program execution. */ + void (*GetProgramRegister)(GLcontext *ctx, enum register_file file, + GLuint index, GLfloat val[4]); /** Query if program can be loaded onto hardware */ GLboolean (*IsProgramNative)(GLcontext *ctx, GLenum target, @@ -841,6 +826,58 @@ struct dd_function_table { void (*BindArrayObject)(GLcontext *ctx, struct gl_array_object *obj); /*@}*/ + /** + * \name GLSL-related functions (ARB extensions and OpenGL 2.x) + */ + /*@{*/ + void (*AttachShader)(GLcontext *ctx, GLuint program, GLuint shader); + void (*BindAttribLocation)(GLcontext *ctx, GLuint program, GLuint index, + const GLcharARB *name); + void (*CompileShader)(GLcontext *ctx, GLuint shader); + GLuint (*CreateShader)(GLcontext *ctx, GLenum type); + GLuint (*CreateProgram)(GLcontext *ctx); + void (*DeleteProgram2)(GLcontext *ctx, GLuint program); + void (*DeleteShader)(GLcontext *ctx, GLuint shader); + void (*DetachShader)(GLcontext *ctx, GLuint program, GLuint shader); + void (*GetActiveAttrib)(GLcontext *ctx, GLuint program, GLuint index, + GLsizei maxLength, GLsizei * length, GLint * size, + GLenum * type, GLcharARB * name); + void (*GetActiveUniform)(GLcontext *ctx, GLuint program, GLuint index, + GLsizei maxLength, GLsizei *length, GLint *size, + GLenum *type, GLcharARB *name); + void (*GetAttachedShaders)(GLcontext *ctx, GLuint program, GLsizei maxCount, + GLsizei *count, GLuint *obj); + GLint (*GetAttribLocation)(GLcontext *ctx, GLuint program, + const GLcharARB *name); + GLuint (*GetHandle)(GLcontext *ctx, GLenum pname); + void (*GetProgramiv)(GLcontext *ctx, GLuint program, + GLenum pname, GLint *params); + void (*GetProgramInfoLog)(GLcontext *ctx, GLuint program, GLsizei bufSize, + GLsizei *length, GLchar *infoLog); + void (*GetShaderiv)(GLcontext *ctx, GLuint shader, + GLenum pname, GLint *params); + void (*GetShaderInfoLog)(GLcontext *ctx, GLuint shader, GLsizei bufSize, + GLsizei *length, GLchar *infoLog); + void (*GetShaderSource)(GLcontext *ctx, GLuint shader, GLsizei maxLength, + GLsizei *length, GLcharARB *sourceOut); + void (*GetUniformfv)(GLcontext *ctx, GLuint program, GLint location, + GLfloat *params); + GLint (*GetUniformLocation)(GLcontext *ctx, GLuint program, + const GLcharARB *name); + GLboolean (*IsProgram)(GLcontext *ctx, GLuint name); + GLboolean (*IsShader)(GLcontext *ctx, GLuint name); + void (*LinkProgram)(GLcontext *ctx, GLuint program); + void (*ShaderSource)(GLcontext *ctx, GLuint shader, const GLchar *source); + void (*Uniform)(GLcontext *ctx, GLint location, GLsizei count, + const GLvoid *values, GLenum type); + void (*UniformMatrix)(GLcontext *ctx, GLint cols, GLint rows, + GLenum matrixType, GLint location, GLsizei count, + GLboolean transpose, const GLfloat *values); + void (*UseProgram)(GLcontext *ctx, GLuint program); + void (*ValidateProgram)(GLcontext *ctx, GLuint program); + /* XXX many more to come */ + /*@}*/ + /** * \name Support for multiple T&L engines diff --git a/dist/Mesa/src/mesa/main/drawpix.c b/dist/Mesa/src/mesa/main/drawpix.c index c82abccc4..3acccf043 100644 --- a/dist/Mesa/src/mesa/main/drawpix.c +++ b/dist/Mesa/src/mesa/main/drawpix.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 7.0.3 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 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"), @@ -341,12 +341,10 @@ _mesa_Bitmap( GLsizei width, GLsizei height, } if (ctx->RenderMode == GL_RENDER) { - if (bitmap) { - /* Truncate, to satisfy conformance tests (matches SGI's OpenGL). */ - GLint x = IFLOOR(ctx->Current.RasterPos[0] - xorig); - GLint y = IFLOOR(ctx->Current.RasterPos[1] - yorig); - ctx->Driver.Bitmap( ctx, x, y, width, height, &ctx->Unpack, bitmap ); - } + /* Truncate, to satisfy conformance tests (matches SGI's OpenGL). */ + GLint x = IFLOOR(ctx->Current.RasterPos[0] - xorig); + GLint y = IFLOOR(ctx->Current.RasterPos[1] - yorig); + ctx->Driver.Bitmap( ctx, x, y, width, height, &ctx->Unpack, bitmap ); } #if _HAVE_FULL_GL else if (ctx->RenderMode == GL_FEEDBACK) { diff --git a/dist/Mesa/src/mesa/main/enable.c b/dist/Mesa/src/mesa/main/enable.c index 1c6167b79..0c2bf8cea 100644 --- a/dist/Mesa/src/mesa/main/enable.c +++ b/dist/Mesa/src/mesa/main/enable.c @@ -5,9 +5,9 @@ /* * Mesa 3-D graphics library - * Version: 6.5.1 + * Version: 7.0.3 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 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"), @@ -364,12 +364,12 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state) case GL_LIGHTING: if (ctx->Light.Enabled == state) return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + ctx->Light.Enabled = state; if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE; else ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE; - FLUSH_VERTICES(ctx, _NEW_LIGHT); - ctx->Light.Enabled = state; break; case GL_LINE_SMOOTH: if (ctx->Line.SmoothFlag == state) diff --git a/dist/Mesa/src/mesa/main/fbobject.c b/dist/Mesa/src/mesa/main/fbobject.c index 8e7d66cb9..bbdc46f00 100644 --- a/dist/Mesa/src/mesa/main/fbobject.c +++ b/dist/Mesa/src/mesa/main/fbobject.c @@ -302,7 +302,7 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, /* OK */ } else if (ctx->Extensions.EXT_packed_depth_stencil && - att->Renderbuffer->_BaseFormat == GL_DEPTH_STENCIL_EXT) { + texImage->TexFormat->BaseFormat == GL_DEPTH_STENCIL_EXT) { /* OK */ } else { diff --git a/dist/Mesa/src/mesa/main/get.c b/dist/Mesa/src/mesa/main/get.c index 086785911..2cbd60539 100644 --- a/dist/Mesa/src/mesa/main/get.c +++ b/dist/Mesa/src/mesa/main/get.c @@ -323,7 +323,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) case GL_EDGE_FLAG: { FLUSH_CURRENT(ctx, 0); - params[0] = ctx->Current.EdgeFlag; + params[0] = (ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0); } break; case GL_FEEDBACK_BUFFER_SIZE: @@ -677,34 +677,34 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) params[0] = ENUM_TO_BOOLEAN(ctx->Hint.PerspectiveCorrection); break; case GL_PIXEL_MAP_A_TO_A_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapAtoAsize); + params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.AtoA.Size); break; case GL_PIXEL_MAP_B_TO_B_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapBtoBsize); + params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.BtoB.Size); break; case GL_PIXEL_MAP_G_TO_G_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapGtoGsize); + params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.GtoG.Size); break; case GL_PIXEL_MAP_I_TO_A_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoAsize); + params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.ItoA.Size); break; case GL_PIXEL_MAP_I_TO_B_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoBsize); + params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.ItoB.Size); break; case GL_PIXEL_MAP_I_TO_G_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoGsize); + params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.ItoG.Size); break; case GL_PIXEL_MAP_I_TO_I_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoIsize); + params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.ItoI.Size); break; case GL_PIXEL_MAP_I_TO_R_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoRsize); + params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.ItoR.Size); break; case GL_PIXEL_MAP_R_TO_R_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapRtoRsize); + params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.RtoR.Size); break; case GL_PIXEL_MAP_S_TO_S_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapStoSsize); + params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.StoS.Size); break; case GL_POINT_SIZE: params[0] = FLOAT_TO_BOOLEAN(ctx->Point.Size); @@ -793,7 +793,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.RedBias); break; case GL_RED_BITS: - params[0] = INT_TO_BOOLEAN( ctx->DrawBuffer->Visual.redBits ); + params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.redBits); break; case GL_RED_SCALE: params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.RedScale); @@ -1283,15 +1283,15 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) break; case GL_COLOR_TABLE_SGI: CHECK_EXT1(SGI_color_table, "GetBooleanv"); - params[0] = ctx->Pixel.ColorTableEnabled; + params[0] = ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]; break; case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: CHECK_EXT1(SGI_color_table, "GetBooleanv"); - params[0] = ctx->Pixel.PostConvolutionColorTableEnabled; + params[0] = ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION]; break; case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: CHECK_EXT1(SGI_color_table, "GetBooleanv"); - params[0] = ctx->Pixel.PostColorMatrixColorTableEnabled; + params[0] = ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX]; break; case GL_TEXTURE_COLOR_TABLE_SGI: CHECK_EXT1(SGI_texture_color_table, "GetBooleanv"); @@ -1833,6 +1833,9 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) case GL_STENCIL_BACK_VALUE_MASK: params[0] = INT_TO_BOOLEAN(ctx->Stencil.ValueMask[1]); break; + case GL_STENCIL_BACK_WRITEMASK: + params[0] = INT_TO_BOOLEAN(ctx->Stencil.WriteMask[1]); + break; case GL_STENCIL_BACK_REF: params[0] = INT_TO_BOOLEAN(ctx->Stencil.Ref[1]); break; @@ -1861,9 +1864,13 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) CHECK_EXT1(EXT_framebuffer_object, "GetBooleanv"); params[0] = INT_TO_BOOLEAN(ctx->Const.MaxRenderbufferSize); break; + case GL_READ_FRAMEBUFFER_BINDING_EXT: + CHECK_EXT1(EXT_framebuffer_blit, "GetBooleanv"); + params[0] = INT_TO_BOOLEAN(ctx->ReadBuffer->Name); + break; case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB: CHECK_EXT1(ARB_fragment_shader, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(MAX_FRAGMENT_UNIFORM_COMPONENTS); + params[0] = INT_TO_BOOLEAN(ctx->Const.FragmentProgram.MaxUniformComponents); break; case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB: CHECK_EXT1(ARB_fragment_shader, "GetBooleanv"); @@ -1871,20 +1878,24 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) break; case GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB: CHECK_EXT1(ARB_vertex_shader, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(MAX_VERTEX_UNIFORM_COMPONENTS); + params[0] = INT_TO_BOOLEAN(ctx->Const.VertexProgram.MaxUniformComponents); break; case GL_MAX_VARYING_FLOATS_ARB: CHECK_EXT1(ARB_vertex_shader, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(MAX_VARYING_FLOATS); + params[0] = INT_TO_BOOLEAN(ctx->Const.MaxVarying * 4); break; case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB: CHECK_EXT1(ARB_vertex_shader, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(MAX_VERTEX_TEXTURE_IMAGE_UNITS); + params[0] = INT_TO_BOOLEAN(ctx->Const.MaxVertexTextureImageUnits); break; case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB: CHECK_EXT1(ARB_vertex_shader, "GetBooleanv"); params[0] = INT_TO_BOOLEAN(MAX_COMBINED_TEXTURE_IMAGE_UNITS); break; + case GL_CURRENT_PROGRAM: + CHECK_EXT1(ARB_shader_objects, "GetBooleanv"); + params[0] = INT_TO_BOOLEAN(ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0); + break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv(pname=0x%x)", pname); } @@ -2147,7 +2158,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) case GL_EDGE_FLAG: { FLUSH_CURRENT(ctx, 0); - params[0] = BOOLEAN_TO_FLOAT(ctx->Current.EdgeFlag); + params[0] = BOOLEAN_TO_FLOAT((ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0)); } break; case GL_FEEDBACK_BUFFER_SIZE: @@ -2501,34 +2512,34 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) params[0] = ENUM_TO_FLOAT(ctx->Hint.PerspectiveCorrection); break; case GL_PIXEL_MAP_A_TO_A_SIZE: - params[0] = (GLfloat)(ctx->Pixel.MapAtoAsize); + params[0] = (GLfloat)(ctx->PixelMaps.AtoA.Size); break; case GL_PIXEL_MAP_B_TO_B_SIZE: - params[0] = (GLfloat)(ctx->Pixel.MapBtoBsize); + params[0] = (GLfloat)(ctx->PixelMaps.BtoB.Size); break; case GL_PIXEL_MAP_G_TO_G_SIZE: - params[0] = (GLfloat)(ctx->Pixel.MapGtoGsize); + params[0] = (GLfloat)(ctx->PixelMaps.GtoG.Size); break; case GL_PIXEL_MAP_I_TO_A_SIZE: - params[0] = (GLfloat)(ctx->Pixel.MapItoAsize); + params[0] = (GLfloat)(ctx->PixelMaps.ItoA.Size); break; case GL_PIXEL_MAP_I_TO_B_SIZE: - params[0] = (GLfloat)(ctx->Pixel.MapItoBsize); + params[0] = (GLfloat)(ctx->PixelMaps.ItoB.Size); break; case GL_PIXEL_MAP_I_TO_G_SIZE: - params[0] = (GLfloat)(ctx->Pixel.MapItoGsize); + params[0] = (GLfloat)(ctx->PixelMaps.ItoG.Size); break; case GL_PIXEL_MAP_I_TO_I_SIZE: - params[0] = (GLfloat)(ctx->Pixel.MapItoIsize); + params[0] = (GLfloat)(ctx->PixelMaps.ItoI.Size); break; case GL_PIXEL_MAP_I_TO_R_SIZE: - params[0] = (GLfloat)(ctx->Pixel.MapItoRsize); + params[0] = (GLfloat)(ctx->PixelMaps.ItoR.Size); break; case GL_PIXEL_MAP_R_TO_R_SIZE: - params[0] = (GLfloat)(ctx->Pixel.MapRtoRsize); + params[0] = (GLfloat)(ctx->PixelMaps.RtoR.Size); break; case GL_PIXEL_MAP_S_TO_S_SIZE: - params[0] = (GLfloat)(ctx->Pixel.MapStoSsize); + params[0] = (GLfloat)(ctx->PixelMaps.StoS.Size); break; case GL_POINT_SIZE: params[0] = ctx->Point.Size; @@ -2617,7 +2628,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) params[0] = ctx->Pixel.RedBias; break; case GL_RED_BITS: - params[0] = (GLfloat)( ctx->DrawBuffer->Visual.redBits ); + params[0] = (GLfloat)(ctx->DrawBuffer->Visual.redBits); break; case GL_RED_SCALE: params[0] = ctx->Pixel.RedScale; @@ -3107,15 +3118,15 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) break; case GL_COLOR_TABLE_SGI: CHECK_EXT1(SGI_color_table, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.ColorTableEnabled); + params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]); break; case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: CHECK_EXT1(SGI_color_table, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.PostConvolutionColorTableEnabled); + params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION]); break; case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: CHECK_EXT1(SGI_color_table, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.PostColorMatrixColorTableEnabled); + params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX]); break; case GL_TEXTURE_COLOR_TABLE_SGI: CHECK_EXT1(SGI_texture_color_table, "GetFloatv"); @@ -3657,6 +3668,9 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) case GL_STENCIL_BACK_VALUE_MASK: params[0] = (GLfloat)(ctx->Stencil.ValueMask[1]); break; + case GL_STENCIL_BACK_WRITEMASK: + params[0] = (GLfloat)(ctx->Stencil.WriteMask[1]); + break; case GL_STENCIL_BACK_REF: params[0] = (GLfloat)(ctx->Stencil.Ref[1]); break; @@ -3685,9 +3699,13 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) CHECK_EXT1(EXT_framebuffer_object, "GetFloatv"); params[0] = (GLfloat)(ctx->Const.MaxRenderbufferSize); break; + case GL_READ_FRAMEBUFFER_BINDING_EXT: + CHECK_EXT1(EXT_framebuffer_blit, "GetFloatv"); + params[0] = (GLfloat)(ctx->ReadBuffer->Name); + break; case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB: CHECK_EXT1(ARB_fragment_shader, "GetFloatv"); - params[0] = (GLfloat)(MAX_FRAGMENT_UNIFORM_COMPONENTS); + params[0] = (GLfloat)(ctx->Const.FragmentProgram.MaxUniformComponents); break; case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB: CHECK_EXT1(ARB_fragment_shader, "GetFloatv"); @@ -3695,20 +3713,24 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) break; case GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB: CHECK_EXT1(ARB_vertex_shader, "GetFloatv"); - params[0] = (GLfloat)(MAX_VERTEX_UNIFORM_COMPONENTS); + params[0] = (GLfloat)(ctx->Const.VertexProgram.MaxUniformComponents); break; case GL_MAX_VARYING_FLOATS_ARB: CHECK_EXT1(ARB_vertex_shader, "GetFloatv"); - params[0] = (GLfloat)(MAX_VARYING_FLOATS); + params[0] = (GLfloat)(ctx->Const.MaxVarying * 4); break; case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB: CHECK_EXT1(ARB_vertex_shader, "GetFloatv"); - params[0] = (GLfloat)(MAX_VERTEX_TEXTURE_IMAGE_UNITS); + params[0] = (GLfloat)(ctx->Const.MaxVertexTextureImageUnits); break; case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB: CHECK_EXT1(ARB_vertex_shader, "GetFloatv"); params[0] = (GLfloat)(MAX_COMBINED_TEXTURE_IMAGE_UNITS); break; + case GL_CURRENT_PROGRAM: + CHECK_EXT1(ARB_shader_objects, "GetFloatv"); + params[0] = (GLfloat)(ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0); + break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv(pname=0x%x)", pname); } @@ -3971,7 +3993,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) case GL_EDGE_FLAG: { FLUSH_CURRENT(ctx, 0); - params[0] = BOOLEAN_TO_INT(ctx->Current.EdgeFlag); + params[0] = BOOLEAN_TO_INT((ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0)); } break; case GL_FEEDBACK_BUFFER_SIZE: @@ -4325,34 +4347,34 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) params[0] = ENUM_TO_INT(ctx->Hint.PerspectiveCorrection); break; case GL_PIXEL_MAP_A_TO_A_SIZE: - params[0] = ctx->Pixel.MapAtoAsize; + params[0] = ctx->PixelMaps.AtoA.Size; break; case GL_PIXEL_MAP_B_TO_B_SIZE: - params[0] = ctx->Pixel.MapBtoBsize; + params[0] = ctx->PixelMaps.BtoB.Size; break; case GL_PIXEL_MAP_G_TO_G_SIZE: - params[0] = ctx->Pixel.MapGtoGsize; + params[0] = ctx->PixelMaps.GtoG.Size; break; case GL_PIXEL_MAP_I_TO_A_SIZE: - params[0] = ctx->Pixel.MapItoAsize; + params[0] = ctx->PixelMaps.ItoA.Size; break; case GL_PIXEL_MAP_I_TO_B_SIZE: - params[0] = ctx->Pixel.MapItoBsize; + params[0] = ctx->PixelMaps.ItoB.Size; break; case GL_PIXEL_MAP_I_TO_G_SIZE: - params[0] = ctx->Pixel.MapItoGsize; + params[0] = ctx->PixelMaps.ItoG.Size; break; case GL_PIXEL_MAP_I_TO_I_SIZE: - params[0] = ctx->Pixel.MapItoIsize; + params[0] = ctx->PixelMaps.ItoI.Size; break; case GL_PIXEL_MAP_I_TO_R_SIZE: - params[0] = ctx->Pixel.MapItoRsize; + params[0] = ctx->PixelMaps.ItoR.Size; break; case GL_PIXEL_MAP_R_TO_R_SIZE: - params[0] = ctx->Pixel.MapRtoRsize; + params[0] = ctx->PixelMaps.RtoR.Size; break; case GL_PIXEL_MAP_S_TO_S_SIZE: - params[0] = ctx->Pixel.MapStoSsize; + params[0] = ctx->PixelMaps.StoS.Size; break; case GL_POINT_SIZE: params[0] = IROUND(ctx->Point.Size); @@ -4441,7 +4463,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) params[0] = IROUND(ctx->Pixel.RedBias); break; case GL_RED_BITS: - params[0] = ctx->DrawBuffer->Visual.redBits ; + params[0] = ctx->DrawBuffer->Visual.redBits; break; case GL_RED_SCALE: params[0] = IROUND(ctx->Pixel.RedScale); @@ -4931,15 +4953,15 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) break; case GL_COLOR_TABLE_SGI: CHECK_EXT1(SGI_color_table, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Pixel.ColorTableEnabled); + params[0] = BOOLEAN_TO_INT(ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]); break; case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: CHECK_EXT1(SGI_color_table, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Pixel.PostConvolutionColorTableEnabled); + params[0] = BOOLEAN_TO_INT(ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION]); break; case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: CHECK_EXT1(SGI_color_table, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Pixel.PostColorMatrixColorTableEnabled); + params[0] = BOOLEAN_TO_INT(ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX]); break; case GL_TEXTURE_COLOR_TABLE_SGI: CHECK_EXT1(SGI_texture_color_table, "GetIntegerv"); @@ -5481,6 +5503,9 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) case GL_STENCIL_BACK_VALUE_MASK: params[0] = ctx->Stencil.ValueMask[1]; break; + case GL_STENCIL_BACK_WRITEMASK: + params[0] = ctx->Stencil.WriteMask[1]; + break; case GL_STENCIL_BACK_REF: params[0] = ctx->Stencil.Ref[1]; break; @@ -5509,9 +5534,13 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) CHECK_EXT1(EXT_framebuffer_object, "GetIntegerv"); params[0] = ctx->Const.MaxRenderbufferSize; break; + case GL_READ_FRAMEBUFFER_BINDING_EXT: + CHECK_EXT1(EXT_framebuffer_blit, "GetIntegerv"); + params[0] = ctx->ReadBuffer->Name; + break; case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB: CHECK_EXT1(ARB_fragment_shader, "GetIntegerv"); - params[0] = MAX_FRAGMENT_UNIFORM_COMPONENTS; + params[0] = ctx->Const.FragmentProgram.MaxUniformComponents; break; case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB: CHECK_EXT1(ARB_fragment_shader, "GetIntegerv"); @@ -5519,20 +5548,24 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) break; case GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB: CHECK_EXT1(ARB_vertex_shader, "GetIntegerv"); - params[0] = MAX_VERTEX_UNIFORM_COMPONENTS; + params[0] = ctx->Const.VertexProgram.MaxUniformComponents; break; case GL_MAX_VARYING_FLOATS_ARB: CHECK_EXT1(ARB_vertex_shader, "GetIntegerv"); - params[0] = MAX_VARYING_FLOATS; + params[0] = ctx->Const.MaxVarying * 4; break; case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB: CHECK_EXT1(ARB_vertex_shader, "GetIntegerv"); - params[0] = MAX_VERTEX_TEXTURE_IMAGE_UNITS; + params[0] = ctx->Const.MaxVertexTextureImageUnits; break; case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB: CHECK_EXT1(ARB_vertex_shader, "GetIntegerv"); params[0] = MAX_COMBINED_TEXTURE_IMAGE_UNITS; break; + case GL_CURRENT_PROGRAM: + CHECK_EXT1(ARB_shader_objects, "GetIntegerv"); + params[0] = ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0; + break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv(pname=0x%x)", pname); } diff --git a/dist/Mesa/src/mesa/main/glheader.h b/dist/Mesa/src/mesa/main/glheader.h index 2d2da49fe..bab962ad5 100644 --- a/dist/Mesa/src/mesa/main/glheader.h +++ b/dist/Mesa/src/mesa/main/glheader.h @@ -237,7 +237,7 @@ #endif -#if (!defined(__GNUC__) || __GNUC__ < 3) && !defined(__IBMC__) +#if (!defined(__GNUC__) || __GNUC__ < 3) && (!defined(__IBMC__) || __IBMC__ < 900) # define __builtin_expect(x, y) x #endif diff --git a/dist/Mesa/src/mesa/main/imports.h b/dist/Mesa/src/mesa/main/imports.h index a17a0fd18..d6dc725b0 100644 --- a/dist/Mesa/src/mesa/main/imports.h +++ b/dist/Mesa/src/mesa/main/imports.h @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.1 + * Version: 7.0.3 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 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"), @@ -55,6 +55,15 @@ extern "C" { #define NULL 0 #endif + +/** gcc -pedantic warns about long string literals, LONGSTRING silences that */ +#if !defined(__GNUC__) || (__GNUC__ < 2) || \ + ((__GNUC__ == 2) && (__GNUC_MINOR__ <= 7)) +# define LONGSTRING +#else +# define LONGSTRING __extension__ +#endif + /*@}*/ @@ -129,13 +138,16 @@ typedef union { GLfloat f; GLint i; } fi_type; #define M_E (2.7182818284590452354) #endif -#ifndef FLT_MAX_EXP -#define FLT_MAX_EXP 128 +#ifndef ONE_DIV_LN2 +#define ONE_DIV_LN2 (1.442695040888963456) #endif -/* XXX this is a bit of a hack needed for compilation within XFree86 */ -#ifndef FLT_MIN -#define FLT_MIN (1.0e-37) +#ifndef ONE_DIV_SQRT_LN2 +#define ONE_DIV_SQRT_LN2 (1.201122408786449815) +#endif + +#ifndef FLT_MAX_EXP +#define FLT_MAX_EXP 128 #endif /* Degrees to radians conversion: */ @@ -147,7 +159,7 @@ typedef union { GLfloat f; GLint i; } fi_type; ***/ #if defined(__i386__) || defined(__386__) || defined(__sparc__) || \ defined(__s390x__) || defined(__powerpc__) || \ - defined(__amd64__) || \ + defined(__amd64__) || defined(__x86_64__) || \ defined(ia64) || defined(__ia64__) || \ defined(__hppa__) || defined(hpux) || \ defined(__mips) || defined(_MIPS_ARCH) || \ @@ -164,8 +176,6 @@ typedef union { GLfloat f; GLint i; } fi_type; ***/ #if 0 /* _mesa_sqrtf() not accurate enough - temporarily disabled */ # define SQRTF(X) _mesa_sqrtf(X) -#elif defined(XFree86LOADER) && defined(IN_MODULE) && !defined(NO_LIBCWRAPPER) -# define SQRTF(X) (float) xf86sqrt((float) (X)) #else # define SQRTF(X) (float) sqrt((float) (X)) #endif @@ -212,8 +222,6 @@ static INLINE GLfloat LOG2(GLfloat val) num.f = ((-1.0f/3) * num.f + 2) * num.f - 2.0f/3; return num.f + log_2; } -#elif defined(XFree86LOADER) && defined(IN_MODULE) && !defined(NO_LIBCWRAPPER) -#define LOG2(x) ((GLfloat) (xf86log(x) * 1.442695)) #else /* * NOTE: log_base_2(x) = log(x) / log(2) @@ -284,15 +292,7 @@ static INLINE int GET_FLOAT_BITS( float x ) *** LDEXPF: multiply value by an integral power of two *** FREXPF: extract mantissa and exponent from value ***/ -#if defined(XFree86LOADER) && defined(IN_MODULE) && !defined(NO_LIBCWRAPPER) -#define CEILF(x) ((GLfloat) xf86ceil(x)) -#define FLOORF(x) ((GLfloat) xf86floor(x)) -#define FABSF(x) ((GLfloat) xf86fabs(x)) -#define LOGF(x) ((GLfloat) xf86log(x)) -#define EXPF(x) ((GLfloat) xf86exp(x)) -#define LDEXPF(x,y) ((GLfloat) xf86ldexp(x,y)) -#define FREXPF(x,y) ((GLfloat) xf86frexp(x,y)) -#elif defined(__gnu_linux__) +#if defined(__gnu_linux__) /* C99 functions */ #define CEILF(x) ceilf(x) #define FLOORF(x) floorf(x) @@ -604,6 +604,17 @@ do { \ #endif +/** + * Return 1 if this is a little endian machine, 0 if big endian. + */ +static INLINE GLboolean +_mesa_little_endian(void) +{ + const GLuint ui = 1; /* intentionally not static */ + return *((const GLubyte *) &ui); +} + + /********************************************************************** * Functions @@ -679,12 +690,22 @@ _mesa_sqrtf(float x); extern float _mesa_inv_sqrtf(float x); +extern void +_mesa_init_sqrt_table(void); + extern double _mesa_pow(double x, double y); extern int _mesa_ffs(int i); +extern int +#ifdef __MINGW32__ +_mesa_ffsll(long i); +#else +_mesa_ffsll(long long i); +#endif + extern unsigned int _mesa_bitcount(unsigned int n); @@ -758,10 +779,6 @@ extern void _mesa_exit( int status ); -extern void -_mesa_init_default_imports( __GLimports *imports, void *driverCtx ); - - #ifdef __cplusplus } #endif diff --git a/dist/Mesa/src/mesa/main/mtypes.h b/dist/Mesa/src/mesa/main/mtypes.h index d00f2efc7..96c3515dd 100644 --- a/dist/Mesa/src/mesa/main/mtypes.h +++ b/dist/Mesa/src/mesa/main/mtypes.h @@ -7,7 +7,7 @@ /* * Mesa 3-D graphics library - * Version: 6.5.3 + * Version: 7.0.3 * * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * @@ -1063,7 +1063,7 @@ struct gl_point_attrib { GLboolean SmoothFlag; /**< True if GL_POINT_SMOOTH is enabled */ GLfloat Size; /**< User-specified point size */ - GLfloat _Size; /**< Size clamped to Const.Min/MaxPointSize */ + GLfloat _Size; /**< Size clamped to user limits */ GLfloat Params[3]; /**< GL_EXT_point_parameters */ GLfloat MinSize, MaxSize; /**< GL_EXT_point_parameters */ GLfloat Threshold; /**< GL_EXT_point_parameters */ @@ -3032,12 +3032,6 @@ struct __GLcontextRec struct gl_list_extensions ListExt; /**< driver dlist extensions */ - - GLuint _Facing; /**< This is a hack for 2-sided stencil test. - * - * We don't have a better way to communicate this value from - * swrast_setup to swrast. */ - /** \name For debugging/development only */ /*@{*/ GLboolean FirstTimeCurrent; diff --git a/dist/Mesa/src/mesa/main/points.c b/dist/Mesa/src/mesa/main/points.c index 8825bb181..5fa905ffc 100644 --- a/dist/Mesa/src/mesa/main/points.c +++ b/dist/Mesa/src/mesa/main/points.c @@ -5,7 +5,7 @@ /* * Mesa 3-D graphics library - * Version: 7.0.1 + * Version: 7.0.3 * * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * @@ -57,6 +57,7 @@ _mesa_PointSize( GLfloat size ) FLUSH_VERTICES(ctx, _NEW_POINT); ctx->Point.Size = size; + /* _Size is only used for non-attenuated path */ ctx->Point._Size = CLAMP(ctx->Point.Size, ctx->Point.MinSize, ctx->Point.MaxSize); @@ -150,6 +151,10 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params) return; FLUSH_VERTICES(ctx, _NEW_POINT); ctx->Point.MinSize = params[0]; + /* re-clamp _Size */ + ctx->Point._Size = CLAMP(ctx->Point.Size, + ctx->Point.MinSize, + ctx->Point.MaxSize); } else { _mesa_error(ctx, GL_INVALID_ENUM, @@ -168,6 +173,10 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params) return; FLUSH_VERTICES(ctx, _NEW_POINT); ctx->Point.MaxSize = params[0]; + /* re-clamp _Size */ + ctx->Point._Size = CLAMP(ctx->Point.Size, + ctx->Point.MinSize, + ctx->Point.MaxSize); } else { _mesa_error(ctx, GL_INVALID_ENUM, diff --git a/dist/Mesa/src/mesa/main/state.c b/dist/Mesa/src/mesa/main/state.c index 99b3f48b4..8266e4506 100644 --- a/dist/Mesa/src/mesa/main/state.c +++ b/dist/Mesa/src/mesa/main/state.c @@ -960,7 +960,7 @@ update_program(GLcontext *ctx) ctx->FragmentProgram._Enabled = ctx->FragmentProgram.Enabled && ctx->FragmentProgram.Current->Base.Instructions; ctx->ATIFragmentShader._Enabled = ctx->ATIFragmentShader.Enabled - && ctx->ATIFragmentShader.Current->Instructions; + && ctx->ATIFragmentShader.Current->Instructions[0]; /* * Set the ctx->VertexProgram._Current and ctx->FragmentProgram._Current diff --git a/dist/Mesa/src/mesa/main/texenvprogram.c b/dist/Mesa/src/mesa/main/texenvprogram.c index 47f3adbd0..387779323 100644 --- a/dist/Mesa/src/mesa/main/texenvprogram.c +++ b/dist/Mesa/src/mesa/main/texenvprogram.c @@ -199,8 +199,8 @@ static void make_state_key( GLcontext *ctx, struct state_key *key ) for (i=0;i<MAX_TEXTURE_UNITS;i++) { const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; - - if (!texUnit->_ReallyEnabled) + + if (!texUnit->_ReallyEnabled || !texUnit->Enabled) continue; key->unit[i].enabled = 1; diff --git a/dist/Mesa/src/mesa/main/teximage.c b/dist/Mesa/src/mesa/main/teximage.c index 14024fec0..26d8fbc8d 100644 --- a/dist/Mesa/src/mesa/main/teximage.c +++ b/dist/Mesa/src/mesa/main/teximage.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.1 + * Version: 7.0.3 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 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"), @@ -73,11 +73,11 @@ _mesa_free_texmemory(void *m) #if 0 static void PrintTexture(GLcontext *ctx, const struct gl_texture_image *img) { -#if CHAN_TYPE == GL_FLOAT - _mesa_problem(NULL, "PrintTexture doesn't support float channels"); +#if CHAN_TYPE != GL_UNSIGNED_BYTE + _mesa_problem(NULL, "PrintTexture not supported"); #else GLuint i, j, c; - const GLchan *data = (const GLchan *) img->Data; + const GLubyte *data = (const GLubyte *) img->Data; if (!data) { _mesa_printf("No texture data\n"); @@ -706,9 +706,12 @@ _mesa_free_texture_image_data(GLcontext *ctx, void _mesa_delete_texture_image( GLcontext *ctx, struct gl_texture_image *texImage ) { - if (texImage->Data) { - ctx->Driver.FreeTexImageData( ctx, texImage ); - } + /* Free texImage->Data and/or any other driver-specific texture + * image storage. + */ + ASSERT(ctx->Driver.FreeTexImageData); + ctx->Driver.FreeTexImageData( ctx, texImage ); + ASSERT(texImage->Data == NULL); if (texImage->ImageOffsets) _mesa_free(texImage->ImageOffsets); @@ -801,24 +804,23 @@ _mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit, * \sa gl_texture_unit. */ struct gl_texture_image * -_mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit, - GLenum target, GLint level) +_mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_object *texObj, + GLenum target, GLint level) { - ASSERT(texUnit); - ASSERT(level < MAX_TEXTURE_LEVELS); + ASSERT(texObj); + + if (level < 0 || level >= MAX_TEXTURE_LEVELS) + return NULL; + switch (target) { case GL_TEXTURE_1D: - return texUnit->Current1D->Image[0][level]; case GL_PROXY_TEXTURE_1D: - return ctx->Texture.Proxy1D->Image[0][level]; case GL_TEXTURE_2D: - return texUnit->Current2D->Image[0][level]; case GL_PROXY_TEXTURE_2D: - return ctx->Texture.Proxy2D->Image[0][level]; case GL_TEXTURE_3D: - return texUnit->Current3D->Image[0][level]; case GL_PROXY_TEXTURE_3D: - return ctx->Texture.Proxy3D->Image[0][level]; + return texObj->Image[0][level]; + case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: @@ -828,33 +830,25 @@ _mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit, if (ctx->Extensions.ARB_texture_cube_map) { GLuint face = ((GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X); - return texUnit->CurrentCubeMap->Image[face][level]; + return texObj->Image[face][level]; } else return NULL; + case GL_PROXY_TEXTURE_CUBE_MAP_ARB: if (ctx->Extensions.ARB_texture_cube_map) - return ctx->Texture.ProxyCubeMap->Image[0][level]; + return texObj->Image[0][level]; else return NULL; + case GL_TEXTURE_RECTANGLE_NV: - if (ctx->Extensions.NV_texture_rectangle) { - ASSERT(level == 0); - return texUnit->CurrentRect->Image[0][level]; - } - else { - return NULL; - } case GL_PROXY_TEXTURE_RECTANGLE_NV: - if (ctx->Extensions.NV_texture_rectangle) { - ASSERT(level == 0); - return ctx->Texture.ProxyRect->Image[0][level]; - } - else { + if (ctx->Extensions.NV_texture_rectangle && level == 0) + return texObj->Image[0][level]; + else return NULL; - } + default: - _mesa_problem(ctx, "bad target in _mesa_select_tex_image()"); return NULL; } } @@ -866,22 +860,25 @@ _mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit, * out of memory. */ struct gl_texture_image * -_mesa_get_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit, +_mesa_get_tex_image(GLcontext *ctx, struct gl_texture_object *texObj, GLenum target, GLint level) { struct gl_texture_image *texImage; - texImage = _mesa_select_tex_image(ctx, texUnit, target, level); + + if (!texObj) + return NULL; + + texImage = _mesa_select_tex_image(ctx, texObj, target, level); if (!texImage) { - struct gl_texture_object *texObj; texImage = ctx->Driver.NewTextureImage(ctx); if (!texImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "texture image allocation"); return NULL; } - texObj = _mesa_select_tex_object(ctx, texUnit, target); - ASSERT(texObj); + _mesa_set_tex_image(texObj, target, level, texImage); } + return texImage; } @@ -1210,6 +1207,10 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target, * A hardware driver might override this function if, for example, the * max 3D texture size is 512x512x64 (i.e. not a cube). * + * Note that width, height, depth == 0 is not an error. However, a + * texture with zero width/height/depth will be considered "incomplete" + * and texturing will effectively be disabled. + * * \param target one of GL_PROXY_TEXTURE_1D, GL_PROXY_TEXTURE_2D, * GL_PROXY_TEXTURE_3D, GL_PROXY_TEXTURE_RECTANGLE_NV, * GL_PROXY_TEXTURE_CUBE_MAP_ARB. @@ -1239,7 +1240,7 @@ _mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level, maxSize = 1 << (ctx->Const.MaxTextureLevels - 1); if (width < 2 * border || width > 2 + maxSize || (!ctx->Extensions.ARB_texture_non_power_of_two && - _mesa_bitcount(width - 2 * border) != 1) || + width > 0 && _mesa_bitcount(width - 2 * border) != 1) || level >= ctx->Const.MaxTextureLevels) { /* bad width or level */ return GL_FALSE; @@ -1249,10 +1250,10 @@ _mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level, maxSize = 1 << (ctx->Const.MaxTextureLevels - 1); if (width < 2 * border || width > 2 + maxSize || (!ctx->Extensions.ARB_texture_non_power_of_two && - _mesa_bitcount(width - 2 * border) != 1) || + width > 0 && _mesa_bitcount(width - 2 * border) != 1) || height < 2 * border || height > 2 + maxSize || (!ctx->Extensions.ARB_texture_non_power_of_two && - _mesa_bitcount(height - 2 * border) != 1) || + height > 0 && _mesa_bitcount(height - 2 * border) != 1) || level >= ctx->Const.MaxTextureLevels) { /* bad width or height or level */ return GL_FALSE; @@ -1262,21 +1263,21 @@ _mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level, maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1); if (width < 2 * border || width > 2 + maxSize || (!ctx->Extensions.ARB_texture_non_power_of_two && - _mesa_bitcount(width - 2 * border) != 1) || + width > 0 && _mesa_bitcount(width - 2 * border) != 1) || height < 2 * border || height > 2 + maxSize || (!ctx->Extensions.ARB_texture_non_power_of_two && - _mesa_bitcount(height - 2 * border) != 1) || + height > 0 && _mesa_bitcount(height - 2 * border) != 1) || depth < 2 * border || depth > 2 + maxSize || (!ctx->Extensions.ARB_texture_non_power_of_two && - _mesa_bitcount(depth - 2 * border) != 1) || + depth > 0 && _mesa_bitcount(depth - 2 * border) != 1) || level >= ctx->Const.Max3DTextureLevels) { /* bad width or height or depth or level */ return GL_FALSE; } return GL_TRUE; case GL_PROXY_TEXTURE_RECTANGLE_NV: - if (width < 1 || width > ctx->Const.MaxTextureRectSize || - height < 1 || height > ctx->Const.MaxTextureRectSize || + if (width < 0 || width > ctx->Const.MaxTextureRectSize || + height < 0 || height > ctx->Const.MaxTextureRectSize || level != 0) { /* bad width or height or level */ return GL_FALSE; @@ -1286,10 +1287,10 @@ _mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level, maxSize = 1 << (ctx->Const.MaxCubeTextureLevels - 1); if (width < 2 * border || width > 2 + maxSize || (!ctx->Extensions.ARB_texture_non_power_of_two && - _mesa_bitcount(width - 2 * border) != 1) || + width > 0 && _mesa_bitcount(width - 2 * border) != 1) || height < 2 * border || height > 2 + maxSize || (!ctx->Extensions.ARB_texture_non_power_of_two && - _mesa_bitcount(height - 2 * border) != 1) || + height > 0 && _mesa_bitcount(height - 2 * border) != 1) || level >= ctx->Const.MaxCubeTextureLevels) { /* bad width or height */ return GL_FALSE; @@ -1303,6 +1304,20 @@ _mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level, /** + * Helper function to determine whether a target supports compressed textures + */ +static GLboolean +target_can_be_compressed(GLcontext *ctx, GLenum target) +{ + return (((target == GL_TEXTURE_2D || target == GL_PROXY_TEXTURE_2D)) + || ((ctx->Extensions.ARB_texture_cube_map && + (target == GL_PROXY_TEXTURE_CUBE_MAP || + (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && + target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z))))); +} + + +/** * Test the glTexImage[123]D() parameters for errors. * * \param ctx GL context. @@ -1332,8 +1347,9 @@ texture_error_check( GLcontext *ctx, GLenum target, GLint depth, GLint border ) { const GLboolean isProxy = _mesa_is_proxy_texture(target); - GLboolean sizeOK; + GLboolean sizeOK = GL_TRUE; GLboolean colorFormat, indexFormat; + GLenum proxy_target; /* Basic level check (more checking in ctx->Driver.TestProxyTexImage) */ if (level < 0 || level >= MAX_TEXTURE_LEVELS) { @@ -1368,10 +1384,9 @@ texture_error_check( GLcontext *ctx, GLenum target, */ if (dimensions == 1) { if (target == GL_PROXY_TEXTURE_1D || target == GL_TEXTURE_1D) { - sizeOK = ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_1D, - level, internalFormat, - format, type, - width, 1, 1, border); + proxy_target = GL_PROXY_TEXTURE_1D; + height = 1; + depth = 1; } else { _mesa_error( ctx, GL_INVALID_ENUM, "glTexImage1D(target)" ); @@ -1379,11 +1394,9 @@ texture_error_check( GLcontext *ctx, GLenum target, } } else if (dimensions == 2) { + depth = 1; if (target == GL_PROXY_TEXTURE_2D || target == GL_TEXTURE_2D) { - sizeOK = ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_2D, - level, internalFormat, - format, type, - width, height, 1, border); + proxy_target = GL_PROXY_TEXTURE_2D; } else if (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB || (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && @@ -1392,10 +1405,8 @@ texture_error_check( GLcontext *ctx, GLenum target, _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)"); return GL_TRUE; } - sizeOK = (width == height) && - ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_CUBE_MAP_ARB, - level, internalFormat, format, type, - width, height, 1, border); + proxy_target = GL_PROXY_TEXTURE_CUBE_MAP_ARB; + sizeOK = (width == height); } else if (target == GL_PROXY_TEXTURE_RECTANGLE_NV || target == GL_TEXTURE_RECTANGLE_NV) { @@ -1403,11 +1414,7 @@ texture_error_check( GLcontext *ctx, GLenum target, _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)"); return GL_TRUE; } - sizeOK = ctx->Driver.TestProxyTexImage(ctx, - GL_PROXY_TEXTURE_RECTANGLE_NV, - level, internalFormat, - format, type, - width, height, 1, border); + proxy_target = GL_PROXY_TEXTURE_RECTANGLE_NV; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)"); @@ -1416,10 +1423,7 @@ texture_error_check( GLcontext *ctx, GLenum target, } else if (dimensions == 3) { if (target == GL_PROXY_TEXTURE_3D || target == GL_TEXTURE_3D) { - sizeOK = ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_3D, - level, internalFormat, - format, type, - width, height, depth, border); + proxy_target = GL_PROXY_TEXTURE_3D; } else { _mesa_error( ctx, GL_INVALID_ENUM, "glTexImage3D(target)" ); @@ -1431,6 +1435,10 @@ texture_error_check( GLcontext *ctx, GLenum target, return GL_TRUE; } + sizeOK = sizeOK && ctx->Driver.TestProxyTexImage(ctx, proxy_target, level, + internalFormat, format, + type, width, height, + depth, border); if (!sizeOK) { if (!isProxy) { _mesa_error(ctx, GL_INVALID_VALUE, @@ -1525,21 +1533,10 @@ texture_error_check( GLcontext *ctx, GLenum target, /* additional checks for compressed textures */ if (is_compressed_format(ctx, internalFormat)) { - if (target == GL_TEXTURE_2D || target == GL_PROXY_TEXTURE_2D) { - /* OK */ - } - else if (ctx->Extensions.ARB_texture_cube_map && - (target == GL_PROXY_TEXTURE_CUBE_MAP || - (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && - target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z))) { - /* OK */ - } - else { - if (!isProxy) { - _mesa_error(ctx, GL_INVALID_ENUM, - "glTexImage%d(target)", dimensions); - return GL_TRUE; - } + if (!target_can_be_compressed(ctx, target) && !isProxy) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexImage%d(target)", dimensions); + return GL_TRUE; } if (border != 0) { if (!isProxy) { @@ -1584,9 +1581,6 @@ subtexture_error_check( GLcontext *ctx, GLuint dimensions, GLint width, GLint height, GLint depth, GLenum format, GLenum type ) { - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - struct gl_texture_image *destTex; - /* Check target */ if (dimensions == 1) { if (target != GL_TEXTURE_1D) { @@ -1596,14 +1590,13 @@ subtexture_error_check( GLcontext *ctx, GLuint dimensions, } else if (dimensions == 2) { if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && - target <=GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) { + target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) { if (!ctx->Extensions.ARB_texture_cube_map) { _mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage2D(target)" ); return GL_TRUE; } } - else if (ctx->Extensions.NV_texture_rectangle && - target == GL_TEXTURE_RECTANGLE_NV) { + else if (target == GL_TEXTURE_RECTANGLE_NV) { if (!ctx->Extensions.NV_texture_rectangle) { _mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage2D(target)" ); return GL_TRUE; @@ -1647,8 +1640,23 @@ subtexture_error_check( GLcontext *ctx, GLuint dimensions, return GL_TRUE; } - destTex = _mesa_select_tex_image(ctx, texUnit, target, level); + if (!_mesa_is_legal_format_and_type(ctx, format, type)) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexSubImage%dD(format or type)", dimensions); + return GL_TRUE; + } + + return GL_FALSE; +} +static GLboolean +subtexture_error_check2( GLcontext *ctx, GLuint dimensions, + GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLint width, GLint height, GLint depth, + GLenum format, GLenum type, + const struct gl_texture_image *destTex ) +{ if (!destTex) { /* undefined image level */ _mesa_error(ctx, GL_INVALID_OPERATION, "glTexSubImage%dD", dimensions); @@ -1688,12 +1696,6 @@ subtexture_error_check( GLcontext *ctx, GLuint dimensions, } } - if (!_mesa_is_legal_format_and_type(ctx, format, type)) { - _mesa_error(ctx, GL_INVALID_ENUM, - "glTexSubImage%dD(format or type)", dimensions); - return GL_TRUE; - } - #if FEATURE_EXT_texture_sRGB if (destTex->InternalFormat == GL_COMPRESSED_SRGB_S3TC_DXT1_EXT || destTex->InternalFormat == GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT || @@ -1709,21 +1711,7 @@ subtexture_error_check( GLcontext *ctx, GLuint dimensions, #endif if (destTex->IsCompressed) { - const struct gl_texture_unit *texUnit; - const struct gl_texture_image *texImage; - texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texImage = _mesa_select_tex_image(ctx, texUnit, target, level); - - if (target == GL_TEXTURE_2D || target == GL_PROXY_TEXTURE_2D) { - /* OK */ - } - else if (ctx->Extensions.ARB_texture_cube_map && - (target == GL_PROXY_TEXTURE_CUBE_MAP || - (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && - target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z))) { - /* OK */ - } - else { + if (!target_can_be_compressed(ctx, target)) { _mesa_error(ctx, GL_INVALID_ENUM, "glTexSubImage%D(target)", dimensions); return GL_TRUE; @@ -1735,12 +1723,12 @@ subtexture_error_check( GLcontext *ctx, GLuint dimensions, return GL_TRUE; } /* size must be multiple of 4 or equal to whole texture size */ - if ((width & 3) && (GLuint) width != texImage->Width) { + if ((width & 3) && (GLuint) width != destTex->Width) { _mesa_error(ctx, GL_INVALID_OPERATION, "glTexSubImage%D(width)", dimensions); return GL_TRUE; } - if ((height & 3) && (GLuint) height != texImage->Height) { + if ((height & 3) && (GLuint) height != destTex->Height) { _mesa_error(ctx, GL_INVALID_OPERATION, "glTexSubImage%D(width)", dimensions); return GL_TRUE; @@ -1781,6 +1769,11 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions, /* Basic level check (more checking in ctx->Driver.TestProxyTexImage) */ if (level < 0 || level >= MAX_TEXTURE_LEVELS) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexImage%dD(level=%d)", dimensions, level); + return GL_TRUE; + } + /* Check that the source buffer is complete */ if (ctx->ReadBuffer->Name) { _mesa_test_framebuffer_completeness(ctx, ctx->ReadBuffer); @@ -1791,11 +1784,6 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions, } } - _mesa_error(ctx, GL_INVALID_VALUE, - "glCopyTexImage%dD(level=%d)", dimensions, level); - return GL_TRUE; - } - /* Check border */ if (border < 0 || border > 1 || ((target == GL_TEXTURE_RECTANGLE_NV || @@ -1945,11 +1933,8 @@ static GLboolean copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, - GLsizei width, GLsizei height ) + GLsizei width, GLsizei height) { - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - struct gl_texture_image *teximage; - /* Check target */ /* Check that the source buffer is complete */ if (ctx->ReadBuffer->Name) { @@ -2012,7 +1997,16 @@ copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions, return GL_TRUE; } - teximage = _mesa_select_tex_image(ctx, texUnit, target, level); + return GL_FALSE; +} + +static GLboolean +copytexsubimage_error_check2( GLcontext *ctx, GLuint dimensions, + GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, + const struct gl_texture_image *teximage ) +{ if (!teximage) { _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyTexSubImage%dD(undefined texture level: %d)", @@ -2058,12 +2052,6 @@ copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions, } if (teximage->IsCompressed) { - if (!_mesa_source_buffer_exists(ctx, teximage->_BaseFormat)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glCopyTexSubImage%dD(missing readbuffer)", dimensions); - return GL_TRUE; - } - if (target != GL_TEXTURE_2D) { _mesa_error(ctx, GL_INVALID_ENUM, "glCopyTexSubImage%d(target)", dimensions); @@ -2093,6 +2081,12 @@ copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions, return GL_TRUE; } + if (!_mesa_source_buffer_exists(ctx, teximage->_BaseFormat)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCopyTexSubImage%dD(missing readbuffer)", dimensions); + return GL_TRUE; + } + if (teximage->_BaseFormat == GL_DEPTH_COMPONENT) { if (!ctx->ReadBuffer->_DepthBuffer) { _mesa_error(ctx, GL_INVALID_OPERATION, @@ -2183,62 +2177,66 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, return; } - if (!pixels) - return; + _mesa_lock_texture(ctx, texObj); + { + texImage = _mesa_select_tex_image(ctx, texObj, target, level); + if (!texImage) { + /* invalid mipmap level, not an error */ + goto out; + } - texImage = _mesa_select_tex_image(ctx, texUnit, target, level); - if (!texImage) { - /* invalid mipmap level, not an error */ - return; - } - /* Make sure the requested image format is compatible with the - * texture's format. Note that a color index texture can be converted - * to RGBA so that combo is allowed. - */ - if (is_color_format(format) - && !is_color_format(texImage->TexFormat->BaseFormat) - && !is_index_format(texImage->TexFormat->BaseFormat)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)"); - return; - } - else if (is_index_format(format) - && !is_index_format(texImage->TexFormat->BaseFormat)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)"); - return; - } - else if (is_depth_format(format) - && !is_depth_format(texImage->TexFormat->BaseFormat) - && !is_depthstencil_format(texImage->TexFormat->BaseFormat)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)"); - return; - } - else if (is_ycbcr_format(format) - && !is_ycbcr_format(texImage->TexFormat->BaseFormat)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)"); - return; - } - else if (is_depthstencil_format(format) - && !is_depthstencil_format(texImage->TexFormat->BaseFormat)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)"); - return; - } - - if (ctx->Pack.BufferObj->Name) { - /* packing texture image into a PBO */ - const GLuint dimensions = (target == GL_TEXTURE_3D) ? 3 : 2; - if (!_mesa_validate_pbo_access(dimensions, &ctx->Pack, texImage->Width, - texImage->Height, texImage->Depth, - format, type, pixels)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGetTexImage(invalid PBO access)"); - return; + /* Make sure the requested image format is compatible with the + * texture's format. Note that a color index texture can be converted + * to RGBA so that combo is allowed. + */ + if (is_color_format(format) + && !is_color_format(texImage->TexFormat->BaseFormat) + && !is_index_format(texImage->TexFormat->BaseFormat)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)"); + goto out; + } + else if (is_index_format(format) + && !is_index_format(texImage->TexFormat->BaseFormat)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)"); + goto out; + } + else if (is_depth_format(format) + && !is_depth_format(texImage->TexFormat->BaseFormat) + && !is_depthstencil_format(texImage->TexFormat->BaseFormat)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)"); + goto out; + } + else if (is_ycbcr_format(format) + && !is_ycbcr_format(texImage->TexFormat->BaseFormat)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)"); + goto out; + } + else if (is_depthstencil_format(format) + && !is_depthstencil_format(texImage->TexFormat->BaseFormat)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)"); + goto out; + } + + if (ctx->Pack.BufferObj->Name) { + /* packing texture image into a PBO */ + const GLuint dimensions = (target == GL_TEXTURE_3D) ? 3 : 2; + if (!_mesa_validate_pbo_access(dimensions, &ctx->Pack, texImage->Width, + texImage->Height, texImage->Depth, + format, type, pixels)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetTexImage(invalid PBO access)"); + goto out; + } } - } - /* typically, this will call _mesa_get_teximage() */ - ctx->Driver.GetTexImage(ctx, target, level, format, type, pixels, - texObj, texImage); + /* typically, this will call _mesa_get_teximage() */ + ctx->Driver.GetTexImage(ctx, target, level, format, type, pixels, + texObj, texImage); + + } + out: + _mesa_unlock_texture(ctx, texObj); } @@ -2301,40 +2299,47 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, return; /* error was recorded */ } - texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texObj = _mesa_select_tex_object(ctx, texUnit, target); - texImage = _mesa_get_tex_image(ctx, texUnit, target, level); - - if (!texImage) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D"); - return; - } - else if (texImage->Data) { - ctx->Driver.FreeTexImageData( ctx, texImage ); - } - ASSERT(texImage->Data == NULL); - clear_teximage_fields(texImage); /* not really needed, but helpful */ - _mesa_init_teximage_fields(ctx, target, texImage, - postConvWidth, 1, 1, - border, internalFormat); - if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) - _mesa_update_state(ctx); + _mesa_update_state(ctx); - ASSERT(ctx->Driver.TexImage1D); + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + _mesa_lock_texture(ctx, texObj); + { + texImage = _mesa_get_tex_image(ctx, texObj, target, level); + if (!texImage) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D"); + goto out; + } + + if (texImage->Data) { + ctx->Driver.FreeTexImageData( ctx, texImage ); + } - /* Give the texture to the driver! <pixels> may be null! */ - (*ctx->Driver.TexImage1D)(ctx, target, level, internalFormat, - width, border, format, type, pixels, - &ctx->Unpack, texObj, texImage); + ASSERT(texImage->Data == NULL); - ASSERT(texImage->TexFormat); + clear_teximage_fields(texImage); /* not really needed, but helpful */ + _mesa_init_teximage_fields(ctx, target, texImage, + postConvWidth, 1, 1, + border, internalFormat); + + ASSERT(ctx->Driver.TexImage1D); - update_fbo_texture(ctx, texObj, face, level); + /* Give the texture to the driver! <pixels> may be null! */ + (*ctx->Driver.TexImage1D)(ctx, target, level, internalFormat, + width, border, format, type, pixels, + &ctx->Unpack, texObj, texImage); + + ASSERT(texImage->TexFormat); - /* state update */ - texObj->Complete = GL_FALSE; - ctx->NewState |= _NEW_TEXTURE; + update_fbo_texture(ctx, texObj, face, level); + + /* state update */ + texObj->Complete = GL_FALSE; + ctx->NewState |= _NEW_TEXTURE; + } + out: + _mesa_unlock_texture(ctx, texObj); } else if (target == GL_PROXY_TEXTURE_1D) { /* Proxy texture: check for errors and update proxy state */ @@ -2396,39 +2401,46 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, return; /* error was recorded */ } - texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texObj = _mesa_select_tex_object(ctx, texUnit, target); - texImage = _mesa_get_tex_image(ctx, texUnit, target, level); - if (!texImage) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); - return; - } - else if (texImage->Data) { - ctx->Driver.FreeTexImageData( ctx, texImage ); - } - ASSERT(texImage->Data == NULL); - clear_teximage_fields(texImage); /* not really needed, but helpful */ - _mesa_init_teximage_fields(ctx, target, texImage, - postConvWidth, postConvHeight, 1, - border, internalFormat); - if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) - _mesa_update_state(ctx); - - ASSERT(ctx->Driver.TexImage2D); - - /* Give the texture to the driver! <pixels> may be null! */ - (*ctx->Driver.TexImage2D)(ctx, target, level, internalFormat, - width, height, border, format, type, pixels, - &ctx->Unpack, texObj, texImage); - - ASSERT(texImage->TexFormat); - - update_fbo_texture(ctx, texObj, face, level); + _mesa_update_state(ctx); - /* state update */ - texObj->Complete = GL_FALSE; - ctx->NewState |= _NEW_TEXTURE; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + _mesa_lock_texture(ctx, texObj); + { + texImage = _mesa_get_tex_image(ctx, texObj, target, level); + if (!texImage) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); + goto out; + } + + if (texImage->Data) { + ctx->Driver.FreeTexImageData( ctx, texImage ); + } + + ASSERT(texImage->Data == NULL); + clear_teximage_fields(texImage); /* not really needed, but helpful */ + _mesa_init_teximage_fields(ctx, target, texImage, + postConvWidth, postConvHeight, 1, + border, internalFormat); + + ASSERT(ctx->Driver.TexImage2D); + + /* Give the texture to the driver! <pixels> may be null! */ + (*ctx->Driver.TexImage2D)(ctx, target, level, internalFormat, + width, height, border, format, type, pixels, + &ctx->Unpack, texObj, texImage); + + ASSERT(texImage->TexFormat); + + update_fbo_texture(ctx, texObj, face, level); + + /* state update */ + texObj->Complete = GL_FALSE; + ctx->NewState |= _NEW_TEXTURE; + } + out: + _mesa_unlock_texture(ctx, texObj); } else if (target == GL_PROXY_TEXTURE_2D || (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB && @@ -2486,39 +2498,46 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat, return; /* error was recorded */ } + if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) + _mesa_update_state(ctx); + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); - texImage = _mesa_get_tex_image(ctx, texUnit, target, level); - if (!texImage) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D"); - return; - } - else if (texImage->Data) { - ctx->Driver.FreeTexImageData( ctx, texImage ); - } - ASSERT(texImage->Data == NULL); - clear_teximage_fields(texImage); /* not really needed, but helpful */ - _mesa_init_teximage_fields(ctx, target, texImage, - width, height, depth, - border, internalFormat); - - if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) - _mesa_update_state(ctx); + _mesa_lock_texture(ctx, texObj); + { + texImage = _mesa_get_tex_image(ctx, texObj, target, level); + if (!texImage) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D"); + goto out; + } + + if (texImage->Data) { + ctx->Driver.FreeTexImageData( ctx, texImage ); + } + + ASSERT(texImage->Data == NULL); + clear_teximage_fields(texImage); /* not really needed, but helpful */ + _mesa_init_teximage_fields(ctx, target, texImage, + width, height, depth, + border, internalFormat); - ASSERT(ctx->Driver.TexImage3D); + ASSERT(ctx->Driver.TexImage3D); - /* Give the texture to the driver! <pixels> may be null! */ - (*ctx->Driver.TexImage3D)(ctx, target, level, internalFormat, - width, height, depth, border, format, type, - pixels, &ctx->Unpack, texObj, texImage); + /* Give the texture to the driver! <pixels> may be null! */ + (*ctx->Driver.TexImage3D)(ctx, target, level, internalFormat, + width, height, depth, border, format, type, + pixels, &ctx->Unpack, texObj, texImage); - ASSERT(texImage->TexFormat); + ASSERT(texImage->TexFormat); - update_fbo_texture(ctx, texObj, face, level); + update_fbo_texture(ctx, texObj, face, level); - /* state update */ - texObj->Complete = GL_FALSE; - ctx->NewState |= _NEW_TEXTURE; + /* state update */ + texObj->Complete = GL_FALSE; + ctx->NewState |= _NEW_TEXTURE; + } + out: + _mesa_unlock_texture(ctx, texObj); } else if (target == GL_PROXY_TEXTURE_3D) { /* Proxy texture: check for errors and update proxy state */ @@ -2532,8 +2551,8 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat, } else { /* no error, set the tex image parameters */ - _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1, - border, internalFormat); + _mesa_init_teximage_fields(ctx, target, texImage, width, height, + depth, border, internalFormat); texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, internalFormat, format, type); } @@ -2566,7 +2585,7 @@ _mesa_TexSubImage1D( GLenum target, GLint level, GLsizei postConvWidth = width; struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; - struct gl_texture_image *texImage; + struct gl_texture_image *texImage = NULL; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); @@ -2579,26 +2598,38 @@ _mesa_TexSubImage1D( GLenum target, GLint level, } if (subtexture_error_check(ctx, 1, target, level, xoffset, 0, 0, - postConvWidth, 1, 1, format, type)) { + postConvWidth, 1, 1, format, type)) { return; /* error was detected */ } + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); - texImage = _mesa_select_tex_image(ctx, texUnit, target, level); - assert(texImage); + assert(texObj); - if (width == 0) - return; /* no-op, not an error */ + _mesa_lock_texture(ctx, texObj); + { + texImage = _mesa_select_tex_image(ctx, texObj, target, level); - /* If we have a border, xoffset=-1 is legal. Bias by border width */ - xoffset += texImage->Border; + if (subtexture_error_check2(ctx, 1, target, level, xoffset, 0, 0, + postConvWidth, 1, 1, format, type, texImage)) { + goto out; /* error was detected */ + } + + if (width == 0) + goto out; /* no-op, not an error */ + + /* If we have a border, xoffset=-1 is legal. Bias by border width */ + xoffset += texImage->Border; - ASSERT(ctx->Driver.TexSubImage1D); - (*ctx->Driver.TexSubImage1D)(ctx, target, level, xoffset, width, - format, type, pixels, &ctx->Unpack, - texObj, texImage); - ctx->NewState |= _NEW_TEXTURE; + ASSERT(ctx->Driver.TexSubImage1D); + (*ctx->Driver.TexSubImage1D)(ctx, target, level, xoffset, width, + format, type, pixels, &ctx->Unpack, + texObj, texImage); + ctx->NewState |= _NEW_TEXTURE; + } + out: + _mesa_unlock_texture(ctx, texObj); } @@ -2626,27 +2657,37 @@ _mesa_TexSubImage2D( GLenum target, GLint level, } if (subtexture_error_check(ctx, 2, target, level, xoffset, yoffset, 0, - postConvWidth, postConvHeight, 1, format, type)) { + postConvWidth, postConvHeight, 1, format, type)) { return; /* error was detected */ } texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); - texImage = _mesa_select_tex_image(ctx, texUnit, target, level); - assert(texImage); + _mesa_lock_texture(ctx, texObj); + { + texImage = _mesa_select_tex_image(ctx, texObj, target, level); - if (width == 0 || height == 0) - return; /* no-op, not an error */ + if (subtexture_error_check2(ctx, 2, target, level, xoffset, yoffset, 0, + postConvWidth, postConvHeight, 1, format, type, + texImage)) { + goto out; /* error was detected */ + } - /* If we have a border, xoffset=-1 is legal. Bias by border width */ - xoffset += texImage->Border; - yoffset += texImage->Border; + if (width == 0 || height == 0) + goto out; /* no-op, not an error */ - ASSERT(ctx->Driver.TexSubImage2D); - (*ctx->Driver.TexSubImage2D)(ctx, target, level, xoffset, yoffset, - width, height, format, type, pixels, - &ctx->Unpack, texObj, texImage); - ctx->NewState |= _NEW_TEXTURE; + /* If we have a border, xoffset=-1 is legal. Bias by border width */ + xoffset += texImage->Border; + yoffset += texImage->Border; + + ASSERT(ctx->Driver.TexSubImage2D); + (*ctx->Driver.TexSubImage2D)(ctx, target, level, xoffset, yoffset, + width, height, format, type, pixels, + &ctx->Unpack, texObj, texImage); + ctx->NewState |= _NEW_TEXTURE; + } + out: + _mesa_unlock_texture(ctx, texObj); } @@ -2674,24 +2715,34 @@ _mesa_TexSubImage3D( GLenum target, GLint level, texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); - texImage = _mesa_select_tex_image(ctx, texUnit, target, level); - assert(texImage); - - if (width == 0 || height == 0 || height == 0) - return; /* no-op, not an error */ - - /* If we have a border, xoffset=-1 is legal. Bias by border width */ - xoffset += texImage->Border; - yoffset += texImage->Border; - zoffset += texImage->Border; - - ASSERT(ctx->Driver.TexSubImage3D); - (*ctx->Driver.TexSubImage3D)(ctx, target, level, - xoffset, yoffset, zoffset, - width, height, depth, - format, type, pixels, - &ctx->Unpack, texObj, texImage ); - ctx->NewState |= _NEW_TEXTURE; + + _mesa_lock_texture(ctx, texObj); + { + texImage = _mesa_select_tex_image(ctx, texObj, target, level); + + if (subtexture_error_check2(ctx, 3, target, level, xoffset, yoffset, zoffset, + width, height, depth, format, type, texImage)) { + goto out; /* error was detected */ + } + + if (width == 0 || height == 0 || height == 0) + goto out; /* no-op, not an error */ + + /* If we have a border, xoffset=-1 is legal. Bias by border width */ + xoffset += texImage->Border; + yoffset += texImage->Border; + zoffset += texImage->Border; + + ASSERT(ctx->Driver.TexSubImage3D); + (*ctx->Driver.TexSubImage3D)(ctx, target, level, + xoffset, yoffset, zoffset, + width, height, depth, + format, type, pixels, + &ctx->Unpack, texObj, texImage ); + ctx->NewState |= _NEW_TEXTURE; + } + out: + _mesa_unlock_texture(ctx, texObj); } @@ -2723,32 +2774,39 @@ _mesa_CopyTexImage1D( GLenum target, GLint level, texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); - texImage = _mesa_get_tex_image(ctx, texUnit, target, level); - if (!texImage) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage1D"); - return; - } - else if (texImage->Data) { - ctx->Driver.FreeTexImageData( ctx, texImage ); - } - ASSERT(texImage->Data == NULL); + _mesa_lock_texture(ctx, texObj); + { + texImage = _mesa_get_tex_image(ctx, texObj, target, level); + if (!texImage) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage1D"); + goto out; + } - clear_teximage_fields(texImage); /* not really needed, but helpful */ - _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, 1, 1, - border, internalFormat); + if (texImage->Data) { + ctx->Driver.FreeTexImageData( ctx, texImage ); + } + + ASSERT(texImage->Data == NULL); + clear_teximage_fields(texImage); /* not really needed, but helpful */ + _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, 1, 1, + border, internalFormat); - ASSERT(ctx->Driver.CopyTexImage1D); - (*ctx->Driver.CopyTexImage1D)(ctx, target, level, internalFormat, - x, y, width, border); - ASSERT(texImage->TexFormat); + ASSERT(ctx->Driver.CopyTexImage1D); + (*ctx->Driver.CopyTexImage1D)(ctx, target, level, internalFormat, + x, y, width, border); - update_fbo_texture(ctx, texObj, face, level); + ASSERT(texImage->TexFormat); + + update_fbo_texture(ctx, texObj, face, level); - /* state update */ - texObj->Complete = GL_FALSE; - ctx->NewState |= _NEW_TEXTURE; + /* state update */ + texObj->Complete = GL_FALSE; + ctx->NewState |= _NEW_TEXTURE; + } + out: + _mesa_unlock_texture(ctx, texObj); } @@ -2780,41 +2838,50 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); - texImage = _mesa_get_tex_image(ctx, texUnit, target, level); - if (!texImage) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage2D"); - return; - } - else if (texImage->Data) { - ctx->Driver.FreeTexImageData( ctx, texImage ); - } - ASSERT(texImage->Data == NULL); - clear_teximage_fields(texImage); /* not really needed, but helpful */ - _mesa_init_teximage_fields(ctx, target, texImage, - postConvWidth, postConvHeight, 1, - border, internalFormat); + _mesa_lock_texture(ctx, texObj); + { + texImage = _mesa_get_tex_image(ctx, texObj, target, level); - ASSERT(ctx->Driver.CopyTexImage2D); - (*ctx->Driver.CopyTexImage2D)(ctx, target, level, internalFormat, - x, y, width, height, border); + if (!texImage) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage2D"); + goto out; + } + + if (texImage->Data) { + ctx->Driver.FreeTexImageData( ctx, texImage ); + } + + ASSERT(texImage->Data == NULL); - ASSERT(texImage->TexFormat); + clear_teximage_fields(texImage); /* not really needed, but helpful */ + _mesa_init_teximage_fields(ctx, target, texImage, + postConvWidth, postConvHeight, 1, + border, internalFormat); + + ASSERT(ctx->Driver.CopyTexImage2D); + (*ctx->Driver.CopyTexImage2D)(ctx, target, level, internalFormat, + x, y, width, height, border); + + ASSERT(texImage->TexFormat); - update_fbo_texture(ctx, texObj, face, level); + update_fbo_texture(ctx, texObj, face, level); - /* state update */ - texObj->Complete = GL_FALSE; - ctx->NewState |= _NEW_TEXTURE; + /* state update */ + texObj->Complete = GL_FALSE; + ctx->NewState |= _NEW_TEXTURE; + } + out: + _mesa_unlock_texture(ctx, texObj); } - void GLAPIENTRY _mesa_CopyTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ) { struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLsizei postConvWidth = width; GET_CURRENT_CONTEXT(ctx); @@ -2831,15 +2898,27 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level, return; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texImage = _mesa_select_tex_image(ctx, texUnit, target, level); - ASSERT(texImage); + texObj = _mesa_select_tex_object(ctx, texUnit, target); + + _mesa_lock_texture(ctx, texObj); + { + texImage = _mesa_select_tex_image(ctx, texObj, target, level); - /* If we have a border, xoffset=-1 is legal. Bias by border width */ - xoffset += texImage->Border; + if (copytexsubimage_error_check2(ctx, 1, target, level, + xoffset, 0, 0, postConvWidth, 1, + texImage)) + goto out; + - ASSERT(ctx->Driver.CopyTexSubImage1D); - (*ctx->Driver.CopyTexSubImage1D)(ctx, target, level, xoffset, x, y, width); - ctx->NewState |= _NEW_TEXTURE; + /* If we have a border, xoffset=-1 is legal. Bias by border width */ + xoffset += texImage->Border; + + ASSERT(ctx->Driver.CopyTexSubImage1D); + (*ctx->Driver.CopyTexSubImage1D)(ctx, target, level, xoffset, x, y, width); + ctx->NewState |= _NEW_TEXTURE; + } + out: + _mesa_unlock_texture(ctx, texObj); } @@ -2850,6 +2929,7 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level, GLint x, GLint y, GLsizei width, GLsizei height ) { struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLsizei postConvWidth = width, postConvHeight = height; GET_CURRENT_CONTEXT(ctx); @@ -2866,17 +2946,27 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level, return; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texImage = _mesa_select_tex_image(ctx, texUnit, target, level); - ASSERT(texImage); + texObj = _mesa_select_tex_object(ctx, texUnit, target); - /* If we have a border, xoffset=-1 is legal. Bias by border width */ - xoffset += texImage->Border; - yoffset += texImage->Border; + _mesa_lock_texture(ctx, texObj); + { + texImage = _mesa_select_tex_image(ctx, texObj, target, level); - ASSERT(ctx->Driver.CopyTexSubImage2D); - (*ctx->Driver.CopyTexSubImage2D)(ctx, target, level, - xoffset, yoffset, x, y, width, height); - ctx->NewState |= _NEW_TEXTURE; + if (copytexsubimage_error_check2(ctx, 2, target, level, xoffset, yoffset, 0, + postConvWidth, postConvHeight, texImage)) + goto out; + + /* If we have a border, xoffset=-1 is legal. Bias by border width */ + xoffset += texImage->Border; + yoffset += texImage->Border; + + ASSERT(ctx->Driver.CopyTexSubImage2D); + (*ctx->Driver.CopyTexSubImage2D)(ctx, target, level, + xoffset, yoffset, x, y, width, height); + ctx->NewState |= _NEW_TEXTURE; + } + out: + _mesa_unlock_texture(ctx, texObj); } @@ -2887,6 +2977,7 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, GLint x, GLint y, GLsizei width, GLsizei height ) { struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLsizei postConvWidth = width, postConvHeight = height; GET_CURRENT_CONTEXT(ctx); @@ -2903,19 +2994,30 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, return; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texImage = _mesa_select_tex_image(ctx, texUnit, target, level); - ASSERT(texImage); + texObj = _mesa_select_tex_object(ctx, texUnit, target); + + _mesa_lock_texture(ctx, texObj); + { + texImage = _mesa_select_tex_image(ctx, texObj, target, level); - /* If we have a border, xoffset=-1 is legal. Bias by border width */ - xoffset += texImage->Border; - yoffset += texImage->Border; - zoffset += texImage->Border; + if (copytexsubimage_error_check2(ctx, 3, target, level, xoffset, yoffset, + zoffset, postConvWidth, postConvHeight, + texImage)) + goto out; - ASSERT(ctx->Driver.CopyTexSubImage3D); - (*ctx->Driver.CopyTexSubImage3D)(ctx, target, level, - xoffset, yoffset, zoffset, - x, y, width, height); - ctx->NewState |= _NEW_TEXTURE; + /* If we have a border, xoffset=-1 is legal. Bias by border width */ + xoffset += texImage->Border; + yoffset += texImage->Border; + zoffset += texImage->Border; + + ASSERT(ctx->Driver.CopyTexSubImage3D); + (*ctx->Driver.CopyTexSubImage3D)(ctx, target, level, + xoffset, yoffset, zoffset, + x, y, width, height); + ctx->NewState |= _NEW_TEXTURE; + } + out: + _mesa_unlock_texture(ctx, texObj); } @@ -3136,28 +3238,35 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level, texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); - texImage = _mesa_get_tex_image(ctx, texUnit, target, level); - if (!texImage) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage1D"); - return; - } - else if (texImage->Data) { - ctx->Driver.FreeTexImageData( ctx, texImage ); - } - ASSERT(texImage->Data == NULL); - _mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1, - border, internalFormat); + _mesa_lock_texture(ctx, texObj); + { + texImage = _mesa_get_tex_image(ctx, texObj, target, level); + if (!texImage) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage1D"); + goto out; + } + + if (texImage->Data) { + ctx->Driver.FreeTexImageData( ctx, texImage ); + } + ASSERT(texImage->Data == NULL); - ASSERT(ctx->Driver.CompressedTexImage1D); - (*ctx->Driver.CompressedTexImage1D)(ctx, target, level, - internalFormat, width, border, - imageSize, data, - texObj, texImage); + _mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1, + border, internalFormat); - /* state update */ - texObj->Complete = GL_FALSE; - ctx->NewState |= _NEW_TEXTURE; + ASSERT(ctx->Driver.CompressedTexImage1D); + (*ctx->Driver.CompressedTexImage1D)(ctx, target, level, + internalFormat, width, border, + imageSize, data, + texObj, texImage); + + /* state update */ + texObj->Complete = GL_FALSE; + ctx->NewState |= _NEW_TEXTURE; + } + out: + _mesa_unlock_texture(ctx, texObj); } else if (target == GL_PROXY_TEXTURE_1D) { /* Proxy texture: check for errors and update proxy state */ @@ -3179,11 +3288,18 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level, else { /* store the teximage parameters */ struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; struct gl_texture_image *texImage; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texImage = _mesa_select_tex_image(ctx, texUnit, target, level); - _mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1, - border, internalFormat); + texObj = _mesa_select_tex_object(ctx, texUnit, target); + + _mesa_lock_texture(ctx, texObj); + { + texImage = _mesa_select_tex_image(ctx, texObj, target, level); + _mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1, + border, internalFormat); + } + _mesa_unlock_texture(ctx, texObj); } } else { @@ -3219,28 +3335,35 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level, texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); - texImage = _mesa_get_tex_image(ctx, texUnit, target, level); - if (!texImage) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D"); - return; - } - else if (texImage->Data) { - ctx->Driver.FreeTexImageData( ctx, texImage ); - } - ASSERT(texImage->Data == NULL); - _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1, - border, internalFormat); + _mesa_lock_texture(ctx, texObj); + { + texImage = _mesa_get_tex_image(ctx, texObj, target, level); + if (!texImage) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D"); + goto out; + } + + if (texImage->Data) { + ctx->Driver.FreeTexImageData( ctx, texImage ); + } + ASSERT(texImage->Data == NULL); - ASSERT(ctx->Driver.CompressedTexImage2D); - (*ctx->Driver.CompressedTexImage2D)(ctx, target, level, - internalFormat, width, height, - border, imageSize, data, - texObj, texImage); + _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1, + border, internalFormat); - /* state update */ - texObj->Complete = GL_FALSE; - ctx->NewState |= _NEW_TEXTURE; + ASSERT(ctx->Driver.CompressedTexImage2D); + (*ctx->Driver.CompressedTexImage2D)(ctx, target, level, + internalFormat, width, height, + border, imageSize, data, + texObj, texImage); + + /* state update */ + texObj->Complete = GL_FALSE; + ctx->NewState |= _NEW_TEXTURE; + } + out: + _mesa_unlock_texture(ctx, texObj); } else if (target == GL_PROXY_TEXTURE_2D || (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB && @@ -3264,11 +3387,18 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level, else { /* store the teximage parameters */ struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; struct gl_texture_image *texImage; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texImage = _mesa_select_tex_image(ctx, texUnit, target, level); - _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1, - border, internalFormat); + texObj = _mesa_select_tex_object(ctx, texUnit, target); + + _mesa_lock_texture(ctx, texObj); + { + texImage = _mesa_select_tex_image(ctx, texObj, target, level); + _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1, + border, internalFormat); + } + _mesa_unlock_texture(ctx, texObj); } } else { @@ -3301,29 +3431,35 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level, texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); - texImage = _mesa_get_tex_image(ctx, texUnit, target, level); - if (!texImage) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage3D"); - return; - } - else if (texImage->Data) { - ctx->Driver.FreeTexImageData( ctx, texImage ); - } - ASSERT(texImage->Data == NULL); - - _mesa_init_teximage_fields(ctx, target, texImage, width, height, depth, - border, internalFormat); + _mesa_lock_texture(ctx, texObj); + { + texImage = _mesa_get_tex_image(ctx, texObj, target, level); + if (!texImage) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage3D"); + goto out; + } + + if (texImage->Data) { + ctx->Driver.FreeTexImageData( ctx, texImage ); + } + ASSERT(texImage->Data == NULL); - ASSERT(ctx->Driver.CompressedTexImage3D); - (*ctx->Driver.CompressedTexImage3D)(ctx, target, level, - internalFormat, - width, height, depth, - border, imageSize, data, - texObj, texImage); + _mesa_init_teximage_fields(ctx, target, texImage, width, height, depth, + border, internalFormat); - /* state update */ - texObj->Complete = GL_FALSE; - ctx->NewState |= _NEW_TEXTURE; + ASSERT(ctx->Driver.CompressedTexImage3D); + (*ctx->Driver.CompressedTexImage3D)(ctx, target, level, + internalFormat, + width, height, depth, + border, imageSize, data, + texObj, texImage); + + /* state update */ + texObj->Complete = GL_FALSE; + ctx->NewState |= _NEW_TEXTURE; + } + out: + _mesa_unlock_texture(ctx, texObj); } else if (target == GL_PROXY_TEXTURE_3D) { /* Proxy texture: check for errors and update proxy state */ @@ -3345,11 +3481,17 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level, else { /* store the teximage parameters */ struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; struct gl_texture_image *texImage; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texImage = _mesa_select_tex_image(ctx, texUnit, target, level); - _mesa_init_teximage_fields(ctx, target, texImage, width, height, - depth, border, internalFormat); + texObj = _mesa_select_tex_object(ctx, texUnit, target); + _mesa_lock_texture(ctx, texObj); + { + texImage = _mesa_select_tex_image(ctx, texObj, target, level); + _mesa_init_teximage_fields(ctx, target, texImage, width, height, + depth, border, internalFormat); + } + _mesa_unlock_texture(ctx, texObj); } } else { @@ -3382,30 +3524,35 @@ _mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); - texImage = _mesa_select_tex_image(ctx, texUnit, target, level); - assert(texImage); + _mesa_lock_texture(ctx, texObj); + { + texImage = _mesa_select_tex_image(ctx, texObj, target, level); + assert(texImage); - if ((GLint) format != texImage->InternalFormat) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glCompressedTexSubImage1D(format)"); - return; - } + if ((GLint) format != texImage->InternalFormat) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCompressedTexSubImage1D(format)"); + goto out; + } - if ((width == 1 || width == 2) && (GLuint) width != texImage->Width) { - _mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexSubImage1D(width)"); - return; - } + if ((width == 1 || width == 2) && (GLuint) width != texImage->Width) { + _mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexSubImage1D(width)"); + goto out; + } - if (width == 0) - return; /* no-op, not an error */ + if (width == 0) + goto out; /* no-op, not an error */ - if (ctx->Driver.CompressedTexSubImage1D) { - (*ctx->Driver.CompressedTexSubImage1D)(ctx, target, level, - xoffset, width, - format, imageSize, data, - texObj, texImage); + if (ctx->Driver.CompressedTexSubImage1D) { + (*ctx->Driver.CompressedTexSubImage1D)(ctx, target, level, + xoffset, width, + format, imageSize, data, + texObj, texImage); + } + ctx->NewState |= _NEW_TEXTURE; } - ctx->NewState |= _NEW_TEXTURE; + out: + _mesa_unlock_texture(ctx, texObj); } @@ -3434,31 +3581,36 @@ _mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); - texImage = _mesa_select_tex_image(ctx, texUnit, target, level); - assert(texImage); + _mesa_lock_texture(ctx, texObj); + { + texImage = _mesa_select_tex_image(ctx, texObj, target, level); + assert(texImage); - if ((GLint) format != texImage->InternalFormat) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glCompressedTexSubImage2D(format)"); - return; - } + if ((GLint) format != texImage->InternalFormat) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCompressedTexSubImage2D(format)"); + goto out; + } - if (((width == 1 || width == 2) && (GLuint) width != texImage->Width) || - ((height == 1 || height == 2) && (GLuint) height != texImage->Height)) { - _mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexSubImage2D(size)"); - return; - } + if (((width == 1 || width == 2) && (GLuint) width != texImage->Width) || + ((height == 1 || height == 2) && (GLuint) height != texImage->Height)) { + _mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexSubImage2D(size)"); + goto out; + } - if (width == 0 || height == 0) - return; /* no-op, not an error */ + if (width == 0 || height == 0) + goto out; /* no-op, not an error */ - if (ctx->Driver.CompressedTexSubImage2D) { - (*ctx->Driver.CompressedTexSubImage2D)(ctx, target, level, - xoffset, yoffset, width, height, - format, imageSize, data, - texObj, texImage); + if (ctx->Driver.CompressedTexSubImage2D) { + (*ctx->Driver.CompressedTexSubImage2D)(ctx, target, level, + xoffset, yoffset, width, height, + format, imageSize, data, + texObj, texImage); + } + ctx->NewState |= _NEW_TEXTURE; } - ctx->NewState |= _NEW_TEXTURE; + out: + _mesa_unlock_texture(ctx, texObj); } @@ -3486,33 +3638,38 @@ _mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); - texImage = _mesa_select_tex_image(ctx, texUnit, target, level); - assert(texImage); + _mesa_lock_texture(ctx, texObj); + { + texImage = _mesa_select_tex_image(ctx, texObj, target, level); + assert(texImage); - if ((GLint) format != texImage->InternalFormat) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glCompressedTexSubImage3D(format)"); - return; - } + if ((GLint) format != texImage->InternalFormat) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCompressedTexSubImage3D(format)"); + goto out; + } - if (((width == 1 || width == 2) && (GLuint) width != texImage->Width) || - ((height == 1 || height == 2) && (GLuint) height != texImage->Height) || - ((depth == 1 || depth == 2) && (GLuint) depth != texImage->Depth)) { - _mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexSubImage3D(size)"); - return; - } + if (((width == 1 || width == 2) && (GLuint) width != texImage->Width) || + ((height == 1 || height == 2) && (GLuint) height != texImage->Height) || + ((depth == 1 || depth == 2) && (GLuint) depth != texImage->Depth)) { + _mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexSubImage3D(size)"); + goto out; + } - if (width == 0 || height == 0 || depth == 0) - return; /* no-op, not an error */ + if (width == 0 || height == 0 || depth == 0) + goto out; /* no-op, not an error */ - if (ctx->Driver.CompressedTexSubImage3D) { - (*ctx->Driver.CompressedTexSubImage3D)(ctx, target, level, - xoffset, yoffset, zoffset, - width, height, depth, - format, imageSize, data, - texObj, texImage); + if (ctx->Driver.CompressedTexSubImage3D) { + (*ctx->Driver.CompressedTexSubImage3D)(ctx, target, level, + xoffset, yoffset, zoffset, + width, height, depth, + format, imageSize, data, + texObj, texImage); + } + ctx->NewState |= _NEW_TEXTURE; } - ctx->NewState |= _NEW_TEXTURE; + out: + _mesa_unlock_texture(ctx, texObj); } @@ -3520,12 +3677,13 @@ void GLAPIENTRY _mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img) { const struct gl_texture_unit *texUnit; - const struct gl_texture_object *texObj; + struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLint maxLevels; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); if (!texObj) { @@ -3546,18 +3704,24 @@ _mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img) return; } - texImage = _mesa_select_tex_image(ctx, texUnit, target, level); - if (!texImage) { - /* probably invalid mipmap level */ - _mesa_error(ctx, GL_INVALID_VALUE, "glGetCompressedTexImageARB(level)"); - return; - } - if (!texImage->IsCompressed) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetCompressedTexImageARB"); - return; - } + _mesa_lock_texture(ctx, texObj); + { + texImage = _mesa_select_tex_image(ctx, texObj, target, level); + if (!texImage) { + /* probably invalid mipmap level */ + _mesa_error(ctx, GL_INVALID_VALUE, "glGetCompressedTexImageARB(level)"); + goto out; + } - /* this typically calls _mesa_get_compressed_teximage() */ - ctx->Driver.GetCompressedTexImage(ctx, target, level, img, texObj,texImage); + if (!texImage->IsCompressed) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetCompressedTexImageARB"); + goto out; + } + + /* this typically calls _mesa_get_compressed_teximage() */ + ctx->Driver.GetCompressedTexImage(ctx, target, level, img, texObj,texImage); + } + out: + _mesa_unlock_texture(ctx, texObj); } diff --git a/dist/Mesa/src/mesa/main/texobj.c b/dist/Mesa/src/mesa/main/texobj.c index 7b36154a5..f385f8112 100644 --- a/dist/Mesa/src/mesa/main/texobj.c +++ b/dist/Mesa/src/mesa/main/texobj.c @@ -854,7 +854,8 @@ _mesa_BindTexture( GLenum target, GLuint texName ) newTexObj = ctx->Shared->DefaultRect; break; default: - ; /* Bad targets are caught above */ + _mesa_error(ctx, GL_INVALID_ENUM, "glBindTexture(target)"); + return; } } else { @@ -926,6 +927,7 @@ _mesa_BindTexture( GLenum target, GLuint texName ) _mesa_reference_texobj(&texUnit->CurrentRect, newTexObj); break; default: + /* Bad target should be caught above */ _mesa_problem(ctx, "bad target in BindTexture"); return; } diff --git a/dist/Mesa/src/mesa/main/texstore.c b/dist/Mesa/src/mesa/main/texstore.c index 7471934b4..2ac458b45 100644 --- a/dist/Mesa/src/mesa/main/texstore.c +++ b/dist/Mesa/src/mesa/main/texstore.c @@ -27,7 +27,7 @@ * Brian Paul */ -/* +/** * The GL texture image functions in teximage.c basically just do * error checking and data structure allocation. They in turn call * device driver functions which actually copy/convert/store the user's @@ -58,16 +58,27 @@ #include "convolve.h" #include "image.h" #include "macros.h" +#include "mipmap.h" #include "imports.h" #include "texcompress.h" #include "texformat.h" #include "teximage.h" #include "texstore.h" +#include "enums.h" -static const GLint ZERO = 4, ONE = 5; +enum { + ZERO = 4, + ONE = 5 +}; -static GLboolean can_swizzle(GLenum logicalBaseFormat) + +/** + * Return GL_TRUE if the given image format is one that be converted + * to another format by swizzling. + */ +static GLboolean +can_swizzle(GLenum logicalBaseFormat) { switch (logicalBaseFormat) { case GL_RGBA: @@ -76,6 +87,12 @@ static GLboolean can_swizzle(GLenum logicalBaseFormat) case GL_INTENSITY: case GL_ALPHA: case GL_LUMINANCE: + case GL_RED: + case GL_GREEN: + case GL_BLUE: + case GL_BGR: + case GL_BGRA: + case GL_ABGR_EXT: return GL_TRUE; default: return GL_FALSE; @@ -83,89 +100,172 @@ static GLboolean can_swizzle(GLenum logicalBaseFormat) } + +enum { + IDX_LUMINANCE = 0, + IDX_ALPHA, + IDX_INTENSITY, + IDX_LUMINANCE_ALPHA, + IDX_RGB, + IDX_RGBA, + IDX_RED, + IDX_GREEN, + IDX_BLUE, + IDX_BGR, + IDX_BGRA, + IDX_ABGR, + MAX_IDX +}; + +#define MAP1(x) MAP4(x, ZERO, ZERO, ZERO) +#define MAP2(x,y) MAP4(x, y, ZERO, ZERO) +#define MAP3(x,y,z) MAP4(x, y, z, ZERO) +#define MAP4(x,y,z,w) { x, y, z, w, ZERO, ONE } + + +static const struct { + GLubyte format_idx; + GLubyte to_rgba[6]; + GLubyte from_rgba[6]; +} mappings[MAX_IDX] = +{ + { + IDX_LUMINANCE, + MAP4(0,0,0,ONE), + MAP1(0) + }, + + { + IDX_ALPHA, + MAP4(ZERO, ZERO, ZERO, 0), + MAP1(3) + }, + + { + IDX_INTENSITY, + MAP4(0, 0, 0, 0), + MAP1(0), + }, + + { + IDX_LUMINANCE_ALPHA, + MAP4(0,0,0,1), + MAP2(0,3) + }, + + { + IDX_RGB, + MAP4(0,1,2,ONE), + MAP3(0,1,2) + }, + + { + IDX_RGBA, + MAP4(0,1,2,3), + MAP4(0,1,2,3), + }, + + + { + IDX_RED, + MAP4(0, ZERO, ZERO, ONE), + MAP1(0), + }, + + { + IDX_GREEN, + MAP4(ZERO, 0, ZERO, ONE), + MAP1(1), + }, + + { + IDX_BLUE, + MAP4(ZERO, ZERO, 0, ONE), + MAP1(2), + }, + + { + IDX_BGR, + MAP4(2,1,0,ONE), + MAP3(2,1,0) + }, + + { + IDX_BGRA, + MAP4(2,1,0,3), + MAP4(2,1,0,3) + }, + + { + IDX_ABGR, + MAP4(3,2,1,0), + MAP4(3,2,1,0) + }, +}; + + + +/** + * Convert a GL image format enum to an IDX_* value (see above). + */ +static int +get_map_idx(GLenum value) +{ + switch (value) { + case GL_LUMINANCE: return IDX_LUMINANCE; + case GL_ALPHA: return IDX_ALPHA; + case GL_INTENSITY: return IDX_INTENSITY; + case GL_LUMINANCE_ALPHA: return IDX_LUMINANCE_ALPHA; + case GL_RGB: return IDX_RGB; + case GL_RGBA: return IDX_RGBA; + case GL_RED: return IDX_RED; + case GL_GREEN: return IDX_GREEN; + case GL_BLUE: return IDX_BLUE; + case GL_BGR: return IDX_BGR; + case GL_BGRA: return IDX_BGRA; + case GL_ABGR_EXT: return IDX_ABGR; + default: + _mesa_problem(NULL, "Unexpected inFormat"); + return 0; + } +} + + /** * When promoting texture formats (see below) we need to compute the * mapping of dest components back to source components. * This function does that. - * \param logicalBaseFormat the logical format of the texture - * \param textureBaseFormat the final texture format - * \return map[4] the four mapping values + * \param inFormat the incoming format of the texture + * \param outFormat the final texture format + * \return map[6] a full 6-component map */ static void -compute_component_mapping(GLenum logicalBaseFormat, GLenum textureBaseFormat, - GLubyte map[6]) +compute_component_mapping(GLenum inFormat, GLenum outFormat, + GLubyte *map) { + const int inFmt = get_map_idx(inFormat); + const int outFmt = get_map_idx(outFormat); + const GLubyte *in2rgba = mappings[inFmt].to_rgba; + const GLubyte *rgba2out = mappings[outFmt].from_rgba; + int i; + + for (i = 0; i < 4; i++) + map[i] = in2rgba[rgba2out[i]]; + map[ZERO] = ZERO; - map[ONE] = ONE; + map[ONE] = ONE; - /* compute mapping from dest components back to src components */ - switch (textureBaseFormat) { - case GL_RGB: - case GL_RGBA: - switch (logicalBaseFormat) { - case GL_LUMINANCE: - map[0] = map[1] = map[2] = 0; - if (textureBaseFormat == GL_RGBA) - map[3] = ONE; - break; - case GL_ALPHA: - ASSERT(textureBaseFormat == GL_RGBA); - map[0] = map[1] = map[2] = ZERO; - map[3] = 0; - break; - case GL_INTENSITY: - map[0] = map[1] = map[2] = 0; - if (textureBaseFormat == GL_RGBA) - map[3] = 0; - break; - case GL_LUMINANCE_ALPHA: - ASSERT(textureBaseFormat == GL_RGBA); - map[0] = map[1] = map[2] = 0; - map[3] = 1; - break; - case GL_RGB: - ASSERT(textureBaseFormat == GL_RGBA); - map[0] = 0; - map[1] = 1; - map[2] = 2; - map[3] = ONE; - break; - case GL_RGBA: - ASSERT(textureBaseFormat == GL_RGBA); - map[0] = 0; - map[1] = 1; - map[2] = 2; - map[3] = 3; - break; - default: - _mesa_problem(NULL, "Unexpected logicalBaseFormat"); - map[0] = map[1] = map[2] = map[3] = 0; - } - break; - case GL_LUMINANCE_ALPHA: - switch (logicalBaseFormat) { - case GL_LUMINANCE: - map[0] = 0; - map[1] = ONE; - break; - case GL_ALPHA: - map[0] = ZERO; - map[1] = 0; - break; - case GL_INTENSITY: - map[0] = 0; - map[1] = 0; - break; - default: - _mesa_problem(NULL, "Unexpected logicalBaseFormat"); - map[0] = map[1] = 0; - } - break; - default: - _mesa_problem(NULL, "Unexpected textureBaseFormat"); - map[0] = map[1] = 0; - break; - } +/* + _mesa_printf("from %x/%s to %x/%s map %d %d %d %d %d %d\n", + inFormat, _mesa_lookup_enum_by_nr(inFormat), + outFormat, _mesa_lookup_enum_by_nr(outFormat), + map[0], + map[1], + map[2], + map[3], + map[4], + map[5]); +*/ } @@ -298,7 +398,7 @@ make_temp_float_image(GLcontext *ctx, GLuint dims, GLfloat *dst = tempImage + img * (convWidth * convHeight * 4); for (row = 0; row < convHeight; row++) { _mesa_pack_rgba_span_float(ctx, convWidth, - (const GLfloat (*)[4]) src, + (GLfloat (*)[4]) src, logicalBaseFormat, GL_FLOAT, dst, &ctx->DefaultPacking, postConvTransferOps); @@ -552,14 +652,16 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims, * \param dstComponents number of color components in destination pixels * \param src source pixels * \param srcComponents number of color components in source pixels - * \param map the swizzle mapping + * \param map the swizzle mapping. map[X] says where to find the X component + * in the source image's pixels. For example, if the source image + * is GL_BGRA and X = red, map[0] yields 2. * \param count number of pixels to copy/swizzle. */ static void swizzle_copy(GLubyte *dst, GLuint dstComponents, const GLubyte *src, GLuint srcComponents, const GLubyte *map, GLuint count) { - GLubyte tmp[8]; + GLubyte tmp[6]; GLuint i; tmp[ZERO] = 0x0; @@ -596,10 +698,61 @@ swizzle_copy(GLubyte *dst, GLuint dstComponents, const GLubyte *src, dst += 2; } break; + case 1: + /* XXX investigate valgrind invalid read when running demos/texenv.c */ + for (i = 0; i < count; i++) { + COPY_4UBV(tmp, src); + src += srcComponents; + dst[0] = tmp[map[0]]; + dst += 1; + } + break; } } +static const GLubyte map_identity[6] = { 0, 1, 2, 3, ZERO, ONE }; +static const GLubyte map_3210[6] = { 3, 2, 1, 0, ZERO, ONE }; + +/* Deal with the _REV input types: + */ +static const GLubyte * +type_mapping( GLenum srcType ) +{ + switch (srcType) { + case GL_UNSIGNED_BYTE: + return map_identity; + case GL_UNSIGNED_INT_8_8_8_8: + return _mesa_little_endian() ? map_3210 : map_identity; + case GL_UNSIGNED_INT_8_8_8_8_REV: + return _mesa_little_endian() ? map_identity : map_3210; + default: + return NULL; + } +} + +/* Mapping required if input type is + */ +static const GLubyte * +byteswap_mapping( GLboolean swapBytes, + GLenum srcType ) +{ + if (!swapBytes) + return map_identity; + + switch (srcType) { + case GL_UNSIGNED_BYTE: + return map_identity; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + return map_3210; + default: + return NULL; + } +} + + + /** * Transfer a GLubyte texture image with component swizzling. */ @@ -607,7 +760,12 @@ static void _mesa_swizzle_ubyte_image(GLcontext *ctx, GLuint dimensions, GLenum srcFormat, - const GLubyte *dstmap, GLint dstComponents, + GLenum srcType, + + GLenum baseInternalFormat, + + const GLubyte *rgba2dst, + GLuint dstComponents, GLvoid *dstAddr, GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, @@ -619,9 +777,9 @@ _mesa_swizzle_ubyte_image(GLcontext *ctx, const struct gl_pixelstore_attrib *srcPacking ) { GLint srcComponents = _mesa_components_in_format(srcFormat); - GLubyte srcmap[6], map[4]; + const GLubyte *srctype2ubyte, *swap; + GLubyte map[4], src2base[6], base2rgba[6]; GLint i; - const GLint srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, GL_UNSIGNED_BYTE); @@ -635,12 +793,24 @@ _mesa_swizzle_ubyte_image(GLcontext *ctx, (void) ctx; - compute_component_mapping(srcFormat, GL_RGBA, srcmap); + /* Translate from src->baseInternal->GL_RGBA->dst. This will + * correctly deal with RGBA->RGB->RGBA conversions where the final + * A value must be 0xff regardless of the incoming alpha values. + */ + compute_component_mapping(srcFormat, baseInternalFormat, src2base); + compute_component_mapping(baseInternalFormat, GL_RGBA, base2rgba); + swap = byteswap_mapping(srcPacking->SwapBytes, srcType); + srctype2ubyte = type_mapping(srcType); + for (i = 0; i < 4; i++) - map[i] = srcmap[dstmap[i]]; + map[i] = srctype2ubyte[swap[src2base[base2rgba[rgba2dst[i]]]]]; - if (srcRowStride == srcWidth * srcComponents && +/* _mesa_printf("map %d %d %d %d\n", map[0], map[1], map[2], map[3]); */ + + if (srcRowStride == dstRowStride && + srcComponents == dstComponents && + srcRowStride == srcWidth * srcComponents && dimensions < 3) { /* 1 and 2D images only */ GLubyte *dstImage = (GLubyte *) dstAddr @@ -817,6 +987,58 @@ _mesa_texstore_rgba(TEXSTORE_PARAMS) } } } + else if (!ctx->_ImageTransferState && + CHAN_TYPE == GL_UNSIGNED_BYTE && + (srcType == GL_UNSIGNED_BYTE || + srcType == GL_UNSIGNED_INT_8_8_8_8 || + srcType == GL_UNSIGNED_INT_8_8_8_8_REV) && + can_swizzle(baseInternalFormat) && + can_swizzle(srcFormat)) { + + const GLubyte *dstmap; + GLuint components; + + /* dstmap - how to swizzle from RGBA to dst format: + */ + if (dstFormat == &_mesa_texformat_rgba) { + dstmap = mappings[IDX_RGBA].from_rgba; + components = 4; + } + else if (dstFormat == &_mesa_texformat_rgb) { + dstmap = mappings[IDX_RGB].from_rgba; + components = 3; + } + else if (dstFormat == &_mesa_texformat_alpha) { + dstmap = mappings[IDX_ALPHA].from_rgba; + components = 1; + } + else if (dstFormat == &_mesa_texformat_luminance) { + dstmap = mappings[IDX_LUMINANCE].from_rgba; + components = 1; + } + else if (dstFormat == &_mesa_texformat_luminance_alpha) { + dstmap = mappings[IDX_LUMINANCE_ALPHA].from_rgba; + components = 2; + } + else if (dstFormat == &_mesa_texformat_intensity) { + dstmap = mappings[IDX_INTENSITY].from_rgba; + components = 1; + } + else { + _mesa_problem(ctx, "Unexpected dstFormat in _mesa_texstore_rgba"); + return GL_FALSE; + } + + _mesa_swizzle_ubyte_image(ctx, dims, + srcFormat, + srcType, + baseInternalFormat, + dstmap, components, + dstAddr, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstImageOffsets, + srcWidth, srcHeight, srcDepth, srcAddr, + srcPacking); + } else { /* general path */ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, @@ -1050,13 +1272,14 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS) } +/** + * Store a texture in MESA_FORMAT_RGBA8888 or MESA_FORMAT_RGBA8888_REV. + */ GLboolean _mesa_texstore_rgba8888(TEXSTORE_PARAMS) { - const GLuint ui = 1; - const GLubyte littleEndian = *((const GLubyte *) &ui); + const GLboolean littleEndian = _mesa_little_endian(); - (void)littleEndian; ASSERT(dstFormat == &_mesa_texformat_rgba8888 || dstFormat == &_mesa_texformat_rgba8888_rev); ASSERT(dstFormat->TexelBytes == 4); @@ -1093,40 +1316,41 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS) srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } -#if 0 - /* broken? */ else if (!ctx->_ImageTransferState && - !srcPacking->SwapBytes && - srcType == GL_UNSIGNED_BYTE && - dstFormat == &_mesa_texformat_rgba8888 && - littleEndian && - /* Three texture formats involved: srcFormat, - * baseInternalFormat and destFormat (GL_RGBA). Only two - * may differ. _mesa_swizzle_ubyte_image can't handle two - * propagations at once correctly. */ - (srcFormat == baseInternalFormat || - baseInternalFormat == GL_RGBA) && + (srcType == GL_UNSIGNED_BYTE || + srcType == GL_UNSIGNED_INT_8_8_8_8 || + srcType == GL_UNSIGNED_INT_8_8_8_8_REV) && + can_swizzle(baseInternalFormat) && can_swizzle(srcFormat)) { + GLubyte dstmap[4]; - /* dstmap - how to swizzle from GL_RGBA to dst format: - * - * FIXME - add !litteEndian and _rev varients: + /* dstmap - how to swizzle from RGBA to dst format: */ - dstmap[3] = 0; - dstmap[2] = 1; - dstmap[1] = 2; - dstmap[0] = 3; + if ((littleEndian && dstFormat == &_mesa_texformat_rgba8888) || + (!littleEndian && dstFormat == &_mesa_texformat_rgba8888_rev)) { + dstmap[3] = 0; + dstmap[2] = 1; + dstmap[1] = 2; + dstmap[0] = 3; + } + else { + dstmap[3] = 3; + dstmap[2] = 2; + dstmap[1] = 1; + dstmap[0] = 0; + } _mesa_swizzle_ubyte_image(ctx, dims, srcFormat, + srcType, + baseInternalFormat, dstmap, 4, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, dstImageStride, + dstRowStride, dstImageOffsets, srcWidth, srcHeight, srcDepth, srcAddr, srcPacking); } -#endif else { /* general path */ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, @@ -1177,8 +1401,7 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS) GLboolean _mesa_texstore_argb8888(TEXSTORE_PARAMS) { - const GLuint ui = 1; - const GLubyte littleEndian = *((const GLubyte *) &ui); + const GLboolean littleEndian = _mesa_little_endian(); ASSERT(dstFormat == &_mesa_texformat_argb8888 || dstFormat == &_mesa_texformat_argb8888_rev); @@ -1218,6 +1441,8 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) !srcPacking->SwapBytes && dstFormat == &_mesa_texformat_argb8888 && srcFormat == GL_RGB && + (baseInternalFormat == GL_RGBA || + baseInternalFormat == GL_RGB) && srcType == GL_UNSIGNED_BYTE) { int img, row, col; @@ -1246,6 +1471,7 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) !srcPacking->SwapBytes && dstFormat == &_mesa_texformat_argb8888 && srcFormat == GL_RGBA && + baseInternalFormat == GL_RGBA && (srcType == GL_UNSIGNED_BYTE && littleEndian)) { GLint img, row, col; /* For some reason, streaming copies to write-combined regions @@ -1280,6 +1506,7 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) !srcPacking->SwapBytes && dstFormat == &_mesa_texformat_argb8888 && srcFormat == GL_RGBA && + baseInternalFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE) { GLint img, row, col; @@ -1305,29 +1532,37 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) } } else if (!ctx->_ImageTransferState && - !srcPacking->SwapBytes && - dstFormat == &_mesa_texformat_argb8888 && - srcType == GL_UNSIGNED_BYTE && - littleEndian && - /* Three texture formats involved: srcFormat, - * baseInternalFormat and destFormat (GL_RGBA). Only two - * may differ. _mesa_swizzle_ubyte_image can't handle two - * propagations at once correctly. */ - (srcFormat == baseInternalFormat || - baseInternalFormat == GL_RGBA) && + (srcType == GL_UNSIGNED_BYTE || + srcType == GL_UNSIGNED_INT_8_8_8_8 || + srcType == GL_UNSIGNED_INT_8_8_8_8_REV) && + can_swizzle(baseInternalFormat) && can_swizzle(srcFormat)) { GLubyte dstmap[4]; - /* dstmap - how to swizzle from GL_RGBA to dst format: + /* dstmap - how to swizzle from RGBA to dst format: */ - dstmap[3] = 3; /* alpha */ - dstmap[2] = 0; /* red */ - dstmap[1] = 1; /* green */ - dstmap[0] = 2; /* blue */ + if ((littleEndian && dstFormat == &_mesa_texformat_argb8888) || + (!littleEndian && dstFormat == &_mesa_texformat_argb8888_rev)) { + dstmap[3] = 3; /* alpha */ + dstmap[2] = 0; /* red */ + dstmap[1] = 1; /* green */ + dstmap[0] = 2; /* blue */ + } + else { + assert((littleEndian && dstFormat == &_mesa_texformat_argb8888_rev) || + (!littleEndian && dstFormat == &_mesa_texformat_argb8888)); + dstmap[3] = 2; + dstmap[2] = 1; + dstmap[1] = 0; + dstmap[0] = 3; + } _mesa_swizzle_ubyte_image(ctx, dims, srcFormat, + srcType, + + baseInternalFormat, dstmap, 4, dstAddr, dstXoffset, dstYoffset, dstZoffset, dstRowStride, @@ -1385,8 +1620,7 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) GLboolean _mesa_texstore_rgb888(TEXSTORE_PARAMS) { - const GLuint ui = 1; - const GLubyte littleEndian = *((const GLubyte *) &ui); + const GLboolean littleEndian = _mesa_little_endian(); ASSERT(dstFormat == &_mesa_texformat_rgb888); ASSERT(dstFormat->TexelBytes == 3); @@ -1431,6 +1665,30 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS) } } } + else if (!ctx->_ImageTransferState && + srcType == GL_UNSIGNED_BYTE && + can_swizzle(baseInternalFormat) && + can_swizzle(srcFormat)) { + + GLubyte dstmap[4]; + + /* dstmap - how to swizzle from RGBA to dst format: + */ + dstmap[0] = 2; + dstmap[1] = 1; + dstmap[2] = 0; + dstmap[3] = ONE; /* ? */ + + _mesa_swizzle_ubyte_image(ctx, dims, + srcFormat, + srcType, + baseInternalFormat, + dstmap, 3, + dstAddr, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstImageOffsets, + srcWidth, srcHeight, srcDepth, srcAddr, + srcPacking); + } else { /* general path */ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, @@ -1487,8 +1745,7 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS) GLboolean _mesa_texstore_bgr888(TEXSTORE_PARAMS) { - const GLuint ui = 1; - const GLubyte littleEndian = *((const GLubyte *) &ui); + const GLboolean littleEndian = _mesa_little_endian(); ASSERT(dstFormat == &_mesa_texformat_bgr888); ASSERT(dstFormat->TexelBytes == 3); @@ -1533,6 +1790,30 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS) } } } + else if (!ctx->_ImageTransferState && + srcType == GL_UNSIGNED_BYTE && + can_swizzle(baseInternalFormat) && + can_swizzle(srcFormat)) { + + GLubyte dstmap[4]; + + /* dstmap - how to swizzle from RGBA to dst format: + */ + dstmap[0] = 0; + dstmap[1] = 1; + dstmap[2] = 2; + dstmap[3] = ONE; /* ? */ + + _mesa_swizzle_ubyte_image(ctx, dims, + srcFormat, + srcType, + baseInternalFormat, + dstmap, 3, + dstAddr, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstImageOffsets, + srcWidth, srcHeight, srcDepth, srcAddr, + srcPacking); + } else { /* general path */ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, @@ -1707,8 +1988,7 @@ _mesa_texstore_argb1555(TEXSTORE_PARAMS) GLboolean _mesa_texstore_al88(TEXSTORE_PARAMS) { - const GLuint ui = 1; - const GLubyte littleEndian = *((const GLubyte *) &ui); + const GLboolean littleEndian = _mesa_little_endian(); ASSERT(dstFormat == &_mesa_texformat_al88 || dstFormat == &_mesa_texformat_al88_rev); @@ -1729,6 +2009,38 @@ _mesa_texstore_al88(TEXSTORE_PARAMS) srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } + else if (!ctx->_ImageTransferState && + littleEndian && + srcType == GL_UNSIGNED_BYTE && + can_swizzle(baseInternalFormat) && + can_swizzle(srcFormat)) { + + GLubyte dstmap[4]; + + /* dstmap - how to swizzle from RGBA to dst format: + */ + if ((littleEndian && dstFormat == &_mesa_texformat_al88) || + (!littleEndian && dstFormat == &_mesa_texformat_al88_rev)) { + dstmap[0] = 0; + dstmap[1] = 3; + } + else { + dstmap[0] = 3; + dstmap[1] = 0; + } + dstmap[2] = ZERO; /* ? */ + dstmap[3] = ONE; /* ? */ + + _mesa_swizzle_ubyte_image(ctx, dims, + srcFormat, + srcType, + baseInternalFormat, + dstmap, 2, + dstAddr, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstImageOffsets, + srcWidth, srcHeight, srcDepth, srcAddr, + srcPacking); + } else { /* general path */ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, @@ -1849,6 +2161,35 @@ _mesa_texstore_a8(TEXSTORE_PARAMS) srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } + else if (!ctx->_ImageTransferState && + srcType == GL_UNSIGNED_BYTE && + can_swizzle(baseInternalFormat) && + can_swizzle(srcFormat)) { + + GLubyte dstmap[4]; + + /* dstmap - how to swizzle from RGBA to dst format: + */ + if (dstFormat == &_mesa_texformat_a8) { + dstmap[0] = 3; + } + else { + dstmap[0] = 0; + } + dstmap[1] = ZERO; /* ? */ + dstmap[2] = ZERO; /* ? */ + dstmap[3] = ONE; /* ? */ + + _mesa_swizzle_ubyte_image(ctx, dims, + srcFormat, + srcType, + baseInternalFormat, + dstmap, 1, + dstAddr, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstImageOffsets, + srcWidth, srcHeight, srcDepth, srcAddr, + srcPacking); + } else { /* general path */ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, @@ -1930,8 +2271,7 @@ _mesa_texstore_ci8(TEXSTORE_PARAMS) GLboolean _mesa_texstore_ycbcr(TEXSTORE_PARAMS) { - const GLuint ui = 1; - const GLubyte littleEndian = *((const GLubyte *) &ui); + const GLboolean littleEndian = _mesa_little_endian(); (void) ctx; (void) dims; (void) baseInternalFormat; ASSERT((dstFormat == &_mesa_texformat_ycbcr) || @@ -2186,8 +2526,7 @@ _mesa_texstore_rgba_float16(TEXSTORE_PARAMS) GLboolean _mesa_texstore_srgb8(TEXSTORE_PARAMS) { - const GLuint ui = 1; - const GLubyte littleEndian = *((const GLubyte *) &ui); + const GLboolean littleEndian = _mesa_little_endian(); const struct gl_texture_format *newDstFormat; StoreTexImageFunc store; GLboolean k; @@ -2218,8 +2557,7 @@ _mesa_texstore_srgb8(TEXSTORE_PARAMS) GLboolean _mesa_texstore_srgba8(TEXSTORE_PARAMS) { - const GLuint ui = 1; - const GLubyte littleEndian = *((const GLubyte *) &ui); + const GLboolean littleEndian = _mesa_little_endian(); const struct gl_texture_format *newDstFormat; GLboolean k; @@ -2267,8 +2605,7 @@ _mesa_texstore_sl8(TEXSTORE_PARAMS) GLboolean _mesa_texstore_sla8(TEXSTORE_PARAMS) { - const GLuint ui = 1; - const GLubyte littleEndian = *((const GLubyte *) &ui); + const GLboolean littleEndian = _mesa_little_endian(); const struct gl_texture_format *newDstFormat; GLboolean k; @@ -2386,8 +2723,8 @@ _mesa_unmap_teximage_pbo(GLcontext *ctx, * Adaptor for fetching a GLchan texel from a float-valued texture. */ static void -FetchTexelFloatToChan( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texelOut ) +fetch_texel_float_to_chan(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texelOut) { GLfloat temp[4]; ASSERT(texImage->FetchTexelf); @@ -2411,8 +2748,8 @@ FetchTexelFloatToChan( const struct gl_texture_image *texImage, * Adaptor for fetching a float texel from a GLchan-valued texture. */ static void -FetchTexelChanToFloat( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texelOut ) +fetch_texel_chan_to_float(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texelOut) { GLchan temp[4]; ASSERT(texImage->FetchTexelc); @@ -2435,8 +2772,8 @@ FetchTexelChanToFloat( const struct gl_texture_image *texImage, /** * Initialize the texture image's FetchTexelc and FetchTexelf methods. */ -static void -set_fetch_functions(struct gl_texture_image *texImage, GLuint dims) +void +_mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims) { ASSERT(dims == 1 || dims == 2 || dims == 3); ASSERT(texImage->TexFormat); @@ -2460,10 +2797,10 @@ set_fetch_functions(struct gl_texture_image *texImage, GLuint dims) /* now check if we need to use a float/chan adaptor */ if (!texImage->FetchTexelc) { - texImage->FetchTexelc = FetchTexelFloatToChan; + texImage->FetchTexelc = fetch_texel_float_to_chan; } else if (!texImage->FetchTexelf) { - texImage->FetchTexelf = FetchTexelChanToFloat; + texImage->FetchTexelf = fetch_texel_chan_to_float; } @@ -2496,7 +2833,7 @@ choose_texture_format(GLcontext *ctx, struct gl_texture_image *texImage, ASSERT(texImage->TexFormat); - set_fetch_functions(texImage, dims); + _mesa_set_fetch_functions(texImage, dims); if (texImage->TexFormat->TexelBytes == 0) { /* must be a compressed format */ @@ -3119,1114 +3456,6 @@ _mesa_store_compressed_texsubimage3d(GLcontext *ctx, GLenum target, } -/* - * Average together two rows of a source image to produce a single new - * row in the dest image. It's legal for the two source rows to point - * to the same data. The source width must be equal to either the - * dest width or two times the dest width. - */ -static void -do_row(const struct gl_texture_format *format, GLint srcWidth, - const GLvoid *srcRowA, const GLvoid *srcRowB, - GLint dstWidth, GLvoid *dstRow) -{ - const GLuint k0 = (srcWidth == dstWidth) ? 0 : 1; - const GLuint colStride = (srcWidth == dstWidth) ? 1 : 2; - - /* This assertion is no longer valid with non-power-of-2 textures - assert(srcWidth == dstWidth || srcWidth == 2 * dstWidth); - */ - - switch (format->MesaFormat) { - case MESA_FORMAT_RGBA: - { - GLuint i, j, k; - const GLchan (*rowA)[4] = (const GLchan (*)[4]) srcRowA; - const GLchan (*rowB)[4] = (const GLchan (*)[4]) srcRowB; - GLchan (*dst)[4] = (GLchan (*)[4]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i][0] = (rowA[j][0] + rowA[k][0] + - rowB[j][0] + rowB[k][0]) / 4; - dst[i][1] = (rowA[j][1] + rowA[k][1] + - rowB[j][1] + rowB[k][1]) / 4; - dst[i][2] = (rowA[j][2] + rowA[k][2] + - rowB[j][2] + rowB[k][2]) / 4; - dst[i][3] = (rowA[j][3] + rowA[k][3] + - rowB[j][3] + rowB[k][3]) / 4; - } - } - return; - case MESA_FORMAT_RGB: - { - GLuint i, j, k; - const GLchan (*rowA)[3] = (const GLchan (*)[3]) srcRowA; - const GLchan (*rowB)[3] = (const GLchan (*)[3]) srcRowB; - GLchan (*dst)[3] = (GLchan (*)[3]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i][0] = (rowA[j][0] + rowA[k][0] + - rowB[j][0] + rowB[k][0]) / 4; - dst[i][1] = (rowA[j][1] + rowA[k][1] + - rowB[j][1] + rowB[k][1]) / 4; - dst[i][2] = (rowA[j][2] + rowA[k][2] + - rowB[j][2] + rowB[k][2]) / 4; - } - } - return; - case MESA_FORMAT_ALPHA: - case MESA_FORMAT_LUMINANCE: - case MESA_FORMAT_INTENSITY: - { - GLuint i, j, k; - const GLchan *rowA = (const GLchan *) srcRowA; - const GLchan *rowB = (const GLchan *) srcRowB; - GLchan *dst = (GLchan *) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) / 4; - } - } - return; - case MESA_FORMAT_LUMINANCE_ALPHA: - { - GLuint i, j, k; - const GLchan (*rowA)[2] = (const GLchan (*)[2]) srcRowA; - const GLchan (*rowB)[2] = (const GLchan (*)[2]) srcRowB; - GLchan (*dst)[2] = (GLchan (*)[2]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i][0] = (rowA[j][0] + rowA[k][0] + - rowB[j][0] + rowB[k][0]) / 4; - dst[i][1] = (rowA[j][1] + rowA[k][1] + - rowB[j][1] + rowB[k][1]) / 4; - } - } - return; - case MESA_FORMAT_Z32: - { - GLuint i, j, k; - const GLuint *rowA = (const GLuint *) srcRowA; - const GLuint *rowB = (const GLuint *) srcRowB; - GLfloat *dst = (GLfloat *) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i] = rowA[j] / 4 + rowA[k] / 4 + rowB[j] / 4 + rowB[k] / 4; - } - } - return; - case MESA_FORMAT_Z16: - { - GLuint i, j, k; - const GLushort *rowA = (const GLushort *) srcRowA; - const GLushort *rowB = (const GLushort *) srcRowB; - GLushort *dst = (GLushort *) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) / 4; - } - } - return; - /* Begin hardware formats */ - case MESA_FORMAT_RGBA8888: - case MESA_FORMAT_RGBA8888_REV: - case MESA_FORMAT_ARGB8888: - case MESA_FORMAT_ARGB8888_REV: -#if FEATURE_EXT_texture_sRGB - case MESA_FORMAT_SRGBA8: -#endif - { - GLuint i, j, k; - const GLubyte (*rowA)[4] = (const GLubyte (*)[4]) srcRowA; - const GLubyte (*rowB)[4] = (const GLubyte (*)[4]) srcRowB; - GLubyte (*dst)[4] = (GLubyte (*)[4]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i][0] = (rowA[j][0] + rowA[k][0] + - rowB[j][0] + rowB[k][0]) / 4; - dst[i][1] = (rowA[j][1] + rowA[k][1] + - rowB[j][1] + rowB[k][1]) / 4; - dst[i][2] = (rowA[j][2] + rowA[k][2] + - rowB[j][2] + rowB[k][2]) / 4; - dst[i][3] = (rowA[j][3] + rowA[k][3] + - rowB[j][3] + rowB[k][3]) / 4; - } - } - return; - case MESA_FORMAT_RGB888: - case MESA_FORMAT_BGR888: -#if FEATURE_EXT_texture_sRGB - case MESA_FORMAT_SRGB8: -#endif - { - GLuint i, j, k; - const GLubyte (*rowA)[3] = (const GLubyte (*)[3]) srcRowA; - const GLubyte (*rowB)[3] = (const GLubyte (*)[3]) srcRowB; - GLubyte (*dst)[3] = (GLubyte (*)[3]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i][0] = (rowA[j][0] + rowA[k][0] + - rowB[j][0] + rowB[k][0]) / 4; - dst[i][1] = (rowA[j][1] + rowA[k][1] + - rowB[j][1] + rowB[k][1]) / 4; - dst[i][2] = (rowA[j][2] + rowA[k][2] + - rowB[j][2] + rowB[k][2]) / 4; - } - } - return; - case MESA_FORMAT_RGB565: - case MESA_FORMAT_RGB565_REV: - { - GLuint i, j, k; - const GLushort *rowA = (const GLushort *) srcRowA; - const GLushort *rowB = (const GLushort *) srcRowB; - GLushort *dst = (GLushort *) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - const GLint rowAr0 = rowA[j] & 0x1f; - const GLint rowAr1 = rowA[k] & 0x1f; - const GLint rowBr0 = rowB[j] & 0x1f; - const GLint rowBr1 = rowB[k] & 0x1f; - const GLint rowAg0 = (rowA[j] >> 5) & 0x3f; - const GLint rowAg1 = (rowA[k] >> 5) & 0x3f; - const GLint rowBg0 = (rowB[j] >> 5) & 0x3f; - const GLint rowBg1 = (rowB[k] >> 5) & 0x3f; - const GLint rowAb0 = (rowA[j] >> 11) & 0x1f; - const GLint rowAb1 = (rowA[k] >> 11) & 0x1f; - const GLint rowBb0 = (rowB[j] >> 11) & 0x1f; - const GLint rowBb1 = (rowB[k] >> 11) & 0x1f; - const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2; - const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2; - const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2; - dst[i] = (blue << 11) | (green << 5) | red; - } - } - return; - case MESA_FORMAT_ARGB4444: - case MESA_FORMAT_ARGB4444_REV: - { - GLuint i, j, k; - const GLushort *rowA = (const GLushort *) srcRowA; - const GLushort *rowB = (const GLushort *) srcRowB; - GLushort *dst = (GLushort *) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - const GLint rowAr0 = rowA[j] & 0xf; - const GLint rowAr1 = rowA[k] & 0xf; - const GLint rowBr0 = rowB[j] & 0xf; - const GLint rowBr1 = rowB[k] & 0xf; - const GLint rowAg0 = (rowA[j] >> 4) & 0xf; - const GLint rowAg1 = (rowA[k] >> 4) & 0xf; - const GLint rowBg0 = (rowB[j] >> 4) & 0xf; - const GLint rowBg1 = (rowB[k] >> 4) & 0xf; - const GLint rowAb0 = (rowA[j] >> 8) & 0xf; - const GLint rowAb1 = (rowA[k] >> 8) & 0xf; - const GLint rowBb0 = (rowB[j] >> 8) & 0xf; - const GLint rowBb1 = (rowB[k] >> 8) & 0xf; - const GLint rowAa0 = (rowA[j] >> 12) & 0xf; - const GLint rowAa1 = (rowA[k] >> 12) & 0xf; - const GLint rowBa0 = (rowB[j] >> 12) & 0xf; - const GLint rowBa1 = (rowB[k] >> 12) & 0xf; - const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2; - const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2; - const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2; - const GLint alpha = (rowAa0 + rowAa1 + rowBa0 + rowBa1) >> 2; - dst[i] = (alpha << 12) | (blue << 8) | (green << 4) | red; - } - } - return; - case MESA_FORMAT_ARGB1555: - case MESA_FORMAT_ARGB1555_REV: /* XXX broken? */ - { - GLuint i, j, k; - const GLushort *rowA = (const GLushort *) srcRowA; - const GLushort *rowB = (const GLushort *) srcRowB; - GLushort *dst = (GLushort *) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - const GLint rowAr0 = rowA[j] & 0x1f; - const GLint rowAr1 = rowA[k] & 0x1f; - const GLint rowBr0 = rowB[j] & 0x1f; - const GLint rowBr1 = rowB[k] & 0xf; - const GLint rowAg0 = (rowA[j] >> 5) & 0x1f; - const GLint rowAg1 = (rowA[k] >> 5) & 0x1f; - const GLint rowBg0 = (rowB[j] >> 5) & 0x1f; - const GLint rowBg1 = (rowB[k] >> 5) & 0x1f; - const GLint rowAb0 = (rowA[j] >> 10) & 0x1f; - const GLint rowAb1 = (rowA[k] >> 10) & 0x1f; - const GLint rowBb0 = (rowB[j] >> 10) & 0x1f; - const GLint rowBb1 = (rowB[k] >> 10) & 0x1f; - const GLint rowAa0 = (rowA[j] >> 15) & 0x1; - const GLint rowAa1 = (rowA[k] >> 15) & 0x1; - const GLint rowBa0 = (rowB[j] >> 15) & 0x1; - const GLint rowBa1 = (rowB[k] >> 15) & 0x1; - const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2; - const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2; - const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2; - const GLint alpha = (rowAa0 + rowAa1 + rowBa0 + rowBa1) >> 2; - dst[i] = (alpha << 15) | (blue << 10) | (green << 5) | red; - } - } - return; - case MESA_FORMAT_AL88: - case MESA_FORMAT_AL88_REV: -#if FEATURE_EXT_texture_sRGB - case MESA_FORMAT_SLA8: -#endif - { - GLuint i, j, k; - const GLubyte (*rowA)[2] = (const GLubyte (*)[2]) srcRowA; - const GLubyte (*rowB)[2] = (const GLubyte (*)[2]) srcRowB; - GLubyte (*dst)[2] = (GLubyte (*)[2]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i][0] = (rowA[j][0] + rowA[k][0] + - rowB[j][0] + rowB[k][0]) >> 2; - dst[i][1] = (rowA[j][1] + rowA[k][1] + - rowB[j][1] + rowB[k][1]) >> 2; - } - } - return; - case MESA_FORMAT_RGB332: - { - GLuint i, j, k; - const GLubyte *rowA = (const GLubyte *) srcRowA; - const GLubyte *rowB = (const GLubyte *) srcRowB; - GLubyte *dst = (GLubyte *) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - const GLint rowAr0 = rowA[j] & 0x3; - const GLint rowAr1 = rowA[k] & 0x3; - const GLint rowBr0 = rowB[j] & 0x3; - const GLint rowBr1 = rowB[k] & 0x3; - const GLint rowAg0 = (rowA[j] >> 2) & 0x7; - const GLint rowAg1 = (rowA[k] >> 2) & 0x7; - const GLint rowBg0 = (rowB[j] >> 2) & 0x7; - const GLint rowBg1 = (rowB[k] >> 2) & 0x7; - const GLint rowAb0 = (rowA[j] >> 5) & 0x7; - const GLint rowAb1 = (rowA[k] >> 5) & 0x7; - const GLint rowBb0 = (rowB[j] >> 5) & 0x7; - const GLint rowBb1 = (rowB[k] >> 5) & 0x7; - const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2; - const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2; - const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2; - dst[i] = (blue << 5) | (green << 2) | red; - } - } - return; - case MESA_FORMAT_A8: - case MESA_FORMAT_L8: - case MESA_FORMAT_I8: - case MESA_FORMAT_CI8: -#if FEATURE_EXT_texture_sRGB - case MESA_FORMAT_SL8: -#endif - { - GLuint i, j, k; - const GLubyte *rowA = (const GLubyte *) srcRowA; - const GLubyte *rowB = (const GLubyte *) srcRowB; - GLubyte *dst = (GLubyte *) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) >> 2; - } - } - return; - case MESA_FORMAT_RGBA_FLOAT32: - { - GLuint i, j, k; - const GLfloat (*rowA)[4] = (const GLfloat (*)[4]) srcRowA; - const GLfloat (*rowB)[4] = (const GLfloat (*)[4]) srcRowB; - GLfloat (*dst)[4] = (GLfloat (*)[4]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i][0] = (rowA[j][0] + rowA[k][0] + - rowB[j][0] + rowB[k][0]) * 0.25F; - dst[i][1] = (rowA[j][1] + rowA[k][1] + - rowB[j][1] + rowB[k][1]) * 0.25F; - dst[i][2] = (rowA[j][2] + rowA[k][2] + - rowB[j][2] + rowB[k][2]) * 0.25F; - dst[i][3] = (rowA[j][3] + rowA[k][3] + - rowB[j][3] + rowB[k][3]) * 0.25F; - } - } - return; - case MESA_FORMAT_RGBA_FLOAT16: - { - GLuint i, j, k, comp; - const GLhalfARB (*rowA)[4] = (const GLhalfARB (*)[4]) srcRowA; - const GLhalfARB (*rowB)[4] = (const GLhalfARB (*)[4]) srcRowB; - GLhalfARB (*dst)[4] = (GLhalfARB (*)[4]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - for (comp = 0; comp < 4; comp++) { - GLfloat aj, ak, bj, bk; - aj = _mesa_half_to_float(rowA[j][comp]); - ak = _mesa_half_to_float(rowA[k][comp]); - bj = _mesa_half_to_float(rowB[j][comp]); - bk = _mesa_half_to_float(rowB[k][comp]); - dst[i][comp] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F); - } - } - } - return; - case MESA_FORMAT_RGB_FLOAT32: - { - GLuint i, j, k; - const GLfloat (*rowA)[3] = (const GLfloat (*)[3]) srcRowA; - const GLfloat (*rowB)[3] = (const GLfloat (*)[3]) srcRowB; - GLfloat (*dst)[3] = (GLfloat (*)[3]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i][0] = (rowA[j][0] + rowA[k][0] + - rowB[j][0] + rowB[k][0]) * 0.25F; - dst[i][1] = (rowA[j][1] + rowA[k][1] + - rowB[j][1] + rowB[k][1]) * 0.25F; - dst[i][2] = (rowA[j][2] + rowA[k][2] + - rowB[j][2] + rowB[k][2]) * 0.25F; - } - } - return; - case MESA_FORMAT_RGB_FLOAT16: - { - GLuint i, j, k, comp; - const GLhalfARB (*rowA)[3] = (const GLhalfARB (*)[3]) srcRowA; - const GLhalfARB (*rowB)[3] = (const GLhalfARB (*)[3]) srcRowB; - GLhalfARB (*dst)[3] = (GLhalfARB (*)[3]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - for (comp = 0; comp < 3; comp++) { - GLfloat aj, ak, bj, bk; - aj = _mesa_half_to_float(rowA[j][comp]); - ak = _mesa_half_to_float(rowA[k][comp]); - bj = _mesa_half_to_float(rowB[j][comp]); - bk = _mesa_half_to_float(rowB[k][comp]); - dst[i][comp] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F); - } - } - } - return; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32: - { - GLuint i, j, k; - const GLfloat (*rowA)[2] = (const GLfloat (*)[2]) srcRowA; - const GLfloat (*rowB)[2] = (const GLfloat (*)[2]) srcRowB; - GLfloat (*dst)[2] = (GLfloat (*)[2]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i][0] = (rowA[j][0] + rowA[k][0] + - rowB[j][0] + rowB[k][0]) * 0.25F; - dst[i][1] = (rowA[j][1] + rowA[k][1] + - rowB[j][1] + rowB[k][1]) * 0.25F; - } - } - return; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16: - { - GLuint i, j, k, comp; - const GLhalfARB (*rowA)[2] = (const GLhalfARB (*)[2]) srcRowA; - const GLhalfARB (*rowB)[2] = (const GLhalfARB (*)[2]) srcRowB; - GLhalfARB (*dst)[2] = (GLhalfARB (*)[2]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - for (comp = 0; comp < 2; comp++) { - GLfloat aj, ak, bj, bk; - aj = _mesa_half_to_float(rowA[j][comp]); - ak = _mesa_half_to_float(rowA[k][comp]); - bj = _mesa_half_to_float(rowB[j][comp]); - bk = _mesa_half_to_float(rowB[k][comp]); - dst[i][comp] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F); - } - } - } - return; - case MESA_FORMAT_ALPHA_FLOAT32: - case MESA_FORMAT_LUMINANCE_FLOAT32: - case MESA_FORMAT_INTENSITY_FLOAT32: - { - GLuint i, j, k; - const GLfloat *rowA = (const GLfloat *) srcRowA; - const GLfloat *rowB = (const GLfloat *) srcRowB; - GLfloat *dst = (GLfloat *) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) * 0.25F; - } - } - return; - case MESA_FORMAT_ALPHA_FLOAT16: - case MESA_FORMAT_LUMINANCE_FLOAT16: - case MESA_FORMAT_INTENSITY_FLOAT16: - { - GLuint i, j, k; - const GLhalfARB *rowA = (const GLhalfARB *) srcRowA; - const GLhalfARB *rowB = (const GLhalfARB *) srcRowB; - GLhalfARB *dst = (GLhalfARB *) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - GLfloat aj, ak, bj, bk; - aj = _mesa_half_to_float(rowA[j]); - ak = _mesa_half_to_float(rowA[k]); - bj = _mesa_half_to_float(rowB[j]); - bk = _mesa_half_to_float(rowB[k]); - dst[i] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F); - } - } - return; - - default: - _mesa_problem(NULL, "bad format in do_row()"); - } -} - - -/* - * These functions generate a 1/2-size mipmap image from a source image. - * Texture borders are handled by copying or averaging the source image's - * border texels, depending on the scale-down factor. - */ - -static void -make_1d_mipmap(const struct gl_texture_format *format, GLint border, - GLint srcWidth, const GLubyte *srcPtr, - GLint dstWidth, GLubyte *dstPtr) -{ - const GLint bpt = format->TexelBytes; - const GLubyte *src; - GLubyte *dst; - - /* skip the border pixel, if any */ - src = srcPtr + border * bpt; - dst = dstPtr + border * bpt; - - /* we just duplicate the input row, kind of hack, saves code */ - do_row(format, srcWidth - 2 * border, src, src, - dstWidth - 2 * border, dst); - - if (border) { - /* copy left-most pixel from source */ - MEMCPY(dstPtr, srcPtr, bpt); - /* copy right-most pixel from source */ - MEMCPY(dstPtr + (dstWidth - 1) * bpt, - srcPtr + (srcWidth - 1) * bpt, - bpt); - } -} - - -/** - * XXX need to use the tex image's row stride! - */ -static void -make_2d_mipmap(const struct gl_texture_format *format, GLint border, - GLint srcWidth, GLint srcHeight, const GLubyte *srcPtr, - GLint dstWidth, GLint dstHeight, GLubyte *dstPtr) -{ - const GLint bpt = format->TexelBytes; - const GLint srcWidthNB = srcWidth - 2 * border; /* sizes w/out border */ - const GLint dstWidthNB = dstWidth - 2 * border; - const GLint dstHeightNB = dstHeight - 2 * border; - const GLint srcRowStride = bpt * srcWidth; - const GLint dstRowStride = bpt * dstWidth; - const GLubyte *srcA, *srcB; - GLubyte *dst; - GLint row; - - /* Compute src and dst pointers, skipping any border */ - srcA = srcPtr + border * ((srcWidth + 1) * bpt); - if (srcHeight > 1) - srcB = srcA + srcRowStride; - else - srcB = srcA; - dst = dstPtr + border * ((dstWidth + 1) * bpt); - - for (row = 0; row < dstHeightNB; row++) { - do_row(format, srcWidthNB, srcA, srcB, - dstWidthNB, dst); - srcA += 2 * srcRowStride; - srcB += 2 * srcRowStride; - dst += dstRowStride; - } - - /* This is ugly but probably won't be used much */ - if (border > 0) { - /* fill in dest border */ - /* lower-left border pixel */ - MEMCPY(dstPtr, srcPtr, bpt); - /* lower-right border pixel */ - MEMCPY(dstPtr + (dstWidth - 1) * bpt, - srcPtr + (srcWidth - 1) * bpt, bpt); - /* upper-left border pixel */ - MEMCPY(dstPtr + dstWidth * (dstHeight - 1) * bpt, - srcPtr + srcWidth * (srcHeight - 1) * bpt, bpt); - /* upper-right border pixel */ - MEMCPY(dstPtr + (dstWidth * dstHeight - 1) * bpt, - srcPtr + (srcWidth * srcHeight - 1) * bpt, bpt); - /* lower border */ - do_row(format, srcWidthNB, - srcPtr + bpt, - srcPtr + bpt, - dstWidthNB, dstPtr + bpt); - /* upper border */ - do_row(format, srcWidthNB, - srcPtr + (srcWidth * (srcHeight - 1) + 1) * bpt, - srcPtr + (srcWidth * (srcHeight - 1) + 1) * bpt, - dstWidthNB, - dstPtr + (dstWidth * (dstHeight - 1) + 1) * bpt); - /* left and right borders */ - if (srcHeight == dstHeight) { - /* copy border pixel from src to dst */ - for (row = 1; row < srcHeight; row++) { - MEMCPY(dstPtr + dstWidth * row * bpt, - srcPtr + srcWidth * row * bpt, bpt); - MEMCPY(dstPtr + (dstWidth * row + dstWidth - 1) * bpt, - srcPtr + (srcWidth * row + srcWidth - 1) * bpt, bpt); - } - } - else { - /* average two src pixels each dest pixel */ - for (row = 0; row < dstHeightNB; row += 2) { - do_row(format, 1, - srcPtr + (srcWidth * (row * 2 + 1)) * bpt, - srcPtr + (srcWidth * (row * 2 + 2)) * bpt, - 1, dstPtr + (dstWidth * row + 1) * bpt); - do_row(format, 1, - srcPtr + (srcWidth * (row * 2 + 1) + srcWidth - 1) * bpt, - srcPtr + (srcWidth * (row * 2 + 2) + srcWidth - 1) * bpt, - 1, dstPtr + (dstWidth * row + 1 + dstWidth - 1) * bpt); - } - } - } -} - - -static void -make_3d_mipmap(const struct gl_texture_format *format, GLint border, - GLint srcWidth, GLint srcHeight, GLint srcDepth, - const GLubyte *srcPtr, - GLint dstWidth, GLint dstHeight, GLint dstDepth, - GLubyte *dstPtr) -{ - const GLint bpt = format->TexelBytes; - const GLint srcWidthNB = srcWidth - 2 * border; /* sizes w/out border */ - const GLint srcDepthNB = srcDepth - 2 * border; - const GLint dstWidthNB = dstWidth - 2 * border; - const GLint dstHeightNB = dstHeight - 2 * border; - const GLint dstDepthNB = dstDepth - 2 * border; - GLvoid *tmpRowA, *tmpRowB; - GLint img, row; - GLint bytesPerSrcImage, bytesPerDstImage; - GLint bytesPerSrcRow, bytesPerDstRow; - GLint srcImageOffset, srcRowOffset; - - (void) srcDepthNB; /* silence warnings */ - - /* Need two temporary row buffers */ - tmpRowA = _mesa_malloc(srcWidth * bpt); - if (!tmpRowA) - return; - tmpRowB = _mesa_malloc(srcWidth * bpt); - if (!tmpRowB) { - _mesa_free(tmpRowA); - return; - } - - bytesPerSrcImage = srcWidth * srcHeight * bpt; - bytesPerDstImage = dstWidth * dstHeight * bpt; - - bytesPerSrcRow = srcWidth * bpt; - bytesPerDstRow = dstWidth * bpt; - - /* Offset between adjacent src images to be averaged together */ - srcImageOffset = (srcDepth == dstDepth) ? 0 : bytesPerSrcImage; - - /* Offset between adjacent src rows to be averaged together */ - srcRowOffset = (srcHeight == dstHeight) ? 0 : srcWidth * bpt; - - /* - * Need to average together up to 8 src pixels for each dest pixel. - * Break that down into 3 operations: - * 1. take two rows from source image and average them together. - * 2. take two rows from next source image and average them together. - * 3. take the two averaged rows and average them for the final dst row. - */ - - /* - _mesa_printf("mip3d %d x %d x %d -> %d x %d x %d\n", - srcWidth, srcHeight, srcDepth, dstWidth, dstHeight, dstDepth); - */ - - for (img = 0; img < dstDepthNB; img++) { - /* first source image pointer, skipping border */ - const GLubyte *imgSrcA = srcPtr - + (bytesPerSrcImage + bytesPerSrcRow + border) * bpt * border - + img * (bytesPerSrcImage + srcImageOffset); - /* second source image pointer, skipping border */ - const GLubyte *imgSrcB = imgSrcA + srcImageOffset; - /* address of the dest image, skipping border */ - GLubyte *imgDst = dstPtr - + (bytesPerDstImage + bytesPerDstRow + border) * bpt * border - + img * bytesPerDstImage; - - /* setup the four source row pointers and the dest row pointer */ - const GLubyte *srcImgARowA = imgSrcA; - const GLubyte *srcImgARowB = imgSrcA + srcRowOffset; - const GLubyte *srcImgBRowA = imgSrcB; - const GLubyte *srcImgBRowB = imgSrcB + srcRowOffset; - GLubyte *dstImgRow = imgDst; - - for (row = 0; row < dstHeightNB; row++) { - /* Average together two rows from first src image */ - do_row(format, srcWidthNB, srcImgARowA, srcImgARowB, - srcWidthNB, tmpRowA); - /* Average together two rows from second src image */ - do_row(format, srcWidthNB, srcImgBRowA, srcImgBRowB, - srcWidthNB, tmpRowB); - /* Average together the temp rows to make the final row */ - do_row(format, srcWidthNB, tmpRowA, tmpRowB, - dstWidthNB, dstImgRow); - /* advance to next rows */ - srcImgARowA += bytesPerSrcRow + srcRowOffset; - srcImgARowB += bytesPerSrcRow + srcRowOffset; - srcImgBRowA += bytesPerSrcRow + srcRowOffset; - srcImgBRowB += bytesPerSrcRow + srcRowOffset; - dstImgRow += bytesPerDstRow; - } - } - - _mesa_free(tmpRowA); - _mesa_free(tmpRowB); - - /* Luckily we can leverage the make_2d_mipmap() function here! */ - if (border > 0) { - /* do front border image */ - make_2d_mipmap(format, 1, srcWidth, srcHeight, srcPtr, - dstWidth, dstHeight, dstPtr); - /* do back border image */ - make_2d_mipmap(format, 1, srcWidth, srcHeight, - srcPtr + bytesPerSrcImage * (srcDepth - 1), - dstWidth, dstHeight, - dstPtr + bytesPerDstImage * (dstDepth - 1)); - /* do four remaining border edges that span the image slices */ - if (srcDepth == dstDepth) { - /* just copy border pixels from src to dst */ - for (img = 0; img < dstDepthNB; img++) { - const GLubyte *src; - GLubyte *dst; - - /* do border along [img][row=0][col=0] */ - src = srcPtr + (img + 1) * bytesPerSrcImage; - dst = dstPtr + (img + 1) * bytesPerDstImage; - MEMCPY(dst, src, bpt); - - /* do border along [img][row=dstHeight-1][col=0] */ - src = srcPtr + (img * 2 + 1) * bytesPerSrcImage - + (srcHeight - 1) * bytesPerSrcRow; - dst = dstPtr + (img + 1) * bytesPerDstImage - + (dstHeight - 1) * bytesPerDstRow; - MEMCPY(dst, src, bpt); - - /* do border along [img][row=0][col=dstWidth-1] */ - src = srcPtr + (img * 2 + 1) * bytesPerSrcImage - + (srcWidth - 1) * bpt; - dst = dstPtr + (img + 1) * bytesPerDstImage - + (dstWidth - 1) * bpt; - MEMCPY(dst, src, bpt); - - /* do border along [img][row=dstHeight-1][col=dstWidth-1] */ - src = srcPtr + (img * 2 + 1) * bytesPerSrcImage - + (bytesPerSrcImage - bpt); - dst = dstPtr + (img + 1) * bytesPerDstImage - + (bytesPerDstImage - bpt); - MEMCPY(dst, src, bpt); - } - } - else { - /* average border pixels from adjacent src image pairs */ - ASSERT(srcDepthNB == 2 * dstDepthNB); - for (img = 0; img < dstDepthNB; img++) { - const GLubyte *src; - GLubyte *dst; - - /* do border along [img][row=0][col=0] */ - src = srcPtr + (img * 2 + 1) * bytesPerSrcImage; - dst = dstPtr + (img + 1) * bytesPerDstImage; - do_row(format, 1, src, src + srcImageOffset, 1, dst); - - /* do border along [img][row=dstHeight-1][col=0] */ - src = srcPtr + (img * 2 + 1) * bytesPerSrcImage - + (srcHeight - 1) * bytesPerSrcRow; - dst = dstPtr + (img + 1) * bytesPerDstImage - + (dstHeight - 1) * bytesPerDstRow; - do_row(format, 1, src, src + srcImageOffset, 1, dst); - - /* do border along [img][row=0][col=dstWidth-1] */ - src = srcPtr + (img * 2 + 1) * bytesPerSrcImage - + (srcWidth - 1) * bpt; - dst = dstPtr + (img + 1) * bytesPerDstImage - + (dstWidth - 1) * bpt; - do_row(format, 1, src, src + srcImageOffset, 1, dst); - - /* do border along [img][row=dstHeight-1][col=dstWidth-1] */ - src = srcPtr + (img * 2 + 1) * bytesPerSrcImage - + (bytesPerSrcImage - bpt); - dst = dstPtr + (img + 1) * bytesPerDstImage - + (bytesPerDstImage - bpt); - do_row(format, 1, src, src + srcImageOffset, 1, dst); - } - } - } -} - - -/** - * For GL_SGIX_generate_mipmap: - * Generate a complete set of mipmaps from texObj's base-level image. - * Stop at texObj's MaxLevel or when we get to the 1x1 texture. - */ -void -_mesa_generate_mipmap(GLcontext *ctx, GLenum target, - const struct gl_texture_unit *texUnit, - struct gl_texture_object *texObj) -{ - const struct gl_texture_image *srcImage; - const struct gl_texture_format *convertFormat; - const GLubyte *srcData = NULL; - GLubyte *dstData = NULL; - GLint level, maxLevels; - - ASSERT(texObj); - /* XXX choose cube map face here??? */ - srcImage = texObj->Image[0][texObj->BaseLevel]; - ASSERT(srcImage); - - maxLevels = _mesa_max_texture_levels(ctx, texObj->Target); - ASSERT(maxLevels > 0); /* bad target */ - - /* Find convertFormat - the format that do_row() will process */ - if (srcImage->IsCompressed) { - /* setup for compressed textures */ - GLuint row; - GLint components, size; - GLchan *dst; - - assert(texObj->Target == GL_TEXTURE_2D); - - if (srcImage->_BaseFormat == GL_RGB) { - convertFormat = &_mesa_texformat_rgb; - components = 3; - } - else if (srcImage->_BaseFormat == GL_RGBA) { - convertFormat = &_mesa_texformat_rgba; - components = 4; - } - else { - _mesa_problem(ctx, "bad srcImage->_BaseFormat in _mesa_generate_mipmaps"); - return; - } - - /* allocate storage for uncompressed GL_RGB or GL_RGBA images */ - size = _mesa_bytes_per_pixel(srcImage->_BaseFormat, CHAN_TYPE) - * srcImage->Width * srcImage->Height * srcImage->Depth + 20; - /* 20 extra bytes, just be safe when calling last FetchTexel */ - srcData = (GLubyte *) _mesa_malloc(size); - if (!srcData) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps"); - return; - } - dstData = (GLubyte *) _mesa_malloc(size / 2); /* 1/4 would probably be OK */ - if (!dstData) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps"); - _mesa_free((void *) srcData); - return; - } - - /* decompress base image here */ - dst = (GLchan *) srcData; - for (row = 0; row < srcImage->Height; row++) { - GLuint col; - for (col = 0; col < srcImage->Width; col++) { - srcImage->FetchTexelc(srcImage, col, row, 0, dst); - dst += components; - } - } - } - else { - /* uncompressed */ - convertFormat = srcImage->TexFormat; - } - - for (level = texObj->BaseLevel; level < texObj->MaxLevel - && level < maxLevels - 1; level++) { - /* generate image[level+1] from image[level] */ - const struct gl_texture_image *srcImage; - struct gl_texture_image *dstImage; - GLint srcWidth, srcHeight, srcDepth; - GLint dstWidth, dstHeight, dstDepth; - GLint border, bytesPerTexel; - - /* get src image parameters */ - srcImage = _mesa_select_tex_image(ctx, texUnit, target, level); - ASSERT(srcImage); - srcWidth = srcImage->Width; - srcHeight = srcImage->Height; - srcDepth = srcImage->Depth; - border = srcImage->Border; - - /* compute next (level+1) image size */ - if (srcWidth - 2 * border > 1) { - dstWidth = (srcWidth - 2 * border) / 2 + 2 * border; - } - else { - dstWidth = srcWidth; /* can't go smaller */ - } - if (srcHeight - 2 * border > 1) { - dstHeight = (srcHeight - 2 * border) / 2 + 2 * border; - } - else { - dstHeight = srcHeight; /* can't go smaller */ - } - if (srcDepth - 2 * border > 1) { - dstDepth = (srcDepth - 2 * border) / 2 + 2 * border; - } - else { - dstDepth = srcDepth; /* can't go smaller */ - } - - if (dstWidth == srcWidth && - dstHeight == srcHeight && - dstDepth == srcDepth) { - /* all done */ - if (srcImage->IsCompressed) { - _mesa_free((void *) srcData); - _mesa_free(dstData); - } - return; - } - - /* get dest gl_texture_image */ - dstImage = _mesa_get_tex_image(ctx, texUnit, target, level + 1); - if (!dstImage) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps"); - return; - } - - /* Free old image data */ - if (dstImage->Data) - ctx->Driver.FreeTexImageData(ctx, dstImage); - - /* initialize new image */ - _mesa_init_teximage_fields(ctx, target, dstImage, dstWidth, dstHeight, - dstDepth, border, srcImage->InternalFormat); - dstImage->DriverData = NULL; - dstImage->TexFormat = srcImage->TexFormat; - dstImage->FetchTexelc = srcImage->FetchTexelc; - dstImage->FetchTexelf = srcImage->FetchTexelf; - dstImage->IsCompressed = srcImage->IsCompressed; - if (dstImage->IsCompressed) { - dstImage->CompressedSize - = ctx->Driver.CompressedTextureSize(ctx, dstImage->Width, - dstImage->Height, - dstImage->Depth, - dstImage->TexFormat->MesaFormat); - ASSERT(dstImage->CompressedSize > 0); - } - - ASSERT(dstImage->TexFormat); - ASSERT(dstImage->FetchTexelc); - ASSERT(dstImage->FetchTexelf); - - /* Alloc new teximage data buffer. - * Setup src and dest data pointers. - */ - if (dstImage->IsCompressed) { - dstImage->Data = _mesa_alloc_texmemory(dstImage->CompressedSize); - if (!dstImage->Data) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps"); - return; - } - /* srcData and dstData are already set */ - ASSERT(srcData); - ASSERT(dstData); - } - else { - bytesPerTexel = dstImage->TexFormat->TexelBytes; - ASSERT(dstWidth * dstHeight * dstDepth * bytesPerTexel > 0); - dstImage->Data = _mesa_alloc_texmemory(dstWidth * dstHeight - * dstDepth * bytesPerTexel); - if (!dstImage->Data) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps"); - return; - } - srcData = (const GLubyte *) srcImage->Data; - dstData = (GLubyte *) dstImage->Data; - } - - /* - * We use simple 2x2 averaging to compute the next mipmap level. - */ - switch (target) { - case GL_TEXTURE_1D: - make_1d_mipmap(convertFormat, border, - srcWidth, srcData, - dstWidth, dstData); - break; - case GL_TEXTURE_2D: - case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: - make_2d_mipmap(convertFormat, border, - srcWidth, srcHeight, srcData, - dstWidth, dstHeight, dstData); - break; - case GL_TEXTURE_3D: - make_3d_mipmap(convertFormat, border, - srcWidth, srcHeight, srcDepth, srcData, - dstWidth, dstHeight, dstDepth, dstData); - break; - case GL_TEXTURE_RECTANGLE_NV: - /* no mipmaps, do nothing */ - break; - default: - _mesa_problem(ctx, "bad dimensions in _mesa_generate_mipmaps"); - return; - } - - if (dstImage->IsCompressed) { - GLubyte *temp; - /* compress image from dstData into dstImage->Data */ - const GLenum srcFormat = convertFormat->BaseFormat; - GLint dstRowStride - = _mesa_compressed_row_stride(dstImage->TexFormat->MesaFormat, dstWidth); - ASSERT(srcFormat == GL_RGB || srcFormat == GL_RGBA); - dstImage->TexFormat->StoreImage(ctx, 2, dstImage->_BaseFormat, - dstImage->TexFormat, - dstImage->Data, - 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowStride, 0, /* strides */ - dstWidth, dstHeight, 1, /* size */ - srcFormat, CHAN_TYPE, - dstData, /* src data, actually */ - &ctx->DefaultPacking); - /* swap src and dest pointers */ - temp = (GLubyte *) srcData; - srcData = dstData; - dstData = temp; - } - - } /* loop over mipmap levels */ -} - - -/** - * Helper function for drivers which need to rescale texture images to - * certain aspect ratios. - * Nearest filtering only (for broken hardware that can't support - * all aspect ratios). This can be made a lot faster, but I don't - * really care enough... - */ -void -_mesa_rescale_teximage2d (GLuint bytesPerPixel, - GLuint srcStrideInPixels, - GLuint dstRowStride, - GLint srcWidth, GLint srcHeight, - GLint dstWidth, GLint dstHeight, - const GLvoid *srcImage, GLvoid *dstImage) -{ - GLint row, col; - -#define INNER_LOOP( TYPE, HOP, WOP ) \ - for ( row = 0 ; row < dstHeight ; row++ ) { \ - GLint srcRow = row HOP hScale; \ - for ( col = 0 ; col < dstWidth ; col++ ) { \ - GLint srcCol = col WOP wScale; \ - dst[col] = src[srcRow * srcStrideInPixels + srcCol]; \ - } \ - dst = (TYPE *) ((GLubyte *) dst + dstRowStride); \ - } \ - -#define RESCALE_IMAGE( TYPE ) \ -do { \ - const TYPE *src = (const TYPE *)srcImage; \ - TYPE *dst = (TYPE *)dstImage; \ - \ - if ( srcHeight < dstHeight ) { \ - const GLint hScale = dstHeight / srcHeight; \ - if ( srcWidth < dstWidth ) { \ - const GLint wScale = dstWidth / srcWidth; \ - INNER_LOOP( TYPE, /, / ); \ - } \ - else { \ - const GLint wScale = srcWidth / dstWidth; \ - INNER_LOOP( TYPE, /, * ); \ - } \ - } \ - else { \ - const GLint hScale = srcHeight / dstHeight; \ - if ( srcWidth < dstWidth ) { \ - const GLint wScale = dstWidth / srcWidth; \ - INNER_LOOP( TYPE, *, / ); \ - } \ - else { \ - const GLint wScale = srcWidth / dstWidth; \ - INNER_LOOP( TYPE, *, * ); \ - } \ - } \ -} while (0) - - switch ( bytesPerPixel ) { - case 4: - RESCALE_IMAGE( GLuint ); - break; - - case 2: - RESCALE_IMAGE( GLushort ); - break; - - case 1: - RESCALE_IMAGE( GLubyte ); - break; - default: - _mesa_problem(NULL,"unexpected bytes/pixel in _mesa_rescale_teximage2d"); - } -} - - -/** - * Upscale an image by replication, not (typical) stretching. - * We use this when the image width or height is less than a - * certain size (4, 8) and we need to upscale an image. - */ -void -_mesa_upscale_teximage2d (GLsizei inWidth, GLsizei inHeight, - GLsizei outWidth, GLsizei outHeight, - GLint comps, const GLchan *src, GLint srcRowStride, - GLchan *dest ) -{ - GLint i, j, k; - - ASSERT(outWidth >= inWidth); - ASSERT(outHeight >= inHeight); -#if 0 - ASSERT(inWidth == 1 || inWidth == 2 || inHeight == 1 || inHeight == 2); - ASSERT((outWidth & 3) == 0); - ASSERT((outHeight & 3) == 0); -#endif - - for (i = 0; i < outHeight; i++) { - const GLint ii = i % inHeight; - for (j = 0; j < outWidth; j++) { - const GLint jj = j % inWidth; - for (k = 0; k < comps; k++) { - dest[(i * outWidth + j) * comps + k] - = src[ii * srcRowStride + jj * comps + k]; - } - } - } -} #if FEATURE_EXT_texture_sRGB @@ -4380,11 +3609,29 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, GLint col; for (col = 0; col < width; col++) { (*texImage->FetchTexelf)(texImage, col, row, img, rgba[col]); + if (texImage->TexFormat->BaseFormat == GL_ALPHA) { + rgba[col][RCOMP] = 0.0; + rgba[col][GCOMP] = 0.0; + rgba[col][BCOMP] = 0.0; + } + else if (texImage->TexFormat->BaseFormat == GL_LUMINANCE) { + rgba[col][GCOMP] = 0.0; + rgba[col][BCOMP] = 0.0; + rgba[col][ACOMP] = 1.0; + } + else if (texImage->TexFormat->BaseFormat == GL_LUMINANCE_ALPHA) { + rgba[col][GCOMP] = 0.0; + rgba[col][BCOMP] = 0.0; + } + else if (texImage->TexFormat->BaseFormat == GL_INTENSITY) { + rgba[col][GCOMP] = 0.0; + rgba[col][BCOMP] = 0.0; + rgba[col][ACOMP] = 1.0; + } } - _mesa_pack_rgba_span_float(ctx, width, - (const GLfloat (*)[4]) rgba, - format, type, dest, &ctx->Pack, - 0 /* no image transfer */); + _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba, + format, type, dest, + &ctx->Pack, 0x0 /*image xfer ops*/); } /* format */ } /* row */ } /* img */ diff --git a/dist/Mesa/src/mesa/main/varray.c b/dist/Mesa/src/mesa/main/varray.c index a048509e5..56772e50f 100644 --- a/dist/Mesa/src/mesa/main/varray.c +++ b/dist/Mesa/src/mesa/main/varray.c @@ -76,7 +76,8 @@ update_array(GLcontext *ctx, struct gl_client_array *array, */ if (ctx->Array.ArrayBufferObj->Name) array->_MaxElement = ((GLsizeiptrARB) ctx->Array.ArrayBufferObj->Size - - (GLsizeiptrARB) array->Ptr) / array->StrideB; + - (GLsizeiptrARB) array->Ptr + array->StrideB + - elementSize) / array->StrideB; else #endif array->_MaxElement = 2 * 1000 * 1000 * 1000; /* just a big number */ @@ -442,7 +443,7 @@ void GLAPIENTRY _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { - const GLboolean normalized = GL_FALSE; + GLboolean normalized = GL_FALSE; GLsizei elementSize; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -470,6 +471,7 @@ _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, /* check for valid 'type' and compute StrideB right away */ switch (type) { case GL_UNSIGNED_BYTE: + normalized = GL_TRUE; elementSize = size * sizeof(GLubyte); break; case GL_SHORT: diff --git a/dist/Mesa/src/mesa/main/version.h b/dist/Mesa/src/mesa/main/version.h index 2d3c68bca..0bf7557e9 100644 --- a/dist/Mesa/src/mesa/main/version.h +++ b/dist/Mesa/src/mesa/main/version.h @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 7.0.2 + * Version: 7.0.3 * - * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 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"), @@ -30,8 +30,8 @@ /* Mesa version */ #define MESA_MAJOR 7 #define MESA_MINOR 0 -#define MESA_PATCH 2 -#define MESA_VERSION_STRING "7.0.2" +#define MESA_PATCH 3 +#define MESA_VERSION_STRING "7.0.3" /* To make version comparison easy */ #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) diff --git a/dist/Mesa/src/mesa/shader/arbprogparse.c b/dist/Mesa/src/mesa/shader/arbprogparse.c index 6a87a1779..f74f727b2 100644 --- a/dist/Mesa/src/mesa/shader/arbprogparse.c +++ b/dist/Mesa/src/mesa/shader/arbprogparse.c @@ -1609,8 +1609,6 @@ parse_attrib_binding(GLcontext * ctx, const GLubyte ** inst, program_error(ctx, Program->Position, "Bad attribute binding"); } - Program->Base.InputsRead |= (1 << *inputReg); - return err; } @@ -1759,7 +1757,7 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst, { GLint idx; GLuint err = 0; - gl_state_index state_tokens[STATE_LENGTH]; + gl_state_index state_tokens[STATE_LENGTH] = {0, 0, 0, 0, 0}; GLfloat const_values[4]; switch (*(*inst)++) { @@ -2565,6 +2563,11 @@ parse_src_reg (GLcontext * ctx, const GLubyte ** inst, return 1; } + /* Add attributes to InputsRead only if they are used the program. + * This avoids the handling of unused ATTRIB declarations in the drivers. */ + if (*File == PROGRAM_INPUT) + Program->Base.InputsRead |= (1 << *Index); + return 0; } @@ -3916,7 +3919,7 @@ _mesa_parse_arb_vertex_program(GLcontext *ctx, GLenum target, ASSERT(target == GL_VERTEX_PROGRAM_ARB); if (!_mesa_parse_arb_program(ctx, target, (const GLubyte*) str, len, &ap)) { - /* Error in the program. Just return. */ + _mesa_error(ctx, GL_INVALID_OPERATION, "glProgramString(bad program)"); return; } diff --git a/dist/Mesa/src/mesa/shader/arbprogram.c b/dist/Mesa/src/mesa/shader/arbprogram.c index 89f2d20cc..ee75be315 100644 --- a/dist/Mesa/src/mesa/shader/arbprogram.c +++ b/dist/Mesa/src/mesa/shader/arbprogram.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 7.0 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 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"), @@ -36,6 +36,7 @@ #include "imports.h" #include "macros.h" #include "mtypes.h" +#include "program.h" void GLAPIENTRY @@ -101,7 +102,7 @@ _mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); - if (index == 0 || index >= MAX_VERTEX_PROGRAM_ATTRIBS) { + if (index >= MAX_VERTEX_PROGRAM_ATTRIBS) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribfvARB(index)"); return; } @@ -123,6 +124,11 @@ _mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params) params[0] = ctx->Array.ArrayObj->VertexAttrib[index].Normalized; break; case GL_CURRENT_VERTEX_ATTRIB_ARB: + if (index == 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetVertexAttribfvARB(index==0)"); + return; + } FLUSH_CURRENT(ctx, 0); COPY_4V(params, ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index]); break; @@ -179,6 +185,31 @@ _mesa_GetVertexAttribPointervARB(GLuint index, GLenum pname, GLvoid **pointer) } +/** + * Determine if id names a vertex or fragment program. + * \note Not compiled into display lists. + * \note Called from both glIsProgramNV and glIsProgramARB. + * \param id is the program identifier + * \return GL_TRUE if id is a program, else GL_FALSE. + */ +GLboolean GLAPIENTRY +_mesa_IsProgramARB(GLuint id) +{ + struct gl_program *prog = NULL; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); + + if (id == 0) + return GL_FALSE; + + prog = _mesa_lookup_program(ctx, id); + if (prog && (prog != &_mesa_DummyProgram)) + return GL_TRUE; + else + return GL_FALSE; +} + + void GLAPIENTRY _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len, const GLvoid *string) @@ -198,7 +229,7 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len, struct gl_vertex_program *prog = ctx->VertexProgram.Current; _mesa_parse_arb_vertex_program(ctx, target, string, len, prog); - if (ctx->Driver.ProgramStringNotify) + if (ctx->Program.ErrorPos == -1 && ctx->Driver.ProgramStringNotify) ctx->Driver.ProgramStringNotify( ctx, target, &prog->Base ); } else if (target == GL_FRAGMENT_PROGRAM_ARB @@ -206,7 +237,7 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len, struct gl_fragment_program *prog = ctx->FragmentProgram.Current; _mesa_parse_arb_fragment_program(ctx, target, string, len, prog); - if (ctx->Driver.ProgramStringNotify) + if (ctx->Program.ErrorPos == -1 && ctx->Driver.ProgramStringNotify) ctx->Driver.ProgramStringNotify( ctx, target, &prog->Base ); } else { @@ -281,7 +312,7 @@ _mesa_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count, const GLfloat *params) { GET_CURRENT_CONTEXT(ctx); - unsigned i; + GLint i; GLfloat * dest; ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -433,7 +464,7 @@ _mesa_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count, { GET_CURRENT_CONTEXT(ctx); struct gl_program *prog; - unsigned i; + GLint i; ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, _NEW_PROGRAM); @@ -672,10 +703,18 @@ _mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params) * The spec says that even if this query returns true, there's * no guarantee that the program will run in hardware. */ - if (ctx->Driver.IsProgramNative) + if (prog->Id == 0) { + /* default/null program */ + *params = GL_FALSE; + } + else if (ctx->Driver.IsProgramNative) { + /* ask the driver */ *params = ctx->Driver.IsProgramNative( ctx, target, prog ); - else + } + else { + /* probably running in software */ *params = GL_TRUE; + } return; default: /* continue with fragment-program only queries below */ @@ -689,22 +728,22 @@ _mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params) const struct gl_fragment_program *fp = ctx->FragmentProgram.Current; switch (pname) { case GL_PROGRAM_ALU_INSTRUCTIONS_ARB: - *params = fp->NumNativeAluInstructions; + *params = fp->Base.NumNativeAluInstructions; return; case GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB: - *params = fp->NumAluInstructions; + *params = fp->Base.NumAluInstructions; return; case GL_PROGRAM_TEX_INSTRUCTIONS_ARB: - *params = fp->NumTexInstructions; + *params = fp->Base.NumTexInstructions; return; case GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB: - *params = fp->NumNativeTexInstructions; + *params = fp->Base.NumNativeTexInstructions; return; case GL_PROGRAM_TEX_INDIRECTIONS_ARB: - *params = fp->NumTexIndirections; + *params = fp->Base.NumTexIndirections; return; case GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB: - *params = fp->NumNativeTexIndirections; + *params = fp->Base.NumNativeTexIndirections; return; case GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB: *params = limits->MaxAluInstructions; @@ -736,6 +775,7 @@ void GLAPIENTRY _mesa_GetProgramStringARB(GLenum target, GLenum pname, GLvoid *string) { const struct gl_program *prog; + char *dst = (char *) string; GET_CURRENT_CONTEXT(ctx); if (!ctx->_CurrentProgram) @@ -759,5 +799,8 @@ _mesa_GetProgramStringARB(GLenum target, GLenum pname, GLvoid *string) return; } - _mesa_memcpy(string, prog->String, _mesa_strlen((char *) prog->String)); + if (prog->String) + _mesa_memcpy(dst, prog->String, _mesa_strlen((char *) prog->String)); + else + *dst = '\0'; } diff --git a/dist/Mesa/src/mesa/shader/arbprogram_syn.h b/dist/Mesa/src/mesa/shader/arbprogram_syn.h index c67afc67d..106fa5b00 100644 --- a/dist/Mesa/src/mesa/shader/arbprogram_syn.h +++ b/dist/Mesa/src/mesa/shader/arbprogram_syn.h @@ -905,6 +905,8 @@ "stateTexEnvProperty\n" " \"color\" .emit TEX_ENV_COLOR;\n" "optLegacyTexUnitNum\n" +" optLegacyTexUnitNum_1 .or .true .emit 0x00;\n" +"optLegacyTexUnitNum_1\n" " lbracket_ne .and legacyTexUnitNum .and rbracket;\n" "legacyTexUnitNum\n" " integer;\n" @@ -1221,11 +1223,11 @@ "white_char\n" " ' ' .or '\\t' .or '\\n' .or '\\r';\n" "comment_block\n" -" '#' .and .loop comment_char .and new_line;\n" +" '#' .and .loop comment_char .and optional_new_line;\n" "comment_char\n" " '\\x0E'-'\\xFF' .or '\\x01'-'\\x09' .or '\\x0B'-'\\x0C';\n" -"new_line\n" -" '\\n' .or crlf .or '\\0';\n" +"optional_new_line\n" +" '\\n' .or crlf .or .true;\n" "crlf\n" " '\\r' .and '\\n';\n" "semicolon\n" diff --git a/dist/Mesa/src/mesa/shader/prog_execute.c b/dist/Mesa/src/mesa/shader/prog_execute.c index 9faf9d861..f4a12af3e 100644 --- a/dist/Mesa/src/mesa/shader/prog_execute.c +++ b/dist/Mesa/src/mesa/shader/prog_execute.c @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 6.5.3 + * Version: 7.0.3 * * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * @@ -46,9 +46,6 @@ #include "slang_library_noise.h" -/* See comments below for info about this */ -#define LAMBDA_ZERO 1 - /* debug predicate */ #define DEBUG_PROG 0 @@ -303,6 +300,36 @@ fetch_vector1(const struct prog_src_register *source, /** + * Fetch texel from texture. Use partial derivatives when possible. + */ +static INLINE void +fetch_texel(GLcontext *ctx, + const struct gl_program_machine *machine, + const struct prog_instruction *inst, + const GLfloat texcoord[4], GLfloat lodBias, + GLfloat color[4]) +{ + /* Note: we only have the right derivatives for fragment input attribs. + */ + if (machine->NumDeriv > 0 && + inst->SrcReg[0].File == PROGRAM_INPUT && + inst->SrcReg[0].Index == FRAG_ATTRIB_TEX0 + inst->TexSrcUnit) { + /* simple texture fetch for which we should have derivatives */ + GLuint attr = inst->SrcReg[0].Index; + machine->FetchTexelDeriv(ctx, texcoord, + machine->DerivX[attr], + machine->DerivY[attr], + lodBias, + inst->TexSrcUnit, color); + } + else { + machine->FetchTexelLod(ctx, texcoord, lodBias, + inst->TexSrcUnit, color); + } +} + + +/** * Test value against zero and return GT, LT, EQ or UN if NaN. */ static INLINE GLuint @@ -1306,33 +1333,18 @@ _mesa_execute_program(GLcontext * ctx, } break; case OPCODE_TEX: /* Both ARB and NV frag prog */ - /* Texel lookup */ + /* Simple texel lookup */ { - /* Note: only use the precomputed lambda value when we're - * sampling texture unit [K] with texcoord[K]. - * Otherwise, the lambda value may have no relation to the - * instruction's texcoord or texture image. Using the wrong - * lambda is usually bad news. - * The rest of the time, just use zero (until we get a more - * sophisticated way of computing lambda). - */ - GLfloat coord[4], color[4], lambda; -#if 0 - if (inst->SrcReg[0].File == PROGRAM_INPUT && - inst->SrcReg[0].Index == FRAG_ATTRIB_TEX0 + inst->TexSrcUnit) - lambda = span->array->lambda[inst->TexSrcUnit][column]; - else -#endif - lambda = 0.0; - fetch_vector4(&inst->SrcReg[0], machine, coord); - machine->FetchTexelLod(ctx, coord, lambda, inst->TexSrcUnit, - color); + GLfloat texcoord[4], color[4]; + fetch_vector4(&inst->SrcReg[0], machine, texcoord); + + fetch_texel(ctx, machine, inst, texcoord, 0.0, color); + if (DEBUG_PROG) { - printf("TEX (%g, %g, %g, %g) = texture[%d][%g, %g, %g, %g], " - "lod %f\n", + printf("TEX (%g, %g, %g, %g) = texture[%d][%g, %g, %g, %g]\n", color[0], color[1], color[2], color[3], inst->TexSrcUnit, - coord[0], coord[1], coord[2], coord[3], lambda); + texcoord[0], texcoord[1], texcoord[2], texcoord[3]); } store_vector4(inst, machine, color); } @@ -1342,21 +1354,18 @@ _mesa_execute_program(GLcontext * ctx, { const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[inst->TexSrcUnit]; - GLfloat coord[4], color[4], lambda, bias; -#if 0 - if (inst->SrcReg[0].File == PROGRAM_INPUT && - inst->SrcReg[0].Index == FRAG_ATTRIB_TEX0 + inst->TexSrcUnit) - lambda = span->array->lambda[inst->TexSrcUnit][column]; - else -#endif - lambda = 0.0; - fetch_vector4(&inst->SrcReg[0], machine, coord); - /* coord[3] is the bias to add to lambda */ - bias = texUnit->LodBias + coord[3]; - if (texUnit->_Current) - bias += texUnit->_Current->LodBias; - machine->FetchTexelLod(ctx, coord, lambda + bias, - inst->TexSrcUnit, color); + GLfloat texcoord[4], color[4], lodBias; + + fetch_vector4(&inst->SrcReg[0], machine, texcoord); + + /* texcoord[3] is the bias to add to lambda */ + lodBias = texUnit->LodBias + texcoord[3]; + if (texUnit->_Current) { + lodBias += texUnit->_Current->LodBias; + } + + fetch_texel(ctx, machine, inst, texcoord, lodBias, color); + store_vector4(inst, machine, color); } break; @@ -1368,6 +1377,7 @@ _mesa_execute_program(GLcontext * ctx, fetch_vector4(&inst->SrcReg[1], machine, dtdx); fetch_vector4(&inst->SrcReg[2], machine, dtdy); machine->FetchTexelDeriv(ctx, texcoord, dtdx, dtdy, + 0.0, /* lodBias */ inst->TexSrcUnit, color); store_vector4(inst, machine, color); } @@ -1375,14 +1385,8 @@ _mesa_execute_program(GLcontext * ctx, case OPCODE_TXP: /* GL_ARB_fragment_program only */ /* Texture lookup w/ projective divide */ { - GLfloat texcoord[4], color[4], lambda; -#if 0 - if (inst->SrcReg[0].File == PROGRAM_INPUT && - inst->SrcReg[0].Index == FRAG_ATTRIB_TEX0 + inst->TexSrcUnit) - lambda = span->array->lambda[inst->TexSrcUnit][column]; - else -#endif - lambda = 0.0; + GLfloat texcoord[4], color[4]; + fetch_vector4(&inst->SrcReg[0], machine, texcoord); /* Not so sure about this test - if texcoord[3] is * zero, we'd probably be fine except for an ASSERT in @@ -1393,22 +1397,19 @@ _mesa_execute_program(GLcontext * ctx, texcoord[1] /= texcoord[3]; texcoord[2] /= texcoord[3]; } - machine->FetchTexelLod(ctx, texcoord, lambda, - inst->TexSrcUnit, color); + + fetch_texel(ctx, machine, inst, texcoord, 0.0, color); + store_vector4(inst, machine, color); } break; case OPCODE_TXP_NV: /* GL_NV_fragment_program only */ - /* Texture lookup w/ projective divide */ + /* Texture lookup w/ projective divide, as above, but do not + * do the divide by w if sampling from a cube map. + */ { - GLfloat texcoord[4], color[4], lambda; -#if 0 - if (inst->SrcReg[0].File == PROGRAM_INPUT && - inst->SrcReg[0].Index == FRAG_ATTRIB_TEX0 + inst->TexSrcUnit) - lambda = span->array->lambda[inst->TexSrcUnit][column]; - else -#endif - lambda = 0.0; + GLfloat texcoord[4], color[4]; + fetch_vector4(&inst->SrcReg[0], machine, texcoord); if (inst->TexSrcTarget != TEXTURE_CUBE_INDEX && texcoord[3] != 0.0) { @@ -1416,8 +1417,9 @@ _mesa_execute_program(GLcontext * ctx, texcoord[1] /= texcoord[3]; texcoord[2] /= texcoord[3]; } - machine->FetchTexelLod(ctx, texcoord, lambda, - inst->TexSrcUnit, color); + + fetch_texel(ctx, machine, inst, texcoord, 0.0, color); + store_vector4(inst, machine, color); } break; diff --git a/dist/Mesa/src/mesa/shader/prog_execute.h b/dist/Mesa/src/mesa/shader/prog_execute.h index be29eceed..3ea0ba156 100644 --- a/dist/Mesa/src/mesa/shader/prog_execute.h +++ b/dist/Mesa/src/mesa/shader/prog_execute.h @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 6.5.3 + * Version: 7.0.3 * * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * @@ -32,6 +32,7 @@ typedef void (*FetchTexelLodFunc)(GLcontext *ctx, const GLfloat texcoord[4], typedef void (*FetchTexelDerivFunc)(GLcontext *ctx, const GLfloat texcoord[4], const GLfloat texdx[4], const GLfloat texdy[4], + GLfloat lodBias, GLuint unit, GLfloat color[4]); diff --git a/dist/Mesa/src/mesa/shader/prog_parameter.c b/dist/Mesa/src/mesa/shader/prog_parameter.c index 9e3d3fecf..46d30872e 100644 --- a/dist/Mesa/src/mesa/shader/prog_parameter.c +++ b/dist/Mesa/src/mesa/shader/prog_parameter.c @@ -384,7 +384,7 @@ sizeof_state_reference(const GLint *stateTokens) * PARAM ambient = state.material.front.ambient; * * \param paramList the parameter list - * \param state an array of 6 (STATE_LENGTH) state tokens + * \param stateTokens an array of 5 (STATE_LENGTH) state tokens * \return index of the new parameter. */ GLint diff --git a/dist/Mesa/src/mesa/shader/prog_statevars.c b/dist/Mesa/src/mesa/shader/prog_statevars.c index d37d7fb9b..05daa8011 100644 --- a/dist/Mesa/src/mesa/shader/prog_statevars.c +++ b/dist/Mesa/src/mesa/shader/prog_statevars.c @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 7.0 + * Version: 7.1 * * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * @@ -181,7 +181,7 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_AMBIENT+face][i]; } /* [3] = material alpha */ - value[3] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE+face][3]; + value[3] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_AMBIENT+face][3]; return; case STATE_DIFFUSE: for (i = 0; i < 3; i++) { @@ -197,7 +197,7 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_SPECULAR+face][i]; } /* [3] = material alpha */ - value[3] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE+face][3]; + value[3] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_SPECULAR+face][3]; return; default: _mesa_problem(ctx, "Invalid lightprod state in fetch_state"); @@ -349,7 +349,7 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], value[0] = ctx->Viewport.Near; /* near */ value[1] = ctx->Viewport.Far; /* far */ value[2] = ctx->Viewport.Far - ctx->Viewport.Near; /* far - near */ - value[3] = 0; + value[3] = 1.0; return; case STATE_FRAGMENT_PROGRAM: { @@ -824,3 +824,94 @@ _mesa_load_state_parameters(GLcontext *ctx, } } + +/** + * Copy the 16 elements of a matrix into four consecutive program + * registers starting at 'pos'. + */ +static void +load_matrix(GLfloat registers[][4], GLuint pos, const GLfloat mat[16]) +{ + GLuint i; + for (i = 0; i < 4; i++) { + registers[pos + i][0] = mat[0 + i]; + registers[pos + i][1] = mat[4 + i]; + registers[pos + i][2] = mat[8 + i]; + registers[pos + i][3] = mat[12 + i]; + } +} + + +/** + * As above, but transpose the matrix. + */ +static void +load_transpose_matrix(GLfloat registers[][4], GLuint pos, + const GLfloat mat[16]) +{ + MEMCPY(registers[pos], mat, 16 * sizeof(GLfloat)); +} + + +/** + * Load current vertex program's parameter registers with tracked + * matrices (if NV program). This only needs to be done per + * glBegin/glEnd, not per-vertex. + */ +void +_mesa_load_tracked_matrices(GLcontext *ctx) +{ + GLuint i; + + for (i = 0; i < MAX_NV_VERTEX_PROGRAM_PARAMS / 4; i++) { + /* point 'mat' at source matrix */ + GLmatrix *mat; + if (ctx->VertexProgram.TrackMatrix[i] == GL_MODELVIEW) { + mat = ctx->ModelviewMatrixStack.Top; + } + else if (ctx->VertexProgram.TrackMatrix[i] == GL_PROJECTION) { + mat = ctx->ProjectionMatrixStack.Top; + } + else if (ctx->VertexProgram.TrackMatrix[i] == GL_TEXTURE) { + mat = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top; + } + else if (ctx->VertexProgram.TrackMatrix[i] == GL_COLOR) { + mat = ctx->ColorMatrixStack.Top; + } + else if (ctx->VertexProgram.TrackMatrix[i]==GL_MODELVIEW_PROJECTION_NV) { + /* XXX verify the combined matrix is up to date */ + mat = &ctx->_ModelProjectMatrix; + } + else if (ctx->VertexProgram.TrackMatrix[i] >= GL_MATRIX0_NV && + ctx->VertexProgram.TrackMatrix[i] <= GL_MATRIX7_NV) { + GLuint n = ctx->VertexProgram.TrackMatrix[i] - GL_MATRIX0_NV; + ASSERT(n < MAX_PROGRAM_MATRICES); + mat = ctx->ProgramMatrixStack[n].Top; + } + else { + /* no matrix is tracked, but we leave the register values as-is */ + assert(ctx->VertexProgram.TrackMatrix[i] == GL_NONE); + continue; + } + + /* load the matrix values into sequential registers */ + if (ctx->VertexProgram.TrackMatrixTransform[i] == GL_IDENTITY_NV) { + load_matrix(ctx->VertexProgram.Parameters, i*4, mat->m); + } + else if (ctx->VertexProgram.TrackMatrixTransform[i] == GL_INVERSE_NV) { + _math_matrix_analyse(mat); /* update the inverse */ + ASSERT(!_math_matrix_is_dirty(mat)); + load_matrix(ctx->VertexProgram.Parameters, i*4, mat->inv); + } + else if (ctx->VertexProgram.TrackMatrixTransform[i] == GL_TRANSPOSE_NV) { + load_transpose_matrix(ctx->VertexProgram.Parameters, i*4, mat->m); + } + else { + assert(ctx->VertexProgram.TrackMatrixTransform[i] + == GL_INVERSE_TRANSPOSE_NV); + _math_matrix_analyse(mat); /* update the inverse */ + ASSERT(!_math_matrix_is_dirty(mat)); + load_transpose_matrix(ctx->VertexProgram.Parameters, i*4, mat->inv); + } + } +} diff --git a/dist/Mesa/src/mesa/shader/prog_statevars.h b/dist/Mesa/src/mesa/shader/prog_statevars.h index 3281a4a2a..22bb8e07a 100644 --- a/dist/Mesa/src/mesa/shader/prog_statevars.h +++ b/dist/Mesa/src/mesa/shader/prog_statevars.h @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.2 + * Version: 7.1 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 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"), @@ -126,4 +126,8 @@ extern const char * _mesa_program_state_string(const gl_state_index state[STATE_LENGTH]); +extern void +_mesa_load_tracked_matrices(GLcontext *ctx); + + #endif /* PROG_STATEVARS_H */ diff --git a/dist/Mesa/src/mesa/shader/program.c b/dist/Mesa/src/mesa/shader/program.c index 590f357b6..95cabe732 100644 --- a/dist/Mesa/src/mesa/shader/program.c +++ b/dist/Mesa/src/mesa/shader/program.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.1 + * Version: 6.5.3 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 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"), @@ -32,29 +32,13 @@ #include "glheader.h" #include "context.h" #include "hash.h" -#include "imports.h" -#include "macros.h" -#include "mtypes.h" #include "program.h" -#include "nvfragparse.h" -#include "program_instruction.h" -#include "nvvertparse.h" -#include "atifragshader.h" +#include "prog_parameter.h" +#include "prog_instruction.h" -static const char * -make_state_string(const GLint stateTokens[6]); - -static GLuint -make_state_flags(const GLint state[]); - - -/**********************************************************************/ -/* Utility functions */ -/**********************************************************************/ - - -/* A pointer to this dummy program is put into the hash table when +/** + * A pointer to this dummy program is put into the hash table when * glGenPrograms is called. */ struct gl_program _mesa_DummyProgram; @@ -203,10 +187,12 @@ _mesa_init_program_struct( GLcontext *ctx, struct gl_program *prog, { (void) ctx; if (prog) { + _mesa_bzero(prog, sizeof(*prog)); prog->Id = id; prog->Target = target; prog->Resident = GL_TRUE; prog->RefCount = 1; + prog->Format = GL_PROGRAM_FORMAT_ASCII_ARB; } return prog; @@ -284,6 +270,9 @@ _mesa_delete_program(GLcontext *ctx, struct gl_program *prog) (void) ctx; ASSERT(prog); + if (prog == &_mesa_DummyProgram) + return; + if (prog->String) _mesa_free(prog->String); @@ -292,6 +281,8 @@ _mesa_delete_program(GLcontext *ctx, struct gl_program *prog) for (i = 0; i < prog->NumInstructions; i++) { if (prog->Instructions[i].Data) _mesa_free(prog->Instructions[i].Data); + if (prog->Instructions[i].Comment) + _mesa_free((char *) prog->Instructions[i].Comment); } _mesa_free(prog->Instructions); } @@ -299,6 +290,12 @@ _mesa_delete_program(GLcontext *ctx, struct gl_program *prog) if (prog->Parameters) { _mesa_free_parameter_list(prog->Parameters); } + if (prog->Varying) { + _mesa_free_parameter_list(prog->Varying); + } + if (prog->Attributes) { + _mesa_free_parameter_list(prog->Attributes); + } /* XXX this is a little ugly */ if (prog->Target == GL_VERTEX_PROGRAM_ARB) { @@ -326,1421 +323,86 @@ _mesa_lookup_program(GLcontext *ctx, GLuint id) } -/**********************************************************************/ -/* Program parameter functions */ -/**********************************************************************/ - -struct gl_program_parameter_list * -_mesa_new_parameter_list(void) -{ - return (struct gl_program_parameter_list *) - _mesa_calloc(sizeof(struct gl_program_parameter_list)); -} - - /** - * Free a parameter list and all its parameters + * Return a copy of a program. + * XXX Problem here if the program object is actually OO-derivation + * made by a device driver. */ -void -_mesa_free_parameter_list(struct gl_program_parameter_list *paramList) -{ - GLuint i; - for (i = 0; i < paramList->NumParameters; i++) { - if (paramList->Parameters[i].Name) - _mesa_free((void *) paramList->Parameters[i].Name); - } - _mesa_free(paramList->Parameters); - if (paramList->ParameterValues) - _mesa_align_free(paramList->ParameterValues); - _mesa_free(paramList); -} - - -/** - * Add a new parameter to a parameter list. - * \param paramList the list to add the parameter to - * \param name the parameter name, will be duplicated/copied! - * \param values initial parameter value, 4 GLfloats - * \param type type of parameter, such as - * \return index of new parameter in the list, or -1 if error (out of mem) - */ -static GLint -add_parameter(struct gl_program_parameter_list *paramList, - const char *name, const GLfloat values[4], - enum register_file type) -{ - const GLuint n = paramList->NumParameters; - - if (n == paramList->Size) { - /* Need to grow the parameter list array */ - if (paramList->Size == 0) - paramList->Size = 8; - else - paramList->Size *= 2; - - /* realloc arrays */ - paramList->Parameters = (struct gl_program_parameter *) - _mesa_realloc(paramList->Parameters, - n * sizeof(struct gl_program_parameter), - paramList->Size * sizeof(struct gl_program_parameter)); - - paramList->ParameterValues = (GLfloat (*)[4]) - _mesa_align_realloc(paramList->ParameterValues, /* old buf */ - n * 4 * sizeof(GLfloat), /* old size */ - paramList->Size * 4 *sizeof(GLfloat), /* new sz */ - 16); - } - - if (!paramList->Parameters || - !paramList->ParameterValues) { - /* out of memory */ - paramList->NumParameters = 0; - paramList->Size = 0; - return -1; - } - else { - paramList->NumParameters = n + 1; - - _mesa_memset(¶mList->Parameters[n], 0, - sizeof(struct gl_program_parameter)); - - paramList->Parameters[n].Name = name ? _mesa_strdup(name) : NULL; - paramList->Parameters[n].Type = type; - if (values) - COPY_4V(paramList->ParameterValues[n], values); - return (GLint) n; - } -} - - -/** - * Add a new named program parameter (Ex: NV_fragment_program DEFINE statement) - * \return index of the new entry in the parameter list - */ -GLint -_mesa_add_named_parameter(struct gl_program_parameter_list *paramList, - const char *name, const GLfloat values[4]) -{ - return add_parameter(paramList, name, values, PROGRAM_NAMED_PARAM); -} - - -/** - * Add a new named constant to the parameter list. - * This will be used when the program contains something like this: - * PARAM myVals = { 0, 1, 2, 3 }; - * - * \param paramList - the parameter list - * \param values - four float values - * \return index of the new parameter. - */ -GLint -_mesa_add_named_constant(struct gl_program_parameter_list *paramList, - const char *name, const GLfloat values[4]) -{ - return add_parameter(paramList, name, values, PROGRAM_CONSTANT); -} - - -/** - * Add a new unnamed constant to the parameter list. - * This will be used when the program contains something like this: - * MOV r, { 0, 1, 2, 3 }; - * - * \param paramList - the parameter list - * \param values - four float values - * \return index of the new parameter. - */ -GLint -_mesa_add_unnamed_constant(struct gl_program_parameter_list *paramList, - const GLfloat values[4]) -{ - return add_parameter(paramList, NULL, values, PROGRAM_CONSTANT); -} - - -/** - * Add a new state reference to the parameter list. - * This will be used when the program contains something like this: - * PARAM ambient = state.material.front.ambient; - * - * \param paramList - the parameter list - * \param state - an array of 6 state tokens - * \return index of the new parameter. - */ -GLint -_mesa_add_state_reference(struct gl_program_parameter_list *paramList, - const GLint *stateTokens) -{ - /* XXX we should probably search the current parameter list to see if - * the new state reference is already present. - */ - GLint index; - const char *name = make_state_string(stateTokens); - - index = add_parameter(paramList, name, NULL, PROGRAM_STATE_VAR); - if (index >= 0) { - GLuint i; - for (i = 0; i < 6; i++) { - paramList->Parameters[index].StateIndexes[i] - = (enum state_index) stateTokens[i]; - } - paramList->StateFlags |= - make_state_flags(stateTokens); - } - - /* free name string here since we duplicated it in add_parameter() */ - _mesa_free((void *) name); - - return index; -} - - -/** - * Lookup a parameter value by name in the given parameter list. - * \return pointer to the float[4] values. - */ -GLfloat * -_mesa_lookup_parameter_value(struct gl_program_parameter_list *paramList, - GLsizei nameLen, const char *name) +struct gl_program * +_mesa_clone_program(GLcontext *ctx, const struct gl_program *prog) { - GLuint i; + struct gl_program *clone; - if (!paramList) + clone = ctx->Driver.NewProgram(ctx, prog->Target, prog->Id); + if (!clone) return NULL; - if (nameLen == -1) { - /* name is null-terminated */ - for (i = 0; i < paramList->NumParameters; i++) { - if (paramList->Parameters[i].Name && - _mesa_strcmp(paramList->Parameters[i].Name, name) == 0) - return paramList->ParameterValues[i]; - } - } - else { - /* name is not null-terminated, use nameLen */ - for (i = 0; i < paramList->NumParameters; i++) { - if (paramList->Parameters[i].Name && - _mesa_strncmp(paramList->Parameters[i].Name, name, nameLen) == 0 - && _mesa_strlen(paramList->Parameters[i].Name) == (size_t)nameLen) - return paramList->ParameterValues[i]; - } - } - return NULL; -} - - -/** - * Lookup a parameter index by name in the given parameter list. - * \return index of parameter in the list. - */ -GLint -_mesa_lookup_parameter_index(struct gl_program_parameter_list *paramList, - GLsizei nameLen, const char *name) -{ - GLint i; - - if (!paramList) - return -1; - - if (nameLen == -1) { - /* name is null-terminated */ - for (i = 0; i < (GLint) paramList->NumParameters; i++) { - if (paramList->Parameters[i].Name && - _mesa_strcmp(paramList->Parameters[i].Name, name) == 0) - return i; - } - } - else { - /* name is not null-terminated, use nameLen */ - for (i = 0; i < (GLint) paramList->NumParameters; i++) { - if (paramList->Parameters[i].Name && - _mesa_strncmp(paramList->Parameters[i].Name, name, nameLen) == 0 - && _mesa_strlen(paramList->Parameters[i].Name) == (size_t)nameLen) - return i; - } + assert(clone->Target == prog->Target); + clone->String = (GLubyte *) _mesa_strdup((char *) prog->String); + clone->RefCount = 1; + clone->Format = prog->Format; + clone->Instructions = _mesa_alloc_instructions(prog->NumInstructions); + if (!clone->Instructions) { + ctx->Driver.DeleteProgram(ctx, clone); + return NULL; } - return -1; -} - - -/** - * Use the list of tokens in the state[] array to find global GL state - * and return it in <value>. Usually, four values are returned in <value> - * but matrix queries may return as many as 16 values. - * This function is used for ARB vertex/fragment programs. - * The program parser will produce the state[] values. - */ -static void -_mesa_fetch_state(GLcontext *ctx, const enum state_index state[], - GLfloat *value) -{ - switch (state[0]) { - case STATE_MATERIAL: + _mesa_copy_instructions(clone->Instructions, prog->Instructions, + prog->NumInstructions); + clone->InputsRead = prog->InputsRead; + clone->OutputsWritten = prog->OutputsWritten; + memcpy(clone->TexturesUsed, prog->TexturesUsed, sizeof(prog->TexturesUsed)); + + if (prog->Parameters) + clone->Parameters = _mesa_clone_parameter_list(prog->Parameters); + memcpy(clone->LocalParams, prog->LocalParams, sizeof(clone->LocalParams)); + if (prog->Varying) + clone->Varying = _mesa_clone_parameter_list(prog->Varying); + if (prog->Attributes) + clone->Attributes = _mesa_clone_parameter_list(prog->Attributes); + memcpy(clone->LocalParams, prog->LocalParams, sizeof(clone->LocalParams)); + clone->NumInstructions = prog->NumInstructions; + clone->NumTemporaries = prog->NumTemporaries; + clone->NumParameters = prog->NumParameters; + clone->NumAttributes = prog->NumAttributes; + clone->NumAddressRegs = prog->NumAddressRegs; + clone->NumNativeInstructions = prog->NumNativeInstructions; + clone->NumNativeTemporaries = prog->NumNativeTemporaries; + clone->NumNativeParameters = prog->NumNativeParameters; + clone->NumNativeAttributes = prog->NumNativeAttributes; + clone->NumNativeAddressRegs = prog->NumNativeAddressRegs; + clone->NumAluInstructions = prog->NumAluInstructions; + clone->NumTexInstructions = prog->NumTexInstructions; + clone->NumTexIndirections = prog->NumTexIndirections; + clone->NumNativeAluInstructions = prog->NumNativeAluInstructions; + clone->NumNativeTexInstructions = prog->NumNativeTexInstructions; + clone->NumNativeTexIndirections = prog->NumNativeTexIndirections; + + switch (prog->Target) { + case GL_VERTEX_PROGRAM_ARB: { - /* state[1] is either 0=front or 1=back side */ - const GLuint face = (GLuint) state[1]; - /* state[2] is the material attribute */ - switch (state[2]) { - case STATE_AMBIENT: - if (face == 0) - COPY_4V(value, ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_AMBIENT]); - else - COPY_4V(value, ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_AMBIENT]); - return; - case STATE_DIFFUSE: - if (face == 0) - COPY_4V(value, ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE]); - else - COPY_4V(value, ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE]); - return; - case STATE_SPECULAR: - if (face == 0) - COPY_4V(value, ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_SPECULAR]); - else - COPY_4V(value, ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_SPECULAR]); - return; - case STATE_EMISSION: - if (face == 0) - COPY_4V(value, ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_EMISSION]); - else - COPY_4V(value, ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_EMISSION]); - return; - case STATE_SHININESS: - if (face == 0) - value[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_SHININESS][0]; - else - value[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_SHININESS][0]; - value[1] = 0.0F; - value[2] = 0.0F; - value[3] = 1.0F; - return; - default: - _mesa_problem(ctx, "Invalid material state in fetch_state"); - return; - } - } - case STATE_LIGHT: - { - /* state[1] is the light number */ - const GLuint ln = (GLuint) state[1]; - /* state[2] is the light attribute */ - switch (state[2]) { - case STATE_AMBIENT: - COPY_4V(value, ctx->Light.Light[ln].Ambient); - return; - case STATE_DIFFUSE: - COPY_4V(value, ctx->Light.Light[ln].Diffuse); - return; - case STATE_SPECULAR: - COPY_4V(value, ctx->Light.Light[ln].Specular); - return; - case STATE_POSITION: - COPY_4V(value, ctx->Light.Light[ln].EyePosition); - return; - case STATE_ATTENUATION: - value[0] = ctx->Light.Light[ln].ConstantAttenuation; - value[1] = ctx->Light.Light[ln].LinearAttenuation; - value[2] = ctx->Light.Light[ln].QuadraticAttenuation; - value[3] = ctx->Light.Light[ln].SpotExponent; - return; - case STATE_SPOT_DIRECTION: - COPY_3V(value, ctx->Light.Light[ln].EyeDirection); - value[3] = ctx->Light.Light[ln]._CosCutoff; - return; - case STATE_HALF: - { - GLfloat eye_z[] = {0, 0, 1}; - - /* Compute infinite half angle vector: - * half-vector = light_position + (0, 0, 1) - * and then normalize. w = 0 - * - * light.EyePosition.w should be 0 for infinite lights. - */ - ADD_3V(value, eye_z, ctx->Light.Light[ln].EyePosition); - NORMALIZE_3FV(value); - value[3] = 0; - } - return; - case STATE_POSITION_NORMALIZED: - COPY_4V(value, ctx->Light.Light[ln].EyePosition); - NORMALIZE_3FV( value ); - return; - default: - _mesa_problem(ctx, "Invalid light state in fetch_state"); - return; - } - } - case STATE_LIGHTMODEL_AMBIENT: - COPY_4V(value, ctx->Light.Model.Ambient); - return; - case STATE_LIGHTMODEL_SCENECOLOR: - if (state[1] == 0) { - /* front */ - GLint i; - for (i = 0; i < 3; i++) { - value[i] = ctx->Light.Model.Ambient[i] - * ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_AMBIENT][i] - + ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_EMISSION][i]; - } - value[3] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3]; - } - else { - /* back */ - GLint i; - for (i = 0; i < 3; i++) { - value[i] = ctx->Light.Model.Ambient[i] - * ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_AMBIENT][i] - + ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_EMISSION][i]; - } - value[3] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; - } - return; - case STATE_LIGHTPROD: - { - const GLuint ln = (GLuint) state[1]; - const GLuint face = (GLuint) state[2]; - GLint i; - ASSERT(face == 0 || face == 1); - switch (state[3]) { - case STATE_AMBIENT: - for (i = 0; i < 3; i++) { - value[i] = ctx->Light.Light[ln].Ambient[i] * - ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_AMBIENT+face][i]; - } - /* [3] = material alpha */ - value[3] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE+face][3]; - return; - case STATE_DIFFUSE: - for (i = 0; i < 3; i++) { - value[i] = ctx->Light.Light[ln].Diffuse[i] * - ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE+face][i]; - } - /* [3] = material alpha */ - value[3] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE+face][3]; - return; - case STATE_SPECULAR: - for (i = 0; i < 3; i++) { - value[i] = ctx->Light.Light[ln].Specular[i] * - ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_SPECULAR+face][i]; - } - /* [3] = material alpha */ - value[3] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE+face][3]; - return; - default: - _mesa_problem(ctx, "Invalid lightprod state in fetch_state"); - return; - } - } - case STATE_TEXGEN: - { - /* state[1] is the texture unit */ - const GLuint unit = (GLuint) state[1]; - /* state[2] is the texgen attribute */ - switch (state[2]) { - case STATE_TEXGEN_EYE_S: - COPY_4V(value, ctx->Texture.Unit[unit].EyePlaneS); - return; - case STATE_TEXGEN_EYE_T: - COPY_4V(value, ctx->Texture.Unit[unit].EyePlaneT); - return; - case STATE_TEXGEN_EYE_R: - COPY_4V(value, ctx->Texture.Unit[unit].EyePlaneR); - return; - case STATE_TEXGEN_EYE_Q: - COPY_4V(value, ctx->Texture.Unit[unit].EyePlaneQ); - return; - case STATE_TEXGEN_OBJECT_S: - COPY_4V(value, ctx->Texture.Unit[unit].ObjectPlaneS); - return; - case STATE_TEXGEN_OBJECT_T: - COPY_4V(value, ctx->Texture.Unit[unit].ObjectPlaneT); - return; - case STATE_TEXGEN_OBJECT_R: - COPY_4V(value, ctx->Texture.Unit[unit].ObjectPlaneR); - return; - case STATE_TEXGEN_OBJECT_Q: - COPY_4V(value, ctx->Texture.Unit[unit].ObjectPlaneQ); - return; - default: - _mesa_problem(ctx, "Invalid texgen state in fetch_state"); - return; - } - } - case STATE_TEXENV_COLOR: - { - /* state[1] is the texture unit */ - const GLuint unit = (GLuint) state[1]; - COPY_4V(value, ctx->Texture.Unit[unit].EnvColor); - } - return; - case STATE_FOG_COLOR: - COPY_4V(value, ctx->Fog.Color); - return; - case STATE_FOG_PARAMS: - value[0] = ctx->Fog.Density; - value[1] = ctx->Fog.Start; - value[2] = ctx->Fog.End; - value[3] = 1.0F / (ctx->Fog.End - ctx->Fog.Start); - return; - case STATE_CLIPPLANE: - { - const GLuint plane = (GLuint) state[1]; - COPY_4V(value, ctx->Transform.EyeUserPlane[plane]); - } - return; - case STATE_POINT_SIZE: - value[0] = ctx->Point.Size; - value[1] = ctx->Point.MinSize; - value[2] = ctx->Point.MaxSize; - value[3] = ctx->Point.Threshold; - return; - case STATE_POINT_ATTENUATION: - value[0] = ctx->Point.Params[0]; - value[1] = ctx->Point.Params[1]; - value[2] = ctx->Point.Params[2]; - value[3] = 1.0F; - return; - case STATE_MATRIX: - { - /* state[1] = modelview, projection, texture, etc. */ - /* state[2] = which texture matrix or program matrix */ - /* state[3] = first column to fetch */ - /* state[4] = last column to fetch */ - /* state[5] = transpose, inverse or invtrans */ - - const GLmatrix *matrix; - const enum state_index mat = state[1]; - const GLuint index = (GLuint) state[2]; - const GLuint first = (GLuint) state[3]; - const GLuint last = (GLuint) state[4]; - const enum state_index modifier = state[5]; - const GLfloat *m; - GLuint row, i; - if (mat == STATE_MODELVIEW) { - matrix = ctx->ModelviewMatrixStack.Top; - } - else if (mat == STATE_PROJECTION) { - matrix = ctx->ProjectionMatrixStack.Top; - } - else if (mat == STATE_MVP) { - matrix = &ctx->_ModelProjectMatrix; - } - else if (mat == STATE_TEXTURE) { - matrix = ctx->TextureMatrixStack[index].Top; - } - else if (mat == STATE_PROGRAM) { - matrix = ctx->ProgramMatrixStack[index].Top; - } - else { - _mesa_problem(ctx, "Bad matrix name in _mesa_fetch_state()"); - return; - } - if (modifier == STATE_MATRIX_INVERSE || - modifier == STATE_MATRIX_INVTRANS) { - /* Be sure inverse is up to date: - */ - _math_matrix_alloc_inv( (GLmatrix *) matrix ); - _math_matrix_analyse( (GLmatrix*) matrix ); - m = matrix->inv; - } - else { - m = matrix->m; - } - if (modifier == STATE_MATRIX_TRANSPOSE || - modifier == STATE_MATRIX_INVTRANS) { - for (i = 0, row = first; row <= last; row++) { - value[i++] = m[row * 4 + 0]; - value[i++] = m[row * 4 + 1]; - value[i++] = m[row * 4 + 2]; - value[i++] = m[row * 4 + 3]; - } - } - else { - for (i = 0, row = first; row <= last; row++) { - value[i++] = m[row + 0]; - value[i++] = m[row + 4]; - value[i++] = m[row + 8]; - value[i++] = m[row + 12]; - } - } - } - return; - case STATE_DEPTH_RANGE: - value[0] = ctx->Viewport.Near; /* near */ - value[1] = ctx->Viewport.Far; /* far */ - value[2] = ctx->Viewport.Far - ctx->Viewport.Near; /* far - near */ - value[3] = 0; - return; - case STATE_FRAGMENT_PROGRAM: - { - /* state[1] = {STATE_ENV, STATE_LOCAL} */ - /* state[2] = parameter index */ - const int idx = (int) state[2]; - switch (state[1]) { - case STATE_ENV: - COPY_4V(value, ctx->FragmentProgram.Parameters[idx]); - break; - case STATE_LOCAL: - COPY_4V(value, ctx->FragmentProgram.Current->Base.LocalParams[idx]); - break; - default: - _mesa_problem(ctx, "Bad state switch in _mesa_fetch_state()"); - return; - } - } - return; - - case STATE_VERTEX_PROGRAM: - { - /* state[1] = {STATE_ENV, STATE_LOCAL} */ - /* state[2] = parameter index */ - const int idx = (int) state[2]; - switch (state[1]) { - case STATE_ENV: - COPY_4V(value, ctx->VertexProgram.Parameters[idx]); - break; - case STATE_LOCAL: - COPY_4V(value, ctx->VertexProgram.Current->Base.LocalParams[idx]); - break; - default: - _mesa_problem(ctx, "Bad state switch in _mesa_fetch_state()"); - return; - } - } - return; - - case STATE_INTERNAL: - { - switch (state[1]) { - case STATE_NORMAL_SCALE: - ASSIGN_4V(value, ctx->_ModelViewInvScale, 0, 0, 1); - break; - default: - _mesa_problem(ctx, "Bad state switch in _mesa_fetch_state()"); - return; - } - } - return; - - default: - _mesa_problem(ctx, "Invalid state in _mesa_fetch_state"); - return; - } -} - - -/** - * Return a bit mask of the Mesa state flags under which a parameter's - * value might change. - */ -static GLuint make_state_flags(const GLint state[]) -{ - switch (state[0]) { - case STATE_MATERIAL: - case STATE_LIGHT: - case STATE_LIGHTMODEL_AMBIENT: - case STATE_LIGHTMODEL_SCENECOLOR: - case STATE_LIGHTPROD: - return _NEW_LIGHT; - - case STATE_TEXGEN: - case STATE_TEXENV_COLOR: - return _NEW_TEXTURE; - - case STATE_FOG_COLOR: - case STATE_FOG_PARAMS: - return _NEW_FOG; - - case STATE_CLIPPLANE: - return _NEW_TRANSFORM; - - case STATE_POINT_SIZE: - case STATE_POINT_ATTENUATION: - return _NEW_POINT; - - case STATE_MATRIX: - switch (state[1]) { - case STATE_MODELVIEW: - return _NEW_MODELVIEW; - case STATE_PROJECTION: - return _NEW_PROJECTION; - case STATE_MVP: - return _NEW_MODELVIEW | _NEW_PROJECTION; - case STATE_TEXTURE: - return _NEW_TEXTURE_MATRIX; - case STATE_PROGRAM: - return _NEW_TRACK_MATRIX; - default: - _mesa_problem(NULL, "unexpected matrix in make_state_flags()"); - return 0; - } - - case STATE_DEPTH_RANGE: - return _NEW_VIEWPORT; - - case STATE_FRAGMENT_PROGRAM: - case STATE_VERTEX_PROGRAM: - return _NEW_PROGRAM; - - case STATE_INTERNAL: - switch (state[1]) { - case STATE_NORMAL_SCALE: - return _NEW_MODELVIEW; - default: - _mesa_problem(NULL, "unexpected int. state in make_state_flags()"); - return 0; - } - - default: - _mesa_problem(NULL, "unexpected state[0] in make_state_flags()"); - return 0; - } -} - - -static void -append(char *dst, const char *src) -{ - while (*dst) - dst++; - while (*src) - *dst++ = *src++; - *dst = 0; -} - - -static void -append_token(char *dst, enum state_index k) -{ - switch (k) { - case STATE_MATERIAL: - append(dst, "material."); - break; - case STATE_LIGHT: - append(dst, "light"); - break; - case STATE_LIGHTMODEL_AMBIENT: - append(dst, "lightmodel.ambient"); - break; - case STATE_LIGHTMODEL_SCENECOLOR: - break; - case STATE_LIGHTPROD: - append(dst, "lightprod"); - break; - case STATE_TEXGEN: - append(dst, "texgen"); - break; - case STATE_FOG_COLOR: - append(dst, "fog.color"); - break; - case STATE_FOG_PARAMS: - append(dst, "fog.params"); - break; - case STATE_CLIPPLANE: - append(dst, "clip"); - break; - case STATE_POINT_SIZE: - append(dst, "point.size"); - break; - case STATE_POINT_ATTENUATION: - append(dst, "point.attenuation"); - break; - case STATE_MATRIX: - append(dst, "matrix."); - break; - case STATE_MODELVIEW: - append(dst, "modelview"); - break; - case STATE_PROJECTION: - append(dst, "projection"); - break; - case STATE_MVP: - append(dst, "mvp"); - break; - case STATE_TEXTURE: - append(dst, "texture"); - break; - case STATE_PROGRAM: - append(dst, "program"); - break; - case STATE_MATRIX_INVERSE: - append(dst, ".inverse"); - break; - case STATE_MATRIX_TRANSPOSE: - append(dst, ".transpose"); - break; - case STATE_MATRIX_INVTRANS: - append(dst, ".invtrans"); - break; - case STATE_AMBIENT: - append(dst, "ambient"); - break; - case STATE_DIFFUSE: - append(dst, "diffuse"); - break; - case STATE_SPECULAR: - append(dst, "specular"); - break; - case STATE_EMISSION: - append(dst, "emission"); - break; - case STATE_SHININESS: - append(dst, "shininess"); - break; - case STATE_HALF: - append(dst, "half"); - break; - case STATE_POSITION: - append(dst, ".position"); - break; - case STATE_ATTENUATION: - append(dst, ".attenuation"); - break; - case STATE_SPOT_DIRECTION: - append(dst, ".spot.direction"); - break; - case STATE_TEXGEN_EYE_S: - append(dst, "eye.s"); - break; - case STATE_TEXGEN_EYE_T: - append(dst, "eye.t"); - break; - case STATE_TEXGEN_EYE_R: - append(dst, "eye.r"); - break; - case STATE_TEXGEN_EYE_Q: - append(dst, "eye.q"); - break; - case STATE_TEXGEN_OBJECT_S: - append(dst, "object.s"); - break; - case STATE_TEXGEN_OBJECT_T: - append(dst, "object.t"); - break; - case STATE_TEXGEN_OBJECT_R: - append(dst, "object.r"); - break; - case STATE_TEXGEN_OBJECT_Q: - append(dst, "object.q"); - break; - case STATE_TEXENV_COLOR: - append(dst, "texenv"); - break; - case STATE_DEPTH_RANGE: - append(dst, "depth.range"); - break; - case STATE_VERTEX_PROGRAM: - case STATE_FRAGMENT_PROGRAM: - break; - case STATE_ENV: - append(dst, "env"); - break; - case STATE_LOCAL: - append(dst, "local"); - break; - case STATE_INTERNAL: - case STATE_NORMAL_SCALE: - case STATE_POSITION_NORMALIZED: - append(dst, "(internal)"); - break; - default: - ; - } -} - -static void -append_face(char *dst, GLint face) -{ - if (face == 0) - append(dst, "front."); - else - append(dst, "back."); -} - -static void -append_index(char *dst, GLint index) -{ - char s[20]; - _mesa_sprintf(s, "[%d].", index); - append(dst, s); -} - -/** - * Make a string from the given state vector. - * For example, return "state.matrix.texture[2].inverse". - * Use _mesa_free() to deallocate the string. - */ -static const char * -make_state_string(const GLint state[6]) -{ - char str[1000] = ""; - char tmp[30]; - - append(str, "state."); - append_token(str, (enum state_index) state[0]); - - switch (state[0]) { - case STATE_MATERIAL: - append_face(str, state[1]); - append_token(str, (enum state_index) state[2]); - break; - case STATE_LIGHT: - append(str, "light"); - append_index(str, state[1]); /* light number [i]. */ - append_token(str, (enum state_index) state[2]); /* coefficients */ - break; - case STATE_LIGHTMODEL_AMBIENT: - append(str, "lightmodel.ambient"); - break; - case STATE_LIGHTMODEL_SCENECOLOR: - if (state[1] == 0) { - append(str, "lightmodel.front.scenecolor"); + const struct gl_vertex_program *vp + = (const struct gl_vertex_program *) prog; + struct gl_vertex_program *vpc = (struct gl_vertex_program *) clone; + vpc->IsPositionInvariant = vp->IsPositionInvariant; } - else { - append(str, "lightmodel.back.scenecolor"); - } - break; - case STATE_LIGHTPROD: - append_index(str, state[1]); /* light number [i]. */ - append_face(str, state[2]); - append_token(str, (enum state_index) state[3]); break; - case STATE_TEXGEN: - append_index(str, state[1]); /* tex unit [i] */ - append_token(str, (enum state_index) state[2]); /* plane coef */ - break; - case STATE_TEXENV_COLOR: - append_index(str, state[1]); /* tex unit [i] */ - append(str, "color"); - break; - case STATE_FOG_COLOR: - case STATE_FOG_PARAMS: - break; - case STATE_CLIPPLANE: - append_index(str, state[1]); /* plane [i] */ - append(str, "plane"); - break; - case STATE_POINT_SIZE: - case STATE_POINT_ATTENUATION: - break; - case STATE_MATRIX: + case GL_FRAGMENT_PROGRAM_ARB: { - /* state[1] = modelview, projection, texture, etc. */ - /* state[2] = which texture matrix or program matrix */ - /* state[3] = first column to fetch */ - /* state[4] = last column to fetch */ - /* state[5] = transpose, inverse or invtrans */ - const enum state_index mat = (enum state_index) state[1]; - const GLuint index = (GLuint) state[2]; - const GLuint first = (GLuint) state[3]; - const GLuint last = (GLuint) state[4]; - const enum state_index modifier = (enum state_index) state[5]; - append_token(str, mat); - if (index) - append_index(str, index); - if (modifier) - append_token(str, modifier); - if (first == last) - _mesa_sprintf(tmp, ".row[%d]", first); - else - _mesa_sprintf(tmp, ".row[%d..%d]", first, last); - append(str, tmp); + const struct gl_fragment_program *fp + = (const struct gl_fragment_program *) prog; + struct gl_fragment_program *fpc = (struct gl_fragment_program *) clone; + fpc->FogOption = fp->FogOption; + fpc->UsesKill = fp->UsesKill; } break; - case STATE_DEPTH_RANGE: - break; - case STATE_FRAGMENT_PROGRAM: - case STATE_VERTEX_PROGRAM: - /* state[1] = {STATE_ENV, STATE_LOCAL} */ - /* state[2] = parameter index */ - append_token(str, (enum state_index) state[1]); - append_index(str, state[2]); - break; - case STATE_INTERNAL: - break; default: - _mesa_problem(NULL, "Invalid state in maka_state_string"); - break; + _mesa_problem(NULL, "Unexpected target in _mesa_clone_program"); } - return _mesa_strdup(str); + return clone; } -/** - * Loop over all the parameters in a parameter list. If the parameter - * is a GL state reference, look up the current value of that state - * variable and put it into the parameter's Value[4] array. - * This would be called at glBegin time when using a fragment program. - */ -void -_mesa_load_state_parameters(GLcontext *ctx, - struct gl_program_parameter_list *paramList) -{ - GLuint i; - - if (!paramList) - return; - - for (i = 0; i < paramList->NumParameters; i++) { - if (paramList->Parameters[i].Type == PROGRAM_STATE_VAR) { - _mesa_fetch_state(ctx, - paramList->Parameters[i].StateIndexes, - paramList->ParameterValues[i]); - } - } -} - - -/** - * Initialize program instruction fields to defaults. - */ -void -_mesa_init_instruction(struct prog_instruction *inst) -{ - _mesa_bzero(inst, sizeof(struct prog_instruction)); - - inst->SrcReg[0].File = PROGRAM_UNDEFINED; - inst->SrcReg[0].Swizzle = SWIZZLE_NOOP; - inst->SrcReg[1].File = PROGRAM_UNDEFINED; - inst->SrcReg[1].Swizzle = SWIZZLE_NOOP; - inst->SrcReg[2].File = PROGRAM_UNDEFINED; - inst->SrcReg[2].Swizzle = SWIZZLE_NOOP; - - inst->DstReg.File = PROGRAM_UNDEFINED; - inst->DstReg.WriteMask = WRITEMASK_XYZW; - inst->DstReg.CondMask = COND_TR; - inst->DstReg.CondSwizzle = SWIZZLE_NOOP; - - inst->SaturateMode = SATURATE_OFF; - inst->Precision = FLOAT32; -} - - -/** - * Allocate an array of program instructions. - * \param numInst number of instructions - * \return pointer to instruction memory - */ -struct prog_instruction * -_mesa_alloc_instructions(GLuint numInst) -{ - return (struct prog_instruction *) - _mesa_calloc(numInst * sizeof(struct prog_instruction)); -} - - -/** - * Reallocate memory storing an array of program instructions. - * This is used when we need to append additional instructions onto an - * program. - * \param oldInst pointer to first of old/src instructions - * \param numOldInst number of instructions at <oldInst> - * \param numNewInst desired size of new instruction array. - * \return pointer to start of new instruction array. - */ -struct prog_instruction * -_mesa_realloc_instructions(struct prog_instruction *oldInst, - GLuint numOldInst, GLuint numNewInst) -{ - struct prog_instruction *newInst; - - newInst = (struct prog_instruction *) - _mesa_realloc(oldInst, - numOldInst * sizeof(struct prog_instruction), - numNewInst * sizeof(struct prog_instruction)); - - return newInst; -} - - -/** - * Basic info about each instruction - */ -struct instruction_info -{ - enum prog_opcode Opcode; - const char *Name; - GLuint NumSrcRegs; -}; - -/** - * Instruction info - * \note Opcode should equal array index! - */ -static const struct instruction_info InstInfo[MAX_OPCODE] = { - { OPCODE_ABS, "ABS", 1 }, - { OPCODE_ADD, "ADD", 2 }, - { OPCODE_ARA, "ARA", 1 }, - { OPCODE_ARL, "ARL", 1 }, - { OPCODE_ARL_NV, "ARL", 1 }, - { OPCODE_ARR, "ARL", 1 }, - { OPCODE_BRA, "BRA", 1 }, - { OPCODE_CAL, "CAL", 1 }, - { OPCODE_CMP, "CMP", 3 }, - { OPCODE_COS, "COS", 1 }, - { OPCODE_DDX, "DDX", 1 }, - { OPCODE_DDY, "DDY", 1 }, - { OPCODE_DP3, "DP3", 2 }, - { OPCODE_DP4, "DP4", 2 }, - { OPCODE_DPH, "DPH", 2 }, - { OPCODE_DST, "DST", 2 }, - { OPCODE_END, "END", 0 }, - { OPCODE_EX2, "EX2", 1 }, - { OPCODE_EXP, "EXP", 1 }, - { OPCODE_FLR, "FLR", 1 }, - { OPCODE_FRC, "FRC", 1 }, - { OPCODE_KIL, "KIL", 1 }, - { OPCODE_KIL_NV, "KIL", 0 }, - { OPCODE_LG2, "LG2", 1 }, - { OPCODE_LIT, "LIT", 1 }, - { OPCODE_LOG, "LOG", 1 }, - { OPCODE_LRP, "LRP", 3 }, - { OPCODE_MAD, "MAD", 3 }, - { OPCODE_MAX, "MAX", 2 }, - { OPCODE_MIN, "MIN", 2 }, - { OPCODE_MOV, "MOV", 1 }, - { OPCODE_MUL, "MUL", 2 }, - { OPCODE_PK2H, "PK2H", 1 }, - { OPCODE_PK2US, "PK2US", 1 }, - { OPCODE_PK4B, "PK4B", 1 }, - { OPCODE_PK4UB, "PK4UB", 1 }, - { OPCODE_POW, "POW", 2 }, - { OPCODE_POPA, "POPA", 0 }, - { OPCODE_PRINT, "PRINT", 1 }, - { OPCODE_PUSHA, "PUSHA", 0 }, - { OPCODE_RCC, "RCC", 1 }, - { OPCODE_RCP, "RCP", 1 }, - { OPCODE_RET, "RET", 1 }, - { OPCODE_RFL, "RFL", 1 }, - { OPCODE_RSQ, "RSQ", 1 }, - { OPCODE_SCS, "SCS", 1 }, - { OPCODE_SEQ, "SEQ", 2 }, - { OPCODE_SFL, "SFL", 0 }, - { OPCODE_SGE, "SGE", 2 }, - { OPCODE_SGT, "SGT", 2 }, - { OPCODE_SIN, "SIN", 1 }, - { OPCODE_SLE, "SLE", 2 }, - { OPCODE_SLT, "SLT", 2 }, - { OPCODE_SNE, "SNE", 2 }, - { OPCODE_SSG, "SSG", 1 }, - { OPCODE_STR, "STR", 0 }, - { OPCODE_SUB, "SUB", 2 }, - { OPCODE_SWZ, "SWZ", 1 }, - { OPCODE_TEX, "TEX", 1 }, - { OPCODE_TXB, "TXB", 1 }, - { OPCODE_TXD, "TXD", 3 }, - { OPCODE_TXL, "TXL", 1 }, - { OPCODE_TXP, "TXP", 1 }, - { OPCODE_TXP_NV, "TXP", 1 }, - { OPCODE_UP2H, "UP2H", 1 }, - { OPCODE_UP2US, "UP2US", 1 }, - { OPCODE_UP4B, "UP4B", 1 }, - { OPCODE_UP4UB, "UP4UB", 1 }, - { OPCODE_X2D, "X2D", 3 }, - { OPCODE_XPD, "XPD", 2 } -}; - - -/** - * Return the number of src registers for the given instruction/opcode. - */ -GLuint -_mesa_num_inst_src_regs(enum prog_opcode opcode) -{ - GLuint i; -#ifdef DEBUG - for (i = 0; i < MAX_OPCODE; i++) { - ASSERT(i == InstInfo[i].Opcode); - } -#endif - for (i = 0; i < MAX_OPCODE; i++) { - if (InstInfo[i].Opcode == opcode) { - return InstInfo[i].NumSrcRegs; - } - } - _mesa_problem(NULL, "invalid opcode in _mesa_num_inst_src_regs"); - return 0; -} - - -/** - * Return string name for given program opcode. - */ -const char * -_mesa_opcode_string(enum prog_opcode opcode) -{ - ASSERT(opcode < MAX_OPCODE); - return InstInfo[opcode].Name; -} - -/** - * Return string name for given program/register file. - */ -static const char * -program_file_string(enum register_file f) -{ - switch (f) { - case PROGRAM_TEMPORARY: - return "TEMP"; - case PROGRAM_LOCAL_PARAM: - return "LOCAL"; - case PROGRAM_ENV_PARAM: - return "ENV"; - case PROGRAM_STATE_VAR: - return "STATE"; - case PROGRAM_INPUT: - return "INPUT"; - case PROGRAM_OUTPUT: - return "OUTPUT"; - case PROGRAM_NAMED_PARAM: - return "NAMED"; - case PROGRAM_CONSTANT: - return "CONST"; - case PROGRAM_WRITE_ONLY: - return "WRITE_ONLY"; - case PROGRAM_ADDRESS: - return "ADDR"; - default: - return "!unkown!"; - } -} - - -/** - * Return a string representation of the given swizzle word. - * If extended is true, use extended (comma-separated) format. - */ -static const char * -swizzle_string(GLuint swizzle, GLuint negateBase, GLboolean extended) -{ - static const char swz[] = "xyzw01"; - static char s[20]; - GLuint i = 0; - - if (!extended && swizzle == SWIZZLE_NOOP && negateBase == 0) - return ""; /* no swizzle/negation */ - - if (!extended) - s[i++] = '.'; - - if (negateBase & 0x1) - s[i++] = '-'; - s[i++] = swz[GET_SWZ(swizzle, 0)]; - - if (extended) { - s[i++] = ','; - } - - if (negateBase & 0x2) - s[i++] = '-'; - s[i++] = swz[GET_SWZ(swizzle, 1)]; - - if (extended) { - s[i++] = ','; - } - - if (negateBase & 0x4) - s[i++] = '-'; - s[i++] = swz[GET_SWZ(swizzle, 2)]; - - if (extended) { - s[i++] = ','; - } - - if (negateBase & 0x8) - s[i++] = '-'; - s[i++] = swz[GET_SWZ(swizzle, 3)]; - - s[i] = 0; - return s; -} - - -static const char * -writemask_string(GLuint writeMask) -{ - static char s[10]; - GLuint i = 0; - - if (writeMask == WRITEMASK_XYZW) - return ""; - - s[i++] = '.'; - if (writeMask & WRITEMASK_X) - s[i++] = 'x'; - if (writeMask & WRITEMASK_Y) - s[i++] = 'y'; - if (writeMask & WRITEMASK_Z) - s[i++] = 'z'; - if (writeMask & WRITEMASK_W) - s[i++] = 'w'; - - s[i] = 0; - return s; -} - -static void -print_dst_reg(const struct prog_dst_register *dstReg) -{ - _mesa_printf(" %s[%d]%s", - program_file_string((enum register_file) dstReg->File), - dstReg->Index, - writemask_string(dstReg->WriteMask)); -} - -static void -print_src_reg(const struct prog_src_register *srcReg) -{ - _mesa_printf("%s[%d]%s", - program_file_string((enum register_file) srcReg->File), - srcReg->Index, - swizzle_string(srcReg->Swizzle, - srcReg->NegateBase, GL_FALSE)); -} - - -/** - * Print a single vertex/fragment program instruction. - */ -void -_mesa_print_instruction(const struct prog_instruction *inst) -{ - switch (inst->Opcode) { - case OPCODE_PRINT: - _mesa_printf("PRINT '%s'", inst->Data); - if (inst->SrcReg[0].File != PROGRAM_UNDEFINED) { - _mesa_printf(", "); - _mesa_printf("%s[%d]%s", - program_file_string((enum register_file) inst->SrcReg[0].File), - inst->SrcReg[0].Index, - swizzle_string(inst->SrcReg[0].Swizzle, - inst->SrcReg[0].NegateBase, GL_FALSE)); - } - _mesa_printf(";\n"); - break; - case OPCODE_SWZ: - _mesa_printf("SWZ"); - if (inst->SaturateMode == SATURATE_ZERO_ONE) - _mesa_printf("_SAT"); - print_dst_reg(&inst->DstReg); - _mesa_printf("%s[%d], %s;\n", - program_file_string((enum register_file) inst->SrcReg[0].File), - inst->SrcReg[0].Index, - swizzle_string(inst->SrcReg[0].Swizzle, - inst->SrcReg[0].NegateBase, GL_TRUE)); - break; - case OPCODE_TEX: - case OPCODE_TXP: - case OPCODE_TXB: - _mesa_printf("%s", _mesa_opcode_string(inst->Opcode)); - if (inst->SaturateMode == SATURATE_ZERO_ONE) - _mesa_printf("_SAT"); - _mesa_printf(" "); - print_dst_reg(&inst->DstReg); - _mesa_printf(", "); - print_src_reg(&inst->SrcReg[0]); - _mesa_printf(", texture[%d], ", inst->TexSrcUnit); - switch (inst->TexSrcTarget) { - case TEXTURE_1D_INDEX: _mesa_printf("1D"); break; - case TEXTURE_2D_INDEX: _mesa_printf("2D"); break; - case TEXTURE_3D_INDEX: _mesa_printf("3D"); break; - case TEXTURE_CUBE_INDEX: _mesa_printf("CUBE"); break; - case TEXTURE_RECT_INDEX: _mesa_printf("RECT"); break; - default: - ; - } - _mesa_printf("\n"); - break; - case OPCODE_ARL: - _mesa_printf("ARL addr.x, "); - print_src_reg(&inst->SrcReg[0]); - _mesa_printf(";\n"); - break; - /* XXX may need for other special-case instructions */ - default: - /* typical alu instruction */ - { - const GLuint numRegs = _mesa_num_inst_src_regs(inst->Opcode); - GLuint j; - - _mesa_printf("%s", _mesa_opcode_string(inst->Opcode)); - - /* frag prog only */ - if (inst->SaturateMode == SATURATE_ZERO_ONE) - _mesa_printf("_SAT"); - - if (inst->DstReg.File != PROGRAM_UNDEFINED) { - _mesa_printf(" %s[%d]%s", - program_file_string((enum register_file) inst->DstReg.File), - inst->DstReg.Index, - writemask_string(inst->DstReg.WriteMask)); - } - - if (numRegs > 0) - _mesa_printf(", "); - - for (j = 0; j < numRegs; j++) { - print_src_reg(inst->SrcReg + j); - if (j + 1 < numRegs) - _mesa_printf(", "); - } - - _mesa_printf(";\n"); - } - } -} - - -/** - * Print a vertx/fragment program to stdout. - * XXX this function could be greatly improved. - */ -void -_mesa_print_program(const struct gl_program *prog) -{ - GLuint i; - for (i = 0; i < prog->NumInstructions; i++) { - _mesa_printf("%3d: ", i); - _mesa_print_instruction(prog->Instructions + i); - } -} - - -/** - * Print all of a program's parameters. - */ -void -_mesa_print_program_parameters(GLcontext *ctx, const struct gl_program *prog) -{ - GLint i; - - _mesa_printf("NumInstructions=%d\n", prog->NumInstructions); - _mesa_printf("NumTemporaries=%d\n", prog->NumTemporaries); - _mesa_printf("NumParameters=%d\n", prog->NumParameters); - _mesa_printf("NumAttributes=%d\n", prog->NumAttributes); - _mesa_printf("NumAddressRegs=%d\n", prog->NumAddressRegs); - - _mesa_load_state_parameters(ctx, prog->Parameters); - -#if 0 - _mesa_printf("Local Params:\n"); - for (i = 0; i < MAX_PROGRAM_LOCAL_PARAMS; i++){ - const GLfloat *p = prog->LocalParams[i]; - _mesa_printf("%2d: %f, %f, %f, %f\n", i, p[0], p[1], p[2], p[3]); - } -#endif - - for (i = 0; i < prog->Parameters->NumParameters; i++){ - struct gl_program_parameter *param = prog->Parameters->Parameters + i; - const GLfloat *v = prog->Parameters->ParameterValues[i]; - _mesa_printf("param[%d] %s = {%.3f, %.3f, %.3f, %.3f};\n", - i, param->Name, v[0], v[1], v[2], v[3]); - } -} - /** * Mixing ARB and NV vertex/fragment programs can be tricky. @@ -1959,248 +621,3 @@ _mesa_GenPrograms(GLsizei n, GLuint *ids) ids[i] = first + i; } } - - -/** - * Determine if id names a vertex or fragment program. - * \note Not compiled into display lists. - * \note Called from both glIsProgramNV and glIsProgramARB. - * \param id is the program identifier - * \return GL_TRUE if id is a program, else GL_FALSE. - */ -GLboolean GLAPIENTRY -_mesa_IsProgram(GLuint id) -{ - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); - - if (id == 0) - return GL_FALSE; - - if (_mesa_lookup_program(ctx, id)) - return GL_TRUE; - else - return GL_FALSE; -} - - - -/**********************************************************************/ -/* GL_MESA_program_debug extension */ -/**********************************************************************/ - - -/* XXX temporary */ -GLAPI void GLAPIENTRY -glProgramCallbackMESA(GLenum target, GLprogramcallbackMESA callback, - GLvoid *data) -{ - _mesa_ProgramCallbackMESA(target, callback, data); -} - - -void -_mesa_ProgramCallbackMESA(GLenum target, GLprogramcallbackMESA callback, - GLvoid *data) -{ - GET_CURRENT_CONTEXT(ctx); - - switch (target) { - case GL_FRAGMENT_PROGRAM_ARB: - if (!ctx->Extensions.ARB_fragment_program) { - _mesa_error(ctx, GL_INVALID_ENUM, "glProgramCallbackMESA(target)"); - return; - } - ctx->FragmentProgram.Callback = callback; - ctx->FragmentProgram.CallbackData = data; - break; - case GL_FRAGMENT_PROGRAM_NV: - if (!ctx->Extensions.NV_fragment_program) { - _mesa_error(ctx, GL_INVALID_ENUM, "glProgramCallbackMESA(target)"); - return; - } - ctx->FragmentProgram.Callback = callback; - ctx->FragmentProgram.CallbackData = data; - break; - case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */ - if (!ctx->Extensions.ARB_vertex_program && - !ctx->Extensions.NV_vertex_program) { - _mesa_error(ctx, GL_INVALID_ENUM, "glProgramCallbackMESA(target)"); - return; - } - ctx->VertexProgram.Callback = callback; - ctx->VertexProgram.CallbackData = data; - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glProgramCallbackMESA(target)"); - return; - } -} - - -/* XXX temporary */ -GLAPI void GLAPIENTRY -glGetProgramRegisterfvMESA(GLenum target, - GLsizei len, const GLubyte *registerName, - GLfloat *v) -{ - _mesa_GetProgramRegisterfvMESA(target, len, registerName, v); -} - - -void -_mesa_GetProgramRegisterfvMESA(GLenum target, - GLsizei len, const GLubyte *registerName, - GLfloat *v) -{ - char reg[1000]; - GET_CURRENT_CONTEXT(ctx); - - /* We _should_ be inside glBegin/glEnd */ -#if 0 - if (ctx->Driver.CurrentExecPrimitive == PRIM_OUTSIDE_BEGIN_END) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramRegisterfvMESA"); - return; - } -#endif - - /* make null-terminated copy of registerName */ - len = MIN2((unsigned int) len, sizeof(reg) - 1); - _mesa_memcpy(reg, registerName, len); - reg[len] = 0; - - switch (target) { - case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */ - if (!ctx->Extensions.ARB_vertex_program && - !ctx->Extensions.NV_vertex_program) { - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetProgramRegisterfvMESA(target)"); - return; - } - if (!ctx->VertexProgram._Enabled) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGetProgramRegisterfvMESA"); - return; - } - /* GL_NV_vertex_program */ - if (reg[0] == 'R') { - /* Temp register */ - GLint i = _mesa_atoi(reg + 1); - if (i >= (GLint)ctx->Const.VertexProgram.MaxTemps) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glGetProgramRegisterfvMESA(registerName)"); - return; - } - COPY_4V(v, ctx->VertexProgram.Temporaries[i]); - } - else if (reg[0] == 'v' && reg[1] == '[') { - /* Vertex Input attribute */ - GLuint i; - for (i = 0; i < ctx->Const.VertexProgram.MaxAttribs; i++) { - const char *name = _mesa_nv_vertex_input_register_name(i); - char number[10]; - _mesa_sprintf(number, "%d", i); - if (_mesa_strncmp(reg + 2, name, 4) == 0 || - _mesa_strncmp(reg + 2, number, _mesa_strlen(number)) == 0) { - COPY_4V(v, ctx->VertexProgram.Inputs[i]); - return; - } - } - _mesa_error(ctx, GL_INVALID_VALUE, - "glGetProgramRegisterfvMESA(registerName)"); - return; - } - else if (reg[0] == 'o' && reg[1] == '[') { - /* Vertex output attribute */ - } - /* GL_ARB_vertex_program */ - else if (_mesa_strncmp(reg, "vertex.", 7) == 0) { - - } - else { - _mesa_error(ctx, GL_INVALID_VALUE, - "glGetProgramRegisterfvMESA(registerName)"); - return; - } - break; - case GL_FRAGMENT_PROGRAM_ARB: - if (!ctx->Extensions.ARB_fragment_program) { - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetProgramRegisterfvMESA(target)"); - return; - } - if (!ctx->FragmentProgram._Enabled) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGetProgramRegisterfvMESA"); - return; - } - /* XXX to do */ - break; - case GL_FRAGMENT_PROGRAM_NV: - if (!ctx->Extensions.NV_fragment_program) { - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetProgramRegisterfvMESA(target)"); - return; - } - if (!ctx->FragmentProgram._Enabled) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGetProgramRegisterfvMESA"); - return; - } - if (reg[0] == 'R') { - /* Temp register */ - GLint i = _mesa_atoi(reg + 1); - if (i >= (GLint)ctx->Const.FragmentProgram.MaxTemps) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glGetProgramRegisterfvMESA(registerName)"); - return; - } - COPY_4V(v, ctx->FragmentProgram.Machine.Temporaries[i]); - } - else if (reg[0] == 'f' && reg[1] == '[') { - /* Fragment input attribute */ - GLuint i; - for (i = 0; i < ctx->Const.FragmentProgram.MaxAttribs; i++) { - const char *name = _mesa_nv_fragment_input_register_name(i); - if (_mesa_strncmp(reg + 2, name, 4) == 0) { - COPY_4V(v, ctx->FragmentProgram.Machine.Inputs[i]); - return; - } - } - _mesa_error(ctx, GL_INVALID_VALUE, - "glGetProgramRegisterfvMESA(registerName)"); - return; - } - else if (_mesa_strcmp(reg, "o[COLR]") == 0) { - /* Fragment output color */ - COPY_4V(v, ctx->FragmentProgram.Machine.Outputs[FRAG_RESULT_COLR]); - } - else if (_mesa_strcmp(reg, "o[COLH]") == 0) { - /* Fragment output color */ - COPY_4V(v, ctx->FragmentProgram.Machine.Outputs[FRAG_RESULT_COLH]); - } - else if (_mesa_strcmp(reg, "o[DEPR]") == 0) { - /* Fragment output depth */ - COPY_4V(v, ctx->FragmentProgram.Machine.Outputs[FRAG_RESULT_DEPR]); - } - else { - /* try user-defined identifiers */ - const GLfloat *value = _mesa_lookup_parameter_value( - ctx->FragmentProgram.Current->Base.Parameters, -1, reg); - if (value) { - COPY_4V(v, value); - } - else { - _mesa_error(ctx, GL_INVALID_VALUE, - "glGetProgramRegisterfvMESA(registerName)"); - return; - } - } - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetProgramRegisterfvMESA(target)"); - return; - } - -} diff --git a/dist/Mesa/src/mesa/shader/shader_api.c b/dist/Mesa/src/mesa/shader/shader_api.c index 06d24b4bf..5f9e2b84a 100644 --- a/dist/Mesa/src/mesa/shader/shader_api.c +++ b/dist/Mesa/src/mesa/shader/shader_api.c @@ -80,7 +80,7 @@ _mesa_clear_shader_program_data(GLcontext *ctx, /* to prevent a double-free in the next call */ shProg->VertexProgram->Base.Parameters = NULL; } - _mesa_delete_program(ctx, &shProg->VertexProgram->Base); + ctx->Driver.DeleteProgram(ctx, &shProg->VertexProgram->Base); shProg->VertexProgram = NULL; } @@ -89,7 +89,7 @@ _mesa_clear_shader_program_data(GLcontext *ctx, /* to prevent a double-free in the next call */ shProg->FragmentProgram->Base.Parameters = NULL; } - _mesa_delete_program(ctx, &shProg->FragmentProgram->Base); + ctx->Driver.DeleteProgram(ctx, &shProg->FragmentProgram->Base); shProg->FragmentProgram = NULL; } @@ -247,7 +247,7 @@ _mesa_free_shader(GLcontext *ctx, struct gl_shader *sh) _mesa_free(sh->InfoLog); for (i = 0; i < sh->NumPrograms; i++) { assert(sh->Programs[i]); - _mesa_delete_program(ctx, sh->Programs[i]); + ctx->Driver.DeleteProgram(ctx, sh->Programs[i]); } if (sh->Programs) _mesa_free(sh->Programs); @@ -370,6 +370,54 @@ copy_string(GLchar *dst, GLsizei maxLength, GLsizei *length, const GLchar *src) /** + * Return size (in floats) of the given GLSL type. + * See also _slang_sizeof_type_specifier(). + */ +static GLint +sizeof_glsl_type(GLenum type) +{ + switch (type) { + case GL_BOOL: + case GL_FLOAT: + case GL_INT: + return 1; + case GL_BOOL_VEC2: + case GL_FLOAT_VEC2: + case GL_INT_VEC2: + return 2; + case GL_BOOL_VEC3: + case GL_FLOAT_VEC3: + case GL_INT_VEC3: + return 3; + case GL_BOOL_VEC4: + case GL_FLOAT_VEC4: + case GL_INT_VEC4: + return 4; + case GL_FLOAT_MAT2: + return 8; /* 2 rows of 4, actually */ + case GL_FLOAT_MAT3: + return 12; /* 3 rows of 4, actually */ + case GL_FLOAT_MAT4: + return 16; + case GL_FLOAT_MAT2x3: + return 8; /* 2 rows of 4, actually */ + case GL_FLOAT_MAT2x4: + return 8; + case GL_FLOAT_MAT3x2: + return 12; /* 3 rows of 4, actually */ + case GL_FLOAT_MAT3x4: + return 12; + case GL_FLOAT_MAT4x2: + return 16; /* 4 rows of 4, actually */ + case GL_FLOAT_MAT4x3: + return 16; /* 4 rows of 4, actually */ + default: + return 0; /* error */ + } +} + + +/** * Called via ctx->Driver.AttachShader() */ void @@ -633,9 +681,9 @@ _mesa_get_active_attrib(GLcontext *ctx, GLuint program, GLuint index, shProg->Attributes->Parameters[index].Name); sz = shProg->Attributes->Parameters[index].Size; if (size) - *size = sz; - if (type) - *type = vec_types[sz]; /* XXX this is a temporary hack */ + *size = 1; /* attributes may not be arrays */ + if (type && sz > 0 && sz <= 4) /* XXX this is a temporary hack */ + *type = vec_types[sz - 1]; } @@ -666,13 +714,17 @@ _mesa_get_active_uniform(GLcontext *ctx, GLuint program, GLuint index, if (shProg->Uniforms->Parameters[j].Type == PROGRAM_UNIFORM || shProg->Uniforms->Parameters[j].Type == PROGRAM_SAMPLER) { if (ind == index) { + GLuint uSize = shProg->Uniforms->Parameters[j].Size; + GLenum uType = shProg->Uniforms->Parameters[j].DataType; /* found it */ copy_string(nameOut, maxLength, length, shProg->Uniforms->Parameters[j].Name); - if (size) - *size = shProg->Uniforms->Parameters[j].Size; + if (size) { + /* convert from floats to 'type' (eg: sizeof(mat4x4)=1) */ + *size = uSize / sizeof_glsl_type(uType); + } if (type) - *type = shProg->Uniforms->Parameters[j].DataType; + *type = uType; return; } ind++; @@ -903,9 +955,40 @@ _mesa_get_uniformfv(GLcontext *ctx, GLuint program, GLint location, if (shProg) { GLint i; if (location >= 0 && location < shProg->Uniforms->NumParameters) { - for (i = 0; i < shProg->Uniforms->Parameters[location].Size; i++) { - params[i] = shProg->Uniforms->ParameterValues[location][i]; + GLuint uSize; + GLenum uType; + GLint rows = 0; + uType = shProg->Uniforms->Parameters[location].DataType; + uSize = sizeof_glsl_type(uType); + /* Matrix types need special handling, because they span several + * parameters, and may also not be fully packed. + */ + switch (shProg->Uniforms->Parameters[location].DataType) { + case GL_FLOAT_MAT2: + case GL_FLOAT_MAT3x2: + case GL_FLOAT_MAT4x2: + rows = 2; + break; + case GL_FLOAT_MAT2x3: + case GL_FLOAT_MAT3: + case GL_FLOAT_MAT4x3: + rows = 3; + break; + case GL_FLOAT_MAT2x4: + case GL_FLOAT_MAT3x4: + case GL_FLOAT_MAT4: + rows = 4; + } + if (rows != 0) { + GLint r, c; + for (c = 0, i = 0; c * 4 < uSize; c++) + for (r = 0; r < rows; r++, i++) + params[i] = shProg->Uniforms->ParameterValues[location + c][r]; } + else + for (i = 0; i < uSize; i++) { + params[i] = shProg->Uniforms->ParameterValues[location][i]; + } } else { _mesa_error(ctx, GL_INVALID_VALUE, "glGetUniformfv(location)"); @@ -1059,19 +1142,28 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count, { struct gl_shader_program *shProg = ctx->Shader.CurrentProgram; GLint elems, i, k; + GLenum uType; + GLsizei maxCount; if (!shProg || !shProg->LinkStatus) { _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(program not linked)"); return; } + if (location == -1) + return; /* The standard specifies this as a no-op */ + + /* The spec says this is GL_INVALID_OPERATION, although it seems like it + * ought to be GL_INVALID_VALUE + */ if (location < 0 || location >= (GLint) shProg->Uniforms->NumParameters) { - _mesa_error(ctx, GL_INVALID_VALUE, "glUniform(location)"); + _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(location)"); return; } FLUSH_VERTICES(ctx, _NEW_PROGRAM); + uType = shProg->Uniforms->Parameters[location].DataType; /* * If we're setting a sampler, we must use glUniformi1()! */ @@ -1119,11 +1211,37 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count, return; } - if (count * elems > shProg->Uniforms->Parameters[location].Size) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(count too large)"); - return; + /* OpenGL requires types to match exactly, except that one can convert + * float or int array to boolean array. + */ + switch (uType) + { + case GL_BOOL: + case GL_BOOL_VEC2: + case GL_BOOL_VEC3: + case GL_BOOL_VEC4: + if (elems != sizeof_glsl_type(uType)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(count mismatch)"); + } + break; + case PROGRAM_SAMPLER: + break; + default: + if (shProg->Uniforms->Parameters[location].Type != PROGRAM_SAMPLER + && uType != type) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(type mismatch)"); + } + break; } + /* XXX if this is a base type, then count must equal 1. However, we + * don't have enough information from the compiler to distinguish a + * base type from a 1-element array of that type. The standard allows + * count to overrun an array, in which case the overflow is ignored. + */ + maxCount = shProg->Uniforms->Parameters[location].Size / elems; + if (count > maxCount) count = maxCount; + for (k = 0; k < count; k++) { GLfloat *uniformVal = shProg->Uniforms->ParameterValues[location + k]; if (type == GL_INT || @@ -1141,6 +1259,13 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count, uniformVal[i] = fValues[i]; } } + if (uType == GL_BOOL || + uType == GL_BOOL_VEC2 || + uType == GL_BOOL_VEC3 || + uType == GL_BOOL_VEC4) { + for (i = 0; i < elems; i++) + uniformVal[i] = uniformVal[i] ? 1.0f : 0.0f; + } } if (shProg->Uniforms->Parameters[location].Type == PROGRAM_SAMPLER) { @@ -1161,20 +1286,30 @@ _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows, GLenum matrixType, GLint location, GLsizei count, GLboolean transpose, const GLfloat *values) { + GLsizei maxCount, i; struct gl_shader_program *shProg = ctx->Shader.CurrentProgram; if (!shProg || !shProg->LinkStatus) { _mesa_error(ctx, GL_INVALID_OPERATION, "glUniformMatrix(program not linked)"); return; } - if (location < 0 || location >= shProg->Uniforms->NumParameters) { - _mesa_error(ctx, GL_INVALID_VALUE, "glUniformMatrix(location)"); + if (location == -1) + return; /* The standard specifies this as a no-op */ + /* The spec says this is GL_INVALID_OPERATION, although it seems like it + * ought to be GL_INVALID_VALUE + */ + if (location < 0 || location >= (GLint) shProg->Uniforms->NumParameters) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glUniformMatrix(location)"); return; } if (values == NULL) { _mesa_error(ctx, GL_INVALID_VALUE, "glUniformMatrix"); return; } + if (count < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glUniformMatrix(count < 0)"); + return; + } FLUSH_VERTICES(ctx, _NEW_PROGRAM); @@ -1183,23 +1318,30 @@ _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows, * the rows. */ /* XXXX need to test 3x3 and 2x2 matrices... */ - if (transpose) { - GLuint row, col; - for (col = 0; col < cols; col++) { - GLfloat *v = shProg->Uniforms->ParameterValues[location + col]; - for (row = 0; row < rows; row++) { - v[row] = values[row * cols + col]; + maxCount = shProg->Uniforms->Parameters[location].Size / (4 * cols); + if (count > maxCount) + count = maxCount; + for (i = 0; i < count; i++) { + if (transpose) { + GLuint row, col; + for (col = 0; col < cols; col++) { + GLfloat *v = shProg->Uniforms->ParameterValues[location + col]; + for (row = 0; row < rows; row++) { + v[row] = values[row * cols + col]; + } } } - } - else { - GLuint row, col; - for (col = 0; col < cols; col++) { - GLfloat *v = shProg->Uniforms->ParameterValues[location + col]; - for (row = 0; row < rows; row++) { - v[row] = values[col * rows + row]; + else { + GLuint row, col; + for (col = 0; col < cols; col++) { + GLfloat *v = shProg->Uniforms->ParameterValues[location + col]; + for (row = 0; row < rows; row++) { + v[row] = values[col * rows + row]; + } } } + location += cols; + values += rows * cols; } } diff --git a/dist/Mesa/src/mesa/shader/slang/library/slang_common_builtin.gc b/dist/Mesa/src/mesa/shader/slang/library/slang_common_builtin.gc index 45cf1c6fd..26080cf26 100644 --- a/dist/Mesa/src/mesa/shader/slang/library/slang_common_builtin.gc +++ b/dist/Mesa/src/mesa/shader/slang/library/slang_common_builtin.gc @@ -343,6 +343,7 @@ vec4 asin(const vec4 v) __retVal.x = asin(v.x); __retVal.y = asin(v.y); __retVal.z = asin(v.z); + __retVal.w = asin(v.w); } float acos(const float x) diff --git a/dist/Mesa/src/mesa/shader/slang/library/slang_common_builtin_gc.h b/dist/Mesa/src/mesa/shader/slang/library/slang_common_builtin_gc.h index e5876528e..c8d1ffc17 100644 --- a/dist/Mesa/src/mesa/shader/slang/library/slang_common_builtin_gc.h +++ b/dist/Mesa/src/mesa/shader/slang/library/slang_common_builtin_gc.h @@ -21,627 +21,789 @@ 119,80,114,111,106,101,99,116,105,111,110,77,97,116,114,105,120,0,0,0,2,2,4,15,1,103,108,95,84,101, 120,116,117,114,101,77,97,116,114,105,120,0,3,18,103,108,95,77,97,120,84,101,120,116,117,114,101, 67,111,111,114,100,115,0,0,0,2,2,4,14,1,103,108,95,78,111,114,109,97,108,77,97,116,114,105,120,0,0, -0,2,2,4,15,1,103,108,95,77,111,100,101,108,86,105,101,119,77,97,116,114,105,120,73,110,118,101,114, -115,101,0,0,0,2,2,4,15,1,103,108,95,80,114,111,106,101,99,116,105,111,110,77,97,116,114,105,120,73, -110,118,101,114,115,101,0,0,0,2,2,4,15,1,103,108,95,77,111,100,101,108,86,105,101,119,80,114,111, -106,101,99,116,105,111,110,77,97,116,114,105,120,73,110,118,101,114,115,101,0,0,0,2,2,4,15,1,103, -108,95,84,101,120,116,117,114,101,77,97,116,114,105,120,73,110,118,101,114,115,101,0,3,18,103,108, -95,77,97,120,84,101,120,116,117,114,101,67,111,111,114,100,115,0,0,0,2,2,4,15,1,103,108,95,77,111, -100,101,108,86,105,101,119,77,97,116,114,105,120,84,114,97,110,115,112,111,115,101,0,0,0,2,2,4,15, -1,103,108,95,80,114,111,106,101,99,116,105,111,110,77,97,116,114,105,120,84,114,97,110,115,112,111, -115,101,0,0,0,2,2,4,15,1,103,108,95,77,111,100,101,108,86,105,101,119,80,114,111,106,101,99,116, -105,111,110,77,97,116,114,105,120,84,114,97,110,115,112,111,115,101,0,0,0,2,2,4,15,1,103,108,95,84, -101,120,116,117,114,101,77,97,116,114,105,120,84,114,97,110,115,112,111,115,101,0,3,18,103,108,95, -77,97,120,84,101,120,116,117,114,101,67,111,111,114,100,115,0,0,0,2,2,4,15,1,103,108,95,77,111,100, -101,108,86,105,101,119,77,97,116,114,105,120,73,110,118,101,114,115,101,84,114,97,110,115,112,111, -115,101,0,0,0,2,2,4,15,1,103,108,95,80,114,111,106,101,99,116,105,111,110,77,97,116,114,105,120,73, -110,118,101,114,115,101,84,114,97,110,115,112,111,115,101,0,0,0,2,2,4,15,1,103,108,95,77,111,100, -101,108,86,105,101,119,80,114,111,106,101,99,116,105,111,110,77,97,116,114,105,120,73,110,118,101, -114,115,101,84,114,97,110,115,112,111,115,101,0,0,0,2,2,4,15,1,103,108,95,84,101,120,116,117,114, -101,77,97,116,114,105,120,73,110,118,101,114,115,101,84,114,97,110,115,112,111,115,101,0,3,18,103, -108,95,77,97,120,84,101,120,116,117,114,101,67,111,111,114,100,115,0,0,0,2,2,4,9,1,103,108,95,78, -111,114,109,97,108,83,99,97,108,101,0,0,0,2,2,0,22,103,108,95,68,101,112,116,104,82,97,110,103,101, -80,97,114,97,109,101,116,101,114,115,0,9,110,101,97,114,0,0,0,1,9,102,97,114,0,0,0,1,9,100,105,102, -102,0,0,0,0,0,0,2,2,4,23,103,108,95,68,101,112,116,104,82,97,110,103,101,80,97,114,97,109,101,116, -101,114,115,0,1,103,108,95,68,101,112,116,104,82,97,110,103,101,0,0,0,2,2,4,12,1,103,108,95,67,108, -105,112,80,108,97,110,101,0,3,18,103,108,95,77,97,120,67,108,105,112,80,108,97,110,101,115,0,0,0,2, -2,0,22,103,108,95,80,111,105,110,116,80,97,114,97,109,101,116,101,114,115,0,9,115,105,122,101,0,0, -0,1,9,115,105,122,101,77,105,110,0,0,0,1,9,115,105,122,101,77,97,120,0,0,0,1,9,102,97,100,101,84, -104,114,101,115,104,111,108,100,83,105,122,101,0,0,0,1,9,100,105,115,116,97,110,99,101,67,111,110, -115,116,97,110,116,65,116,116,101,110,117,97,116,105,111,110,0,0,0,1,9,100,105,115,116,97,110,99, -101,76,105,110,101,97,114,65,116,116,101,110,117,97,116,105,111,110,0,0,0,1,9,100,105,115,116,97, -110,99,101,81,117,97,100,114,97,116,105,99,65,116,116,101,110,117,97,116,105,111,110,0,0,0,0,0,0,2, -2,4,23,103,108,95,80,111,105,110,116,80,97,114,97,109,101,116,101,114,115,0,1,103,108,95,80,111, -105,110,116,0,0,0,2,2,0,22,103,108,95,77,97,116,101,114,105,97,108,80,97,114,97,109,101,116,101, -114,115,0,12,101,109,105,115,115,105,111,110,0,0,0,1,12,97,109,98,105,101,110,116,0,0,0,1,12,100, -105,102,102,117,115,101,0,0,0,1,12,115,112,101,99,117,108,97,114,0,0,0,1,9,115,104,105,110,105,110, -101,115,115,0,0,0,0,0,0,2,2,4,23,103,108,95,77,97,116,101,114,105,97,108,80,97,114,97,109,101,116, -101,114,115,0,1,103,108,95,70,114,111,110,116,77,97,116,101,114,105,97,108,0,0,0,2,2,4,23,103,108, -95,77,97,116,101,114,105,97,108,80,97,114,97,109,101,116,101,114,115,0,1,103,108,95,66,97,99,107, -77,97,116,101,114,105,97,108,0,0,0,2,2,0,22,103,108,95,76,105,103,104,116,83,111,117,114,99,101,80, -97,114,97,109,101,116,101,114,115,0,12,97,109,98,105,101,110,116,0,0,0,1,12,100,105,102,102,117, -115,101,0,0,0,1,12,115,112,101,99,117,108,97,114,0,0,0,1,12,112,111,115,105,116,105,111,110,0,0,0, -1,12,104,97,108,102,86,101,99,116,111,114,0,0,0,1,11,115,112,111,116,68,105,114,101,99,116,105,111, -110,0,0,0,1,9,115,112,111,116,69,120,112,111,110,101,110,116,0,0,0,1,9,115,112,111,116,67,117,116, -111,102,102,0,0,0,1,9,115,112,111,116,67,111,115,67,117,116,111,102,102,0,0,0,1,9,99,111,110,115, -116,97,110,116,65,116,116,101,110,117,97,116,105,111,110,0,0,0,1,9,108,105,110,101,97,114,65,116, -116,101,110,117,97,116,105,111,110,0,0,0,1,9,113,117,97,100,114,97,116,105,99,65,116,116,101,110, -117,97,116,105,111,110,0,0,0,0,0,0,2,2,4,23,103,108,95,76,105,103,104,116,83,111,117,114,99,101,80, -97,114,97,109,101,116,101,114,115,0,1,103,108,95,76,105,103,104,116,83,111,117,114,99,101,0,3,18, -103,108,95,77,97,120,76,105,103,104,116,115,0,0,0,2,2,0,22,103,108,95,76,105,103,104,116,77,111, -100,101,108,80,97,114,97,109,101,116,101,114,115,0,12,97,109,98,105,101,110,116,0,0,0,0,0,0,2,2,4, -23,103,108,95,76,105,103,104,116,77,111,100,101,108,80,97,114,97,109,101,116,101,114,115,0,1,103, -108,95,76,105,103,104,116,77,111,100,101,108,0,0,0,2,2,0,22,103,108,95,76,105,103,104,116,77,111, -100,101,108,80,114,111,100,117,99,116,115,0,12,115,99,101,110,101,67,111,108,111,114,0,0,0,0,0,0,2, -2,4,23,103,108,95,76,105,103,104,116,77,111,100,101,108,80,114,111,100,117,99,116,115,0,1,103,108, -95,70,114,111,110,116,76,105,103,104,116,77,111,100,101,108,80,114,111,100,117,99,116,0,0,0,2,2,4, -23,103,108,95,76,105,103,104,116,77,111,100,101,108,80,114,111,100,117,99,116,115,0,1,103,108,95, -66,97,99,107,76,105,103,104,116,77,111,100,101,108,80,114,111,100,117,99,116,0,0,0,2,2,0,22,103, -108,95,76,105,103,104,116,80,114,111,100,117,99,116,115,0,12,97,109,98,105,101,110,116,0,0,0,1,12, -100,105,102,102,117,115,101,0,0,0,1,12,115,112,101,99,117,108,97,114,0,0,0,0,0,0,2,2,4,23,103,108, -95,76,105,103,104,116,80,114,111,100,117,99,116,115,0,1,103,108,95,70,114,111,110,116,76,105,103, -104,116,80,114,111,100,117,99,116,0,3,18,103,108,95,77,97,120,76,105,103,104,116,115,0,0,0,2,2,4, -23,103,108,95,76,105,103,104,116,80,114,111,100,117,99,116,115,0,1,103,108,95,66,97,99,107,76,105, -103,104,116,80,114,111,100,117,99,116,0,3,18,103,108,95,77,97,120,76,105,103,104,116,115,0,0,0,2,2, -4,12,1,103,108,95,84,101,120,116,117,114,101,69,110,118,67,111,108,111,114,0,3,18,103,108,95,77,97, -120,84,101,120,116,117,114,101,73,109,97,103,101,85,110,105,116,115,0,0,0,2,2,4,12,1,103,108,95,69, -121,101,80,108,97,110,101,83,0,3,18,103,108,95,77,97,120,84,101,120,116,117,114,101,67,111,111,114, -100,115,0,0,0,2,2,4,12,1,103,108,95,69,121,101,80,108,97,110,101,84,0,3,18,103,108,95,77,97,120,84, -101,120,116,117,114,101,67,111,111,114,100,115,0,0,0,2,2,4,12,1,103,108,95,69,121,101,80,108,97, -110,101,82,0,3,18,103,108,95,77,97,120,84,101,120,116,117,114,101,67,111,111,114,100,115,0,0,0,2,2, -4,12,1,103,108,95,69,121,101,80,108,97,110,101,81,0,3,18,103,108,95,77,97,120,84,101,120,116,117, -114,101,67,111,111,114,100,115,0,0,0,2,2,4,12,1,103,108,95,79,98,106,101,99,116,80,108,97,110,101, -83,0,3,18,103,108,95,77,97,120,84,101,120,116,117,114,101,67,111,111,114,100,115,0,0,0,2,2,4,12,1, -103,108,95,79,98,106,101,99,116,80,108,97,110,101,84,0,3,18,103,108,95,77,97,120,84,101,120,116, -117,114,101,67,111,111,114,100,115,0,0,0,2,2,4,12,1,103,108,95,79,98,106,101,99,116,80,108,97,110, -101,82,0,3,18,103,108,95,77,97,120,84,101,120,116,117,114,101,67,111,111,114,100,115,0,0,0,2,2,4, -12,1,103,108,95,79,98,106,101,99,116,80,108,97,110,101,81,0,3,18,103,108,95,77,97,120,84,101,120, -116,117,114,101,67,111,111,114,100,115,0,0,0,2,2,0,22,103,108,95,70,111,103,80,97,114,97,109,101, -116,101,114,115,0,12,99,111,108,111,114,0,0,0,1,9,100,101,110,115,105,116,121,0,0,0,1,9,115,116,97, -114,116,0,0,0,1,9,101,110,100,0,0,0,1,9,115,99,97,108,101,0,0,0,0,0,0,2,2,4,23,103,108,95,70,111, -103,80,97,114,97,109,101,116,101,114,115,0,1,103,108,95,70,111,103,0,0,0,1,0,9,0,114,97,100,105,97, -110,115,0,1,0,0,9,100,101,103,0,0,0,1,8,17,51,0,49,52,49,53,57,51,0,0,18,100,101,103,0,48,17,49,56, -48,0,48,0,0,49,0,0,1,0,10,0,114,97,100,105,97,110,115,0,1,0,0,10,100,101,103,0,0,0,1,8,58,118,101, -99,50,0,17,51,0,49,52,49,53,57,51,0,0,0,0,18,100,101,103,0,48,58,118,101,99,50,0,17,49,56,48,0,48, -0,0,0,0,49,0,0,1,0,11,0,114,97,100,105,97,110,115,0,1,0,0,11,100,101,103,0,0,0,1,8,58,118,101,99, -51,0,17,51,0,49,52,49,53,57,51,0,0,0,0,18,100,101,103,0,48,58,118,101,99,51,0,17,49,56,48,0,48,0,0, -0,0,49,0,0,1,0,12,0,114,97,100,105,97,110,115,0,1,0,0,12,100,101,103,0,0,0,1,8,58,118,101,99,52,0, -17,51,0,49,52,49,53,57,51,0,0,0,0,18,100,101,103,0,48,58,118,101,99,52,0,17,49,56,48,0,48,0,0,0,0, -49,0,0,1,0,9,0,100,101,103,114,101,101,115,0,1,0,0,9,114,97,100,0,0,0,1,8,17,49,56,48,0,48,0,0,18, -114,97,100,0,48,17,51,0,49,52,49,53,57,51,0,0,49,0,0,1,0,10,0,100,101,103,114,101,101,115,0,1,0,0, -10,114,97,100,0,0,0,1,8,58,118,101,99,50,0,17,49,56,48,0,48,0,0,0,0,18,114,97,100,0,48,58,118,101, -99,50,0,17,51,0,49,52,49,53,57,51,0,0,0,0,49,0,0,1,0,11,0,100,101,103,114,101,101,115,0,1,0,0,11, -114,97,100,0,0,0,1,8,58,118,101,99,51,0,17,49,56,48,0,48,0,0,0,0,18,114,97,100,0,48,58,118,101,99, -51,0,17,51,0,49,52,49,53,57,51,0,0,0,0,49,0,0,1,0,12,0,100,101,103,114,101,101,115,0,1,0,0,12,114, -97,100,0,0,0,1,8,58,118,101,99,52,0,17,49,56,48,0,48,0,0,0,0,18,114,97,100,0,48,58,118,101,99,52,0, -17,51,0,49,52,49,53,57,51,0,0,0,0,49,0,0,1,0,9,0,115,105,110,0,1,0,0,9,97,110,103,108,101,0,0,0,1, -3,2,0,9,1,120,0,0,0,4,102,108,111,97,116,95,115,105,110,101,0,18,120,0,0,18,97,110,103,108,101,0,0, -0,8,18,120,0,0,0,1,0,10,0,115,105,110,0,1,0,0,10,97,110,103,108,101,0,0,0,1,8,58,118,101,99,50,0, -58,115,105,110,0,18,97,110,103,108,101,0,59,120,0,0,0,0,58,115,105,110,0,18,97,110,103,108,101,0, -59,121,0,0,0,0,0,0,0,1,0,11,0,115,105,110,0,1,0,0,11,97,110,103,108,101,0,0,0,1,8,58,118,101,99,51, -0,58,115,105,110,0,18,97,110,103,108,101,0,59,120,0,0,0,0,58,115,105,110,0,18,97,110,103,108,101,0, -59,121,0,0,0,0,58,115,105,110,0,18,97,110,103,108,101,0,59,122,0,0,0,0,0,0,0,1,0,12,0,115,105,110, -0,1,0,0,12,97,110,103,108,101,0,0,0,1,8,58,118,101,99,52,0,58,115,105,110,0,18,97,110,103,108,101, -0,59,120,0,0,0,0,58,115,105,110,0,18,97,110,103,108,101,0,59,121,0,0,0,0,58,115,105,110,0,18,97, -110,103,108,101,0,59,122,0,0,0,0,58,115,105,110,0,18,97,110,103,108,101,0,59,119,0,0,0,0,0,0,0,1,0, -9,0,99,111,115,0,1,0,0,9,97,110,103,108,101,0,0,0,1,8,58,115,105,110,0,18,97,110,103,108,101,0,17, -49,0,53,55,48,56,0,0,46,0,0,0,0,1,0,10,0,99,111,115,0,1,0,0,10,97,110,103,108,101,0,0,0,1,8,58,118, -101,99,50,0,58,99,111,115,0,18,97,110,103,108,101,0,59,120,0,0,0,0,58,99,111,115,0,18,97,110,103, -108,101,0,59,121,0,0,0,0,0,0,0,1,0,11,0,99,111,115,0,1,0,0,11,97,110,103,108,101,0,0,0,1,8,58,118, -101,99,51,0,58,99,111,115,0,18,97,110,103,108,101,0,59,120,0,0,0,0,58,99,111,115,0,18,97,110,103, -108,101,0,59,121,0,0,0,0,58,99,111,115,0,18,97,110,103,108,101,0,59,122,0,0,0,0,0,0,0,1,0,12,0,99, -111,115,0,1,0,0,12,97,110,103,108,101,0,0,0,1,8,58,118,101,99,52,0,58,99,111,115,0,18,97,110,103, -108,101,0,59,120,0,0,0,0,58,99,111,115,0,18,97,110,103,108,101,0,59,121,0,0,0,0,58,99,111,115,0,18, -97,110,103,108,101,0,59,122,0,0,0,0,58,99,111,115,0,18,97,110,103,108,101,0,59,119,0,0,0,0,0,0,0,1, -0,9,0,116,97,110,0,1,0,0,9,97,110,103,108,101,0,0,0,1,8,58,115,105,110,0,18,97,110,103,108,101,0,0, -0,58,99,111,115,0,18,97,110,103,108,101,0,0,0,49,0,0,1,0,10,0,116,97,110,0,1,0,0,10,97,110,103,108, -101,0,0,0,1,8,58,118,101,99,50,0,58,116,97,110,0,18,97,110,103,108,101,0,59,120,0,0,0,0,58,116,97, -110,0,18,97,110,103,108,101,0,59,121,0,0,0,0,0,0,0,1,0,11,0,116,97,110,0,1,0,0,11,97,110,103,108, -101,0,0,0,1,8,58,118,101,99,51,0,58,116,97,110,0,18,97,110,103,108,101,0,59,120,0,0,0,0,58,116,97, -110,0,18,97,110,103,108,101,0,59,121,0,0,0,0,58,116,97,110,0,18,97,110,103,108,101,0,59,122,0,0,0, -0,0,0,0,1,0,12,0,116,97,110,0,1,0,0,12,97,110,103,108,101,0,0,0,1,8,58,118,101,99,52,0,58,116,97, -110,0,18,97,110,103,108,101,0,59,120,0,0,0,0,58,116,97,110,0,18,97,110,103,108,101,0,59,121,0,0,0, -0,58,116,97,110,0,18,97,110,103,108,101,0,59,122,0,0,0,0,58,116,97,110,0,18,97,110,103,108,101,0, -59,119,0,0,0,0,0,0,0,1,0,9,0,97,115,105,110,0,1,0,0,9,120,0,0,0,1,3,2,0,9,1,121,0,0,0,4,102,108, -111,97,116,95,97,114,99,115,105,110,101,0,18,121,0,0,18,120,0,0,0,8,18,121,0,0,0,1,0,10,0,97,115, -105,110,0,1,0,0,10,118,0,0,0,1,8,58,118,101,99,50,0,58,97,115,105,110,0,18,118,0,59,120,0,0,0,0,58, -97,115,105,110,0,18,118,0,59,121,0,0,0,0,0,0,0,1,0,11,0,97,115,105,110,0,1,0,0,11,118,0,0,0,1,8,58, -118,101,99,51,0,58,97,115,105,110,0,18,118,0,59,120,0,0,0,0,58,97,115,105,110,0,18,118,0,59,121,0, -0,0,0,58,97,115,105,110,0,18,118,0,59,122,0,0,0,0,0,0,0,1,0,12,0,97,115,105,110,0,1,0,0,12,118,0,0, -0,1,8,58,118,101,99,52,0,58,97,115,105,110,0,18,118,0,59,120,0,0,0,0,58,97,115,105,110,0,18,118,0, -59,121,0,0,0,0,58,97,115,105,110,0,18,118,0,59,122,0,0,0,0,58,97,115,105,110,0,18,118,0,59,119,0,0, -0,0,0,0,0,1,0,9,0,97,99,111,115,0,1,0,0,9,120,0,0,0,1,8,17,49,0,53,55,48,56,0,0,58,97,115,105,110, -0,18,120,0,0,0,47,0,0,1,0,10,0,97,99,111,115,0,1,0,0,10,118,0,0,0,1,8,58,118,101,99,50,0,58,97,99, -111,115,0,18,118,0,59,120,0,0,0,0,58,97,99,111,115,0,18,118,0,59,121,0,0,0,0,0,0,0,1,0,11,0,97,99, -111,115,0,1,0,0,11,118,0,0,0,1,8,58,118,101,99,51,0,58,97,99,111,115,0,18,118,0,59,120,0,0,0,0,58, -97,99,111,115,0,18,118,0,59,121,0,0,0,0,58,97,99,111,115,0,18,118,0,59,122,0,0,0,0,0,0,0,1,0,12,0, -97,99,111,115,0,1,0,0,12,118,0,0,0,1,8,58,118,101,99,52,0,58,97,99,111,115,0,18,118,0,59,120,0,0,0, -0,58,97,99,111,115,0,18,118,0,59,121,0,0,0,0,58,97,99,111,115,0,18,118,0,59,122,0,0,0,0,58,97,99, -111,115,0,18,118,0,59,119,0,0,0,0,0,0,0,1,0,9,0,97,116,97,110,0,1,0,0,9,121,95,111,118,101,114,95, -120,0,0,0,1,3,2,0,9,1,122,0,0,0,4,102,108,111,97,116,95,97,114,99,116,97,110,0,18,122,0,0,18,121, -95,111,118,101,114,95,120,0,0,0,8,18,122,0,0,0,1,0,10,0,97,116,97,110,0,1,0,0,10,121,95,111,118, -101,114,95,120,0,0,0,1,8,58,118,101,99,50,0,58,97,116,97,110,0,18,121,95,111,118,101,114,95,120,0, -59,120,0,0,0,0,58,97,116,97,110,0,18,121,95,111,118,101,114,95,120,0,59,121,0,0,0,0,0,0,0,1,0,11,0, -97,116,97,110,0,1,0,0,11,121,95,111,118,101,114,95,120,0,0,0,1,8,58,118,101,99,51,0,58,97,116,97, -110,0,18,121,95,111,118,101,114,95,120,0,59,120,0,0,0,0,58,97,116,97,110,0,18,121,95,111,118,101, -114,95,120,0,59,121,0,0,0,0,58,97,116,97,110,0,18,121,95,111,118,101,114,95,120,0,59,122,0,0,0,0,0, -0,0,1,0,12,0,97,116,97,110,0,1,0,0,12,121,95,111,118,101,114,95,120,0,0,0,1,8,58,118,101,99,52,0, -58,97,116,97,110,0,18,121,95,111,118,101,114,95,120,0,59,120,0,0,0,0,58,97,116,97,110,0,18,121,95, -111,118,101,114,95,120,0,59,121,0,0,0,0,58,97,116,97,110,0,18,121,95,111,118,101,114,95,120,0,59, -122,0,0,0,0,58,97,116,97,110,0,18,121,95,111,118,101,114,95,120,0,59,119,0,0,0,0,0,0,0,1,0,9,0,97, -116,97,110,0,1,0,0,9,121,0,0,1,0,0,9,120,0,0,0,1,3,2,0,9,1,122,0,2,58,97,116,97,110,0,18,121,0,18, -120,0,49,0,0,0,0,10,18,120,0,17,48,0,48,0,0,40,0,2,10,18,121,0,17,48,0,48,0,0,40,0,8,18,122,0,17, -51,0,49,52,49,53,57,51,0,0,47,0,9,14,0,8,18,122,0,17,51,0,49,52,49,53,57,51,0,0,46,0,0,9,14,0,8,18, -122,0,0,0,1,0,10,0,97,116,97,110,0,1,0,0,10,117,0,0,1,0,0,10,118,0,0,0,1,8,58,118,101,99,50,0,58, -97,116,97,110,0,18,117,0,59,120,0,0,18,118,0,59,120,0,0,0,0,58,97,116,97,110,0,18,117,0,59,121,0,0, -18,118,0,59,121,0,0,0,0,0,0,0,1,0,11,0,97,116,97,110,0,1,0,0,11,117,0,0,1,0,0,11,118,0,0,0,1,8,58, -118,101,99,51,0,58,97,116,97,110,0,18,117,0,59,120,0,0,18,118,0,59,120,0,0,0,0,58,97,116,97,110,0, -18,117,0,59,121,0,0,18,118,0,59,121,0,0,0,0,58,97,116,97,110,0,18,117,0,59,122,0,0,18,118,0,59,122, -0,0,0,0,0,0,0,1,0,12,0,97,116,97,110,0,1,0,0,12,117,0,0,1,0,0,12,118,0,0,0,1,8,58,118,101,99,52,0, -58,97,116,97,110,0,18,117,0,59,120,0,0,18,118,0,59,120,0,0,0,0,58,97,116,97,110,0,18,117,0,59,121, -0,0,18,118,0,59,121,0,0,0,0,58,97,116,97,110,0,18,117,0,59,122,0,0,18,118,0,59,122,0,0,0,0,58,97, -116,97,110,0,18,117,0,59,119,0,0,18,118,0,59,119,0,0,0,0,0,0,0,1,0,9,0,112,111,119,0,1,0,0,9,120,0, -0,1,0,0,9,121,0,0,0,1,3,2,0,9,1,112,0,0,0,4,102,108,111,97,116,95,112,111,119,101,114,0,18,112,0,0, -18,120,0,0,18,121,0,0,0,8,18,112,0,0,0,1,0,10,0,112,111,119,0,1,0,0,10,118,0,0,1,0,0,10,117,0,0,0, -1,8,58,118,101,99,50,0,58,112,111,119,0,18,118,0,59,120,0,0,18,117,0,59,120,0,0,0,0,58,112,111,119, -0,18,118,0,59,121,0,0,18,117,0,59,121,0,0,0,0,0,0,0,1,0,11,0,112,111,119,0,1,0,0,11,118,0,0,1,0,0, -11,117,0,0,0,1,8,58,118,101,99,51,0,58,112,111,119,0,18,118,0,59,120,0,0,18,117,0,59,120,0,0,0,0, -58,112,111,119,0,18,118,0,59,121,0,0,18,117,0,59,121,0,0,0,0,58,112,111,119,0,18,118,0,59,122,0,0, -18,117,0,59,122,0,0,0,0,0,0,0,1,0,12,0,112,111,119,0,1,0,0,12,118,0,0,1,0,0,12,117,0,0,0,1,8,58, -118,101,99,52,0,58,112,111,119,0,18,118,0,59,120,0,0,18,117,0,59,120,0,0,0,0,58,112,111,119,0,18, -118,0,59,121,0,0,18,117,0,59,121,0,0,0,0,58,112,111,119,0,18,118,0,59,122,0,0,18,117,0,59,122,0,0, -0,0,58,112,111,119,0,18,118,0,59,119,0,0,18,117,0,59,119,0,0,0,0,0,0,0,1,0,9,0,101,120,112,0,1,0,0, -9,120,0,0,0,1,8,58,112,111,119,0,17,50,0,55,49,56,50,56,49,56,51,0,0,0,18,120,0,0,0,0,0,1,0,10,0, -101,120,112,0,1,0,0,10,118,0,0,0,1,8,58,112,111,119,0,58,118,101,99,50,0,17,50,0,55,49,56,50,56,49, -56,51,0,0,0,0,0,18,118,0,0,0,0,0,1,0,11,0,101,120,112,0,1,0,0,11,118,0,0,0,1,8,58,112,111,119,0,58, -118,101,99,51,0,17,50,0,55,49,56,50,56,49,56,51,0,0,0,0,0,18,118,0,0,0,0,0,1,0,12,0,101,120,112,0, -1,0,0,12,118,0,0,0,1,8,58,112,111,119,0,58,118,101,99,52,0,17,50,0,55,49,56,50,56,49,56,51,0,0,0,0, -0,18,118,0,0,0,0,0,1,0,9,0,108,111,103,50,0,1,0,0,9,120,0,0,0,1,3,2,0,9,1,121,0,0,0,4,102,108,111, -97,116,95,108,111,103,50,0,18,121,0,0,18,120,0,0,0,8,18,121,0,0,0,1,0,10,0,108,111,103,50,0,1,0,0, -10,118,0,0,0,1,8,58,118,101,99,50,0,58,108,111,103,50,0,18,118,0,59,120,0,0,0,0,58,108,111,103,50, -0,18,118,0,59,121,0,0,0,0,0,0,0,1,0,11,0,108,111,103,50,0,1,0,0,11,118,0,0,0,1,8,58,118,101,99,51, -0,58,108,111,103,50,0,18,118,0,59,120,0,0,0,0,58,108,111,103,50,0,18,118,0,59,121,0,0,0,0,58,108, -111,103,50,0,18,118,0,59,122,0,0,0,0,0,0,0,1,0,12,0,108,111,103,50,0,1,0,0,12,118,0,0,0,1,8,58,118, -101,99,52,0,58,108,111,103,50,0,18,118,0,59,120,0,0,0,0,58,108,111,103,50,0,18,118,0,59,121,0,0,0, -0,58,108,111,103,50,0,18,118,0,59,122,0,0,0,0,58,108,111,103,50,0,18,118,0,59,119,0,0,0,0,0,0,0,1, -0,9,0,108,111,103,0,1,0,0,9,120,0,0,0,1,8,58,108,111,103,50,0,18,120,0,0,0,58,108,111,103,50,0,17, -50,0,55,49,56,50,56,49,56,51,0,0,0,0,49,0,0,1,0,10,0,108,111,103,0,1,0,0,10,118,0,0,0,1,8,58,108, -111,103,50,0,18,118,0,0,0,58,108,111,103,50,0,58,118,101,99,50,0,17,50,0,55,49,56,50,56,49,56,51,0, -0,0,0,0,0,49,0,0,1,0,11,0,108,111,103,0,1,0,0,11,118,0,0,0,1,8,58,108,111,103,50,0,18,118,0,0,0,58, -108,111,103,50,0,58,118,101,99,51,0,17,50,0,55,49,56,50,56,49,56,51,0,0,0,0,0,0,49,0,0,1,0,12,0, -108,111,103,0,1,0,0,12,118,0,0,0,1,8,58,108,111,103,50,0,18,118,0,0,0,58,108,111,103,50,0,58,118, -101,99,52,0,17,50,0,55,49,56,50,56,49,56,51,0,0,0,0,0,0,49,0,0,1,0,9,0,101,120,112,50,0,1,0,0,9, -120,0,0,0,1,8,58,112,111,119,0,17,50,0,48,0,0,0,18,120,0,0,0,0,0,1,0,10,0,101,120,112,50,0,1,0,0, -10,118,0,0,0,1,8,58,112,111,119,0,58,118,101,99,50,0,17,50,0,48,0,0,0,0,0,18,118,0,0,0,0,0,1,0,11, -0,101,120,112,50,0,1,0,0,11,118,0,0,0,1,8,58,112,111,119,0,58,118,101,99,51,0,17,50,0,48,0,0,0,0,0, -18,118,0,0,0,0,0,1,0,12,0,101,120,112,50,0,1,0,0,12,118,0,0,0,1,8,58,112,111,119,0,58,118,101,99, -52,0,17,50,0,48,0,0,0,0,0,18,118,0,0,0,0,0,1,0,9,0,115,113,114,116,0,1,0,0,9,120,0,0,0,1,8,58,112, -111,119,0,18,120,0,0,17,48,0,53,0,0,0,0,0,0,1,0,10,0,115,113,114,116,0,1,0,0,10,118,0,0,0,1,8,58, -112,111,119,0,18,118,0,0,58,118,101,99,50,0,17,48,0,53,0,0,0,0,0,0,0,0,1,0,11,0,115,113,114,116,0, -1,0,0,11,118,0,0,0,1,8,58,112,111,119,0,18,118,0,0,58,118,101,99,51,0,17,48,0,53,0,0,0,0,0,0,0,0,1, -0,12,0,115,113,114,116,0,1,0,0,12,118,0,0,0,1,8,58,112,111,119,0,18,118,0,0,58,118,101,99,52,0,17, -48,0,53,0,0,0,0,0,0,0,0,1,0,9,0,105,110,118,101,114,115,101,115,113,114,116,0,1,0,0,9,120,0,0,0,1, -8,17,49,0,48,0,0,58,115,113,114,116,0,18,120,0,0,0,49,0,0,1,0,10,0,105,110,118,101,114,115,101,115, -113,114,116,0,1,0,0,10,118,0,0,0,1,8,58,118,101,99,50,0,17,49,0,48,0,0,0,0,58,115,113,114,116,0,18, -118,0,0,0,49,0,0,1,0,11,0,105,110,118,101,114,115,101,115,113,114,116,0,1,0,0,11,118,0,0,0,1,8,58, -118,101,99,51,0,17,49,0,48,0,0,0,0,58,115,113,114,116,0,18,118,0,0,0,49,0,0,1,0,12,0,105,110,118, -101,114,115,101,115,113,114,116,0,1,0,0,12,118,0,0,0,1,8,58,118,101,99,52,0,17,49,0,48,0,0,0,0,58, -115,113,114,116,0,18,118,0,0,0,49,0,0,1,0,9,0,97,98,115,0,1,0,0,9,120,0,0,0,1,8,18,120,0,17,48,0, -48,0,0,43,18,120,0,18,120,0,54,31,0,0,1,0,10,0,97,98,115,0,1,0,0,10,118,0,0,0,1,8,58,118,101,99,50, -0,58,97,98,115,0,18,118,0,59,120,0,0,0,0,58,97,98,115,0,18,118,0,59,121,0,0,0,0,0,0,0,1,0,11,0,97, -98,115,0,1,0,0,11,118,0,0,0,1,8,58,118,101,99,51,0,58,97,98,115,0,18,118,0,59,120,0,0,0,0,58,97,98, -115,0,18,118,0,59,121,0,0,0,0,58,97,98,115,0,18,118,0,59,122,0,0,0,0,0,0,0,1,0,12,0,97,98,115,0,1, -0,0,12,118,0,0,0,1,8,58,118,101,99,52,0,58,97,98,115,0,18,118,0,59,120,0,0,0,0,58,97,98,115,0,18, -118,0,59,121,0,0,0,0,58,97,98,115,0,18,118,0,59,122,0,0,0,0,58,97,98,115,0,18,118,0,59,119,0,0,0,0, -0,0,0,1,0,9,0,115,105,103,110,0,1,0,0,9,120,0,0,0,1,8,18,120,0,17,48,0,48,0,0,41,17,49,0,48,0,0,18, -120,0,17,48,0,48,0,0,40,17,49,0,48,0,0,54,17,48,0,48,0,0,31,31,0,0,1,0,10,0,115,105,103,110,0,1,0, -0,10,118,0,0,0,1,8,58,118,101,99,50,0,58,115,105,103,110,0,18,118,0,59,120,0,0,0,0,58,115,105,103, -110,0,18,118,0,59,121,0,0,0,0,0,0,0,1,0,11,0,115,105,103,110,0,1,0,0,11,118,0,0,0,1,8,58,118,101, -99,51,0,58,115,105,103,110,0,18,118,0,59,120,0,0,0,0,58,115,105,103,110,0,18,118,0,59,121,0,0,0,0, -58,115,105,103,110,0,18,118,0,59,122,0,0,0,0,0,0,0,1,0,12,0,115,105,103,110,0,1,0,0,12,118,0,0,0,1, -8,58,118,101,99,52,0,58,115,105,103,110,0,18,118,0,59,120,0,0,0,0,58,115,105,103,110,0,18,118,0,59, -121,0,0,0,0,58,115,105,103,110,0,18,118,0,59,122,0,0,0,0,58,115,105,103,110,0,18,118,0,59,119,0,0, -0,0,0,0,0,1,0,9,0,102,108,111,111,114,0,1,0,0,9,120,0,0,0,1,3,2,0,9,1,121,0,0,0,4,102,108,111,97, -116,95,102,108,111,111,114,0,18,121,0,0,18,120,0,0,0,8,18,121,0,0,0,1,0,10,0,102,108,111,111,114,0, -1,0,0,10,118,0,0,0,1,8,58,118,101,99,50,0,58,102,108,111,111,114,0,18,118,0,59,120,0,0,0,0,58,102, -108,111,111,114,0,18,118,0,59,121,0,0,0,0,0,0,0,1,0,11,0,102,108,111,111,114,0,1,0,0,11,118,0,0,0, -1,8,58,118,101,99,51,0,58,102,108,111,111,114,0,18,118,0,59,120,0,0,0,0,58,102,108,111,111,114,0, -18,118,0,59,121,0,0,0,0,58,102,108,111,111,114,0,18,118,0,59,122,0,0,0,0,0,0,0,1,0,12,0,102,108, -111,111,114,0,1,0,0,12,118,0,0,0,1,8,58,118,101,99,52,0,58,102,108,111,111,114,0,18,118,0,59,120,0, -0,0,0,58,102,108,111,111,114,0,18,118,0,59,121,0,0,0,0,58,102,108,111,111,114,0,18,118,0,59,122,0, -0,0,0,58,102,108,111,111,114,0,18,118,0,59,119,0,0,0,0,0,0,0,1,0,9,0,99,101,105,108,0,1,0,0,9,120, -0,0,0,1,3,2,0,9,1,121,0,0,0,4,102,108,111,97,116,95,99,101,105,108,0,18,121,0,0,18,120,0,0,0,8,18, -121,0,0,0,1,0,10,0,99,101,105,108,0,1,0,0,10,118,0,0,0,1,8,58,118,101,99,50,0,58,99,101,105,108,0, -18,118,0,59,120,0,0,0,0,58,99,101,105,108,0,18,118,0,59,121,0,0,0,0,0,0,0,1,0,11,0,99,101,105,108, -0,1,0,0,11,118,0,0,0,1,8,58,118,101,99,51,0,58,99,101,105,108,0,18,118,0,59,120,0,0,0,0,58,99,101, -105,108,0,18,118,0,59,121,0,0,0,0,58,99,101,105,108,0,18,118,0,59,122,0,0,0,0,0,0,0,1,0,12,0,99, -101,105,108,0,1,0,0,12,118,0,0,0,1,8,58,118,101,99,52,0,58,99,101,105,108,0,18,118,0,59,120,0,0,0, -0,58,99,101,105,108,0,18,118,0,59,121,0,0,0,0,58,99,101,105,108,0,18,118,0,59,122,0,0,0,0,58,99, -101,105,108,0,18,118,0,59,119,0,0,0,0,0,0,0,1,0,9,0,102,114,97,99,116,0,1,0,0,9,120,0,0,0,1,8,18, -120,0,58,102,108,111,111,114,0,18,120,0,0,0,47,0,0,1,0,10,0,102,114,97,99,116,0,1,0,0,10,118,0,0,0, -1,8,18,118,0,58,102,108,111,111,114,0,18,118,0,0,0,47,0,0,1,0,11,0,102,114,97,99,116,0,1,0,0,11, -118,0,0,0,1,8,18,118,0,58,102,108,111,111,114,0,18,118,0,0,0,47,0,0,1,0,12,0,102,114,97,99,116,0,1, -0,0,12,118,0,0,0,1,8,18,118,0,58,102,108,111,111,114,0,18,118,0,0,0,47,0,0,1,0,9,0,109,111,100,0,1, -0,0,9,120,0,0,1,0,0,9,121,0,0,0,1,8,18,120,0,18,121,0,58,102,108,111,111,114,0,18,120,0,18,121,0, -49,0,0,48,47,0,0,1,0,10,0,109,111,100,0,1,0,0,10,118,0,0,1,0,0,9,117,0,0,0,1,8,18,118,0,18,117,0, -58,102,108,111,111,114,0,18,118,0,18,117,0,49,0,0,48,47,0,0,1,0,11,0,109,111,100,0,1,0,0,11,118,0, -0,1,0,0,9,117,0,0,0,1,8,18,118,0,18,117,0,58,102,108,111,111,114,0,18,118,0,18,117,0,49,0,0,48,47, -0,0,1,0,12,0,109,111,100,0,1,0,0,12,118,0,0,1,0,0,9,117,0,0,0,1,8,18,118,0,18,117,0,58,102,108,111, -111,114,0,18,118,0,18,117,0,49,0,0,48,47,0,0,1,0,10,0,109,111,100,0,1,0,0,10,118,0,0,1,0,0,10,117, -0,0,0,1,8,18,118,0,18,117,0,58,102,108,111,111,114,0,18,118,0,18,117,0,49,0,0,48,47,0,0,1,0,11,0, -109,111,100,0,1,0,0,11,118,0,0,1,0,0,11,117,0,0,0,1,8,18,118,0,18,117,0,58,102,108,111,111,114,0, -18,118,0,18,117,0,49,0,0,48,47,0,0,1,0,12,0,109,111,100,0,1,0,0,12,118,0,0,1,0,0,12,117,0,0,0,1,8, -18,118,0,18,117,0,58,102,108,111,111,114,0,18,118,0,18,117,0,49,0,0,48,47,0,0,1,0,9,0,109,105,110, -0,1,0,0,9,120,0,0,1,0,0,9,121,0,0,0,1,8,18,120,0,18,121,0,40,18,120,0,18,121,0,31,0,0,1,0,10,0,109, -105,110,0,1,0,0,10,118,0,0,1,0,0,10,117,0,0,0,1,8,58,118,101,99,50,0,58,109,105,110,0,18,118,0,59, -120,0,0,18,117,0,59,120,0,0,0,0,58,109,105,110,0,18,118,0,59,121,0,0,18,117,0,59,121,0,0,0,0,0,0,0, -1,0,11,0,109,105,110,0,1,0,0,11,118,0,0,1,0,0,11,117,0,0,0,1,8,58,118,101,99,51,0,58,109,105,110,0, -18,118,0,59,120,0,0,18,117,0,59,120,0,0,0,0,58,109,105,110,0,18,118,0,59,121,0,0,18,117,0,59,121,0, -0,0,0,58,109,105,110,0,18,118,0,59,122,0,0,18,117,0,59,122,0,0,0,0,0,0,0,1,0,12,0,109,105,110,0,1, -0,0,12,118,0,0,1,0,0,12,117,0,0,0,1,8,58,118,101,99,52,0,58,109,105,110,0,18,118,0,59,120,0,0,18, -117,0,59,120,0,0,0,0,58,109,105,110,0,18,118,0,59,121,0,0,18,117,0,59,121,0,0,0,0,58,109,105,110,0, -18,118,0,59,122,0,0,18,117,0,59,122,0,0,0,0,58,109,105,110,0,18,118,0,59,119,0,0,18,117,0,59,119,0, -0,0,0,0,0,0,1,0,10,0,109,105,110,0,1,0,0,10,118,0,0,1,0,0,9,121,0,0,0,1,8,58,109,105,110,0,18,118, -0,0,58,118,101,99,50,0,18,121,0,0,0,0,0,0,0,1,0,11,0,109,105,110,0,1,0,0,11,118,0,0,1,0,0,9,121,0, -0,0,1,8,58,109,105,110,0,18,118,0,0,58,118,101,99,51,0,18,121,0,0,0,0,0,0,0,1,0,12,0,109,105,110,0, -1,0,0,12,118,0,0,1,0,0,9,121,0,0,0,1,8,58,109,105,110,0,18,118,0,0,58,118,101,99,52,0,18,121,0,0,0, -0,0,0,0,1,0,9,0,109,97,120,0,1,0,0,9,120,0,0,1,0,0,9,121,0,0,0,1,8,18,120,0,18,121,0,40,18,121,0, -18,120,0,31,0,0,1,0,10,0,109,97,120,0,1,0,0,10,118,0,0,1,0,0,10,117,0,0,0,1,8,58,118,101,99,50,0, -58,109,97,120,0,18,118,0,59,120,0,0,18,117,0,59,120,0,0,0,0,58,109,97,120,0,18,118,0,59,121,0,0,18, -117,0,59,121,0,0,0,0,0,0,0,1,0,11,0,109,97,120,0,1,0,0,11,118,0,0,1,0,0,11,117,0,0,0,1,8,58,118, -101,99,51,0,58,109,97,120,0,18,118,0,59,120,0,0,18,117,0,59,120,0,0,0,0,58,109,97,120,0,18,118,0, -59,121,0,0,18,117,0,59,121,0,0,0,0,58,109,97,120,0,18,118,0,59,122,0,0,18,117,0,59,122,0,0,0,0,0,0, -0,1,0,12,0,109,97,120,0,1,0,0,12,118,0,0,1,0,0,12,117,0,0,0,1,8,58,118,101,99,52,0,58,109,97,120,0, -18,118,0,59,120,0,0,18,117,0,59,120,0,0,0,0,58,109,97,120,0,18,118,0,59,121,0,0,18,117,0,59,121,0, -0,0,0,58,109,97,120,0,18,118,0,59,122,0,0,18,117,0,59,122,0,0,0,0,58,109,97,120,0,18,118,0,59,119, -0,0,18,117,0,59,119,0,0,0,0,0,0,0,1,0,10,0,109,97,120,0,1,0,0,10,118,0,0,1,0,0,9,121,0,0,0,1,8,58, -109,97,120,0,18,118,0,0,58,118,101,99,50,0,18,121,0,0,0,0,0,0,0,1,0,11,0,109,97,120,0,1,0,0,11,118, -0,0,1,0,0,9,121,0,0,0,1,8,58,109,97,120,0,18,118,0,0,58,118,101,99,51,0,18,121,0,0,0,0,0,0,0,1,0, -12,0,109,97,120,0,1,0,0,12,118,0,0,1,0,0,9,121,0,0,0,1,8,58,109,97,120,0,18,118,0,0,58,118,101,99, -52,0,18,121,0,0,0,0,0,0,0,1,0,9,0,99,108,97,109,112,0,1,0,0,9,120,0,0,1,0,0,9,109,105,110,86,97, -108,0,0,1,0,0,9,109,97,120,86,97,108,0,0,0,1,8,58,109,105,110,0,58,109,97,120,0,18,120,0,0,18,109, -105,110,86,97,108,0,0,0,0,18,109,97,120,86,97,108,0,0,0,0,0,1,0,10,0,99,108,97,109,112,0,1,0,0,10, -120,0,0,1,0,0,9,109,105,110,86,97,108,0,0,1,0,0,9,109,97,120,86,97,108,0,0,0,1,8,58,109,105,110,0, -58,109,97,120,0,18,120,0,0,18,109,105,110,86,97,108,0,0,0,0,18,109,97,120,86,97,108,0,0,0,0,0,1,0, -11,0,99,108,97,109,112,0,1,0,0,11,120,0,0,1,0,0,9,109,105,110,86,97,108,0,0,1,0,0,9,109,97,120,86, -97,108,0,0,0,1,8,58,109,105,110,0,58,109,97,120,0,18,120,0,0,18,109,105,110,86,97,108,0,0,0,0,18, -109,97,120,86,97,108,0,0,0,0,0,1,0,12,0,99,108,97,109,112,0,1,0,0,12,120,0,0,1,0,0,9,109,105,110, -86,97,108,0,0,1,0,0,9,109,97,120,86,97,108,0,0,0,1,8,58,109,105,110,0,58,109,97,120,0,18,120,0,0, -18,109,105,110,86,97,108,0,0,0,0,18,109,97,120,86,97,108,0,0,0,0,0,1,0,10,0,99,108,97,109,112,0,1, -0,0,10,120,0,0,1,0,0,10,109,105,110,86,97,108,0,0,1,0,0,10,109,97,120,86,97,108,0,0,0,1,8,58,109, -105,110,0,58,109,97,120,0,18,120,0,0,18,109,105,110,86,97,108,0,0,0,0,18,109,97,120,86,97,108,0,0, -0,0,0,1,0,11,0,99,108,97,109,112,0,1,0,0,11,120,0,0,1,0,0,11,109,105,110,86,97,108,0,0,1,0,0,11, -109,97,120,86,97,108,0,0,0,1,8,58,109,105,110,0,58,109,97,120,0,18,120,0,0,18,109,105,110,86,97, -108,0,0,0,0,18,109,97,120,86,97,108,0,0,0,0,0,1,0,12,0,99,108,97,109,112,0,1,0,0,12,120,0,0,1,0,0, -12,109,105,110,86,97,108,0,0,1,0,0,12,109,97,120,86,97,108,0,0,0,1,8,58,109,105,110,0,58,109,97, -120,0,18,120,0,0,18,109,105,110,86,97,108,0,0,0,0,18,109,97,120,86,97,108,0,0,0,0,0,1,0,9,0,109, -105,120,0,1,0,0,9,120,0,0,1,0,0,9,121,0,0,1,0,0,9,97,0,0,0,1,8,18,120,0,17,49,0,48,0,0,18,97,0,47, -48,18,121,0,18,97,0,48,46,0,0,1,0,10,0,109,105,120,0,1,0,0,10,120,0,0,1,0,0,10,121,0,0,1,0,0,9,97, -0,0,0,1,8,18,120,0,17,49,0,48,0,0,18,97,0,47,48,18,121,0,18,97,0,48,46,0,0,1,0,11,0,109,105,120,0, -1,0,0,11,120,0,0,1,0,0,11,121,0,0,1,0,0,9,97,0,0,0,1,8,18,120,0,17,49,0,48,0,0,18,97,0,47,48,18, -121,0,18,97,0,48,46,0,0,1,0,12,0,109,105,120,0,1,0,0,12,120,0,0,1,0,0,12,121,0,0,1,0,0,9,97,0,0,0, -1,8,18,120,0,17,49,0,48,0,0,18,97,0,47,48,18,121,0,18,97,0,48,46,0,0,1,0,10,0,109,105,120,0,1,0,0, -10,120,0,0,1,0,0,10,121,0,0,1,0,0,10,97,0,0,0,1,8,18,120,0,17,49,0,48,0,0,18,97,0,47,48,18,121,0, -18,97,0,48,46,0,0,1,0,11,0,109,105,120,0,1,0,0,11,120,0,0,1,0,0,11,121,0,0,1,0,0,11,97,0,0,0,1,8, -18,120,0,17,49,0,48,0,0,18,97,0,47,48,18,121,0,18,97,0,48,46,0,0,1,0,12,0,109,105,120,0,1,0,0,12, -120,0,0,1,0,0,12,121,0,0,1,0,0,12,97,0,0,0,1,8,18,120,0,17,49,0,48,0,0,18,97,0,47,48,18,121,0,18, -97,0,48,46,0,0,1,0,9,0,115,116,101,112,0,1,0,0,9,101,100,103,101,0,0,1,0,0,9,120,0,0,0,1,8,18,120, -0,18,101,100,103,101,0,40,17,48,0,48,0,0,17,49,0,48,0,0,31,0,0,1,0,10,0,115,116,101,112,0,1,0,0,10, -101,100,103,101,0,0,1,0,0,10,118,0,0,0,1,8,58,118,101,99,50,0,58,115,116,101,112,0,18,101,100,103, -101,0,59,120,0,0,18,118,0,59,120,0,0,0,0,58,115,116,101,112,0,18,101,100,103,101,0,59,121,0,0,18, -118,0,59,121,0,0,0,0,0,0,0,1,0,11,0,115,116,101,112,0,1,0,0,11,101,100,103,101,0,0,1,0,0,11,118,0, -0,0,1,8,58,118,101,99,51,0,58,115,116,101,112,0,18,101,100,103,101,0,59,120,0,0,18,118,0,59,120,0, -0,0,0,58,115,116,101,112,0,18,101,100,103,101,0,59,121,0,0,18,118,0,59,121,0,0,0,0,58,115,116,101, -112,0,18,101,100,103,101,0,59,122,0,0,18,118,0,59,122,0,0,0,0,0,0,0,1,0,12,0,115,116,101,112,0,1,0, -0,12,101,100,103,101,0,0,1,0,0,12,118,0,0,0,1,8,58,118,101,99,52,0,58,115,116,101,112,0,18,101,100, -103,101,0,59,120,0,0,18,118,0,59,120,0,0,0,0,58,115,116,101,112,0,18,101,100,103,101,0,59,121,0,0, -18,118,0,59,121,0,0,0,0,58,115,116,101,112,0,18,101,100,103,101,0,59,122,0,0,18,118,0,59,122,0,0,0, -0,58,115,116,101,112,0,18,101,100,103,101,0,59,119,0,0,18,118,0,59,119,0,0,0,0,0,0,0,1,0,10,0,115, -116,101,112,0,1,0,0,9,101,100,103,101,0,0,1,0,0,10,118,0,0,0,1,8,58,115,116,101,112,0,58,118,101, -99,50,0,18,101,100,103,101,0,0,0,0,18,118,0,0,0,0,0,1,0,11,0,115,116,101,112,0,1,0,0,9,101,100,103, -101,0,0,1,0,0,11,118,0,0,0,1,8,58,115,116,101,112,0,58,118,101,99,51,0,18,101,100,103,101,0,0,0,0, -18,118,0,0,0,0,0,1,0,12,0,115,116,101,112,0,1,0,0,9,101,100,103,101,0,0,1,0,0,12,118,0,0,0,1,8,58, -115,116,101,112,0,58,118,101,99,52,0,18,101,100,103,101,0,0,0,0,18,118,0,0,0,0,0,1,0,9,0,115,109, -111,111,116,104,115,116,101,112,0,1,0,0,9,101,100,103,101,48,0,0,1,0,0,9,101,100,103,101,49,0,0,1, -0,0,9,120,0,0,0,1,3,2,0,9,1,116,0,2,58,99,108,97,109,112,0,18,120,0,18,101,100,103,101,48,0,47,18, -101,100,103,101,49,0,18,101,100,103,101,48,0,47,49,0,17,48,0,48,0,0,0,17,49,0,48,0,0,0,0,0,0,8,18, -116,0,18,116,0,48,17,51,0,48,0,0,17,50,0,48,0,0,18,116,0,48,47,48,0,0,1,0,10,0,115,109,111,111,116, -104,115,116,101,112,0,1,0,0,10,101,100,103,101,48,0,0,1,0,0,10,101,100,103,101,49,0,0,1,0,0,10,118, -0,0,0,1,8,58,118,101,99,50,0,58,115,109,111,111,116,104,115,116,101,112,0,18,101,100,103,101,48,0, -59,120,0,0,18,101,100,103,101,49,0,59,120,0,0,18,118,0,59,120,0,0,0,0,58,115,109,111,111,116,104, -115,116,101,112,0,18,101,100,103,101,48,0,59,121,0,0,18,101,100,103,101,49,0,59,121,0,0,18,118,0, -59,121,0,0,0,0,0,0,0,1,0,11,0,115,109,111,111,116,104,115,116,101,112,0,1,0,0,11,101,100,103,101, -48,0,0,1,0,0,11,101,100,103,101,49,0,0,1,0,0,11,118,0,0,0,1,8,58,118,101,99,51,0,58,115,109,111, -111,116,104,115,116,101,112,0,18,101,100,103,101,48,0,59,120,0,0,18,101,100,103,101,49,0,59,120,0, -0,18,118,0,59,120,0,0,0,0,58,115,109,111,111,116,104,115,116,101,112,0,18,101,100,103,101,48,0,59, -121,0,0,18,101,100,103,101,49,0,59,121,0,0,18,118,0,59,121,0,0,0,0,58,115,109,111,111,116,104,115, -116,101,112,0,18,101,100,103,101,48,0,59,122,0,0,18,101,100,103,101,49,0,59,122,0,0,18,118,0,59, -122,0,0,0,0,0,0,0,1,0,12,0,115,109,111,111,116,104,115,116,101,112,0,1,0,0,12,101,100,103,101,48,0, -0,1,0,0,12,101,100,103,101,49,0,0,1,0,0,12,118,0,0,0,1,8,58,118,101,99,52,0,58,115,109,111,111,116, -104,115,116,101,112,0,18,101,100,103,101,48,0,59,120,0,0,18,101,100,103,101,49,0,59,120,0,0,18,118, -0,59,120,0,0,0,0,58,115,109,111,111,116,104,115,116,101,112,0,18,101,100,103,101,48,0,59,121,0,0, -18,101,100,103,101,49,0,59,121,0,0,18,118,0,59,121,0,0,0,0,58,115,109,111,111,116,104,115,116,101, -112,0,18,101,100,103,101,48,0,59,122,0,0,18,101,100,103,101,49,0,59,122,0,0,18,118,0,59,122,0,0,0, -0,58,115,109,111,111,116,104,115,116,101,112,0,18,101,100,103,101,48,0,59,119,0,0,18,101,100,103, -101,49,0,59,119,0,0,18,118,0,59,119,0,0,0,0,0,0,0,1,0,10,0,115,109,111,111,116,104,115,116,101,112, -0,1,0,0,9,101,100,103,101,48,0,0,1,0,0,9,101,100,103,101,49,0,0,1,0,0,10,118,0,0,0,1,8,58,118,101, -99,50,0,58,115,109,111,111,116,104,115,116,101,112,0,18,101,100,103,101,48,0,0,18,101,100,103,101, -49,0,0,18,118,0,59,120,0,0,0,0,58,115,109,111,111,116,104,115,116,101,112,0,18,101,100,103,101,48, -0,0,18,101,100,103,101,49,0,0,18,118,0,59,121,0,0,0,0,0,0,0,1,0,11,0,115,109,111,111,116,104,115, -116,101,112,0,1,0,0,9,101,100,103,101,48,0,0,1,0,0,9,101,100,103,101,49,0,0,1,0,0,11,118,0,0,0,1,8, -58,118,101,99,51,0,58,115,109,111,111,116,104,115,116,101,112,0,18,101,100,103,101,48,0,0,18,101, -100,103,101,49,0,0,18,118,0,59,120,0,0,0,0,58,115,109,111,111,116,104,115,116,101,112,0,18,101,100, -103,101,48,0,0,18,101,100,103,101,49,0,0,18,118,0,59,121,0,0,0,0,58,115,109,111,111,116,104,115, -116,101,112,0,18,101,100,103,101,48,0,0,18,101,100,103,101,49,0,0,18,118,0,59,122,0,0,0,0,0,0,0,1, -0,12,0,115,109,111,111,116,104,115,116,101,112,0,1,0,0,9,101,100,103,101,48,0,0,1,0,0,9,101,100, -103,101,49,0,0,1,0,0,12,118,0,0,0,1,8,58,118,101,99,52,0,58,115,109,111,111,116,104,115,116,101, -112,0,18,101,100,103,101,48,0,0,18,101,100,103,101,49,0,0,18,118,0,59,120,0,0,0,0,58,115,109,111, -111,116,104,115,116,101,112,0,18,101,100,103,101,48,0,0,18,101,100,103,101,49,0,0,18,118,0,59,121, -0,0,0,0,58,115,109,111,111,116,104,115,116,101,112,0,18,101,100,103,101,48,0,0,18,101,100,103,101, -49,0,0,18,118,0,59,122,0,0,0,0,58,115,109,111,111,116,104,115,116,101,112,0,18,101,100,103,101,48, -0,0,18,101,100,103,101,49,0,0,18,118,0,59,119,0,0,0,0,0,0,0,1,0,9,0,100,111,116,0,1,0,0,9,120,0,0, -1,0,0,9,121,0,0,0,1,8,18,120,0,18,121,0,48,0,0,1,0,9,0,100,111,116,0,1,0,0,10,118,0,0,1,0,0,10,117, -0,0,0,1,8,18,118,0,59,120,0,18,117,0,59,120,0,48,18,118,0,59,121,0,18,117,0,59,121,0,48,46,0,0,1,0, -9,0,100,111,116,0,1,0,0,11,118,0,0,1,0,0,11,117,0,0,0,1,8,18,118,0,59,120,0,18,117,0,59,120,0,48, -18,118,0,59,121,0,18,117,0,59,121,0,48,46,18,118,0,59,122,0,18,117,0,59,122,0,48,46,0,0,1,0,9,0, -100,111,116,0,1,0,0,12,118,0,0,1,0,0,12,117,0,0,0,1,8,18,118,0,59,120,0,18,117,0,59,120,0,48,18, -118,0,59,121,0,18,117,0,59,121,0,48,46,18,118,0,59,122,0,18,117,0,59,122,0,48,46,18,118,0,59,119,0, -18,117,0,59,119,0,48,46,0,0,1,0,9,0,108,101,110,103,116,104,0,1,0,0,9,120,0,0,0,1,8,58,115,113,114, -116,0,58,100,111,116,0,18,120,0,0,18,120,0,0,0,0,0,0,0,1,0,9,0,108,101,110,103,116,104,0,1,0,0,10, -118,0,0,0,1,8,58,115,113,114,116,0,58,100,111,116,0,18,118,0,0,18,118,0,0,0,0,0,0,0,1,0,9,0,108, -101,110,103,116,104,0,1,0,0,11,118,0,0,0,1,8,58,115,113,114,116,0,58,100,111,116,0,18,118,0,0,18, -118,0,0,0,0,0,0,0,1,0,9,0,108,101,110,103,116,104,0,1,0,0,12,118,0,0,0,1,8,58,115,113,114,116,0,58, -100,111,116,0,18,118,0,0,18,118,0,0,0,0,0,0,0,1,0,9,0,100,105,115,116,97,110,99,101,0,1,0,0,9,120, -0,0,1,0,0,9,121,0,0,0,1,8,58,108,101,110,103,116,104,0,18,120,0,18,121,0,47,0,0,0,0,1,0,9,0,100, -105,115,116,97,110,99,101,0,1,0,0,10,118,0,0,1,0,0,10,117,0,0,0,1,8,58,108,101,110,103,116,104,0, -18,118,0,18,117,0,47,0,0,0,0,1,0,9,0,100,105,115,116,97,110,99,101,0,1,0,0,11,118,0,0,1,0,0,11,117, -0,0,0,1,8,58,108,101,110,103,116,104,0,18,118,0,18,117,0,47,0,0,0,0,1,0,9,0,100,105,115,116,97,110, -99,101,0,1,0,0,12,118,0,0,1,0,0,12,117,0,0,0,1,8,58,108,101,110,103,116,104,0,18,118,0,18,117,0,47, -0,0,0,0,1,0,11,0,99,114,111,115,115,0,1,0,0,11,118,0,0,1,0,0,11,117,0,0,0,1,8,58,118,101,99,51,0, -18,118,0,59,121,0,18,117,0,59,122,0,48,18,117,0,59,121,0,18,118,0,59,122,0,48,47,0,18,118,0,59,122, -0,18,117,0,59,120,0,48,18,117,0,59,122,0,18,118,0,59,120,0,48,47,0,18,118,0,59,120,0,18,117,0,59, -121,0,48,18,117,0,59,120,0,18,118,0,59,121,0,48,47,0,0,0,0,1,0,9,0,110,111,114,109,97,108,105,122, -101,0,1,0,0,9,120,0,0,0,1,8,17,49,0,48,0,0,0,0,1,0,10,0,110,111,114,109,97,108,105,122,101,0,1,0,0, -10,118,0,0,0,1,8,18,118,0,58,108,101,110,103,116,104,0,18,118,0,0,0,49,0,0,1,0,11,0,110,111,114, -109,97,108,105,122,101,0,1,0,0,11,118,0,0,0,1,8,18,118,0,58,108,101,110,103,116,104,0,18,118,0,0,0, -49,0,0,1,0,12,0,110,111,114,109,97,108,105,122,101,0,1,0,0,12,118,0,0,0,1,8,18,118,0,58,108,101, -110,103,116,104,0,18,118,0,0,0,49,0,0,1,0,9,0,102,97,99,101,102,111,114,119,97,114,100,0,1,0,0,9, -78,0,0,1,0,0,9,73,0,0,1,0,0,9,78,114,101,102,0,0,0,1,8,58,100,111,116,0,18,78,114,101,102,0,0,18, -73,0,0,0,17,48,0,48,0,0,40,18,78,0,18,78,0,54,31,0,0,1,0,10,0,102,97,99,101,102,111,114,119,97,114, -100,0,1,0,0,10,78,0,0,1,0,0,10,73,0,0,1,0,0,10,78,114,101,102,0,0,0,1,8,58,100,111,116,0,18,78,114, -101,102,0,0,18,73,0,0,0,17,48,0,48,0,0,40,18,78,0,18,78,0,54,31,0,0,1,0,11,0,102,97,99,101,102,111, -114,119,97,114,100,0,1,0,0,11,78,0,0,1,0,0,11,73,0,0,1,0,0,11,78,114,101,102,0,0,0,1,8,58,100,111, -116,0,18,78,114,101,102,0,0,18,73,0,0,0,17,48,0,48,0,0,40,18,78,0,18,78,0,54,31,0,0,1,0,12,0,102, -97,99,101,102,111,114,119,97,114,100,0,1,0,0,12,78,0,0,1,0,0,12,73,0,0,1,0,0,12,78,114,101,102,0,0, -0,1,8,58,100,111,116,0,18,78,114,101,102,0,0,18,73,0,0,0,17,48,0,48,0,0,40,18,78,0,18,78,0,54,31,0, -0,1,0,9,0,114,101,102,108,101,99,116,0,1,0,0,9,73,0,0,1,0,0,9,78,0,0,0,1,8,18,73,0,17,50,0,48,0,0, -58,100,111,116,0,18,78,0,0,18,73,0,0,0,48,18,78,0,48,47,0,0,1,0,10,0,114,101,102,108,101,99,116,0, -1,0,0,10,73,0,0,1,0,0,10,78,0,0,0,1,8,18,73,0,17,50,0,48,0,0,58,100,111,116,0,18,78,0,0,18,73,0,0, -0,48,18,78,0,48,47,0,0,1,0,11,0,114,101,102,108,101,99,116,0,1,0,0,11,73,0,0,1,0,0,11,78,0,0,0,1,8, -18,73,0,17,50,0,48,0,0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,48,18,78,0,48,47,0,0,1,0,12,0,114, -101,102,108,101,99,116,0,1,0,0,12,73,0,0,1,0,0,12,78,0,0,0,1,8,18,73,0,17,50,0,48,0,0,58,100,111, -116,0,18,78,0,0,18,73,0,0,0,48,18,78,0,48,47,0,0,1,0,9,0,114,101,102,114,97,99,116,0,1,0,0,9,73,0, -0,1,0,0,9,78,0,0,1,0,0,9,101,116,97,0,0,0,1,3,2,0,9,1,107,0,2,17,49,0,48,0,0,18,101,116,97,0,18, -101,116,97,0,48,17,49,0,48,0,0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,58,100,111,116,0,18,78,0,0, -18,73,0,0,0,48,47,48,47,0,0,10,18,107,0,17,48,0,48,0,0,40,0,8,17,48,0,48,0,0,0,9,14,0,8,18,101,116, -97,0,18,73,0,48,18,101,116,97,0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,48,58,115,113,114,116,0,18, -107,0,0,0,46,18,78,0,48,47,0,0,1,0,10,0,114,101,102,114,97,99,116,0,1,0,0,10,73,0,0,1,0,0,10,78,0, -0,1,0,0,9,101,116,97,0,0,0,1,3,2,0,9,1,107,0,2,17,49,0,48,0,0,18,101,116,97,0,18,101,116,97,0,48, +0,2,2,4,14,1,95,95,78,111,114,109,97,108,77,97,116,114,105,120,84,114,97,110,115,112,111,115,101,0, +0,0,2,2,4,15,1,103,108,95,77,111,100,101,108,86,105,101,119,77,97,116,114,105,120,73,110,118,101, +114,115,101,0,0,0,2,2,4,15,1,103,108,95,80,114,111,106,101,99,116,105,111,110,77,97,116,114,105, +120,73,110,118,101,114,115,101,0,0,0,2,2,4,15,1,103,108,95,77,111,100,101,108,86,105,101,119,80, +114,111,106,101,99,116,105,111,110,77,97,116,114,105,120,73,110,118,101,114,115,101,0,0,0,2,2,4,15, +1,103,108,95,84,101,120,116,117,114,101,77,97,116,114,105,120,73,110,118,101,114,115,101,0,3,18, +103,108,95,77,97,120,84,101,120,116,117,114,101,67,111,111,114,100,115,0,0,0,2,2,4,15,1,103,108,95, +77,111,100,101,108,86,105,101,119,77,97,116,114,105,120,84,114,97,110,115,112,111,115,101,0,0,0,2, +2,4,15,1,103,108,95,80,114,111,106,101,99,116,105,111,110,77,97,116,114,105,120,84,114,97,110,115, +112,111,115,101,0,0,0,2,2,4,15,1,103,108,95,77,111,100,101,108,86,105,101,119,80,114,111,106,101, +99,116,105,111,110,77,97,116,114,105,120,84,114,97,110,115,112,111,115,101,0,0,0,2,2,4,15,1,103, +108,95,84,101,120,116,117,114,101,77,97,116,114,105,120,84,114,97,110,115,112,111,115,101,0,3,18, +103,108,95,77,97,120,84,101,120,116,117,114,101,67,111,111,114,100,115,0,0,0,2,2,4,15,1,103,108,95, +77,111,100,101,108,86,105,101,119,77,97,116,114,105,120,73,110,118,101,114,115,101,84,114,97,110, +115,112,111,115,101,0,0,0,2,2,4,15,1,103,108,95,80,114,111,106,101,99,116,105,111,110,77,97,116, +114,105,120,73,110,118,101,114,115,101,84,114,97,110,115,112,111,115,101,0,0,0,2,2,4,15,1,103,108, +95,77,111,100,101,108,86,105,101,119,80,114,111,106,101,99,116,105,111,110,77,97,116,114,105,120, +73,110,118,101,114,115,101,84,114,97,110,115,112,111,115,101,0,0,0,2,2,4,15,1,103,108,95,84,101, +120,116,117,114,101,77,97,116,114,105,120,73,110,118,101,114,115,101,84,114,97,110,115,112,111,115, +101,0,3,18,103,108,95,77,97,120,84,101,120,116,117,114,101,67,111,111,114,100,115,0,0,0,2,2,4,9,1, +103,108,95,78,111,114,109,97,108,83,99,97,108,101,0,0,0,2,2,0,24,103,108,95,68,101,112,116,104,82, +97,110,103,101,80,97,114,97,109,101,116,101,114,115,0,9,110,101,97,114,0,0,0,1,9,102,97,114,0,0,0, +1,9,100,105,102,102,0,0,0,0,0,0,2,2,4,25,103,108,95,68,101,112,116,104,82,97,110,103,101,80,97,114, +97,109,101,116,101,114,115,0,1,103,108,95,68,101,112,116,104,82,97,110,103,101,0,0,0,2,2,4,12,1, +103,108,95,67,108,105,112,80,108,97,110,101,0,3,18,103,108,95,77,97,120,67,108,105,112,80,108,97, +110,101,115,0,0,0,2,2,0,24,103,108,95,80,111,105,110,116,80,97,114,97,109,101,116,101,114,115,0,9, +115,105,122,101,0,0,0,1,9,115,105,122,101,77,105,110,0,0,0,1,9,115,105,122,101,77,97,120,0,0,0,1,9, +102,97,100,101,84,104,114,101,115,104,111,108,100,83,105,122,101,0,0,0,1,9,100,105,115,116,97,110, +99,101,67,111,110,115,116,97,110,116,65,116,116,101,110,117,97,116,105,111,110,0,0,0,1,9,100,105, +115,116,97,110,99,101,76,105,110,101,97,114,65,116,116,101,110,117,97,116,105,111,110,0,0,0,1,9, +100,105,115,116,97,110,99,101,81,117,97,100,114,97,116,105,99,65,116,116,101,110,117,97,116,105, +111,110,0,0,0,0,0,0,2,2,4,25,103,108,95,80,111,105,110,116,80,97,114,97,109,101,116,101,114,115,0, +1,103,108,95,80,111,105,110,116,0,0,0,2,2,0,24,103,108,95,77,97,116,101,114,105,97,108,80,97,114, +97,109,101,116,101,114,115,0,12,101,109,105,115,115,105,111,110,0,0,0,1,12,97,109,98,105,101,110, +116,0,0,0,1,12,100,105,102,102,117,115,101,0,0,0,1,12,115,112,101,99,117,108,97,114,0,0,0,1,9,115, +104,105,110,105,110,101,115,115,0,0,0,0,0,0,2,2,4,25,103,108,95,77,97,116,101,114,105,97,108,80,97, +114,97,109,101,116,101,114,115,0,1,103,108,95,70,114,111,110,116,77,97,116,101,114,105,97,108,0,0, +0,2,2,4,25,103,108,95,77,97,116,101,114,105,97,108,80,97,114,97,109,101,116,101,114,115,0,1,103, +108,95,66,97,99,107,77,97,116,101,114,105,97,108,0,0,0,2,2,0,24,103,108,95,76,105,103,104,116,83, +111,117,114,99,101,80,97,114,97,109,101,116,101,114,115,0,12,97,109,98,105,101,110,116,0,0,0,1,12, +100,105,102,102,117,115,101,0,0,0,1,12,115,112,101,99,117,108,97,114,0,0,0,1,12,112,111,115,105, +116,105,111,110,0,0,0,1,12,104,97,108,102,86,101,99,116,111,114,0,0,0,1,11,115,112,111,116,68,105, +114,101,99,116,105,111,110,0,0,0,1,9,115,112,111,116,69,120,112,111,110,101,110,116,0,0,0,1,9,115, +112,111,116,67,117,116,111,102,102,0,0,0,1,9,115,112,111,116,67,111,115,67,117,116,111,102,102,0,0, +0,1,9,99,111,110,115,116,97,110,116,65,116,116,101,110,117,97,116,105,111,110,0,0,0,1,9,108,105, +110,101,97,114,65,116,116,101,110,117,97,116,105,111,110,0,0,0,1,9,113,117,97,100,114,97,116,105, +99,65,116,116,101,110,117,97,116,105,111,110,0,0,0,0,0,0,2,2,4,25,103,108,95,76,105,103,104,116,83, +111,117,114,99,101,80,97,114,97,109,101,116,101,114,115,0,1,103,108,95,76,105,103,104,116,83,111, +117,114,99,101,0,3,18,103,108,95,77,97,120,76,105,103,104,116,115,0,0,0,2,2,0,24,103,108,95,76,105, +103,104,116,77,111,100,101,108,80,97,114,97,109,101,116,101,114,115,0,12,97,109,98,105,101,110,116, +0,0,0,0,0,0,2,2,4,25,103,108,95,76,105,103,104,116,77,111,100,101,108,80,97,114,97,109,101,116,101, +114,115,0,1,103,108,95,76,105,103,104,116,77,111,100,101,108,0,0,0,2,2,0,24,103,108,95,76,105,103, +104,116,77,111,100,101,108,80,114,111,100,117,99,116,115,0,12,115,99,101,110,101,67,111,108,111, +114,0,0,0,0,0,0,2,2,4,25,103,108,95,76,105,103,104,116,77,111,100,101,108,80,114,111,100,117,99, +116,115,0,1,103,108,95,70,114,111,110,116,76,105,103,104,116,77,111,100,101,108,80,114,111,100,117, +99,116,0,0,0,2,2,4,25,103,108,95,76,105,103,104,116,77,111,100,101,108,80,114,111,100,117,99,116, +115,0,1,103,108,95,66,97,99,107,76,105,103,104,116,77,111,100,101,108,80,114,111,100,117,99,116,0, +0,0,2,2,0,24,103,108,95,76,105,103,104,116,80,114,111,100,117,99,116,115,0,12,97,109,98,105,101, +110,116,0,0,0,1,12,100,105,102,102,117,115,101,0,0,0,1,12,115,112,101,99,117,108,97,114,0,0,0,0,0, +0,2,2,4,25,103,108,95,76,105,103,104,116,80,114,111,100,117,99,116,115,0,1,103,108,95,70,114,111, +110,116,76,105,103,104,116,80,114,111,100,117,99,116,0,3,18,103,108,95,77,97,120,76,105,103,104, +116,115,0,0,0,2,2,4,25,103,108,95,76,105,103,104,116,80,114,111,100,117,99,116,115,0,1,103,108,95, +66,97,99,107,76,105,103,104,116,80,114,111,100,117,99,116,0,3,18,103,108,95,77,97,120,76,105,103, +104,116,115,0,0,0,2,2,4,12,1,103,108,95,84,101,120,116,117,114,101,69,110,118,67,111,108,111,114,0, +3,18,103,108,95,77,97,120,84,101,120,116,117,114,101,73,109,97,103,101,85,110,105,116,115,0,0,0,2, +2,4,12,1,103,108,95,69,121,101,80,108,97,110,101,83,0,3,18,103,108,95,77,97,120,84,101,120,116,117, +114,101,67,111,111,114,100,115,0,0,0,2,2,4,12,1,103,108,95,69,121,101,80,108,97,110,101,84,0,3,18, +103,108,95,77,97,120,84,101,120,116,117,114,101,67,111,111,114,100,115,0,0,0,2,2,4,12,1,103,108,95, +69,121,101,80,108,97,110,101,82,0,3,18,103,108,95,77,97,120,84,101,120,116,117,114,101,67,111,111, +114,100,115,0,0,0,2,2,4,12,1,103,108,95,69,121,101,80,108,97,110,101,81,0,3,18,103,108,95,77,97, +120,84,101,120,116,117,114,101,67,111,111,114,100,115,0,0,0,2,2,4,12,1,103,108,95,79,98,106,101,99, +116,80,108,97,110,101,83,0,3,18,103,108,95,77,97,120,84,101,120,116,117,114,101,67,111,111,114,100, +115,0,0,0,2,2,4,12,1,103,108,95,79,98,106,101,99,116,80,108,97,110,101,84,0,3,18,103,108,95,77,97, +120,84,101,120,116,117,114,101,67,111,111,114,100,115,0,0,0,2,2,4,12,1,103,108,95,79,98,106,101,99, +116,80,108,97,110,101,82,0,3,18,103,108,95,77,97,120,84,101,120,116,117,114,101,67,111,111,114,100, +115,0,0,0,2,2,4,12,1,103,108,95,79,98,106,101,99,116,80,108,97,110,101,81,0,3,18,103,108,95,77,97, +120,84,101,120,116,117,114,101,67,111,111,114,100,115,0,0,0,2,2,0,24,103,108,95,70,111,103,80,97, +114,97,109,101,116,101,114,115,0,12,99,111,108,111,114,0,0,0,1,9,100,101,110,115,105,116,121,0,0,0, +1,9,115,116,97,114,116,0,0,0,1,9,101,110,100,0,0,0,1,9,115,99,97,108,101,0,0,0,0,0,0,2,2,4,25,103, +108,95,70,111,103,80,97,114,97,109,101,116,101,114,115,0,1,103,108,95,70,111,103,0,0,0,1,0,9,0,114, +97,100,105,97,110,115,0,1,1,0,9,100,101,103,0,0,0,1,3,2,1,9,1,99,0,2,17,51,0,49,52,49,53,57,50,54, +0,0,17,49,56,48,0,48,0,0,49,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,95,95,114, +101,116,86,97,108,0,59,120,0,0,18,100,101,103,0,0,18,99,0,0,0,0,1,0,10,0,114,97,100,105,97,110,115, +0,1,1,0,10,100,101,103,0,0,0,1,3,2,1,9,1,99,0,2,17,51,0,49,52,49,53,57,50,54,0,0,17,49,56,48,0,48, +0,0,49,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,0, +59,120,121,0,0,18,100,101,103,0,59,120,121,0,0,18,99,0,59,120,120,0,0,0,0,1,0,11,0,114,97,100,105, +97,110,115,0,1,1,0,11,100,101,103,0,0,0,1,3,2,1,9,1,99,0,2,17,51,0,49,52,49,53,57,50,54,0,0,17,49, +56,48,0,48,0,0,49,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,95,95,114,101,116,86, +97,108,0,59,120,121,122,0,0,18,100,101,103,0,59,120,121,122,0,0,18,99,0,59,120,120,120,0,0,0,0,1,0, +12,0,114,97,100,105,97,110,115,0,1,1,0,12,100,101,103,0,0,0,1,3,2,1,9,1,99,0,2,17,51,0,49,52,49,53, +57,50,54,0,0,17,49,56,48,0,48,0,0,49,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18, +95,95,114,101,116,86,97,108,0,0,18,100,101,103,0,0,18,99,0,59,120,120,120,120,0,0,0,0,1,0,9,0,100, +101,103,114,101,101,115,0,1,1,0,9,114,97,100,0,0,0,1,3,2,1,9,1,99,0,2,17,49,56,48,0,48,0,0,17,51,0, +49,52,49,53,57,50,54,0,0,49,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,95,95,114, +101,116,86,97,108,0,59,120,0,0,18,114,97,100,0,0,18,99,0,0,0,0,1,0,10,0,100,101,103,114,101,101, +115,0,1,1,0,10,114,97,100,0,0,0,1,3,2,1,9,1,99,0,2,17,51,0,49,52,49,53,57,50,54,0,0,17,49,56,48,0, +48,0,0,49,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,108, +0,59,120,121,0,0,18,114,97,100,0,59,120,121,0,0,18,99,0,59,120,120,0,0,0,0,1,0,11,0,100,101,103, +114,101,101,115,0,1,1,0,11,114,97,100,0,0,0,1,3,2,1,9,1,99,0,2,17,51,0,49,52,49,53,57,50,54,0,0,17, +49,56,48,0,48,0,0,49,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,95,95,114,101,116, +86,97,108,0,59,120,121,122,0,0,18,114,97,100,0,59,120,121,122,0,0,18,99,0,59,120,120,120,0,0,0,0,1, +0,12,0,100,101,103,114,101,101,115,0,1,1,0,12,114,97,100,0,0,0,1,3,2,1,9,1,99,0,2,17,51,0,49,52,49, +53,57,50,54,0,0,17,49,56,48,0,48,0,0,49,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0, +18,95,95,114,101,116,86,97,108,0,0,18,114,97,100,0,0,18,99,0,59,120,120,120,120,0,0,0,0,1,0,9,0, +115,105,110,0,1,1,0,9,114,97,100,105,97,110,115,0,0,0,1,4,102,108,111,97,116,95,115,105,110,101,0, +18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,114,97,100,105,97,110,115,0,0,0,0,1,0,10,0,115,105, +110,0,1,1,0,10,114,97,100,105,97,110,115,0,0,0,1,4,102,108,111,97,116,95,115,105,110,101,0,18,95, +95,114,101,116,86,97,108,0,59,120,0,0,18,114,97,100,105,97,110,115,0,59,120,0,0,0,4,102,108,111,97, +116,95,115,105,110,101,0,18,95,95,114,101,116,86,97,108,0,59,121,0,0,18,114,97,100,105,97,110,115, +0,59,121,0,0,0,0,1,0,11,0,115,105,110,0,1,1,0,11,114,97,100,105,97,110,115,0,0,0,1,4,102,108,111, +97,116,95,115,105,110,101,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,114,97,100,105,97,110, +115,0,59,120,0,0,0,4,102,108,111,97,116,95,115,105,110,101,0,18,95,95,114,101,116,86,97,108,0,59, +121,0,0,18,114,97,100,105,97,110,115,0,59,121,0,0,0,4,102,108,111,97,116,95,115,105,110,101,0,18, +95,95,114,101,116,86,97,108,0,59,122,0,0,18,114,97,100,105,97,110,115,0,59,122,0,0,0,0,1,0,12,0, +115,105,110,0,1,1,0,12,114,97,100,105,97,110,115,0,0,0,1,4,102,108,111,97,116,95,115,105,110,101,0, +18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,114,97,100,105,97,110,115,0,59,120,0,0,0,4,102,108, +111,97,116,95,115,105,110,101,0,18,95,95,114,101,116,86,97,108,0,59,121,0,0,18,114,97,100,105,97, +110,115,0,59,121,0,0,0,4,102,108,111,97,116,95,115,105,110,101,0,18,95,95,114,101,116,86,97,108,0, +59,122,0,0,18,114,97,100,105,97,110,115,0,59,122,0,0,0,4,102,108,111,97,116,95,115,105,110,101,0, +18,95,95,114,101,116,86,97,108,0,59,119,0,0,18,114,97,100,105,97,110,115,0,59,119,0,0,0,0,1,0,9,0, +99,111,115,0,1,1,0,9,114,97,100,105,97,110,115,0,0,0,1,4,102,108,111,97,116,95,99,111,115,105,110, +101,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,114,97,100,105,97,110,115,0,0,0,0,1,0,10,0,99, +111,115,0,1,1,0,10,114,97,100,105,97,110,115,0,0,0,1,4,102,108,111,97,116,95,99,111,115,105,110, +101,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,114,97,100,105,97,110,115,0,59,120,0,0,0,4, +102,108,111,97,116,95,99,111,115,105,110,101,0,18,95,95,114,101,116,86,97,108,0,59,121,0,0,18,114, +97,100,105,97,110,115,0,59,121,0,0,0,0,1,0,11,0,99,111,115,0,1,1,0,11,114,97,100,105,97,110,115,0, +0,0,1,4,102,108,111,97,116,95,99,111,115,105,110,101,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0, +18,114,97,100,105,97,110,115,0,59,120,0,0,0,4,102,108,111,97,116,95,99,111,115,105,110,101,0,18,95, +95,114,101,116,86,97,108,0,59,121,0,0,18,114,97,100,105,97,110,115,0,59,121,0,0,0,4,102,108,111,97, +116,95,99,111,115,105,110,101,0,18,95,95,114,101,116,86,97,108,0,59,122,0,0,18,114,97,100,105,97, +110,115,0,59,122,0,0,0,0,1,0,12,0,99,111,115,0,1,1,0,12,114,97,100,105,97,110,115,0,0,0,1,4,102, +108,111,97,116,95,99,111,115,105,110,101,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,114,97, +100,105,97,110,115,0,59,120,0,0,0,4,102,108,111,97,116,95,99,111,115,105,110,101,0,18,95,95,114, +101,116,86,97,108,0,59,121,0,0,18,114,97,100,105,97,110,115,0,59,121,0,0,0,4,102,108,111,97,116,95, +99,111,115,105,110,101,0,18,95,95,114,101,116,86,97,108,0,59,122,0,0,18,114,97,100,105,97,110,115, +0,59,122,0,0,0,4,102,108,111,97,116,95,99,111,115,105,110,101,0,18,95,95,114,101,116,86,97,108,0, +59,119,0,0,18,114,97,100,105,97,110,115,0,59,119,0,0,0,0,1,0,9,0,116,97,110,0,1,1,0,9,97,110,103, +108,101,0,0,0,1,3,2,1,9,1,115,0,2,58,115,105,110,0,18,97,110,103,108,101,0,0,0,0,0,3,2,1,9,1,99,0, +2,58,99,111,115,0,18,97,110,103,108,101,0,0,0,0,0,8,18,115,0,18,99,0,49,0,0,1,0,10,0,116,97,110,0, +1,1,0,10,97,110,103,108,101,0,0,0,1,3,2,1,10,1,115,0,2,58,115,105,110,0,18,97,110,103,108,101,0,0, +0,0,0,3,2,1,10,1,99,0,2,58,99,111,115,0,18,97,110,103,108,101,0,0,0,0,0,8,18,115,0,18,99,0,49,0,0, +1,0,11,0,116,97,110,0,1,1,0,11,97,110,103,108,101,0,0,0,1,3,2,1,11,1,115,0,2,58,115,105,110,0,18, +97,110,103,108,101,0,0,0,0,0,3,2,1,11,1,99,0,2,58,99,111,115,0,18,97,110,103,108,101,0,0,0,0,0,8, +18,115,0,18,99,0,49,0,0,1,0,12,0,116,97,110,0,1,1,0,12,97,110,103,108,101,0,0,0,1,3,2,1,12,1,115,0, +2,58,115,105,110,0,18,97,110,103,108,101,0,0,0,0,0,3,2,1,12,1,99,0,2,58,99,111,115,0,18,97,110,103, +108,101,0,0,0,0,0,8,18,115,0,18,99,0,49,0,0,1,0,9,0,97,115,105,110,0,1,1,0,9,120,0,0,0,1,3,2,1,9,1, +97,48,0,2,17,49,0,53,55,48,55,50,56,56,0,0,0,0,3,2,1,9,1,97,49,0,2,17,48,0,50,49,50,49,49,52,52,0, +0,54,0,0,3,2,1,9,1,97,50,0,2,17,48,0,48,55,52,50,54,49,48,0,0,0,0,3,2,1,9,1,104,97,108,102,80,105, +0,2,17,51,0,49,52,49,53,57,50,54,0,0,17,48,0,53,0,0,48,0,0,3,2,1,9,1,121,0,2,58,97,98,115,0,18,120, +0,0,0,0,0,9,18,95,95,114,101,116,86,97,108,0,18,104,97,108,102,80,105,0,58,115,113,114,116,0,17,49, +0,48,0,0,18,121,0,47,0,0,18,97,48,0,18,121,0,18,97,49,0,18,97,50,0,18,121,0,48,46,48,46,48,47,58, +115,105,103,110,0,18,120,0,0,0,48,20,0,0,1,0,10,0,97,115,105,110,0,1,1,0,10,118,0,0,0,1,9,18,95,95, +114,101,116,86,97,108,0,59,120,0,58,97,115,105,110,0,18,118,0,59,120,0,0,0,20,0,9,18,95,95,114,101, +116,86,97,108,0,59,121,0,58,97,115,105,110,0,18,118,0,59,121,0,0,0,20,0,0,1,0,11,0,97,115,105,110, +0,1,1,0,11,118,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,97,115,105,110,0,18,118,0,59, +120,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,97,115,105,110,0,18,118,0,59,121,0,0, +0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,58,97,115,105,110,0,18,118,0,59,122,0,0,0,20,0, +0,1,0,12,0,97,115,105,110,0,1,1,0,12,118,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,97, +115,105,110,0,18,118,0,59,120,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,97,115,105, +110,0,18,118,0,59,121,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,58,97,115,105,110,0, +18,118,0,59,122,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,119,0,58,97,115,105,110,0,18,118, +0,59,119,0,0,0,20,0,0,1,0,9,0,97,99,111,115,0,1,1,0,9,120,0,0,0,1,3,2,1,9,1,104,97,108,102,80,105, +0,2,17,51,0,49,52,49,53,57,50,54,0,0,17,48,0,53,0,0,48,0,0,9,18,95,95,114,101,116,86,97,108,0,18, +104,97,108,102,80,105,0,58,97,115,105,110,0,18,120,0,0,0,47,20,0,0,1,0,10,0,97,99,111,115,0,1,1,0, +10,118,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,97,99,111,115,0,18,118,0,59,120,0,0, +0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,97,99,111,115,0,18,118,0,59,121,0,0,0,20,0,0, +1,0,11,0,97,99,111,115,0,1,1,0,11,118,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,97,99, +111,115,0,18,118,0,59,120,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,97,99,111,115, +0,18,118,0,59,121,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,58,97,99,111,115,0,18,118, +0,59,122,0,0,0,20,0,0,1,0,12,0,97,99,111,115,0,1,1,0,12,118,0,0,0,1,9,18,95,95,114,101,116,86,97, +108,0,59,120,0,58,97,99,111,115,0,18,118,0,59,120,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59, +121,0,58,97,99,111,115,0,18,118,0,59,121,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,58, +97,99,111,115,0,18,118,0,59,122,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,119,0,58,97,99, +111,115,0,18,118,0,59,119,0,0,0,20,0,0,1,0,9,0,97,116,97,110,0,1,1,0,9,120,0,0,0,1,9,18,95,95,114, +101,116,86,97,108,0,58,97,115,105,110,0,18,120,0,58,105,110,118,101,114,115,101,115,113,114,116,0, +18,120,0,18,120,0,48,17,49,0,48,0,0,46,0,0,48,0,0,20,0,0,1,0,10,0,97,116,97,110,0,1,1,0,10,121,95, +111,118,101,114,95,120,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,97,116,97,110,0,18, +121,95,111,118,101,114,95,120,0,59,120,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,58, +97,116,97,110,0,18,121,95,111,118,101,114,95,120,0,59,121,0,0,0,20,0,0,1,0,11,0,97,116,97,110,0,1, +1,0,11,121,95,111,118,101,114,95,120,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,97,116, +97,110,0,18,121,95,111,118,101,114,95,120,0,59,120,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0, +59,121,0,58,97,116,97,110,0,18,121,95,111,118,101,114,95,120,0,59,121,0,0,0,20,0,9,18,95,95,114, +101,116,86,97,108,0,59,122,0,58,97,116,97,110,0,18,121,95,111,118,101,114,95,120,0,59,122,0,0,0,20, +0,0,1,0,12,0,97,116,97,110,0,1,1,0,12,121,95,111,118,101,114,95,120,0,0,0,1,9,18,95,95,114,101,116, +86,97,108,0,59,120,0,58,97,116,97,110,0,18,121,95,111,118,101,114,95,120,0,59,120,0,0,0,20,0,9,18, +95,95,114,101,116,86,97,108,0,59,121,0,58,97,116,97,110,0,18,121,95,111,118,101,114,95,120,0,59, +121,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,58,97,116,97,110,0,18,121,95,111,118, +101,114,95,120,0,59,122,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,119,0,58,97,116,97,110,0, +18,121,95,111,118,101,114,95,120,0,59,119,0,0,0,20,0,0,1,0,9,0,97,116,97,110,0,1,1,0,9,121,0,0,1,1, +0,9,120,0,0,0,1,10,18,120,0,17,48,0,48,0,0,38,0,8,17,48,0,48,0,0,0,9,14,0,3,2,0,9,1,122,0,2,58,97, +116,97,110,0,18,121,0,18,120,0,49,0,0,0,0,10,18,120,0,17,48,0,48,0,0,40,0,2,10,18,121,0,17,48,0,48, +0,0,40,0,8,18,122,0,17,51,0,49,52,49,53,57,51,0,0,47,0,9,14,0,8,18,122,0,17,51,0,49,52,49,53,57,51, +0,0,46,0,0,9,14,0,8,18,122,0,0,0,1,0,10,0,97,116,97,110,0,1,1,0,10,117,0,0,1,1,0,10,118,0,0,0,1,9, +18,95,95,114,101,116,86,97,108,0,59,120,0,58,97,116,97,110,0,18,117,0,59,120,0,0,18,118,0,59,120,0, +0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,97,116,97,110,0,18,117,0,59,121,0,0,18,118, +0,59,121,0,0,0,20,0,0,1,0,11,0,97,116,97,110,0,1,1,0,11,117,0,0,1,1,0,11,118,0,0,0,1,9,18,95,95, +114,101,116,86,97,108,0,59,120,0,58,97,116,97,110,0,18,117,0,59,120,0,0,18,118,0,59,120,0,0,0,20,0, +9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,97,116,97,110,0,18,117,0,59,121,0,0,18,118,0,59,121, +0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,58,97,116,97,110,0,18,117,0,59,122,0,0,18, +118,0,59,122,0,0,0,20,0,0,1,0,12,0,97,116,97,110,0,1,1,0,12,117,0,0,1,1,0,12,118,0,0,0,1,9,18,95, +95,114,101,116,86,97,108,0,59,120,0,58,97,116,97,110,0,18,117,0,59,120,0,0,18,118,0,59,120,0,0,0, +20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,97,116,97,110,0,18,117,0,59,121,0,0,18,118,0, +59,121,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,58,97,116,97,110,0,18,117,0,59,122,0, +0,18,118,0,59,122,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,119,0,58,97,116,97,110,0,18,117, +0,59,119,0,0,18,118,0,59,119,0,0,0,20,0,0,1,0,9,0,112,111,119,0,1,1,0,9,97,0,0,1,1,0,9,98,0,0,0,1, +4,102,108,111,97,116,95,112,111,119,101,114,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,97,0, +0,18,98,0,0,0,0,1,0,10,0,112,111,119,0,1,1,0,10,97,0,0,1,1,0,10,98,0,0,0,1,4,102,108,111,97,116,95, +112,111,119,101,114,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,97,0,59,120,0,0,18,98,0,59, +120,0,0,0,4,102,108,111,97,116,95,112,111,119,101,114,0,18,95,95,114,101,116,86,97,108,0,59,121,0, +0,18,97,0,59,121,0,0,18,98,0,59,121,0,0,0,0,1,0,11,0,112,111,119,0,1,1,0,11,97,0,0,1,1,0,11,98,0,0, +0,1,4,102,108,111,97,116,95,112,111,119,101,114,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18, +97,0,59,120,0,0,18,98,0,59,120,0,0,0,4,102,108,111,97,116,95,112,111,119,101,114,0,18,95,95,114, +101,116,86,97,108,0,59,121,0,0,18,97,0,59,121,0,0,18,98,0,59,121,0,0,0,4,102,108,111,97,116,95,112, +111,119,101,114,0,18,95,95,114,101,116,86,97,108,0,59,122,0,0,18,97,0,59,122,0,0,18,98,0,59,122,0, +0,0,0,1,0,12,0,112,111,119,0,1,1,0,12,97,0,0,1,1,0,12,98,0,0,0,1,4,102,108,111,97,116,95,112,111, +119,101,114,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,97,0,59,120,0,0,18,98,0,59,120,0,0,0, +4,102,108,111,97,116,95,112,111,119,101,114,0,18,95,95,114,101,116,86,97,108,0,59,121,0,0,18,97,0, +59,121,0,0,18,98,0,59,121,0,0,0,4,102,108,111,97,116,95,112,111,119,101,114,0,18,95,95,114,101,116, +86,97,108,0,59,122,0,0,18,97,0,59,122,0,0,18,98,0,59,122,0,0,0,4,102,108,111,97,116,95,112,111,119, +101,114,0,18,95,95,114,101,116,86,97,108,0,59,119,0,0,18,97,0,59,119,0,0,18,98,0,59,119,0,0,0,0,1, +0,9,0,101,120,112,0,1,1,0,9,97,0,0,0,1,3,2,1,9,1,101,0,2,17,50,0,55,49,56,50,56,0,0,0,0,4,102,108, +111,97,116,95,112,111,119,101,114,0,18,95,95,114,101,116,86,97,108,0,0,18,101,0,0,18,97,0,0,0,0,1, +0,10,0,101,120,112,0,1,1,0,10,97,0,0,0,1,3,2,1,9,1,101,0,2,17,50,0,55,49,56,50,56,0,0,0,0,4,102, +108,111,97,116,95,112,111,119,101,114,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,101,0,0,18, +97,0,59,120,0,0,0,4,102,108,111,97,116,95,112,111,119,101,114,0,18,95,95,114,101,116,86,97,108,0, +59,121,0,0,18,101,0,0,18,97,0,59,121,0,0,0,0,1,0,11,0,101,120,112,0,1,1,0,11,97,0,0,0,1,3,2,1,9,1, +101,0,2,17,50,0,55,49,56,50,56,0,0,0,0,4,102,108,111,97,116,95,112,111,119,101,114,0,18,95,95,114, +101,116,86,97,108,0,59,120,0,0,18,101,0,0,18,97,0,59,120,0,0,0,4,102,108,111,97,116,95,112,111,119, +101,114,0,18,95,95,114,101,116,86,97,108,0,59,121,0,0,18,101,0,0,18,97,0,59,121,0,0,0,4,102,108, +111,97,116,95,112,111,119,101,114,0,18,95,95,114,101,116,86,97,108,0,59,122,0,0,18,101,0,0,18,97,0, +59,122,0,0,0,0,1,0,12,0,101,120,112,0,1,1,0,12,97,0,0,0,1,3,2,1,9,1,101,0,2,17,50,0,55,49,56,50,56, +0,0,0,0,4,102,108,111,97,116,95,112,111,119,101,114,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0, +18,101,0,0,18,97,0,59,120,0,0,0,4,102,108,111,97,116,95,112,111,119,101,114,0,18,95,95,114,101,116, +86,97,108,0,59,121,0,0,18,101,0,0,18,97,0,59,121,0,0,0,4,102,108,111,97,116,95,112,111,119,101,114, +0,18,95,95,114,101,116,86,97,108,0,59,122,0,0,18,101,0,0,18,97,0,59,122,0,0,0,4,102,108,111,97,116, +95,112,111,119,101,114,0,18,95,95,114,101,116,86,97,108,0,59,119,0,0,18,101,0,0,18,97,0,59,119,0,0, +0,0,1,0,9,0,108,111,103,50,0,1,1,0,9,120,0,0,0,1,4,102,108,111,97,116,95,108,111,103,50,0,18,95,95, +114,101,116,86,97,108,0,59,120,0,0,18,120,0,0,0,0,1,0,10,0,108,111,103,50,0,1,1,0,10,118,0,0,0,1,4, +102,108,111,97,116,95,108,111,103,50,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,118,0,59,120, +0,0,0,4,102,108,111,97,116,95,108,111,103,50,0,18,95,95,114,101,116,86,97,108,0,59,121,0,0,18,118, +0,59,121,0,0,0,0,1,0,11,0,108,111,103,50,0,1,1,0,11,118,0,0,0,1,4,102,108,111,97,116,95,108,111, +103,50,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,118,0,59,120,0,0,0,4,102,108,111,97,116,95, +108,111,103,50,0,18,95,95,114,101,116,86,97,108,0,59,121,0,0,18,118,0,59,121,0,0,0,4,102,108,111, +97,116,95,108,111,103,50,0,18,95,95,114,101,116,86,97,108,0,59,122,0,0,18,118,0,59,122,0,0,0,0,1,0, +12,0,108,111,103,50,0,1,1,0,12,118,0,0,0,1,4,102,108,111,97,116,95,108,111,103,50,0,18,95,95,114, +101,116,86,97,108,0,59,120,0,0,18,118,0,59,120,0,0,0,4,102,108,111,97,116,95,108,111,103,50,0,18, +95,95,114,101,116,86,97,108,0,59,121,0,0,18,118,0,59,121,0,0,0,4,102,108,111,97,116,95,108,111,103, +50,0,18,95,95,114,101,116,86,97,108,0,59,122,0,0,18,118,0,59,122,0,0,0,4,102,108,111,97,116,95,108, +111,103,50,0,18,95,95,114,101,116,86,97,108,0,59,119,0,0,18,118,0,59,119,0,0,0,0,1,0,9,0,108,111, +103,0,1,1,0,9,120,0,0,0,1,3,2,1,9,1,99,0,2,17,48,0,54,57,51,49,52,55,49,56,49,0,0,0,0,8,58,108,111, +103,50,0,18,120,0,0,0,18,99,0,48,0,0,1,0,10,0,108,111,103,0,1,1,0,10,118,0,0,0,1,3,2,1,9,1,99,0,2, +17,48,0,54,57,51,49,52,55,49,56,49,0,0,0,0,8,58,108,111,103,50,0,18,118,0,0,0,18,99,0,48,0,0,1,0, +11,0,108,111,103,0,1,1,0,11,118,0,0,0,1,3,2,1,9,1,99,0,2,17,48,0,54,57,51,49,52,55,49,56,49,0,0,0, +0,8,58,108,111,103,50,0,18,118,0,0,0,18,99,0,48,0,0,1,0,12,0,108,111,103,0,1,1,0,12,118,0,0,0,1,3, +2,1,9,1,99,0,2,17,48,0,54,57,51,49,52,55,49,56,49,0,0,0,0,8,58,108,111,103,50,0,18,118,0,0,0,18,99, +0,48,0,0,1,0,9,0,101,120,112,50,0,1,1,0,9,97,0,0,0,1,4,102,108,111,97,116,95,101,120,112,50,0,18, +95,95,114,101,116,86,97,108,0,59,120,0,0,18,97,0,0,0,0,1,0,10,0,101,120,112,50,0,1,1,0,10,97,0,0,0, +1,4,102,108,111,97,116,95,101,120,112,50,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,97,0,59, +120,0,0,0,4,102,108,111,97,116,95,101,120,112,50,0,18,95,95,114,101,116,86,97,108,0,59,121,0,0,18, +97,0,59,121,0,0,0,0,1,0,11,0,101,120,112,50,0,1,1,0,11,97,0,0,0,1,4,102,108,111,97,116,95,101,120, +112,50,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,97,0,59,120,0,0,0,4,102,108,111,97,116,95, +101,120,112,50,0,18,95,95,114,101,116,86,97,108,0,59,121,0,0,18,97,0,59,121,0,0,0,4,102,108,111,97, +116,95,101,120,112,50,0,18,95,95,114,101,116,86,97,108,0,59,122,0,0,18,97,0,59,122,0,0,0,0,1,0,12, +0,101,120,112,50,0,1,1,0,12,97,0,0,0,1,4,102,108,111,97,116,95,101,120,112,50,0,18,95,95,114,101, +116,86,97,108,0,59,120,0,0,18,97,0,59,120,0,0,0,4,102,108,111,97,116,95,101,120,112,50,0,18,95,95, +114,101,116,86,97,108,0,59,121,0,0,18,97,0,59,121,0,0,0,4,102,108,111,97,116,95,101,120,112,50,0, +18,95,95,114,101,116,86,97,108,0,59,122,0,0,18,97,0,59,122,0,0,0,4,102,108,111,97,116,95,101,120, +112,50,0,18,95,95,114,101,116,86,97,108,0,59,119,0,0,18,97,0,59,119,0,0,0,0,1,0,9,0,115,113,114, +116,0,1,1,0,9,120,0,0,0,1,3,2,0,9,1,114,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,114,0,0,18, +120,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,114, +0,0,0,0,1,0,10,0,115,113,114,116,0,1,1,0,10,118,0,0,0,1,3,2,0,9,1,114,0,0,0,4,102,108,111,97,116, +95,114,115,113,0,18,114,0,0,18,118,0,59,120,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,95,95, +114,101,116,86,97,108,0,59,120,0,0,18,114,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,114,0,0, +18,118,0,59,121,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,95,95,114,101,116,86,97,108,0,59,121, +0,0,18,114,0,0,0,0,1,0,11,0,115,113,114,116,0,1,1,0,11,118,0,0,0,1,3,2,0,9,1,114,0,0,0,4,102,108, +111,97,116,95,114,115,113,0,18,114,0,0,18,118,0,59,120,0,0,0,4,102,108,111,97,116,95,114,99,112,0, +18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,114,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18, +114,0,0,18,118,0,59,121,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,95,95,114,101,116,86,97,108, +0,59,121,0,0,18,114,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,114,0,0,18,118,0,59,122,0,0,0,4, +102,108,111,97,116,95,114,99,112,0,18,95,95,114,101,116,86,97,108,0,59,122,0,0,18,114,0,0,0,0,1,0, +12,0,115,113,114,116,0,1,1,0,12,118,0,0,0,1,3,2,0,9,1,114,0,0,0,4,102,108,111,97,116,95,114,115, +113,0,18,114,0,0,18,118,0,59,120,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,95,95,114,101,116, +86,97,108,0,59,120,0,0,18,114,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,114,0,0,18,118,0,59, +121,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,95,95,114,101,116,86,97,108,0,59,121,0,0,18,114, +0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,114,0,0,18,118,0,59,122,0,0,0,4,102,108,111,97,116, +95,114,99,112,0,18,95,95,114,101,116,86,97,108,0,59,122,0,0,18,114,0,0,0,4,102,108,111,97,116,95, +114,115,113,0,18,114,0,0,18,118,0,59,119,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,95,95,114, +101,116,86,97,108,0,59,119,0,0,18,114,0,0,0,0,1,0,9,0,105,110,118,101,114,115,101,115,113,114,116, +0,1,1,0,9,120,0,0,0,1,4,102,108,111,97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59, +120,0,0,18,120,0,0,0,0,1,0,10,0,105,110,118,101,114,115,101,115,113,114,116,0,1,1,0,10,118,0,0,0,1, +4,102,108,111,97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,118,0,59,120, +0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,121,0,0,18,118,0, +59,121,0,0,0,0,1,0,11,0,105,110,118,101,114,115,101,115,113,114,116,0,1,1,0,11,118,0,0,0,1,4,102, +108,111,97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,118,0,59,120,0,0,0, +4,102,108,111,97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,121,0,0,18,118,0,59,121, +0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,122,0,0,18,118,0, +59,122,0,0,0,0,1,0,12,0,105,110,118,101,114,115,101,115,113,114,116,0,1,1,0,12,118,0,0,0,1,4,102, +108,111,97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,118,0,59,120,0,0,0, +4,102,108,111,97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,121,0,0,18,118,0,59,121, +0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,122,0,0,18,118,0, +59,122,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,119,0,0,18, +118,0,59,119,0,0,0,0,1,0,9,0,110,111,114,109,97,108,105,122,101,0,1,1,0,9,120,0,0,0,1,9,18,95,95, +114,101,116,86,97,108,0,59,120,0,17,49,0,48,0,0,20,0,0,1,0,10,0,110,111,114,109,97,108,105,122,101, +0,1,1,0,10,118,0,0,0,1,3,2,1,9,1,115,0,2,58,105,110,118,101,114,115,101,115,113,114,116,0,58,100, +111,116,0,18,118,0,0,18,118,0,0,0,0,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18, +95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,118,0,0,18,115,0,59,120,120,0,0,0,0,1,0,11,0,110, +111,114,109,97,108,105,122,101,0,1,1,0,11,118,0,0,0,1,3,2,0,9,1,116,109,112,0,0,0,4,118,101,99,51, +95,100,111,116,0,18,116,109,112,0,0,18,118,0,0,18,118,0,0,0,4,102,108,111,97,116,95,114,115,113,0, +18,116,109,112,0,0,18,116,109,112,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,95, +95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,118,0,0,18,116,109,112,0,59,120,120,120,0,0,0,0,1, +0,12,0,110,111,114,109,97,108,105,122,101,0,1,1,0,12,118,0,0,0,1,3,2,0,9,1,116,109,112,0,0,0,4,118, +101,99,52,95,100,111,116,0,18,116,109,112,0,0,18,118,0,0,18,118,0,0,0,4,102,108,111,97,116,95,114, +115,113,0,18,116,109,112,0,0,18,116,109,112,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108, +121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,118,0,0,18,116,109,112,0,59,120,120, +120,0,0,0,0,1,0,9,0,97,98,115,0,1,1,0,9,97,0,0,0,1,4,118,101,99,52,95,97,98,115,0,18,95,95,114,101, +116,86,97,108,0,59,120,0,0,18,97,0,0,0,0,1,0,10,0,97,98,115,0,1,1,0,10,97,0,0,0,1,4,118,101,99,52, +95,97,98,115,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,97,0,0,0,0,1,0,11,0,97,98,115,0, +1,1,0,11,97,0,0,0,1,4,118,101,99,52,95,97,98,115,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122, +0,0,18,97,0,0,0,0,1,0,12,0,97,98,115,0,1,1,0,12,97,0,0,0,1,4,118,101,99,52,95,97,98,115,0,18,95,95, +114,101,116,86,97,108,0,0,18,97,0,0,0,0,1,0,9,0,115,105,103,110,0,1,1,0,9,120,0,0,0,1,3,2,0,9,1, +112,0,0,1,1,110,0,0,0,4,118,101,99,52,95,115,103,116,0,18,112,0,59,120,0,0,18,120,0,0,17,48,0,48,0, +0,0,0,4,118,101,99,52,95,115,103,116,0,18,110,0,59,120,0,0,17,48,0,48,0,0,0,18,120,0,0,0,4,118,101, +99,52,95,115,117,98,116,114,97,99,116,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,112,0,0,18, +110,0,0,0,0,1,0,10,0,115,105,103,110,0,1,1,0,10,118,0,0,0,1,3,2,0,10,1,112,0,0,1,1,110,0,0,0,4,118, +101,99,52,95,115,103,116,0,18,112,0,59,120,121,0,0,18,118,0,0,17,48,0,48,0,0,0,0,4,118,101,99,52, +95,115,103,116,0,18,110,0,59,120,121,0,0,17,48,0,48,0,0,0,18,118,0,0,0,4,118,101,99,52,95,115,117, +98,116,114,97,99,116,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,112,0,0,18,110,0,0,0,0,1, +0,11,0,115,105,103,110,0,1,1,0,11,118,0,0,0,1,3,2,0,11,1,112,0,0,1,1,110,0,0,0,4,118,101,99,52,95, +115,103,116,0,18,112,0,59,120,121,122,0,0,18,118,0,0,17,48,0,48,0,0,0,0,4,118,101,99,52,95,115,103, +116,0,18,110,0,59,120,121,122,0,0,17,48,0,48,0,0,0,18,118,0,0,0,4,118,101,99,52,95,115,117,98,116, +114,97,99,116,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,112,0,0,18,110,0,0,0,0,1,0, +12,0,115,105,103,110,0,1,1,0,12,118,0,0,0,1,3,2,0,12,1,112,0,0,1,1,110,0,0,0,4,118,101,99,52,95, +115,103,116,0,18,112,0,0,18,118,0,0,17,48,0,48,0,0,0,0,4,118,101,99,52,95,115,103,116,0,18,110,0,0, +17,48,0,48,0,0,0,18,118,0,0,0,4,118,101,99,52,95,115,117,98,116,114,97,99,116,0,18,95,95,114,101, +116,86,97,108,0,0,18,112,0,0,18,110,0,0,0,0,1,0,9,0,102,108,111,111,114,0,1,1,0,9,97,0,0,0,1,4,118, +101,99,52,95,102,108,111,111,114,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,97,0,0,0,0,1,0, +10,0,102,108,111,111,114,0,1,1,0,10,97,0,0,0,1,4,118,101,99,52,95,102,108,111,111,114,0,18,95,95, +114,101,116,86,97,108,0,59,120,121,0,0,18,97,0,0,0,0,1,0,11,0,102,108,111,111,114,0,1,1,0,11,97,0, +0,0,1,4,118,101,99,52,95,102,108,111,111,114,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0, +18,97,0,0,0,0,1,0,12,0,102,108,111,111,114,0,1,1,0,12,97,0,0,0,1,4,118,101,99,52,95,102,108,111, +111,114,0,18,95,95,114,101,116,86,97,108,0,0,18,97,0,0,0,0,1,0,9,0,99,101,105,108,0,1,1,0,9,97,0,0, +0,1,3,2,0,9,1,98,0,2,18,97,0,54,0,0,4,118,101,99,52,95,102,108,111,111,114,0,18,98,0,0,18,98,0,0,0, +9,18,95,95,114,101,116,86,97,108,0,59,120,0,18,98,0,54,20,0,0,1,0,10,0,99,101,105,108,0,1,1,0,10, +97,0,0,0,1,3,2,0,10,1,98,0,2,18,97,0,54,0,0,4,118,101,99,52,95,102,108,111,111,114,0,18,98,0,0,18, +98,0,0,0,9,18,95,95,114,101,116,86,97,108,0,59,120,121,0,18,98,0,54,20,0,0,1,0,11,0,99,101,105,108, +0,1,1,0,11,97,0,0,0,1,3,2,0,11,1,98,0,2,18,97,0,54,0,0,4,118,101,99,52,95,102,108,111,111,114,0,18, +98,0,0,18,98,0,0,0,9,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,18,98,0,54,20,0,0,1,0,12,0, +99,101,105,108,0,1,1,0,12,97,0,0,0,1,3,2,0,12,1,98,0,2,18,97,0,54,0,0,4,118,101,99,52,95,102,108, +111,111,114,0,18,98,0,0,18,98,0,0,0,9,18,95,95,114,101,116,86,97,108,0,18,98,0,54,20,0,0,1,0,9,0, +102,114,97,99,116,0,1,1,0,9,97,0,0,0,1,4,118,101,99,52,95,102,114,97,99,0,18,95,95,114,101,116,86, +97,108,0,59,120,0,0,18,97,0,0,0,0,1,0,10,0,102,114,97,99,116,0,1,1,0,10,97,0,0,0,1,4,118,101,99,52, +95,102,114,97,99,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,97,0,0,0,0,1,0,11,0,102,114, +97,99,116,0,1,1,0,11,97,0,0,0,1,4,118,101,99,52,95,102,114,97,99,0,18,95,95,114,101,116,86,97,108, +0,59,120,121,122,0,0,18,97,0,0,0,0,1,0,12,0,102,114,97,99,116,0,1,1,0,12,97,0,0,0,1,4,118,101,99, +52,95,102,114,97,99,0,18,95,95,114,101,116,86,97,108,0,0,18,97,0,0,0,0,1,0,9,0,109,111,100,0,1,1,0, +9,97,0,0,1,1,0,9,98,0,0,0,1,3,2,0,9,1,111,110,101,79,118,101,114,66,0,0,0,4,102,108,111,97,116,95, +114,99,112,0,18,111,110,101,79,118,101,114,66,0,0,18,98,0,0,0,9,18,95,95,114,101,116,86,97,108,0, +59,120,0,18,97,0,18,98,0,58,102,108,111,111,114,0,18,97,0,18,111,110,101,79,118,101,114,66,0,48,0, +0,48,47,20,0,0,1,0,10,0,109,111,100,0,1,1,0,10,97,0,0,1,1,0,9,98,0,0,0,1,3,2,0,9,1,111,110,101,79, +118,101,114,66,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,111,110,101,79,118,101,114,66,0,0,18, +98,0,0,0,9,18,95,95,114,101,116,86,97,108,0,59,120,121,0,18,97,0,18,98,0,58,102,108,111,111,114,0, +18,97,0,18,111,110,101,79,118,101,114,66,0,48,0,0,48,47,20,0,0,1,0,11,0,109,111,100,0,1,1,0,11,97, +0,0,1,1,0,9,98,0,0,0,1,3,2,0,9,1,111,110,101,79,118,101,114,66,0,0,0,4,102,108,111,97,116,95,114, +99,112,0,18,111,110,101,79,118,101,114,66,0,0,18,98,0,0,0,9,18,95,95,114,101,116,86,97,108,0,59, +120,121,122,0,18,97,0,18,98,0,58,102,108,111,111,114,0,18,97,0,18,111,110,101,79,118,101,114,66,0, +48,0,0,48,47,20,0,0,1,0,12,0,109,111,100,0,1,1,0,12,97,0,0,1,1,0,9,98,0,0,0,1,3,2,0,9,1,111,110, +101,79,118,101,114,66,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,111,110,101,79,118,101,114,66, +0,0,18,98,0,0,0,9,18,95,95,114,101,116,86,97,108,0,18,97,0,18,98,0,58,102,108,111,111,114,0,18,97, +0,18,111,110,101,79,118,101,114,66,0,48,0,0,48,47,20,0,0,1,0,10,0,109,111,100,0,1,1,0,10,97,0,0,1, +1,0,10,98,0,0,0,1,3,2,0,9,1,111,110,101,79,118,101,114,66,120,0,0,1,1,111,110,101,79,118,101,114, +66,121,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,111,110,101,79,118,101,114,66,120,0,0,18,98,0, +59,120,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,111,110,101,79,118,101,114,66,121,0,0,18,98,0, +59,121,0,0,0,9,18,95,95,114,101,116,86,97,108,0,59,120,0,18,97,0,59,120,0,18,98,0,59,120,0,58,102, +108,111,111,114,0,18,97,0,59,120,0,18,111,110,101,79,118,101,114,66,120,0,48,0,0,48,47,20,0,9,18, +95,95,114,101,116,86,97,108,0,59,121,0,18,97,0,59,121,0,18,98,0,59,121,0,58,102,108,111,111,114,0, +18,97,0,59,121,0,18,111,110,101,79,118,101,114,66,121,0,48,0,0,48,47,20,0,0,1,0,11,0,109,111,100,0, +1,1,0,11,97,0,0,1,1,0,11,98,0,0,0,1,3,2,0,9,1,111,110,101,79,118,101,114,66,120,0,0,1,1,111,110, +101,79,118,101,114,66,121,0,0,1,1,111,110,101,79,118,101,114,66,122,0,0,0,4,102,108,111,97,116,95, +114,99,112,0,18,111,110,101,79,118,101,114,66,120,0,0,18,98,0,59,120,0,0,0,4,102,108,111,97,116,95, +114,99,112,0,18,111,110,101,79,118,101,114,66,121,0,0,18,98,0,59,121,0,0,0,4,102,108,111,97,116,95, +114,99,112,0,18,111,110,101,79,118,101,114,66,122,0,0,18,98,0,59,122,0,0,0,9,18,95,95,114,101,116, +86,97,108,0,59,120,0,18,97,0,59,120,0,18,98,0,59,120,0,58,102,108,111,111,114,0,18,97,0,59,120,0, +18,111,110,101,79,118,101,114,66,120,0,48,0,0,48,47,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121, +0,18,97,0,59,121,0,18,98,0,59,121,0,58,102,108,111,111,114,0,18,97,0,59,121,0,18,111,110,101,79, +118,101,114,66,121,0,48,0,0,48,47,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,18,97,0,59,122, +0,18,98,0,59,122,0,58,102,108,111,111,114,0,18,97,0,59,122,0,18,111,110,101,79,118,101,114,66,122, +0,48,0,0,48,47,20,0,0,1,0,12,0,109,111,100,0,1,1,0,12,97,0,0,1,1,0,12,98,0,0,0,1,3,2,0,9,1,111,110, +101,79,118,101,114,66,120,0,0,1,1,111,110,101,79,118,101,114,66,121,0,0,1,1,111,110,101,79,118,101, +114,66,122,0,0,1,1,111,110,101,79,118,101,114,66,119,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18, +111,110,101,79,118,101,114,66,120,0,0,18,98,0,59,120,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18, +111,110,101,79,118,101,114,66,121,0,0,18,98,0,59,121,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18, +111,110,101,79,118,101,114,66,122,0,0,18,98,0,59,122,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18, +111,110,101,79,118,101,114,66,119,0,0,18,98,0,59,119,0,0,0,9,18,95,95,114,101,116,86,97,108,0,59, +120,0,18,97,0,59,120,0,18,98,0,59,120,0,58,102,108,111,111,114,0,18,97,0,59,120,0,18,111,110,101, +79,118,101,114,66,120,0,48,0,0,48,47,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,18,97,0,59, +121,0,18,98,0,59,121,0,58,102,108,111,111,114,0,18,97,0,59,121,0,18,111,110,101,79,118,101,114,66, +121,0,48,0,0,48,47,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,18,97,0,59,122,0,18,98,0,59, +122,0,58,102,108,111,111,114,0,18,97,0,59,122,0,18,111,110,101,79,118,101,114,66,122,0,48,0,0,48, +47,20,0,9,18,95,95,114,101,116,86,97,108,0,59,119,0,18,97,0,59,119,0,18,98,0,59,119,0,58,102,108, +111,111,114,0,18,97,0,59,119,0,18,111,110,101,79,118,101,114,66,119,0,48,0,0,48,47,20,0,0,1,0,9,0, +109,105,110,0,1,1,0,9,97,0,0,1,1,0,9,98,0,0,0,1,4,118,101,99,52,95,109,105,110,0,18,95,95,114,101, +116,86,97,108,0,59,120,0,0,18,97,0,59,120,0,0,18,98,0,59,120,0,0,0,0,1,0,10,0,109,105,110,0,1,1,0, +10,97,0,0,1,1,0,10,98,0,0,0,1,4,118,101,99,52,95,109,105,110,0,18,95,95,114,101,116,86,97,108,0,59, +120,121,0,0,18,97,0,59,120,121,0,0,18,98,0,59,120,121,0,0,0,0,1,0,11,0,109,105,110,0,1,1,0,11,97,0, +0,1,1,0,11,98,0,0,0,1,4,118,101,99,52,95,109,105,110,0,18,95,95,114,101,116,86,97,108,0,59,120,121, +122,0,0,18,97,0,59,120,121,122,0,0,18,98,0,59,120,121,122,0,0,0,0,1,0,12,0,109,105,110,0,1,1,0,12, +97,0,0,1,1,0,12,98,0,0,0,1,4,118,101,99,52,95,109,105,110,0,18,95,95,114,101,116,86,97,108,0,0,18, +97,0,0,18,98,0,0,0,0,1,0,10,0,109,105,110,0,1,1,0,10,97,0,0,1,1,0,9,98,0,0,0,1,4,118,101,99,52,95, +109,105,110,0,18,95,95,114,101,116,86,97,108,0,0,18,97,0,59,120,121,0,0,18,98,0,59,120,120,0,0,0,0, +1,0,11,0,109,105,110,0,1,1,0,11,97,0,0,1,1,0,9,98,0,0,0,1,4,118,101,99,52,95,109,105,110,0,18,95, +95,114,101,116,86,97,108,0,0,18,97,0,59,120,121,122,0,0,18,98,0,59,120,120,120,0,0,0,0,1,0,12,0, +109,105,110,0,1,1,0,12,97,0,0,1,1,0,9,98,0,0,0,1,4,118,101,99,52,95,109,105,110,0,18,95,95,114,101, +116,86,97,108,0,0,18,97,0,0,18,98,0,59,120,120,120,120,0,0,0,0,1,0,9,0,109,97,120,0,1,1,0,9,97,0,0, +1,1,0,9,98,0,0,0,1,4,118,101,99,52,95,109,97,120,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18, +97,0,59,120,0,0,18,98,0,59,120,0,0,0,0,1,0,10,0,109,97,120,0,1,1,0,10,97,0,0,1,1,0,10,98,0,0,0,1,4, +118,101,99,52,95,109,97,120,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,97,0,59,120,121,0, +0,18,98,0,59,120,121,0,0,0,0,1,0,11,0,109,97,120,0,1,1,0,11,97,0,0,1,1,0,11,98,0,0,0,1,4,118,101, +99,52,95,109,97,120,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,97,0,59,120,121,122,0, +0,18,98,0,59,120,121,122,0,0,0,0,1,0,12,0,109,97,120,0,1,1,0,12,97,0,0,1,1,0,12,98,0,0,0,1,4,118, +101,99,52,95,109,97,120,0,18,95,95,114,101,116,86,97,108,0,0,18,97,0,0,18,98,0,0,0,0,1,0,10,0,109, +97,120,0,1,1,0,10,97,0,0,1,1,0,9,98,0,0,0,1,4,118,101,99,52,95,109,97,120,0,18,95,95,114,101,116, +86,97,108,0,0,18,97,0,59,120,121,0,0,18,98,0,59,120,120,0,0,0,0,1,0,11,0,109,97,120,0,1,1,0,11,97, +0,0,1,1,0,9,98,0,0,0,1,4,118,101,99,52,95,109,97,120,0,18,95,95,114,101,116,86,97,108,0,0,18,97,0, +59,120,121,122,0,0,18,98,0,59,120,120,120,0,0,0,0,1,0,12,0,109,97,120,0,1,1,0,12,97,0,0,1,1,0,9,98, +0,0,0,1,4,118,101,99,52,95,109,97,120,0,18,95,95,114,101,116,86,97,108,0,0,18,97,0,0,18,98,0,59, +120,120,120,120,0,0,0,0,1,0,9,0,99,108,97,109,112,0,1,1,0,9,118,97,108,0,0,1,1,0,9,109,105,110,86, +97,108,0,0,1,1,0,9,109,97,120,86,97,108,0,0,0,1,4,118,101,99,52,95,99,108,97,109,112,0,18,95,95, +114,101,116,86,97,108,0,0,18,118,97,108,0,0,18,109,105,110,86,97,108,0,0,18,109,97,120,86,97,108,0, +0,0,0,1,0,10,0,99,108,97,109,112,0,1,1,0,10,118,97,108,0,0,1,1,0,9,109,105,110,86,97,108,0,0,1,1,0, +9,109,97,120,86,97,108,0,0,0,1,4,118,101,99,52,95,99,108,97,109,112,0,18,95,95,114,101,116,86,97, +108,0,0,18,118,97,108,0,0,18,109,105,110,86,97,108,0,0,18,109,97,120,86,97,108,0,0,0,0,1,0,11,0,99, +108,97,109,112,0,1,1,0,11,118,97,108,0,0,1,1,0,9,109,105,110,86,97,108,0,0,1,1,0,9,109,97,120,86, +97,108,0,0,0,1,4,118,101,99,52,95,99,108,97,109,112,0,18,95,95,114,101,116,86,97,108,0,0,18,118,97, +108,0,0,18,109,105,110,86,97,108,0,0,18,109,97,120,86,97,108,0,0,0,0,1,0,12,0,99,108,97,109,112,0, +1,1,0,12,118,97,108,0,0,1,1,0,9,109,105,110,86,97,108,0,0,1,1,0,9,109,97,120,86,97,108,0,0,0,1,4, +118,101,99,52,95,99,108,97,109,112,0,18,95,95,114,101,116,86,97,108,0,0,18,118,97,108,0,0,18,109, +105,110,86,97,108,0,0,18,109,97,120,86,97,108,0,0,0,0,1,0,10,0,99,108,97,109,112,0,1,1,0,10,118,97, +108,0,0,1,1,0,10,109,105,110,86,97,108,0,0,1,1,0,10,109,97,120,86,97,108,0,0,0,1,4,118,101,99,52, +95,99,108,97,109,112,0,18,95,95,114,101,116,86,97,108,0,0,18,118,97,108,0,0,18,109,105,110,86,97, +108,0,0,18,109,97,120,86,97,108,0,0,0,0,1,0,11,0,99,108,97,109,112,0,1,1,0,11,118,97,108,0,0,1,1,0, +11,109,105,110,86,97,108,0,0,1,1,0,11,109,97,120,86,97,108,0,0,0,1,4,118,101,99,52,95,99,108,97, +109,112,0,18,95,95,114,101,116,86,97,108,0,0,18,118,97,108,0,0,18,109,105,110,86,97,108,0,0,18,109, +97,120,86,97,108,0,0,0,0,1,0,12,0,99,108,97,109,112,0,1,1,0,12,118,97,108,0,0,1,1,0,12,109,105,110, +86,97,108,0,0,1,1,0,12,109,97,120,86,97,108,0,0,0,1,4,118,101,99,52,95,99,108,97,109,112,0,18,95, +95,114,101,116,86,97,108,0,0,18,118,97,108,0,0,18,109,105,110,86,97,108,0,0,18,109,97,120,86,97, +108,0,0,0,0,1,0,9,0,109,105,120,0,1,1,0,9,120,0,0,1,1,0,9,121,0,0,1,1,0,9,97,0,0,0,1,4,118,101,99, +52,95,108,114,112,0,18,95,95,114,101,116,86,97,108,0,0,18,97,0,0,18,121,0,0,18,120,0,0,0,0,1,0,10, +0,109,105,120,0,1,1,0,10,120,0,0,1,1,0,10,121,0,0,1,1,0,9,97,0,0,0,1,4,118,101,99,52,95,108,114, +112,0,18,95,95,114,101,116,86,97,108,0,0,18,97,0,0,18,121,0,0,18,120,0,0,0,0,1,0,11,0,109,105,120, +0,1,1,0,11,120,0,0,1,1,0,11,121,0,0,1,1,0,9,97,0,0,0,1,4,118,101,99,52,95,108,114,112,0,18,95,95, +114,101,116,86,97,108,0,0,18,97,0,0,18,121,0,0,18,120,0,0,0,0,1,0,12,0,109,105,120,0,1,1,0,12,120, +0,0,1,1,0,12,121,0,0,1,1,0,9,97,0,0,0,1,4,118,101,99,52,95,108,114,112,0,18,95,95,114,101,116,86, +97,108,0,0,18,97,0,0,18,121,0,0,18,120,0,0,0,0,1,0,10,0,109,105,120,0,1,1,0,10,120,0,0,1,1,0,10, +121,0,0,1,1,0,10,97,0,0,0,1,4,118,101,99,52,95,108,114,112,0,18,95,95,114,101,116,86,97,108,0,0,18, +97,0,0,18,121,0,0,18,120,0,0,0,0,1,0,11,0,109,105,120,0,1,1,0,11,120,0,0,1,1,0,11,121,0,0,1,1,0,11, +97,0,0,0,1,4,118,101,99,52,95,108,114,112,0,18,95,95,114,101,116,86,97,108,0,0,18,97,0,0,18,121,0, +0,18,120,0,0,0,0,1,0,12,0,109,105,120,0,1,1,0,12,120,0,0,1,1,0,12,121,0,0,1,1,0,12,97,0,0,0,1,4, +118,101,99,52,95,108,114,112,0,18,95,95,114,101,116,86,97,108,0,0,18,97,0,0,18,121,0,0,18,120,0,0, +0,0,1,0,9,0,115,116,101,112,0,1,1,0,9,101,100,103,101,0,0,1,1,0,9,120,0,0,0,1,4,118,101,99,52,95, +115,103,116,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,120,0,0,18,101,100,103,101,0,0,0,0,1, +0,10,0,115,116,101,112,0,1,1,0,10,101,100,103,101,0,0,1,1,0,10,120,0,0,0,1,4,118,101,99,52,95,115, +103,116,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,120,0,0,18,101,100,103,101,0,0,0,0,1, +0,11,0,115,116,101,112,0,1,1,0,11,101,100,103,101,0,0,1,1,0,11,120,0,0,0,1,4,118,101,99,52,95,115, +103,116,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,120,0,0,18,101,100,103,101,0,0,0, +0,1,0,12,0,115,116,101,112,0,1,1,0,12,101,100,103,101,0,0,1,1,0,12,120,0,0,0,1,4,118,101,99,52,95, +115,103,116,0,18,95,95,114,101,116,86,97,108,0,0,18,120,0,0,18,101,100,103,101,0,0,0,0,1,0,10,0, +115,116,101,112,0,1,1,0,9,101,100,103,101,0,0,1,1,0,10,118,0,0,0,1,4,118,101,99,52,95,115,103,116, +0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,118,0,0,18,101,100,103,101,0,59,120,120,0,0,0, +0,1,0,11,0,115,116,101,112,0,1,1,0,9,101,100,103,101,0,0,1,1,0,11,118,0,0,0,1,4,118,101,99,52,95, +115,103,116,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,118,0,0,18,101,100,103,101,0, +59,120,120,120,0,0,0,0,1,0,12,0,115,116,101,112,0,1,1,0,9,101,100,103,101,0,0,1,1,0,12,118,0,0,0,1, +4,118,101,99,52,95,115,103,116,0,18,95,95,114,101,116,86,97,108,0,0,18,118,0,0,18,101,100,103,101, +0,59,120,120,120,120,0,0,0,0,1,0,9,0,115,109,111,111,116,104,115,116,101,112,0,1,1,0,9,101,100,103, +101,48,0,0,1,1,0,9,101,100,103,101,49,0,0,1,1,0,9,120,0,0,0,1,3,2,0,9,1,116,0,2,58,99,108,97,109, +112,0,18,120,0,18,101,100,103,101,48,0,47,18,101,100,103,101,49,0,18,101,100,103,101,48,0,47,49,0, +17,48,0,48,0,0,0,17,49,0,48,0,0,0,0,0,0,8,18,116,0,18,116,0,48,17,51,0,48,0,0,17,50,0,48,0,0,18, +116,0,48,47,48,0,0,1,0,10,0,115,109,111,111,116,104,115,116,101,112,0,1,1,0,10,101,100,103,101,48, +0,0,1,1,0,10,101,100,103,101,49,0,0,1,1,0,10,118,0,0,0,1,3,2,0,10,1,116,0,2,58,99,108,97,109,112,0, +18,118,0,18,101,100,103,101,48,0,47,18,101,100,103,101,49,0,18,101,100,103,101,48,0,47,49,0,17,48, +0,48,0,0,0,17,49,0,48,0,0,0,0,0,0,8,18,116,0,18,116,0,48,17,51,0,48,0,0,17,50,0,48,0,0,18,116,0,48, +47,48,0,0,1,0,11,0,115,109,111,111,116,104,115,116,101,112,0,1,1,0,11,101,100,103,101,48,0,0,1,1,0, +11,101,100,103,101,49,0,0,1,1,0,11,118,0,0,0,1,3,2,0,11,1,116,0,2,58,99,108,97,109,112,0,18,118,0, +18,101,100,103,101,48,0,47,18,101,100,103,101,49,0,18,101,100,103,101,48,0,47,49,0,17,48,0,48,0,0, +0,17,49,0,48,0,0,0,0,0,0,8,18,116,0,18,116,0,48,17,51,0,48,0,0,17,50,0,48,0,0,18,116,0,48,47,48,0, +0,1,0,12,0,115,109,111,111,116,104,115,116,101,112,0,1,1,0,12,101,100,103,101,48,0,0,1,1,0,12,101, +100,103,101,49,0,0,1,1,0,12,118,0,0,0,1,3,2,0,12,1,116,0,2,58,99,108,97,109,112,0,18,118,0,18,101, +100,103,101,48,0,47,18,101,100,103,101,49,0,18,101,100,103,101,48,0,47,49,0,17,48,0,48,0,0,0,17,49, +0,48,0,0,0,0,0,0,8,18,116,0,18,116,0,48,17,51,0,48,0,0,17,50,0,48,0,0,18,116,0,48,47,48,0,0,1,0,10, +0,115,109,111,111,116,104,115,116,101,112,0,1,1,0,9,101,100,103,101,48,0,0,1,1,0,9,101,100,103,101, +49,0,0,1,1,0,10,118,0,0,0,1,3,2,0,10,1,116,0,2,58,99,108,97,109,112,0,18,118,0,18,101,100,103,101, +48,0,47,18,101,100,103,101,49,0,18,101,100,103,101,48,0,47,49,0,17,48,0,48,0,0,0,17,49,0,48,0,0,0, +0,0,0,8,18,116,0,18,116,0,48,17,51,0,48,0,0,17,50,0,48,0,0,18,116,0,48,47,48,0,0,1,0,11,0,115,109, +111,111,116,104,115,116,101,112,0,1,1,0,9,101,100,103,101,48,0,0,1,1,0,9,101,100,103,101,49,0,0,1, +1,0,11,118,0,0,0,1,3,2,0,11,1,116,0,2,58,99,108,97,109,112,0,18,118,0,18,101,100,103,101,48,0,47, +18,101,100,103,101,49,0,18,101,100,103,101,48,0,47,49,0,17,48,0,48,0,0,0,17,49,0,48,0,0,0,0,0,0,8, +18,116,0,18,116,0,48,17,51,0,48,0,0,17,50,0,48,0,0,18,116,0,48,47,48,0,0,1,0,12,0,115,109,111,111, +116,104,115,116,101,112,0,1,1,0,9,101,100,103,101,48,0,0,1,1,0,9,101,100,103,101,49,0,0,1,1,0,12, +118,0,0,0,1,3,2,0,12,1,116,0,2,58,99,108,97,109,112,0,18,118,0,18,101,100,103,101,48,0,47,18,101, +100,103,101,49,0,18,101,100,103,101,48,0,47,49,0,17,48,0,48,0,0,0,17,49,0,48,0,0,0,0,0,0,8,18,116, +0,18,116,0,48,17,51,0,48,0,0,17,50,0,48,0,0,18,116,0,48,47,48,0,0,1,0,9,0,108,101,110,103,116,104, +0,1,1,0,9,120,0,0,0,1,8,58,97,98,115,0,18,120,0,0,0,0,0,1,0,9,0,108,101,110,103,116,104,0,1,1,0,10, +118,0,0,0,1,3,2,0,9,1,114,0,0,0,3,2,1,9,1,112,0,2,58,100,111,116,0,18,118,0,0,18,118,0,0,0,0,0,4, +102,108,111,97,116,95,114,115,113,0,18,114,0,0,18,112,0,0,0,4,102,108,111,97,116,95,114,99,112,0, +18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,114,0,0,0,0,1,0,9,0,108,101,110,103,116,104,0,1,1,0, +11,118,0,0,0,1,3,2,0,9,1,114,0,0,0,3,2,1,9,1,112,0,2,58,100,111,116,0,18,118,0,0,18,118,0,0,0,0,0, +4,102,108,111,97,116,95,114,115,113,0,18,114,0,0,18,112,0,0,0,4,102,108,111,97,116,95,114,99,112,0, +18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,114,0,0,0,0,1,0,9,0,108,101,110,103,116,104,0,1,1,0, +12,118,0,0,0,1,3,2,0,9,1,114,0,0,0,3,2,1,9,1,112,0,2,58,100,111,116,0,18,118,0,0,18,118,0,0,0,0,0, +4,102,108,111,97,116,95,114,115,113,0,18,114,0,0,18,112,0,0,0,4,102,108,111,97,116,95,114,99,112,0, +18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,114,0,0,0,0,1,0,9,0,100,105,115,116,97,110,99,101,0, +1,1,0,9,120,0,0,1,1,0,9,121,0,0,0,1,3,2,1,9,1,100,0,2,18,120,0,18,121,0,47,0,0,9,18,95,95,114,101, +116,86,97,108,0,58,108,101,110,103,116,104,0,18,100,0,0,0,20,0,0,1,0,9,0,100,105,115,116,97,110,99, +101,0,1,1,0,10,118,0,0,1,1,0,10,117,0,0,0,1,3,2,1,10,1,100,50,0,2,18,118,0,18,117,0,47,0,0,9,18,95, +95,114,101,116,86,97,108,0,58,108,101,110,103,116,104,0,18,100,50,0,0,0,20,0,0,1,0,9,0,100,105,115, +116,97,110,99,101,0,1,1,0,11,118,0,0,1,1,0,11,117,0,0,0,1,3,2,1,11,1,100,51,0,2,18,118,0,18,117,0, +47,0,0,9,18,95,95,114,101,116,86,97,108,0,58,108,101,110,103,116,104,0,18,100,51,0,0,0,20,0,0,1,0, +9,0,100,105,115,116,97,110,99,101,0,1,1,0,12,118,0,0,1,1,0,12,117,0,0,0,1,3,2,1,12,1,100,52,0,2,18, +118,0,18,117,0,47,0,0,9,18,95,95,114,101,116,86,97,108,0,58,108,101,110,103,116,104,0,18,100,52,0, +0,0,20,0,0,1,0,11,0,99,114,111,115,115,0,1,1,0,11,118,0,0,1,1,0,11,117,0,0,0,1,4,118,101,99,51,95, +99,114,111,115,115,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,118,0,0,18,117,0,0,0,0, +1,0,9,0,102,97,99,101,102,111,114,119,97,114,100,0,1,1,0,9,78,0,0,1,1,0,9,73,0,0,1,1,0,9,78,114, +101,102,0,0,0,1,3,2,1,9,1,100,0,2,58,100,111,116,0,18,78,114,101,102,0,0,18,73,0,0,0,0,0,3,2,0,9,1, +115,0,0,0,4,118,101,99,52,95,115,103,116,0,18,115,0,59,120,0,0,17,48,0,48,0,0,0,18,100,0,0,0,8,58, +109,105,120,0,18,78,0,54,0,18,78,0,0,18,115,0,0,0,0,0,1,0,10,0,102,97,99,101,102,111,114,119,97, +114,100,0,1,1,0,10,78,0,0,1,1,0,10,73,0,0,1,1,0,10,78,114,101,102,0,0,0,1,3,2,1,9,1,100,0,2,58,100, +111,116,0,18,78,114,101,102,0,0,18,73,0,0,0,0,0,3,2,0,9,1,115,0,0,0,4,118,101,99,52,95,115,103,116, +0,18,115,0,59,120,0,0,17,48,0,48,0,0,0,18,100,0,0,0,8,58,109,105,120,0,18,78,0,54,0,18,78,0,0,18, +115,0,0,0,0,0,1,0,11,0,102,97,99,101,102,111,114,119,97,114,100,0,1,1,0,11,78,0,0,1,1,0,11,73,0,0, +1,1,0,11,78,114,101,102,0,0,0,1,3,2,1,9,1,100,0,2,58,100,111,116,0,18,78,114,101,102,0,0,18,73,0,0, +0,0,0,3,2,0,9,1,115,0,0,0,4,118,101,99,52,95,115,103,116,0,18,115,0,59,120,0,0,17,48,0,48,0,0,0,18, +100,0,0,0,8,58,109,105,120,0,18,78,0,54,0,18,78,0,0,18,115,0,0,0,0,0,1,0,12,0,102,97,99,101,102, +111,114,119,97,114,100,0,1,1,0,12,78,0,0,1,1,0,12,73,0,0,1,1,0,12,78,114,101,102,0,0,0,1,3,2,1,9,1, +100,0,2,58,100,111,116,0,18,78,114,101,102,0,0,18,73,0,0,0,0,0,3,2,0,9,1,115,0,0,0,4,118,101,99,52, +95,115,103,116,0,18,115,0,59,120,0,0,17,48,0,48,0,0,0,18,100,0,0,0,8,58,109,105,120,0,18,78,0,54,0, +18,78,0,0,18,115,0,0,0,0,0,1,0,9,0,114,101,102,108,101,99,116,0,1,1,0,9,73,0,0,1,1,0,9,78,0,0,0,1, +8,18,73,0,17,50,0,48,0,0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,48,18,78,0,48,47,0,0,1,0,10,0,114, +101,102,108,101,99,116,0,1,1,0,10,73,0,0,1,1,0,10,78,0,0,0,1,8,18,73,0,17,50,0,48,0,0,58,100,111, +116,0,18,78,0,0,18,73,0,0,0,48,18,78,0,48,47,0,0,1,0,11,0,114,101,102,108,101,99,116,0,1,1,0,11,73, +0,0,1,1,0,11,78,0,0,0,1,8,18,73,0,17,50,0,48,0,0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,48,18,78,0, +48,47,0,0,1,0,12,0,114,101,102,108,101,99,116,0,1,1,0,12,73,0,0,1,1,0,12,78,0,0,0,1,8,18,73,0,17, +50,0,48,0,0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,48,18,78,0,48,47,0,0,1,0,9,0,114,101,102,114,97, +99,116,0,1,1,0,9,73,0,0,1,1,0,9,78,0,0,1,1,0,9,101,116,97,0,0,0,1,3,2,0,9,1,107,0,2,17,49,0,48,0,0, +18,101,116,97,0,18,101,116,97,0,48,17,49,0,48,0,0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,58,100, +111,116,0,18,78,0,0,18,73,0,0,0,48,47,48,47,0,0,10,18,107,0,17,48,0,48,0,0,40,0,8,17,48,0,48,0,0,0, +9,14,0,8,18,101,116,97,0,18,73,0,48,18,101,116,97,0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,48,58, +115,113,114,116,0,18,107,0,0,0,46,18,78,0,48,47,0,0,1,0,10,0,114,101,102,114,97,99,116,0,1,1,0,10, +73,0,0,1,1,0,10,78,0,0,1,1,0,9,101,116,97,0,0,0,1,3,2,0,9,1,107,0,2,17,49,0,48,0,0,18,101,116,97,0, +18,101,116,97,0,48,17,49,0,48,0,0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,58,100,111,116,0,18,78,0, +0,18,73,0,0,0,48,47,48,47,0,0,10,18,107,0,17,48,0,48,0,0,40,0,8,17,48,0,48,0,0,0,9,14,0,8,18,101, +116,97,0,18,73,0,48,18,101,116,97,0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,48,58,115,113,114,116,0, +18,107,0,0,0,46,18,78,0,48,47,0,0,1,0,11,0,114,101,102,114,97,99,116,0,1,1,0,11,73,0,0,1,1,0,11,78, +0,0,1,1,0,9,101,116,97,0,0,0,1,3,2,0,9,1,107,0,2,17,49,0,48,0,0,18,101,116,97,0,18,101,116,97,0,48, 17,49,0,48,0,0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,48,47, 48,47,0,0,10,18,107,0,17,48,0,48,0,0,40,0,8,17,48,0,48,0,0,0,9,14,0,8,18,101,116,97,0,18,73,0,48, 18,101,116,97,0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,48,58,115,113,114,116,0,18,107,0,0,0,46,18, -78,0,48,47,0,0,1,0,11,0,114,101,102,114,97,99,116,0,1,0,0,11,73,0,0,1,0,0,11,78,0,0,1,0,0,9,101, +78,0,48,47,0,0,1,0,12,0,114,101,102,114,97,99,116,0,1,1,0,12,73,0,0,1,1,0,12,78,0,0,1,1,0,9,101, 116,97,0,0,0,1,3,2,0,9,1,107,0,2,17,49,0,48,0,0,18,101,116,97,0,18,101,116,97,0,48,17,49,0,48,0,0, 58,100,111,116,0,18,78,0,0,18,73,0,0,0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,48,47,48,47,0,0,10, 18,107,0,17,48,0,48,0,0,40,0,8,17,48,0,48,0,0,0,9,14,0,8,18,101,116,97,0,18,73,0,48,18,101,116,97, 0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,48,58,115,113,114,116,0,18,107,0,0,0,46,18,78,0,48,47,0,0, -1,0,12,0,114,101,102,114,97,99,116,0,1,0,0,12,73,0,0,1,0,0,12,78,0,0,1,0,0,9,101,116,97,0,0,0,1,3, -2,0,9,1,107,0,2,17,49,0,48,0,0,18,101,116,97,0,18,101,116,97,0,48,17,49,0,48,0,0,58,100,111,116,0, -18,78,0,0,18,73,0,0,0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,48,47,48,47,0,0,10,18,107,0,17,48,0, -48,0,0,40,0,8,17,48,0,48,0,0,0,9,14,0,8,18,101,116,97,0,18,73,0,48,18,101,116,97,0,58,100,111,116, -0,18,78,0,0,18,73,0,0,0,48,58,115,113,114,116,0,18,107,0,0,0,46,18,78,0,48,47,0,0,1,0,13,0,109,97, -116,114,105,120,67,111,109,112,77,117,108,116,0,1,0,0,13,109,0,0,1,0,0,13,110,0,0,0,1,8,58,109,97, -116,50,0,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,48,0,18,109,0,16,10,49,0,57,18,110,0,16,10,49, -0,57,48,0,0,0,0,1,0,14,0,109,97,116,114,105,120,67,111,109,112,77,117,108,116,0,1,0,0,14,109,0,0,1, -0,0,14,110,0,0,0,1,8,58,109,97,116,51,0,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,48,0,18,109,0, -16,10,49,0,57,18,110,0,16,10,49,0,57,48,0,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,48,0,0,0,0, -1,0,15,0,109,97,116,114,105,120,67,111,109,112,77,117,108,116,0,1,0,0,15,109,0,0,1,0,0,15,110,0,0, -0,1,8,58,109,97,116,52,0,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,48,0,18,109,0,16,10,49,0,57, -18,110,0,16,10,49,0,57,48,0,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,48,0,18,109,0,16,10,51,0, -57,18,110,0,16,10,51,0,57,48,0,0,0,0,1,0,2,0,108,101,115,115,84,104,97,110,0,1,0,0,10,118,0,0,1,0, -0,10,117,0,0,0,1,8,58,98,118,101,99,50,0,18,118,0,59,120,0,18,117,0,59,120,0,40,0,18,118,0,59,121, -0,18,117,0,59,121,0,40,0,0,0,0,1,0,3,0,108,101,115,115,84,104,97,110,0,1,0,0,11,118,0,0,1,0,0,11, -117,0,0,0,1,8,58,98,118,101,99,51,0,18,118,0,59,120,0,18,117,0,59,120,0,40,0,18,118,0,59,121,0,18, -117,0,59,121,0,40,0,18,118,0,59,122,0,18,117,0,59,122,0,40,0,0,0,0,1,0,4,0,108,101,115,115,84,104, -97,110,0,1,0,0,12,118,0,0,1,0,0,12,117,0,0,0,1,8,58,98,118,101,99,52,0,18,118,0,59,120,0,18,117,0, -59,120,0,40,0,18,118,0,59,121,0,18,117,0,59,121,0,40,0,18,118,0,59,122,0,18,117,0,59,122,0,40,0,18, -118,0,59,119,0,18,117,0,59,119,0,40,0,0,0,0,1,0,2,0,108,101,115,115,84,104,97,110,0,1,0,0,6,118,0, -0,1,0,0,6,117,0,0,0,1,8,58,98,118,101,99,50,0,18,118,0,59,120,0,18,117,0,59,120,0,40,0,18,118,0,59, -121,0,18,117,0,59,121,0,40,0,0,0,0,1,0,3,0,108,101,115,115,84,104,97,110,0,1,0,0,7,118,0,0,1,0,0,7, -117,0,0,0,1,8,58,98,118,101,99,51,0,18,118,0,59,120,0,18,117,0,59,120,0,40,0,18,118,0,59,121,0,18, -117,0,59,121,0,40,0,18,118,0,59,122,0,18,117,0,59,122,0,40,0,0,0,0,1,0,4,0,108,101,115,115,84,104, -97,110,0,1,0,0,8,118,0,0,1,0,0,8,117,0,0,0,1,8,58,98,118,101,99,52,0,18,118,0,59,120,0,18,117,0,59, -120,0,40,0,18,118,0,59,121,0,18,117,0,59,121,0,40,0,18,118,0,59,122,0,18,117,0,59,122,0,40,0,18, -118,0,59,119,0,18,117,0,59,119,0,40,0,0,0,0,1,0,2,0,108,101,115,115,84,104,97,110,69,113,117,97, -108,0,1,0,0,10,118,0,0,1,0,0,10,117,0,0,0,1,8,58,98,118,101,99,50,0,18,118,0,59,120,0,18,117,0,59, -120,0,42,0,18,118,0,59,121,0,18,117,0,59,121,0,42,0,0,0,0,1,0,3,0,108,101,115,115,84,104,97,110,69, -113,117,97,108,0,1,0,0,11,118,0,0,1,0,0,11,117,0,0,0,1,8,58,98,118,101,99,51,0,18,118,0,59,120,0, -18,117,0,59,120,0,42,0,18,118,0,59,121,0,18,117,0,59,121,0,42,0,18,118,0,59,122,0,18,117,0,59,122, -0,42,0,0,0,0,1,0,4,0,108,101,115,115,84,104,97,110,69,113,117,97,108,0,1,0,0,12,118,0,0,1,0,0,12, -117,0,0,0,1,8,58,98,118,101,99,52,0,18,118,0,59,120,0,18,117,0,59,120,0,42,0,18,118,0,59,121,0,18, -117,0,59,121,0,42,0,18,118,0,59,122,0,18,117,0,59,122,0,42,0,18,118,0,59,119,0,18,117,0,59,119,0, -42,0,0,0,0,1,0,2,0,108,101,115,115,84,104,97,110,69,113,117,97,108,0,1,0,0,6,118,0,0,1,0,0,6,117,0, -0,0,1,8,58,98,118,101,99,50,0,18,118,0,59,120,0,18,117,0,59,120,0,42,0,18,118,0,59,121,0,18,117,0, -59,121,0,42,0,0,0,0,1,0,3,0,108,101,115,115,84,104,97,110,69,113,117,97,108,0,1,0,0,7,118,0,0,1,0, -0,7,117,0,0,0,1,8,58,98,118,101,99,51,0,18,118,0,59,120,0,18,117,0,59,120,0,42,0,18,118,0,59,121,0, -18,117,0,59,121,0,42,0,18,118,0,59,122,0,18,117,0,59,122,0,42,0,0,0,0,1,0,4,0,108,101,115,115,84, -104,97,110,69,113,117,97,108,0,1,0,0,8,118,0,0,1,0,0,8,117,0,0,0,1,8,58,98,118,101,99,52,0,18,118, -0,59,120,0,18,117,0,59,120,0,42,0,18,118,0,59,121,0,18,117,0,59,121,0,42,0,18,118,0,59,122,0,18, -117,0,59,122,0,42,0,18,118,0,59,119,0,18,117,0,59,119,0,42,0,0,0,0,1,0,2,0,103,114,101,97,116,101, -114,84,104,97,110,0,1,0,0,10,118,0,0,1,0,0,10,117,0,0,0,1,8,58,98,118,101,99,50,0,18,118,0,59,120, -0,18,117,0,59,120,0,41,0,18,118,0,59,121,0,18,117,0,59,121,0,41,0,0,0,0,1,0,3,0,103,114,101,97,116, -101,114,84,104,97,110,0,1,0,0,11,118,0,0,1,0,0,11,117,0,0,0,1,8,58,98,118,101,99,51,0,18,118,0,59, -120,0,18,117,0,59,120,0,41,0,18,118,0,59,121,0,18,117,0,59,121,0,41,0,18,118,0,59,122,0,18,117,0, -59,122,0,41,0,0,0,0,1,0,4,0,103,114,101,97,116,101,114,84,104,97,110,0,1,0,0,12,118,0,0,1,0,0,12, -117,0,0,0,1,8,58,98,118,101,99,52,0,18,118,0,59,120,0,18,117,0,59,120,0,41,0,18,118,0,59,121,0,18, -117,0,59,121,0,41,0,18,118,0,59,122,0,18,117,0,59,122,0,41,0,18,118,0,59,119,0,18,117,0,59,119,0, -41,0,0,0,0,1,0,2,0,103,114,101,97,116,101,114,84,104,97,110,0,1,0,0,6,118,0,0,1,0,0,6,117,0,0,0,1, -8,58,98,118,101,99,50,0,18,118,0,59,120,0,18,117,0,59,120,0,41,0,18,118,0,59,121,0,18,117,0,59,121, -0,41,0,0,0,0,1,0,3,0,103,114,101,97,116,101,114,84,104,97,110,0,1,0,0,7,118,0,0,1,0,0,7,117,0,0,0, -1,8,58,98,118,101,99,51,0,18,118,0,59,120,0,18,117,0,59,120,0,41,0,18,118,0,59,121,0,18,117,0,59, -121,0,41,0,18,118,0,59,122,0,18,117,0,59,122,0,41,0,0,0,0,1,0,4,0,103,114,101,97,116,101,114,84, -104,97,110,0,1,0,0,8,118,0,0,1,0,0,8,117,0,0,0,1,8,58,98,118,101,99,52,0,18,118,0,59,120,0,18,117, -0,59,120,0,41,0,18,118,0,59,121,0,18,117,0,59,121,0,41,0,18,118,0,59,122,0,18,117,0,59,122,0,41,0, -18,118,0,59,119,0,18,117,0,59,119,0,41,0,0,0,0,1,0,2,0,103,114,101,97,116,101,114,84,104,97,110,69, -113,117,97,108,0,1,0,0,10,118,0,0,1,0,0,10,117,0,0,0,1,8,58,98,118,101,99,50,0,18,118,0,59,120,0, -18,117,0,59,120,0,43,0,18,118,0,59,121,0,18,117,0,59,121,0,43,0,0,0,0,1,0,3,0,103,114,101,97,116, -101,114,84,104,97,110,69,113,117,97,108,0,1,0,0,11,118,0,0,1,0,0,11,117,0,0,0,1,8,58,98,118,101,99, -51,0,18,118,0,59,120,0,18,117,0,59,120,0,43,0,18,118,0,59,121,0,18,117,0,59,121,0,43,0,18,118,0,59, -122,0,18,117,0,59,122,0,43,0,0,0,0,1,0,4,0,103,114,101,97,116,101,114,84,104,97,110,69,113,117,97, -108,0,1,0,0,12,118,0,0,1,0,0,12,117,0,0,0,1,8,58,98,118,101,99,52,0,18,118,0,59,120,0,18,117,0,59, -120,0,43,0,18,118,0,59,121,0,18,117,0,59,121,0,43,0,18,118,0,59,122,0,18,117,0,59,122,0,43,0,18, -118,0,59,119,0,18,117,0,59,119,0,43,0,0,0,0,1,0,2,0,103,114,101,97,116,101,114,84,104,97,110,69, -113,117,97,108,0,1,0,0,6,118,0,0,1,0,0,6,117,0,0,0,1,8,58,98,118,101,99,50,0,18,118,0,59,120,0,18, -117,0,59,120,0,43,0,18,118,0,59,121,0,18,117,0,59,121,0,43,0,0,0,0,1,0,3,0,103,114,101,97,116,101, -114,84,104,97,110,69,113,117,97,108,0,1,0,0,7,118,0,0,1,0,0,7,117,0,0,0,1,8,58,98,118,101,99,51,0, -18,118,0,59,120,0,18,117,0,59,120,0,43,0,18,118,0,59,121,0,18,117,0,59,121,0,43,0,18,118,0,59,122, -0,18,117,0,59,122,0,43,0,0,0,0,1,0,4,0,103,114,101,97,116,101,114,84,104,97,110,69,113,117,97,108, -0,1,0,0,8,118,0,0,1,0,0,8,117,0,0,0,1,8,58,98,118,101,99,52,0,18,118,0,59,120,0,18,117,0,59,120,0, -43,0,18,118,0,59,121,0,18,117,0,59,121,0,43,0,18,118,0,59,122,0,18,117,0,59,122,0,43,0,18,118,0,59, -119,0,18,117,0,59,119,0,43,0,0,0,0,1,0,2,0,101,113,117,97,108,0,1,0,0,10,118,0,0,1,0,0,10,117,0,0, -0,1,8,58,98,118,101,99,50,0,18,118,0,59,120,0,18,117,0,59,120,0,38,0,18,118,0,59,121,0,18,117,0,59, -121,0,38,0,0,0,0,1,0,3,0,101,113,117,97,108,0,1,0,0,11,118,0,0,1,0,0,11,117,0,0,0,1,8,58,98,118, -101,99,51,0,18,118,0,59,120,0,18,117,0,59,120,0,38,0,18,118,0,59,121,0,18,117,0,59,121,0,38,0,18, -118,0,59,122,0,18,117,0,59,122,0,38,0,0,0,0,1,0,4,0,101,113,117,97,108,0,1,0,0,12,118,0,0,1,0,0,12, -117,0,0,0,1,8,58,98,118,101,99,52,0,18,118,0,59,120,0,18,117,0,59,120,0,38,0,18,118,0,59,121,0,18, -117,0,59,121,0,38,0,18,118,0,59,122,0,18,117,0,59,122,0,38,0,18,118,0,59,119,0,18,117,0,59,119,0, -38,0,0,0,0,1,0,2,0,101,113,117,97,108,0,1,0,0,6,118,0,0,1,0,0,6,117,0,0,0,1,8,58,98,118,101,99,50, -0,18,118,0,59,120,0,18,117,0,59,120,0,38,0,18,118,0,59,121,0,18,117,0,59,121,0,38,0,0,0,0,1,0,3,0, -101,113,117,97,108,0,1,0,0,7,118,0,0,1,0,0,7,117,0,0,0,1,8,58,98,118,101,99,51,0,18,118,0,59,120,0, -18,117,0,59,120,0,38,0,18,118,0,59,121,0,18,117,0,59,121,0,38,0,18,118,0,59,122,0,18,117,0,59,122, -0,38,0,0,0,0,1,0,4,0,101,113,117,97,108,0,1,0,0,8,118,0,0,1,0,0,8,117,0,0,0,1,8,58,98,118,101,99, -52,0,18,118,0,59,120,0,18,117,0,59,120,0,38,0,18,118,0,59,121,0,18,117,0,59,121,0,38,0,18,118,0,59, -122,0,18,117,0,59,122,0,38,0,18,118,0,59,119,0,18,117,0,59,119,0,38,0,0,0,0,1,0,2,0,110,111,116,69, -113,117,97,108,0,1,0,0,10,118,0,0,1,0,0,10,117,0,0,0,1,8,58,98,118,101,99,50,0,18,118,0,59,120,0, -18,117,0,59,120,0,39,0,18,118,0,59,121,0,18,117,0,59,121,0,39,0,0,0,0,1,0,3,0,110,111,116,69,113, -117,97,108,0,1,0,0,11,118,0,0,1,0,0,11,117,0,0,0,1,8,58,98,118,101,99,51,0,18,118,0,59,120,0,18, -117,0,59,120,0,39,0,18,118,0,59,121,0,18,117,0,59,121,0,39,0,18,118,0,59,122,0,18,117,0,59,122,0, -39,0,0,0,0,1,0,4,0,110,111,116,69,113,117,97,108,0,1,0,0,12,118,0,0,1,0,0,12,117,0,0,0,1,8,58,98, -118,101,99,52,0,18,118,0,59,120,0,18,117,0,59,120,0,39,0,18,118,0,59,121,0,18,117,0,59,121,0,39,0, -18,118,0,59,122,0,18,117,0,59,122,0,39,0,18,118,0,59,119,0,18,117,0,59,119,0,39,0,0,0,0,1,0,2,0, -110,111,116,69,113,117,97,108,0,1,0,0,6,118,0,0,1,0,0,6,117,0,0,0,1,8,58,98,118,101,99,50,0,18,118, -0,59,120,0,18,117,0,59,120,0,39,0,18,118,0,59,121,0,18,117,0,59,121,0,39,0,0,0,0,1,0,3,0,110,111, -116,69,113,117,97,108,0,1,0,0,7,118,0,0,1,0,0,7,117,0,0,0,1,8,58,98,118,101,99,51,0,18,118,0,59, -120,0,18,117,0,59,120,0,39,0,18,118,0,59,121,0,18,117,0,59,121,0,39,0,18,118,0,59,122,0,18,117,0, -59,122,0,39,0,0,0,0,1,0,4,0,110,111,116,69,113,117,97,108,0,1,0,0,8,118,0,0,1,0,0,8,117,0,0,0,1,8, -58,98,118,101,99,52,0,18,118,0,59,120,0,18,117,0,59,120,0,39,0,18,118,0,59,121,0,18,117,0,59,121,0, -39,0,18,118,0,59,122,0,18,117,0,59,122,0,39,0,18,118,0,59,119,0,18,117,0,59,119,0,39,0,0,0,0,1,0,1, -0,97,110,121,0,1,0,0,2,118,0,0,0,1,8,18,118,0,59,120,0,18,118,0,59,121,0,32,0,0,1,0,1,0,97,110,121, -0,1,0,0,3,118,0,0,0,1,8,18,118,0,59,120,0,18,118,0,59,121,0,32,18,118,0,59,122,0,32,0,0,1,0,1,0,97, -110,121,0,1,0,0,4,118,0,0,0,1,8,18,118,0,59,120,0,18,118,0,59,121,0,32,18,118,0,59,122,0,32,18,118, -0,59,119,0,32,0,0,1,0,1,0,97,108,108,0,1,0,0,2,118,0,0,0,1,8,18,118,0,59,120,0,18,118,0,59,121,0, -34,0,0,1,0,1,0,97,108,108,0,1,0,0,3,118,0,0,0,1,8,18,118,0,59,120,0,18,118,0,59,121,0,34,18,118,0, -59,122,0,34,0,0,1,0,1,0,97,108,108,0,1,0,0,4,118,0,0,0,1,8,18,118,0,59,120,0,18,118,0,59,121,0,34, -18,118,0,59,122,0,34,18,118,0,59,119,0,34,0,0,1,0,2,0,110,111,116,0,1,0,0,2,118,0,0,0,1,8,58,98, -118,101,99,50,0,18,118,0,59,120,0,56,0,18,118,0,59,121,0,56,0,0,0,0,1,0,3,0,110,111,116,0,1,0,0,3, -118,0,0,0,1,8,58,98,118,101,99,51,0,18,118,0,59,120,0,56,0,18,118,0,59,121,0,56,0,18,118,0,59,122, -0,56,0,0,0,0,1,0,4,0,110,111,116,0,1,0,0,4,118,0,0,0,1,8,58,98,118,101,99,52,0,18,118,0,59,120,0, -56,0,18,118,0,59,121,0,56,0,18,118,0,59,122,0,56,0,18,118,0,59,119,0,56,0,0,0,0,1,0,12,0,116,101, -120,116,117,114,101,49,68,0,1,0,0,16,115,97,109,112,108,101,114,0,0,1,0,0,9,99,111,111,114,100,0,0, -0,1,3,2,0,12,1,116,101,120,101,108,0,0,0,4,118,101,99,52,95,116,101,120,49,100,0,18,116,101,120, -101,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,0,17,48,0,48,0,0,0,0,8,18, -116,101,120,101,108,0,0,0,1,0,12,0,116,101,120,116,117,114,101,49,68,80,114,111,106,0,1,0,0,16,115, -97,109,112,108,101,114,0,0,1,0,0,10,99,111,111,114,100,0,0,0,1,8,58,116,101,120,116,117,114,101,49, -68,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59, -116,0,49,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,49,68,80,114,111,106,0,1,0,0,16,115,97,109, -112,108,101,114,0,0,1,0,0,12,99,111,111,114,100,0,0,0,1,8,58,116,101,120,116,117,114,101,49,68,0, -18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,113, -0,49,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,50,68,0,1,0,0,17,115,97,109,112,108,101,114,0,0, -1,0,0,10,99,111,111,114,100,0,0,0,1,3,2,0,12,1,116,101,120,101,108,0,0,0,4,118,101,99,52,95,116, -101,120,50,100,0,18,116,101,120,101,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114, -100,0,0,17,48,0,48,0,0,0,0,8,18,116,101,120,101,108,0,0,0,1,0,12,0,116,101,120,116,117,114,101,50, -68,80,114,111,106,0,1,0,0,17,115,97,109,112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,0,1,8, -58,116,101,120,116,117,114,101,50,68,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,50,0,18,99, -111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,112,0,49,0,18,99,111,111,114,100,0,59,116,0, -18,99,111,111,114,100,0,59,112,0,49,0,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,50,68,80,114, -111,106,0,1,0,0,17,115,97,109,112,108,101,114,0,0,1,0,0,12,99,111,111,114,100,0,0,0,1,8,58,116,101, -120,116,117,114,101,50,68,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,50,0,18,99,111,111,114, -100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114,100,0,59,116,0,18,99,111, -111,114,100,0,59,113,0,49,0,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,51,68,0,1,0,0,18,115,97, -109,112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,0,1,3,2,0,12,1,116,101,120,101,108,0,0,0,4, -118,101,99,52,95,116,101,120,51,100,0,18,116,101,120,101,108,0,0,18,115,97,109,112,108,101,114,0,0, -18,99,111,111,114,100,0,0,17,48,0,48,0,0,0,0,8,18,116,101,120,101,108,0,0,0,1,0,12,0,116,101,120, -116,117,114,101,51,68,80,114,111,106,0,1,0,0,18,115,97,109,112,108,101,114,0,0,1,0,0,12,99,111,111, -114,100,0,0,0,1,8,58,116,101,120,116,117,114,101,51,68,0,18,115,97,109,112,108,101,114,0,0,58,118, -101,99,51,0,18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111, -114,100,0,59,116,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114,100,0,59,112,0,18,99, -111,111,114,100,0,59,113,0,49,0,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,67,117,98,101,0,1,0, -0,19,115,97,109,112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,0,1,3,2,0,12,1,116,101,120,101, -108,0,0,0,4,118,101,99,52,95,116,101,120,99,117,98,101,0,18,116,101,120,101,108,0,0,18,115,97,109, -112,108,101,114,0,0,18,99,111,111,114,100,0,0,17,48,0,48,0,0,0,0,8,18,116,101,120,101,108,0,0,0,1, -0,12,0,115,104,97,100,111,119,49,68,0,1,0,0,20,115,97,109,112,108,101,114,0,0,1,0,0,11,99,111,111, -114,100,0,0,0,1,3,2,0,12,1,116,101,120,101,108,0,0,0,4,118,101,99,52,95,115,104,97,100,49,100,0,18, -116,101,120,101,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,0,17,48,0,48,0,0, -0,0,8,18,116,101,120,101,108,0,0,0,1,0,12,0,115,104,97,100,111,119,49,68,80,114,111,106,0,1,0,0,20, -115,97,109,112,108,101,114,0,0,1,0,0,12,99,111,111,114,100,0,0,0,1,8,58,115,104,97,100,111,119,49, -68,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,51,0,18,99,111,111,114,100,0,59,115,0,18,99, -111,111,114,100,0,59,113,0,49,0,17,48,0,48,0,0,0,18,99,111,111,114,100,0,59,112,0,18,99,111,111, -114,100,0,59,113,0,49,0,0,0,0,0,0,1,0,12,0,115,104,97,100,111,119,50,68,0,1,0,0,21,115,97,109,112, -108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,0,1,3,2,0,12,1,116,101,120,101,108,0,0,0,4,118,101, -99,52,95,115,104,97,100,50,100,0,18,116,101,120,101,108,0,0,18,115,97,109,112,108,101,114,0,0,18, -99,111,111,114,100,0,0,17,48,0,48,0,0,0,0,8,18,116,101,120,101,108,0,0,0,1,0,12,0,115,104,97,100, -111,119,50,68,80,114,111,106,0,1,0,0,21,115,97,109,112,108,101,114,0,0,1,0,0,12,99,111,111,114,100, -0,0,0,1,8,58,115,104,97,100,111,119,50,68,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,51,0, -18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114,100,0,59, -116,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114,100,0,59,112,0,18,99,111,111,114,100, -0,59,113,0,49,0,0,0,0,0,0,1,0,9,0,110,111,105,115,101,49,0,1,0,0,9,120,0,0,0,1,3,2,0,9,1,97,0,0,0, -4,102,108,111,97,116,95,110,111,105,115,101,49,0,18,97,0,0,18,120,0,0,0,8,18,97,0,0,0,1,0,9,0,110, -111,105,115,101,49,0,1,0,0,10,120,0,0,0,1,3,2,0,9,1,97,0,0,0,4,102,108,111,97,116,95,110,111,105, -115,101,50,0,18,97,0,0,18,120,0,0,0,8,18,97,0,0,0,1,0,9,0,110,111,105,115,101,49,0,1,0,0,11,120,0, -0,0,1,3,2,0,9,1,97,0,0,0,4,102,108,111,97,116,95,110,111,105,115,101,51,0,18,97,0,0,18,120,0,0,0,8, -18,97,0,0,0,1,0,9,0,110,111,105,115,101,49,0,1,0,0,12,120,0,0,0,1,3,2,0,9,1,97,0,0,0,4,102,108,111, -97,116,95,110,111,105,115,101,52,0,18,97,0,0,18,120,0,0,0,8,18,97,0,0,0,1,0,10,0,110,111,105,115, -101,50,0,1,0,0,9,120,0,0,0,1,8,58,118,101,99,50,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58, -110,111,105,115,101,49,0,18,120,0,17,49,57,0,51,52,0,0,46,0,0,0,0,0,0,1,0,10,0,110,111,105,115,101, -50,0,1,0,0,10,120,0,0,0,1,8,58,118,101,99,50,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110, -111,105,115,101,49,0,18,120,0,58,118,101,99,50,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,0,46,0, -0,0,0,0,0,1,0,10,0,110,111,105,115,101,50,0,1,0,0,11,120,0,0,0,1,8,58,118,101,99,50,0,58,110,111, -105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,49,57,0, -51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,0,46,0,0,0,0,0,0,1,0,10,0,110,111,105,115,101, -50,0,1,0,0,12,120,0,0,0,1,8,58,118,101,99,50,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110, -111,105,115,101,49,0,18,120,0,58,118,101,99,52,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51, -0,50,51,0,0,0,17,50,0,55,55,0,0,0,0,46,0,0,0,0,0,0,1,0,11,0,110,111,105,115,101,51,0,1,0,0,9,120,0, -0,0,1,8,58,118,101,99,51,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0, -18,120,0,17,49,57,0,51,52,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,17,53,0,52,55,0,0,46,0, -0,0,0,0,0,1,0,11,0,110,111,105,115,101,51,0,1,0,0,10,120,0,0,0,1,8,58,118,101,99,51,0,58,110,111, -105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,50,0,17,49,57,0, -51,52,0,0,0,17,55,0,54,54,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,50,0, -17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,0,46,0,0,0,0,0,0,1,0,11,0,110,111,105,115,101,51,0,1,0, -0,11,120,0,0,0,1,8,58,118,101,99,51,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105, -115,101,49,0,18,120,0,58,118,101,99,51,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51, -0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,53,0,52,55,0,0,0,17,49, -55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,0,0,46,0,0,0,0,0,0,1,0,11,0,110,111,105,115,101,51,0,1,0,0, -12,120,0,0,0,1,8,58,118,101,99,51,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115, -101,49,0,18,120,0,58,118,101,99,52,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0, -0,17,50,0,55,55,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,52,0,17,53,0, -52,55,0,0,0,17,49,55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,0,17,49,51,0,49,57,0,0,0,0,46,0,0,0,0,0,0, -1,0,12,0,110,111,105,115,101,52,0,1,0,0,9,120,0,0,0,1,8,58,118,101,99,52,0,58,110,111,105,115,101, -49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,17,49,57,0,51,52,0,0,46,0,0,0,58,110,111, -105,115,101,49,0,18,120,0,17,53,0,52,55,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,17,50,51, -0,53,52,0,0,46,0,0,0,0,0,0,1,0,12,0,110,111,105,115,101,52,0,1,0,0,10,120,0,0,0,1,8,58,118,101,99, -52,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99, -50,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58, -118,101,99,50,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0, -18,120,0,58,118,101,99,50,0,17,50,51,0,53,52,0,0,0,17,50,57,0,49,49,0,0,0,0,46,0,0,0,0,0,0,1,0,12, -0,110,111,105,115,101,52,0,1,0,0,11,120,0,0,0,1,8,58,118,101,99,52,0,58,110,111,105,115,101,49,0, -18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,49,57,0,51,52,0,0,0,17, -55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99, -51,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,0,0,46,0,0,0,58,110,111,105, -115,101,49,0,18,120,0,58,118,101,99,51,0,17,50,51,0,53,52,0,0,0,17,50,57,0,49,49,0,0,0,17,51,49,0, -57,49,0,0,0,0,46,0,0,0,0,0,0,1,0,12,0,110,111,105,115,101,52,0,1,0,0,12,120,0,0,0,1,8,58,118,101, -99,52,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101, -99,52,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,17,50,0,55,55,0,0,0,0,46,0, -0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,52,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0, -0,0,17,49,49,0,48,52,0,0,0,17,49,51,0,49,57,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0, -58,118,101,99,52,0,17,50,51,0,53,52,0,0,0,17,50,57,0,49,49,0,0,0,17,51,49,0,57,49,0,0,0,17,51,55,0, -52,56,0,0,0,0,46,0,0,0,0,0,0,0 +1,0,13,0,109,97,116,114,105,120,67,111,109,112,77,117,108,116,0,1,0,0,13,109,0,0,1,0,0,13,110,0,0, +0,1,8,58,109,97,116,50,0,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,48,0,18,109,0,16,10,49,0,57, +18,110,0,16,10,49,0,57,48,0,0,0,0,1,0,14,0,109,97,116,114,105,120,67,111,109,112,77,117,108,116,0, +1,0,0,14,109,0,0,1,0,0,14,110,0,0,0,1,8,58,109,97,116,51,0,18,109,0,16,8,48,0,57,18,110,0,16,8,48, +0,57,48,0,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,48,0,18,109,0,16,10,50,0,57,18,110,0,16,10, +50,0,57,48,0,0,0,0,1,0,15,0,109,97,116,114,105,120,67,111,109,112,77,117,108,116,0,1,0,0,15,109,0, +0,1,0,0,15,110,0,0,0,1,8,58,109,97,116,52,0,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,48,0,18, +109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,48,0,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,48,0, +18,109,0,16,10,51,0,57,18,110,0,16,10,51,0,57,48,0,0,0,0,1,0,2,0,108,101,115,115,84,104,97,110,0,1, +1,0,10,117,0,0,1,1,0,10,118,0,0,0,1,4,118,101,99,52,95,115,108,116,0,18,95,95,114,101,116,86,97, +108,0,59,120,121,0,0,18,117,0,0,18,118,0,0,0,0,1,0,3,0,108,101,115,115,84,104,97,110,0,1,1,0,11, +117,0,0,1,1,0,11,118,0,0,0,1,4,118,101,99,52,95,115,108,116,0,18,95,95,114,101,116,86,97,108,0,59, +120,121,122,0,0,18,117,0,0,18,118,0,0,0,0,1,0,4,0,108,101,115,115,84,104,97,110,0,1,1,0,12,117,0,0, +1,1,0,12,118,0,0,0,1,4,118,101,99,52,95,115,108,116,0,18,95,95,114,101,116,86,97,108,0,0,18,117,0, +0,18,118,0,0,0,0,1,0,2,0,108,101,115,115,84,104,97,110,0,1,1,0,6,117,0,0,1,1,0,6,118,0,0,0,1,4,118, +101,99,52,95,115,108,116,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,117,0,0,18,118,0,0,0, +0,1,0,3,0,108,101,115,115,84,104,97,110,0,1,1,0,7,117,0,0,1,1,0,7,118,0,0,0,1,4,118,101,99,52,95, +115,108,116,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,117,0,0,18,118,0,0,0,0,1,0,4, +0,108,101,115,115,84,104,97,110,0,1,1,0,8,117,0,0,1,1,0,8,118,0,0,0,1,4,118,101,99,52,95,115,108, +116,0,18,95,95,114,101,116,86,97,108,0,0,18,117,0,0,18,118,0,0,0,0,1,0,2,0,108,101,115,115,84,104, +97,110,69,113,117,97,108,0,1,1,0,10,117,0,0,1,1,0,10,118,0,0,0,1,4,118,101,99,52,95,115,108,101,0, +18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,117,0,0,18,118,0,0,0,0,1,0,3,0,108,101,115,115, +84,104,97,110,69,113,117,97,108,0,1,1,0,11,117,0,0,1,1,0,11,118,0,0,0,1,4,118,101,99,52,95,115,108, +101,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,117,0,0,18,118,0,0,0,0,1,0,4,0,108, +101,115,115,84,104,97,110,69,113,117,97,108,0,1,1,0,12,117,0,0,1,1,0,12,118,0,0,0,1,4,118,101,99, +52,95,115,108,101,0,18,95,95,114,101,116,86,97,108,0,0,18,117,0,0,18,118,0,0,0,0,1,0,2,0,108,101, +115,115,84,104,97,110,69,113,117,97,108,0,1,1,0,6,117,0,0,1,1,0,6,118,0,0,0,1,4,118,101,99,52,95, +115,108,101,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,117,0,0,18,118,0,0,0,0,1,0,3,0, +108,101,115,115,84,104,97,110,69,113,117,97,108,0,1,1,0,7,117,0,0,1,1,0,7,118,0,0,0,1,4,118,101,99, +52,95,115,108,101,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,117,0,0,18,118,0,0,0,0, +1,0,4,0,108,101,115,115,84,104,97,110,69,113,117,97,108,0,1,1,0,8,117,0,0,1,1,0,8,118,0,0,0,1,4, +118,101,99,52,95,115,108,101,0,18,95,95,114,101,116,86,97,108,0,0,18,117,0,0,18,118,0,0,0,0,1,0,2, +0,103,114,101,97,116,101,114,84,104,97,110,0,1,1,0,10,117,0,0,1,1,0,10,118,0,0,0,1,4,118,101,99,52, +95,115,103,116,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,117,0,0,18,118,0,0,0,0,1,0,3,0, +103,114,101,97,116,101,114,84,104,97,110,0,1,1,0,11,117,0,0,1,1,0,11,118,0,0,0,1,4,118,101,99,52, +95,115,103,116,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,117,0,0,18,118,0,0,0,0,1,0, +4,0,103,114,101,97,116,101,114,84,104,97,110,0,1,1,0,12,117,0,0,1,1,0,12,118,0,0,0,1,4,118,101,99, +52,95,115,103,116,0,18,95,95,114,101,116,86,97,108,0,0,18,117,0,0,18,118,0,0,0,0,1,0,2,0,103,114, +101,97,116,101,114,84,104,97,110,0,1,1,0,6,117,0,0,1,1,0,6,118,0,0,0,1,4,118,101,99,52,95,115,103, +116,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,117,0,0,18,118,0,0,0,0,1,0,3,0,103,114, +101,97,116,101,114,84,104,97,110,0,1,1,0,7,117,0,0,1,1,0,7,118,0,0,0,1,4,118,101,99,52,95,115,103, +116,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,117,0,0,18,118,0,0,0,0,1,0,4,0,103, +114,101,97,116,101,114,84,104,97,110,0,1,1,0,8,117,0,0,1,1,0,8,118,0,0,0,1,4,118,101,99,52,95,115, +103,116,0,18,95,95,114,101,116,86,97,108,0,0,18,117,0,0,18,118,0,0,0,0,1,0,2,0,103,114,101,97,116, +101,114,84,104,97,110,69,113,117,97,108,0,1,1,0,10,117,0,0,1,1,0,10,118,0,0,0,1,4,118,101,99,52,95, +115,103,101,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,117,0,0,18,118,0,0,0,0,1,0,3,0, +103,114,101,97,116,101,114,84,104,97,110,69,113,117,97,108,0,1,1,0,11,117,0,0,1,1,0,11,118,0,0,0,1, +4,118,101,99,52,95,115,103,101,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,117,0,0,18, +118,0,0,0,0,1,0,4,0,103,114,101,97,116,101,114,84,104,97,110,69,113,117,97,108,0,1,1,0,12,117,0,0, +1,1,0,12,118,0,0,0,1,4,118,101,99,52,95,115,103,101,0,18,95,95,114,101,116,86,97,108,0,0,18,117,0, +0,18,118,0,0,0,0,1,0,2,0,103,114,101,97,116,101,114,84,104,97,110,69,113,117,97,108,0,1,1,0,6,117, +0,0,1,1,0,6,118,0,0,0,1,4,118,101,99,52,95,115,103,101,0,18,95,95,114,101,116,86,97,108,0,59,120, +121,0,0,18,117,0,0,18,118,0,0,0,0,1,0,3,0,103,114,101,97,116,101,114,84,104,97,110,69,113,117,97, +108,0,1,1,0,7,117,0,0,1,1,0,7,118,0,0,0,1,4,118,101,99,52,95,115,103,101,0,18,95,95,114,101,116,86, +97,108,0,59,120,121,122,0,0,18,117,0,0,18,118,0,0,0,0,1,0,4,0,103,114,101,97,116,101,114,84,104,97, +110,69,113,117,97,108,0,1,1,0,8,117,0,0,1,1,0,8,118,0,0,0,1,4,118,101,99,52,95,115,103,101,0,18,95, +95,114,101,116,86,97,108,0,0,18,117,0,0,18,118,0,0,0,0,1,0,2,0,101,113,117,97,108,0,1,1,0,10,117,0, +0,1,1,0,10,118,0,0,0,1,4,118,101,99,52,95,115,101,113,0,18,95,95,114,101,116,86,97,108,0,59,120, +121,0,0,18,117,0,0,18,118,0,0,0,0,1,0,3,0,101,113,117,97,108,0,1,1,0,11,117,0,0,1,1,0,11,118,0,0,0, +1,4,118,101,99,52,95,115,101,113,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,117,0,0, +18,118,0,0,0,0,1,0,4,0,101,113,117,97,108,0,1,1,0,12,117,0,0,1,1,0,12,118,0,0,0,1,4,118,101,99,52, +95,115,101,113,0,18,95,95,114,101,116,86,97,108,0,0,18,117,0,0,18,118,0,0,0,0,1,0,2,0,101,113,117, +97,108,0,1,1,0,6,117,0,0,1,1,0,6,118,0,0,0,1,4,118,101,99,52,95,115,101,113,0,18,95,95,114,101,116, +86,97,108,0,59,120,121,0,0,18,117,0,0,18,118,0,0,0,0,1,0,3,0,101,113,117,97,108,0,1,1,0,7,117,0,0, +1,1,0,7,118,0,0,0,1,4,118,101,99,52,95,115,101,113,0,18,95,95,114,101,116,86,97,108,0,59,120,121, +122,0,0,18,117,0,0,18,118,0,0,0,0,1,0,4,0,101,113,117,97,108,0,1,1,0,8,117,0,0,1,1,0,8,118,0,0,0,1, +4,118,101,99,52,95,115,101,113,0,18,95,95,114,101,116,86,97,108,0,0,18,117,0,0,18,118,0,0,0,0,1,0, +2,0,110,111,116,69,113,117,97,108,0,1,1,0,10,117,0,0,1,1,0,10,118,0,0,0,1,4,118,101,99,52,95,115, +110,101,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,117,0,0,18,118,0,0,0,0,1,0,3,0,110, +111,116,69,113,117,97,108,0,1,1,0,11,117,0,0,1,1,0,11,118,0,0,0,1,4,118,101,99,52,95,115,110,101,0, +18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,117,0,0,18,118,0,0,0,0,1,0,4,0,110,111,116, +69,113,117,97,108,0,1,1,0,12,117,0,0,1,1,0,12,118,0,0,0,1,4,118,101,99,52,95,115,110,101,0,18,95, +95,114,101,116,86,97,108,0,0,18,117,0,0,18,118,0,0,0,0,1,0,2,0,110,111,116,69,113,117,97,108,0,1,1, +0,6,117,0,0,1,1,0,6,118,0,0,0,1,4,118,101,99,52,95,115,110,101,0,18,95,95,114,101,116,86,97,108,0, +59,120,121,0,0,18,117,0,0,18,118,0,0,0,0,1,0,3,0,110,111,116,69,113,117,97,108,0,1,1,0,7,117,0,0,1, +1,0,7,118,0,0,0,1,4,118,101,99,52,95,115,110,101,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122, +0,0,18,117,0,0,18,118,0,0,0,0,1,0,4,0,110,111,116,69,113,117,97,108,0,1,1,0,8,117,0,0,1,1,0,8,118, +0,0,0,1,4,118,101,99,52,95,115,110,101,0,18,95,95,114,101,116,86,97,108,0,0,18,117,0,0,18,118,0,0, +0,0,1,0,1,0,97,110,121,0,1,1,0,2,118,0,0,0,1,3,2,0,9,1,115,117,109,0,0,0,4,118,101,99,52,95,97,100, +100,0,18,115,117,109,0,59,120,0,0,18,118,0,59,120,0,0,18,118,0,59,121,0,0,0,4,118,101,99,52,95,115, +110,101,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,115,117,109,0,59,120,0,0,17,48,0,48,0,0,0, +0,0,1,0,1,0,97,110,121,0,1,1,0,3,118,0,0,0,1,3,2,0,9,1,115,117,109,0,0,0,4,118,101,99,52,95,97,100, +100,0,18,115,117,109,0,59,120,0,0,18,118,0,59,120,0,0,18,118,0,59,121,0,0,0,4,118,101,99,52,95,97, +100,100,0,18,115,117,109,0,59,120,0,0,18,115,117,109,0,59,120,0,0,18,118,0,59,122,0,0,0,4,118,101, +99,52,95,115,110,101,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,115,117,109,0,59,120,0,0,17, +48,0,48,0,0,0,0,0,1,0,1,0,97,110,121,0,1,1,0,4,118,0,0,0,1,3,2,0,9,1,115,117,109,0,0,0,4,118,101, +99,52,95,97,100,100,0,18,115,117,109,0,59,120,0,0,18,118,0,59,120,0,0,18,118,0,59,121,0,0,0,4,118, +101,99,52,95,97,100,100,0,18,115,117,109,0,59,120,0,0,18,115,117,109,0,59,120,0,0,18,118,0,59,122, +0,0,0,4,118,101,99,52,95,97,100,100,0,18,115,117,109,0,59,120,0,0,18,115,117,109,0,59,120,0,0,18, +118,0,59,119,0,0,0,4,118,101,99,52,95,115,110,101,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18, +115,117,109,0,59,120,0,0,17,48,0,48,0,0,0,0,0,1,0,1,0,97,108,108,0,1,1,0,10,118,0,0,0,1,3,2,0,9,1, +112,114,111,100,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,112,114,111,100,0,59, +120,0,0,18,118,0,59,120,0,0,18,118,0,59,121,0,0,0,4,118,101,99,52,95,115,110,101,0,18,95,95,114, +101,116,86,97,108,0,59,120,0,0,18,112,114,111,100,0,59,120,0,0,17,48,0,48,0,0,0,0,8,18,118,0,59, +120,0,18,118,0,59,121,0,34,0,0,1,0,1,0,97,108,108,0,1,1,0,3,118,0,0,0,1,3,2,0,9,1,112,114,111,100, +0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,112,114,111,100,0,59,120,0,0,18,118, +0,59,120,0,0,18,118,0,59,121,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,112,114, +111,100,0,59,120,0,0,18,112,114,111,100,0,59,120,0,0,18,118,0,59,122,0,0,0,4,118,101,99,52,95,115, +110,101,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,112,114,111,100,0,59,120,0,0,17,48,0,48,0, +0,0,0,0,1,0,1,0,97,108,108,0,1,1,0,4,118,0,0,0,1,3,2,0,9,1,112,114,111,100,0,0,0,4,118,101,99,52, +95,109,117,108,116,105,112,108,121,0,18,112,114,111,100,0,59,120,0,0,18,118,0,59,120,0,0,18,118,0, +59,121,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,112,114,111,100,0,59,120,0,0, +18,112,114,111,100,0,59,120,0,0,18,118,0,59,122,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112, +108,121,0,18,112,114,111,100,0,59,120,0,0,18,112,114,111,100,0,59,120,0,0,18,118,0,59,119,0,0,0,4, +118,101,99,52,95,115,110,101,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,112,114,111,100,0,59, +120,0,0,17,48,0,48,0,0,0,0,0,1,0,2,0,110,111,116,0,1,1,0,2,118,0,0,0,1,4,118,101,99,52,95,115,101, +113,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,118,0,0,17,48,0,48,0,0,0,0,0,1,0,3,0,110, +111,116,0,1,1,0,3,118,0,0,0,1,4,118,101,99,52,95,115,101,113,0,18,95,95,114,101,116,86,97,108,0,59, +120,121,122,0,0,18,118,0,0,17,48,0,48,0,0,0,0,0,1,0,4,0,110,111,116,0,1,1,0,4,118,0,0,0,1,4,118, +101,99,52,95,115,101,113,0,18,95,95,114,101,116,86,97,108,0,0,18,118,0,0,17,48,0,48,0,0,0,0,0,1,0, +12,0,116,101,120,116,117,114,101,49,68,0,1,1,0,16,115,97,109,112,108,101,114,0,0,1,1,0,9,99,111, +111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,49,100,0,18,95,95,114,101,116,86,97,108,0,0,18, +115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101, +49,68,80,114,111,106,0,1,1,0,16,115,97,109,112,108,101,114,0,0,1,1,0,10,99,111,111,114,100,0,0,0,1, +4,118,101,99,52,95,116,101,120,112,49,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112, +108,101,114,0,0,18,99,111,111,114,100,0,59,120,121,121,121,0,0,0,0,1,0,12,0,116,101,120,116,117, +114,101,49,68,80,114,111,106,0,1,1,0,16,115,97,109,112,108,101,114,0,0,1,1,0,12,99,111,111,114,100, +0,0,0,1,4,118,101,99,52,95,116,101,120,112,49,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97, +109,112,108,101,114,0,0,18,99,111,111,114,100,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,50,68,0, +1,1,0,17,115,97,109,112,108,101,114,0,0,1,1,0,10,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116, +101,120,50,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111, +111,114,100,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,50,68,80,114,111,106,0,1,1,0,17,115,97, +109,112,108,101,114,0,0,1,1,0,11,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,112,50, +100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0, +59,120,121,122,122,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,50,68,80,114,111,106,0,1,1,0,17, +115,97,109,112,108,101,114,0,0,1,1,0,12,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120, +112,50,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111, +114,100,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,51,68,0,1,1,0,18,115,97,109,112,108,101,114,0, +0,1,1,0,11,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,51,100,0,18,95,95,114,101,116, +86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,0,0,0,1,0,12,0,116,101,120, +116,117,114,101,51,68,80,114,111,106,0,1,1,0,18,115,97,109,112,108,101,114,0,0,1,1,0,12,99,111,111, +114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,112,51,100,0,18,95,95,114,101,116,86,97,108,0,0,18, +115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101, +67,117,98,101,0,1,1,0,19,115,97,109,112,108,101,114,0,0,1,1,0,11,99,111,111,114,100,0,0,0,1,4,118, +101,99,52,95,116,101,120,99,117,98,101,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108, +101,114,0,0,18,99,111,111,114,100,0,0,0,0,1,0,12,0,115,104,97,100,111,119,49,68,0,1,1,0,20,115,97, +109,112,108,101,114,0,0,1,1,0,11,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,49,100, +0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,0,0, +0,1,0,12,0,115,104,97,100,111,119,49,68,80,114,111,106,0,1,1,0,20,115,97,109,112,108,101,114,0,0,1, +1,0,12,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,112,49,100,0,18,95,95,114,101,116, +86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,0,0,0,1,0,12,0,115,104,97, +100,111,119,50,68,0,1,1,0,21,115,97,109,112,108,101,114,0,0,1,1,0,11,99,111,111,114,100,0,0,0,1,4, +118,101,99,52,95,116,101,120,50,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101, +114,0,0,18,99,111,111,114,100,0,0,0,0,1,0,12,0,115,104,97,100,111,119,50,68,80,114,111,106,0,1,1,0, +21,115,97,109,112,108,101,114,0,0,1,1,0,12,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101, +120,112,50,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111, +111,114,100,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,50,68,82,101,99,116,0,1,1,0,22,115,97,109, +112,108,101,114,0,0,1,1,0,10,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,95,114,101, +99,116,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114, +100,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,50,68,82,101,99,116,80,114,111,106,0,1,1,0,22,115, +97,109,112,108,101,114,0,0,1,1,0,11,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,112, +95,114,101,99,116,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111, +111,114,100,0,59,120,121,122,122,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,50,68,82,101,99,116, +80,114,111,106,0,1,1,0,22,115,97,109,112,108,101,114,0,0,1,1,0,12,99,111,111,114,100,0,0,0,1,4,118, +101,99,52,95,116,101,120,112,95,114,101,99,116,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109, +112,108,101,114,0,0,18,99,99,111,111,114,100,0,0,0,0,1,0,12,0,115,104,97,100,111,119,50,68,82,101, +99,116,0,1,1,0,23,115,97,109,112,108,101,114,0,0,1,1,0,11,99,111,111,114,100,0,0,0,1,4,118,101,99, +52,95,116,101,120,95,114,101,99,116,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101, +114,0,0,18,99,111,111,114,100,0,0,0,0,1,0,12,0,115,104,97,100,111,119,50,68,82,101,99,116,80,114, +111,106,0,1,1,0,23,115,97,109,112,108,101,114,0,0,1,1,0,12,99,111,111,114,100,0,0,0,1,4,118,101,99, +52,95,116,101,120,112,95,114,101,99,116,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108, +101,114,0,0,18,99,111,111,114,100,0,0,0,0,1,0,9,0,110,111,105,115,101,49,0,1,1,0,9,120,0,0,0,1,4, +102,108,111,97,116,95,110,111,105,115,101,49,0,18,95,95,114,101,116,86,97,108,0,0,18,120,0,0,0,0,1, +0,9,0,110,111,105,115,101,49,0,1,1,0,10,120,0,0,0,1,4,102,108,111,97,116,95,110,111,105,115,101,50, +0,18,95,95,114,101,116,86,97,108,0,0,18,120,0,0,0,0,1,0,9,0,110,111,105,115,101,49,0,1,1,0,11,120, +0,0,0,1,4,102,108,111,97,116,95,110,111,105,115,101,51,0,18,95,95,114,101,116,86,97,108,0,0,18,120, +0,0,0,0,1,0,9,0,110,111,105,115,101,49,0,1,1,0,12,120,0,0,0,1,4,102,108,111,97,116,95,110,111,105, +115,101,52,0,18,95,95,114,101,116,86,97,108,0,0,18,120,0,0,0,0,1,0,10,0,110,111,105,115,101,50,0,1, +1,0,9,120,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,110,111,105,115,101,49,0,18,120,0, +0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,110,111,105,115,101,49,0,18,120,0,17,49,57, +0,51,52,0,0,46,0,0,20,0,0,1,0,10,0,110,111,105,115,101,50,0,1,1,0,10,120,0,0,0,1,9,18,95,95,114, +101,116,86,97,108,0,59,120,0,58,110,111,105,115,101,49,0,18,120,0,0,0,20,0,9,18,95,95,114,101,116, +86,97,108,0,59,121,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,50,0,17,49,57,0,51,52,0,0, +0,17,55,0,54,54,0,0,0,0,46,0,0,20,0,0,1,0,10,0,110,111,105,115,101,50,0,1,1,0,11,120,0,0,0,1,9,18, +95,95,114,101,116,86,97,108,0,59,120,0,58,110,111,105,115,101,49,0,18,120,0,0,0,20,0,9,18,95,95, +114,101,116,86,97,108,0,59,121,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,49,57, +0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,0,46,0,0,20,0,0,1,0,10,0,110,111,105,115,101, +50,0,1,1,0,12,120,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,110,111,105,115,101,49,0, +18,120,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,110,111,105,115,101,49,0,18,120,0, +58,118,101,99,52,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,17,50,0,55,55,0, +0,0,0,46,0,0,20,0,0,1,0,11,0,110,111,105,115,101,51,0,1,1,0,9,120,0,0,0,1,9,18,95,95,114,101,116, +86,97,108,0,59,120,0,58,110,111,105,115,101,49,0,18,120,0,0,0,20,0,9,18,95,95,114,101,116,86,97, +108,0,59,121,0,58,110,111,105,115,101,49,0,18,120,0,17,49,57,0,51,52,0,0,46,0,0,20,0,9,18,95,95, +114,101,116,86,97,108,0,59,122,0,58,110,111,105,115,101,49,0,18,120,0,17,53,0,52,55,0,0,46,0,0,20, +0,0,1,0,11,0,110,111,105,115,101,51,0,1,1,0,10,120,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59, +120,0,58,110,111,105,115,101,49,0,18,120,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,58, +110,111,105,115,101,49,0,18,120,0,58,118,101,99,50,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,0, +46,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,58,110,111,105,115,101,49,0,18,120,0,58, +118,101,99,50,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,0,46,0,0,20,0,0,1,0,11,0,110,111,105, +115,101,51,0,1,1,0,11,120,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,110,111,105,115, +101,49,0,18,120,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,110,111,105,115,101,49,0, +18,120,0,58,118,101,99,51,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,0,46,0, +0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101, +99,51,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,0,0,46,0,0,20,0,0,1,0,11,0, +110,111,105,115,101,51,0,1,1,0,12,120,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,110, +111,105,115,101,49,0,18,120,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,110,111,105, +115,101,49,0,18,120,0,58,118,101,99,52,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51, +0,0,0,17,50,0,55,55,0,0,0,0,46,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,58,110,111,105, +115,101,49,0,18,120,0,58,118,101,99,52,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,17,49,49,0,48, +52,0,0,0,17,49,51,0,49,57,0,0,0,0,46,0,0,20,0,0,1,0,12,0,110,111,105,115,101,52,0,1,1,0,9,120,0,0, +0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,110,111,105,115,101,49,0,18,120,0,0,0,20,0,9,18, +95,95,114,101,116,86,97,108,0,59,121,0,58,110,111,105,115,101,49,0,18,120,0,17,49,57,0,51,52,0,0, +46,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,58,110,111,105,115,101,49,0,18,120,0,17,53, +0,52,55,0,0,46,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,119,0,58,110,111,105,115,101,49,0,18, +120,0,17,50,51,0,53,52,0,0,46,0,0,20,0,0,1,0,12,0,110,111,105,115,101,52,0,1,1,0,10,120,0,0,0,1,9, +18,95,95,114,101,116,86,97,108,0,59,120,0,58,110,111,105,115,101,49,0,18,120,0,0,0,20,0,9,18,95,95, +114,101,116,86,97,108,0,59,121,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,50,0,17,49,57, +0,51,52,0,0,0,17,55,0,54,54,0,0,0,0,46,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,58,110, +111,105,115,101,49,0,18,120,0,58,118,101,99,50,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,0,46,0, +0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,119,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101, +99,50,0,17,50,51,0,53,52,0,0,0,17,50,57,0,49,49,0,0,0,0,46,0,0,20,0,0,1,0,12,0,110,111,105,115,101, +52,0,1,1,0,11,120,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,110,111,105,115,101,49,0, +18,120,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,110,111,105,115,101,49,0,18,120,0, +58,118,101,99,51,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,0,46,0,0,20,0,9, +18,95,95,114,101,116,86,97,108,0,59,122,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,51,0, +17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,0,0,46,0,0,20,0,9,18,95,95,114,101, +116,86,97,108,0,59,119,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,50,51,0,53,52, +0,0,0,17,50,57,0,49,49,0,0,0,17,51,49,0,57,49,0,0,0,0,46,0,0,20,0,0,1,0,12,0,110,111,105,115,101, +52,0,1,1,0,12,120,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,110,111,105,115,101,49,0, +18,120,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,110,111,105,115,101,49,0,18,120,0, +58,118,101,99,52,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,17,50,0,55,55,0, +0,0,0,46,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,58,110,111,105,115,101,49,0,18,120,0, +58,118,101,99,52,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,0,17,49,51,0,49, +57,0,0,0,0,46,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,119,0,58,110,111,105,115,101,49,0,18, +120,0,58,118,101,99,52,0,17,50,51,0,53,52,0,0,0,17,50,57,0,49,49,0,0,0,17,51,49,0,57,49,0,0,0,17, +51,55,0,52,56,0,0,0,0,46,0,0,20,0,0,0 diff --git a/dist/Mesa/src/mesa/shader/slang/slang_builtin.c b/dist/Mesa/src/mesa/shader/slang/slang_builtin.c index 6ee0fd33b..7351f263c 100644 --- a/dist/Mesa/src/mesa/shader/slang/slang_builtin.c +++ b/dist/Mesa/src/mesa/shader/slang/slang_builtin.c @@ -250,7 +250,7 @@ lookup_statevar(const char *var, GLint index1, GLint index2, const char *field, } } else if (strcmp(var, "gl_FrontLightModelProduct") == 0) { - if (strcmp(field, "ambient") == 0) { + if (strcmp(field, "sceneColor") == 0) { tokens[0] = STATE_LIGHTMODEL_SCENECOLOR; tokens[1] = 0; } @@ -259,7 +259,7 @@ lookup_statevar(const char *var, GLint index1, GLint index2, const char *field, } } else if (strcmp(var, "gl_BackLightModelProduct") == 0) { - if (strcmp(field, "ambient") == 0) { + if (strcmp(field, "sceneColor") == 0) { tokens[0] = STATE_LIGHTMODEL_SCENECOLOR; tokens[1] = 1; } @@ -397,6 +397,8 @@ lookup_statevar(const char *var, GLint index1, GLint index2, const char *field, * var.field * var[i].field * var[i][j] + * + * \return -1 upon error, else position in paramList of the state var/data */ GLint _slang_alloc_statevar(slang_ir_node *n, @@ -414,9 +416,13 @@ _slang_alloc_statevar(slang_ir_node *n, if (n->Opcode == IR_ELEMENT) { /* XXX can only handle constant indexes for now */ - assert(n->Children[1]->Opcode == IR_FLOAT); - index1 = (GLint) n->Children[1]->Value[0]; - n = n->Children[0]; + if (n->Children[1]->Opcode == IR_FLOAT) { + index1 = (GLint) n->Children[1]->Value[0]; + n = n->Children[0]; + } + else { + return -1; + } } if (n->Opcode == IR_ELEMENT) { diff --git a/dist/Mesa/src/mesa/shader/slang/slang_codegen.c b/dist/Mesa/src/mesa/shader/slang/slang_codegen.c index 675dd8318..ef9c0ab3f 100644 --- a/dist/Mesa/src/mesa/shader/slang/slang_codegen.c +++ b/dist/Mesa/src/mesa/shader/slang/slang_codegen.c @@ -2344,7 +2344,8 @@ _slang_gen_field(slang_assemble_ctx * A, slang_operation *oper) return n; } else if ( ti.spec.type == SLANG_SPEC_FLOAT - || ti.spec.type == SLANG_SPEC_INT) { + || ti.spec.type == SLANG_SPEC_INT + || ti.spec.type == SLANG_SPEC_BOOL) { const GLuint rows = 1; slang_swizzle swz; slang_ir_node *n; diff --git a/dist/Mesa/src/mesa/shader/slang/slang_emit.c b/dist/Mesa/src/mesa/shader/slang/slang_emit.c index fe13f2865..9c307c627 100644 --- a/dist/Mesa/src/mesa/shader/slang/slang_emit.c +++ b/dist/Mesa/src/mesa/shader/slang/slang_emit.c @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 6.5.3 + * Version: 7.0.3 * * Copyright (C) 2005-2007 Brian Paul All Rights Reserved. * @@ -677,6 +677,7 @@ static struct prog_instruction * emit_clamp(slang_emit_info *emitInfo, slang_ir_node *n) { struct prog_instruction *inst; + slang_ir_node tmpNode; assert(n->Opcode == IR_CLAMP); /* ch[0] = value @@ -722,18 +723,27 @@ emit_clamp(slang_emit_info *emitInfo, slang_ir_node *n) emit(emitInfo, n->Children[1]); emit(emitInfo, n->Children[2]); + /* Some GPUs don't allow reading from output registers. So if the + * dest for this clamp() is an output reg, we can't use that reg for + * the intermediate result. Use a temp register instead. + */ + _mesa_bzero(&tmpNode, sizeof(tmpNode)); + alloc_temp_storage(emitInfo, &tmpNode, n->Store->Size); + /* tmp = max(ch[0], ch[1]) */ inst = new_instruction(emitInfo, OPCODE_MAX); - storage_to_dst_reg(&inst->DstReg, n->Store, n->Writemask); + storage_to_dst_reg(&inst->DstReg, tmpNode.Store, n->Writemask); storage_to_src_reg(&inst->SrcReg[0], n->Children[0]->Store); storage_to_src_reg(&inst->SrcReg[1], n->Children[1]->Store); - /* tmp = min(tmp, ch[2]) */ + /* n->dest = min(tmp, ch[2]) */ inst = new_instruction(emitInfo, OPCODE_MIN); storage_to_dst_reg(&inst->DstReg, n->Store, n->Writemask); - storage_to_src_reg(&inst->SrcReg[0], n->Store); + storage_to_src_reg(&inst->SrcReg[0], tmpNode.Store); storage_to_src_reg(&inst->SrcReg[1], n->Children[2]->Store); + free_temp_storage(emitInfo->vt, &tmpNode); + return inst; } @@ -859,12 +869,18 @@ emit_return(slang_emit_info *emitInfo, slang_ir_node *n) static struct prog_instruction * emit_kill(slang_emit_info *emitInfo) { + struct gl_fragment_program *fp; struct prog_instruction *inst; /* NV-KILL - discard fragment depending on condition code. * Note that ARB-KILL depends on sign of vector operand. */ inst = new_instruction(emitInfo, OPCODE_KIL_NV); inst->DstReg.CondMask = COND_TR; /* always branch */ + + assert(emitInfo->prog->Target == GL_FRAGMENT_PROGRAM_ARB); + fp = (struct gl_fragment_program *) emitInfo->prog; + fp->UsesKill = GL_TRUE; + return inst; } @@ -1486,6 +1502,10 @@ emit_struct_field(slang_emit_info *emitInfo, slang_ir_node *n) { if (n->Store->File == PROGRAM_STATE_VAR) { n->Store->Index = _slang_alloc_statevar(n, emitInfo->prog->Parameters); + if (n->Store->Index < 0) { + slang_info_log_error(emitInfo->log, "Error parsing state variable"); + return NULL; + } } else { GLint offset = n->FieldOffset / 4; diff --git a/dist/Mesa/src/mesa/swrast/s_aalinetemp.h b/dist/Mesa/src/mesa/swrast/s_aalinetemp.h index 34c95fc34..074ffe8c9 100644 --- a/dist/Mesa/src/mesa/swrast/s_aalinetemp.h +++ b/dist/Mesa/src/mesa/swrast/s_aalinetemp.h @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 6.5.3 * - * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 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"), @@ -36,6 +36,7 @@ static void NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy) { + const SWcontext *swrast = SWRAST_CONTEXT(ctx); const GLfloat fx = (GLfloat) ix; const GLfloat fy = (GLfloat) iy; #ifdef DO_INDEX @@ -45,6 +46,8 @@ NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy) #endif const GLuint i = line->span.end; + (void) swrast; + if (coverage == 0.0) return; @@ -61,7 +64,7 @@ NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy) line->span.array->z[i] = (GLuint) solve_plane(fx, fy, line->zPlane); #endif #ifdef DO_FOG - line->span.array->fog[i] = solve_plane(fx, fy, line->fPlane); + line->span.array->attribs[FRAG_ATTRIB_FOGC][i][0] = solve_plane(fx, fy, line->fPlane); #endif #ifdef DO_RGBA line->span.array->rgba[i][RCOMP] = solve_plane_chan(fx, fy, line->rPlane); @@ -77,44 +80,27 @@ NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy) line->span.array->spec[i][GCOMP] = solve_plane_chan(fx, fy, line->sgPlane); line->span.array->spec[i][BCOMP] = solve_plane_chan(fx, fy, line->sbPlane); #endif -#ifdef DO_TEX - { +#if defined(DO_ATTRIBS) + ATTRIB_LOOP_BEGIN + GLfloat (*attribArray)[4] = line->span.array->attribs[attr]; GLfloat invQ; if (ctx->FragmentProgram._Active) { invQ = 1.0F; } else { - invQ = solve_plane_recip(fx, fy, line->vPlane[0]); + invQ = solve_plane_recip(fx, fy, line->vPlane[attr]); } - line->span.array->texcoords[0][i][0] = solve_plane(fx, fy, line->sPlane[0]) * invQ; - line->span.array->texcoords[0][i][1] = solve_plane(fx, fy, line->tPlane[0]) * invQ; - line->span.array->texcoords[0][i][2] = solve_plane(fx, fy, line->uPlane[0]) * invQ; - line->span.array->lambda[0][i] = compute_lambda(line->sPlane[0], - line->tPlane[0], invQ, - line->texWidth[0], - line->texHeight[0]); - } -#elif defined(DO_MULTITEX) - { - GLuint unit; - for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { - if (ctx->Texture.Unit[unit]._ReallyEnabled) { - GLfloat invQ; - if (ctx->FragmentProgram._Active) { - invQ = 1.0F; - } - else { - invQ = solve_plane_recip(fx, fy, line->vPlane[unit]); - } - line->span.array->texcoords[unit][i][0] = solve_plane(fx, fy, line->sPlane[unit]) * invQ; - line->span.array->texcoords[unit][i][1] = solve_plane(fx, fy, line->tPlane[unit]) * invQ; - line->span.array->texcoords[unit][i][2] = solve_plane(fx, fy, line->uPlane[unit]) * invQ; - line->span.array->lambda[unit][i] = compute_lambda(line->sPlane[unit], - line->tPlane[unit], invQ, - line->texWidth[unit], line->texHeight[unit]); - } + attribArray[i][0] = solve_plane(fx, fy, line->sPlane[attr]) * invQ; + attribArray[i][1] = solve_plane(fx, fy, line->tPlane[attr]) * invQ; + attribArray[i][2] = solve_plane(fx, fy, line->uPlane[attr]) * invQ; + if (attr < FRAG_ATTRIB_VAR0 && attr >= FRAG_ATTRIB_TEX0) { + const GLuint unit = attr - FRAG_ATTRIB_TEX0; + line->span.array->lambda[unit][i] + = compute_lambda(line->sPlane[attr], + line->tPlane[attr], invQ, + line->texWidth[attr], line->texHeight[attr]); } - } + ATTRIB_LOOP_END #endif if (line->span.end == MAX_WIDTH) { @@ -155,6 +141,7 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1) return; INIT_SPAN(line.span, GL_LINE, 0, 0, SPAN_XY | SPAN_COVERAGE); + line.span.facing = swrast->PointLineFacing; line.xAdj = line.dx / line.len * line.halfWidth; line.yAdj = line.dy / line.len * line.halfWidth; @@ -167,7 +154,9 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1) #ifdef DO_FOG line.span.arrayMask |= SPAN_FOG; compute_plane(line.x0, line.y0, line.x1, line.y1, - v0->fog, v1->fog, line.fPlane); + v0->attrib[FRAG_ATTRIB_FOGC][0], + v1->attrib[FRAG_ATTRIB_FOGC][0], + line.fPlane); #endif #ifdef DO_RGBA line.span.arrayMask |= SPAN_RGBA; @@ -214,54 +203,32 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1) constant_plane(v1->index, line.iPlane); } #endif -#ifdef DO_TEX +#if defined(DO_ATTRIBS) { - const struct gl_texture_object *obj = ctx->Texture.Unit[0]._Current; - const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel]; const GLfloat invW0 = v0->win[3]; const GLfloat invW1 = v1->win[3]; - const GLfloat s0 = v0->texcoord[0][0] * invW0; - const GLfloat s1 = v1->texcoord[0][0] * invW1; - const GLfloat t0 = v0->texcoord[0][1] * invW0; - const GLfloat t1 = v1->texcoord[0][1] * invW1; - const GLfloat r0 = v0->texcoord[0][2] * invW0; - const GLfloat r1 = v1->texcoord[0][2] * invW1; - const GLfloat q0 = v0->texcoord[0][3] * invW0; - const GLfloat q1 = v1->texcoord[0][3] * invW1; - line.span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA); - compute_plane(line.x0, line.y0, line.x1, line.y1, s0, s1, line.sPlane[0]); - compute_plane(line.x0, line.y0, line.x1, line.y1, t0, t1, line.tPlane[0]); - compute_plane(line.x0, line.y0, line.x1, line.y1, r0, r1, line.uPlane[0]); - compute_plane(line.x0, line.y0, line.x1, line.y1, q0, q1, line.vPlane[0]); - line.texWidth[0] = (GLfloat) texImage->Width; - line.texHeight[0] = (GLfloat) texImage->Height; - } -#elif defined(DO_MULTITEX) - { - GLuint u; - line.span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA); - for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { - if (ctx->Texture.Unit[u]._ReallyEnabled) { + line.span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA | SPAN_VARYING); + ATTRIB_LOOP_BEGIN + const GLfloat s0 = v0->attrib[attr][0] * invW0; + const GLfloat s1 = v1->attrib[attr][0] * invW1; + const GLfloat t0 = v0->attrib[attr][1] * invW0; + const GLfloat t1 = v1->attrib[attr][1] * invW1; + const GLfloat r0 = v0->attrib[attr][2] * invW0; + const GLfloat r1 = v1->attrib[attr][2] * invW1; + const GLfloat q0 = v0->attrib[attr][3] * invW0; + const GLfloat q1 = v1->attrib[attr][3] * invW1; + compute_plane(line.x0, line.y0, line.x1, line.y1, s0, s1, line.sPlane[attr]); + compute_plane(line.x0, line.y0, line.x1, line.y1, t0, t1, line.tPlane[attr]); + compute_plane(line.x0, line.y0, line.x1, line.y1, r0, r1, line.uPlane[attr]); + compute_plane(line.x0, line.y0, line.x1, line.y1, q0, q1, line.vPlane[attr]); + if (attr < FRAG_ATTRIB_VAR0 && attr >= FRAG_ATTRIB_TEX0) { + const GLuint u = attr - FRAG_ATTRIB_TEX0; const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current; const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel]; - const GLfloat invW0 = v0->win[3]; - const GLfloat invW1 = v1->win[3]; - const GLfloat s0 = v0->texcoord[u][0] * invW0; - const GLfloat s1 = v1->texcoord[u][0] * invW1; - const GLfloat t0 = v0->texcoord[u][1] * invW0; - const GLfloat t1 = v1->texcoord[u][1] * invW1; - const GLfloat r0 = v0->texcoord[u][2] * invW0; - const GLfloat r1 = v1->texcoord[u][2] * invW1; - const GLfloat q0 = v0->texcoord[u][3] * invW0; - const GLfloat q1 = v1->texcoord[u][3] * invW1; - compute_plane(line.x0, line.y0, line.x1, line.y1, s0, s1, line.sPlane[u]); - compute_plane(line.x0, line.y0, line.x1, line.y1, t0, t1, line.tPlane[u]); - compute_plane(line.x0, line.y0, line.x1, line.y1, r0, r1, line.uPlane[u]); - compute_plane(line.x0, line.y0, line.x1, line.y1, q0, q1, line.vPlane[u]); - line.texWidth[u] = (GLfloat) texImage->Width; - line.texHeight[u] = (GLfloat) texImage->Height; + line.texWidth[attr] = (GLfloat) texImage->Width; + line.texHeight[attr] = (GLfloat) texImage->Height; } - } + ATTRIB_LOOP_END } #endif @@ -324,6 +291,5 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1) #undef DO_RGBA #undef DO_INDEX #undef DO_SPEC -#undef DO_TEX -#undef DO_MULTITEX +#undef DO_ATTRIBS #undef NAME diff --git a/dist/Mesa/src/mesa/swrast/s_aatritemp.h b/dist/Mesa/src/mesa/swrast/s_aatritemp.h index 23c262f83..b26f21f5d 100644 --- a/dist/Mesa/src/mesa/swrast/s_aatritemp.h +++ b/dist/Mesa/src/mesa/swrast/s_aatritemp.h @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 7.0.3 * - * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 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"), @@ -36,12 +36,12 @@ * DO_RGBA - if defined, compute RGBA values * DO_INDEX - if defined, compute color index values * DO_SPEC - if defined, compute specular RGB values - * DO_TEX - if defined, compute unit 0 STRQ texcoords - * DO_MULTITEX - if defined, compute all unit's STRQ texcoords + * DO_ATTRIBS - if defined, compute texcoords, varying, etc. */ /*void triangle( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv )*/ { + const SWcontext *swrast = SWRAST_CONTEXT(ctx); const GLfloat *p0 = v0->win; const GLfloat *p1 = v1->win; const GLfloat *p2 = v2->win; @@ -51,7 +51,7 @@ GLboolean ltor; GLfloat majDx, majDy; /* major (i.e. long) edge dx and dy */ - struct sw_span span; + SWspan span; #ifdef DO_Z GLfloat zPlane[4]; @@ -70,20 +70,18 @@ #ifdef DO_SPEC GLfloat srPlane[4], sgPlane[4], sbPlane[4]; #endif -#ifdef DO_TEX - GLfloat sPlane[4], tPlane[4], uPlane[4], vPlane[4]; - GLfloat texWidth, texHeight; -#elif defined(DO_MULTITEX) - GLfloat sPlane[MAX_TEXTURE_COORD_UNITS][4]; /* texture S */ - GLfloat tPlane[MAX_TEXTURE_COORD_UNITS][4]; /* texture T */ - GLfloat uPlane[MAX_TEXTURE_COORD_UNITS][4]; /* texture R */ - GLfloat vPlane[MAX_TEXTURE_COORD_UNITS][4]; /* texture Q */ - GLfloat texWidth[MAX_TEXTURE_COORD_UNITS]; - GLfloat texHeight[MAX_TEXTURE_COORD_UNITS]; -#endif - GLfloat bf = SWRAST_CONTEXT(ctx)->_BackfaceSign; - +#if defined(DO_ATTRIBS) + GLfloat sPlane[FRAG_ATTRIB_MAX][4]; /* texture S */ + GLfloat tPlane[FRAG_ATTRIB_MAX][4]; /* texture T */ + GLfloat uPlane[FRAG_ATTRIB_MAX][4]; /* texture R */ + GLfloat vPlane[FRAG_ATTRIB_MAX][4]; /* texture Q */ + GLfloat texWidth[FRAG_ATTRIB_MAX]; + GLfloat texHeight[FRAG_ATTRIB_MAX]; +#endif + GLfloat bf = SWRAST_CONTEXT(ctx)->_BackfaceCullSign; + (void) swrast; + INIT_SPAN(span, GL_POLYGON, 0, 0, SPAN_COVERAGE); /* determine bottom to top order of vertices */ @@ -118,6 +116,7 @@ majDx = vMax->win[0] - vMin->win[0]; majDy = vMax->win[1] - vMin->win[1]; + /* front/back-face determination and cullling */ { const GLfloat botDx = vMid->win[0] - vMin->win[0]; const GLfloat botDy = vMid->win[1] - vMin->win[1]; @@ -126,6 +125,8 @@ if (area * bf < 0 || area == 0 || IS_INF_OR_NAN(area)) return; ltor = (GLboolean) (area < 0.0F); + + span.facing = area * swrast->_BackfaceSign > 0.0F; } /* Plane equation setup: @@ -138,7 +139,11 @@ span.arrayMask |= SPAN_Z; #endif #ifdef DO_FOG - compute_plane(p0, p1, p2, v0->fog, v1->fog, v2->fog, fogPlane); + compute_plane(p0, p1, p2, + v0->attrib[FRAG_ATTRIB_FOGC][0], + v1->attrib[FRAG_ATTRIB_FOGC][0], + v2->attrib[FRAG_ATTRIB_FOGC][0], + fogPlane); span.arrayMask |= SPAN_FOG; #endif #ifdef DO_RGBA @@ -179,65 +184,41 @@ } span.arrayMask |= SPAN_SPEC; #endif -#ifdef DO_TEX +#if defined(DO_ATTRIBS) { - const struct gl_texture_object *obj = ctx->Texture.Unit[0]._Current; - const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel]; const GLfloat invW0 = v0->win[3]; const GLfloat invW1 = v1->win[3]; const GLfloat invW2 = v2->win[3]; - const GLfloat s0 = v0->texcoord[0][0] * invW0; - const GLfloat s1 = v1->texcoord[0][0] * invW1; - const GLfloat s2 = v2->texcoord[0][0] * invW2; - const GLfloat t0 = v0->texcoord[0][1] * invW0; - const GLfloat t1 = v1->texcoord[0][1] * invW1; - const GLfloat t2 = v2->texcoord[0][1] * invW2; - const GLfloat r0 = v0->texcoord[0][2] * invW0; - const GLfloat r1 = v1->texcoord[0][2] * invW1; - const GLfloat r2 = v2->texcoord[0][2] * invW2; - const GLfloat q0 = v0->texcoord[0][3] * invW0; - const GLfloat q1 = v1->texcoord[0][3] * invW1; - const GLfloat q2 = v2->texcoord[0][3] * invW2; - compute_plane(p0, p1, p2, s0, s1, s2, sPlane); - compute_plane(p0, p1, p2, t0, t1, t2, tPlane); - compute_plane(p0, p1, p2, r0, r1, r2, uPlane); - compute_plane(p0, p1, p2, q0, q1, q2, vPlane); - texWidth = (GLfloat) texImage->Width; - texHeight = (GLfloat) texImage->Height; - } - span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA); -#elif defined(DO_MULTITEX) - { - GLuint u; - for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { - if (ctx->Texture.Unit[u]._ReallyEnabled) { + ATTRIB_LOOP_BEGIN + const GLfloat s0 = v0->attrib[attr][0] * invW0; + const GLfloat s1 = v1->attrib[attr][0] * invW1; + const GLfloat s2 = v2->attrib[attr][0] * invW2; + const GLfloat t0 = v0->attrib[attr][1] * invW0; + const GLfloat t1 = v1->attrib[attr][1] * invW1; + const GLfloat t2 = v2->attrib[attr][1] * invW2; + const GLfloat r0 = v0->attrib[attr][2] * invW0; + const GLfloat r1 = v1->attrib[attr][2] * invW1; + const GLfloat r2 = v2->attrib[attr][2] * invW2; + const GLfloat q0 = v0->attrib[attr][3] * invW0; + const GLfloat q1 = v1->attrib[attr][3] * invW1; + const GLfloat q2 = v2->attrib[attr][3] * invW2; + compute_plane(p0, p1, p2, s0, s1, s2, sPlane[attr]); + compute_plane(p0, p1, p2, t0, t1, t2, tPlane[attr]); + compute_plane(p0, p1, p2, r0, r1, r2, uPlane[attr]); + compute_plane(p0, p1, p2, q0, q1, q2, vPlane[attr]); + if (attr < FRAG_ATTRIB_VAR0 && attr >= FRAG_ATTRIB_TEX0) { + const GLuint u = attr - FRAG_ATTRIB_TEX0; const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current; const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel]; - const GLfloat invW0 = v0->win[3]; - const GLfloat invW1 = v1->win[3]; - const GLfloat invW2 = v2->win[3]; - const GLfloat s0 = v0->texcoord[u][0] * invW0; - const GLfloat s1 = v1->texcoord[u][0] * invW1; - const GLfloat s2 = v2->texcoord[u][0] * invW2; - const GLfloat t0 = v0->texcoord[u][1] * invW0; - const GLfloat t1 = v1->texcoord[u][1] * invW1; - const GLfloat t2 = v2->texcoord[u][1] * invW2; - const GLfloat r0 = v0->texcoord[u][2] * invW0; - const GLfloat r1 = v1->texcoord[u][2] * invW1; - const GLfloat r2 = v2->texcoord[u][2] * invW2; - const GLfloat q0 = v0->texcoord[u][3] * invW0; - const GLfloat q1 = v1->texcoord[u][3] * invW1; - const GLfloat q2 = v2->texcoord[u][3] * invW2; - compute_plane(p0, p1, p2, s0, s1, s2, sPlane[u]); - compute_plane(p0, p1, p2, t0, t1, t2, tPlane[u]); - compute_plane(p0, p1, p2, r0, r1, r2, uPlane[u]); - compute_plane(p0, p1, p2, q0, q1, q2, vPlane[u]); - texWidth[u] = (GLfloat) texImage->Width; - texHeight[u] = (GLfloat) texImage->Height; + texWidth[attr] = (GLfloat) texImage->Width; + texHeight[attr] = (GLfloat) texImage->Height; } - } + else { + texWidth[attr] = texHeight[attr] = 1.0; + } + ATTRIB_LOOP_END } - span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA); + span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA | SPAN_VARYING); #endif /* Begin bottom-to-top scan over the triangle. @@ -279,7 +260,7 @@ while (coverage > 0.0F) { /* (cx,cy) = center of fragment */ const GLfloat cx = ix + 0.5F, cy = iy + 0.5F; - struct span_arrays *array = span.array; + SWspanarrays *array = span.array; #ifdef DO_INDEX array->coverage[count] = (GLfloat) compute_coveragei(pMin, pMid, pMax, ix, iy); #else @@ -289,7 +270,7 @@ array->z[count] = (GLuint) solve_plane(cx, cy, zPlane); #endif #ifdef DO_FOG - array->fog[count] = solve_plane(cx, cy, fogPlane); + array->attribs[FRAG_ATTRIB_FOGC][count][0] = solve_plane(cx, cy, fogPlane); #endif #ifdef DO_RGBA array->rgba[count][RCOMP] = solve_plane_chan(cx, cy, rPlane); @@ -305,31 +286,19 @@ array->spec[count][GCOMP] = solve_plane_chan(cx, cy, sgPlane); array->spec[count][BCOMP] = solve_plane_chan(cx, cy, sbPlane); #endif -#ifdef DO_TEX - { - const GLfloat invQ = solve_plane_recip(cx, cy, vPlane); - array->texcoords[0][count][0] = solve_plane(cx, cy, sPlane) * invQ; - array->texcoords[0][count][1] = solve_plane(cx, cy, tPlane) * invQ; - array->texcoords[0][count][2] = solve_plane(cx, cy, uPlane) * invQ; - array->lambda[0][count] = compute_lambda(sPlane, tPlane, vPlane, - cx, cy, invQ, - texWidth, texHeight); - } -#elif defined(DO_MULTITEX) - { - GLuint unit; - for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { - if (ctx->Texture.Unit[unit]._ReallyEnabled) { - GLfloat invQ = solve_plane_recip(cx, cy, vPlane[unit]); - array->texcoords[unit][count][0] = solve_plane(cx, cy, sPlane[unit]) * invQ; - array->texcoords[unit][count][1] = solve_plane(cx, cy, tPlane[unit]) * invQ; - array->texcoords[unit][count][2] = solve_plane(cx, cy, uPlane[unit]) * invQ; - array->lambda[unit][count] = compute_lambda(sPlane[unit], - tPlane[unit], vPlane[unit], cx, cy, invQ, - texWidth[unit], texHeight[unit]); - } +#if defined(DO_ATTRIBS) + ATTRIB_LOOP_BEGIN + GLfloat invQ = solve_plane_recip(cx, cy, vPlane[attr]); + array->attribs[attr][count][0] = solve_plane(cx, cy, sPlane[attr]) * invQ; + array->attribs[attr][count][1] = solve_plane(cx, cy, tPlane[attr]) * invQ; + array->attribs[attr][count][2] = solve_plane(cx, cy, uPlane[attr]) * invQ; + if (attr < FRAG_ATTRIB_VAR0 && attr >= FRAG_ATTRIB_TEX0) { + const GLuint unit = attr - FRAG_ATTRIB_TEX0; + array->lambda[unit][count] = compute_lambda(sPlane[attr], tPlane[attr], + vPlane[attr], cx, cy, invQ, + texWidth[attr], texHeight[attr]); } - } + ATTRIB_LOOP_END #endif ix++; count++; @@ -370,7 +339,7 @@ } /* skip fragments with zero coverage */ - while (startX >= 0) { + while (startX > 0) { coverage = compute_coveragef(pMin, pMax, pMid, startX, iy); if (coverage > 0.0F) break; @@ -383,7 +352,8 @@ while (coverage > 0.0F) { /* (cx,cy) = center of fragment */ const GLfloat cx = ix + 0.5F, cy = iy + 0.5F; - struct span_arrays *array = span.array; + SWspanarrays *array = span.array; + ASSERT(ix >= 0); #ifdef DO_INDEX array->coverage[ix] = (GLfloat) compute_coveragei(pMin, pMax, pMid, ix, iy); #else @@ -393,7 +363,7 @@ array->z[ix] = (GLuint) solve_plane(cx, cy, zPlane); #endif #ifdef DO_FOG - array->fog[ix] = solve_plane(cx, cy, fogPlane); + array->attribs[FRAG_ATTRIB_FOGC][ix][0] = solve_plane(cx, cy, fogPlane); #endif #ifdef DO_RGBA array->rgba[ix][RCOMP] = solve_plane_chan(cx, cy, rPlane); @@ -409,33 +379,22 @@ array->spec[ix][GCOMP] = solve_plane_chan(cx, cy, sgPlane); array->spec[ix][BCOMP] = solve_plane_chan(cx, cy, sbPlane); #endif -#ifdef DO_TEX - { - const GLfloat invQ = solve_plane_recip(cx, cy, vPlane); - array->texcoords[0][ix][0] = solve_plane(cx, cy, sPlane) * invQ; - array->texcoords[0][ix][1] = solve_plane(cx, cy, tPlane) * invQ; - array->texcoords[0][ix][2] = solve_plane(cx, cy, uPlane) * invQ; - array->lambda[0][ix] = compute_lambda(sPlane, tPlane, vPlane, - cx, cy, invQ, texWidth, texHeight); - } -#elif defined(DO_MULTITEX) - { - GLuint unit; - for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { - if (ctx->Texture.Unit[unit]._ReallyEnabled) { - GLfloat invQ = solve_plane_recip(cx, cy, vPlane[unit]); - array->texcoords[unit][ix][0] = solve_plane(cx, cy, sPlane[unit]) * invQ; - array->texcoords[unit][ix][1] = solve_plane(cx, cy, tPlane[unit]) * invQ; - array->texcoords[unit][ix][2] = solve_plane(cx, cy, uPlane[unit]) * invQ; - array->lambda[unit][ix] = compute_lambda(sPlane[unit], - tPlane[unit], - vPlane[unit], - cx, cy, invQ, - texWidth[unit], - texHeight[unit]); - } +#if defined(DO_ATTRIBS) + ATTRIB_LOOP_BEGIN + GLfloat invQ = solve_plane_recip(cx, cy, vPlane[attr]); + array->attribs[attr][ix][0] = solve_plane(cx, cy, sPlane[attr]) * invQ; + array->attribs[attr][ix][1] = solve_plane(cx, cy, tPlane[attr]) * invQ; + array->attribs[attr][ix][2] = solve_plane(cx, cy, uPlane[attr]) * invQ; + if (attr < FRAG_ATTRIB_VAR0 && attr >= FRAG_ATTRIB_TEX0) { + const GLuint unit = attr - FRAG_ATTRIB_TEX0; + array->lambda[unit][ix] = compute_lambda(sPlane[attr], + tPlane[attr], + vPlane[attr], + cx, cy, invQ, + texWidth[attr], + texHeight[attr]); } - } + ATTRIB_LOOP_END #endif ix--; count++; @@ -452,7 +411,7 @@ /* shift all values to the left */ /* XXX this is temporary */ { - struct span_arrays *array = span.array; + SWspanarrays *array = span.array; GLint j; for (j = 0; j < (GLint) n; j++) { #ifdef DO_RGBA @@ -468,33 +427,28 @@ array->z[j] = array->z[j + left]; #endif #ifdef DO_FOG - array->fog[j] = array->fog[j + left]; + array->attribs[FRAG_ATTRIB_FOGC][j][0] + = array->attribs[FRAG_ATTRIB_FOGC][j + left][0]; #endif -#ifdef DO_TEX - COPY_4V(array->texcoords[0][j], array->texcoords[0][j + left]); -#endif -#if defined(DO_MULTITEX) || defined(DO_TEX) +#if defined(DO_ATTRIBS) array->lambda[0][j] = array->lambda[0][j + left]; #endif array->coverage[j] = array->coverage[j + left]; } } -#ifdef DO_MULTITEX - /* shift texcoords */ +#ifdef DO_ATTRIBS + /* shift texcoords, varying */ { - struct span_arrays *array = span.array; - GLuint unit; - for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { - if (ctx->Texture.Unit[unit]._ReallyEnabled) { - GLint j; - for (j = 0; j < (GLint) n; j++) { - array->texcoords[unit][j][0] = array->texcoords[unit][j + left][0]; - array->texcoords[unit][j][1] = array->texcoords[unit][j + left][1]; - array->texcoords[unit][j][2] = array->texcoords[unit][j + left][2]; - array->lambda[unit][j] = array->lambda[unit][j + left]; - } + SWspanarrays *array = span.array; + ATTRIB_LOOP_BEGIN + GLint j; + for (j = 0; j < (GLint) n; j++) { + array->attribs[attr][j][0] = array->attribs[attr][j + left][0]; + array->attribs[attr][j][1] = array->attribs[attr][j + left][1]; + array->attribs[attr][j][2] = array->attribs[attr][j + left][2]; + /*array->lambda[unit][j] = array->lambda[unit][j + left];*/ } - } + ATTRIB_LOOP_END } #endif @@ -532,12 +486,8 @@ #undef DO_SPEC #endif -#ifdef DO_TEX -#undef DO_TEX -#endif - -#ifdef DO_MULTITEX -#undef DO_MULTITEX +#ifdef DO_ATTRIBS +#undef DO_ATTRIBS #endif #ifdef DO_OCCLUSION_TEST diff --git a/dist/Mesa/src/mesa/swrast/s_context.c b/dist/Mesa/src/mesa/swrast/s_context.c index a265d9e6c..9b9b73fee 100644 --- a/dist/Mesa/src/mesa/swrast/s_context.c +++ b/dist/Mesa/src/mesa/swrast/s_context.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.1 + * Version: 7.0.3 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 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"), @@ -31,7 +31,7 @@ #include "context.h" #include "colormac.h" #include "mtypes.h" -#include "program.h" +#include "prog_statevars.h" #include "teximage.h" #include "swrast.h" #include "s_blend.h" @@ -98,11 +98,7 @@ _swrast_update_rasterflags( GLcontext *ctx ) rasterMask |= MULTI_DRAW_BIT; /* all color index bits disabled */ } - if (ctx->FragmentProgram._Active) { - rasterMask |= FRAGPROG_BIT; - } - - if (ctx->ShaderObjects._FragmentShaderPresent) { + if (ctx->FragmentProgram._Current) { rasterMask |= FRAGPROG_BIT; } @@ -121,51 +117,53 @@ _swrast_update_rasterflags( GLcontext *ctx ) /** - * Examine polycon culls tate to compute the _BackfaceSign field. - * _BackfaceSign will be 0 if no culling, -1 if culling back-faces, + * Examine polycon culls tate to compute the _BackfaceCullSign field. + * _BackfaceCullSign will be 0 if no culling, -1 if culling back-faces, * and 1 if culling front-faces. The Polygon FrontFace state also * factors in. */ static void _swrast_update_polygon( GLcontext *ctx ) { - GLfloat backface_sign = 1; + GLfloat backface_sign; if (ctx->Polygon.CullFlag) { - backface_sign = 1; - switch(ctx->Polygon.CullFaceMode) { + switch (ctx->Polygon.CullFaceMode) { case GL_BACK: - if(ctx->Polygon.FrontFace==GL_CCW) - backface_sign = -1; + backface_sign = -1.0; break; case GL_FRONT: - if(ctx->Polygon.FrontFace!=GL_CCW) - backface_sign = -1; + backface_sign = 1.0; break; - default: case GL_FRONT_AND_BACK: - backface_sign = 0; - break; + /* fallthrough */ + default: + backface_sign = 0.0; } } else { - backface_sign = 0; + backface_sign = 0.0; } - SWRAST_CONTEXT(ctx)->_BackfaceSign = backface_sign; + SWRAST_CONTEXT(ctx)->_BackfaceCullSign = backface_sign; + + /* This is for front/back-face determination, but not for culling */ + SWRAST_CONTEXT(ctx)->_BackfaceSign + = (ctx->Polygon.FrontFace == GL_CW) ? -1.0 : 1.0; } + /** * Update the _PreferPixelFog field to indicate if we need to compute - * fog factors per-fragment. + * fog blend factors (from the fog coords) per-fragment. */ static void _swrast_update_fog_hint( GLcontext *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); swrast->_PreferPixelFog = (!swrast->AllowVertexFog || - ctx->FragmentProgram._Enabled || /* not _Active! */ + ctx->FragmentProgram._Current || (ctx->Hint.Fog == GL_NICEST && swrast->AllowPixelFog)); } @@ -198,22 +196,14 @@ static void _swrast_update_fog_state( GLcontext *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); - - /* convert fog color to GLchan values */ - CLAMPED_FLOAT_TO_CHAN(swrast->_FogColor[RCOMP], ctx->Fog.Color[RCOMP]); - CLAMPED_FLOAT_TO_CHAN(swrast->_FogColor[GCOMP], ctx->Fog.Color[GCOMP]); - CLAMPED_FLOAT_TO_CHAN(swrast->_FogColor[BCOMP], ctx->Fog.Color[BCOMP]); + const struct gl_fragment_program *fp = ctx->FragmentProgram._Current; /* determine if fog is needed, and if so, which fog mode */ swrast->_FogEnabled = GL_FALSE; - if (ctx->FragmentProgram._Active) { - if (ctx->FragmentProgram._Current->Base.Target==GL_FRAGMENT_PROGRAM_ARB) { - const struct gl_fragment_program *fp - = ctx->FragmentProgram._Current; - if (fp->FogOption != GL_NONE) { - swrast->_FogEnabled = GL_TRUE; - swrast->_FogMode = fp->FogOption; - } + if (fp && fp->Base.Target == GL_FRAGMENT_PROGRAM_ARB) { + if (fp->FogOption != GL_NONE) { + swrast->_FogEnabled = GL_TRUE; + swrast->_FogMode = fp->FogOption; } } else if (ctx->Fog.Enabled) { @@ -228,11 +218,17 @@ _swrast_update_fog_state( GLcontext *ctx ) * program parameters with current state values. */ static void -_swrast_update_fragment_program( GLcontext *ctx ) -{ - if (ctx->FragmentProgram._Active) { - const struct gl_fragment_program *fp = ctx->FragmentProgram._Current; - _mesa_load_state_parameters(ctx, fp->Base.Parameters); +_swrast_update_fragment_program(GLcontext *ctx, GLbitfield newState) +{ + const struct gl_fragment_program *fp = ctx->FragmentProgram._Current; + if (fp) { +#if 0 + /* XXX Need a way to trigger the initial loading of parameters + * even when there's no recent state changes. + */ + if (fp->Base.Parameters->StateFlags & newState) +#endif + _mesa_load_state_parameters(ctx, fp->Base.Parameters); } } @@ -296,10 +292,11 @@ _swrast_validate_triangle( GLcontext *ctx, _swrast_validate_derived( ctx ); swrast->choose_triangle( ctx ); + ASSERT(swrast->Triangle); if (ctx->Texture._EnabledUnits == 0 && NEED_SECONDARY_COLOR(ctx) - && !ctx->FragmentProgram._Active) { + && !ctx->FragmentProgram._Current) { /* separate specular color, but no texture */ swrast->SpecTriangle = swrast->Triangle; swrast->Triangle = _swrast_add_spec_terms_triangle; @@ -319,10 +316,11 @@ _swrast_validate_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ) _swrast_validate_derived( ctx ); swrast->choose_line( ctx ); + ASSERT(swrast->Line); if (ctx->Texture._EnabledUnits == 0 && NEED_SECONDARY_COLOR(ctx) - && !ctx->FragmentProgram._Active) { + && !ctx->FragmentProgram._Current) { swrast->SpecLine = swrast->Line; swrast->Line = _swrast_add_spec_terms_line; } @@ -345,7 +343,7 @@ _swrast_validate_point( GLcontext *ctx, const SWvertex *v0 ) if (ctx->Texture._EnabledUnits == 0 && NEED_SECONDARY_COLOR(ctx) - && !ctx->FragmentProgram._Active) { + && !ctx->FragmentProgram._Current) { swrast->SpecPoint = swrast->Point; swrast->Point = _swrast_add_spec_terms_point; } @@ -359,17 +357,16 @@ _swrast_validate_point( GLcontext *ctx, const SWvertex *v0 ) * function, then call it. */ static void _ASMAPI -_swrast_validate_blend_func( GLcontext *ctx, GLuint n, - const GLubyte mask[], - GLchan src[][4], - CONST GLchan dst[][4] ) +_swrast_validate_blend_func(GLcontext *ctx, GLuint n, const GLubyte mask[], + GLvoid *src, const GLvoid *dst, + GLenum chanType ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); - _swrast_validate_derived( ctx ); - _swrast_choose_blend_func( ctx ); + _swrast_validate_derived( ctx ); /* why is this needed? */ + _swrast_choose_blend_func( ctx, chanType ); - swrast->BlendFunc( ctx, n, mask, src, dst ); + swrast->BlendFunc( ctx, n, mask, src, dst, chanType ); } @@ -396,7 +393,7 @@ _swrast_validate_texture_images(GLcontext *ctx) GLuint numFaces = (texObj->Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1; GLuint face; for (face = 0; face < numFaces; face++) { - GLuint lvl; + GLint lvl; for (lvl = texObj->BaseLevel; lvl <= texObj->_MaxLevel; lvl++) { struct gl_texture_image *texImg = texObj->Image[face][lvl]; if (texImg && !texImg->Data) { @@ -434,7 +431,7 @@ _swrast_eject_texture_images(GLcontext *ctx) GLuint numFaces = (texObj->Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1; GLuint face; for (face = 0; face < numFaces; face++) { - GLuint lvl; + GLint lvl; for (lvl = texObj->BaseLevel; lvl <= texObj->_MaxLevel; lvl++) { struct gl_texture_image *texImg = texObj->Image[face][lvl]; if (texImg && texImg->Data) { @@ -492,7 +489,7 @@ _swrast_invalidate_state( GLcontext *ctx, GLbitfield new_state ) } -static void +void _swrast_update_texture_samplers(GLcontext *ctx) { SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -500,9 +497,99 @@ _swrast_update_texture_samplers(GLcontext *ctx) for (u = 0; u < ctx->Const.MaxTextureImageUnits; u++) { const struct gl_texture_object *tObj = ctx->Texture.Unit[u]._Current; - if (tObj) - swrast->TextureSample[u] = - _swrast_choose_texture_sample_func(ctx, tObj); + /* Note: If tObj is NULL, the sample function will be a simple + * function that just returns opaque black (0,0,0,1). + */ + swrast->TextureSample[u] = _swrast_choose_texture_sample_func(ctx, tObj); + } +} + + +/** + * Update swrast->_ActiveAttribs and swrast->_NumActiveAttribs + */ +static void +_swrast_update_fragment_attribs(GLcontext *ctx) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + GLuint attribsMask; + + if (ctx->FragmentProgram._Current) { + attribsMask = ctx->FragmentProgram._Current->Base.InputsRead; + } + else { + GLuint u; + attribsMask = 0x0; + +#if 0 /* not yet */ + if (ctx->Depth.Test) + attribsMask |= FRAG_BIT_WPOS; + if (NEED_SECONDARY_COLOR(ctx)) + attribsMask |= FRAG_BIT_COL1; +#endif + if (swrast->_FogEnabled) + attribsMask |= FRAG_BIT_FOGC; + + for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { + if (ctx->Texture.Unit[u]._ReallyEnabled) { + attribsMask |= FRAG_BIT_TEX(u); + } + } + } + + /* don't want to interpolate these generic attribs just yet */ + /* XXX temporary */ + attribsMask &= ~(FRAG_BIT_WPOS | + FRAG_BIT_COL0 | + FRAG_BIT_COL1 | + FRAG_BIT_FOGC); + + /* Update _ActiveAttribs[] list */ + { + GLuint i, num = 0; + for (i = 0; i < FRAG_ATTRIB_MAX; i++) { + if (attribsMask & (1 << i)) + swrast->_ActiveAttribs[num++] = i; + } + swrast->_NumActiveAttribs = num; + } +} + + +/** + * Update the swrast->_ColorOutputsMask which indicates which color + * renderbuffers (aka rendertargets) are being written to by the current + * fragment program. + * We also take glDrawBuffers() into account to skip outputs that are + * set to GL_NONE. + */ +static void +_swrast_update_color_outputs(GLcontext *ctx) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + const struct gl_framebuffer *fb = ctx->DrawBuffer; + + swrast->_ColorOutputsMask = 0; + swrast->_NumColorOutputs = 0; + + if (ctx->FragmentProgram._Current) { + const GLbitfield outputsWritten + = ctx->FragmentProgram._Current->Base.OutputsWritten; + GLuint output; + for (output = 0; output < ctx->Const.MaxDrawBuffers; output++) { + if ((outputsWritten & (1 << (FRAG_RESULT_DATA0 + output))) + && (fb->_NumColorDrawBuffers[output] > 0)) { + swrast->_ColorOutputsMask |= (1 << output); + swrast->_NumColorOutputs = output + 1; + } + } + } + if (swrast->_ColorOutputsMask == 0x0) { + /* no fragment program, or frag prog didn't write to gl_FragData[] */ + if (fb->_NumColorDrawBuffers[0] > 0) { + swrast->_ColorOutputsMask = 0x1; + swrast->_NumColorOutputs = 1; + } } } @@ -525,10 +612,20 @@ _swrast_validate_derived( GLcontext *ctx ) if (swrast->NewState & (_NEW_FOG | _NEW_PROGRAM)) _swrast_update_fog_state( ctx ); - if (swrast->NewState & _NEW_PROGRAM) - _swrast_update_fragment_program( ctx ); + if (swrast->NewState & (_NEW_MODELVIEW | + _NEW_PROJECTION | + _NEW_TEXTURE_MATRIX | + _NEW_FOG | + _NEW_LIGHT | + _NEW_LINE | + _NEW_TEXTURE | + _NEW_TRANSFORM | + _NEW_POINT | + _NEW_VIEWPORT | + _NEW_PROGRAM)) + _swrast_update_fragment_program( ctx, swrast->NewState ); - if (swrast->NewState & _NEW_TEXTURE) + if (swrast->NewState & (_NEW_TEXTURE | _NEW_PROGRAM)) _swrast_update_texture_samplers( ctx ); if (swrast->NewState & (_NEW_TEXTURE | _NEW_PROGRAM)) @@ -537,6 +634,15 @@ _swrast_validate_derived( GLcontext *ctx ) if (swrast->NewState & _SWRAST_NEW_RASTERMASK) _swrast_update_rasterflags( ctx ); + if (swrast->NewState & (_NEW_DEPTH | + _NEW_FOG | + _NEW_PROGRAM | + _NEW_TEXTURE)) + _swrast_update_fragment_attribs(ctx); + + if (swrast->NewState & (_NEW_PROGRAM | _NEW_BUFFERS)) + _swrast_update_color_outputs(ctx); + swrast->NewState = 0; swrast->StateChanges = 0; swrast->InvalidateState = _swrast_invalidate_state; @@ -616,6 +722,12 @@ _swrast_ResetLineStipple( GLcontext *ctx ) } void +_swrast_SetFacing(GLcontext *ctx, GLuint facing) +{ + SWRAST_CONTEXT(ctx)->PointLineFacing = facing; +} + +void _swrast_allow_vertex_fog( GLcontext *ctx, GLboolean value ) { if (SWRAST_DEBUG) { @@ -675,15 +787,25 @@ _swrast_CreateContext( GLcontext *ctx ) for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++) swrast->TextureSample[i] = NULL; - swrast->SpanArrays = MALLOC_STRUCT(span_arrays); + swrast->SpanArrays = MALLOC_STRUCT(sw_span_arrays); if (!swrast->SpanArrays) { FREE(swrast); return GL_FALSE; } + swrast->SpanArrays->ChanType = CHAN_TYPE; +#if CHAN_TYPE == GL_UNSIGNED_BYTE + swrast->SpanArrays->rgba = swrast->SpanArrays->color.sz1.rgba; + swrast->SpanArrays->spec = swrast->SpanArrays->color.sz1.spec; +#elif CHAN_TYPE == GL_UNSIGNED_SHORT + swrast->SpanArrays->rgba = swrast->SpanArrays->color.sz2.rgba; + swrast->SpanArrays->spec = swrast->SpanArrays->color.sz2.spec; +#else + swrast->SpanArrays->rgba = swrast->SpanArrays->attribs[FRAG_ATTRIB_COL0]; + swrast->SpanArrays->spec = swrast->SpanArrays->attribs[FRAG_ATTRIB_COL1]; +#endif /* init point span buffer */ swrast->PointSpan.primitive = GL_POINT; - swrast->PointSpan.start = 0; swrast->PointSpan.end = 0; swrast->PointSpan.facing = 0; swrast->PointSpan.array = swrast->SpanArrays; @@ -786,8 +908,10 @@ _swrast_print_vertex( GLcontext *ctx, const SWvertex *v ) for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) if (ctx->Texture.Unit[i]._ReallyEnabled) _mesa_debug(ctx, "texcoord[%d] %f %f %f %f\n", i, - v->texcoord[i][0], v->texcoord[i][1], - v->texcoord[i][2], v->texcoord[i][3]); + v->attrib[FRAG_ATTRIB_TEX0 + i][0], + v->attrib[FRAG_ATTRIB_TEX0 + i][1], + v->attrib[FRAG_ATTRIB_TEX0 + i][2], + v->attrib[FRAG_ATTRIB_TEX0 + i][3]); #if CHAN_TYPE == GL_FLOAT _mesa_debug(ctx, "color %f %f %f %f\n", @@ -802,7 +926,7 @@ _swrast_print_vertex( GLcontext *ctx, const SWvertex *v ) v->specular[0], v->specular[1], v->specular[2], v->specular[3]); #endif - _mesa_debug(ctx, "fog %f\n", v->fog); + _mesa_debug(ctx, "fog %f\n", v->attrib[FRAG_ATTRIB_FOGC][0]); _mesa_debug(ctx, "index %d\n", v->index); _mesa_debug(ctx, "pointsize %f\n", v->pointSize); _mesa_debug(ctx, "\n"); diff --git a/dist/Mesa/src/mesa/swrast/s_context.h b/dist/Mesa/src/mesa/swrast/s_context.h index 3c5a4c322..58841ad4a 100644 --- a/dist/Mesa/src/mesa/swrast/s_context.h +++ b/dist/Mesa/src/mesa/swrast/s_context.h @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 6.5.3 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 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"), @@ -45,172 +45,8 @@ #include "mtypes.h" #include "swrast.h" - - -/** - * \defgroup SpanFlags SPAN_XXX-flags - * Bitmasks to indicate which span_arrays need to be computed - * (sw_span::interpMask) or have already been filled in (sw_span::arrayMask) - */ -/*@{*/ -#define SPAN_RGBA 0x001 -#define SPAN_SPEC 0x002 -#define SPAN_INDEX 0x004 -#define SPAN_Z 0x008 -#define SPAN_W 0x010 -#define SPAN_FOG 0x020 -#define SPAN_TEXTURE 0x040 -#define SPAN_INT_TEXTURE 0x080 -#define SPAN_LAMBDA 0x100 -#define SPAN_COVERAGE 0x200 -#define SPAN_FLAT 0x400 /**< flat shading? */ -#define SPAN_XY 0x800 -#define SPAN_MASK 0x1000 -#define SPAN_VARYING 0x2000 -/*@}*/ - - -/** - * \struct span_arrays - * \brief Arrays of fragment values. - * - * These will either be computed from the x/xStep values above or - * filled in by glDraw/CopyPixels, etc. - * These arrays are separated out of sw_span to conserve memory. - */ -struct span_arrays { - /* XXX the next three fields could go into a union */ - GLchan rgb[MAX_WIDTH][3]; - GLchan rgba[MAX_WIDTH][4]; - GLuint index[MAX_WIDTH]; - GLchan spec[MAX_WIDTH][4]; /* specular color */ - GLint x[MAX_WIDTH]; /**< X/Y used for point/line rendering only */ - GLint y[MAX_WIDTH]; /**< X/Y used for point/line rendering only */ - GLuint z[MAX_WIDTH]; - GLfloat fog[MAX_WIDTH]; - GLfloat texcoords[MAX_TEXTURE_COORD_UNITS][MAX_WIDTH][4]; - GLfloat lambda[MAX_TEXTURE_COORD_UNITS][MAX_WIDTH]; - GLfloat coverage[MAX_WIDTH]; - GLfloat varying[MAX_WIDTH][MAX_VARYING_VECTORS][VARYINGS_PER_VECTOR]; - - /** This mask indicates which fragments are alive or culled */ - GLubyte mask[MAX_WIDTH]; -}; - - -/** - * \struct sw_span - * \brief Contains data for either a horizontal line or a set of - * pixels that are passed through a pipeline of functions before being - * drawn. - * - * The sw_span structure describes the colors, Z, fogcoord, texcoords, - * etc for either a horizontal run or an array of independent pixels. - * We can either specify a base/step to indicate interpolated values, or - * fill in arrays of values. The interpMask and arrayMask bitfields - * indicate which are active. - * - * With this structure it's easy to hand-off span rasterization to - * subroutines instead of doing it all inline in the triangle functions - * like we used to do. - * It also cleans up the local variable namespace a great deal. - * - * It would be interesting to experiment with multiprocessor rasterization - * with this structure. The triangle rasterizer could simply emit a - * stream of these structures which would be consumed by one or more - * span-processing threads which could run in parallel. - */ -struct sw_span { - GLint x, y; - - /** Only need to process pixels between start <= i < end */ - /** At this time, start is always zero. */ - GLuint start, end; - - /** This flag indicates that mask[] array is effectively filled with ones */ - GLboolean writeAll; - - /** either GL_POLYGON, GL_LINE, GL_POLYGON, GL_BITMAP */ - GLenum primitive; - - /** 0 = front-facing span, 1 = back-facing span (for two-sided stencil) */ - GLuint facing; - - /** - * This bitmask (of \link SpanFlags SPAN_* flags\endlink) indicates - * which of the x/xStep variables are relevant. - */ - GLbitfield interpMask; - - /* For horizontal spans, step is the partial derivative wrt X. - * For lines, step is the delta from one fragment to the next. - */ -#if CHAN_TYPE == GL_FLOAT - GLfloat red, redStep; - GLfloat green, greenStep; - GLfloat blue, blueStep; - GLfloat alpha, alphaStep; - GLfloat specRed, specRedStep; - GLfloat specGreen, specGreenStep; - GLfloat specBlue, specBlueStep; -#else /* CHAN_TYPE == GL_UNSIGNED_BYTE or GL_UNSIGNED_SHORT */ - GLfixed red, redStep; - GLfixed green, greenStep; - GLfixed blue, blueStep; - GLfixed alpha, alphaStep; - GLfixed specRed, specRedStep; - GLfixed specGreen, specGreenStep; - GLfixed specBlue, specBlueStep; -#endif - GLfixed index, indexStep; - GLfixed z, zStep; /* XXX z should probably be GLuint */ - GLfloat fog, fogStep; - GLfloat tex[MAX_TEXTURE_COORD_UNITS][4]; /* s, t, r, q */ - GLfloat texStepX[MAX_TEXTURE_COORD_UNITS][4]; - GLfloat texStepY[MAX_TEXTURE_COORD_UNITS][4]; - GLfixed intTex[2], intTexStep[2]; /* s, t only */ - GLfloat var[MAX_VARYING_VECTORS][VARYINGS_PER_VECTOR]; - GLfloat varStepX[MAX_VARYING_VECTORS][VARYINGS_PER_VECTOR]; - GLfloat varStepY[MAX_VARYING_VECTORS][VARYINGS_PER_VECTOR]; - - /* partial derivatives wrt X and Y. */ - GLfloat dzdx, dzdy; - GLfloat w, dwdx, dwdy; - GLfloat drdx, drdy; - GLfloat dgdx, dgdy; - GLfloat dbdx, dbdy; - GLfloat dadx, dady; - GLfloat dsrdx, dsrdy; - GLfloat dsgdx, dsgdy; - GLfloat dsbdx, dsbdy; - GLfloat dfogdx, dfogdy; - - /** - * This bitmask (of \link SpanFlags SPAN_* flags\endlink) indicates - * which of the fragment arrays in the span_arrays struct are relevant. - */ - GLbitfield arrayMask; - - /** - * We store the arrays of fragment values in a separate struct so - * that we can allocate sw_span structs on the stack without using - * a lot of memory. The span_arrays struct is about 400KB while the - * sw_span struct is only about 512 bytes. - */ - struct span_arrays *array; -}; - - -#define INIT_SPAN(S, PRIMITIVE, END, INTERP_MASK, ARRAY_MASK) \ -do { \ - (S).primitive = (PRIMITIVE); \ - (S).interpMask = (INTERP_MASK); \ - (S).arrayMask = (ARRAY_MASK); \ - (S).start = 0; \ - (S).end = (END); \ - (S).facing = 0; \ - (S).array = SWRAST_CONTEXT(ctx)->SpanArrays; \ -} while (0) +#include "s_span.h" +#include "prog_execute.h" typedef void (*texture_sample_func)(GLcontext *ctx, @@ -220,7 +56,8 @@ typedef void (*texture_sample_func)(GLcontext *ctx, typedef void (_ASMAPIP blend_func)( GLcontext *ctx, GLuint n, const GLubyte mask[], - GLchan src[][4], CONST GLchan dst[][4] ); + GLvoid *src, const GLvoid *dst, + GLenum chanType); typedef void (*swrast_point_func)( GLcontext *ctx, const SWvertex *); @@ -236,7 +73,8 @@ typedef void (*validate_texture_image_func)(GLcontext *ctx, GLuint face, GLuint level); -/** \defgroup Bitmasks +/** + * \defgroup Bitmasks * Bitmasks to indicate which rasterization options are enabled * (RasterMask) */ @@ -272,7 +110,7 @@ typedef void (*validate_texture_image_func)(GLcontext *ctx, /** * \struct SWcontext - * \brief SWContext? + * \brief Per-context state that's private to the software rasterizer module. */ typedef struct { @@ -290,13 +128,22 @@ typedef struct * _swrast_validate_derived(): */ GLbitfield _RasterMask; - GLfloat _BackfaceSign; + GLfloat _BackfaceSign; /** +1 or -1 */ + GLfloat _BackfaceCullSign; /** +1, 0, or -1 */ GLboolean _PreferPixelFog; /* Compute fog blend factor per fragment? */ GLboolean _AnyTextureCombine; - GLchan _FogColor[3]; GLboolean _FogEnabled; GLenum _FogMode; /* either GL_FOG_MODE or fragment program's fog mode */ + /** Multiple render targets */ + GLbitfield _ColorOutputsMask; + GLuint _NumColorOutputs; + + /** List/array of the fragment attributes to interpolate */ + GLuint _ActiveAttribs[FRAG_ATTRIB_MAX]; + /** Number of fragment attributes to interpolate */ + GLuint _NumActiveAttribs; + /* Accum buffer temporaries. */ GLboolean _IntegerAccumMode; /**< Storing unscaled integers? */ @@ -305,6 +152,7 @@ typedef struct /* Working values: */ GLuint StippleCounter; /**< Line stipple counter */ + GLuint PointLineFacing; GLbitfield NewState; GLuint StateChanges; GLenum Primitive; /* current primitive being drawn (ala glBegin) */ @@ -356,12 +204,12 @@ typedef struct * this object is big and causes problems when allocated on the stack * on some systems. */ - struct span_arrays *SpanArrays; + SWspanarrays *SpanArrays; /** * Used to buffer N GL_POINTS, instead of rendering one by one. */ - struct sw_span PointSpan; + SWspan PointSpan; /** Internal hooks, kept up to date by the same mechanism as above. */ @@ -375,12 +223,18 @@ typedef struct validate_texture_image_func ValidateTextureImage; + /** State used during execution of fragment programs */ + struct gl_program_machine FragProgMachine; + } SWcontext; extern void _swrast_validate_derived( GLcontext *ctx ); +extern void +_swrast_update_texture_samplers(GLcontext *ctx); + #define SWRAST_CONTEXT(ctx) ((SWcontext *)ctx->swrast_context) @@ -400,6 +254,16 @@ _swrast_validate_derived( GLcontext *ctx ); +/** + * Size of an RGBA pixel, in bytes, for given datatype. + */ +#define RGBA_PIXEL_SIZE(TYPE) \ + ((TYPE == GL_UNSIGNED_BYTE) ? 4 * sizeof(GLubyte) : \ + ((TYPE == GL_UNSIGNED_SHORT) ? 4 * sizeof(GLushort) \ + : 4 * sizeof(GLfloat))) + + + /* * XXX these macros are just bandages for now in order to make * CHAN_BITS==32 compile cleanly. @@ -413,4 +277,19 @@ _swrast_validate_derived( GLcontext *ctx ); #define FixedToChan(X) FixedToInt(X) #endif + +/** + * For looping over fragment attributes in the pointe, line + * triangle rasterizers. + */ +#define ATTRIB_LOOP_BEGIN \ + { \ + GLuint a; \ + for (a = 0; a < swrast->_NumActiveAttribs; a++) { \ + const GLuint attr = swrast->_ActiveAttribs[a]; + +#define ATTRIB_LOOP_END } } + + + #endif diff --git a/dist/Mesa/src/mesa/swrast/s_drawpix.c b/dist/Mesa/src/mesa/swrast/s_drawpix.c index cfe516733..cb613b6b2 100644 --- a/dist/Mesa/src/mesa/swrast/s_drawpix.c +++ b/dist/Mesa/src/mesa/swrast/s_drawpix.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.1 + * Version: 7.0.1 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 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"), @@ -40,32 +40,38 @@ #include "s_zoom.h" -/* + +/** * Try to do a fast and simple RGB(a) glDrawPixels. * Return: GL_TRUE if success, GL_FALSE if slow path must be used instead */ static GLboolean -fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *unpack, - const GLvoid *pixels) +fast_draw_rgba_pixels(GLcontext *ctx, GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *userUnpack, + const GLvoid *pixels) { const GLint imgX = x, imgY = y; struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][0]; + const GLenum rbType = rb->DataType; SWcontext *swrast = SWRAST_CONTEXT(ctx); - struct sw_span span; - - INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA); - - if (swrast->_RasterMask & MULTI_DRAW_BIT) - return GL_FALSE; - - if (ctx->_ImageTransferState) { - /* don't handle any pixel transfer options here */ + SWspan span; + GLboolean simpleZoom; + GLint yStep; /* +1 or -1 */ + struct gl_pixelstore_attrib unpack; + GLint destX, destY, drawWidth, drawHeight; /* post clipping */ + + if ((swrast->_RasterMask & ~CLIP_BIT) || + ctx->Texture._EnabledCoordUnits || + userUnpack->SwapBytes || + ctx->_ImageTransferState) { + /* can't handle any of those conditions */ return GL_FALSE; } + INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA); + _swrast_span_default_secondary_color(ctx, &span); if (ctx->Depth.Test) _swrast_span_default_z(ctx, &span); if (swrast->_FogEnabled) @@ -73,372 +79,245 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, if (ctx->Texture._EnabledCoordUnits) _swrast_span_default_texcoords(ctx, &span); - if ((swrast->_RasterMask & ~CLIP_BIT) == 0 - && ctx->Texture._EnabledCoordUnits == 0 - && unpack->Alignment == 1 /* XXX may not really need this */ - && !unpack->SwapBytes - && !unpack->LsbFirst) { - - /* XXX there's a lot of clipping code here that should be replaced - * by a call to _mesa_clip_drawpixels(). - */ - GLint destX = x; - GLint destY = y; - GLint drawWidth = width; /* actual width drawn */ - GLint drawHeight = height; /* actual height drawn */ - GLint skipPixels = unpack->SkipPixels; - GLint skipRows = unpack->SkipRows; - GLint rowLength; - - if (unpack->RowLength > 0) - rowLength = unpack->RowLength; - else - rowLength = width; + /* copy input params since clipping may change them */ + unpack = *userUnpack; + destX = x; + destY = y; + drawWidth = width; + drawHeight = height; + + /* check for simple zooming and clipping */ + if (ctx->Pixel.ZoomX == 1.0F && + (ctx->Pixel.ZoomY == 1.0F || ctx->Pixel.ZoomY == -1.0F)) { + if (!_mesa_clip_drawpixels(ctx, &destX, &destY, + &drawWidth, &drawHeight, &unpack)) { + /* image was completely clipped: no-op, all done */ + return GL_TRUE; + } + simpleZoom = GL_TRUE; + yStep = (GLint) ctx->Pixel.ZoomY; + ASSERT(yStep == 1 || yStep == -1); + } + else { + /* non-simple zooming */ + simpleZoom = GL_FALSE; + yStep = 1; + if (unpack.RowLength == 0) + unpack.RowLength = width; + } - /* If we're not using pixel zoom then do all clipping calculations - * now. Otherwise, we'll let the _swrast_write_zoomed_*_span() functions - * handle the clipping. - */ - if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { - /* horizontal clipping */ - if (destX < ctx->DrawBuffer->_Xmin) { - skipPixels += (ctx->DrawBuffer->_Xmin - destX); - drawWidth -= (ctx->DrawBuffer->_Xmin - destX); - destX = ctx->DrawBuffer->_Xmin; - } - if (destX + drawWidth > ctx->DrawBuffer->_Xmax) - drawWidth -= (destX + drawWidth - ctx->DrawBuffer->_Xmax); - if (drawWidth <= 0) - return GL_TRUE; + /* + * Ready to draw! + */ - /* vertical clipping */ - if (destY < ctx->DrawBuffer->_Ymin) { - skipRows += (ctx->DrawBuffer->_Ymin - destY); - drawHeight -= (ctx->DrawBuffer->_Ymin - destY); - destY = ctx->DrawBuffer->_Ymin; + if (format == GL_RGBA && type == rbType) { + const GLubyte *src + = (const GLubyte *) _mesa_image_address2d(&unpack, pixels, width, + height, format, type, 0, 0); + const GLint srcStride = _mesa_image_row_stride(&unpack, width, + format, type); + if (simpleZoom) { + GLint row; + for (row = 0; row < drawHeight; row++) { + rb->PutRow(ctx, rb, drawWidth, destX, destY, src, NULL); + src += srcStride; + destY += yStep; } - if (destY + drawHeight > ctx->DrawBuffer->_Ymax) - drawHeight -= (destY + drawHeight - ctx->DrawBuffer->_Ymax); - if (drawHeight <= 0) - return GL_TRUE; } - else if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==-1.0F) { - /* upside-down image */ - /* horizontal clipping */ - if (destX < ctx->DrawBuffer->_Xmin) { - skipPixels += (ctx->DrawBuffer->_Xmin - destX); - drawWidth -= (ctx->DrawBuffer->_Xmin - destX); - destX = ctx->DrawBuffer->_Xmin; + else { + /* with zooming */ + GLint row; + for (row = 0; row < drawHeight; row++) { + span.x = destX; + span.y = destY + row; + span.end = drawWidth; + span.array->ChanType = rbType; + _swrast_write_zoomed_rgba_span(ctx, imgX, imgY, &span, src); + src += srcStride; } - if (destX + drawWidth > ctx->DrawBuffer->_Xmax) - drawWidth -= (destX + drawWidth - ctx->DrawBuffer->_Xmax); - if (drawWidth <= 0) - return GL_TRUE; + span.array->ChanType = CHAN_TYPE; + } + return GL_TRUE; + } - /* vertical clipping */ - if (destY > ctx->DrawBuffer->_Ymax) { - skipRows += (destY - ctx->DrawBuffer->_Ymax); - drawHeight -= (destY - ctx->DrawBuffer->_Ymax); - destY = ctx->DrawBuffer->_Ymax; + if (format == GL_RGB && type == rbType) { + const GLubyte *src + = (const GLubyte *) _mesa_image_address2d(&unpack, pixels, width, + height, format, type, 0, 0); + const GLint srcStride = _mesa_image_row_stride(&unpack, width, + format, type); + if (simpleZoom) { + GLint row; + for (row = 0; row < drawHeight; row++) { + rb->PutRowRGB(ctx, rb, drawWidth, destX, destY, src, NULL); + src += srcStride; + destY += yStep; } - if (destY - drawHeight < ctx->DrawBuffer->_Ymin) - drawHeight -= (ctx->DrawBuffer->_Ymin - (destY - drawHeight)); - if (drawHeight <= 0) - return GL_TRUE; } else { - if (drawWidth > MAX_WIDTH) - return GL_FALSE; /* fall back to general case path */ + /* with zooming */ + GLint row; + for (row = 0; row < drawHeight; row++) { + span.x = destX; + span.y = destY; + span.end = drawWidth; + span.array->ChanType = rbType; + _swrast_write_zoomed_rgb_span(ctx, imgX, imgY, &span, src); + src += srcStride; + destY++; + } + span.array->ChanType = CHAN_TYPE; } + return GL_TRUE; + } + /* Remaining cases haven't been tested with alignment != 1 */ + if (userUnpack->Alignment != 1) + return GL_FALSE; - /* - * Ready to draw! - * The window region at (destX, destY) of size (drawWidth, drawHeight) - * will be written to. - * We'll take pixel data from buffer pointed to by "pixels" but we'll - * skip "skipRows" rows and skip "skipPixels" pixels/row. - */ - - if (format == GL_RGBA && type == CHAN_TYPE) { - if (ctx->Visual.rgbMode) { - const GLchan *src = (const GLchan *) pixels - + (skipRows * rowLength + skipPixels) * 4; - if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { - /* no zooming */ - GLint row; - for (row=0; row<drawHeight; row++) { - rb->PutRow(ctx, rb, drawWidth, destX, destY, src, NULL); - src += rowLength * 4; - destY++; - } - } - else if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==-1.0F) { - /* upside-down */ - GLint row; - for (row=0; row<drawHeight; row++) { - destY--; - rb->PutRow(ctx, rb, drawWidth, destX, destY, src, NULL); - src += rowLength * 4; - } - } - else { - /* with zooming */ - GLint row; - for (row=0; row<drawHeight; row++) { - span.x = destX; - span.y = destY + row; - span.end = drawWidth; - _swrast_write_zoomed_rgba_span(ctx, imgX, imgY, &span, - (CONST GLchan (*)[4]) src); - src += rowLength * 4; - } + if (format == GL_LUMINANCE && type == CHAN_TYPE && rbType == CHAN_TYPE) { + const GLchan *src = (const GLchan *) pixels + + (unpack.SkipRows * unpack.RowLength + unpack.SkipPixels); + if (simpleZoom) { + /* no zooming */ + GLint row; + ASSERT(drawWidth <= MAX_WIDTH); + for (row = 0; row < drawHeight; row++) { + GLchan rgb[MAX_WIDTH][3]; + GLint i; + for (i = 0;i<drawWidth;i++) { + rgb[i][0] = src[i]; + rgb[i][1] = src[i]; + rgb[i][2] = src[i]; } + rb->PutRowRGB(ctx, rb, drawWidth, destX, destY, rgb, NULL); + src += unpack.RowLength; + destY += yStep; } - return GL_TRUE; } - else if (format == GL_RGB && type == CHAN_TYPE) { - if (ctx->Visual.rgbMode) { - const GLchan *src = (const GLchan *) pixels - + (skipRows * rowLength + skipPixels) * 3; - if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { - GLint row; - for (row=0; row<drawHeight; row++) { - rb->PutRowRGB(ctx, rb, drawWidth, destX, destY, src, NULL); - src += rowLength * 3; - destY++; - } - } - else if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==-1.0F) { - /* upside-down */ - GLint row; - for (row=0; row<drawHeight; row++) { - destY--; - rb->PutRowRGB(ctx, rb, drawWidth, destX, destY, src, NULL); - src += rowLength * 3; - } - } - else { - /* with zooming */ - GLint row; - for (row=0; row<drawHeight; row++) { - span.x = destX; - span.y = destY; - span.end = drawWidth; - _swrast_write_zoomed_rgb_span(ctx, imgX, imgY, &span, - (CONST GLchan (*)[3]) src); - src += rowLength * 3; - destY++; - } + else { + /* with zooming */ + GLint row; + ASSERT(drawWidth <= MAX_WIDTH); + for (row = 0; row < drawHeight; row++) { + GLchan rgb[MAX_WIDTH][3]; + GLint i; + for (i = 0;i<drawWidth;i++) { + rgb[i][0] = src[i]; + rgb[i][1] = src[i]; + rgb[i][2] = src[i]; } + span.x = destX; + span.y = destY; + span.end = drawWidth; + _swrast_write_zoomed_rgb_span(ctx, imgX, imgY, &span, rgb); + src += unpack.RowLength; + destY++; } - return GL_TRUE; } - else if (format == GL_LUMINANCE && type == CHAN_TYPE) { - if (ctx->Visual.rgbMode) { - const GLchan *src = (const GLchan *) pixels - + (skipRows * rowLength + skipPixels); - if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { - /* no zooming */ - GLint row; - ASSERT(drawWidth <= MAX_WIDTH); - for (row=0; row<drawHeight; row++) { - GLint i; - for (i=0;i<drawWidth;i++) { - span.array->rgb[i][0] = src[i]; - span.array->rgb[i][1] = src[i]; - span.array->rgb[i][2] = src[i]; - } - rb->PutRowRGB(ctx, rb, drawWidth, destX, destY, - span.array->rgb, NULL); - src += rowLength; - destY++; - } - } - else if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==-1.0F) { - /* upside-down */ - GLint row; - ASSERT(drawWidth <= MAX_WIDTH); - for (row=0; row<drawHeight; row++) { - GLint i; - for (i=0;i<drawWidth;i++) { - span.array->rgb[i][0] = src[i]; - span.array->rgb[i][1] = src[i]; - span.array->rgb[i][2] = src[i]; - } - destY--; - rb->PutRow(ctx, rb, drawWidth, destX, destY, - span.array->rgb, NULL); - src += rowLength; - } - } - else { - /* with zooming */ - GLint row; - ASSERT(drawWidth <= MAX_WIDTH); - for (row=0; row<drawHeight; row++) { - GLint i; - for (i=0;i<drawWidth;i++) { - span.array->rgb[i][0] = src[i]; - span.array->rgb[i][1] = src[i]; - span.array->rgb[i][2] = src[i]; - } - span.x = destX; - span.y = destY; - span.end = drawWidth; - _swrast_write_zoomed_rgb_span(ctx, imgX, imgY, &span, - (CONST GLchan (*)[3]) span.array->rgb); - src += rowLength; - destY++; - } + return GL_TRUE; + } + + if (format == GL_LUMINANCE_ALPHA && type == CHAN_TYPE && rbType == CHAN_TYPE) { + const GLchan *src = (const GLchan *) pixels + + (unpack.SkipRows * unpack.RowLength + unpack.SkipPixels)*2; + if (simpleZoom) { + GLint row; + ASSERT(drawWidth <= MAX_WIDTH); + for (row = 0; row < drawHeight; row++) { + GLint i; + const GLchan *ptr = src; + for (i = 0;i<drawWidth;i++) { + span.array->rgba[i][0] = *ptr; + span.array->rgba[i][1] = *ptr; + span.array->rgba[i][2] = *ptr++; + span.array->rgba[i][3] = *ptr++; } + rb->PutRow(ctx, rb, drawWidth, destX, destY, + span.array->rgba, NULL); + src += unpack.RowLength*2; + destY += yStep; } - return GL_TRUE; } - else if (format == GL_LUMINANCE_ALPHA && type == CHAN_TYPE) { - if (ctx->Visual.rgbMode) { - const GLchan *src = (const GLchan *) pixels - + (skipRows * rowLength + skipPixels)*2; - if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { - /* no zooming */ - GLint row; - ASSERT(drawWidth <= MAX_WIDTH); - for (row=0; row<drawHeight; row++) { - GLint i; - const GLchan *ptr = src; - for (i=0;i<drawWidth;i++) { - span.array->rgba[i][0] = *ptr; - span.array->rgba[i][1] = *ptr; - span.array->rgba[i][2] = *ptr++; - span.array->rgba[i][3] = *ptr++; - } - rb->PutRow(ctx, rb, drawWidth, destX, destY, - span.array->rgba, NULL); - src += rowLength*2; - destY++; - } - } - else if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==-1.0F) { - /* upside-down */ - GLint row; - ASSERT(drawWidth <= MAX_WIDTH); - for (row=0; row<drawHeight; row++) { - GLint i; - const GLchan *ptr = src; - for (i=0;i<drawWidth;i++) { - span.array->rgba[i][0] = *ptr; - span.array->rgba[i][1] = *ptr; - span.array->rgba[i][2] = *ptr++; - span.array->rgba[i][3] = *ptr++; - } - destY--; - rb->PutRow(ctx, rb, drawWidth, destX, destY, - span.array->rgba, NULL); - src += rowLength*2; - } - } - else { - /* with zooming */ - GLint row; - ASSERT(drawWidth <= MAX_WIDTH); - for (row=0; row<drawHeight; row++) { - const GLchan *ptr = src; - GLint i; - for (i=0;i<drawWidth;i++) { - span.array->rgba[i][0] = *ptr; - span.array->rgba[i][1] = *ptr; - span.array->rgba[i][2] = *ptr++; - span.array->rgba[i][3] = *ptr++; - } - span.x = destX; - span.y = destY; - span.end = drawWidth; - _swrast_write_zoomed_rgba_span(ctx, imgX, imgY, &span, - (CONST GLchan (*)[4]) span.array->rgba); - src += rowLength*2; - destY++; - } + else { + /* with zooming */ + GLint row; + ASSERT(drawWidth <= MAX_WIDTH); + for (row = 0; row < drawHeight; row++) { + const GLchan *ptr = src; + GLint i; + for (i = 0;i<drawWidth;i++) { + span.array->rgba[i][0] = *ptr; + span.array->rgba[i][1] = *ptr; + span.array->rgba[i][2] = *ptr++; + span.array->rgba[i][3] = *ptr++; } + span.x = destX; + span.y = destY; + span.end = drawWidth; + _swrast_write_zoomed_rgba_span(ctx, imgX, imgY, &span, + span.array->rgba); + src += unpack.RowLength*2; + destY++; } - return GL_TRUE; } - else if (format==GL_COLOR_INDEX && type==GL_UNSIGNED_BYTE) { - const GLubyte *src = - (const GLubyte *) pixels + skipRows * rowLength + skipPixels; - if (ctx->Visual.rgbMode) { - /* convert CI data to RGBA */ - if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { - /* no zooming */ - GLint row; - for (row=0; row<drawHeight; row++) { - ASSERT(drawWidth <= MAX_WIDTH); - _mesa_map_ci8_to_rgba(ctx, drawWidth, src, span.array->rgba); - rb->PutRow(ctx, rb, drawWidth, destX, destY, - span.array->rgba, NULL); - src += rowLength; - destY++; - } - return GL_TRUE; - } - else if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==-1.0F) { - /* upside-down */ - GLint row; - for (row=0; row<drawHeight; row++) { - ASSERT(drawWidth <= MAX_WIDTH); - _mesa_map_ci8_to_rgba(ctx, drawWidth, src, span.array->rgba); - destY--; - rb->PutRow(ctx, rb, drawWidth, destX, destY, - span.array->rgba, NULL); - src += rowLength; - } - return GL_TRUE; - } - else { - /* with zooming */ - GLint row; - for (row=0; row<drawHeight; row++) { - ASSERT(drawWidth <= MAX_WIDTH); - _mesa_map_ci8_to_rgba(ctx, drawWidth, src, span.array->rgba); - span.x = destX; - span.y = destY; - span.end = drawWidth; - _swrast_write_zoomed_rgba_span(ctx, imgX, imgY, &span, - (CONST GLchan (*)[4]) span.array->rgba); - src += rowLength; - destY++; - } - return GL_TRUE; + return GL_TRUE; + } + + if (format == GL_COLOR_INDEX && type == GL_UNSIGNED_BYTE) { + const GLubyte *src = (const GLubyte *) pixels + + unpack.SkipRows * unpack.RowLength + unpack.SkipPixels; + if (ctx->Visual.rgbMode && rbType == GL_UNSIGNED_BYTE) { + /* convert ubyte/CI data to ubyte/RGBA */ + if (simpleZoom) { + GLint row; + for (row = 0; row < drawHeight; row++) { + ASSERT(drawWidth <= MAX_WIDTH); + _mesa_map_ci8_to_rgba8(ctx, drawWidth, src, + span.array->color.sz1.rgba); + rb->PutRow(ctx, rb, drawWidth, destX, destY, + span.array->color.sz1.rgba, NULL); + src += unpack.RowLength; + destY += yStep; } } else { - /* write CI data to CI frame buffer */ + /* ubyte/CI to ubyte/RGBA with zooming */ GLint row; - if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { - /* no zooming */ - for (row=0; row<drawHeight; row++) { - GLuint index32[MAX_WIDTH]; - GLint col; - for (col = 0; col < drawWidth; col++) - index32[col] = src[col]; - rb->PutRow(ctx, rb, drawWidth, destX, destY, index32, NULL); - src += rowLength; - destY++; - } - return GL_TRUE; - } - else { - /* with zooming */ - return GL_FALSE; + for (row = 0; row < drawHeight; row++) { + ASSERT(drawWidth <= MAX_WIDTH); + _mesa_map_ci8_to_rgba8(ctx, drawWidth, src, + span.array->color.sz1.rgba); + span.x = destX; + span.y = destY; + span.end = drawWidth; + _swrast_write_zoomed_rgba_span(ctx, imgX, imgY, &span, + span.array->color.sz1.rgba); + src += unpack.RowLength; + destY++; } } + return GL_TRUE; } - else { - /* can't handle this pixel format and/or data type here */ - return GL_FALSE; + else if (!ctx->Visual.rgbMode && rbType == GL_UNSIGNED_INT) { + /* write CI data to CI frame buffer */ + GLint row; + if (simpleZoom) { + for (row = 0; row < drawHeight; row++) { + GLuint index32[MAX_WIDTH]; + GLint col; + for (col = 0; col < drawWidth; col++) + index32[col] = src[col]; + rb->PutRow(ctx, rb, drawWidth, destX, destY, index32, NULL); + src += unpack.RowLength; + destY += yStep; + } + return GL_TRUE; + } } } - /* can't do a simple draw, have to use slow path */ + /* can't handle this pixel format and/or data type */ return GL_FALSE; } @@ -458,7 +337,7 @@ draw_index_pixels( GLcontext *ctx, GLint x, GLint y, const GLint imgX = x, imgY = y; const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0; GLint row, skipPixels; - struct sw_span span; + SWspan span; INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_INDEX); @@ -527,16 +406,9 @@ draw_stencil_pixels( GLcontext *ctx, GLint x, GLint y, width, height, GL_COLOR_INDEX, type, row, skipPixels); - _mesa_unpack_index_span(ctx, spanWidth, destType, values, - type, source, unpack, - ctx->_ImageTransferState); - if (ctx->_ImageTransferState & IMAGE_SHIFT_OFFSET_BIT) { - _mesa_shift_and_offset_stencil(ctx, spanWidth, values); - } - if (ctx->Pixel.MapStencilFlag) { - _mesa_map_stencil(ctx, spanWidth, values); - } - + _mesa_unpack_stencil_span(ctx, spanWidth, destType, values, + type, source, unpack, + ctx->_ImageTransferState); if (zoom) { _swrast_write_zoomed_stencil_span(ctx, x, y, spanWidth, spanX, spanY, values); @@ -564,12 +436,12 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, const GLboolean scaleOrBias = ctx->Pixel.DepthScale != 1.0 || ctx->Pixel.DepthBias != 0.0; const GLboolean zoom = ctx->Pixel.ZoomX != 1.0 || ctx->Pixel.ZoomY != 1.0; - struct sw_span span; + SWspan span; INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_Z); _swrast_span_default_color(ctx, &span); - + _swrast_span_default_secondary_color(ctx, &span); if (swrast->_FogEnabled) _swrast_span_default_fog(ctx, &span); if (ctx->Texture._EnabledCoordUnits) @@ -580,7 +452,8 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, && !scaleOrBias && !zoom && ctx->Visual.rgbMode - && width <= MAX_WIDTH) { + && width <= MAX_WIDTH + && !unpack->SwapBytes) { /* Special case: directly write 16-bit depth values */ GLint row; for (row = 0; row < height; row++) { @@ -600,7 +473,8 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, && !scaleOrBias && !zoom && ctx->Visual.rgbMode - && width <= MAX_WIDTH) { + && width <= MAX_WIDTH + && !unpack->SwapBytes) { /* Special case: shift 32-bit values down to Visual.depthBits */ const GLint shift = 32 - ctx->DrawBuffer->Visual.depthBits; GLint row; @@ -665,7 +539,7 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, -/* +/** * Draw RGBA image. */ static void @@ -677,19 +551,18 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, { SWcontext *swrast = SWRAST_CONTEXT(ctx); const GLint imgX = x, imgY = y; - struct gl_renderbuffer *rb = NULL; /* only used for quickDraw path */ const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0; - GLboolean quickDraw; GLfloat *convImage = NULL; - GLuint transferOps = ctx->_ImageTransferState; - struct sw_span span; - - INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA); + GLbitfield transferOps = ctx->_ImageTransferState; + SWspan span; /* Try an optimized glDrawPixels first */ - if (fast_draw_pixels(ctx, x, y, width, height, format, type, unpack, pixels)) + if (fast_draw_rgba_pixels(ctx, x, y, width, height, format, type, + unpack, pixels)) return; + INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA); + _swrast_span_default_secondary_color(ctx, &span); if (ctx->Depth.Test) _swrast_span_default_z(ctx, &span); if (swrast->_FogEnabled) @@ -697,18 +570,6 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, if (ctx->Texture._EnabledCoordUnits) _swrast_span_default_texcoords(ctx, &span); - if (swrast->_RasterMask == 0 && !zoom && x >= 0 && y >= 0 - && x + width <= (GLint) ctx->DrawBuffer->Width - && y + height <= (GLint) ctx->DrawBuffer->Height - && ctx->DrawBuffer->_NumColorDrawBuffers[0] == 1) { - quickDraw = GL_TRUE; - rb = ctx->DrawBuffer->_ColorDrawBuffers[0][0]; - } - else { - quickDraw = GL_FALSE; - rb = NULL; - } - if (ctx->Pixel.Convolution2DEnabled || ctx->Pixel.Separable2DEnabled) { /* Convolution has to be handled specially. We'll create an * intermediate image, applying all pixel transfer operations @@ -759,60 +620,74 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, type = GL_FLOAT; transferOps &= IMAGE_POST_CONVOLUTION_BITS; } + else if (ctx->Pixel.Convolution1DEnabled) { + /* we only want to apply 1D convolution to glTexImage1D */ + transferOps &= ~(IMAGE_CONVOLUTION_BIT | + IMAGE_POST_CONVOLUTION_SCALE_BIAS); + } + + if (ctx->DrawBuffer->_NumColorDrawBuffers[0] > 0 && + ctx->DrawBuffer->_ColorDrawBuffers[0][0]->DataType != GL_FLOAT && + ctx->Color.ClampFragmentColor != GL_FALSE) { + /* need to clamp colors before applying fragment ops */ + transferOps |= IMAGE_CLAMP_BIT; + } /* * General solution */ { + const GLboolean sink = (ctx->Pixel.MinMaxEnabled && ctx->MinMax.Sink) + || (ctx->Pixel.HistogramEnabled && ctx->Histogram.Sink); const GLbitfield interpMask = span.interpMask; const GLbitfield arrayMask = span.arrayMask; + const GLint srcStride + = _mesa_image_row_stride(unpack, width, format, type); GLint skipPixels = 0; + /* use span array for temp color storage */ + GLfloat *rgba = (GLfloat *) span.array->attribs[FRAG_ATTRIB_COL0]; /* if the span is wider than MAX_WIDTH we have to do it in chunks */ while (skipPixels < width) { const GLint spanWidth = MIN2(width - skipPixels, MAX_WIDTH); + const GLubyte *source + = (const GLubyte *) _mesa_image_address2d(unpack, pixels, + width, height, format, + type, 0, skipPixels); GLint row; - ASSERT(span.end <= MAX_WIDTH); - for (row = 0; row < height; row++) { - const GLvoid *source = _mesa_image_address2d(unpack, - pixels, width, height, format, type, row, skipPixels); - - /* Set these for each row since the _swrast_write_* function may - * change them while clipping. - */ - span.x = x + skipPixels; - span.y = y + row; - span.end = spanWidth; - span.arrayMask = arrayMask; - span.interpMask = interpMask; - - _mesa_unpack_color_span_chan(ctx, spanWidth, GL_RGBA, - (GLchan *) span.array->rgba, - format, type, source, unpack, - transferOps); - - if ((ctx->Pixel.MinMaxEnabled && ctx->MinMax.Sink) || - (ctx->Pixel.HistogramEnabled && ctx->Histogram.Sink)) - continue; - + /* get image row as float/RGBA */ + _mesa_unpack_color_span_float(ctx, spanWidth, GL_RGBA, rgba, + format, type, source, unpack, + transferOps); /* draw the span */ - if (quickDraw) { - rb->PutRow(ctx, rb, span.end, span.x, span.y, - span.array->rgba, NULL); - } - else if (zoom) { - _swrast_write_zoomed_rgba_span(ctx, imgX, imgY, &span, - (CONST GLchan (*)[4]) span.array->rgba); - } - else { - _swrast_write_rgba_span(ctx, &span); + if (!sink) { + /* Set these for each row since the _swrast_write_* functions + * may change them while clipping/rendering. + */ + span.array->ChanType = GL_FLOAT; + span.x = x + skipPixels; + span.y = y + row; + span.end = spanWidth; + span.arrayMask = arrayMask; + span.interpMask = interpMask; + if (zoom) { + _swrast_write_zoomed_rgba_span(ctx, imgX, imgY, &span, rgba); + } + else { + _swrast_write_rgba_span(ctx, &span); + } } - } + + source += srcStride; + } /* for row */ skipPixels += spanWidth; - } + } /* while skipPixels < width */ + + /* XXX this is ugly/temporary, to undo above change */ + span.array->ChanType = CHAN_TYPE; } if (convImage) { @@ -985,7 +860,8 @@ _swrast_DrawPixels( GLcontext *ctx, format, type, pixels)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels(invalid PBO access)"); - goto end; + RENDER_FINISH(swrast, ctx); + return; } buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, GL_READ_ONLY_ARB, @@ -993,7 +869,8 @@ _swrast_DrawPixels( GLcontext *ctx, if (!buf) { /* buffer is already mapped - that's an error */ _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels(PBO is mapped)"); - goto end; + RENDER_FINISH(swrast, ctx); + return; } pixels = ADD_POINTERS(buf, pixels); } @@ -1033,8 +910,6 @@ _swrast_DrawPixels( GLcontext *ctx, /* don't return yet, clean-up */ } -end: - RENDER_FINISH(swrast,ctx); if (unpack->BufferObj->Name) { diff --git a/dist/Mesa/src/mesa/swrast/s_fragprog.c b/dist/Mesa/src/mesa/swrast/s_fragprog.c index e47dbbdaf..89114ebc9 100644 --- a/dist/Mesa/src/mesa/swrast/s_fragprog.c +++ b/dist/Mesa/src/mesa/swrast/s_fragprog.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.2 + * Version: 7.0.3 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 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"), @@ -40,10 +40,12 @@ fetch_texel( GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda, { GLchan rgba[4]; SWcontext *swrast = SWRAST_CONTEXT(ctx); + const struct gl_texture_object *texObj = ctx->Texture.Unit[unit]._Current; + + lambda = CLAMP(lambda, texObj->MinLod, texObj->MaxLod); /* XXX use a float-valued TextureSample routine here!!! */ - swrast->TextureSample[unit](ctx, ctx->Texture.Unit[unit]._Current, - 1, (const GLfloat (*)[4]) texcoord, + swrast->TextureSample[unit](ctx, texObj, 1, (const GLfloat (*)[4]) texcoord, &lambda, &rgba); color[0] = CHAN_TO_FLOAT(rgba[0]); color[1] = CHAN_TO_FLOAT(rgba[1]); @@ -59,7 +61,7 @@ fetch_texel( GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda, static void fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4], const GLfloat texdx[4], const GLfloat texdy[4], - GLuint unit, GLfloat color[4] ) + GLfloat lodBias, GLuint unit, GLfloat color[4] ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); const struct gl_texture_object *texObj = ctx->Texture.Unit[unit]._Current; @@ -68,15 +70,17 @@ fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4], const GLfloat texH = (GLfloat) texImg->HeightScale; GLchan rgba[4]; - GLfloat lambda = _swrast_compute_lambda(texdx[0], texdy[0], /* ds/dx, ds/dy */ - texdx[1], texdy[1], /* dt/dx, dt/dy */ - texdx[3], texdy[2], /* dq/dx, dq/dy */ - texW, texH, - texcoord[0], texcoord[1], texcoord[3], - 1.0F / texcoord[3]); + GLfloat lambda + = _swrast_compute_lambda(texdx[0], texdy[0], /* ds/dx, ds/dy */ + texdx[1], texdy[1], /* dt/dx, dt/dy */ + texdx[3], texdy[2], /* dq/dx, dq/dy */ + texW, texH, + texcoord[0], texcoord[1], texcoord[3], + 1.0F / texcoord[3]) + lodBias; + + lambda = CLAMP(lambda, texObj->MinLod, texObj->MaxLod); - swrast->TextureSample[unit](ctx, ctx->Texture.Unit[unit]._Current, - 1, (const GLfloat (*)[4]) texcoord, + swrast->TextureSample[unit](ctx, texObj, 1, (const GLfloat (*)[4]) texcoord, &lambda, &rgba); color[0] = CHAN_TO_FLOAT(rgba[0]); color[1] = CHAN_TO_FLOAT(rgba[1]); @@ -114,7 +118,7 @@ init_machine(GLcontext *ctx, struct gl_program_machine *machine, if (ctx->Shader.CurrentProgram) { /* Store front/back facing value in register FOGC.Y */ - machine->Attribs[FRAG_ATTRIB_FOGC][col][1] = (GLfloat) ctx->_Facing; + machine->Attribs[FRAG_ATTRIB_FOGC][col][1] = 1.0 - span->facing; } machine->CurElement = col; diff --git a/dist/Mesa/src/mesa/swrast/s_linetemp.h b/dist/Mesa/src/mesa/swrast/s_linetemp.h index f7c5ab492..9e240a7d2 100644 --- a/dist/Mesa/src/mesa/swrast/s_linetemp.h +++ b/dist/Mesa/src/mesa/swrast/s_linetemp.h @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 6.5.3 * - * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 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"), @@ -35,8 +35,7 @@ * INTERP_RGBA - if defined, interpolate RGBA values * INTERP_SPEC - if defined, interpolate specular RGB values * INTERP_INDEX - if defined, interpolate color index values - * INTERP_TEX - if defined, interpolate unit 0 texcoords - * INTERP_MULTITEX - if defined, interpolate multi-texcoords + * INTERP_ATTRIBS - if defined, interpolate attribs (texcoords, varying, etc) * * When one can directly address pixels in the color buffer the following * macros can be defined and used to directly compute pixel addresses during @@ -70,7 +69,8 @@ static void NAME( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 ) { - struct sw_span span; + const SWcontext *swrast = SWRAST_CONTEXT(ctx); + SWspan span; GLuint interpFlags = 0; GLint x0 = (GLint) vert0->win[0]; GLint x1 = (GLint) vert1->win[0]; @@ -80,14 +80,15 @@ NAME( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 ) GLint numPixels; GLint xstep, ystep; #if defined(DEPTH_TYPE) - const GLint depthBits = ctx->Visual.depthBits; + const GLint depthBits = ctx->DrawBuffer->Visual.depthBits; const GLint fixedToDepthShift = depthBits <= 16 ? FIXED_SHIFT : 0; struct gl_renderbuffer *zrb = ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer; #define FixedToDepth(F) ((F) >> fixedToDepthShift) GLint zPtrXstep, zPtrYstep; DEPTH_TYPE *zPtr; #elif defined(INTERP_Z) - const GLint depthBits = ctx->Visual.depthBits; + const GLint depthBits = ctx->DrawBuffer->Visual.depthBits; +/*ctx->Visual.depthBits;*/ #endif #ifdef PIXEL_ADDRESS PIXEL_TYPE *pixelPtr; @@ -98,6 +99,8 @@ NAME( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 ) SETUP_CODE #endif + (void) swrast; + /* Cull primitives with malformed coordinates. */ { @@ -268,78 +271,54 @@ NAME( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 ) } else { /* don't use fixed point */ - span.z = (GLint) vert0->win[2]; + span.z = (GLuint) vert0->win[2]; span.zStep = (GLint) ((vert1->win[2] - vert0->win[2]) / numPixels); } } #endif #ifdef INTERP_FOG interpFlags |= SPAN_FOG; - span.fog = vert0->fog; - span.fogStep = (vert1->fog - vert0->fog) / numPixels; + span.attrStart[FRAG_ATTRIB_FOGC][0] = vert0->attrib[FRAG_ATTRIB_FOGC][0]; + span.attrStepX[FRAG_ATTRIB_FOGC][0] = (vert1->attrib[FRAG_ATTRIB_FOGC][0] + - vert0->attrib[FRAG_ATTRIB_FOGC][0]) / numPixels; #endif -#ifdef INTERP_TEX - interpFlags |= SPAN_TEXTURE; +#if defined(INTERP_ATTRIBS) + interpFlags |= (SPAN_TEXTURE | SPAN_VARYING); { + const GLfloat invLen = 1.0F / numPixels; const GLfloat invw0 = vert0->win[3]; const GLfloat invw1 = vert1->win[3]; - const GLfloat invLen = 1.0F / numPixels; - GLfloat ds, dt, dr, dq; - span.tex[0][0] = invw0 * vert0->texcoord[0][0]; - span.tex[0][1] = invw0 * vert0->texcoord[0][1]; - span.tex[0][2] = invw0 * vert0->texcoord[0][2]; - span.tex[0][3] = invw0 * vert0->texcoord[0][3]; - ds = (invw1 * vert1->texcoord[0][0]) - span.tex[0][0]; - dt = (invw1 * vert1->texcoord[0][1]) - span.tex[0][1]; - dr = (invw1 * vert1->texcoord[0][2]) - span.tex[0][2]; - dq = (invw1 * vert1->texcoord[0][3]) - span.tex[0][3]; - span.texStepX[0][0] = ds * invLen; - span.texStepX[0][1] = dt * invLen; - span.texStepX[0][2] = dr * invLen; - span.texStepX[0][3] = dq * invLen; - span.texStepY[0][0] = 0.0F; - span.texStepY[0][1] = 0.0F; - span.texStepY[0][2] = 0.0F; - span.texStepY[0][3] = 0.0F; - } -#endif -#ifdef INTERP_MULTITEX - interpFlags |= SPAN_TEXTURE; - { - const GLfloat invLen = 1.0F / numPixels; - GLuint u; - for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { - if (ctx->Texture.Unit[u]._ReallyEnabled) { - const GLfloat invw0 = vert0->win[3]; - const GLfloat invw1 = vert1->win[3]; - GLfloat ds, dt, dr, dq; - span.tex[u][0] = invw0 * vert0->texcoord[u][0]; - span.tex[u][1] = invw0 * vert0->texcoord[u][1]; - span.tex[u][2] = invw0 * vert0->texcoord[u][2]; - span.tex[u][3] = invw0 * vert0->texcoord[u][3]; - ds = (invw1 * vert1->texcoord[u][0]) - span.tex[u][0]; - dt = (invw1 * vert1->texcoord[u][1]) - span.tex[u][1]; - dr = (invw1 * vert1->texcoord[u][2]) - span.tex[u][2]; - dq = (invw1 * vert1->texcoord[u][3]) - span.tex[u][3]; - span.texStepX[u][0] = ds * invLen; - span.texStepX[u][1] = dt * invLen; - span.texStepX[u][2] = dr * invLen; - span.texStepX[u][3] = dq * invLen; - span.texStepY[u][0] = 0.0F; - span.texStepY[u][1] = 0.0F; - span.texStepY[u][2] = 0.0F; - span.texStepY[u][3] = 0.0F; - } - } + ATTRIB_LOOP_BEGIN + GLfloat ds, dt, dr, dq; + span.attrStart[attr][0] = invw0 * vert0->attrib[attr][0]; + span.attrStart[attr][1] = invw0 * vert0->attrib[attr][1]; + span.attrStart[attr][2] = invw0 * vert0->attrib[attr][2]; + span.attrStart[attr][3] = invw0 * vert0->attrib[attr][3]; + ds = (invw1 * vert1->attrib[attr][0]) - span.attrStart[attr][0]; + dt = (invw1 * vert1->attrib[attr][1]) - span.attrStart[attr][1]; + dr = (invw1 * vert1->attrib[attr][2]) - span.attrStart[attr][2]; + dq = (invw1 * vert1->attrib[attr][3]) - span.attrStart[attr][3]; + span.attrStepX[attr][0] = ds * invLen; + span.attrStepX[attr][1] = dt * invLen; + span.attrStepX[attr][2] = dr * invLen; + span.attrStepX[attr][3] = dq * invLen; + span.attrStepY[attr][0] = 0.0F; + span.attrStepY[attr][1] = 0.0F; + span.attrStepY[attr][2] = 0.0F; + span.attrStepY[attr][3] = 0.0F; + ATTRIB_LOOP_END } #endif INIT_SPAN(span, GL_LINE, numPixels, interpFlags, SPAN_XY); /* Need these for fragment prog texcoord interpolation */ - span.w = 1.0F; - span.dwdx = 0.0F; - span.dwdy = 0.0F; + span.attrStart[FRAG_ATTRIB_WPOS][3] = 1.0F; + span.attrStepX[FRAG_ATTRIB_WPOS][3] = 0.0F; + span.attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0F; + + span.facing = swrast->PointLineFacing; + /* * Draw @@ -440,8 +419,7 @@ NAME( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 ) #undef INTERP_FOG #undef INTERP_RGBA #undef INTERP_SPEC -#undef INTERP_TEX -#undef INTERP_MULTITEX +#undef INTERP_ATTRIBS #undef INTERP_INDEX #undef PIXEL_ADDRESS #undef PIXEL_TYPE diff --git a/dist/Mesa/src/mesa/swrast/s_pointtemp.h b/dist/Mesa/src/mesa/swrast/s_pointtemp.h index 94364643d..891ff2224 100644 --- a/dist/Mesa/src/mesa/swrast/s_pointtemp.h +++ b/dist/Mesa/src/mesa/swrast/s_pointtemp.h @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.3 + * Version: 7.0.3 * - * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 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"), @@ -105,6 +105,7 @@ NAME ( GLcontext *ctx, const SWvertex *vert ) */ span->interpMask = SPAN_FOG; span->arrayMask = SPAN_XY | SPAN_Z; + span->facing = swrast->PointLineFacing; span->attrStart[FRAG_ATTRIB_FOGC][0] = vert->attrib[FRAG_ATTRIB_FOGC][0]; span->attrStepX[FRAG_ATTRIB_FOGC][0] = 0.0; span->attrStepY[FRAG_ATTRIB_FOGC][0] = 0.0; @@ -217,9 +218,9 @@ NAME ( GLcontext *ctx, const SWvertex *vert ) } else { /* even size */ - xmin = (GLint) vert->win[0] - iRadius; + xmin = (GLint) (vert->win[0] + 0.5) - iRadius; xmax = xmin + iSize - 1; - ymin = (GLint) vert->win[1] - iRadius; + ymin = (GLint) (vert->win[1] + 0.5) - iRadius; ymax = ymin + iSize - 1; } #endif /*SMOOTH*/ diff --git a/dist/Mesa/src/mesa/swrast/s_readpix.c b/dist/Mesa/src/mesa/swrast/s_readpix.c index 4c3be5a83..8df15c870 100644 --- a/dist/Mesa/src/mesa/swrast/s_readpix.c +++ b/dist/Mesa/src/mesa/swrast/s_readpix.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 7.0.3 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 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"), @@ -54,7 +54,8 @@ read_index_pixels( GLcontext *ctx, struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer; GLint i; - ASSERT(rb); + if (!rb) + return; /* width should never be > MAX_WIDTH since we did clipping earlier */ ASSERT(width <= MAX_WIDTH); @@ -91,16 +92,17 @@ read_depth_pixels( GLcontext *ctx, const GLboolean biasOrScale = ctx->Pixel.DepthScale != 1.0 || ctx->Pixel.DepthBias != 0.0; + if (!rb) + return; + /* clipping should have been done already */ ASSERT(x >= 0); ASSERT(y >= 0); - ASSERT(x + width <= rb->Width); - ASSERT(y + height <= rb->Height); + ASSERT(x + width <= (GLint) rb->Width); + ASSERT(y + height <= (GLint) rb->Height); /* width should never be > MAX_WIDTH since we did clipping earlier */ ASSERT(width <= MAX_WIDTH); - ASSERT(rb); - if (type == GL_UNSIGNED_SHORT && fb->Visual.depthBits == 16 && !biasOrScale && !packing->SwapBytes) { /* Special case: directly read 16-bit unsigned depth values. */ @@ -117,7 +119,7 @@ read_depth_pixels( GLcontext *ctx, && !biasOrScale && !packing->SwapBytes) { /* Special case: directly read 24-bit unsigned depth values. */ GLint j; - ASSERT(rb->InternalFormat == GL_DEPTH_COMPONENT32); + ASSERT(rb->InternalFormat == GL_DEPTH_COMPONENT24); ASSERT(rb->DataType == GL_UNSIGNED_INT); for (j = 0; j < height; j++, y++) { GLuint *dest = (GLuint *) @@ -127,7 +129,8 @@ read_depth_pixels( GLcontext *ctx, rb->GetRow(ctx, rb, width, x, y, dest); /* convert range from 24-bit to 32-bit */ for (k = 0; k < width; k++) { - dest[k] = (dest[k] << 8) | (dest[k] >> 24); + /* Note: put MSByte of 24-bit value into LSByte */ + dest[k] = (dest[k] << 8) | ((dest[k] >> 16) & 0xff); } } } @@ -171,7 +174,8 @@ read_stencil_pixels( GLcontext *ctx, struct gl_renderbuffer *rb = fb->_StencilBuffer; GLint j; - ASSERT(rb); + if (!rb) + return; /* width should never be > MAX_WIDTH since we did clipping earlier */ ASSERT(width <= MAX_WIDTH); @@ -193,79 +197,113 @@ read_stencil_pixels( GLcontext *ctx, /** - * Optimized glReadPixels for particular pixel formats: - * GL_UNSIGNED_BYTE, GL_RGBA - * when pixel scaling, biasing and mapping are disabled. + * Optimized glReadPixels for particular pixel formats when pixel + * scaling, biasing, mapping, etc. are disabled. + * \return GL_TRUE if success, GL_FALSE if unable to do the readpixels */ static GLboolean -read_fast_rgba_pixels( GLcontext *ctx, +fast_read_rgba_pixels( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels, - const struct gl_pixelstore_attrib *packing ) + const struct gl_pixelstore_attrib *packing, + GLbitfield transferOps) { struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer; - /* can't do scale, bias, mapping, etc */ - if (ctx->_ImageTransferState) - return GL_FALSE; + if (!rb) + return GL_FALSE; + + ASSERT(rb->_BaseFormat == GL_RGBA || rb->_BaseFormat == GL_RGB); + + /* clipping should have already been done */ + ASSERT(x + width <= (GLint) rb->Width); + ASSERT(y + height <= (GLint) rb->Height); - /* can't do fancy pixel packing */ - if (packing->Alignment != 1 || packing->SwapBytes || packing->LsbFirst) + /* check for things we can't handle here */ + if (transferOps || + packing->SwapBytes || + packing->LsbFirst) { return GL_FALSE; + } - { - GLint srcX = x; - GLint srcY = y; - GLint readWidth = width; /* actual width read */ - GLint readHeight = height; /* actual height read */ - GLint skipPixels = packing->SkipPixels; - GLint skipRows = packing->SkipRows; - GLint rowLength; - - if (packing->RowLength > 0) - rowLength = packing->RowLength; - else - rowLength = width; - - /* - * Ready to read! - * The window region at (destX, destY) of size (readWidth, readHeight) - * will be read back. - * We'll write pixel data to buffer pointed to by "pixels" but we'll - * skip "skipRows" rows and skip "skipPixels" pixels/row. - */ -#if CHAN_BITS == 8 - if (format == GL_RGBA && type == GL_UNSIGNED_BYTE) -#elif CHAN_BITS == 16 - if (format == GL_RGBA && type == GL_UNSIGNED_SHORT) -#else - if (0) -#endif - { - GLchan *dest = (GLchan *) pixels - + (skipRows * rowLength + skipPixels) * 4; - GLint row; - - if (packing->Invert) { - /* start at top and go down */ - dest += (readHeight - 1) * rowLength * 4; - rowLength = -rowLength; - } + if (format == GL_RGBA && rb->DataType == type) { + const GLint dstStride = _mesa_image_row_stride(packing, width, + format, type); + GLubyte *dest + = (GLubyte *) _mesa_image_address2d(packing, pixels, width, height, + format, type, 0, 0); + GLint row; + ASSERT(rb->GetRow); + for (row = 0; row < height; row++) { + rb->GetRow(ctx, rb, width, x, y + row, dest); + dest += dstStride; + } + return GL_TRUE; + } - ASSERT(rb->GetRow); - for (row=0; row<readHeight; row++) { - rb->GetRow(ctx, rb, readWidth, srcX, srcY, dest); - dest += rowLength * 4; - srcY++; + if (format == GL_RGB && + rb->DataType == GL_UNSIGNED_BYTE && + type == GL_UNSIGNED_BYTE) { + const GLint dstStride = _mesa_image_row_stride(packing, width, + format, type); + GLubyte *dest + = (GLubyte *) _mesa_image_address2d(packing, pixels, width, height, + format, type, 0, 0); + GLint row; + ASSERT(rb->GetRow); + for (row = 0; row < height; row++) { + GLubyte tempRow[MAX_WIDTH][4]; + GLint col; + rb->GetRow(ctx, rb, width, x, y + row, tempRow); + /* convert RGBA to RGB */ + for (col = 0; col < width; col++) { + dest[col * 3 + 0] = tempRow[col][0]; + dest[col * 3 + 1] = tempRow[col][1]; + dest[col * 3 + 2] = tempRow[col][2]; } - return GL_TRUE; - } - else { - /* can't do this format/type combination */ - return GL_FALSE; + dest += dstStride; } + return GL_TRUE; + } + + /* not handled */ + return GL_FALSE; +} + + +/** + * When we're using a low-precision color buffer (like 16-bit 5/6/5) + * we have to adjust our color values a bit to pass conformance. + * The problem is when a 5 or 6-bit color value is convert to an 8-bit + * value and then a floating point value, the floating point values don't + * increment uniformly as the 5 or 6-bit value is incremented. + * + * This function adjusts floating point values to compensate. + */ +static void +adjust_colors(GLcontext *ctx, GLuint n, GLfloat rgba[][4]) +{ + const GLuint rShift = 8 - ctx->Visual.redBits; + const GLuint gShift = 8 - ctx->Visual.greenBits; + const GLuint bShift = 8 - ctx->Visual.blueBits; + const GLfloat rScale = 1.0F / (GLfloat) ((1 << ctx->Visual.redBits ) - 1); + const GLfloat gScale = 1.0F / (GLfloat) ((1 << ctx->Visual.greenBits) - 1); + const GLfloat bScale = 1.0F / (GLfloat) ((1 << ctx->Visual.blueBits ) - 1); + GLuint i; + for (i = 0; i < n; i++) { + GLint r, g, b; + /* convert float back to ubyte */ + CLAMPED_FLOAT_TO_UBYTE(r, rgba[i][RCOMP]); + CLAMPED_FLOAT_TO_UBYTE(g, rgba[i][GCOMP]); + CLAMPED_FLOAT_TO_UBYTE(b, rgba[i][BCOMP]); + /* using only the N most significant bits of the ubyte value, convert to + * float in [0,1]. + */ + rgba[i][RCOMP] = (GLfloat) (r >> rShift) * rScale; + rgba[i][GCOMP] = (GLfloat) (g >> gShift) * gScale; + rgba[i][BCOMP] = (GLfloat) (b >> bShift) * bScale; } } @@ -281,14 +319,22 @@ read_rgba_pixels( GLcontext *ctx, GLenum format, GLenum type, GLvoid *pixels, const struct gl_pixelstore_attrib *packing ) { + SWcontext *swrast = SWRAST_CONTEXT(ctx); + GLbitfield transferOps = ctx->_ImageTransferState; struct gl_framebuffer *fb = ctx->ReadBuffer; struct gl_renderbuffer *rb = fb->_ColorReadBuffer; - ASSERT(rb); + if (!rb) + return; + + if (type == GL_FLOAT && ((ctx->Color.ClampReadColor == GL_TRUE) || + (ctx->Color.ClampReadColor == GL_FIXED_ONLY_ARB && + rb->DataType != GL_FLOAT))) + transferOps |= IMAGE_CLAMP_BIT; /* Try optimized path first */ - if (read_fast_rgba_pixels( ctx, x, y, width, height, - format, type, pixels, packing )) { + if (fast_read_rgba_pixels(ctx, x, y, width, height, + format, type, pixels, packing, transferOps)) { return; /* done! */ } @@ -296,7 +342,6 @@ read_rgba_pixels( GLcontext *ctx, ASSERT(width <= MAX_WIDTH); if (ctx->Pixel.Convolution2DEnabled || ctx->Pixel.Separable2DEnabled) { - const GLuint transferOps = ctx->_ImageTransferState; GLfloat *dest, *src, *tmpImage, *convImage; GLint row; @@ -315,22 +360,21 @@ read_rgba_pixels( GLcontext *ctx, /* read full RGBA, FLOAT image */ dest = tmpImage; for (row = 0; row < height; row++, y++) { - GLchan rgba[MAX_WIDTH][4]; if (fb->Visual.rgbMode) { - _swrast_read_rgba_span(ctx, rb, width, x, y, rgba); + _swrast_read_rgba_span(ctx, rb, width, x, y, GL_FLOAT, dest); } else { GLuint index[MAX_WIDTH]; ASSERT(rb->DataType == GL_UNSIGNED_INT); rb->GetRow(ctx, rb, width, x, y, index); - if (ctx->Pixel.IndexShift != 0 || ctx->Pixel.IndexOffset !=0 ) { - _mesa_map_ci(ctx, width, index); - } - _mesa_map_ci_to_rgba_chan(ctx, width, index, rgba); + _mesa_apply_ci_transfer_ops(ctx, + transferOps & IMAGE_SHIFT_OFFSET_BIT, + width, index); + _mesa_map_ci_to_rgba(ctx, width, index, (GLfloat (*)[4]) dest); } - _mesa_pack_rgba_span_chan(ctx, width, (const GLchan (*)[4]) rgba, - GL_RGBA, GL_FLOAT, dest, &ctx->DefaultPacking, - transferOps & IMAGE_PRE_CONVOLUTION_BITS); + _mesa_apply_rgba_transfer_ops(ctx, + transferOps & IMAGE_PRE_CONVOLUTION_BITS, + width, (GLfloat (*)[4]) dest); dest += width * 4; } @@ -350,8 +394,7 @@ read_rgba_pixels( GLcontext *ctx, GLvoid *dest; dest = _mesa_image_address2d(packing, pixels, width, height, format, type, row, 0); - _mesa_pack_rgba_span_float(ctx, width, - (const GLfloat (*)[4]) src, + _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) src, format, type, dest, packing, transferOps & IMAGE_POST_CONVOLUTION_BITS); src += width * 4; @@ -360,45 +403,47 @@ read_rgba_pixels( GLcontext *ctx, } else { /* no convolution */ + const GLint dstStride + = _mesa_image_row_stride(packing, width, format, type); + GLfloat (*rgba)[4] = swrast->SpanArrays->attribs[FRAG_ATTRIB_COL0]; GLint row; + GLubyte *dst + = (GLubyte *) _mesa_image_address2d(packing, pixels, width, height, + format, type, 0, 0); + + /* make sure we don't apply 1D convolution */ + transferOps &= ~(IMAGE_CONVOLUTION_BIT | + IMAGE_POST_CONVOLUTION_SCALE_BIAS); + for (row = 0; row < height; row++, y++) { - GLchan rgba[MAX_WIDTH][4]; - GLvoid *dst; + + /* Get float rgba pixels */ if (fb->Visual.rgbMode) { - _swrast_read_rgba_span(ctx, rb, width, x, y, rgba); + _swrast_read_rgba_span(ctx, rb, width, x, y, GL_FLOAT, rgba); } else { + /* read CI and convert to RGBA */ GLuint index[MAX_WIDTH]; ASSERT(rb->DataType == GL_UNSIGNED_INT); rb->GetRow(ctx, rb, width, x, y, index); - if (ctx->Pixel.IndexShift != 0 || ctx->Pixel.IndexOffset != 0) { - _mesa_map_ci(ctx, width, index); - } - _mesa_map_ci_to_rgba_chan(ctx, width, index, rgba); + _mesa_apply_ci_transfer_ops(ctx, + transferOps & IMAGE_SHIFT_OFFSET_BIT, + width, index); + _mesa_map_ci_to_rgba(ctx, width, index, rgba); } - dst = _mesa_image_address2d(packing, pixels, width, height, - format, type, row, 0); - if (fb->Visual.redBits < CHAN_BITS || - fb->Visual.greenBits < CHAN_BITS || - fb->Visual.blueBits < CHAN_BITS) { - /* Requantize the color values into floating point and go from - * there. This fixes conformance failures with 5/6/5 color - * buffers, for example. - */ - GLfloat rgbaf[MAX_WIDTH][4]; - _mesa_chan_to_float_span(ctx, width, - (CONST GLchan (*)[4]) rgba, rgbaf); - _mesa_pack_rgba_span_float(ctx, width, - (CONST GLfloat (*)[4]) rgbaf, - format, type, dst, packing, - ctx->_ImageTransferState); - } - else { - /* GLubytes are fine */ - _mesa_pack_rgba_span_chan(ctx, width, (CONST GLchan (*)[4]) rgba, - format, type, dst, packing, - ctx->_ImageTransferState); + + /* apply fudge factor for shallow color buffers */ + if (fb->Visual.redBits < 8 || + fb->Visual.greenBits < 8 || + fb->Visual.blueBits < 8) { + adjust_colors(ctx, width, rgba); } + + /* pack the row of RGBA pixels into user's buffer */ + _mesa_pack_rgba_span_float(ctx, width, rgba, format, type, dst, + packing, transferOps); + + dst += dstStride; } } } @@ -425,8 +470,8 @@ read_depth_stencil_pixels(GLcontext *ctx, depthRb = ctx->ReadBuffer->_DepthBuffer; stencilRb = ctx->ReadBuffer->_StencilBuffer; - ASSERT(depthRb); - ASSERT(stencilRb); + if (!depthRb || !stencilRb) + return; depthRb = ctx->ReadBuffer->Attachment[BUFFER_DEPTH].Renderbuffer; stencilRb = ctx->ReadBuffer->Attachment[BUFFER_STENCIL].Renderbuffer; @@ -525,6 +570,7 @@ _swrast_ReadPixels( GLcontext *ctx, /* Do all needed clipping here, so that we can forget about it later */ if (!_mesa_clip_readpixels(ctx, &x, &y, &width, &height, &clippedPacking)) { /* The ReadPixels region is totally outside the window bounds */ + RENDER_FINISH(swrast, ctx); return; } @@ -535,7 +581,8 @@ _swrast_ReadPixels( GLcontext *ctx, format, type, pixels)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(invalid PBO access)"); - goto end; + RENDER_FINISH(swrast, ctx); + return; } buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, GL_WRITE_ONLY_ARB, @@ -543,7 +590,8 @@ _swrast_ReadPixels( GLcontext *ctx, if (!buf) { /* buffer is already mapped - that's an error */ _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(PBO is mapped)"); - goto end; + RENDER_FINISH(swrast, ctx); + return; } pixels = ADD_POINTERS(buf, pixels); } @@ -584,8 +632,6 @@ _swrast_ReadPixels( GLcontext *ctx, /* don't return yet, clean-up */ } - -end: RENDER_FINISH(swrast, ctx); if (clippedPacking.BufferObj->Name) { diff --git a/dist/Mesa/src/mesa/swrast/s_texfilter.c b/dist/Mesa/src/mesa/swrast/s_texfilter.c index 629b4ec13..084d65f55 100644 --- a/dist/Mesa/src/mesa/swrast/s_texfilter.c +++ b/dist/Mesa/src/mesa/swrast/s_texfilter.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.1 + * Version: 7.0.3 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 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"), @@ -590,13 +590,13 @@ compute_min_mag_ranges(const struct gl_texture_object *tObj, } #endif /* DEBUG */ - if (lambda[0] <= minMagThresh && lambda[n-1] <= minMagThresh) { + if (lambda[0] <= minMagThresh && (n <= 1 || lambda[n-1] <= minMagThresh)) { /* magnification for whole span */ *magStart = 0; *magEnd = n; *minStart = *minEnd = 0; } - else if (lambda[0] > minMagThresh && lambda[n-1] > minMagThresh) { + else if (lambda[0] > minMagThresh && (n <=1 || lambda[n-1] > minMagThresh)) { /* minification for whole span */ *minStart = 0; *minEnd = n; @@ -1043,7 +1043,7 @@ sample_2d_linear_repeat(GLcontext *ctx, ASSERT(tObj->WrapS == GL_REPEAT); ASSERT(tObj->WrapT == GL_REPEAT); ASSERT(img->Border == 0); - ASSERT(img->_BaseFormat != GL_COLOR_INDEX); + ASSERT(img->TexFormat->BaseFormat != GL_COLOR_INDEX); ASSERT(img->_IsPowerOfTwo); COMPUTE_LINEAR_REPEAT_TEXEL_LOCATION(texcoord[0], u, width, i0, i1); @@ -1196,7 +1196,10 @@ sample_linear_2d( GLcontext *ctx, GLuint i; struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel]; (void) lambda; - if (tObj->WrapS == GL_REPEAT && tObj->WrapT == GL_REPEAT) { + if (tObj->WrapS == GL_REPEAT && + tObj->WrapT == GL_REPEAT && + image->Border == 0 && + image->_IsPowerOfTwo) { for (i=0;i<n;i++) { sample_2d_linear_repeat(ctx, tObj, image, texcoords[i], rgba[i]); } @@ -1235,7 +1238,7 @@ opt_sample_rgb_2d( GLcontext *ctx, ASSERT(tObj->WrapS==GL_REPEAT); ASSERT(tObj->WrapT==GL_REPEAT); ASSERT(img->Border==0); - ASSERT(img->_BaseFormat==GL_RGB); + ASSERT(img->TexFormat->MesaFormat==MESA_FORMAT_RGB); ASSERT(img->_IsPowerOfTwo); for (k=0; k<n; k++) { @@ -1276,7 +1279,7 @@ opt_sample_rgba_2d( GLcontext *ctx, ASSERT(tObj->WrapS==GL_REPEAT); ASSERT(tObj->WrapT==GL_REPEAT); ASSERT(img->Border==0); - ASSERT(img->_BaseFormat==GL_RGBA); + ASSERT(img->TexFormat->MesaFormat==MESA_FORMAT_RGBA); ASSERT(img->_IsPowerOfTwo); for (i = 0; i < n; i++) { @@ -1306,7 +1309,7 @@ sample_lambda_2d( GLcontext *ctx, const GLboolean repeatNoBorderPOT = (tObj->WrapS == GL_REPEAT) && (tObj->WrapT == GL_REPEAT) && (tImg->Border == 0 && (tImg->Width == tImg->RowStride)) - && (tImg->_BaseFormat != GL_COLOR_INDEX) + && (tImg->TexFormat->BaseFormat != GL_COLOR_INDEX) && tImg->_IsPowerOfTwo; ASSERT(lambda != NULL); @@ -1321,16 +1324,10 @@ sample_lambda_2d( GLcontext *ctx, if (repeatNoBorderPOT) { switch (tImg->TexFormat->MesaFormat) { case MESA_FORMAT_RGB: - case MESA_FORMAT_RGB888: - /*case MESA_FORMAT_BGR888:*/ opt_sample_rgb_2d(ctx, tObj, m, texcoords + minStart, NULL, rgba + minStart); break; case MESA_FORMAT_RGBA: - case MESA_FORMAT_RGBA8888: - case MESA_FORMAT_ARGB8888: - /*case MESA_FORMAT_ABGR8888:*/ - /*case MESA_FORMAT_BGRA8888:*/ opt_sample_rgba_2d(ctx, tObj, m, texcoords + minStart, NULL, rgba + minStart); break; @@ -1384,16 +1381,10 @@ sample_lambda_2d( GLcontext *ctx, if (repeatNoBorderPOT) { switch (tImg->TexFormat->MesaFormat) { case MESA_FORMAT_RGB: - case MESA_FORMAT_RGB888: - /*case MESA_FORMAT_BGR888:*/ opt_sample_rgb_2d(ctx, tObj, m, texcoords + magStart, NULL, rgba + magStart); break; case MESA_FORMAT_RGBA: - case MESA_FORMAT_RGBA8888: - case MESA_FORMAT_ARGB8888: - /*case MESA_FORMAT_ABGR8888:*/ - /*case MESA_FORMAT_BGRA8888:*/ opt_sample_rgba_2d(ctx, tObj, m, texcoords + magStart, NULL, rgba + magStart); break; @@ -2024,6 +2015,60 @@ sample_lambda_cube( GLcontext *ctx, /* Texture Rectangle Sampling Functions */ /**********************************************************************/ + +/** + * Do clamp/wrap for a texture rectangle coord, GL_NEAREST filter mode. + */ +static INLINE GLint +clamp_rect_coord_nearest(GLenum wrapMode, GLfloat coord, GLint max) +{ + if (wrapMode == GL_CLAMP) { + return IFLOOR( CLAMP(coord, 0.0F, max - 1) ); + } + else if (wrapMode == GL_CLAMP_TO_EDGE) { + return IFLOOR( CLAMP(coord, 0.5F, max - 0.5F) ); + } + else { + return IFLOOR( CLAMP(coord, -0.5F, max + 0.5F) ); + } +} + + +/* + * As above, but GL_LINEAR filtering. + */ +static INLINE void +clamp_rect_coord_linear(GLenum wrapMode, GLfloat coord, GLint max, + GLint *i0out, GLint *i1out) +{ + GLfloat fcol; + GLint i0, i1; + if (wrapMode == GL_CLAMP) { + /* Not exactly what the spec says, but it matches NVIDIA output */ + fcol = CLAMP(coord - 0.5F, 0.0, max-1); + i0 = IFLOOR(fcol); + i1 = i0 + 1; + } + else if (wrapMode == GL_CLAMP_TO_EDGE) { + fcol = CLAMP(coord, 0.5F, max - 0.5F); + fcol -= 0.5F; + i0 = IFLOOR(fcol); + i1 = i0 + 1; + if (i1 > max - 1) + i1 = max - 1; + } + else { + ASSERT(wrapMode == GL_CLAMP_TO_BORDER); + fcol = CLAMP(coord, -0.5F, max + 0.5F); + fcol -= 0.5F; + i0 = IFLOOR(fcol); + i1 = i0 + 1; + } + *i0out = i0; + *i1out = i1; +} + + static void sample_nearest_rect(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, @@ -2046,31 +2091,12 @@ sample_nearest_rect(GLcontext *ctx, ASSERT(tObj->WrapT == GL_CLAMP || tObj->WrapT == GL_CLAMP_TO_EDGE || tObj->WrapT == GL_CLAMP_TO_BORDER); - ASSERT(img->_BaseFormat != GL_COLOR_INDEX); + ASSERT(img->TexFormat->BaseFormat != GL_COLOR_INDEX); - /* XXX move Wrap mode tests outside of loops for common cases */ for (i = 0; i < n; i++) { GLint row, col; - /* NOTE: we DO NOT use [0, 1] texture coordinates! */ - if (tObj->WrapS == GL_CLAMP) { - col = IFLOOR( CLAMP(texcoords[i][0], 0.0F, width - 1) ); - } - else if (tObj->WrapS == GL_CLAMP_TO_EDGE) { - col = IFLOOR( CLAMP(texcoords[i][0], 0.5F, width - 0.5F) ); - } - else { - col = IFLOOR( CLAMP(texcoords[i][0], -0.5F, width + 0.5F) ); - } - if (tObj->WrapT == GL_CLAMP) { - row = IFLOOR( CLAMP(texcoords[i][1], 0.0F, height - 1) ); - } - else if (tObj->WrapT == GL_CLAMP_TO_EDGE) { - row = IFLOOR( CLAMP(texcoords[i][1], 0.5F, height - 0.5F) ); - } - else { - row = IFLOOR( CLAMP(texcoords[i][1], -0.5F, height + 0.5F) ); - } - + col = clamp_rect_coord_nearest(tObj->WrapS, texcoords[i][0], width); + row = clamp_rect_coord_nearest(tObj->WrapT, texcoords[i][1], height); if (col < 0 || col > width_minus_1 || row < 0 || row > height_minus_1) COPY_CHAN4(rgba[i], tObj->_BorderChan); else @@ -2101,7 +2127,7 @@ sample_linear_rect(GLcontext *ctx, ASSERT(tObj->WrapT == GL_CLAMP || tObj->WrapT == GL_CLAMP_TO_EDGE || tObj->WrapT == GL_CLAMP_TO_BORDER); - ASSERT(img->_BaseFormat != GL_COLOR_INDEX); + ASSERT(img->TexFormat->BaseFormat != GL_COLOR_INDEX); /* XXX lots of opportunity for optimization in this loop */ for (i = 0; i < n; i++) { @@ -2249,8 +2275,8 @@ sample_depth_texture( GLcontext *ctx, (void) lambda; - ASSERT(tObj->Image[0][tObj->BaseLevel]->_BaseFormat == GL_DEPTH_COMPONENT || - tObj->Image[0][tObj->BaseLevel]->_BaseFormat == GL_DEPTH_STENCIL_EXT); + ASSERT(img->TexFormat->BaseFormat == GL_DEPTH_COMPONENT || + img->TexFormat->BaseFormat == GL_DEPTH_STENCIL_EXT); ASSERT(tObj->Target == GL_TEXTURE_1D || tObj->Target == GL_TEXTURE_2D || @@ -2284,9 +2310,17 @@ sample_depth_texture( GLcontext *ctx, for (i = 0; i < n; i++) { GLfloat depthSample; GLint col, row; - /* XXX fix for texture rectangle! */ - COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoords[i][0], width, col); - COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, texcoords[i][1], height, row); + + if (tObj->Target == GL_TEXTURE_RECTANGLE_ARB) { + col = clamp_rect_coord_nearest(tObj->WrapS, texcoords[i][0], width); + row = clamp_rect_coord_nearest(tObj->WrapT, texcoords[i][1], height); + } + else { + COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoords[i][0], + width, col); + COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, texcoords[i][1], + height, row); + } if (col >= 0 && row >= 0 && col < width && row < height) { img->FetchTexelf(img, col, row, 0, &depthSample); } @@ -2360,9 +2394,18 @@ sample_depth_texture( GLcontext *ctx, GLfloat u, v; GLuint useBorderTexel; - /* XXX fix for texture rectangle! */ - COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, texcoords[i][0], u, width, i0, i1); - COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapT, texcoords[i][1], v, height,j0, j1); + if (tObj->Target == GL_TEXTURE_RECTANGLE_ARB) { + clamp_rect_coord_linear(tObj->WrapS, texcoords[i][0], + width, &i0, &i1); + clamp_rect_coord_linear(tObj->WrapT, texcoords[i][1], + height, &j0, &j1); + } + else { + COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, texcoords[i][0], + u, width, i0, i1); + COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapT, texcoords[i][1], + v, height,j0, j1); + } useBorderTexel = 0; if (img->Border) { @@ -2550,7 +2593,7 @@ sample_depth_texture2(const GLcontext *ctx, * GL_TEXTURE_COMPARE_SGIX == GL_TRUE but the current texture object * isn't a depth texture. */ - if (texImage->_BaseFormat != GL_DEPTH_COMPONENT) { + if (texImage->TexFormat->BaseFormat != GL_DEPTH_COMPONENT) { _mesa_problem(ctx,"GL_TEXTURE_COMPARE_SGIX enabled with non-depth texture"); return; } @@ -2653,7 +2696,7 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, } else { const GLboolean needLambda = (GLboolean) (t->MinFilter != t->MagFilter); - const GLenum format = t->Image[0][t->BaseLevel]->_BaseFormat; + const GLenum format = t->Image[0][t->BaseLevel]->TexFormat->BaseFormat; switch (t->Target) { case GL_TEXTURE_1D: @@ -2725,7 +2768,10 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, return &sample_nearest_cube; } case GL_TEXTURE_RECTANGLE_NV: - if (needLambda) { + if (format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL_EXT) { + return &sample_depth_texture; + } + else if (needLambda) { return &sample_lambda_rect; } else if (t->MinFilter == GL_LINEAR) { diff --git a/dist/Mesa/src/mesa/swrast/s_triangle.c b/dist/Mesa/src/mesa/swrast/s_triangle.c index a1cbd881a..fc40084be 100644 --- a/dist/Mesa/src/mesa/swrast/s_triangle.c +++ b/dist/Mesa/src/mesa/swrast/s_triangle.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 6.5.3 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 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"), @@ -58,7 +58,7 @@ _swrast_culltriangle( GLcontext *ctx, GLfloat fy = v2->win[1] - v0->win[1]; GLfloat c = ex*fy-ey*fx; - if (c * SWRAST_CONTEXT(ctx)->_BackfaceSign > 0) + if (c * SWRAST_CONTEXT(ctx)->_BackfaceCullSign > 0) return 0; return 1; @@ -67,24 +67,9 @@ _swrast_culltriangle( GLcontext *ctx, /* - * Render a flat-shaded color index triangle. + * Render a smooth or flat-shaded color index triangle. */ -#define NAME flat_ci_triangle -#define INTERP_Z 1 -#define INTERP_FOG 1 -#define SETUP_CODE \ - span.interpMask |= SPAN_INDEX; \ - span.index = FloatToFixed(v2->index);\ - span.indexStep = 0; -#define RENDER_SPAN( span ) _swrast_write_index_span(ctx, &span); -#include "s_tritemp.h" - - - -/* - * Render a smooth-shaded color index triangle. - */ -#define NAME smooth_ci_triangle +#define NAME ci_triangle #define INTERP_Z 1 #define INTERP_FOG 1 #define INTERP_INDEX 1 @@ -139,7 +124,7 @@ _swrast_culltriangle( GLcontext *ctx, * Render an RGB, GL_DECAL, textured triangle. * Interpolate S,T only w/out mipmapping or perspective correction. * - * No fog. + * No fog. No depth testing. */ #define NAME simple_textured_triangle #define INTERP_INT_TEX 1 @@ -163,6 +148,7 @@ _swrast_culltriangle( GLcontext *ctx, #define RENDER_SPAN( span ) \ GLuint i; \ + GLchan rgb[MAX_WIDTH][3]; \ span.intTex[0] -= FIXED_HALF; /* off-by-one error? */ \ span.intTex[1] -= FIXED_HALF; \ for (i = 0; i < span.end; i++) { \ @@ -170,13 +156,13 @@ _swrast_culltriangle( GLcontext *ctx, GLint t = FixedToInt(span.intTex[1]) & tmask; \ GLint pos = (t << twidth_log2) + s; \ pos = pos + pos + pos; /* multiply by 3 */ \ - span.array->rgb[i][RCOMP] = texture[pos]; \ - span.array->rgb[i][GCOMP] = texture[pos+1]; \ - span.array->rgb[i][BCOMP] = texture[pos+2]; \ + rgb[i][RCOMP] = texture[pos]; \ + rgb[i][GCOMP] = texture[pos+1]; \ + rgb[i][BCOMP] = texture[pos+2]; \ span.intTex[0] += span.intTexStep[0]; \ span.intTex[1] += span.intTexStep[1]; \ } \ - rb->PutRowRGB(ctx, rb, span.end, span.x, span.y, span.array->rgb, NULL); + rb->PutRowRGB(ctx, rb, span.end, span.x, span.y, rgb, NULL); #include "s_tritemp.h" @@ -214,6 +200,7 @@ _swrast_culltriangle( GLcontext *ctx, #define RENDER_SPAN( span ) \ GLuint i; \ + GLchan rgb[MAX_WIDTH][3]; \ span.intTex[0] -= FIXED_HALF; /* off-by-one error? */ \ span.intTex[1] -= FIXED_HALF; \ for (i = 0; i < span.end; i++) { \ @@ -223,9 +210,9 @@ _swrast_culltriangle( GLcontext *ctx, GLint t = FixedToInt(span.intTex[1]) & tmask; \ GLint pos = (t << twidth_log2) + s; \ pos = pos + pos + pos; /* multiply by 3 */ \ - span.array->rgb[i][RCOMP] = texture[pos]; \ - span.array->rgb[i][GCOMP] = texture[pos+1]; \ - span.array->rgb[i][BCOMP] = texture[pos+2]; \ + rgb[i][RCOMP] = texture[pos]; \ + rgb[i][GCOMP] = texture[pos+1]; \ + rgb[i][BCOMP] = texture[pos+2]; \ zRow[i] = z; \ span.array->mask[i] = 1; \ } \ @@ -236,8 +223,7 @@ _swrast_culltriangle( GLcontext *ctx, span.intTex[1] += span.intTexStep[1]; \ span.z += span.zStep; \ } \ - rb->PutRowRGB(ctx, rb, span.end, span.x, span.y, \ - span.array->rgb, span.array->mask); + rb->PutRowRGB(ctx, rb, span.end, span.x, span.y, rgb, span.array->mask); #include "s_tritemp.h" @@ -278,7 +264,7 @@ ilerp_2d(GLint ia, GLint ib, GLint v00, GLint v10, GLint v01, GLint v11) * texture env modes. */ static INLINE void -affine_span(GLcontext *ctx, struct sw_span *span, +affine_span(GLcontext *ctx, SWspan *span, struct affine_info *info) { GLchan sample[4]; /* the filtered texture sample */ @@ -601,7 +587,7 @@ struct persp_info static INLINE void -fast_persp_span(GLcontext *ctx, struct sw_span *span, +fast_persp_span(GLcontext *ctx, SWspan *span, struct persp_info *info) { GLchan sample[4]; /* the filtered texture sample */ @@ -675,13 +661,13 @@ fast_persp_span(GLcontext *ctx, struct sw_span *span, const GLuint savedTexEnable = ctx->Texture._EnabledUnits; ctx->Texture._EnabledUnits = 0; - tex_coord[0] = span->tex[0][0] * (info->smask + 1); - tex_step[0] = span->texStepX[0][0] * (info->smask + 1); - tex_coord[1] = span->tex[0][1] * (info->tmask + 1); - tex_step[1] = span->texStepX[0][1] * (info->tmask + 1); - /* span->tex[0][2] only if 3D-texturing, here only 2D */ - tex_coord[2] = span->tex[0][3]; - tex_step[2] = span->texStepX[0][3]; + tex_coord[0] = span->attrStart[FRAG_ATTRIB_TEX0][0] * (info->smask + 1); + tex_step[0] = span->attrStepX[FRAG_ATTRIB_TEX0][0] * (info->smask + 1); + tex_coord[1] = span->attrStart[FRAG_ATTRIB_TEX0][1] * (info->tmask + 1); + tex_step[1] = span->attrStepX[FRAG_ATTRIB_TEX0][1] * (info->tmask + 1); + /* span->attrStart[FRAG_ATTRIB_TEX0][2] only if 3D-texturing, here only 2D */ + tex_coord[2] = span->attrStart[FRAG_ATTRIB_TEX0][3]; + tex_step[2] = span->attrStepX[FRAG_ATTRIB_TEX0][3]; switch (info->filter) { case GL_NEAREST: @@ -802,7 +788,7 @@ fast_persp_span(GLcontext *ctx, struct sw_span *span, #define INTERP_FOG 1 #define INTERP_RGB 1 #define INTERP_ALPHA 1 -#define INTERP_TEX 1 +#define INTERP_ATTRIBS 1 #define SETUP_CODE \ struct persp_info info; \ @@ -864,40 +850,21 @@ fast_persp_span(GLcontext *ctx, struct sw_span *span, /* - * Render a smooth-shaded, textured, RGBA triangle. - * Interpolate S,T,R with perspective correction, w/out mipmapping. + * Render an RGBA triangle with arbitrary attributes. */ -#define NAME general_textured_triangle +#define NAME general_triangle #define INTERP_Z 1 #define INTERP_W 1 #define INTERP_FOG 1 #define INTERP_RGB 1 #define INTERP_SPEC 1 #define INTERP_ALPHA 1 -#define INTERP_TEX 1 +#define INTERP_ATTRIBS 1 #define RENDER_SPAN( span ) _swrast_write_rgba_span(ctx, &span); #include "s_tritemp.h" -/* - * This is the big one! - * Interpolate Z, RGB, Alpha, specular, fog, N sets of texture coordinates, and varying floats. - * Yup, it's slow. - */ -#define NAME multitextured_triangle -#define INTERP_Z 1 -#define INTERP_W 1 -#define INTERP_FOG 1 -#define INTERP_RGB 1 -#define INTERP_ALPHA 1 -#define INTERP_SPEC 1 -#define INTERP_MULTITEX 1 -#define INTERP_VARYING 1 -#define RENDER_SPAN( span ) _swrast_write_rgba_span(ctx, &span); -#include "s_tritemp.h" - - /* * Special tri function for occlusion testing @@ -1072,8 +1039,14 @@ _swrast_choose_triangle( GLcontext *ctx ) } } - if (ctx->Texture._EnabledCoordUnits || ctx->FragmentProgram._Active || - ctx->ATIFragmentShader._Enabled || ctx->ShaderObjects._FragmentShaderPresent) { + if (!rgbmode) { + USE(ci_triangle); + return; + } + + if (ctx->Texture._EnabledCoordUnits || + ctx->FragmentProgram._Current || + ctx->ATIFragmentShader._Enabled) { /* Ugh, we do a _lot_ of tests to pick the best textured tri func */ const struct gl_texture_object *texObj2D; const struct gl_texture_image *texImg; @@ -1088,9 +1061,8 @@ _swrast_choose_triangle( GLcontext *ctx ) /* First see if we can use an optimized 2-D texture function */ if (ctx->Texture._EnabledCoordUnits == 0x1 - && !ctx->FragmentProgram._Active + && !ctx->FragmentProgram._Current && !ctx->ATIFragmentShader._Enabled - && !ctx->ShaderObjects._FragmentShaderPresent && ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT && texObj2D->WrapS == GL_REPEAT && texObj2D->WrapT == GL_REPEAT @@ -1120,7 +1092,7 @@ _swrast_choose_triangle( GLcontext *ctx ) } else { #if (CHAN_BITS == 16 || CHAN_BITS == 32) - USE(general_textured_triangle); + USE(general_triangle); #else USE(affine_textured_triangle); #endif @@ -1128,7 +1100,7 @@ _swrast_choose_triangle( GLcontext *ctx ) } else { #if (CHAN_BITS == 16 || CHAN_BITS == 32) - USE(general_textured_triangle); + USE(general_triangle); #else USE(persp_textured_triangle); #endif @@ -1136,33 +1108,18 @@ _swrast_choose_triangle( GLcontext *ctx ) } else { /* general case textured triangles */ - if (ctx->Texture._EnabledCoordUnits > 1) { - USE(multitextured_triangle); - } - else { - USE(general_textured_triangle); - } + USE(general_triangle); } } else { ASSERT(!ctx->Texture._EnabledCoordUnits); if (ctx->Light.ShadeModel==GL_SMOOTH) { /* smooth shaded, no texturing, stippled or some raster ops */ - if (rgbmode) { - USE(smooth_rgba_triangle); - } - else { - USE(smooth_ci_triangle); - } + USE(smooth_rgba_triangle); } else { /* flat shaded, no texturing, stippled or some raster ops */ - if (rgbmode) { - USE(flat_rgba_triangle); - } - else { - USE(flat_ci_triangle); - } + USE(flat_rgba_triangle); } } } diff --git a/dist/Mesa/src/mesa/swrast/s_tritemp.h b/dist/Mesa/src/mesa/swrast/s_tritemp.h index 29a7a94da..891eaf678 100644 --- a/dist/Mesa/src/mesa/swrast/s_tritemp.h +++ b/dist/Mesa/src/mesa/swrast/s_tritemp.h @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 7.0 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 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"), @@ -38,10 +38,9 @@ * INTERP_INDEX - if defined, interpolate color index values * INTERP_INT_TEX - if defined, interpolate integer ST texcoords * (fast, simple 2-D texture mapping) - * INTERP_TEX - if defined, interpolate set 0 float STRQ texcoords + * INTERP_ATTRIBS - if defined, interpolate arbitrary attribs (texcoords, + * varying vars, etc) * NOTE: OpenGL STRQ = Mesa STUV (R was taken for red) - * INTERP_MULTITEX - if defined, interpolate N units of STRQ texcoords - * INTERP_VARYING - if defined, interpolate M floats of GLSL varyings * * When one can directly address pixels in the color buffer the following * macros can be defined and used to compute pixel addresses during @@ -120,44 +119,6 @@ /* - * Either loop over all texture units, or just use unit zero. - */ -#ifdef INTERP_MULTITEX -#define TEX_UNIT_LOOP(CODE) \ - { \ - GLuint u; \ - for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \ - if (ctx->Texture._EnabledCoordUnits & (1 << u)) { \ - CODE \ - } \ - } \ - } -#define INTERP_TEX -#elif defined(INTERP_TEX) -#define TEX_UNIT_LOOP(CODE) \ - { \ - const GLuint u = 0; \ - CODE \ - } -#endif - - - -#ifdef INTERP_VARYING -#define VARYING_LOOP(CODE)\ - {\ - GLuint iv, ic;\ - for (iv = 0; iv < MAX_VARYING_VECTORS; iv++) {\ - for (ic = 0; ic < VARYINGS_PER_VECTOR; ic++) {\ - CODE\ - }\ - }\ - } -#endif - - - -/* * Some code we unfortunately need to prevent negative interpolated colors. */ #ifndef CLAMP_INTERPOLANT @@ -201,6 +162,7 @@ static void NAME(GLcontext *ctx, const SWvertex *v0, GLint lines; /* number of lines to be sampled on this edge */ } EdgeT; + const SWcontext *swrast = SWRAST_CONTEXT(ctx); #ifdef INTERP_Z const GLint depthBits = ctx->DrawBuffer->Visual.depthBits; const GLint fixedToDepthShift = depthBits <= 16 ? FIXED_SHIFT : 0; @@ -216,9 +178,12 @@ static void NAME(GLcontext *ctx, const SWvertex *v0, #endif GLinterp vMin_fx, vMin_fy, vMid_fx, vMid_fy, vMax_fx, vMax_fy; - struct sw_span span; + SWspan span; + + (void) swrast; INIT_SPAN(span, GL_POLYGON, 0, 0, 0); + span.y = 0; /* silence warnings */ #ifdef INTERP_Z (void) fixedToDepthShift; @@ -327,18 +292,17 @@ static void NAME(GLcontext *ctx, const SWvertex *v0, #else const GLfloat area = eMaj.dx * eBot.dy - eBot.dx * eMaj.dy; #endif - /* Do backface culling */ - if (area * bf < 0.0) + if (IS_INF_OR_NAN(area) || area == 0.0F) return; - if (IS_INF_OR_NAN(area) || area == 0.0F) + if (area * bf * swrast->_BackfaceCullSign < 0.0) return; oneOverArea = 1.0F / area; - } - - span.facing = ctx->_Facing; /* for 2-sided stencil test */ + /* 0 = front, 1 = back */ + span.facing = oneOverArea * bf > 0.0F; + } /* Edge setup. For a triangle strip these could be reused... */ { @@ -465,19 +429,19 @@ static void NAME(GLcontext *ctx, const SWvertex *v0, { GLfloat eMaj_dz = vMax->win[2] - vMin->win[2]; GLfloat eBot_dz = vMid->win[2] - vMin->win[2]; - span.dzdx = oneOverArea * (eMaj_dz * eBot.dy - eMaj.dy * eBot_dz); - if (span.dzdx > maxDepth || span.dzdx < -maxDepth) { + span.attrStepX[FRAG_ATTRIB_WPOS][2] = oneOverArea * (eMaj_dz * eBot.dy - eMaj.dy * eBot_dz); + if (span.attrStepX[FRAG_ATTRIB_WPOS][2] > maxDepth || span.attrStepX[FRAG_ATTRIB_WPOS][2] < -maxDepth) { /* probably a sliver triangle */ - span.dzdx = 0.0; - span.dzdy = 0.0; + span.attrStepX[FRAG_ATTRIB_WPOS][2] = 0.0; + span.attrStepY[FRAG_ATTRIB_WPOS][2] = 0.0; } else { - span.dzdy = oneOverArea * (eMaj.dx * eBot_dz - eMaj_dz * eBot.dx); + span.attrStepY[FRAG_ATTRIB_WPOS][2] = oneOverArea * (eMaj.dx * eBot_dz - eMaj_dz * eBot.dx); } if (depthBits <= 16) - span.zStep = SignedFloatToFixed(span.dzdx); + span.zStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_WPOS][2]); else - span.zStep = (GLint) span.dzdx; + span.zStep = (GLint) span.attrStepX[FRAG_ATTRIB_WPOS][2]; } #endif #ifdef INTERP_W @@ -485,8 +449,8 @@ static void NAME(GLcontext *ctx, const SWvertex *v0, { const GLfloat eMaj_dw = vMax->win[3] - vMin->win[3]; const GLfloat eBot_dw = vMid->win[3] - vMin->win[3]; - span.dwdx = oneOverArea * (eMaj_dw * eBot.dy - eMaj.dy * eBot_dw); - span.dwdy = oneOverArea * (eMaj.dx * eBot_dw - eMaj_dw * eBot.dx); + span.attrStepX[FRAG_ATTRIB_WPOS][3] = oneOverArea * (eMaj_dw * eBot.dy - eMaj.dy * eBot_dw); + span.attrStepY[FRAG_ATTRIB_WPOS][3] = oneOverArea * (eMaj.dx * eBot_dw - eMaj_dw * eBot.dx); } #endif #ifdef INTERP_FOG @@ -494,15 +458,14 @@ static void NAME(GLcontext *ctx, const SWvertex *v0, { # ifdef INTERP_W const GLfloat wMax = vMax->win[3], wMin = vMin->win[3], wMid = vMid->win[3]; - const GLfloat eMaj_dfog = vMax->fog * wMax - vMin->fog * wMin; - const GLfloat eBot_dfog = vMid->fog * wMid - vMin->fog * wMin; + const GLfloat eMaj_dfog = vMax->attrib[FRAG_ATTRIB_FOGC][0] * wMax - vMin->attrib[FRAG_ATTRIB_FOGC][0] * wMin; + const GLfloat eBot_dfog = vMid->attrib[FRAG_ATTRIB_FOGC][0] * wMid - vMin->attrib[FRAG_ATTRIB_FOGC][0] * wMin; # else - const GLfloat eMaj_dfog = vMax->fog - vMin->fog; - const GLfloat eBot_dfog = vMid->fog - vMin->fog; + const GLfloat eMaj_dfog = vMax->attrib[FRAG_ATTRIB_FOGC][0] - vMin->attrib[FRAG_ATTRIB_FOGC][0]; + const GLfloat eBot_dfog = vMid->attrib[FRAG_ATTRIB_FOGC][0] - vMin->attrib[FRAG_ATTRIB_FOGC][0]; # endif - span.dfogdx = oneOverArea * (eMaj_dfog * eBot.dy - eMaj.dy * eBot_dfog); - span.dfogdy = oneOverArea * (eMaj.dx * eBot_dfog - eMaj_dfog * eBot.dx); - span.fogStep = span.dfogdx; + span.attrStepX[FRAG_ATTRIB_FOGC][0] = oneOverArea * (eMaj_dfog * eBot.dy - eMaj.dy * eBot_dfog); + span.attrStepY[FRAG_ATTRIB_FOGC][0] = oneOverArea * (eMaj.dx * eBot_dfog - eMaj_dfog * eBot.dx); } #endif #ifdef INTERP_RGB @@ -518,37 +481,37 @@ static void NAME(GLcontext *ctx, const SWvertex *v0, GLfloat eMaj_da = (GLfloat) ((ColorTemp) vMax->color[ACOMP] - (ColorTemp) vMin->color[ACOMP]); GLfloat eBot_da = (GLfloat) ((ColorTemp) vMid->color[ACOMP] - (ColorTemp) vMin->color[ACOMP]); # endif - span.drdx = oneOverArea * (eMaj_dr * eBot.dy - eMaj.dy * eBot_dr); - span.drdy = oneOverArea * (eMaj.dx * eBot_dr - eMaj_dr * eBot.dx); - span.dgdx = oneOverArea * (eMaj_dg * eBot.dy - eMaj.dy * eBot_dg); - span.dgdy = oneOverArea * (eMaj.dx * eBot_dg - eMaj_dg * eBot.dx); - span.dbdx = oneOverArea * (eMaj_db * eBot.dy - eMaj.dy * eBot_db); - span.dbdy = oneOverArea * (eMaj.dx * eBot_db - eMaj_db * eBot.dx); + span.attrStepX[FRAG_ATTRIB_COL0][0] = oneOverArea * (eMaj_dr * eBot.dy - eMaj.dy * eBot_dr); + span.attrStepY[FRAG_ATTRIB_COL0][0] = oneOverArea * (eMaj.dx * eBot_dr - eMaj_dr * eBot.dx); + span.attrStepX[FRAG_ATTRIB_COL0][1] = oneOverArea * (eMaj_dg * eBot.dy - eMaj.dy * eBot_dg); + span.attrStepY[FRAG_ATTRIB_COL0][1] = oneOverArea * (eMaj.dx * eBot_dg - eMaj_dg * eBot.dx); + span.attrStepX[FRAG_ATTRIB_COL0][2] = oneOverArea * (eMaj_db * eBot.dy - eMaj.dy * eBot_db); + span.attrStepY[FRAG_ATTRIB_COL0][2] = oneOverArea * (eMaj.dx * eBot_db - eMaj_db * eBot.dx); # if CHAN_TYPE == GL_FLOAT - span.redStep = span.drdx; - span.greenStep = span.dgdx; - span.blueStep = span.dbdx; + span.redStep = span.attrStepX[FRAG_ATTRIB_COL0][0]; + span.greenStep = span.attrStepX[FRAG_ATTRIB_COL0][1]; + span.blueStep = span.attrStepX[FRAG_ATTRIB_COL0][2]; # else - span.redStep = SignedFloatToFixed(span.drdx); - span.greenStep = SignedFloatToFixed(span.dgdx); - span.blueStep = SignedFloatToFixed(span.dbdx); + span.redStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL0][0]); + span.greenStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL0][1]); + span.blueStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL0][2]); # endif /* GL_FLOAT */ # ifdef INTERP_ALPHA - span.dadx = oneOverArea * (eMaj_da * eBot.dy - eMaj.dy * eBot_da); - span.dady = oneOverArea * (eMaj.dx * eBot_da - eMaj_da * eBot.dx); + span.attrStepX[FRAG_ATTRIB_COL0][3] = oneOverArea * (eMaj_da * eBot.dy - eMaj.dy * eBot_da); + span.attrStepY[FRAG_ATTRIB_COL0][3] = oneOverArea * (eMaj.dx * eBot_da - eMaj_da * eBot.dx); # if CHAN_TYPE == GL_FLOAT - span.alphaStep = span.dadx; + span.alphaStep = span.attrStepX[FRAG_ATTRIB_COL0][3]; # else - span.alphaStep = SignedFloatToFixed(span.dadx); + span.alphaStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL0][3]); # endif /* GL_FLOAT */ # endif /* INTERP_ALPHA */ } else { ASSERT(ctx->Light.ShadeModel == GL_FLAT); span.interpMask |= SPAN_FLAT; - span.drdx = span.drdy = 0.0F; - span.dgdx = span.dgdy = 0.0F; - span.dbdx = span.dbdy = 0.0F; + span.attrStepX[FRAG_ATTRIB_COL0][0] = span.attrStepY[FRAG_ATTRIB_COL0][0] = 0.0F; + span.attrStepX[FRAG_ATTRIB_COL0][1] = span.attrStepY[FRAG_ATTRIB_COL0][1] = 0.0F; + span.attrStepX[FRAG_ATTRIB_COL0][2] = span.attrStepY[FRAG_ATTRIB_COL0][2] = 0.0F; # if CHAN_TYPE == GL_FLOAT span.redStep = 0.0F; span.greenStep = 0.0F; @@ -559,7 +522,7 @@ static void NAME(GLcontext *ctx, const SWvertex *v0, span.blueStep = 0; # endif /* GL_FLOAT */ # ifdef INTERP_ALPHA - span.dadx = span.dady = 0.0F; + span.attrStepX[FRAG_ATTRIB_COL0][3] = span.attrStepY[FRAG_ATTRIB_COL0][3] = 0.0F; # if CHAN_TYPE == GL_FLOAT span.alphaStep = 0.0F; # else @@ -577,26 +540,26 @@ static void NAME(GLcontext *ctx, const SWvertex *v0, GLfloat eBot_dsg = (GLfloat) ((ColorTemp) vMid->specular[GCOMP] - (ColorTemp) vMin->specular[GCOMP]); GLfloat eMaj_dsb = (GLfloat) ((ColorTemp) vMax->specular[BCOMP] - (ColorTemp) vMin->specular[BCOMP]); GLfloat eBot_dsb = (GLfloat) ((ColorTemp) vMid->specular[BCOMP] - (ColorTemp) vMin->specular[BCOMP]); - span.dsrdx = oneOverArea * (eMaj_dsr * eBot.dy - eMaj.dy * eBot_dsr); - span.dsrdy = oneOverArea * (eMaj.dx * eBot_dsr - eMaj_dsr * eBot.dx); - span.dsgdx = oneOverArea * (eMaj_dsg * eBot.dy - eMaj.dy * eBot_dsg); - span.dsgdy = oneOverArea * (eMaj.dx * eBot_dsg - eMaj_dsg * eBot.dx); - span.dsbdx = oneOverArea * (eMaj_dsb * eBot.dy - eMaj.dy * eBot_dsb); - span.dsbdy = oneOverArea * (eMaj.dx * eBot_dsb - eMaj_dsb * eBot.dx); + span.attrStepX[FRAG_ATTRIB_COL1][0] = oneOverArea * (eMaj_dsr * eBot.dy - eMaj.dy * eBot_dsr); + span.attrStepY[FRAG_ATTRIB_COL1][0] = oneOverArea * (eMaj.dx * eBot_dsr - eMaj_dsr * eBot.dx); + span.attrStepX[FRAG_ATTRIB_COL1][1] = oneOverArea * (eMaj_dsg * eBot.dy - eMaj.dy * eBot_dsg); + span.attrStepY[FRAG_ATTRIB_COL1][1] = oneOverArea * (eMaj.dx * eBot_dsg - eMaj_dsg * eBot.dx); + span.attrStepX[FRAG_ATTRIB_COL1][2] = oneOverArea * (eMaj_dsb * eBot.dy - eMaj.dy * eBot_dsb); + span.attrStepY[FRAG_ATTRIB_COL1][2] = oneOverArea * (eMaj.dx * eBot_dsb - eMaj_dsb * eBot.dx); # if CHAN_TYPE == GL_FLOAT - span.specRedStep = span.dsrdx; - span.specGreenStep = span.dsgdx; - span.specBlueStep = span.dsbdx; + span.specRedStep = span.attrStepX[FRAG_ATTRIB_COL1][0]; + span.specGreenStep = span.attrStepX[FRAG_ATTRIB_COL1][1]; + span.specBlueStep = span.attrStepX[FRAG_ATTRIB_COL1][2]; # else - span.specRedStep = SignedFloatToFixed(span.dsrdx); - span.specGreenStep = SignedFloatToFixed(span.dsgdx); - span.specBlueStep = SignedFloatToFixed(span.dsbdx); + span.specRedStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL1][0]); + span.specGreenStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL1][1]); + span.specBlueStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL1][2]); # endif } else { - span.dsrdx = span.dsrdy = 0.0F; - span.dsgdx = span.dsgdy = 0.0F; - span.dsbdx = span.dsbdy = 0.0F; + span.attrStepX[FRAG_ATTRIB_COL1][0] = span.attrStepY[FRAG_ATTRIB_COL1][0] = 0.0F; + span.attrStepX[FRAG_ATTRIB_COL1][1] = span.attrStepY[FRAG_ATTRIB_COL1][1] = 0.0F; + span.attrStepX[FRAG_ATTRIB_COL1][2] = span.attrStepY[FRAG_ATTRIB_COL1][2] = 0.0F; # if CHAN_TYPE == GL_FLOAT span.specRedStep = 0.0F; span.specGreenStep = 0.0F; @@ -626,54 +589,41 @@ static void NAME(GLcontext *ctx, const SWvertex *v0, #ifdef INTERP_INT_TEX span.interpMask |= SPAN_INT_TEXTURE; { - GLfloat eMaj_ds = (vMax->texcoord[0][0] - vMin->texcoord[0][0]) * S_SCALE; - GLfloat eBot_ds = (vMid->texcoord[0][0] - vMin->texcoord[0][0]) * S_SCALE; - GLfloat eMaj_dt = (vMax->texcoord[0][1] - vMin->texcoord[0][1]) * T_SCALE; - GLfloat eBot_dt = (vMid->texcoord[0][1] - vMin->texcoord[0][1]) * T_SCALE; - span.texStepX[0][0] = oneOverArea * (eMaj_ds * eBot.dy - eMaj.dy * eBot_ds); - span.texStepY[0][0] = oneOverArea * (eMaj.dx * eBot_ds - eMaj_ds * eBot.dx); - span.texStepX[0][1] = oneOverArea * (eMaj_dt * eBot.dy - eMaj.dy * eBot_dt); - span.texStepY[0][1] = oneOverArea * (eMaj.dx * eBot_dt - eMaj_dt * eBot.dx); - span.intTexStep[0] = SignedFloatToFixed(span.texStepX[0][0]); - span.intTexStep[1] = SignedFloatToFixed(span.texStepX[0][1]); + GLfloat eMaj_ds = (vMax->attrib[FRAG_ATTRIB_TEX0][0] - vMin->attrib[FRAG_ATTRIB_TEX0][0]) * S_SCALE; + GLfloat eBot_ds = (vMid->attrib[FRAG_ATTRIB_TEX0][0] - vMin->attrib[FRAG_ATTRIB_TEX0][0]) * S_SCALE; + GLfloat eMaj_dt = (vMax->attrib[FRAG_ATTRIB_TEX0][1] - vMin->attrib[FRAG_ATTRIB_TEX0][1]) * T_SCALE; + GLfloat eBot_dt = (vMid->attrib[FRAG_ATTRIB_TEX0][1] - vMin->attrib[FRAG_ATTRIB_TEX0][1]) * T_SCALE; + span.attrStepX[FRAG_ATTRIB_TEX0][0] = oneOverArea * (eMaj_ds * eBot.dy - eMaj.dy * eBot_ds); + span.attrStepY[FRAG_ATTRIB_TEX0][0] = oneOverArea * (eMaj.dx * eBot_ds - eMaj_ds * eBot.dx); + span.attrStepX[FRAG_ATTRIB_TEX0][1] = oneOverArea * (eMaj_dt * eBot.dy - eMaj.dy * eBot_dt); + span.attrStepY[FRAG_ATTRIB_TEX0][1] = oneOverArea * (eMaj.dx * eBot_dt - eMaj_dt * eBot.dx); + span.intTexStep[0] = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_TEX0][0]); + span.intTexStep[1] = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_TEX0][1]); } #endif -#ifdef INTERP_TEX - span.interpMask |= SPAN_TEXTURE; +#ifdef INTERP_ATTRIBS + span.interpMask |= (SPAN_TEXTURE | SPAN_VARYING); { /* win[3] is 1/W */ const GLfloat wMax = vMax->win[3], wMin = vMin->win[3], wMid = vMid->win[3]; - TEX_UNIT_LOOP( - GLfloat eMaj_ds = vMax->texcoord[u][0] * wMax - vMin->texcoord[u][0] * wMin; - GLfloat eBot_ds = vMid->texcoord[u][0] * wMid - vMin->texcoord[u][0] * wMin; - GLfloat eMaj_dt = vMax->texcoord[u][1] * wMax - vMin->texcoord[u][1] * wMin; - GLfloat eBot_dt = vMid->texcoord[u][1] * wMid - vMin->texcoord[u][1] * wMin; - GLfloat eMaj_du = vMax->texcoord[u][2] * wMax - vMin->texcoord[u][2] * wMin; - GLfloat eBot_du = vMid->texcoord[u][2] * wMid - vMin->texcoord[u][2] * wMin; - GLfloat eMaj_dv = vMax->texcoord[u][3] * wMax - vMin->texcoord[u][3] * wMin; - GLfloat eBot_dv = vMid->texcoord[u][3] * wMid - vMin->texcoord[u][3] * wMin; - span.texStepX[u][0] = oneOverArea * (eMaj_ds * eBot.dy - eMaj.dy * eBot_ds); - span.texStepY[u][0] = oneOverArea * (eMaj.dx * eBot_ds - eMaj_ds * eBot.dx); - span.texStepX[u][1] = oneOverArea * (eMaj_dt * eBot.dy - eMaj.dy * eBot_dt); - span.texStepY[u][1] = oneOverArea * (eMaj.dx * eBot_dt - eMaj_dt * eBot.dx); - span.texStepX[u][2] = oneOverArea * (eMaj_du * eBot.dy - eMaj.dy * eBot_du); - span.texStepY[u][2] = oneOverArea * (eMaj.dx * eBot_du - eMaj_du * eBot.dx); - span.texStepX[u][3] = oneOverArea * (eMaj_dv * eBot.dy - eMaj.dy * eBot_dv); - span.texStepY[u][3] = oneOverArea * (eMaj.dx * eBot_dv - eMaj_dv * eBot.dx); - ) - } -#endif -#ifdef INTERP_VARYING - span.interpMask |= SPAN_VARYING; - { - /* win[3] is 1/W */ - const GLfloat wMax = vMax->win[3], wMin = vMin->win[3], wMid = vMid->win[3]; - VARYING_LOOP( - GLfloat eMaj_dvar = vMax->attribute[iv][ic] * wMax - vMin->attribute[iv][ic] * wMin; - GLfloat eBot_dvar = vMid->attribute[iv][ic] * wMid - vMin->attribute[iv][ic] * wMin; - span.varStepX[iv][ic] = oneOverArea * (eMaj_dvar * eBot.dy - eMaj.dy * eBot_dvar); - span.varStepY[iv][ic] = oneOverArea * (eMaj.dx * eBot_dvar - eMaj_dvar * eBot.dx); - ) + ATTRIB_LOOP_BEGIN + GLfloat eMaj_ds = vMax->attrib[attr][0] * wMax - vMin->attrib[attr][0] * wMin; + GLfloat eBot_ds = vMid->attrib[attr][0] * wMid - vMin->attrib[attr][0] * wMin; + GLfloat eMaj_dt = vMax->attrib[attr][1] * wMax - vMin->attrib[attr][1] * wMin; + GLfloat eBot_dt = vMid->attrib[attr][1] * wMid - vMin->attrib[attr][1] * wMin; + GLfloat eMaj_du = vMax->attrib[attr][2] * wMax - vMin->attrib[attr][2] * wMin; + GLfloat eBot_du = vMid->attrib[attr][2] * wMid - vMin->attrib[attr][2] * wMin; + GLfloat eMaj_dv = vMax->attrib[attr][3] * wMax - vMin->attrib[attr][3] * wMin; + GLfloat eBot_dv = vMid->attrib[attr][3] * wMid - vMin->attrib[attr][3] * wMin; + span.attrStepX[attr][0] = oneOverArea * (eMaj_ds * eBot.dy - eMaj.dy * eBot_ds); + span.attrStepY[attr][0] = oneOverArea * (eMaj.dx * eBot_ds - eMaj_ds * eBot.dx); + span.attrStepX[attr][1] = oneOverArea * (eMaj_dt * eBot.dy - eMaj.dy * eBot_dt); + span.attrStepY[attr][1] = oneOverArea * (eMaj.dx * eBot_dt - eMaj_dt * eBot.dx); + span.attrStepX[attr][2] = oneOverArea * (eMaj_du * eBot.dy - eMaj.dy * eBot_du); + span.attrStepY[attr][2] = oneOverArea * (eMaj.dx * eBot_du - eMaj_du * eBot.dx); + span.attrStepX[attr][3] = oneOverArea * (eMaj_dv * eBot.dy - eMaj.dy * eBot_dv); + span.attrStepY[attr][3] = oneOverArea * (eMaj.dx * eBot_dv - eMaj_dv * eBot.dx); + ATTRIB_LOOP_END } #endif @@ -769,20 +719,15 @@ static void NAME(GLcontext *ctx, const SWvertex *v0, GLfixed sLeft=0, dsOuter=0, dsInner; GLfixed tLeft=0, dtOuter=0, dtInner; #endif -#ifdef INTERP_TEX - GLfloat sLeft[MAX_TEXTURE_COORD_UNITS]; - GLfloat tLeft[MAX_TEXTURE_COORD_UNITS]; - GLfloat uLeft[MAX_TEXTURE_COORD_UNITS]; - GLfloat vLeft[MAX_TEXTURE_COORD_UNITS]; - GLfloat dsOuter[MAX_TEXTURE_COORD_UNITS], dsInner[MAX_TEXTURE_COORD_UNITS]; - GLfloat dtOuter[MAX_TEXTURE_COORD_UNITS], dtInner[MAX_TEXTURE_COORD_UNITS]; - GLfloat duOuter[MAX_TEXTURE_COORD_UNITS], duInner[MAX_TEXTURE_COORD_UNITS]; - GLfloat dvOuter[MAX_TEXTURE_COORD_UNITS], dvInner[MAX_TEXTURE_COORD_UNITS]; -#endif -#ifdef INTERP_VARYING - GLfloat varLeft[MAX_VARYING_VECTORS][VARYINGS_PER_VECTOR]; - GLfloat dvarOuter[MAX_VARYING_VECTORS][VARYINGS_PER_VECTOR]; - GLfloat dvarInner[MAX_VARYING_VECTORS][VARYINGS_PER_VECTOR]; +#ifdef INTERP_ATTRIBS + GLfloat sLeft[FRAG_ATTRIB_MAX]; + GLfloat tLeft[FRAG_ATTRIB_MAX]; + GLfloat uLeft[FRAG_ATTRIB_MAX]; + GLfloat vLeft[FRAG_ATTRIB_MAX]; + GLfloat dsOuter[FRAG_ATTRIB_MAX], dsInner[FRAG_ATTRIB_MAX]; + GLfloat dtOuter[FRAG_ATTRIB_MAX], dtInner[FRAG_ATTRIB_MAX]; + GLfloat duOuter[FRAG_ATTRIB_MAX], duInner[FRAG_ATTRIB_MAX]; + GLfloat dvOuter[FRAG_ATTRIB_MAX], dvInner[FRAG_ATTRIB_MAX]; #endif for (subTriangle=0; subTriangle<=1; subTriangle++) { @@ -894,19 +839,20 @@ static void NAME(GLcontext *ctx, const SWvertex *v0, GLfloat z0 = vLower->win[2]; if (depthBits <= 16) { /* interpolate fixed-pt values */ - GLfloat tmp = (z0 * FIXED_SCALE + span.dzdx * adjx - + span.dzdy * adjy) + FIXED_HALF; + GLfloat tmp = (z0 * FIXED_SCALE + + span.attrStepX[FRAG_ATTRIB_WPOS][2] * adjx + + span.attrStepY[FRAG_ATTRIB_WPOS][2] * adjy) + FIXED_HALF; if (tmp < MAX_GLUINT / 2) zLeft = (GLfixed) tmp; else zLeft = MAX_GLUINT / 2; - fdzOuter = SignedFloatToFixed(span.dzdy + dxOuter * span.dzdx); + fdzOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_WPOS][2] + dxOuter * span.attrStepX[FRAG_ATTRIB_WPOS][2]); } else { /* interpolate depth values w/out scaling */ - zLeft = (GLuint) (z0 + span.dzdx * FixedToFloat(adjx) - + span.dzdy * FixedToFloat(adjy)); - fdzOuter = (GLint) (span.dzdy + dxOuter * span.dzdx); + zLeft = (GLuint) (z0 + span.attrStepX[FRAG_ATTRIB_WPOS][2] * FixedToFloat(adjx) + + span.attrStepY[FRAG_ATTRIB_WPOS][2] * FixedToFloat(adjy)); + fdzOuter = (GLint) (span.attrStepY[FRAG_ATTRIB_WPOS][2] + dxOuter * span.attrStepX[FRAG_ATTRIB_WPOS][2]); } # ifdef DEPTH_TYPE zRow = (DEPTH_TYPE *) @@ -916,41 +862,41 @@ static void NAME(GLcontext *ctx, const SWvertex *v0, } #endif #ifdef INTERP_W - wLeft = vLower->win[3] + (span.dwdx * adjx + span.dwdy * adjy) * (1.0F/FIXED_SCALE); - dwOuter = span.dwdy + dxOuter * span.dwdx; + wLeft = vLower->win[3] + (span.attrStepX[FRAG_ATTRIB_WPOS][3] * adjx + span.attrStepY[FRAG_ATTRIB_WPOS][3] * adjy) * (1.0F/FIXED_SCALE); + dwOuter = span.attrStepY[FRAG_ATTRIB_WPOS][3] + dxOuter * span.attrStepX[FRAG_ATTRIB_WPOS][3]; #endif #ifdef INTERP_FOG # ifdef INTERP_W - fogLeft = vLower->fog * vLower->win[3] + (span.dfogdx * adjx + span.dfogdy * adjy) * (1.0F/FIXED_SCALE); + fogLeft = vLower->attrib[FRAG_ATTRIB_FOGC][0] * vLower->win[3] + (span.attrStepX[FRAG_ATTRIB_FOGC][0] * adjx + span.attrStepY[FRAG_ATTRIB_FOGC][0] * adjy) * (1.0F/FIXED_SCALE); # else - fogLeft = vLower->fog + (span.dfogdx * adjx + span.dfogdy * adjy) * (1.0F/FIXED_SCALE); + fogLeft = vLower->attrib[FRAG_ATTRIB_FOGC][0] + (span.attrStepX[FRAG_ATTRIB_FOGC][0] * adjx + span.attrStepY[FRAG_ATTRIB_FOGC][0] * adjy) * (1.0F/FIXED_SCALE); # endif - dfogOuter = span.dfogdy + dxOuter * span.dfogdx; + dfogOuter = span.attrStepY[FRAG_ATTRIB_FOGC][0] + dxOuter * span.attrStepX[FRAG_ATTRIB_FOGC][0]; #endif #ifdef INTERP_RGB if (ctx->Light.ShadeModel == GL_SMOOTH) { # if CHAN_TYPE == GL_FLOAT - rLeft = vLower->color[RCOMP] + (span.drdx * adjx + span.drdy * adjy) * (1.0F / FIXED_SCALE); - gLeft = vLower->color[GCOMP] + (span.dgdx * adjx + span.dgdy * adjy) * (1.0F / FIXED_SCALE); - bLeft = vLower->color[BCOMP] + (span.dbdx * adjx + span.dbdy * adjy) * (1.0F / FIXED_SCALE); - fdrOuter = span.drdy + dxOuter * span.drdx; - fdgOuter = span.dgdy + dxOuter * span.dgdx; - fdbOuter = span.dbdy + dxOuter * span.dbdx; + rLeft = vLower->color[RCOMP] + (span.attrStepX[FRAG_ATTRIB_COL0][0] * adjx + span.attrStepY[FRAG_ATTRIB_COL0][0] * adjy) * (1.0F / FIXED_SCALE); + gLeft = vLower->color[GCOMP] + (span.attrStepX[FRAG_ATTRIB_COL0][1] * adjx + span.attrStepY[FRAG_ATTRIB_COL0][1] * adjy) * (1.0F / FIXED_SCALE); + bLeft = vLower->color[BCOMP] + (span.attrStepX[FRAG_ATTRIB_COL0][2] * adjx + span.attrStepY[FRAG_ATTRIB_COL0][2] * adjy) * (1.0F / FIXED_SCALE); + fdrOuter = span.attrStepY[FRAG_ATTRIB_COL0][0] + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][0]; + fdgOuter = span.attrStepY[FRAG_ATTRIB_COL0][1] + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][1]; + fdbOuter = span.attrStepY[FRAG_ATTRIB_COL0][2] + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][2]; # else - rLeft = (GLint)(ChanToFixed(vLower->color[RCOMP]) + span.drdx * adjx + span.drdy * adjy) + FIXED_HALF; - gLeft = (GLint)(ChanToFixed(vLower->color[GCOMP]) + span.dgdx * adjx + span.dgdy * adjy) + FIXED_HALF; - bLeft = (GLint)(ChanToFixed(vLower->color[BCOMP]) + span.dbdx * adjx + span.dbdy * adjy) + FIXED_HALF; - fdrOuter = SignedFloatToFixed(span.drdy + dxOuter * span.drdx); - fdgOuter = SignedFloatToFixed(span.dgdy + dxOuter * span.dgdx); - fdbOuter = SignedFloatToFixed(span.dbdy + dxOuter * span.dbdx); + rLeft = (GLint)(ChanToFixed(vLower->color[RCOMP]) + span.attrStepX[FRAG_ATTRIB_COL0][0] * adjx + span.attrStepY[FRAG_ATTRIB_COL0][0] * adjy) + FIXED_HALF; + gLeft = (GLint)(ChanToFixed(vLower->color[GCOMP]) + span.attrStepX[FRAG_ATTRIB_COL0][1] * adjx + span.attrStepY[FRAG_ATTRIB_COL0][1] * adjy) + FIXED_HALF; + bLeft = (GLint)(ChanToFixed(vLower->color[BCOMP]) + span.attrStepX[FRAG_ATTRIB_COL0][2] * adjx + span.attrStepY[FRAG_ATTRIB_COL0][2] * adjy) + FIXED_HALF; + fdrOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL0][0] + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][0]); + fdgOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL0][1] + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][1]); + fdbOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL0][2] + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][2]); # endif # ifdef INTERP_ALPHA # if CHAN_TYPE == GL_FLOAT - aLeft = vLower->color[ACOMP] + (span.dadx * adjx + span.dady * adjy) * (1.0F / FIXED_SCALE); - fdaOuter = span.dady + dxOuter * span.dadx; + aLeft = vLower->color[ACOMP] + (span.attrStepX[FRAG_ATTRIB_COL0][3] * adjx + span.attrStepY[FRAG_ATTRIB_COL0][3] * adjy) * (1.0F / FIXED_SCALE); + fdaOuter = span.attrStepY[FRAG_ATTRIB_COL0][3] + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][3]; # else - aLeft = (GLint)(ChanToFixed(vLower->color[ACOMP]) + span.dadx * adjx + span.dady * adjy) + FIXED_HALF; - fdaOuter = SignedFloatToFixed(span.dady + dxOuter * span.dadx); + aLeft = (GLint)(ChanToFixed(vLower->color[ACOMP]) + span.attrStepX[FRAG_ATTRIB_COL0][3] * adjx + span.attrStepX[FRAG_ATTRIB_COL0][3] * adjy) + FIXED_HALF; + fdaOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL0][3] + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][3]); # endif # endif } @@ -983,19 +929,19 @@ static void NAME(GLcontext *ctx, const SWvertex *v0, #ifdef INTERP_SPEC if (ctx->Light.ShadeModel == GL_SMOOTH) { # if CHAN_TYPE == GL_FLOAT - srLeft = vLower->specular[RCOMP] + (span.dsrdx * adjx + span.dsrdy * adjy) * (1.0F / FIXED_SCALE); - sgLeft = vLower->specular[GCOMP] + (span.dsgdx * adjx + span.dsgdy * adjy) * (1.0F / FIXED_SCALE); - sbLeft = vLower->specular[BCOMP] + (span.dsbdx * adjx + span.dsbdy * adjy) * (1.0F / FIXED_SCALE); - dsrOuter = span.dsrdy + dxOuter * span.dsrdx; - dsgOuter = span.dsgdy + dxOuter * span.dsgdx; - dsbOuter = span.dsbdy + dxOuter * span.dsbdx; + srLeft = vLower->specular[RCOMP] + (span.attrStepX[FRAG_ATTRIB_COL1][0] * adjx + span.attrStepY[FRAG_ATTRIB_COL1][0] * adjy) * (1.0F / FIXED_SCALE); + sgLeft = vLower->specular[GCOMP] + (span.attrStepX[FRAG_ATTRIB_COL1][1] * adjx + span.attrStepY[FRAG_ATTRIB_COL1][1] * adjy) * (1.0F / FIXED_SCALE); + sbLeft = vLower->specular[BCOMP] + (span.attrStepX[FRAG_ATTRIB_COL1][2] * adjx + span.attrStepY[FRAG_ATTRIB_COL1][2] * adjy) * (1.0F / FIXED_SCALE); + dsrOuter = span.attrStepY[FRAG_ATTRIB_COL1][0] + dxOuter * span.attrStepX[FRAG_ATTRIB_COL1][0]; + dsgOuter = span.attrStepY[FRAG_ATTRIB_COL1][1] + dxOuter * span.attrStepX[FRAG_ATTRIB_COL1][1]; + dsbOuter = span.attrStepY[FRAG_ATTRIB_COL1][2] + dxOuter * span.attrStepX[FRAG_ATTRIB_COL1][2]; # else - srLeft = (GLfixed) (ChanToFixed(vLower->specular[RCOMP]) + span.dsrdx * adjx + span.dsrdy * adjy) + FIXED_HALF; - sgLeft = (GLfixed) (ChanToFixed(vLower->specular[GCOMP]) + span.dsgdx * adjx + span.dsgdy * adjy) + FIXED_HALF; - sbLeft = (GLfixed) (ChanToFixed(vLower->specular[BCOMP]) + span.dsbdx * adjx + span.dsbdy * adjy) + FIXED_HALF; - dsrOuter = SignedFloatToFixed(span.dsrdy + dxOuter * span.dsrdx); - dsgOuter = SignedFloatToFixed(span.dsgdy + dxOuter * span.dsgdx); - dsbOuter = SignedFloatToFixed(span.dsbdy + dxOuter * span.dsbdx); + srLeft = (GLfixed) (ChanToFixed(vLower->specular[RCOMP]) + span.attrStepX[FRAG_ATTRIB_COL1][0] * adjx + span.attrStepY[FRAG_ATTRIB_COL1][0] * adjy) + FIXED_HALF; + sgLeft = (GLfixed) (ChanToFixed(vLower->specular[GCOMP]) + span.attrStepX[FRAG_ATTRIB_COL1][1] * adjx + span.attrStepY[FRAG_ATTRIB_COL1][1] * adjy) + FIXED_HALF; + sbLeft = (GLfixed) (ChanToFixed(vLower->specular[BCOMP]) + span.attrStepX[FRAG_ATTRIB_COL1][2] * adjx + span.attrStepY[FRAG_ATTRIB_COL1][2] * adjy) + FIXED_HALF; + dsrOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL1][0] + dxOuter * span.attrStepX[FRAG_ATTRIB_COL1][0]); + dsgOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL1][1] + dxOuter * span.attrStepX[FRAG_ATTRIB_COL1][1]); + dsbOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL1][2] + dxOuter * span.attrStepX[FRAG_ATTRIB_COL1][2]); # endif } else { @@ -1029,42 +975,33 @@ static void NAME(GLcontext *ctx, const SWvertex *v0, #ifdef INTERP_INT_TEX { GLfloat s0, t0; - s0 = vLower->texcoord[0][0] * S_SCALE; - sLeft = (GLfixed)(s0 * FIXED_SCALE + span.texStepX[0][0] * adjx - + span.texStepY[0][0] * adjy) + FIXED_HALF; - dsOuter = SignedFloatToFixed(span.texStepY[0][0] + dxOuter * span.texStepX[0][0]); - - t0 = vLower->texcoord[0][1] * T_SCALE; - tLeft = (GLfixed)(t0 * FIXED_SCALE + span.texStepX[0][1] * adjx - + span.texStepY[0][1] * adjy) + FIXED_HALF; - dtOuter = SignedFloatToFixed(span.texStepY[0][1] + dxOuter * span.texStepX[0][1]); + s0 = vLower->attrib[FRAG_ATTRIB_TEX0][0] * S_SCALE; + sLeft = (GLfixed)(s0 * FIXED_SCALE + span.attrStepX[FRAG_ATTRIB_TEX0][0] * adjx + + span.attrStepY[FRAG_ATTRIB_TEX0][0] * adjy) + FIXED_HALF; + dsOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_TEX0][0] + dxOuter * span.attrStepX[FRAG_ATTRIB_TEX0][0]); + + t0 = vLower->attrib[FRAG_ATTRIB_TEX0][1] * T_SCALE; + tLeft = (GLfixed)(t0 * FIXED_SCALE + span.attrStepX[FRAG_ATTRIB_TEX0][1] * adjx + + span.attrStepY[FRAG_ATTRIB_TEX0][1] * adjy) + FIXED_HALF; + dtOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_TEX0][1] + dxOuter * span.attrStepX[FRAG_ATTRIB_TEX0][1]); } #endif -#ifdef INTERP_TEX - TEX_UNIT_LOOP( +#ifdef INTERP_ATTRIBS + ATTRIB_LOOP_BEGIN const GLfloat invW = vLower->win[3]; - const GLfloat s0 = vLower->texcoord[u][0] * invW; - const GLfloat t0 = vLower->texcoord[u][1] * invW; - const GLfloat u0 = vLower->texcoord[u][2] * invW; - const GLfloat v0 = vLower->texcoord[u][3] * invW; - sLeft[u] = s0 + (span.texStepX[u][0] * adjx + span.texStepY[u][0] * adjy) * (1.0F/FIXED_SCALE); - tLeft[u] = t0 + (span.texStepX[u][1] * adjx + span.texStepY[u][1] * adjy) * (1.0F/FIXED_SCALE); - uLeft[u] = u0 + (span.texStepX[u][2] * adjx + span.texStepY[u][2] * adjy) * (1.0F/FIXED_SCALE); - vLeft[u] = v0 + (span.texStepX[u][3] * adjx + span.texStepY[u][3] * adjy) * (1.0F/FIXED_SCALE); - dsOuter[u] = span.texStepY[u][0] + dxOuter * span.texStepX[u][0]; - dtOuter[u] = span.texStepY[u][1] + dxOuter * span.texStepX[u][1]; - duOuter[u] = span.texStepY[u][2] + dxOuter * span.texStepX[u][2]; - dvOuter[u] = span.texStepY[u][3] + dxOuter * span.texStepX[u][3]; - ) -#endif -#ifdef INTERP_VARYING - VARYING_LOOP( - const GLfloat invW = vLower->win[3]; - const GLfloat var0 = vLower->attribute[iv][ic] * invW; - varLeft[iv][ic] = var0 + (span.varStepX[iv][ic] * adjx + - span.varStepY[iv][ic] * adjy) * (1.0f / FIXED_SCALE); - dvarOuter[iv][ic] = span.varStepY[iv][ic] + dxOuter * span.varStepX[iv][ic]; - ) + const GLfloat s0 = vLower->attrib[attr][0] * invW; + const GLfloat t0 = vLower->attrib[attr][1] * invW; + const GLfloat u0 = vLower->attrib[attr][2] * invW; + const GLfloat v0 = vLower->attrib[attr][3] * invW; + sLeft[attr] = s0 + (span.attrStepX[attr][0] * adjx + span.attrStepY[attr][0] * adjy) * (1.0F/FIXED_SCALE); + tLeft[attr] = t0 + (span.attrStepX[attr][1] * adjx + span.attrStepY[attr][1] * adjy) * (1.0F/FIXED_SCALE); + uLeft[attr] = u0 + (span.attrStepX[attr][2] * adjx + span.attrStepY[attr][2] * adjy) * (1.0F/FIXED_SCALE); + vLeft[attr] = v0 + (span.attrStepX[attr][3] * adjx + span.attrStepY[attr][3] * adjy) * (1.0F/FIXED_SCALE); + dsOuter[attr] = span.attrStepY[attr][0] + dxOuter * span.attrStepX[attr][0]; + dtOuter[attr] = span.attrStepY[attr][1] + dxOuter * span.attrStepX[attr][1]; + duOuter[attr] = span.attrStepY[attr][2] + dxOuter * span.attrStepX[attr][2]; + dvOuter[attr] = span.attrStepY[attr][3] + dxOuter * span.attrStepX[attr][3]; + ATTRIB_LOOP_END #endif } /*if setupLeft*/ @@ -1095,10 +1032,10 @@ static void NAME(GLcontext *ctx, const SWvertex *v0, fdzInner = fdzOuter + span.zStep; #endif #ifdef INTERP_W - dwInner = dwOuter + span.dwdx; + dwInner = dwOuter + span.attrStepX[FRAG_ATTRIB_WPOS][3]; #endif #ifdef INTERP_FOG - dfogInner = dfogOuter + span.dfogdx; + dfogInner = dfogOuter + span.attrStepX[FRAG_ATTRIB_FOGC][0]; #endif #ifdef INTERP_RGB fdrInner = fdrOuter + span.redStep; @@ -1120,18 +1057,13 @@ static void NAME(GLcontext *ctx, const SWvertex *v0, dsInner = dsOuter + span.intTexStep[0]; dtInner = dtOuter + span.intTexStep[1]; #endif -#ifdef INTERP_TEX - TEX_UNIT_LOOP( - dsInner[u] = dsOuter[u] + span.texStepX[u][0]; - dtInner[u] = dtOuter[u] + span.texStepX[u][1]; - duInner[u] = duOuter[u] + span.texStepX[u][2]; - dvInner[u] = dvOuter[u] + span.texStepX[u][3]; - ) -#endif -#ifdef INTERP_VARYING - VARYING_LOOP( - dvarInner[iv][ic] = dvarOuter[iv][ic] + span.varStepX[iv][ic]; - ) +#ifdef INTERP_ATTRIBS + ATTRIB_LOOP_BEGIN + dsInner[attr] = dsOuter[attr] + span.attrStepX[attr][0]; + dtInner[attr] = dtOuter[attr] + span.attrStepX[attr][1]; + duInner[attr] = duOuter[attr] + span.attrStepX[attr][2]; + dvInner[attr] = dvOuter[attr] + span.attrStepX[attr][3]; + ATTRIB_LOOP_END #endif while (lines > 0) { @@ -1148,10 +1080,10 @@ static void NAME(GLcontext *ctx, const SWvertex *v0, span.z = zLeft; #endif #ifdef INTERP_W - span.w = wLeft; + span.attrStart[FRAG_ATTRIB_WPOS][3] = wLeft; #endif #ifdef INTERP_FOG - span.fog = fogLeft; + span.attrStart[FRAG_ATTRIB_FOGC][0] = fogLeft; #endif #ifdef INTERP_RGB span.red = rLeft; @@ -1174,18 +1106,13 @@ static void NAME(GLcontext *ctx, const SWvertex *v0, span.intTex[1] = tLeft; #endif -#ifdef INTERP_TEX - TEX_UNIT_LOOP( - span.tex[u][0] = sLeft[u]; - span.tex[u][1] = tLeft[u]; - span.tex[u][2] = uLeft[u]; - span.tex[u][3] = vLeft[u]; - ) -#endif -#ifdef INTERP_VARYING - VARYING_LOOP( - span.var[iv][ic] = varLeft[iv][ic]; - ) +#ifdef INTERP_ATTRIBS + ATTRIB_LOOP_BEGIN + span.attrStart[attr][0] = sLeft[attr]; + span.attrStart[attr][1] = tLeft[attr]; + span.attrStart[attr][2] = uLeft[attr]; + span.attrStart[attr][3] = vLeft[attr]; + ATTRIB_LOOP_END #endif /* This is where we actually generate fragments */ @@ -1267,18 +1194,13 @@ static void NAME(GLcontext *ctx, const SWvertex *v0, sLeft += dsOuter; tLeft += dtOuter; #endif -#ifdef INTERP_TEX - TEX_UNIT_LOOP( - sLeft[u] += dsOuter[u]; - tLeft[u] += dtOuter[u]; - uLeft[u] += duOuter[u]; - vLeft[u] += dvOuter[u]; - ) -#endif -#ifdef INTERP_VARYING - VARYING_LOOP( - varLeft[iv][ic] += dvarOuter[iv][ic]; - ) +#ifdef INTERP_ATTRIBS + ATTRIB_LOOP_BEGIN + sLeft[attr] += dsOuter[attr]; + tLeft[attr] += dtOuter[attr]; + uLeft[attr] += duOuter[attr]; + vLeft[attr] += dvOuter[attr]; + ATTRIB_LOOP_END #endif } else { @@ -1317,18 +1239,13 @@ static void NAME(GLcontext *ctx, const SWvertex *v0, sLeft += dsInner; tLeft += dtInner; #endif -#ifdef INTERP_TEX - TEX_UNIT_LOOP( - sLeft[u] += dsInner[u]; - tLeft[u] += dtInner[u]; - uLeft[u] += duInner[u]; - vLeft[u] += dvInner[u]; - ) -#endif -#ifdef INTERP_VARYING - VARYING_LOOP( - varLeft[iv][ic] += dvarInner[iv][ic]; - ) +#ifdef INTERP_ATTRIBS + ATTRIB_LOOP_BEGIN + sLeft[attr] += dsInner[attr]; + tLeft[attr] += dtInner[attr]; + uLeft[attr] += duInner[attr]; + vLeft[attr] += dvInner[attr]; + ATTRIB_LOOP_END #endif } } /*while lines>0*/ @@ -1359,9 +1276,7 @@ static void NAME(GLcontext *ctx, const SWvertex *v0, #undef INTERP_SPEC #undef INTERP_INDEX #undef INTERP_INT_TEX -#undef INTERP_TEX -#undef INTERP_MULTITEX -#undef INTERP_VARYING +#undef INTERP_ATTRIBS #undef TEX_UNIT_LOOP #undef VARYING_LOOP diff --git a/dist/Mesa/src/mesa/swrast/swrast.h b/dist/Mesa/src/mesa/swrast/swrast.h index 2a2123425..86405503a 100644 --- a/dist/Mesa/src/mesa/swrast/swrast.h +++ b/dist/Mesa/src/mesa/swrast/swrast.h @@ -67,13 +67,11 @@ typedef struct { * that clip{XYZ} were multiplied by to get ndc{XYZ}. */ GLfloat win[4]; - GLfloat texcoord[MAX_TEXTURE_COORD_UNITS][4]; GLchan color[4]; GLchan specular[4]; - GLfloat fog; GLfloat index; GLfloat pointSize; - GLfloat attribute[MAX_VERTEX_ATTRIBS][4]; + GLfloat attrib[FRAG_ATTRIB_MAX][4]; /**< texcoords & varying, more to come */ } SWvertex; @@ -130,13 +128,10 @@ _swrast_BlitFramebuffer(GLcontext *ctx, GLbitfield mask, GLenum filter); extern void -_swrast_Clear( GLcontext *ctx, GLbitfield mask, GLboolean all, - GLint x, GLint y, GLint width, GLint height ); +_swrast_Clear(GLcontext *ctx, GLbitfield buffers); extern void -_swrast_Accum( GLcontext *ctx, GLenum op, - GLfloat value, GLint xpos, GLint ypos, - GLint width, GLint height ); +_swrast_Accum(GLcontext *ctx, GLenum op, GLfloat value); @@ -145,6 +140,13 @@ _swrast_Accum( GLcontext *ctx, GLenum op, extern void _swrast_ResetLineStipple( GLcontext *ctx ); +/** + * Indicates front/back facing for subsequent points/lines when drawing + * unfilled polygons. Needed for two-side stencil. + */ +extern void +_swrast_SetFacing(GLcontext *ctx, GLuint facing); + /* These will always render the correct point/line/triangle for the * current state. * @@ -255,6 +257,13 @@ extern void _swrast_eject_texture_images(GLcontext *ctx); +#if FEATURE_MESA_program_debug +extern void +_swrast_get_program_register(GLcontext *, enum register_file file, + GLuint index, GLfloat val[4]); +#endif /* FEATURE_MESA_program_debug */ + + /** * The driver interface for the software rasterizer. * XXX this may go away. diff --git a/dist/Mesa/src/mesa/swrast_setup/ss_context.c b/dist/Mesa/src/mesa/swrast_setup/ss_context.c index cd76375d0..43f2696da 100644 --- a/dist/Mesa/src/mesa/swrast_setup/ss_context.c +++ b/dist/Mesa/src/mesa/swrast_setup/ss_context.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 6.5.3 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 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"), @@ -42,6 +42,9 @@ #define _SWSETUP_NEW_RENDERINDEX (_NEW_POLYGON|_NEW_LIGHT|_NEW_PROGRAM) +#define VARYING_EMIT_STYLE EMIT_4F + + GLboolean _swsetup_CreateContext( GLcontext *ctx ) { @@ -82,6 +85,10 @@ _swsetup_RenderPrimitive( GLcontext *ctx, GLenum mode ) _swrast_render_primitive( ctx, mode ); } + +/** + * Helper macros for setup_vertex_format() + */ #define SWZ ((SWvertex *)0) #define SWOffset(MEMBER) (((char *)&(SWZ->MEMBER)) - ((char *)SWZ)) @@ -93,32 +100,20 @@ do { \ e++; \ } while (0) -/* - * We patch this function into tnl->Driver.Render.Start. - * It's called when we start rendering a vertex buffer. + +/** + * Tell the tnl module how to build SWvertex objects for swrast. + * We'll build the map[] array with that info and pass it to + * _tnl_install_attrs(). */ static void -_swsetup_RenderStart( GLcontext *ctx ) +setup_vertex_format(GLcontext *ctx) { - SScontext *swsetup = SWSETUP_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *VB = &tnl->vb; - GLuint new_state = swsetup->NewState; - - if (new_state & _SWSETUP_NEW_RENDERINDEX) { - _swsetup_choose_trifuncs( ctx ); - } - - swsetup->NewState = 0; - - _swrast_render_start( ctx ); - - /* Important: - */ - VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr; - + SScontext *swsetup = SWSETUP_CONTEXT(ctx); - if (!RENDERINPUTS_EQUAL(tnl->render_inputs_bitset, swsetup->last_index_bitset)) { + if (!RENDERINPUTS_EQUAL(tnl->render_inputs_bitset, + swsetup->last_index_bitset)) { DECLARE_RENDERINPUTS(index_bitset); struct tnl_attr_map map[_TNL_ATTRIB_MAX]; int i, e = 0; @@ -136,23 +131,30 @@ _swsetup_RenderStart( GLcontext *ctx ) if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR_INDEX )) EMIT_ATTR( _TNL_ATTRIB_COLOR_INDEX, EMIT_1F, index ); - if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG )) - EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1F, fog); + if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG )) { + const GLint emit = ctx->FragmentProgram._Current ? EMIT_4F : EMIT_1F; + EMIT_ATTR( _TNL_ATTRIB_FOG, emit, attrib[FRAG_ATTRIB_FOGC]); + } - if (RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX )) { + if (RENDERINPUTS_TEST_RANGE(index_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX)) + { for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) { if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX(i) )) { - EMIT_ATTR( _TNL_ATTRIB_TEX(i), EMIT_4F, texcoord[i] ); + EMIT_ATTR( _TNL_ATTRIB_TEX(i), EMIT_4F, + attrib[FRAG_ATTRIB_TEX0 + i] ); } } } - if (RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_FIRST_GENERIC, _TNL_LAST_GENERIC )) { - for (i = 0; i < MAX_VERTEX_ATTRIBS; i++) { - if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_GENERIC(i) )) { - EMIT_ATTR( _TNL_ATTRIB_GENERIC(i), VARYING_EMIT_STYLE, attribute[i] ); - } - } + /* shader varying vars */ + if (RENDERINPUTS_TEST_RANGE( index_bitset, + _TNL_FIRST_GENERIC, _TNL_LAST_GENERIC )) { + for (i = 0; i < ctx->Const.MaxVarying; i++) { + if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_GENERIC(i) )) { + EMIT_ATTR( _TNL_ATTRIB_GENERIC(i), VARYING_EMIT_STYLE, + attrib[FRAG_ATTRIB_VAR0 + i] ); + } + } } if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_POINTSIZE )) @@ -166,6 +168,36 @@ _swsetup_RenderStart( GLcontext *ctx ) } } + +/** + * Prepare to render a vertex buffer. + * Called via tnl->Driver.Render.Start. + */ +static void +_swsetup_RenderStart( GLcontext *ctx ) +{ + SScontext *swsetup = SWSETUP_CONTEXT(ctx); + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + + if (swsetup->NewState & _SWSETUP_NEW_RENDERINDEX) { + _swsetup_choose_trifuncs(ctx); + } + + swsetup->NewState = 0; + + /* This will change if drawing unfilled tris */ + _swrast_SetFacing(ctx, 0); + + _swrast_render_start(ctx); + + /* Important */ + VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr; + + setup_vertex_format(ctx); +} + + /* * We patch this function into tnl->Driver.Render.Finish. * It's called when we finish rendering a vertex buffer. @@ -234,10 +266,15 @@ _swsetup_Translate( GLcontext *ctx, const void *vertex, SWvertex *dest ) dest->win[2] = m[10] * tmp[2] + m[14]; dest->win[3] = tmp[3]; - + /** XXX try to limit these loops someday */ for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) - _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_TEX0+i, dest->texcoord[i] ); - + _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_TEX0+i, + dest->attrib[FRAG_ATTRIB_TEX0 + i] ); + + for (i = 0 ; i < ctx->Const.MaxVarying ; i++) + _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_GENERIC0+i, + dest->attrib[FRAG_ATTRIB_VAR0 + i] ); + _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_COLOR0, tmp ); UNCLAMPED_FLOAT_TO_RGBA_CHAN( dest->color, tmp ); @@ -245,11 +282,12 @@ _swsetup_Translate( GLcontext *ctx, const void *vertex, SWvertex *dest ) UNCLAMPED_FLOAT_TO_RGBA_CHAN( dest->specular, tmp ); _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_FOG, tmp ); - dest->fog = tmp[0]; + dest->attrib[FRAG_ATTRIB_FOGC][0] = tmp[0]; _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_COLOR_INDEX, tmp ); dest->index = tmp[0]; + /* XXX See _tnl_get_attr about pointsize ... */ _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_POINTSIZE, tmp ); dest->pointSize = tmp[0]; } diff --git a/dist/Mesa/src/mesa/swrast_setup/ss_triangle.c b/dist/Mesa/src/mesa/swrast_setup/ss_triangle.c index 09244d9c4..058567337 100644 --- a/dist/Mesa/src/mesa/swrast_setup/ss_triangle.c +++ b/dist/Mesa/src/mesa/swrast_setup/ss_triangle.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.1 + * Version: 7.1 * - * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 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"), @@ -68,6 +68,8 @@ static void _swsetup_render_line_tri( GLcontext *ctx, return; } + _swrast_SetFacing(ctx, facing); + if (ctx->Light.ShadeModel == GL_FLAT) { COPY_CHAN4(c[0], v0->color); COPY_CHAN4(c[1], v1->color); @@ -127,6 +129,8 @@ static void _swsetup_render_point_tri( GLcontext *ctx, return; } + _swrast_SetFacing(ctx, facing); + if (ctx->Light.ShadeModel == GL_FLAT) { /* save colors/indexes for v0, v1 vertices */ COPY_CHAN4(c[0], v0->color); @@ -291,7 +295,7 @@ void _swsetup_choose_trifuncs( GLcontext *ctx ) ind |= SS_OFFSET_BIT; if ((ctx->Light.Enabled && ctx->Light.Model.TwoSide) || - (ctx->VertexProgram._Enabled && ctx->VertexProgram.TwoSideEnabled)) + (ctx->VertexProgram._Current && ctx->VertexProgram.TwoSideEnabled)) ind |= SS_TWOSIDE_BIT; /* We piggyback the two-sided stencil front/back determination on the @@ -309,6 +313,4 @@ void _swsetup_choose_trifuncs( GLcontext *ctx ) tnl->Driver.Render.Quad = quad_tab[ind]; tnl->Driver.Render.Line = swsetup_line; tnl->Driver.Render.Points = swsetup_points; - - ctx->_Facing = 0; } diff --git a/dist/Mesa/src/mesa/swrast_setup/ss_tritmp.h b/dist/Mesa/src/mesa/swrast_setup/ss_tritmp.h index 59c534ee5..0e0cbce3c 100644 --- a/dist/Mesa/src/mesa/swrast_setup/ss_tritmp.h +++ b/dist/Mesa/src/mesa/swrast_setup/ss_tritmp.h @@ -43,7 +43,6 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) v[1] = &verts[e1]; v[2] = &verts[e2]; - if (IND & (SS_TWOSIDE_BIT | SS_OFFSET_BIT | SS_UNFILLED_BIT)) { GLfloat ex = v[0]->win[0] - v[2]->win[0]; @@ -55,7 +54,6 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) if (IND & (SS_TWOSIDE_BIT | SS_UNFILLED_BIT)) { facing = (cc < 0.0) ^ ctx->Polygon._FrontBit; - ctx->_Facing = facing; if (IND & SS_UNFILLED_BIT) mode = facing ? ctx->Polygon.BackMode : ctx->Polygon.FrontMode; diff --git a/dist/Mesa/src/mesa/tnl/t_vb_program.c b/dist/Mesa/src/mesa/tnl/t_vb_program.c index 36ee4b2f4..03e1ad293 100644 --- a/dist/Mesa/src/mesa/tnl/t_vb_program.c +++ b/dist/Mesa/src/mesa/tnl/t_vb_program.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 7.1 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 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"), @@ -25,29 +25,28 @@ /** * \file tnl/t_vb_program.c - * \brief Pipeline stage for executing NVIDIA vertex programs. + * \brief Pipeline stage for executing vertex programs. * \author Brian Paul, Keith Whitwell */ -#include "glheader.h" -#include "api_noop.h" -#include "colormac.h" -#include "context.h" -#include "dlist.h" -#include "hash.h" -#include "light.h" -#include "macros.h" -#include "imports.h" -#include "simple_list.h" -#include "mtypes.h" -#include "program_instruction.h" -#include "nvvertexec.h" -#include "nvprogram.h" +#include "main/glheader.h" +#include "main/colormac.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/imports.h" +#include "shader/prog_instruction.h" +#include "shader/prog_statevars.h" +#include "shader/prog_execute.h" +#include "swrast/s_context.h" +#include "swrast/s_texfilter.h" -#include "t_context.h" -#include "t_pipeline.h" +#include "tnl/tnl.h" +#include "tnl/t_context.h" +#include "tnl/t_pipeline.h" +#include "swrast/s_context.h" +#include "swrast/s_texfilter.h" /*! @@ -55,7 +54,7 @@ */ struct vp_stage_data { /** The results of running the vertex program go into these arrays. */ - GLvector4f attribs[15]; + GLvector4f results[VERT_RESULT_MAX]; GLvector4f ndcCoords; /**< normalized device coords */ GLubyte *clipmask; /**< clip flags */ @@ -66,6 +65,232 @@ struct vp_stage_data { #define VP_STAGE_DATA(stage) ((struct vp_stage_data *)(stage->privatePtr)) +static void +userclip( GLcontext *ctx, + GLvector4f *clip, + GLubyte *clipmask, + GLubyte *clipormask, + GLubyte *clipandmask ) +{ + GLuint p; + + for (p = 0; p < ctx->Const.MaxClipPlanes; p++) { + if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { + GLuint nr, i; + const GLfloat a = ctx->Transform._ClipUserPlane[p][0]; + const GLfloat b = ctx->Transform._ClipUserPlane[p][1]; + const GLfloat c = ctx->Transform._ClipUserPlane[p][2]; + const GLfloat d = ctx->Transform._ClipUserPlane[p][3]; + GLfloat *coord = (GLfloat *)clip->data; + GLuint stride = clip->stride; + GLuint count = clip->count; + + for (nr = 0, i = 0 ; i < count ; i++) { + GLfloat dp = (coord[0] * a + + coord[1] * b + + coord[2] * c + + coord[3] * d); + + if (dp < 0) { + nr++; + clipmask[i] |= CLIP_USER_BIT; + } + + STRIDE_F(coord, stride); + } + + if (nr > 0) { + *clipormask |= CLIP_USER_BIT; + if (nr == count) { + *clipandmask |= CLIP_USER_BIT; + return; + } + } + } + } +} + + +static GLboolean +do_ndc_cliptest(GLcontext *ctx, struct vp_stage_data *store) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + /* Cliptest and perspective divide. Clip functions must clear + * the clipmask. + */ + store->ormask = 0; + store->andmask = CLIP_FRUSTUM_BITS; + + if (tnl->NeedNdcCoords) { + VB->NdcPtr = + _mesa_clip_tab[VB->ClipPtr->size]( VB->ClipPtr, + &store->ndcCoords, + store->clipmask, + &store->ormask, + &store->andmask ); + } + else { + VB->NdcPtr = NULL; + _mesa_clip_np_tab[VB->ClipPtr->size]( VB->ClipPtr, + NULL, + store->clipmask, + &store->ormask, + &store->andmask ); + } + + if (store->andmask) { + /* All vertices are outside the frustum */ + return GL_FALSE; + } + + /* Test userclip planes. This contributes to VB->ClipMask. + */ + /** XXX NEW_SLANG _Enabled ??? */ + if (ctx->Transform.ClipPlanesEnabled && (!ctx->VertexProgram._Enabled || + ctx->VertexProgram.Current->IsPositionInvariant)) { + userclip( ctx, + VB->ClipPtr, + store->clipmask, + &store->ormask, + &store->andmask ); + + if (store->andmask) { + return GL_FALSE; + } + } + + VB->ClipAndMask = store->andmask; + VB->ClipOrMask = store->ormask; + VB->ClipMask = store->clipmask; + + return GL_TRUE; +} + + +/** + * XXX the texture sampling code in this module is a bit of a hack. + * The texture sampling code is in swrast, though it doesn't have any + * real dependencies on the rest of swrast. It should probably be + * moved into main/ someday. + */ +static void +vp_fetch_texel(GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda, + GLuint unit, GLfloat color[4]) +{ + GLchan rgba[4]; + SWcontext *swrast = SWRAST_CONTEXT(ctx); + + /* XXX use a float-valued TextureSample routine here!!! */ + swrast->TextureSample[unit](ctx, ctx->Texture.Unit[unit]._Current, + 1, (const GLfloat (*)[4]) texcoord, + &lambda, &rgba); + color[0] = CHAN_TO_FLOAT(rgba[0]); + color[1] = CHAN_TO_FLOAT(rgba[1]); + color[2] = CHAN_TO_FLOAT(rgba[2]); + color[3] = CHAN_TO_FLOAT(rgba[3]); +} + + +/** + * Called via ctx->Driver.ProgramStringNotify() after a new vertex program + * string has been parsed. + */ +void +_tnl_program_string(GLcontext *ctx, GLenum target, struct gl_program *program) +{ + /* No-op. + * If we had derived anything from the program that was private to this + * stage we'd recompute/validate it here. + */ +} + + +/** + * Initialize virtual machine state prior to executing vertex program. + */ +static void +init_machine(GLcontext *ctx, struct gl_program_machine *machine) +{ + /* Input registers get initialized from the current vertex attribs */ + MEMCPY(machine->VertAttribs, ctx->Current.Attrib, + MAX_VERTEX_PROGRAM_ATTRIBS * 4 * sizeof(GLfloat)); + + if (ctx->VertexProgram._Current->IsNVProgram) { + GLuint i; + /* Output/result regs are initialized to [0,0,0,1] */ + for (i = 0; i < MAX_NV_VERTEX_PROGRAM_OUTPUTS; i++) { + ASSIGN_4V(machine->Outputs[i], 0.0F, 0.0F, 0.0F, 1.0F); + } + /* Temp regs are initialized to [0,0,0,0] */ + for (i = 0; i < MAX_NV_VERTEX_PROGRAM_TEMPS; i++) { + ASSIGN_4V(machine->Temporaries[i], 0.0F, 0.0F, 0.0F, 0.0F); + } + for (i = 0; i < MAX_VERTEX_PROGRAM_ADDRESS_REGS; i++) { + ASSIGN_4V(machine->AddressReg[i], 0, 0, 0, 0); + } + } + + machine->NumDeriv = 0; + + /* init condition codes */ + machine->CondCodes[0] = COND_EQ; + machine->CondCodes[1] = COND_EQ; + machine->CondCodes[2] = COND_EQ; + machine->CondCodes[3] = COND_EQ; + + /* init call stack */ + machine->StackDepth = 0; + + machine->FetchTexelLod = vp_fetch_texel; + machine->FetchTexelDeriv = NULL; /* not used by vertex programs */ +} + + +/** + * Map the texture images which the vertex program will access (if any). + */ +static void +map_textures(GLcontext *ctx, const struct gl_vertex_program *vp) +{ + GLuint u; + + if (!ctx->Driver.MapTexture) + return; + + for (u = 0; u < ctx->Const.MaxVertexTextureImageUnits; u++) { + if (vp->Base.TexturesUsed[u]) { + /* Note: _Current *should* correspond to the target indicated + * in TexturesUsed[u]. + */ + ctx->Driver.MapTexture(ctx, ctx->Texture.Unit[u]._Current); + } + } +} + + +/** + * Unmap the texture images which were used by the vertex program (if any). + */ +static void +unmap_textures(GLcontext *ctx, const struct gl_vertex_program *vp) +{ + GLuint u; + + if (!ctx->Driver.MapTexture) + return; + + for (u = 0; u < ctx->Const.MaxVertexTextureImageUnits; u++) { + if (vp->Base.TexturesUsed[u]) { + /* Note: _Current *should* correspond to the target indicated + * in TexturesUsed[u]. + */ + ctx->Driver.UnmapTexture(ctx, ctx->Texture.Unit[u]._Current); + } + } +} + + /** * This function executes vertex programs */ @@ -75,23 +300,36 @@ run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage ) TNLcontext *tnl = TNL_CONTEXT(ctx); struct vp_stage_data *store = VP_STAGE_DATA(stage); struct vertex_buffer *VB = &tnl->vb; - struct gl_vertex_program *program = ctx->VertexProgram.Current; - GLuint i; + struct gl_vertex_program *program = ctx->VertexProgram._Current; + struct gl_program_machine machine; + GLuint outputs[VERT_RESULT_MAX], numOutputs; + GLuint i, j; - if (ctx->ShaderObjects._VertexShaderPresent) + if (!program) return GL_TRUE; - if (!ctx->VertexProgram._Enabled || - !program->IsNVProgram) - return GL_TRUE; + if (program->IsNVProgram) { + _mesa_load_tracked_matrices(ctx); + } + else { + /* ARB program or vertex shader */ + _mesa_load_state_parameters(ctx, program->Base.Parameters); + } + + /* make list of outputs to save some time below */ + numOutputs = 0; + for (i = 0; i < VERT_RESULT_MAX; i++) { + if (program->Base.OutputsWritten & (1 << i)) { + outputs[numOutputs++] = i; + } + } - /* load program parameter registers (they're read-only) */ - _mesa_init_vp_per_primitive_registers(ctx); + map_textures(ctx, program); for (i = 0; i < VB->Count; i++) { GLuint attr; - _mesa_init_vp_per_vertex_registers(ctx); + init_machine(ctx, &machine); #if 0 printf("Input %d: %f, %f, %f, %f\n", i, @@ -118,102 +356,117 @@ run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage ) const GLuint size = VB->AttribPtr[attr]->size; const GLuint stride = VB->AttribPtr[attr]->stride; const GLfloat *data = (GLfloat *) (ptr + stride * i); - COPY_CLEAN_4V(ctx->VertexProgram.Inputs[attr], size, data); + COPY_CLEAN_4V(machine.VertAttribs[attr], size, data); } } /* execute the program */ - ASSERT(program); - _mesa_exec_vertex_program(ctx, program); + _mesa_execute_program(ctx, &program->Base, &machine); + + /* copy the output registers into the VB->attribs arrays */ + for (j = 0; j < numOutputs; j++) { + const GLuint attr = outputs[j]; + COPY_4V(store->results[attr].data[i], machine.Outputs[attr]); + } +#if 0 + printf("HPOS: %f %f %f %f\n", + machine.Outputs[0][0], + machine.Outputs[0][1], + machine.Outputs[0][2], + machine.Outputs[0][3]); +#endif + } + + unmap_textures(ctx, program); - /* Fixup fog an point size results if needed */ + /* Fixup fog and point size results if needed */ + if (program->IsNVProgram) { if (ctx->Fog.Enabled && (program->Base.OutputsWritten & (1 << VERT_RESULT_FOGC)) == 0) { - ctx->VertexProgram.Outputs[VERT_RESULT_FOGC][0] = 1.0; + for (i = 0; i < VB->Count; i++) { + store->results[VERT_RESULT_FOGC].data[i][0] = 1.0; + } } if (ctx->VertexProgram.PointSizeEnabled && (program->Base.OutputsWritten & (1 << VERT_RESULT_PSIZ)) == 0) { - ctx->VertexProgram.Outputs[VERT_RESULT_PSIZ][0] = ctx->Point.Size; + for (i = 0; i < VB->Count; i++) { + store->results[VERT_RESULT_PSIZ].data[i][0] = ctx->Point.Size; + } } + } - /* copy the output registers into the VB->attribs arrays */ - /* XXX (optimize) could use a conditional and smaller loop limit here */ - for (attr = 0; attr < 15; attr++) { - COPY_4V(store->attribs[attr].data[i], - ctx->VertexProgram.Outputs[attr]); + if (program->IsPositionInvariant) { + /* We need the exact same transform as in the fixed function path here + * to guarantee invariance, depending on compiler optimization flags + * results could be different otherwise. + */ + VB->ClipPtr = TransformRaw( &store->results[0], + &ctx->_ModelProjectMatrix, + VB->AttribPtr[0] ); + + /* Drivers expect this to be clean to element 4... + */ + switch (VB->ClipPtr->size) { + case 1: + /* impossible */ + case 2: + _mesa_vector4f_clean_elem( VB->ClipPtr, VB->Count, 2 ); + /* fall-through */ + case 3: + _mesa_vector4f_clean_elem( VB->ClipPtr, VB->Count, 3 ); + /* fall-through */ + case 4: + break; } } + else { + /* Setup the VB pointers so that the next pipeline stages get + * their data from the right place (the program output arrays). + */ + VB->ClipPtr = &store->results[VERT_RESULT_HPOS]; + VB->ClipPtr->size = 4; + VB->ClipPtr->count = VB->Count; + } - /* Setup the VB pointers so that the next pipeline stages get - * their data from the right place (the program output arrays). - */ - VB->ClipPtr = &store->attribs[VERT_RESULT_HPOS]; - VB->ClipPtr->size = 4; - VB->ClipPtr->count = VB->Count; - VB->ColorPtr[0] = &store->attribs[VERT_RESULT_COL0]; - VB->ColorPtr[1] = &store->attribs[VERT_RESULT_BFC0]; - VB->SecondaryColorPtr[0] = &store->attribs[VERT_RESULT_COL1]; - VB->SecondaryColorPtr[1] = &store->attribs[VERT_RESULT_BFC1]; - VB->FogCoordPtr = &store->attribs[VERT_RESULT_FOGC]; - - VB->AttribPtr[VERT_ATTRIB_COLOR0] = &store->attribs[VERT_RESULT_COL0]; - VB->AttribPtr[VERT_ATTRIB_COLOR1] = &store->attribs[VERT_RESULT_COL1]; - VB->AttribPtr[VERT_ATTRIB_FOG] = &store->attribs[VERT_RESULT_FOGC]; - VB->AttribPtr[_TNL_ATTRIB_POINTSIZE] = &store->attribs[VERT_RESULT_PSIZ]; + VB->ColorPtr[0] = &store->results[VERT_RESULT_COL0]; + VB->ColorPtr[1] = &store->results[VERT_RESULT_BFC0]; + VB->SecondaryColorPtr[0] = &store->results[VERT_RESULT_COL1]; + VB->SecondaryColorPtr[1] = &store->results[VERT_RESULT_BFC1]; + VB->FogCoordPtr = &store->results[VERT_RESULT_FOGC]; + + VB->AttribPtr[VERT_ATTRIB_COLOR0] = &store->results[VERT_RESULT_COL0]; + VB->AttribPtr[VERT_ATTRIB_COLOR1] = &store->results[VERT_RESULT_COL1]; + VB->AttribPtr[VERT_ATTRIB_FOG] = &store->results[VERT_RESULT_FOGC]; + VB->AttribPtr[_TNL_ATTRIB_POINTSIZE] = &store->results[VERT_RESULT_PSIZ]; for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { VB->TexCoordPtr[i] = VB->AttribPtr[_TNL_ATTRIB_TEX0 + i] - = &store->attribs[VERT_RESULT_TEX0 + i]; + = &store->results[VERT_RESULT_TEX0 + i]; } - /* Cliptest and perspective divide. Clip functions must clear - * the clipmask. - */ - store->ormask = 0; - store->andmask = CLIP_FRUSTUM_BITS; - - if (tnl->NeedNdcCoords) { - VB->NdcPtr = - _mesa_clip_tab[VB->ClipPtr->size]( VB->ClipPtr, - &store->ndcCoords, - store->clipmask, - &store->ormask, - &store->andmask ); - } - else { - VB->NdcPtr = NULL; - _mesa_clip_np_tab[VB->ClipPtr->size]( VB->ClipPtr, - NULL, - store->clipmask, - &store->ormask, - &store->andmask ); + for (i = 0; i < ctx->Const.MaxVarying; i++) { + if (program->Base.OutputsWritten & (1 << (VERT_RESULT_VAR0 + i))) { + /* Note: varying results get put into the generic attributes */ + VB->AttribPtr[VERT_ATTRIB_GENERIC0+i] + = &store->results[VERT_RESULT_VAR0 + i]; + } } - if (store->andmask) /* All vertices are outside the frustum */ - return GL_FALSE; - - /* This is where we'd do clip testing against the user-defined - * clipping planes, but they're not supported by vertex programs. + /* Perform NDC and cliptest operations: */ - - VB->ClipOrMask = store->ormask; - VB->ClipMask = store->clipmask; - - return GL_TRUE; + return do_ndc_cliptest(ctx, store); } - - /** * Called the first time stage->run is called. In effect, don't * allocate data until the first time the stage is run. */ -static GLboolean init_vp( GLcontext *ctx, - struct tnl_pipeline_stage *stage ) +static GLboolean +init_vp(GLcontext *ctx, struct tnl_pipeline_stage *stage) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &(tnl->vb); @@ -227,10 +480,9 @@ static GLboolean init_vp( GLcontext *ctx, return GL_FALSE; /* Allocate arrays of vertex output values */ - /* XXX change '15' to a named constant */ - for (i = 0; i < 15; i++) { - _mesa_vector4f_alloc( &store->attribs[i], 0, size, 32 ); - store->attribs[i].size = 4; + for (i = 0; i < VERT_RESULT_MAX; i++) { + _mesa_vector4f_alloc( &store->results[i], 0, size, 32 ); + store->results[i].size = 4; } /* a few other misc allocations */ @@ -241,13 +493,11 @@ static GLboolean init_vp( GLcontext *ctx, } - - - /** * Destructor for this pipeline stage. */ -static void dtr( struct tnl_pipeline_stage *stage ) +static void +dtr(struct tnl_pipeline_stage *stage) { struct vp_stage_data *store = VP_STAGE_DATA(stage); @@ -256,7 +506,7 @@ static void dtr( struct tnl_pipeline_stage *stage ) /* free the vertex program result arrays */ for (i = 0; i < VERT_RESULT_MAX; i++) - _mesa_vector4f_free( &store->attribs[i] ); + _mesa_vector4f_free( &store->results[i] ); /* free misc arrays */ _mesa_vector4f_free( &store->ndcCoords ); @@ -267,6 +517,17 @@ static void dtr( struct tnl_pipeline_stage *stage ) } } + +static void +validate_vp_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage) +{ + if (ctx->VertexProgram._Current) { + _swrast_update_texture_samplers(ctx); + } +} + + + /** * Public description of this pipeline stage. */ @@ -276,6 +537,6 @@ const struct tnl_pipeline_stage _tnl_vertex_program_stage = NULL, /* private_data */ init_vp, /* create */ dtr, /* destroy */ - NULL, /* validate */ + validate_vp_stage, /* validate */ run_vp /* run -- initially set to ctr */ }; diff --git a/dist/Mesa/src/mesa/tnl/t_vertex_sse.c b/dist/Mesa/src/mesa/tnl/t_vertex_sse.c index 9515d9f81..f1c98fe2d 100644 --- a/dist/Mesa/src/mesa/tnl/t_vertex_sse.c +++ b/dist/Mesa/src/mesa/tnl/t_vertex_sse.c @@ -648,12 +648,12 @@ void _tnl_generate_sse_emit( GLcontext *ctx ) p.ctx = ctx; p.inputs_safe = 0; /* for now */ - p.outputs_safe = 1; /* for now */ + p.outputs_safe = 0; /* for now */ p.have_sse2 = cpu_has_xmm2; p.identity = x86_make_reg(file_XMM, 6); p.chan0 = x86_make_reg(file_XMM, 7); - if (!x86_init_func(&p.func, MAX_SSE_CODE_SIZE)) { + if (!x86_init_func_size(&p.func, MAX_SSE_CODE_SIZE)) { vtx->emit = NULL; return; } diff --git a/dist/Mesa/src/mesa/tnl/tnl.h b/dist/Mesa/src/mesa/tnl/tnl.h index dab422429..c8c009354 100644 --- a/dist/Mesa/src/mesa/tnl/tnl.h +++ b/dist/Mesa/src/mesa/tnl/tnl.h @@ -1,9 +1,8 @@ - /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 7.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 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"), @@ -50,30 +49,14 @@ _tnl_InvalidateState( GLcontext *ctx, GLuint new_state ); * dispatch and/or driver callbacks. */ -/* Restore just the ctx->Exec table: - */ -extern void -_tnl_wakeup_exec( GLcontext *ctx ); - -/* Restore both ctx->Exec and ctx->Save: - */ extern void -_tnl_wakeup_save_exec( GLcontext *ctx ); +_tnl_wakeup( GLcontext *ctx ); /* Driver configuration options: */ extern void _tnl_need_projected_coords( GLcontext *ctx, GLboolean flag ); -extern void -_tnl_need_dlist_loopback( GLcontext *ctx, GLboolean flag ); - -extern void -_tnl_need_dlist_norm_lengths( GLcontext *ctx, GLboolean flag ); - -extern void -_tnl_isolate_materials( GLcontext *ctx, GLboolean flag ); - /* Control whether T&L does per-vertex fog */ @@ -86,4 +69,16 @@ _tnl_allow_pixel_fog( GLcontext *ctx, GLboolean value ); extern void _tnl_program_string(GLcontext *ctx, GLenum target, struct gl_program *program); +struct _mesa_prim; +struct _mesa_index_buffer; + +void +_tnl_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); + #endif diff --git a/dist/Mesa/src/mesa/tnl_dd/t_dd_tritmp.h b/dist/Mesa/src/mesa/tnl_dd/t_dd_tritmp.h index 0bf32ff34..6c2378f5e 100644 --- a/dist/Mesa/src/mesa/tnl_dd/t_dd_tritmp.h +++ b/dist/Mesa/src/mesa/tnl_dd/t_dd_tritmp.h @@ -155,10 +155,6 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) { facing = AREA_IS_CCW( cc ) ^ ctx->Polygon._FrontBit; - if (DO_TWOSTENCIL && ctx->Stencil.TestTwoSide) { - ctx->_Facing = facing; /* mixed mode rendering: for 2-sided stencil test */ - } - if (DO_UNFILLED) { if (facing) { mode = ctx->Polygon.BackMode; @@ -421,10 +417,6 @@ static void TAG(quad)( GLcontext *ctx, { facing = AREA_IS_CCW( cc ) ^ ctx->Polygon._FrontBit; - if (DO_TWOSTENCIL && ctx->Stencil.TestTwoSide) { - ctx->_Facing = facing; /* mixed mode rendering: for 2-sided stencil test */ - } - if (DO_UNFILLED) { if (facing) { mode = ctx->Polygon.BackMode; diff --git a/dist/Mesa/src/mesa/vbo/vbo_context.c b/dist/Mesa/src/mesa/vbo/vbo_context.c index f64f59d11..f128ae634 100644 --- a/dist/Mesa/src/mesa/vbo/vbo_context.c +++ b/dist/Mesa/src/mesa/vbo/vbo_context.c @@ -242,6 +242,7 @@ void _vbo_DestroyContext( GLcontext *ctx ) } vbo_exec_destroy(ctx); + vbo_save_destroy(ctx); FREE(vbo_context(ctx)); ctx->swtnl_im = NULL; } diff --git a/dist/Mesa/src/mesa/vbo/vbo_exec.h b/dist/Mesa/src/mesa/vbo/vbo_exec.h index a9b01e08e..9a9e89246 100644 --- a/dist/Mesa/src/mesa/vbo/vbo_exec.h +++ b/dist/Mesa/src/mesa/vbo/vbo_exec.h @@ -162,4 +162,7 @@ void vbo_exec_do_EvalCoord2f( struct vbo_exec_context *exec, void vbo_exec_do_EvalCoord1f( struct vbo_exec_context *exec, GLfloat u); +extern GLboolean +vbo_validate_shaders(GLcontext *ctx); + #endif diff --git a/dist/Mesa/src/mesa/vbo/vbo_exec_api.c b/dist/Mesa/src/mesa/vbo/vbo_exec_api.c index 2d4ded0f9..6812f88ae 100644 --- a/dist/Mesa/src/mesa/vbo/vbo_exec_api.c +++ b/dist/Mesa/src/mesa/vbo/vbo_exec_api.c @@ -477,6 +477,23 @@ static void GLAPIENTRY vbo_exec_EvalPoint2( GLint i, GLint j ) } +/** + * Check if programs/shaders are enabled and valid at glBegin time. + */ +GLboolean +vbo_validate_shaders(GLcontext *ctx) +{ + if ((ctx->VertexProgram.Enabled && !ctx->VertexProgram._Enabled) || + (ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled)) { + return GL_FALSE; + } + if (ctx->Shader.CurrentProgram && !ctx->Shader.CurrentProgram->LinkStatus) { + return GL_FALSE; + } + return GL_TRUE; +} + + /* Build a list of primitives on the fly. Keep * ctx->Driver.CurrentExecPrimitive uptodate as well. */ @@ -491,18 +508,16 @@ static void GLAPIENTRY vbo_exec_Begin( GLenum mode ) if (ctx->NewState) { _mesa_update_state( ctx ); - /* XXX also need to check if shader enabled, but invalid */ - if ((ctx->VertexProgram.Enabled && !ctx->VertexProgram._Enabled) || - (ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glBegin (invalid vertex/fragment program)"); - return; - } - CALL_Begin(ctx->Exec, (mode)); return; } + if (!vbo_validate_shaders(ctx)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBegin (invalid vertex/fragment program)"); + return; + } + /* Heuristic: attempt to isolate attributes occuring outside * begin/end pairs. */ diff --git a/dist/Mesa/src/mesa/vbo/vbo_exec_array.c b/dist/Mesa/src/mesa/vbo/vbo_exec_array.c index 1e4c31020..8f70e3505 100644 --- a/dist/Mesa/src/mesa/vbo/vbo_exec_array.c +++ b/dist/Mesa/src/mesa/vbo/vbo_exec_array.c @@ -245,6 +245,11 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count) if (ctx->NewState) _mesa_update_state( ctx ); + if (!vbo_validate_shaders(ctx)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawArrays(bad shader)"); + return; + } + bind_arrays( ctx ); prim[0].begin = 1; @@ -280,6 +285,11 @@ vbo_exec_DrawRangeElements(GLenum mode, if (ctx->NewState) _mesa_update_state( ctx ); + if (!vbo_validate_shaders(ctx)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawRangeElements(bad shader)"); + return; + } + bind_arrays( ctx ); ib.count = count; @@ -340,6 +350,11 @@ vbo_exec_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *ind if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices )) return; + if (!vbo_validate_shaders(ctx)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawElements(bad shader)"); + return; + } + if (ctx->Array.ElementArrayBufferObj->Name) { const GLvoid *map = ctx->Driver.MapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER_ARB, diff --git a/dist/Mesa/src/mesa/vbo/vbo_save.c b/dist/Mesa/src/mesa/vbo/vbo_save.c index e7f468796..38d9d3f8f 100644 --- a/dist/Mesa/src/mesa/vbo/vbo_save.c +++ b/dist/Mesa/src/mesa/vbo/vbo_save.c @@ -69,6 +69,21 @@ void vbo_save_init( GLcontext *ctx ) void vbo_save_destroy( GLcontext *ctx ) { + struct vbo_context *vbo = vbo_context(ctx); + struct vbo_save_context *save = &vbo->save; + if (save->prim_store) { + if ( --save->prim_store->refcount == 0 ) { + FREE( save->prim_store ); + save->prim_store = NULL; + } + if ( --save->vertex_store->refcount == 0 ) { + if (save->vertex_store->bufferobj) + ctx->Driver.DeleteBuffer( ctx, save->vertex_store->bufferobj ); + + FREE( save->vertex_store ); + save->vertex_store = NULL; + } + } } diff --git a/dist/Mesa/src/mesa/x86/matypes.h b/dist/Mesa/src/mesa/x86/matypes.h deleted file mode 100644 index 3ce781d49..000000000 --- a/dist/Mesa/src/mesa/x86/matypes.h +++ /dev/null @@ -1,163 +0,0 @@ -/* - * This file is automatically generated from the Mesa internal type - * definitions. Do not edit directly. - */ - -#ifndef __ASM_TYPES_H__ -#define __ASM_TYPES_H__ - -#include "assyntax.h" - - -/* ============================================================= - * Offsets for GLcontext - */ - -#define CTX_DRIVER_CTX 952 - -#define CTX_LIGHT_ENABLED 39056 -#define CTX_LIGHT_SHADE_MODEL 39060 -#define CTX_LIGHT_COLOR_MAT_FACE 39064 -#define CTX_LIGHT_COLOR_MAT_MODE 39068 -#define CTX_LIGHT_COLOR_MAT_MASK 39072 -#define CTX_LIGHT_COLOR_MAT_ENABLED 39076 -#define CTX_LIGHT_ENABLED_LIST 39084 -#define CTX_LIGHT_NEED_VERTS 43445 -#define CTX_LIGHT_FLAGS 43448 -#define CTX_LIGHT_BASE_COLOR 43452 - - -/* ============================================================= - * Offsets for struct vertex_buffer - */ - -#define VB_SIZE 0 -#define VB_COUNT 4 - -#define VB_ELTS 8 -#define VB_OBJ_PTR 12 -#define VB_EYE_PTR 16 -#define VB_CLIP_PTR 20 -#define VB_PROJ_CLIP_PTR 24 -#define VB_CLIP_OR_MASK 28 -#define VB_CLIP_MASK 32 -#define VB_NORMAL_PTR 36 -#define VB_EDGE_FLAG 44 -#define VB_TEX0_COORD_PTR 48 -#define VB_TEX1_COORD_PTR 52 -#define VB_TEX2_COORD_PTR 56 -#define VB_TEX3_COORD_PTR 60 -#define VB_INDEX_PTR 80 -#define VB_COLOR_PTR 88 -#define VB_SECONDARY_COLOR_PTR 96 -#define VB_FOG_COORD_PTR 104 -#define VB_PRIMITIVE 108 - - -/* - * Flags for struct vertex_buffer - */ - -#define VERT_BIT_OBJ 0x1 -#define VERT_BIT_NORM 0x4 -#define VERT_BIT_RGBA 0x8 -#define VERT_BIT_SPEC_RGB 0x10 -#define VERT_BIT_FOG_COORD 0x20 -#define VERT_BIT_TEX0 0x100 -#define VERT_BIT_TEX1 0x200 -#define VERT_BIT_TEX2 0x400 -#define VERT_BIT_TEX3 0x800 - - -/* ============================================================= - * Offsets for GLvector4f - */ - -#define V4F_DATA 0 -#define V4F_START 4 -#define V4F_COUNT 8 -#define V4F_STRIDE 12 -#define V4F_SIZE 16 -#define V4F_FLAGS 20 - -/* - * Flags for GLvector4f - */ - -#define VEC_MALLOC 0x10 -#define VEC_NOT_WRITEABLE 0x40 -#define VEC_BAD_STRIDE 0x100 - -#define VEC_SIZE_1 0x1 -#define VEC_SIZE_2 0x3 -#define VEC_SIZE_3 0x7 -#define VEC_SIZE_4 0xf - - -/* ============================================================= - * Offsets for GLmatrix - */ - -#define MATRIX_DATA 0 -#define MATRIX_INV 4 -#define MATRIX_FLAGS 8 -#define MATRIX_TYPE 12 - - -/* ============================================================= - * Offsets for struct gl_light - */ - -#define LIGHT_NEXT 0 -#define LIGHT_PREV 4 - -#define LIGHT_AMBIENT 8 -#define LIGHT_DIFFUSE 24 -#define LIGHT_SPECULAR 40 -#define LIGHT_EYE_POSITION 56 -#define LIGHT_EYE_DIRECTION 72 -#define LIGHT_SPOT_EXPONENT 88 -#define LIGHT_SPOT_CUTOFF 92 -#define LIGHT_COS_CUTOFF 100 -#define LIGHT_CONST_ATTEN 104 -#define LIGHT_LINEAR_ATTEN 108 -#define LIGHT_QUADRATIC_ATTEN 112 -#define LIGHT_ENABLED 116 - -#define LIGHT_FLAGS 120 - -#define LIGHT_POSITION 124 -#define LIGHT_VP_INF_NORM 140 -#define LIGHT_H_INF_NORM 152 -#define LIGHT_NORM_DIRECTION 164 -#define LIGHT_VP_INF_SPOT_ATTEN 180 - -#define LIGHT_SPOT_EXP_TABLE 184 -#define LIGHT_MAT_AMBIENT 4280 -#define LIGHT_MAT_DIFFUSE 4304 -#define LIGHT_MAT_SPECULAR 4328 - -#define SIZEOF_GL_LIGHT 4360 - -/* - * Flags for struct gl_light - */ - -#define LIGHT_SPOT 0x1 -#define LIGHT_LOCAL_VIEWER 0x2 -#define LIGHT_POSITIONAL 0x4 - -#define LIGHT_NEED_VERTICES 0x6 - - -/* ============================================================= - * Offsets for struct gl_lightmodel - */ - -#define LIGHT_MODEL_AMBIENT 0 -#define LIGHT_MODEL_LOCAL_VIEWER 16 -#define LIGHT_MODEL_TWO_SIDE 17 -#define LIGHT_MODEL_COLOR_CONTROL 20 - - -#endif /* __ASM_TYPES_H__ */ diff --git a/dist/Mesa/src/mesa/x86/rtasm/x86sse.c b/dist/Mesa/src/mesa/x86/rtasm/x86sse.c index 612cd51a6..772471c72 100644 --- a/dist/Mesa/src/mesa/x86/rtasm/x86sse.c +++ b/dist/Mesa/src/mesa/x86/rtasm/x86sse.c @@ -1,4 +1,4 @@ -#if defined(USE_X86_ASM) || defined(SLANG_X86) +#if defined(__i386__) || defined(__386__) #include "imports.h" #include "x86sse.h" @@ -6,54 +6,78 @@ #define DISASSEM 0 #define X86_TWOB 0x0f -/* Emit bytes to the instruction stream: - */ -static void emit_1b( struct x86_function *p, GLbyte b0 ) +static unsigned char *cptr( void (*label)() ) { - *(GLbyte *)(p->csr++) = b0; + return (unsigned char *)(unsigned long)label; } -static void emit_1i( struct x86_function *p, GLint i0 ) + +static void do_realloc( struct x86_function *p ) { - *(GLint *)(p->csr) = i0; - p->csr += 4; + if (p->size == 0) { + p->size = 1024; + p->store = _mesa_exec_malloc(p->size); + p->csr = p->store; + } + else { + unsigned used = p->csr - p->store; + unsigned char *tmp = p->store; + p->size *= 2; + p->store = _mesa_exec_malloc(p->size); + memcpy(p->store, tmp, used); + p->csr = p->store + used; + _mesa_exec_free(tmp); + } } -static void disassem( struct x86_function *p, const char *fn ) +/* Emit bytes to the instruction stream: + */ +static unsigned char *reserve( struct x86_function *p, int bytes ) { -#if DISASSEM && 0 - if (fn && fn != p->fn) { - _mesa_printf("0x%x: %s\n", p->csr, fn); - p->fn = fn; + if (p->csr + bytes - p->store > p->size) + do_realloc(p); + + { + unsigned char *csr = p->csr; + p->csr += bytes; + return csr; } -#endif } -static void emit_1ub_fn( struct x86_function *p, GLubyte b0, const char *fn ) + + +static void emit_1b( struct x86_function *p, char b0 ) { - disassem(p, fn); - *(p->csr++) = b0; + char *csr = (char *)reserve(p, 1); + *csr = b0; } -static void emit_2ub_fn( struct x86_function *p, GLubyte b0, GLubyte b1, const char *fn ) +static void emit_1i( struct x86_function *p, int i0 ) { - disassem(p, fn); - *(p->csr++) = b0; - *(p->csr++) = b1; + int *icsr = (int *)reserve(p, sizeof(i0)); + *icsr = i0; } -static void emit_3ub_fn( struct x86_function *p, GLubyte b0, GLubyte b1, GLubyte b2, const char *fn ) +static void emit_1ub( struct x86_function *p, unsigned char b0 ) { - disassem(p, fn); - *(p->csr++) = b0; - *(p->csr++) = b1; - *(p->csr++) = b2; + unsigned char *csr = reserve(p, 1); + *csr++ = b0; } -#define emit_1ub(p, b0) emit_1ub_fn(p, b0, __FUNCTION__) -#define emit_2ub(p, b0, b1) emit_2ub_fn(p, b0, b1, __FUNCTION__) -#define emit_3ub(p, b0, b1, b2) emit_3ub_fn(p, b0, b1, b2, __FUNCTION__) +static void emit_2ub( struct x86_function *p, unsigned char b0, unsigned char b1 ) +{ + unsigned char *csr = reserve(p, 2); + *csr++ = b0; + *csr++ = b1; +} +static void emit_3ub( struct x86_function *p, unsigned char b0, unsigned char b1, unsigned char b2 ) +{ + unsigned char *csr = reserve(p, 3); + *csr++ = b0; + *csr++ = b1; + *csr++ = b2; +} /* Build a modRM byte + possible displacement. No treatment of SIB @@ -63,7 +87,7 @@ static void emit_modrm( struct x86_function *p, struct x86_reg reg, struct x86_reg regmem ) { - GLubyte val = 0; + unsigned char val = 0; assert(reg.mod == mod_REG); @@ -71,13 +95,13 @@ static void emit_modrm( struct x86_function *p, val |= reg.idx << 3; /* reg field */ val |= regmem.idx; /* r/m field */ - emit_1ub_fn(p, val, 0); + emit_1ub(p, val); /* Oh-oh we've stumbled into the SIB thing. */ if (regmem.file == file_REG32 && regmem.idx == reg_SP) { - emit_1ub_fn(p, 0x24, 0); /* simplistic! */ + emit_1ub(p, 0x24); /* simplistic! */ } switch (regmem.mod) { @@ -98,7 +122,7 @@ static void emit_modrm( struct x86_function *p, static void emit_modrm_noreg( struct x86_function *p, - GLuint op, + unsigned op, struct x86_reg regmem ) { struct x86_reg dummy = x86_make_reg(file_REG32, op); @@ -111,21 +135,21 @@ static void emit_modrm_noreg( struct x86_function *p, * the arguments presented. */ static void emit_op_modrm( struct x86_function *p, - GLubyte op_dst_is_reg, - GLubyte op_dst_is_mem, + unsigned char op_dst_is_reg, + unsigned char op_dst_is_mem, struct x86_reg dst, struct x86_reg src ) { switch (dst.mod) { case mod_REG: - emit_1ub_fn(p, op_dst_is_reg, 0); + emit_1ub(p, op_dst_is_reg); emit_modrm(p, dst, src); break; case mod_INDIRECT: case mod_DISP32: case mod_DISP8: assert(src.mod == mod_REG); - emit_1ub_fn(p, op_dst_is_mem, 0); + emit_1ub(p, op_dst_is_mem); emit_modrm(p, src, dst); break; default: @@ -156,7 +180,7 @@ struct x86_reg x86_make_reg( enum x86_reg_file file, } struct x86_reg x86_make_disp( struct x86_reg reg, - GLint disp ) + int disp ) { assert(reg.file == file_REG32); @@ -185,7 +209,7 @@ struct x86_reg x86_get_base_reg( struct x86_reg reg ) return x86_make_reg( reg.file, reg.idx ); } -GLubyte *x86_get_label( struct x86_function *p ) +unsigned char *x86_get_label( struct x86_function *p ) { return p->csr; } @@ -199,13 +223,13 @@ GLubyte *x86_get_label( struct x86_function *p ) void x86_jcc( struct x86_function *p, enum x86_cc cc, - GLubyte *label ) + unsigned char *label ) { - GLint offset = label - (x86_get_label(p) + 2); + int offset = label - (x86_get_label(p) + 2); if (offset <= 127 && offset >= -128) { emit_1ub(p, 0x70 + cc); - emit_1b(p, (GLbyte) offset); + emit_1b(p, (char) offset); } else { offset = label - (x86_get_label(p) + 6); @@ -216,7 +240,7 @@ void x86_jcc( struct x86_function *p, /* Always use a 32bit offset for forward jumps: */ -GLubyte *x86_jcc_forward( struct x86_function *p, +unsigned char *x86_jcc_forward( struct x86_function *p, enum x86_cc cc ) { emit_2ub(p, 0x0f, 0x80 + cc); @@ -224,14 +248,14 @@ GLubyte *x86_jcc_forward( struct x86_function *p, return x86_get_label(p); } -GLubyte *x86_jmp_forward( struct x86_function *p) +unsigned char *x86_jmp_forward( struct x86_function *p) { emit_1ub(p, 0xe9); emit_1i(p, 0); return x86_get_label(p); } -GLubyte *x86_call_forward( struct x86_function *p) +unsigned char *x86_call_forward( struct x86_function *p) { emit_1ub(p, 0xe8); emit_1i(p, 0); @@ -241,28 +265,41 @@ GLubyte *x86_call_forward( struct x86_function *p) /* Fixup offset from forward jump: */ void x86_fixup_fwd_jump( struct x86_function *p, - GLubyte *fixup ) + unsigned char *fixup ) { *(int *)(fixup - 4) = x86_get_label(p) - fixup; } -void x86_jmp( struct x86_function *p, GLubyte *label) +void x86_jmp( struct x86_function *p, unsigned char *label) { emit_1ub(p, 0xe9); emit_1i(p, label - x86_get_label(p) - 4); } -void x86_call( struct x86_function *p, GLubyte *label) +#if 0 +/* This doesn't work once we start reallocating & copying the + * generated code on buffer fills, because the call is relative to the + * current pc. + */ +void x86_call( struct x86_function *p, void (*label)()) { emit_1ub(p, 0xe8); - emit_1i(p, label - x86_get_label(p) - 4); + emit_1i(p, cptr(label) - x86_get_label(p) - 4); +} +#else +void x86_call( struct x86_function *p, struct x86_reg reg) +{ + emit_1ub(p, 0xff); + emit_modrm(p, reg, reg); } +#endif + /* michal: * Temporary. As I need immediate operands, and dont want to mess with the codegen, * I load the immediate into general purpose register and use it. */ -void x86_mov_reg_imm( struct x86_function *p, struct x86_reg dst, GLint imm ) +void x86_mov_reg_imm( struct x86_function *p, struct x86_reg dst, int imm ) { assert(dst.mod == mod_REG); emit_1ub(p, 0xb8 + dst.idx); @@ -502,6 +539,14 @@ void sse_addss( struct x86_function *p, emit_modrm( p, dst, src ); } +void sse_andnps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_2ub(p, X86_TWOB, 0x55); + emit_modrm( p, dst, src ); +} + void sse_andps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) @@ -510,6 +555,13 @@ void sse_andps( struct x86_function *p, emit_modrm( p, dst, src ); } +void sse_rsqrtps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_2ub(p, X86_TWOB, 0x52); + emit_modrm( p, dst, src ); +} void sse_rsqrtss( struct x86_function *p, struct x86_reg dst, @@ -538,6 +590,21 @@ void sse_movlhps( struct x86_function *p, emit_modrm( p, dst, src ); } +void sse_orps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_2ub(p, X86_TWOB, 0x56); + emit_modrm( p, dst, src ); +} + +void sse_xorps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_2ub(p, X86_TWOB, 0x57); + emit_modrm( p, dst, src ); +} void sse_cvtps2pi( struct x86_function *p, struct x86_reg dst, @@ -559,7 +626,7 @@ void sse_cvtps2pi( struct x86_function *p, void sse_shufps( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, - GLubyte shuf) + unsigned char shuf) { emit_2ub(p, X86_TWOB, 0xC6); emit_modrm(p, dest, arg0); @@ -569,13 +636,21 @@ void sse_shufps( struct x86_function *p, void sse_cmpps( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, - GLubyte cc) + unsigned char cc) { emit_2ub(p, X86_TWOB, 0xC2); emit_modrm(p, dest, arg0); emit_1ub(p, cc); } +void sse_pmovmskb( struct x86_function *p, + struct x86_reg dest, + struct x86_reg src) +{ + emit_3ub(p, 0x66, X86_TWOB, 0xD7); + emit_modrm(p, dest, src); +} + /*********************************************************************** * SSE2 instructions */ @@ -586,13 +661,21 @@ void sse_cmpps( struct x86_function *p, void sse2_pshufd( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, - GLubyte shuf) + unsigned char shuf) { emit_3ub(p, 0x66, X86_TWOB, 0x70); emit_modrm(p, dest, arg0); emit_1ub(p, shuf); } +void sse2_cvttps2dq( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_3ub( p, 0xF3, X86_TWOB, 0x5B ); + emit_modrm( p, dst, src ); +} + void sse2_cvtps2dq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) @@ -625,6 +708,14 @@ void sse2_packuswb( struct x86_function *p, emit_modrm( p, dst, src ); } +void sse2_rcpps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_2ub(p, X86_TWOB, 0x53); + emit_modrm( p, dst, src ); +} + void sse2_rcpss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) @@ -712,11 +803,11 @@ void x87_fclex( struct x86_function *p ) static void x87_arith_op( struct x86_function *p, struct x86_reg dst, struct x86_reg arg, - GLubyte dst0ub0, - GLubyte dst0ub1, - GLubyte arg0ub0, - GLubyte arg0ub1, - GLubyte argmem_noreg) + unsigned char dst0ub0, + unsigned char dst0ub1, + unsigned char arg0ub0, + unsigned char arg0ub1, + unsigned char argmem_noreg) { assert(dst.file == file_x87); @@ -729,7 +820,7 @@ static void x87_arith_op( struct x86_function *p, struct x86_reg dst, struct x86 assert(0); } else if (dst.idx == 0) { - assert(arg.file = file_REG32); + assert(arg.file == file_REG32); emit_1ub(p, 0xd8); emit_modrm_noreg(p, argmem_noreg, arg); } @@ -1056,44 +1147,42 @@ void mmx_movq( struct x86_function *p, * account any push/pop activity: */ struct x86_reg x86_fn_arg( struct x86_function *p, - GLuint arg ) + unsigned arg ) { return x86_make_disp(x86_make_reg(file_REG32, reg_SP), p->stack_offset + arg * 4); /* ??? */ } -/** - * Initialize an x86_function object, allocating space for up to - * 'code_size' bytes of code. - */ -GLboolean x86_init_func( struct x86_function *p, GLuint code_size ) +void x86_init_func( struct x86_function *p ) { - assert(!p->store); + p->size = 0; + p->store = NULL; + p->csr = p->store; +} + +int x86_init_func_size( struct x86_function *p, unsigned code_size ) +{ + p->size = code_size; p->store = _mesa_exec_malloc(code_size); - if (p->store) { - p->csr = p->store; - return GL_TRUE; - } - else { - p->csr = NULL; - return GL_FALSE; - } + p->csr = p->store; + return p->store != NULL; } void x86_release_func( struct x86_function *p ) { - if (p->store) - _mesa_exec_free(p->store); - p->store = p->csr = NULL; + _mesa_exec_free(p->store); + p->store = NULL; + p->csr = NULL; + p->size = 0; } void (*x86_get_func( struct x86_function *p ))(void) { - if (DISASSEM) + if (DISASSEM && p->store) _mesa_printf("disassemble %p %p\n", p->store, p->csr); - return (void (*)(void))p->store; + return (void (*)(void)) (unsigned long) p->store; } #else diff --git a/dist/Mesa/src/mesa/x86/rtasm/x86sse.h b/dist/Mesa/src/mesa/x86/rtasm/x86sse.h index 42b09937b..f6282f5bd 100644 --- a/dist/Mesa/src/mesa/x86/rtasm/x86sse.h +++ b/dist/Mesa/src/mesa/x86/rtasm/x86sse.h @@ -2,26 +2,25 @@ #ifndef _X86SSE_H_ #define _X86SSE_H_ -#if defined(USE_X86_ASM) || defined(SLANG_X86) - -#include "glheader.h" +#if defined(__i386__) || defined(__386__) /* It is up to the caller to ensure that instructions issued are * suitable for the host cpu. There are no checks made in this module * for mmx/sse/sse2 support on the cpu. */ struct x86_reg { - GLuint file:3; - GLuint idx:3; - GLuint mod:2; /* mod_REG if this is just a register */ - GLint disp:24; /* only +/- 23bits of offset - should be enough... */ + unsigned file:3; + unsigned idx:3; + unsigned mod:2; /* mod_REG if this is just a register */ + int disp:24; /* only +/- 23bits of offset - should be enough... */ }; struct x86_function { - GLubyte *store; - GLubyte *csr; - GLuint stack_offset; - GLint need_emms; + unsigned size; + unsigned char *store; + unsigned char *csr; + unsigned stack_offset; + int need_emms; const char *fn; }; @@ -80,7 +79,8 @@ enum sse_cc { */ -GLboolean x86_init_func( struct x86_function *p, GLuint code_size ); +void x86_init_func( struct x86_function *p ); +int x86_init_func_size( struct x86_function *p, unsigned code_size ); void x86_release_func( struct x86_function *p ); void (*x86_get_func( struct x86_function *p ))( void ); @@ -92,7 +92,7 @@ struct x86_reg x86_make_reg( enum x86_reg_file file, enum x86_reg_name idx ); struct x86_reg x86_make_disp( struct x86_reg reg, - GLint disp ); + int disp ); struct x86_reg x86_deref( struct x86_reg reg ); @@ -101,31 +101,32 @@ struct x86_reg x86_get_base_reg( struct x86_reg reg ); /* Labels, jumps and fixup: */ -GLubyte *x86_get_label( struct x86_function *p ); +unsigned char *x86_get_label( struct x86_function *p ); void x86_jcc( struct x86_function *p, enum x86_cc cc, - GLubyte *label ); + unsigned char *label ); -GLubyte *x86_jcc_forward( struct x86_function *p, +unsigned char *x86_jcc_forward( struct x86_function *p, enum x86_cc cc ); -GLubyte *x86_jmp_forward( struct x86_function *p); +unsigned char *x86_jmp_forward( struct x86_function *p); -GLubyte *x86_call_forward( struct x86_function *p); +unsigned char *x86_call_forward( struct x86_function *p); void x86_fixup_fwd_jump( struct x86_function *p, - GLubyte *fixup ); + unsigned char *fixup ); -void x86_jmp( struct x86_function *p, GLubyte *label ); +void x86_jmp( struct x86_function *p, unsigned char *label ); -void x86_call( struct x86_function *p, GLubyte *label ); +/* void x86_call( struct x86_function *p, void (*label)() ); */ +void x86_call( struct x86_function *p, struct x86_reg reg); /* michal: * Temporary. As I need immediate operands, and dont want to mess with the codegen, * I load the immediate into general purpose register and use it. */ -void x86_mov_reg_imm( struct x86_function *p, struct x86_reg dst, GLint imm ); +void x86_mov_reg_imm( struct x86_function *p, struct x86_reg dst, int imm ); /* Macro for sse_shufps() and sse2_pshufd(): @@ -141,19 +142,24 @@ void mmx_packssdw( struct x86_function *p, struct x86_reg dst, struct x86_reg sr void mmx_packuswb( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse2_cvtps2dq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse2_cvttps2dq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse2_movd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse2_packssdw( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse2_packsswb( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse2_packuswb( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse2_pshufd( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, GLubyte shuf ); +void sse2_pshufd( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, + unsigned char shuf ); +void sse2_rcpps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse2_rcpss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse_addps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse_addss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse_cvtps2pi( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse_divss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_andnps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse_andps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse_cmpps( struct x86_function *p, struct x86_reg dst, struct x86_reg src, GLubyte cc ); +void sse_cmpps( struct x86_function *p, struct x86_reg dst, struct x86_reg src, + unsigned char cc ); void sse_maxps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse_maxss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse_minps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); @@ -166,9 +172,14 @@ void sse_movss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) void sse_movups( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse_mulps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse_mulss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_orps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_xorps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse_subps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_rsqrtps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse_rsqrtss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse_shufps( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, GLubyte shuf ); +void sse_shufps( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, + unsigned char shuf ); +void sse_pmovmskb( struct x86_function *p, struct x86_reg dest, struct x86_reg src ); void x86_add( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void x86_and( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); @@ -239,7 +250,7 @@ void x87_fucom( struct x86_function *p, struct x86_reg arg ); * account any push/pop activity. Note - doesn't track explict * manipulation of ESP by other instructions. */ -struct x86_reg x86_fn_arg( struct x86_function *p, GLuint arg ); +struct x86_reg x86_fn_arg( struct x86_function *p, unsigned arg ); #endif #endif |