From 990bc3f015a4f8fce2eb918375defcd44980a845 Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 8 Jun 2012 09:33:13 +0200 Subject: Used synchronise script to update files --- mesalib/src/mesa/main/.gitignore | 13 + mesalib/src/mesa/main/api_loopback.c | 3450 ++++++++++++++--------------- mesalib/src/mesa/main/atifragshader.c | 1592 ++++++------- mesalib/src/mesa/main/blend.h | 212 +- mesalib/src/mesa/main/bufferobj.c | 19 + mesalib/src/mesa/main/clear.h | 128 +- mesalib/src/mesa/main/clip.c | 232 +- mesalib/src/mesa/main/clip.h | 94 +- mesalib/src/mesa/main/condrender.h | 90 +- mesalib/src/mesa/main/dd.h | 192 +- mesalib/src/mesa/main/depth.h | 136 +- mesalib/src/mesa/main/drawtex.h | 122 +- mesalib/src/mesa/main/enable.h | 142 +- mesalib/src/mesa/main/extensions.c | 1 + mesalib/src/mesa/main/ffvertex_prog.h | 80 +- mesalib/src/mesa/main/fog.h | 138 +- mesalib/src/mesa/main/formats.c | 8 +- mesalib/src/mesa/main/hint.h | 118 +- mesalib/src/mesa/main/lines.h | 98 +- mesalib/src/mesa/main/matrix.h | 226 +- mesalib/src/mesa/main/mipmap.c | 8 +- mesalib/src/mesa/main/mtypes.h | 1 + mesalib/src/mesa/main/multisample.c | 124 +- mesalib/src/mesa/main/multisample.h | 82 +- mesalib/src/mesa/main/pixelstore.h | 104 +- mesalib/src/mesa/main/points.c | 544 ++--- mesalib/src/mesa/main/points.h | 118 +- mesalib/src/mesa/main/rastpos.c | 1132 +++++----- mesalib/src/mesa/main/remap.c | 452 ++-- mesalib/src/mesa/main/scissor.c | 200 +- mesalib/src/mesa/main/scissor.h | 94 +- mesalib/src/mesa/main/stencil.h | 162 +- mesalib/src/mesa/main/syncobj.c | 852 +++---- mesalib/src/mesa/main/texformat.h | 78 +- mesalib/src/mesa/main/texgen.c | 802 +++---- mesalib/src/mesa/main/teximage.c | 151 +- mesalib/src/mesa/main/texobj.c | 28 +- mesalib/src/mesa/main/texstore.c | 259 +-- mesalib/src/mesa/main/texstore.h | 113 +- mesalib/src/mesa/main/texturebarrier.c | 108 +- mesalib/src/mesa/main/texturebarrier.h | 88 +- mesalib/src/mesa/main/transformfeedback.c | 21 +- mesalib/src/mesa/main/version.c | 1 + mesalib/src/mesa/main/viewport.c | 370 ++-- mesalib/src/mesa/main/viewport.h | 116 +- 45 files changed, 6348 insertions(+), 6751 deletions(-) create mode 100644 mesalib/src/mesa/main/.gitignore (limited to 'mesalib/src/mesa/main') diff --git a/mesalib/src/mesa/main/.gitignore b/mesalib/src/mesa/main/.gitignore new file mode 100644 index 000000000..caed74f40 --- /dev/null +++ b/mesalib/src/mesa/main/.gitignore @@ -0,0 +1,13 @@ +api_exec_es1.c +api_exec_es2.c +dispatch.h +enums.c +get_es1.c +get_es2.c +git_sha1.h +git_sha1.h.tmp +api_exec_es1_dispatch.h +api_exec_es1_remap_helper.h +api_exec_es2_dispatch.h +api_exec_es2_remap_helper.h +remap_helper.h diff --git a/mesalib/src/mesa/main/api_loopback.c b/mesalib/src/mesa/main/api_loopback.c index fb9d781f7..c438307d8 100644 --- a/mesalib/src/mesa/main/api_loopback.c +++ b/mesalib/src/mesa/main/api_loopback.c @@ -1,1725 +1,1725 @@ -/** - * \file api_loopback.c - * - * \author Keith Whitwell - */ - -/* - * Mesa 3-D graphics library - * Version: 6.3 - * - * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#include "glheader.h" -#include "macros.h" -#include "api_loopback.h" -#include "mtypes.h" -#include "glapi/glapi.h" -#include "glapi/glthread.h" -#include "main/dispatch.h" -#include "mfeatures.h" - -/* KW: A set of functions to convert unusual Color/Normal/Vertex/etc - * calls to a smaller set of driver-provided formats. Currently just - * go back to dispatch to find these (eg. call glNormal3f directly), - * hence 'loopback'. - * - * The driver must supply all of the remaining entry points, which are - * listed in dd.h. The easiest way for a driver to do this is to - * install the supplied software t&l module. - */ -#define COLORF(r,g,b,a) CALL_Color4f(GET_DISPATCH(), (r,g,b,a)) -#define VERTEX2(x,y) CALL_Vertex2f(GET_DISPATCH(), (x,y)) -#define VERTEX3(x,y,z) CALL_Vertex3f(GET_DISPATCH(), (x,y,z)) -#define VERTEX4(x,y,z,w) CALL_Vertex4f(GET_DISPATCH(), (x,y,z,w)) -#define NORMAL(x,y,z) CALL_Normal3f(GET_DISPATCH(), (x,y,z)) -#define TEXCOORD1(s) CALL_TexCoord1f(GET_DISPATCH(), (s)) -#define TEXCOORD2(s,t) CALL_TexCoord2f(GET_DISPATCH(), (s,t)) -#define TEXCOORD3(s,t,u) CALL_TexCoord3f(GET_DISPATCH(), (s,t,u)) -#define TEXCOORD4(s,t,u,v) CALL_TexCoord4f(GET_DISPATCH(), (s,t,u,v)) -#define INDEX(c) CALL_Indexf(GET_DISPATCH(), (c)) -#define MULTI_TEXCOORD1(z,s) CALL_MultiTexCoord1fARB(GET_DISPATCH(), (z,s)) -#define MULTI_TEXCOORD2(z,s,t) CALL_MultiTexCoord2fARB(GET_DISPATCH(), (z,s,t)) -#define MULTI_TEXCOORD3(z,s,t,u) CALL_MultiTexCoord3fARB(GET_DISPATCH(), (z,s,t,u)) -#define MULTI_TEXCOORD4(z,s,t,u,v) CALL_MultiTexCoord4fARB(GET_DISPATCH(), (z,s,t,u,v)) -#define EVALCOORD1(x) CALL_EvalCoord1f(GET_DISPATCH(), (x)) -#define EVALCOORD2(x,y) CALL_EvalCoord2f(GET_DISPATCH(), (x,y)) -#define MATERIALFV(a,b,c) CALL_Materialfv(GET_DISPATCH(), (a,b,c)) -#define RECTF(a,b,c,d) CALL_Rectf(GET_DISPATCH(), (a,b,c,d)) - -#define FOGCOORDF(x) CALL_FogCoordfEXT(GET_DISPATCH(), (x)) -#define SECONDARYCOLORF(a,b,c) CALL_SecondaryColor3fEXT(GET_DISPATCH(), (a,b,c)) - -#define ATTRIB1NV(index,x) CALL_VertexAttrib1fNV(GET_DISPATCH(), (index,x)) -#define ATTRIB2NV(index,x,y) CALL_VertexAttrib2fNV(GET_DISPATCH(), (index,x,y)) -#define ATTRIB3NV(index,x,y,z) CALL_VertexAttrib3fNV(GET_DISPATCH(), (index,x,y,z)) -#define ATTRIB4NV(index,x,y,z,w) CALL_VertexAttrib4fNV(GET_DISPATCH(), (index,x,y,z,w)) - -#define ATTRIB1ARB(index,x) CALL_VertexAttrib1fARB(GET_DISPATCH(), (index,x)) -#define ATTRIB2ARB(index,x,y) CALL_VertexAttrib2fARB(GET_DISPATCH(), (index,x,y)) -#define ATTRIB3ARB(index,x,y,z) CALL_VertexAttrib3fARB(GET_DISPATCH(), (index,x,y,z)) -#define ATTRIB4ARB(index,x,y,z,w) CALL_VertexAttrib4fARB(GET_DISPATCH(), (index,x,y,z,w)) - -#define ATTRIBI_1I(index,x) CALL_VertexAttribI1iEXT(GET_DISPATCH(), (index,x)) -#define ATTRIBI_1UI(index,x) CALL_VertexAttribI1uiEXT(GET_DISPATCH(), (index,x)) -#define ATTRIBI_4I(index,x,y,z,w) CALL_VertexAttribI4iEXT(GET_DISPATCH(), (index,x,y,z,w)) - -#define ATTRIBI_4UI(index,x,y,z,w) CALL_VertexAttribI4uiEXT(GET_DISPATCH(), (index,x,y,z,w)) - - -#if FEATURE_beginend - - -static void GLAPIENTRY -loopback_Color3b_f( GLbyte red, GLbyte green, GLbyte blue ) -{ - COLORF( BYTE_TO_FLOAT(red), - BYTE_TO_FLOAT(green), - BYTE_TO_FLOAT(blue), - 1.0 ); -} - -static void GLAPIENTRY -loopback_Color3d_f( GLdouble red, GLdouble green, GLdouble blue ) -{ - COLORF( (GLfloat) red, (GLfloat) green, (GLfloat) blue, 1.0 ); -} - -static void GLAPIENTRY -loopback_Color3i_f( GLint red, GLint green, GLint blue ) -{ - COLORF( INT_TO_FLOAT(red), INT_TO_FLOAT(green), - INT_TO_FLOAT(blue), 1.0); -} - -static void GLAPIENTRY -loopback_Color3s_f( GLshort red, GLshort green, GLshort blue ) -{ - COLORF( SHORT_TO_FLOAT(red), SHORT_TO_FLOAT(green), - SHORT_TO_FLOAT(blue), 1.0); -} - -static void GLAPIENTRY -loopback_Color3ui_f( GLuint red, GLuint green, GLuint blue ) -{ - COLORF( UINT_TO_FLOAT(red), UINT_TO_FLOAT(green), - UINT_TO_FLOAT(blue), 1.0 ); -} - -static void GLAPIENTRY -loopback_Color3us_f( GLushort red, GLushort green, GLushort blue ) -{ - COLORF( USHORT_TO_FLOAT(red), USHORT_TO_FLOAT(green), - USHORT_TO_FLOAT(blue), 1.0 ); -} - -static void GLAPIENTRY -loopback_Color3ub_f( GLubyte red, GLubyte green, GLubyte blue ) -{ - COLORF( UBYTE_TO_FLOAT(red), UBYTE_TO_FLOAT(green), - UBYTE_TO_FLOAT(blue), 1.0 ); -} - - -static void GLAPIENTRY -loopback_Color3bv_f( const GLbyte *v ) -{ - COLORF( BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), - BYTE_TO_FLOAT(v[2]), 1.0 ); -} - -static void GLAPIENTRY -loopback_Color3dv_f( const GLdouble *v ) -{ - COLORF( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0 ); -} - -static void GLAPIENTRY -loopback_Color3iv_f( const GLint *v ) -{ - COLORF( INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), - INT_TO_FLOAT(v[2]), 1.0 ); -} - -static void GLAPIENTRY -loopback_Color3sv_f( const GLshort *v ) -{ - COLORF( SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), - SHORT_TO_FLOAT(v[2]), 1.0 ); -} - -static void GLAPIENTRY -loopback_Color3uiv_f( const GLuint *v ) -{ - COLORF( UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]), - UINT_TO_FLOAT(v[2]), 1.0 ); -} - -static void GLAPIENTRY -loopback_Color3usv_f( const GLushort *v ) -{ - COLORF( USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]), - USHORT_TO_FLOAT(v[2]), 1.0 ); -} - -static void GLAPIENTRY -loopback_Color3ubv_f( const GLubyte *v ) -{ - COLORF( UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), - UBYTE_TO_FLOAT(v[2]), 1.0 ); -} - - -static void GLAPIENTRY -loopback_Color4b_f( GLbyte red, GLbyte green, GLbyte blue, - GLbyte alpha ) -{ - COLORF( BYTE_TO_FLOAT(red), BYTE_TO_FLOAT(green), - BYTE_TO_FLOAT(blue), BYTE_TO_FLOAT(alpha) ); -} - -static void GLAPIENTRY -loopback_Color4d_f( GLdouble red, GLdouble green, GLdouble blue, - GLdouble alpha ) -{ - COLORF( (GLfloat) red, (GLfloat) green, (GLfloat) blue, (GLfloat) alpha ); -} - -static void GLAPIENTRY -loopback_Color4i_f( GLint red, GLint green, GLint blue, GLint alpha ) -{ - COLORF( INT_TO_FLOAT(red), INT_TO_FLOAT(green), - INT_TO_FLOAT(blue), INT_TO_FLOAT(alpha) ); -} - -static void GLAPIENTRY -loopback_Color4s_f( GLshort red, GLshort green, GLshort blue, - GLshort alpha ) -{ - COLORF( SHORT_TO_FLOAT(red), SHORT_TO_FLOAT(green), - SHORT_TO_FLOAT(blue), SHORT_TO_FLOAT(alpha) ); -} - -static void GLAPIENTRY -loopback_Color4ui_f( GLuint red, GLuint green, GLuint blue, GLuint alpha ) -{ - COLORF( UINT_TO_FLOAT(red), UINT_TO_FLOAT(green), - UINT_TO_FLOAT(blue), UINT_TO_FLOAT(alpha) ); -} - -static void GLAPIENTRY -loopback_Color4us_f( GLushort red, GLushort green, GLushort blue, GLushort alpha ) -{ - COLORF( USHORT_TO_FLOAT(red), USHORT_TO_FLOAT(green), - USHORT_TO_FLOAT(blue), USHORT_TO_FLOAT(alpha) ); -} - -static void GLAPIENTRY -loopback_Color4ub_f( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) -{ - COLORF( UBYTE_TO_FLOAT(red), UBYTE_TO_FLOAT(green), - UBYTE_TO_FLOAT(blue), UBYTE_TO_FLOAT(alpha) ); -} - - -static void GLAPIENTRY -loopback_Color4iv_f( const GLint *v ) -{ - COLORF( INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), - INT_TO_FLOAT(v[2]), INT_TO_FLOAT(v[3]) ); -} - - -static void GLAPIENTRY -loopback_Color4bv_f( const GLbyte *v ) -{ - COLORF( BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), - BYTE_TO_FLOAT(v[2]), BYTE_TO_FLOAT(v[3]) ); -} - -static void GLAPIENTRY -loopback_Color4dv_f( const GLdouble *v ) -{ - COLORF( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3] ); -} - - -static void GLAPIENTRY -loopback_Color4sv_f( const GLshort *v) -{ - COLORF( SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), - SHORT_TO_FLOAT(v[2]), SHORT_TO_FLOAT(v[3]) ); -} - - -static void GLAPIENTRY -loopback_Color4uiv_f( const GLuint *v) -{ - COLORF( UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]), - UINT_TO_FLOAT(v[2]), UINT_TO_FLOAT(v[3]) ); -} - -static void GLAPIENTRY -loopback_Color4usv_f( const GLushort *v) -{ - COLORF( USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]), - USHORT_TO_FLOAT(v[2]), USHORT_TO_FLOAT(v[3]) ); -} - -static void GLAPIENTRY -loopback_Color4ubv_f( const GLubyte *v) -{ - COLORF( UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), - UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3]) ); -} - - -static void GLAPIENTRY -loopback_FogCoorddEXT( GLdouble d ) -{ - FOGCOORDF( (GLfloat) d ); -} - -static void GLAPIENTRY -loopback_FogCoorddvEXT( const GLdouble *v ) -{ - FOGCOORDF( (GLfloat) *v ); -} - - -static void GLAPIENTRY -loopback_Indexd( GLdouble c ) -{ - INDEX( (GLfloat) c ); -} - -static void GLAPIENTRY -loopback_Indexi( GLint c ) -{ - INDEX( (GLfloat) c ); -} - -static void GLAPIENTRY -loopback_Indexs( GLshort c ) -{ - INDEX( (GLfloat) c ); -} - -static void GLAPIENTRY -loopback_Indexub( GLubyte c ) -{ - INDEX( (GLfloat) c ); -} - -static void GLAPIENTRY -loopback_Indexdv( const GLdouble *c ) -{ - INDEX( (GLfloat) *c ); -} - -static void GLAPIENTRY -loopback_Indexiv( const GLint *c ) -{ - INDEX( (GLfloat) *c ); -} - -static void GLAPIENTRY -loopback_Indexsv( const GLshort *c ) -{ - INDEX( (GLfloat) *c ); -} - -static void GLAPIENTRY -loopback_Indexubv( const GLubyte *c ) -{ - INDEX( (GLfloat) *c ); -} - - -static void GLAPIENTRY -loopback_EdgeFlagv(const GLboolean *flag) -{ - CALL_EdgeFlag(GET_DISPATCH(), (*flag)); -} - - -static void GLAPIENTRY -loopback_Normal3b( GLbyte nx, GLbyte ny, GLbyte nz ) -{ - NORMAL( BYTE_TO_FLOAT(nx), BYTE_TO_FLOAT(ny), BYTE_TO_FLOAT(nz) ); -} - -static void GLAPIENTRY -loopback_Normal3d( GLdouble nx, GLdouble ny, GLdouble nz ) -{ - NORMAL((GLfloat) nx, (GLfloat) ny, (GLfloat) nz); -} - -static void GLAPIENTRY -loopback_Normal3i( GLint nx, GLint ny, GLint nz ) -{ - NORMAL( INT_TO_FLOAT(nx), INT_TO_FLOAT(ny), INT_TO_FLOAT(nz) ); -} - -static void GLAPIENTRY -loopback_Normal3s( GLshort nx, GLshort ny, GLshort nz ) -{ - NORMAL( SHORT_TO_FLOAT(nx), SHORT_TO_FLOAT(ny), SHORT_TO_FLOAT(nz) ); -} - -static void GLAPIENTRY -loopback_Normal3bv( const GLbyte *v ) -{ - NORMAL( BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), BYTE_TO_FLOAT(v[2]) ); -} - -static void GLAPIENTRY -loopback_Normal3dv( const GLdouble *v ) -{ - NORMAL( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); -} - -static void GLAPIENTRY -loopback_Normal3iv( const GLint *v ) -{ - NORMAL( INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), INT_TO_FLOAT(v[2]) ); -} - -static void GLAPIENTRY -loopback_Normal3sv( const GLshort *v ) -{ - NORMAL( SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), SHORT_TO_FLOAT(v[2]) ); -} - -static void GLAPIENTRY -loopback_TexCoord1d( GLdouble s ) -{ - TEXCOORD1((GLfloat) s); -} - -static void GLAPIENTRY -loopback_TexCoord1i( GLint s ) -{ - TEXCOORD1((GLfloat) s); -} - -static void GLAPIENTRY -loopback_TexCoord1s( GLshort s ) -{ - TEXCOORD1((GLfloat) s); -} - -static void GLAPIENTRY -loopback_TexCoord2d( GLdouble s, GLdouble t ) -{ - TEXCOORD2((GLfloat) s,(GLfloat) t); -} - -static void GLAPIENTRY -loopback_TexCoord2s( GLshort s, GLshort t ) -{ - TEXCOORD2((GLfloat) s,(GLfloat) t); -} - -static void GLAPIENTRY -loopback_TexCoord2i( GLint s, GLint t ) -{ - TEXCOORD2((GLfloat) s,(GLfloat) t); -} - -static void GLAPIENTRY -loopback_TexCoord3d( GLdouble s, GLdouble t, GLdouble r ) -{ - TEXCOORD3((GLfloat) s,(GLfloat) t,(GLfloat) r); -} - -static void GLAPIENTRY -loopback_TexCoord3i( GLint s, GLint t, GLint r ) -{ - TEXCOORD3((GLfloat) s,(GLfloat) t,(GLfloat) r); -} - -static void GLAPIENTRY -loopback_TexCoord3s( GLshort s, GLshort t, GLshort r ) -{ - TEXCOORD3((GLfloat) s,(GLfloat) t,(GLfloat) r); -} - -static void GLAPIENTRY -loopback_TexCoord4d( GLdouble s, GLdouble t, GLdouble r, GLdouble q ) -{ - TEXCOORD4((GLfloat) s,(GLfloat) t,(GLfloat) r,(GLfloat) q); -} - -static void GLAPIENTRY -loopback_TexCoord4i( GLint s, GLint t, GLint r, GLint q ) -{ - TEXCOORD4((GLfloat) s,(GLfloat) t,(GLfloat) r,(GLfloat) q); -} - -static void GLAPIENTRY -loopback_TexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q ) -{ - TEXCOORD4((GLfloat) s,(GLfloat) t,(GLfloat) r,(GLfloat) q); -} - -static void GLAPIENTRY -loopback_TexCoord1dv( const GLdouble *v ) -{ - TEXCOORD1((GLfloat) v[0]); -} - -static void GLAPIENTRY -loopback_TexCoord1iv( const GLint *v ) -{ - TEXCOORD1((GLfloat) v[0]); -} - -static void GLAPIENTRY -loopback_TexCoord1sv( const GLshort *v ) -{ - TEXCOORD1((GLfloat) v[0]); -} - -static void GLAPIENTRY -loopback_TexCoord2dv( const GLdouble *v ) -{ - TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]); -} - -static void GLAPIENTRY -loopback_TexCoord2iv( const GLint *v ) -{ - TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]); -} - -static void GLAPIENTRY -loopback_TexCoord2sv( const GLshort *v ) -{ - TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]); -} - -static void GLAPIENTRY -loopback_TexCoord3dv( const GLdouble *v ) -{ - TEXCOORD3((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2]); -} - -static void GLAPIENTRY -loopback_TexCoord3iv( const GLint *v ) -{ - TEXCOORD3((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2]); -} - -static void GLAPIENTRY -loopback_TexCoord3sv( const GLshort *v ) -{ - TEXCOORD3((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2]); -} - -static void GLAPIENTRY -loopback_TexCoord4dv( const GLdouble *v ) -{ - TEXCOORD4((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2],(GLfloat) v[3]); -} - -static void GLAPIENTRY -loopback_TexCoord4iv( const GLint *v ) -{ - TEXCOORD4((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2],(GLfloat) v[3]); -} - -static void GLAPIENTRY -loopback_TexCoord4sv( const GLshort *v ) -{ - TEXCOORD4((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2],(GLfloat) v[3]); -} - -static void GLAPIENTRY -loopback_Vertex2d( GLdouble x, GLdouble y ) -{ - VERTEX2( (GLfloat) x, (GLfloat) y ); -} - -static void GLAPIENTRY -loopback_Vertex2i( GLint x, GLint y ) -{ - VERTEX2( (GLfloat) x, (GLfloat) y ); -} - -static void GLAPIENTRY -loopback_Vertex2s( GLshort x, GLshort y ) -{ - VERTEX2( (GLfloat) x, (GLfloat) y ); -} - -static void GLAPIENTRY -loopback_Vertex3d( GLdouble x, GLdouble y, GLdouble z ) -{ - VERTEX3( (GLfloat) x, (GLfloat) y, (GLfloat) z ); -} - -static void GLAPIENTRY -loopback_Vertex3i( GLint x, GLint y, GLint z ) -{ - VERTEX3( (GLfloat) x, (GLfloat) y, (GLfloat) z ); -} - -static void GLAPIENTRY -loopback_Vertex3s( GLshort x, GLshort y, GLshort z ) -{ - VERTEX3( (GLfloat) x, (GLfloat) y, (GLfloat) z ); -} - -static void GLAPIENTRY -loopback_Vertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w ) -{ - VERTEX4( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w ); -} - -static void GLAPIENTRY -loopback_Vertex4i( GLint x, GLint y, GLint z, GLint w ) -{ - VERTEX4( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w ); -} - -static void GLAPIENTRY -loopback_Vertex4s( GLshort x, GLshort y, GLshort z, GLshort w ) -{ - VERTEX4( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w ); -} - -static void GLAPIENTRY -loopback_Vertex2dv( const GLdouble *v ) -{ - VERTEX2( (GLfloat) v[0], (GLfloat) v[1] ); -} - -static void GLAPIENTRY -loopback_Vertex2iv( const GLint *v ) -{ - VERTEX2( (GLfloat) v[0], (GLfloat) v[1] ); -} - -static void GLAPIENTRY -loopback_Vertex2sv( const GLshort *v ) -{ - VERTEX2( (GLfloat) v[0], (GLfloat) v[1] ); -} - -static void GLAPIENTRY -loopback_Vertex3dv( const GLdouble *v ) -{ - VERTEX3( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); -} - -static void GLAPIENTRY -loopback_Vertex3iv( const GLint *v ) -{ - VERTEX3( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); -} - -static void GLAPIENTRY -loopback_Vertex3sv( const GLshort *v ) -{ - VERTEX3( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); -} - -static void GLAPIENTRY -loopback_Vertex4dv( const GLdouble *v ) -{ - VERTEX4( (GLfloat) v[0], (GLfloat) v[1], - (GLfloat) v[2], (GLfloat) v[3] ); -} - -static void GLAPIENTRY -loopback_Vertex4iv( const GLint *v ) -{ - VERTEX4( (GLfloat) v[0], (GLfloat) v[1], - (GLfloat) v[2], (GLfloat) v[3] ); -} - -static void GLAPIENTRY -loopback_Vertex4sv( const GLshort *v ) -{ - VERTEX4( (GLfloat) v[0], (GLfloat) v[1], - (GLfloat) v[2], (GLfloat) v[3] ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord1dARB(GLenum target, GLdouble s) -{ - MULTI_TEXCOORD1( target, (GLfloat) s ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord1dvARB(GLenum target, const GLdouble *v) -{ - MULTI_TEXCOORD1( target, (GLfloat) v[0] ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord1iARB(GLenum target, GLint s) -{ - MULTI_TEXCOORD1( target, (GLfloat) s ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord1ivARB(GLenum target, const GLint *v) -{ - MULTI_TEXCOORD1( target, (GLfloat) v[0] ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord1sARB(GLenum target, GLshort s) -{ - MULTI_TEXCOORD1( target, (GLfloat) s ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord1svARB(GLenum target, const GLshort *v) -{ - MULTI_TEXCOORD1( target, (GLfloat) v[0] ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t) -{ - MULTI_TEXCOORD2( target, (GLfloat) s, (GLfloat) t ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord2dvARB(GLenum target, const GLdouble *v) -{ - MULTI_TEXCOORD2( target, (GLfloat) v[0], (GLfloat) v[1] ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord2iARB(GLenum target, GLint s, GLint t) -{ - MULTI_TEXCOORD2( target, (GLfloat) s, (GLfloat) t ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord2ivARB(GLenum target, const GLint *v) -{ - MULTI_TEXCOORD2( target, (GLfloat) v[0], (GLfloat) v[1] ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord2sARB(GLenum target, GLshort s, GLshort t) -{ - MULTI_TEXCOORD2( target, (GLfloat) s, (GLfloat) t ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord2svARB(GLenum target, const GLshort *v) -{ - MULTI_TEXCOORD2( target, (GLfloat) v[0], (GLfloat) v[1] ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r) -{ - MULTI_TEXCOORD3( target, (GLfloat) s, (GLfloat) t, (GLfloat) r ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord3dvARB(GLenum target, const GLdouble *v) -{ - MULTI_TEXCOORD3( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r) -{ - MULTI_TEXCOORD3( target, (GLfloat) s, (GLfloat) t, (GLfloat) r ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord3ivARB(GLenum target, const GLint *v) -{ - MULTI_TEXCOORD3( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r) -{ - MULTI_TEXCOORD3( target, (GLfloat) s, (GLfloat) t, (GLfloat) r ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord3svARB(GLenum target, const GLshort *v) -{ - MULTI_TEXCOORD3( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) -{ - MULTI_TEXCOORD4( target, (GLfloat) s, (GLfloat) t, - (GLfloat) r, (GLfloat) q ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord4dvARB(GLenum target, const GLdouble *v) -{ - MULTI_TEXCOORD4( target, (GLfloat) v[0], (GLfloat) v[1], - (GLfloat) v[2], (GLfloat) v[3] ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q) -{ - MULTI_TEXCOORD4( target, (GLfloat) s, (GLfloat) t, - (GLfloat) r, (GLfloat) q ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord4ivARB(GLenum target, const GLint *v) -{ - MULTI_TEXCOORD4( target, (GLfloat) v[0], (GLfloat) v[1], - (GLfloat) v[2], (GLfloat) v[3] ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) -{ - MULTI_TEXCOORD4( target, (GLfloat) s, (GLfloat) t, - (GLfloat) r, (GLfloat) q ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord4svARB(GLenum target, const GLshort *v) -{ - MULTI_TEXCOORD4( target, (GLfloat) v[0], (GLfloat) v[1], - (GLfloat) v[2], (GLfloat) v[3] ); -} - -static void GLAPIENTRY -loopback_EvalCoord2dv( const GLdouble *u ) -{ - EVALCOORD2( (GLfloat) u[0], (GLfloat) u[1] ); -} - -static void GLAPIENTRY -loopback_EvalCoord2fv( const GLfloat *u ) -{ - EVALCOORD2( u[0], u[1] ); -} - -static void GLAPIENTRY -loopback_EvalCoord2d( GLdouble u, GLdouble v ) -{ - EVALCOORD2( (GLfloat) u, (GLfloat) v ); -} - -static void GLAPIENTRY -loopback_EvalCoord1dv( const GLdouble *u ) -{ - EVALCOORD1( (GLfloat) *u ); -} - -static void GLAPIENTRY -loopback_EvalCoord1fv( const GLfloat *u ) -{ - EVALCOORD1( (GLfloat) *u ); -} - -static void GLAPIENTRY -loopback_EvalCoord1d( GLdouble u ) -{ - EVALCOORD1( (GLfloat) u ); -} - -static void GLAPIENTRY -loopback_Materialf( GLenum face, GLenum pname, GLfloat param ) -{ - GLfloat fparam[4]; - fparam[0] = param; - MATERIALFV( face, pname, fparam ); -} - -static void GLAPIENTRY -loopback_Materiali(GLenum face, GLenum pname, GLint param ) -{ - GLfloat p = (GLfloat) param; - MATERIALFV(face, pname, &p); -} - -static void GLAPIENTRY -loopback_Materialiv(GLenum face, GLenum pname, const GLint *params ) -{ - GLfloat fparam[4]; - switch (pname) { - case GL_AMBIENT: - case GL_DIFFUSE: - case GL_SPECULAR: - case GL_EMISSION: - case GL_AMBIENT_AND_DIFFUSE: - fparam[0] = INT_TO_FLOAT( params[0] ); - fparam[1] = INT_TO_FLOAT( params[1] ); - fparam[2] = INT_TO_FLOAT( params[2] ); - fparam[3] = INT_TO_FLOAT( params[3] ); - break; - case GL_SHININESS: - fparam[0] = (GLfloat) params[0]; - break; - case GL_COLOR_INDEXES: - fparam[0] = (GLfloat) params[0]; - fparam[1] = (GLfloat) params[1]; - fparam[2] = (GLfloat) params[2]; - break; - default: - ; - } - MATERIALFV(face, pname, fparam); -} - - -static void GLAPIENTRY -loopback_Rectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2) -{ - RECTF((GLfloat) x1, (GLfloat) y1, (GLfloat) x2, (GLfloat) y2); -} - -static void GLAPIENTRY -loopback_Rectdv(const GLdouble *v1, const GLdouble *v2) -{ - RECTF((GLfloat) v1[0], (GLfloat) v1[1], (GLfloat) v2[0], (GLfloat) v2[1]); -} - -static void GLAPIENTRY -loopback_Rectfv(const GLfloat *v1, const GLfloat *v2) -{ - RECTF(v1[0], v1[1], v2[0], v2[1]); -} - -static void GLAPIENTRY -loopback_Recti(GLint x1, GLint y1, GLint x2, GLint y2) -{ - RECTF((GLfloat) x1, (GLfloat) y1, (GLfloat) x2, (GLfloat) y2); -} - -static void GLAPIENTRY -loopback_Rectiv(const GLint *v1, const GLint *v2) -{ - RECTF((GLfloat) v1[0], (GLfloat) v1[1], (GLfloat) v2[0], (GLfloat) v2[1]); -} - -static void GLAPIENTRY -loopback_Rects(GLshort x1, GLshort y1, GLshort x2, GLshort y2) -{ - RECTF((GLfloat) x1, (GLfloat) y1, (GLfloat) x2, (GLfloat) y2); -} - -static void GLAPIENTRY -loopback_Rectsv(const GLshort *v1, const GLshort *v2) -{ - RECTF((GLfloat) v1[0], (GLfloat) v1[1], (GLfloat) v2[0], (GLfloat) v2[1]); -} - -static void GLAPIENTRY -loopback_SecondaryColor3bEXT_f( GLbyte red, GLbyte green, GLbyte blue ) -{ - SECONDARYCOLORF( BYTE_TO_FLOAT(red), - BYTE_TO_FLOAT(green), - BYTE_TO_FLOAT(blue) ); -} - -static void GLAPIENTRY -loopback_SecondaryColor3dEXT_f( GLdouble red, GLdouble green, GLdouble blue ) -{ - SECONDARYCOLORF( (GLfloat) red, (GLfloat) green, (GLfloat) blue ); -} - -static void GLAPIENTRY -loopback_SecondaryColor3iEXT_f( GLint red, GLint green, GLint blue ) -{ - SECONDARYCOLORF( INT_TO_FLOAT(red), - INT_TO_FLOAT(green), - INT_TO_FLOAT(blue)); -} - -static void GLAPIENTRY -loopback_SecondaryColor3sEXT_f( GLshort red, GLshort green, GLshort blue ) -{ - SECONDARYCOLORF(SHORT_TO_FLOAT(red), - SHORT_TO_FLOAT(green), - SHORT_TO_FLOAT(blue)); -} - -static void GLAPIENTRY -loopback_SecondaryColor3uiEXT_f( GLuint red, GLuint green, GLuint blue ) -{ - SECONDARYCOLORF(UINT_TO_FLOAT(red), - UINT_TO_FLOAT(green), - UINT_TO_FLOAT(blue)); -} - -static void GLAPIENTRY -loopback_SecondaryColor3usEXT_f( GLushort red, GLushort green, GLushort blue ) -{ - SECONDARYCOLORF(USHORT_TO_FLOAT(red), - USHORT_TO_FLOAT(green), - USHORT_TO_FLOAT(blue)); -} - -static void GLAPIENTRY -loopback_SecondaryColor3ubEXT_f( GLubyte red, GLubyte green, GLubyte blue ) -{ - SECONDARYCOLORF(UBYTE_TO_FLOAT(red), - UBYTE_TO_FLOAT(green), - UBYTE_TO_FLOAT(blue)); -} - -static void GLAPIENTRY -loopback_SecondaryColor3bvEXT_f( const GLbyte *v ) -{ - SECONDARYCOLORF(BYTE_TO_FLOAT(v[0]), - BYTE_TO_FLOAT(v[1]), - BYTE_TO_FLOAT(v[2])); -} - -static void GLAPIENTRY -loopback_SecondaryColor3dvEXT_f( const GLdouble *v ) -{ - SECONDARYCOLORF( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); -} -static void GLAPIENTRY -loopback_SecondaryColor3ivEXT_f( const GLint *v ) -{ - SECONDARYCOLORF(INT_TO_FLOAT(v[0]), - INT_TO_FLOAT(v[1]), - INT_TO_FLOAT(v[2])); -} - -static void GLAPIENTRY -loopback_SecondaryColor3svEXT_f( const GLshort *v ) -{ - SECONDARYCOLORF(SHORT_TO_FLOAT(v[0]), - SHORT_TO_FLOAT(v[1]), - SHORT_TO_FLOAT(v[2])); -} - -static void GLAPIENTRY -loopback_SecondaryColor3uivEXT_f( const GLuint *v ) -{ - SECONDARYCOLORF(UINT_TO_FLOAT(v[0]), - UINT_TO_FLOAT(v[1]), - UINT_TO_FLOAT(v[2])); -} - -static void GLAPIENTRY -loopback_SecondaryColor3usvEXT_f( const GLushort *v ) -{ - SECONDARYCOLORF(USHORT_TO_FLOAT(v[0]), - USHORT_TO_FLOAT(v[1]), - USHORT_TO_FLOAT(v[2])); -} - -static void GLAPIENTRY -loopback_SecondaryColor3ubvEXT_f( const GLubyte *v ) -{ - SECONDARYCOLORF(UBYTE_TO_FLOAT(v[0]), - UBYTE_TO_FLOAT(v[1]), - UBYTE_TO_FLOAT(v[2])); -} - - -/* - * GL_NV_vertex_program: - * Always loop-back to one of the VertexAttrib[1234]f[v]NV functions. - * Note that attribute indexes DO alias conventional vertex attributes. - */ - -static void GLAPIENTRY -loopback_VertexAttrib1sNV(GLuint index, GLshort x) -{ - ATTRIB1NV(index, (GLfloat) x); -} - -static void GLAPIENTRY -loopback_VertexAttrib1dNV(GLuint index, GLdouble x) -{ - ATTRIB1NV(index, (GLfloat) x); -} - -static void GLAPIENTRY -loopback_VertexAttrib2sNV(GLuint index, GLshort x, GLshort y) -{ - ATTRIB2NV(index, (GLfloat) x, y); -} - -static void GLAPIENTRY -loopback_VertexAttrib2dNV(GLuint index, GLdouble x, GLdouble y) -{ - ATTRIB2NV(index, (GLfloat) x, (GLfloat) y); -} - -static void GLAPIENTRY -loopback_VertexAttrib3sNV(GLuint index, GLshort x, GLshort y, GLshort z) -{ - ATTRIB3NV(index, (GLfloat) x, (GLfloat) y, (GLfloat) z); -} - -static void GLAPIENTRY -loopback_VertexAttrib3dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z) -{ - ATTRIB4NV(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); -} - -static void GLAPIENTRY -loopback_VertexAttrib4sNV(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w) -{ - ATTRIB4NV(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); -} - -static void GLAPIENTRY -loopback_VertexAttrib4dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) -{ - ATTRIB4NV(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); -} - -static void GLAPIENTRY -loopback_VertexAttrib4ubNV(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w) -{ - ATTRIB4NV(index, UBYTE_TO_FLOAT(x), UBYTE_TO_FLOAT(y), - UBYTE_TO_FLOAT(z), UBYTE_TO_FLOAT(w)); -} - -static void GLAPIENTRY -loopback_VertexAttrib1svNV(GLuint index, const GLshort *v) -{ - ATTRIB1NV(index, (GLfloat) v[0]); -} - -static void GLAPIENTRY -loopback_VertexAttrib1dvNV(GLuint index, const GLdouble *v) -{ - ATTRIB1NV(index, (GLfloat) v[0]); -} - -static void GLAPIENTRY -loopback_VertexAttrib2svNV(GLuint index, const GLshort *v) -{ - ATTRIB2NV(index, (GLfloat) v[0], (GLfloat) v[1]); -} - -static void GLAPIENTRY -loopback_VertexAttrib2dvNV(GLuint index, const GLdouble *v) -{ - ATTRIB2NV(index, (GLfloat) v[0], (GLfloat) v[1]); -} - -static void GLAPIENTRY -loopback_VertexAttrib3svNV(GLuint index, const GLshort *v) -{ - ATTRIB3NV(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); -} - -static void GLAPIENTRY -loopback_VertexAttrib3dvNV(GLuint index, const GLdouble *v) -{ - ATTRIB3NV(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); -} - -static void GLAPIENTRY -loopback_VertexAttrib4svNV(GLuint index, const GLshort *v) -{ - ATTRIB4NV(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], - (GLfloat)v[3]); -} - -static void GLAPIENTRY -loopback_VertexAttrib4dvNV(GLuint index, const GLdouble *v) -{ - ATTRIB4NV(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); -} - -static void GLAPIENTRY -loopback_VertexAttrib4ubvNV(GLuint index, const GLubyte *v) -{ - ATTRIB4NV(index, UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), - UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3])); -} - - -static void GLAPIENTRY -loopback_VertexAttribs1svNV(GLuint index, GLsizei n, const GLshort *v) -{ - GLint i; - for (i = n - 1; i >= 0; i--) - loopback_VertexAttrib1svNV(index + i, v + i); -} - -static void GLAPIENTRY -loopback_VertexAttribs1fvNV(GLuint index, GLsizei n, const GLfloat *v) -{ - GLint i; - for (i = n - 1; i >= 0; i--) - ATTRIB1NV(index + i, v[i]); -} - -static void GLAPIENTRY -loopback_VertexAttribs1dvNV(GLuint index, GLsizei n, const GLdouble *v) -{ - GLint i; - for (i = n - 1; i >= 0; i--) - loopback_VertexAttrib1dvNV(index + i, v + i); -} - -static void GLAPIENTRY -loopback_VertexAttribs2svNV(GLuint index, GLsizei n, const GLshort *v) -{ - GLint i; - for (i = n - 1; i >= 0; i--) - loopback_VertexAttrib2svNV(index + i, v + 2 * i); -} - -static void GLAPIENTRY -loopback_VertexAttribs2fvNV(GLuint index, GLsizei n, const GLfloat *v) -{ - GLint i; - for (i = n - 1; i >= 0; i--) - ATTRIB2NV(index + i, v[2 * i], v[2 * i + 1]); -} - -static void GLAPIENTRY -loopback_VertexAttribs2dvNV(GLuint index, GLsizei n, const GLdouble *v) -{ - GLint i; - for (i = n - 1; i >= 0; i--) - loopback_VertexAttrib2dvNV(index + i, v + 2 * i); -} - -static void GLAPIENTRY -loopback_VertexAttribs3svNV(GLuint index, GLsizei n, const GLshort *v) -{ - GLint i; - for (i = n - 1; i >= 0; i--) - loopback_VertexAttrib3svNV(index + i, v + 3 * i); -} - -static void GLAPIENTRY -loopback_VertexAttribs3fvNV(GLuint index, GLsizei n, const GLfloat *v) -{ - GLint i; - for (i = n - 1; i >= 0; i--) - ATTRIB3NV(index + i, v[3 * i], v[3 * i + 1], v[3 * i + 2]); -} - -static void GLAPIENTRY -loopback_VertexAttribs3dvNV(GLuint index, GLsizei n, const GLdouble *v) -{ - GLint i; - for (i = n - 1; i >= 0; i--) - loopback_VertexAttrib3dvNV(index + i, v + 3 * i); -} - -static void GLAPIENTRY -loopback_VertexAttribs4svNV(GLuint index, GLsizei n, const GLshort *v) -{ - GLint i; - for (i = n - 1; i >= 0; i--) - loopback_VertexAttrib4svNV(index + i, v + 4 * i); -} - -static void GLAPIENTRY -loopback_VertexAttribs4fvNV(GLuint index, GLsizei n, const GLfloat *v) -{ - GLint i; - for (i = n - 1; i >= 0; i--) - ATTRIB4NV(index + i, v[4 * i], v[4 * i + 1], v[4 * i + 2], v[4 * i + 3]); -} - -static void GLAPIENTRY -loopback_VertexAttribs4dvNV(GLuint index, GLsizei n, const GLdouble *v) -{ - GLint i; - for (i = n - 1; i >= 0; i--) - loopback_VertexAttrib4dvNV(index + i, v + 4 * i); -} - -static void GLAPIENTRY -loopback_VertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte *v) -{ - GLint i; - for (i = n - 1; i >= 0; i--) - loopback_VertexAttrib4ubvNV(index + i, v + 4 * i); -} - - -/* - * GL_ARB_vertex_program - * Always loop-back to one of the VertexAttrib[1234]f[v]ARB functions. - * Note that attribute indexes do NOT alias conventional attributes. - */ - -static void GLAPIENTRY -loopback_VertexAttrib1sARB(GLuint index, GLshort x) -{ - ATTRIB1ARB(index, (GLfloat) x); -} - -static void GLAPIENTRY -loopback_VertexAttrib1dARB(GLuint index, GLdouble x) -{ - ATTRIB1ARB(index, (GLfloat) x); -} - -static void GLAPIENTRY -loopback_VertexAttrib2sARB(GLuint index, GLshort x, GLshort y) -{ - ATTRIB2ARB(index, (GLfloat) x, y); -} - -static void GLAPIENTRY -loopback_VertexAttrib2dARB(GLuint index, GLdouble x, GLdouble y) -{ - ATTRIB2ARB(index, (GLfloat) x, (GLfloat) y); -} - -static void GLAPIENTRY -loopback_VertexAttrib3sARB(GLuint index, GLshort x, GLshort y, GLshort z) -{ - ATTRIB3ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z); -} - -static void GLAPIENTRY -loopback_VertexAttrib3dARB(GLuint index, GLdouble x, GLdouble y, GLdouble z) -{ - ATTRIB4ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); -} - -static void GLAPIENTRY -loopback_VertexAttrib4sARB(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w) -{ - ATTRIB4ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); -} - -static void GLAPIENTRY -loopback_VertexAttrib4dARB(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) -{ - ATTRIB4ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); -} - -static void GLAPIENTRY -loopback_VertexAttrib1svARB(GLuint index, const GLshort *v) -{ - ATTRIB1ARB(index, (GLfloat) v[0]); -} - -static void GLAPIENTRY -loopback_VertexAttrib1dvARB(GLuint index, const GLdouble *v) -{ - ATTRIB1ARB(index, (GLfloat) v[0]); -} - -static void GLAPIENTRY -loopback_VertexAttrib2svARB(GLuint index, const GLshort *v) -{ - ATTRIB2ARB(index, (GLfloat) v[0], (GLfloat) v[1]); -} - -static void GLAPIENTRY -loopback_VertexAttrib2dvARB(GLuint index, const GLdouble *v) -{ - ATTRIB2ARB(index, (GLfloat) v[0], (GLfloat) v[1]); -} - -static void GLAPIENTRY -loopback_VertexAttrib3svARB(GLuint index, const GLshort *v) -{ - ATTRIB3ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); -} - -static void GLAPIENTRY -loopback_VertexAttrib3dvARB(GLuint index, const GLdouble *v) -{ - ATTRIB3ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); -} - -static void GLAPIENTRY -loopback_VertexAttrib4svARB(GLuint index, const GLshort *v) -{ - ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], - (GLfloat)v[3]); -} - -static void GLAPIENTRY -loopback_VertexAttrib4dvARB(GLuint index, const GLdouble *v) -{ - ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); -} - -static void GLAPIENTRY -loopback_VertexAttrib4bvARB(GLuint index, const GLbyte * v) -{ - ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); -} - -static void GLAPIENTRY -loopback_VertexAttrib4ivARB(GLuint index, const GLint * v) -{ - ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); -} - -static void GLAPIENTRY -loopback_VertexAttrib4ubvARB(GLuint index, const GLubyte * v) -{ - ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); -} - -static void GLAPIENTRY -loopback_VertexAttrib4usvARB(GLuint index, const GLushort * v) -{ - ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); -} - -static void GLAPIENTRY -loopback_VertexAttrib4uivARB(GLuint index, const GLuint * v) -{ - ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); -} - -static void GLAPIENTRY -loopback_VertexAttrib4NbvARB(GLuint index, const GLbyte * v) -{ - ATTRIB4ARB(index, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), - BYTE_TO_FLOAT(v[2]), BYTE_TO_FLOAT(v[3])); -} - -static void GLAPIENTRY -loopback_VertexAttrib4NsvARB(GLuint index, const GLshort * v) -{ - ATTRIB4ARB(index, SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), - SHORT_TO_FLOAT(v[2]), SHORT_TO_FLOAT(v[3])); -} - -static void GLAPIENTRY -loopback_VertexAttrib4NivARB(GLuint index, const GLint * v) -{ - ATTRIB4ARB(index, INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), - INT_TO_FLOAT(v[2]), INT_TO_FLOAT(v[3])); -} - -static void GLAPIENTRY -loopback_VertexAttrib4NubARB(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w) -{ - ATTRIB4ARB(index, UBYTE_TO_FLOAT(x), UBYTE_TO_FLOAT(y), - UBYTE_TO_FLOAT(z), UBYTE_TO_FLOAT(w)); -} - -static void GLAPIENTRY -loopback_VertexAttrib4NubvARB(GLuint index, const GLubyte * v) -{ - ATTRIB4ARB(index, UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), - UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3])); -} - -static void GLAPIENTRY -loopback_VertexAttrib4NusvARB(GLuint index, const GLushort * v) -{ - ATTRIB4ARB(index, USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]), - USHORT_TO_FLOAT(v[2]), USHORT_TO_FLOAT(v[3])); -} - -static void GLAPIENTRY -loopback_VertexAttrib4NuivARB(GLuint index, const GLuint * v) -{ - ATTRIB4ARB(index, UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]), - UINT_TO_FLOAT(v[2]), UINT_TO_FLOAT(v[3])); -} - - - -/** - * GL_EXT_gpu_shader / GL 3.0 signed/unsigned integer-valued attributes. - * Note that attribute indexes do NOT alias conventional attributes. - */ - -static void GLAPIENTRY -loopback_VertexAttribI1iv(GLuint index, const GLint *v) -{ - ATTRIBI_1I(index, v[0]); -} - -static void GLAPIENTRY -loopback_VertexAttribI1uiv(GLuint index, const GLuint *v) -{ - ATTRIBI_1UI(index, v[0]); -} - -static void GLAPIENTRY -loopback_VertexAttribI4bv(GLuint index, const GLbyte *v) -{ - ATTRIBI_4I(index, v[0], v[1], v[2], v[3]); -} - -static void GLAPIENTRY -loopback_VertexAttribI4sv(GLuint index, const GLshort *v) -{ - ATTRIBI_4I(index, v[0], v[1], v[2], v[3]); -} - -static void GLAPIENTRY -loopback_VertexAttribI4ubv(GLuint index, const GLubyte *v) -{ - ATTRIBI_4UI(index, v[0], v[1], v[2], v[3]); -} - -static void GLAPIENTRY -loopback_VertexAttribI4usv(GLuint index, const GLushort *v) -{ - ATTRIBI_4UI(index, v[0], v[1], v[2], v[3]); -} - - - - -/* - * This code never registers handlers for any of the entry points - * listed in vtxfmt.h. - */ -void -_mesa_loopback_init_api_table( struct _glapi_table *dest ) -{ - SET_Color3b(dest, loopback_Color3b_f); - SET_Color3d(dest, loopback_Color3d_f); - SET_Color3i(dest, loopback_Color3i_f); - SET_Color3s(dest, loopback_Color3s_f); - SET_Color3ui(dest, loopback_Color3ui_f); - SET_Color3us(dest, loopback_Color3us_f); - SET_Color3ub(dest, loopback_Color3ub_f); - SET_Color4b(dest, loopback_Color4b_f); - SET_Color4d(dest, loopback_Color4d_f); - SET_Color4i(dest, loopback_Color4i_f); - SET_Color4s(dest, loopback_Color4s_f); - SET_Color4ui(dest, loopback_Color4ui_f); - SET_Color4us(dest, loopback_Color4us_f); - SET_Color4ub(dest, loopback_Color4ub_f); - SET_Color3bv(dest, loopback_Color3bv_f); - SET_Color3dv(dest, loopback_Color3dv_f); - SET_Color3iv(dest, loopback_Color3iv_f); - SET_Color3sv(dest, loopback_Color3sv_f); - SET_Color3uiv(dest, loopback_Color3uiv_f); - SET_Color3usv(dest, loopback_Color3usv_f); - SET_Color3ubv(dest, loopback_Color3ubv_f); - SET_Color4bv(dest, loopback_Color4bv_f); - SET_Color4dv(dest, loopback_Color4dv_f); - SET_Color4iv(dest, loopback_Color4iv_f); - SET_Color4sv(dest, loopback_Color4sv_f); - SET_Color4uiv(dest, loopback_Color4uiv_f); - SET_Color4usv(dest, loopback_Color4usv_f); - SET_Color4ubv(dest, loopback_Color4ubv_f); - - SET_SecondaryColor3bEXT(dest, loopback_SecondaryColor3bEXT_f); - SET_SecondaryColor3dEXT(dest, loopback_SecondaryColor3dEXT_f); - SET_SecondaryColor3iEXT(dest, loopback_SecondaryColor3iEXT_f); - SET_SecondaryColor3sEXT(dest, loopback_SecondaryColor3sEXT_f); - SET_SecondaryColor3uiEXT(dest, loopback_SecondaryColor3uiEXT_f); - SET_SecondaryColor3usEXT(dest, loopback_SecondaryColor3usEXT_f); - SET_SecondaryColor3ubEXT(dest, loopback_SecondaryColor3ubEXT_f); - SET_SecondaryColor3bvEXT(dest, loopback_SecondaryColor3bvEXT_f); - SET_SecondaryColor3dvEXT(dest, loopback_SecondaryColor3dvEXT_f); - SET_SecondaryColor3ivEXT(dest, loopback_SecondaryColor3ivEXT_f); - SET_SecondaryColor3svEXT(dest, loopback_SecondaryColor3svEXT_f); - SET_SecondaryColor3uivEXT(dest, loopback_SecondaryColor3uivEXT_f); - SET_SecondaryColor3usvEXT(dest, loopback_SecondaryColor3usvEXT_f); - SET_SecondaryColor3ubvEXT(dest, loopback_SecondaryColor3ubvEXT_f); - - SET_EdgeFlagv(dest, loopback_EdgeFlagv); - - SET_Indexd(dest, loopback_Indexd); - SET_Indexi(dest, loopback_Indexi); - SET_Indexs(dest, loopback_Indexs); - SET_Indexub(dest, loopback_Indexub); - SET_Indexdv(dest, loopback_Indexdv); - SET_Indexiv(dest, loopback_Indexiv); - SET_Indexsv(dest, loopback_Indexsv); - SET_Indexubv(dest, loopback_Indexubv); - SET_Normal3b(dest, loopback_Normal3b); - SET_Normal3d(dest, loopback_Normal3d); - SET_Normal3i(dest, loopback_Normal3i); - SET_Normal3s(dest, loopback_Normal3s); - SET_Normal3bv(dest, loopback_Normal3bv); - SET_Normal3dv(dest, loopback_Normal3dv); - SET_Normal3iv(dest, loopback_Normal3iv); - SET_Normal3sv(dest, loopback_Normal3sv); - SET_TexCoord1d(dest, loopback_TexCoord1d); - SET_TexCoord1i(dest, loopback_TexCoord1i); - SET_TexCoord1s(dest, loopback_TexCoord1s); - SET_TexCoord2d(dest, loopback_TexCoord2d); - SET_TexCoord2s(dest, loopback_TexCoord2s); - SET_TexCoord2i(dest, loopback_TexCoord2i); - SET_TexCoord3d(dest, loopback_TexCoord3d); - SET_TexCoord3i(dest, loopback_TexCoord3i); - SET_TexCoord3s(dest, loopback_TexCoord3s); - SET_TexCoord4d(dest, loopback_TexCoord4d); - SET_TexCoord4i(dest, loopback_TexCoord4i); - SET_TexCoord4s(dest, loopback_TexCoord4s); - SET_TexCoord1dv(dest, loopback_TexCoord1dv); - SET_TexCoord1iv(dest, loopback_TexCoord1iv); - SET_TexCoord1sv(dest, loopback_TexCoord1sv); - SET_TexCoord2dv(dest, loopback_TexCoord2dv); - SET_TexCoord2iv(dest, loopback_TexCoord2iv); - SET_TexCoord2sv(dest, loopback_TexCoord2sv); - SET_TexCoord3dv(dest, loopback_TexCoord3dv); - SET_TexCoord3iv(dest, loopback_TexCoord3iv); - SET_TexCoord3sv(dest, loopback_TexCoord3sv); - SET_TexCoord4dv(dest, loopback_TexCoord4dv); - SET_TexCoord4iv(dest, loopback_TexCoord4iv); - SET_TexCoord4sv(dest, loopback_TexCoord4sv); - SET_Vertex2d(dest, loopback_Vertex2d); - SET_Vertex2i(dest, loopback_Vertex2i); - SET_Vertex2s(dest, loopback_Vertex2s); - SET_Vertex3d(dest, loopback_Vertex3d); - SET_Vertex3i(dest, loopback_Vertex3i); - SET_Vertex3s(dest, loopback_Vertex3s); - SET_Vertex4d(dest, loopback_Vertex4d); - SET_Vertex4i(dest, loopback_Vertex4i); - SET_Vertex4s(dest, loopback_Vertex4s); - SET_Vertex2dv(dest, loopback_Vertex2dv); - SET_Vertex2iv(dest, loopback_Vertex2iv); - SET_Vertex2sv(dest, loopback_Vertex2sv); - SET_Vertex3dv(dest, loopback_Vertex3dv); - SET_Vertex3iv(dest, loopback_Vertex3iv); - SET_Vertex3sv(dest, loopback_Vertex3sv); - SET_Vertex4dv(dest, loopback_Vertex4dv); - SET_Vertex4iv(dest, loopback_Vertex4iv); - SET_Vertex4sv(dest, loopback_Vertex4sv); - SET_MultiTexCoord1dARB(dest, loopback_MultiTexCoord1dARB); - SET_MultiTexCoord1dvARB(dest, loopback_MultiTexCoord1dvARB); - SET_MultiTexCoord1iARB(dest, loopback_MultiTexCoord1iARB); - SET_MultiTexCoord1ivARB(dest, loopback_MultiTexCoord1ivARB); - SET_MultiTexCoord1sARB(dest, loopback_MultiTexCoord1sARB); - SET_MultiTexCoord1svARB(dest, loopback_MultiTexCoord1svARB); - SET_MultiTexCoord2dARB(dest, loopback_MultiTexCoord2dARB); - SET_MultiTexCoord2dvARB(dest, loopback_MultiTexCoord2dvARB); - SET_MultiTexCoord2iARB(dest, loopback_MultiTexCoord2iARB); - SET_MultiTexCoord2ivARB(dest, loopback_MultiTexCoord2ivARB); - SET_MultiTexCoord2sARB(dest, loopback_MultiTexCoord2sARB); - SET_MultiTexCoord2svARB(dest, loopback_MultiTexCoord2svARB); - SET_MultiTexCoord3dARB(dest, loopback_MultiTexCoord3dARB); - SET_MultiTexCoord3dvARB(dest, loopback_MultiTexCoord3dvARB); - SET_MultiTexCoord3iARB(dest, loopback_MultiTexCoord3iARB); - SET_MultiTexCoord3ivARB(dest, loopback_MultiTexCoord3ivARB); - SET_MultiTexCoord3sARB(dest, loopback_MultiTexCoord3sARB); - SET_MultiTexCoord3svARB(dest, loopback_MultiTexCoord3svARB); - SET_MultiTexCoord4dARB(dest, loopback_MultiTexCoord4dARB); - SET_MultiTexCoord4dvARB(dest, loopback_MultiTexCoord4dvARB); - SET_MultiTexCoord4iARB(dest, loopback_MultiTexCoord4iARB); - SET_MultiTexCoord4ivARB(dest, loopback_MultiTexCoord4ivARB); - SET_MultiTexCoord4sARB(dest, loopback_MultiTexCoord4sARB); - SET_MultiTexCoord4svARB(dest, loopback_MultiTexCoord4svARB); - SET_EvalCoord2dv(dest, loopback_EvalCoord2dv); - SET_EvalCoord2fv(dest, loopback_EvalCoord2fv); - SET_EvalCoord2d(dest, loopback_EvalCoord2d); - SET_EvalCoord1dv(dest, loopback_EvalCoord1dv); - SET_EvalCoord1fv(dest, loopback_EvalCoord1fv); - SET_EvalCoord1d(dest, loopback_EvalCoord1d); - SET_Materialf(dest, loopback_Materialf); - SET_Materiali(dest, loopback_Materiali); - SET_Materialiv(dest, loopback_Materialiv); - SET_Rectd(dest, loopback_Rectd); - SET_Rectdv(dest, loopback_Rectdv); - SET_Rectfv(dest, loopback_Rectfv); - SET_Recti(dest, loopback_Recti); - SET_Rectiv(dest, loopback_Rectiv); - SET_Rects(dest, loopback_Rects); - SET_Rectsv(dest, loopback_Rectsv); - SET_FogCoorddEXT(dest, loopback_FogCoorddEXT); - SET_FogCoorddvEXT(dest, loopback_FogCoorddvEXT); - - SET_VertexAttrib1sNV(dest, loopback_VertexAttrib1sNV); - SET_VertexAttrib1dNV(dest, loopback_VertexAttrib1dNV); - SET_VertexAttrib2sNV(dest, loopback_VertexAttrib2sNV); - SET_VertexAttrib2dNV(dest, loopback_VertexAttrib2dNV); - SET_VertexAttrib3sNV(dest, loopback_VertexAttrib3sNV); - SET_VertexAttrib3dNV(dest, loopback_VertexAttrib3dNV); - SET_VertexAttrib4sNV(dest, loopback_VertexAttrib4sNV); - SET_VertexAttrib4dNV(dest, loopback_VertexAttrib4dNV); - SET_VertexAttrib4ubNV(dest, loopback_VertexAttrib4ubNV); - SET_VertexAttrib1svNV(dest, loopback_VertexAttrib1svNV); - SET_VertexAttrib1dvNV(dest, loopback_VertexAttrib1dvNV); - SET_VertexAttrib2svNV(dest, loopback_VertexAttrib2svNV); - SET_VertexAttrib2dvNV(dest, loopback_VertexAttrib2dvNV); - SET_VertexAttrib3svNV(dest, loopback_VertexAttrib3svNV); - SET_VertexAttrib3dvNV(dest, loopback_VertexAttrib3dvNV); - SET_VertexAttrib4svNV(dest, loopback_VertexAttrib4svNV); - SET_VertexAttrib4dvNV(dest, loopback_VertexAttrib4dvNV); - SET_VertexAttrib4ubvNV(dest, loopback_VertexAttrib4ubvNV); - SET_VertexAttribs1svNV(dest, loopback_VertexAttribs1svNV); - SET_VertexAttribs1fvNV(dest, loopback_VertexAttribs1fvNV); - SET_VertexAttribs1dvNV(dest, loopback_VertexAttribs1dvNV); - SET_VertexAttribs2svNV(dest, loopback_VertexAttribs2svNV); - SET_VertexAttribs2fvNV(dest, loopback_VertexAttribs2fvNV); - SET_VertexAttribs2dvNV(dest, loopback_VertexAttribs2dvNV); - SET_VertexAttribs3svNV(dest, loopback_VertexAttribs3svNV); - SET_VertexAttribs3fvNV(dest, loopback_VertexAttribs3fvNV); - SET_VertexAttribs3dvNV(dest, loopback_VertexAttribs3dvNV); - SET_VertexAttribs4svNV(dest, loopback_VertexAttribs4svNV); - SET_VertexAttribs4fvNV(dest, loopback_VertexAttribs4fvNV); - SET_VertexAttribs4dvNV(dest, loopback_VertexAttribs4dvNV); - SET_VertexAttribs4ubvNV(dest, loopback_VertexAttribs4ubvNV); - - SET_VertexAttrib1sARB(dest, loopback_VertexAttrib1sARB); - SET_VertexAttrib1dARB(dest, loopback_VertexAttrib1dARB); - SET_VertexAttrib2sARB(dest, loopback_VertexAttrib2sARB); - SET_VertexAttrib2dARB(dest, loopback_VertexAttrib2dARB); - SET_VertexAttrib3sARB(dest, loopback_VertexAttrib3sARB); - SET_VertexAttrib3dARB(dest, loopback_VertexAttrib3dARB); - SET_VertexAttrib4sARB(dest, loopback_VertexAttrib4sARB); - SET_VertexAttrib4dARB(dest, loopback_VertexAttrib4dARB); - SET_VertexAttrib1svARB(dest, loopback_VertexAttrib1svARB); - SET_VertexAttrib1dvARB(dest, loopback_VertexAttrib1dvARB); - SET_VertexAttrib2svARB(dest, loopback_VertexAttrib2svARB); - SET_VertexAttrib2dvARB(dest, loopback_VertexAttrib2dvARB); - SET_VertexAttrib3svARB(dest, loopback_VertexAttrib3svARB); - SET_VertexAttrib3dvARB(dest, loopback_VertexAttrib3dvARB); - SET_VertexAttrib4svARB(dest, loopback_VertexAttrib4svARB); - SET_VertexAttrib4dvARB(dest, loopback_VertexAttrib4dvARB); - SET_VertexAttrib4NubARB(dest, loopback_VertexAttrib4NubARB); - SET_VertexAttrib4NubvARB(dest, loopback_VertexAttrib4NubvARB); - SET_VertexAttrib4bvARB(dest, loopback_VertexAttrib4bvARB); - SET_VertexAttrib4ivARB(dest, loopback_VertexAttrib4ivARB); - SET_VertexAttrib4ubvARB(dest, loopback_VertexAttrib4ubvARB); - SET_VertexAttrib4usvARB(dest, loopback_VertexAttrib4usvARB); - SET_VertexAttrib4uivARB(dest, loopback_VertexAttrib4uivARB); - SET_VertexAttrib4NbvARB(dest, loopback_VertexAttrib4NbvARB); - SET_VertexAttrib4NsvARB(dest, loopback_VertexAttrib4NsvARB); - SET_VertexAttrib4NivARB(dest, loopback_VertexAttrib4NivARB); - SET_VertexAttrib4NusvARB(dest, loopback_VertexAttrib4NusvARB); - SET_VertexAttrib4NuivARB(dest, loopback_VertexAttrib4NuivARB); - - /* GL_EXT_gpu_shader4, GL 3.0 */ - SET_VertexAttribI1ivEXT(dest, loopback_VertexAttribI1iv); - SET_VertexAttribI1uivEXT(dest, loopback_VertexAttribI1uiv); - SET_VertexAttribI4bvEXT(dest, loopback_VertexAttribI4bv); - SET_VertexAttribI4svEXT(dest, loopback_VertexAttribI4sv); - SET_VertexAttribI4ubvEXT(dest, loopback_VertexAttribI4ubv); - SET_VertexAttribI4usvEXT(dest, loopback_VertexAttribI4usv); -} - - -#endif /* FEATURE_beginend */ +/** + * \file api_loopback.c + * + * \author Keith Whitwell + */ + +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#include "glheader.h" +#include "macros.h" +#include "api_loopback.h" +#include "mtypes.h" +#include "glapi/glapi.h" +#include "glapi/glthread.h" +#include "main/dispatch.h" +#include "mfeatures.h" + +/* KW: A set of functions to convert unusual Color/Normal/Vertex/etc + * calls to a smaller set of driver-provided formats. Currently just + * go back to dispatch to find these (eg. call glNormal3f directly), + * hence 'loopback'. + * + * The driver must supply all of the remaining entry points, which are + * listed in dd.h. The easiest way for a driver to do this is to + * install the supplied software t&l module. + */ +#define COLORF(r,g,b,a) CALL_Color4f(GET_DISPATCH(), (r,g,b,a)) +#define VERTEX2(x,y) CALL_Vertex2f(GET_DISPATCH(), (x,y)) +#define VERTEX3(x,y,z) CALL_Vertex3f(GET_DISPATCH(), (x,y,z)) +#define VERTEX4(x,y,z,w) CALL_Vertex4f(GET_DISPATCH(), (x,y,z,w)) +#define NORMAL(x,y,z) CALL_Normal3f(GET_DISPATCH(), (x,y,z)) +#define TEXCOORD1(s) CALL_TexCoord1f(GET_DISPATCH(), (s)) +#define TEXCOORD2(s,t) CALL_TexCoord2f(GET_DISPATCH(), (s,t)) +#define TEXCOORD3(s,t,u) CALL_TexCoord3f(GET_DISPATCH(), (s,t,u)) +#define TEXCOORD4(s,t,u,v) CALL_TexCoord4f(GET_DISPATCH(), (s,t,u,v)) +#define INDEX(c) CALL_Indexf(GET_DISPATCH(), (c)) +#define MULTI_TEXCOORD1(z,s) CALL_MultiTexCoord1fARB(GET_DISPATCH(), (z,s)) +#define MULTI_TEXCOORD2(z,s,t) CALL_MultiTexCoord2fARB(GET_DISPATCH(), (z,s,t)) +#define MULTI_TEXCOORD3(z,s,t,u) CALL_MultiTexCoord3fARB(GET_DISPATCH(), (z,s,t,u)) +#define MULTI_TEXCOORD4(z,s,t,u,v) CALL_MultiTexCoord4fARB(GET_DISPATCH(), (z,s,t,u,v)) +#define EVALCOORD1(x) CALL_EvalCoord1f(GET_DISPATCH(), (x)) +#define EVALCOORD2(x,y) CALL_EvalCoord2f(GET_DISPATCH(), (x,y)) +#define MATERIALFV(a,b,c) CALL_Materialfv(GET_DISPATCH(), (a,b,c)) +#define RECTF(a,b,c,d) CALL_Rectf(GET_DISPATCH(), (a,b,c,d)) + +#define FOGCOORDF(x) CALL_FogCoordfEXT(GET_DISPATCH(), (x)) +#define SECONDARYCOLORF(a,b,c) CALL_SecondaryColor3fEXT(GET_DISPATCH(), (a,b,c)) + +#define ATTRIB1NV(index,x) CALL_VertexAttrib1fNV(GET_DISPATCH(), (index,x)) +#define ATTRIB2NV(index,x,y) CALL_VertexAttrib2fNV(GET_DISPATCH(), (index,x,y)) +#define ATTRIB3NV(index,x,y,z) CALL_VertexAttrib3fNV(GET_DISPATCH(), (index,x,y,z)) +#define ATTRIB4NV(index,x,y,z,w) CALL_VertexAttrib4fNV(GET_DISPATCH(), (index,x,y,z,w)) + +#define ATTRIB1ARB(index,x) CALL_VertexAttrib1fARB(GET_DISPATCH(), (index,x)) +#define ATTRIB2ARB(index,x,y) CALL_VertexAttrib2fARB(GET_DISPATCH(), (index,x,y)) +#define ATTRIB3ARB(index,x,y,z) CALL_VertexAttrib3fARB(GET_DISPATCH(), (index,x,y,z)) +#define ATTRIB4ARB(index,x,y,z,w) CALL_VertexAttrib4fARB(GET_DISPATCH(), (index,x,y,z,w)) + +#define ATTRIBI_1I(index,x) CALL_VertexAttribI1iEXT(GET_DISPATCH(), (index,x)) +#define ATTRIBI_1UI(index,x) CALL_VertexAttribI1uiEXT(GET_DISPATCH(), (index,x)) +#define ATTRIBI_4I(index,x,y,z,w) CALL_VertexAttribI4iEXT(GET_DISPATCH(), (index,x,y,z,w)) + +#define ATTRIBI_4UI(index,x,y,z,w) CALL_VertexAttribI4uiEXT(GET_DISPATCH(), (index,x,y,z,w)) + + +#if FEATURE_beginend + + +static void GLAPIENTRY +loopback_Color3b_f( GLbyte red, GLbyte green, GLbyte blue ) +{ + COLORF( BYTE_TO_FLOAT(red), + BYTE_TO_FLOAT(green), + BYTE_TO_FLOAT(blue), + 1.0 ); +} + +static void GLAPIENTRY +loopback_Color3d_f( GLdouble red, GLdouble green, GLdouble blue ) +{ + COLORF( (GLfloat) red, (GLfloat) green, (GLfloat) blue, 1.0 ); +} + +static void GLAPIENTRY +loopback_Color3i_f( GLint red, GLint green, GLint blue ) +{ + COLORF( INT_TO_FLOAT(red), INT_TO_FLOAT(green), + INT_TO_FLOAT(blue), 1.0); +} + +static void GLAPIENTRY +loopback_Color3s_f( GLshort red, GLshort green, GLshort blue ) +{ + COLORF( SHORT_TO_FLOAT(red), SHORT_TO_FLOAT(green), + SHORT_TO_FLOAT(blue), 1.0); +} + +static void GLAPIENTRY +loopback_Color3ui_f( GLuint red, GLuint green, GLuint blue ) +{ + COLORF( UINT_TO_FLOAT(red), UINT_TO_FLOAT(green), + UINT_TO_FLOAT(blue), 1.0 ); +} + +static void GLAPIENTRY +loopback_Color3us_f( GLushort red, GLushort green, GLushort blue ) +{ + COLORF( USHORT_TO_FLOAT(red), USHORT_TO_FLOAT(green), + USHORT_TO_FLOAT(blue), 1.0 ); +} + +static void GLAPIENTRY +loopback_Color3ub_f( GLubyte red, GLubyte green, GLubyte blue ) +{ + COLORF( UBYTE_TO_FLOAT(red), UBYTE_TO_FLOAT(green), + UBYTE_TO_FLOAT(blue), 1.0 ); +} + + +static void GLAPIENTRY +loopback_Color3bv_f( const GLbyte *v ) +{ + COLORF( BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), + BYTE_TO_FLOAT(v[2]), 1.0 ); +} + +static void GLAPIENTRY +loopback_Color3dv_f( const GLdouble *v ) +{ + COLORF( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0 ); +} + +static void GLAPIENTRY +loopback_Color3iv_f( const GLint *v ) +{ + COLORF( INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), + INT_TO_FLOAT(v[2]), 1.0 ); +} + +static void GLAPIENTRY +loopback_Color3sv_f( const GLshort *v ) +{ + COLORF( SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), + SHORT_TO_FLOAT(v[2]), 1.0 ); +} + +static void GLAPIENTRY +loopback_Color3uiv_f( const GLuint *v ) +{ + COLORF( UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]), + UINT_TO_FLOAT(v[2]), 1.0 ); +} + +static void GLAPIENTRY +loopback_Color3usv_f( const GLushort *v ) +{ + COLORF( USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]), + USHORT_TO_FLOAT(v[2]), 1.0 ); +} + +static void GLAPIENTRY +loopback_Color3ubv_f( const GLubyte *v ) +{ + COLORF( UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), + UBYTE_TO_FLOAT(v[2]), 1.0 ); +} + + +static void GLAPIENTRY +loopback_Color4b_f( GLbyte red, GLbyte green, GLbyte blue, + GLbyte alpha ) +{ + COLORF( BYTE_TO_FLOAT(red), BYTE_TO_FLOAT(green), + BYTE_TO_FLOAT(blue), BYTE_TO_FLOAT(alpha) ); +} + +static void GLAPIENTRY +loopback_Color4d_f( GLdouble red, GLdouble green, GLdouble blue, + GLdouble alpha ) +{ + COLORF( (GLfloat) red, (GLfloat) green, (GLfloat) blue, (GLfloat) alpha ); +} + +static void GLAPIENTRY +loopback_Color4i_f( GLint red, GLint green, GLint blue, GLint alpha ) +{ + COLORF( INT_TO_FLOAT(red), INT_TO_FLOAT(green), + INT_TO_FLOAT(blue), INT_TO_FLOAT(alpha) ); +} + +static void GLAPIENTRY +loopback_Color4s_f( GLshort red, GLshort green, GLshort blue, + GLshort alpha ) +{ + COLORF( SHORT_TO_FLOAT(red), SHORT_TO_FLOAT(green), + SHORT_TO_FLOAT(blue), SHORT_TO_FLOAT(alpha) ); +} + +static void GLAPIENTRY +loopback_Color4ui_f( GLuint red, GLuint green, GLuint blue, GLuint alpha ) +{ + COLORF( UINT_TO_FLOAT(red), UINT_TO_FLOAT(green), + UINT_TO_FLOAT(blue), UINT_TO_FLOAT(alpha) ); +} + +static void GLAPIENTRY +loopback_Color4us_f( GLushort red, GLushort green, GLushort blue, GLushort alpha ) +{ + COLORF( USHORT_TO_FLOAT(red), USHORT_TO_FLOAT(green), + USHORT_TO_FLOAT(blue), USHORT_TO_FLOAT(alpha) ); +} + +static void GLAPIENTRY +loopback_Color4ub_f( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) +{ + COLORF( UBYTE_TO_FLOAT(red), UBYTE_TO_FLOAT(green), + UBYTE_TO_FLOAT(blue), UBYTE_TO_FLOAT(alpha) ); +} + + +static void GLAPIENTRY +loopback_Color4iv_f( const GLint *v ) +{ + COLORF( INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), + INT_TO_FLOAT(v[2]), INT_TO_FLOAT(v[3]) ); +} + + +static void GLAPIENTRY +loopback_Color4bv_f( const GLbyte *v ) +{ + COLORF( BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), + BYTE_TO_FLOAT(v[2]), BYTE_TO_FLOAT(v[3]) ); +} + +static void GLAPIENTRY +loopback_Color4dv_f( const GLdouble *v ) +{ + COLORF( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3] ); +} + + +static void GLAPIENTRY +loopback_Color4sv_f( const GLshort *v) +{ + COLORF( SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), + SHORT_TO_FLOAT(v[2]), SHORT_TO_FLOAT(v[3]) ); +} + + +static void GLAPIENTRY +loopback_Color4uiv_f( const GLuint *v) +{ + COLORF( UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]), + UINT_TO_FLOAT(v[2]), UINT_TO_FLOAT(v[3]) ); +} + +static void GLAPIENTRY +loopback_Color4usv_f( const GLushort *v) +{ + COLORF( USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]), + USHORT_TO_FLOAT(v[2]), USHORT_TO_FLOAT(v[3]) ); +} + +static void GLAPIENTRY +loopback_Color4ubv_f( const GLubyte *v) +{ + COLORF( UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), + UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3]) ); +} + + +static void GLAPIENTRY +loopback_FogCoorddEXT( GLdouble d ) +{ + FOGCOORDF( (GLfloat) d ); +} + +static void GLAPIENTRY +loopback_FogCoorddvEXT( const GLdouble *v ) +{ + FOGCOORDF( (GLfloat) *v ); +} + + +static void GLAPIENTRY +loopback_Indexd( GLdouble c ) +{ + INDEX( (GLfloat) c ); +} + +static void GLAPIENTRY +loopback_Indexi( GLint c ) +{ + INDEX( (GLfloat) c ); +} + +static void GLAPIENTRY +loopback_Indexs( GLshort c ) +{ + INDEX( (GLfloat) c ); +} + +static void GLAPIENTRY +loopback_Indexub( GLubyte c ) +{ + INDEX( (GLfloat) c ); +} + +static void GLAPIENTRY +loopback_Indexdv( const GLdouble *c ) +{ + INDEX( (GLfloat) *c ); +} + +static void GLAPIENTRY +loopback_Indexiv( const GLint *c ) +{ + INDEX( (GLfloat) *c ); +} + +static void GLAPIENTRY +loopback_Indexsv( const GLshort *c ) +{ + INDEX( (GLfloat) *c ); +} + +static void GLAPIENTRY +loopback_Indexubv( const GLubyte *c ) +{ + INDEX( (GLfloat) *c ); +} + + +static void GLAPIENTRY +loopback_EdgeFlagv(const GLboolean *flag) +{ + CALL_EdgeFlag(GET_DISPATCH(), (*flag)); +} + + +static void GLAPIENTRY +loopback_Normal3b( GLbyte nx, GLbyte ny, GLbyte nz ) +{ + NORMAL( BYTE_TO_FLOAT(nx), BYTE_TO_FLOAT(ny), BYTE_TO_FLOAT(nz) ); +} + +static void GLAPIENTRY +loopback_Normal3d( GLdouble nx, GLdouble ny, GLdouble nz ) +{ + NORMAL((GLfloat) nx, (GLfloat) ny, (GLfloat) nz); +} + +static void GLAPIENTRY +loopback_Normal3i( GLint nx, GLint ny, GLint nz ) +{ + NORMAL( INT_TO_FLOAT(nx), INT_TO_FLOAT(ny), INT_TO_FLOAT(nz) ); +} + +static void GLAPIENTRY +loopback_Normal3s( GLshort nx, GLshort ny, GLshort nz ) +{ + NORMAL( SHORT_TO_FLOAT(nx), SHORT_TO_FLOAT(ny), SHORT_TO_FLOAT(nz) ); +} + +static void GLAPIENTRY +loopback_Normal3bv( const GLbyte *v ) +{ + NORMAL( BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), BYTE_TO_FLOAT(v[2]) ); +} + +static void GLAPIENTRY +loopback_Normal3dv( const GLdouble *v ) +{ + NORMAL( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); +} + +static void GLAPIENTRY +loopback_Normal3iv( const GLint *v ) +{ + NORMAL( INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), INT_TO_FLOAT(v[2]) ); +} + +static void GLAPIENTRY +loopback_Normal3sv( const GLshort *v ) +{ + NORMAL( SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), SHORT_TO_FLOAT(v[2]) ); +} + +static void GLAPIENTRY +loopback_TexCoord1d( GLdouble s ) +{ + TEXCOORD1((GLfloat) s); +} + +static void GLAPIENTRY +loopback_TexCoord1i( GLint s ) +{ + TEXCOORD1((GLfloat) s); +} + +static void GLAPIENTRY +loopback_TexCoord1s( GLshort s ) +{ + TEXCOORD1((GLfloat) s); +} + +static void GLAPIENTRY +loopback_TexCoord2d( GLdouble s, GLdouble t ) +{ + TEXCOORD2((GLfloat) s,(GLfloat) t); +} + +static void GLAPIENTRY +loopback_TexCoord2s( GLshort s, GLshort t ) +{ + TEXCOORD2((GLfloat) s,(GLfloat) t); +} + +static void GLAPIENTRY +loopback_TexCoord2i( GLint s, GLint t ) +{ + TEXCOORD2((GLfloat) s,(GLfloat) t); +} + +static void GLAPIENTRY +loopback_TexCoord3d( GLdouble s, GLdouble t, GLdouble r ) +{ + TEXCOORD3((GLfloat) s,(GLfloat) t,(GLfloat) r); +} + +static void GLAPIENTRY +loopback_TexCoord3i( GLint s, GLint t, GLint r ) +{ + TEXCOORD3((GLfloat) s,(GLfloat) t,(GLfloat) r); +} + +static void GLAPIENTRY +loopback_TexCoord3s( GLshort s, GLshort t, GLshort r ) +{ + TEXCOORD3((GLfloat) s,(GLfloat) t,(GLfloat) r); +} + +static void GLAPIENTRY +loopback_TexCoord4d( GLdouble s, GLdouble t, GLdouble r, GLdouble q ) +{ + TEXCOORD4((GLfloat) s,(GLfloat) t,(GLfloat) r,(GLfloat) q); +} + +static void GLAPIENTRY +loopback_TexCoord4i( GLint s, GLint t, GLint r, GLint q ) +{ + TEXCOORD4((GLfloat) s,(GLfloat) t,(GLfloat) r,(GLfloat) q); +} + +static void GLAPIENTRY +loopback_TexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q ) +{ + TEXCOORD4((GLfloat) s,(GLfloat) t,(GLfloat) r,(GLfloat) q); +} + +static void GLAPIENTRY +loopback_TexCoord1dv( const GLdouble *v ) +{ + TEXCOORD1((GLfloat) v[0]); +} + +static void GLAPIENTRY +loopback_TexCoord1iv( const GLint *v ) +{ + TEXCOORD1((GLfloat) v[0]); +} + +static void GLAPIENTRY +loopback_TexCoord1sv( const GLshort *v ) +{ + TEXCOORD1((GLfloat) v[0]); +} + +static void GLAPIENTRY +loopback_TexCoord2dv( const GLdouble *v ) +{ + TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]); +} + +static void GLAPIENTRY +loopback_TexCoord2iv( const GLint *v ) +{ + TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]); +} + +static void GLAPIENTRY +loopback_TexCoord2sv( const GLshort *v ) +{ + TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]); +} + +static void GLAPIENTRY +loopback_TexCoord3dv( const GLdouble *v ) +{ + TEXCOORD3((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2]); +} + +static void GLAPIENTRY +loopback_TexCoord3iv( const GLint *v ) +{ + TEXCOORD3((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2]); +} + +static void GLAPIENTRY +loopback_TexCoord3sv( const GLshort *v ) +{ + TEXCOORD3((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2]); +} + +static void GLAPIENTRY +loopback_TexCoord4dv( const GLdouble *v ) +{ + TEXCOORD4((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2],(GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_TexCoord4iv( const GLint *v ) +{ + TEXCOORD4((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2],(GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_TexCoord4sv( const GLshort *v ) +{ + TEXCOORD4((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2],(GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_Vertex2d( GLdouble x, GLdouble y ) +{ + VERTEX2( (GLfloat) x, (GLfloat) y ); +} + +static void GLAPIENTRY +loopback_Vertex2i( GLint x, GLint y ) +{ + VERTEX2( (GLfloat) x, (GLfloat) y ); +} + +static void GLAPIENTRY +loopback_Vertex2s( GLshort x, GLshort y ) +{ + VERTEX2( (GLfloat) x, (GLfloat) y ); +} + +static void GLAPIENTRY +loopback_Vertex3d( GLdouble x, GLdouble y, GLdouble z ) +{ + VERTEX3( (GLfloat) x, (GLfloat) y, (GLfloat) z ); +} + +static void GLAPIENTRY +loopback_Vertex3i( GLint x, GLint y, GLint z ) +{ + VERTEX3( (GLfloat) x, (GLfloat) y, (GLfloat) z ); +} + +static void GLAPIENTRY +loopback_Vertex3s( GLshort x, GLshort y, GLshort z ) +{ + VERTEX3( (GLfloat) x, (GLfloat) y, (GLfloat) z ); +} + +static void GLAPIENTRY +loopback_Vertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w ) +{ + VERTEX4( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w ); +} + +static void GLAPIENTRY +loopback_Vertex4i( GLint x, GLint y, GLint z, GLint w ) +{ + VERTEX4( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w ); +} + +static void GLAPIENTRY +loopback_Vertex4s( GLshort x, GLshort y, GLshort z, GLshort w ) +{ + VERTEX4( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w ); +} + +static void GLAPIENTRY +loopback_Vertex2dv( const GLdouble *v ) +{ + VERTEX2( (GLfloat) v[0], (GLfloat) v[1] ); +} + +static void GLAPIENTRY +loopback_Vertex2iv( const GLint *v ) +{ + VERTEX2( (GLfloat) v[0], (GLfloat) v[1] ); +} + +static void GLAPIENTRY +loopback_Vertex2sv( const GLshort *v ) +{ + VERTEX2( (GLfloat) v[0], (GLfloat) v[1] ); +} + +static void GLAPIENTRY +loopback_Vertex3dv( const GLdouble *v ) +{ + VERTEX3( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); +} + +static void GLAPIENTRY +loopback_Vertex3iv( const GLint *v ) +{ + VERTEX3( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); +} + +static void GLAPIENTRY +loopback_Vertex3sv( const GLshort *v ) +{ + VERTEX3( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); +} + +static void GLAPIENTRY +loopback_Vertex4dv( const GLdouble *v ) +{ + VERTEX4( (GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3] ); +} + +static void GLAPIENTRY +loopback_Vertex4iv( const GLint *v ) +{ + VERTEX4( (GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3] ); +} + +static void GLAPIENTRY +loopback_Vertex4sv( const GLshort *v ) +{ + VERTEX4( (GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord1dARB(GLenum target, GLdouble s) +{ + MULTI_TEXCOORD1( target, (GLfloat) s ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord1dvARB(GLenum target, const GLdouble *v) +{ + MULTI_TEXCOORD1( target, (GLfloat) v[0] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord1iARB(GLenum target, GLint s) +{ + MULTI_TEXCOORD1( target, (GLfloat) s ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord1ivARB(GLenum target, const GLint *v) +{ + MULTI_TEXCOORD1( target, (GLfloat) v[0] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord1sARB(GLenum target, GLshort s) +{ + MULTI_TEXCOORD1( target, (GLfloat) s ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord1svARB(GLenum target, const GLshort *v) +{ + MULTI_TEXCOORD1( target, (GLfloat) v[0] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t) +{ + MULTI_TEXCOORD2( target, (GLfloat) s, (GLfloat) t ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord2dvARB(GLenum target, const GLdouble *v) +{ + MULTI_TEXCOORD2( target, (GLfloat) v[0], (GLfloat) v[1] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord2iARB(GLenum target, GLint s, GLint t) +{ + MULTI_TEXCOORD2( target, (GLfloat) s, (GLfloat) t ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord2ivARB(GLenum target, const GLint *v) +{ + MULTI_TEXCOORD2( target, (GLfloat) v[0], (GLfloat) v[1] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord2sARB(GLenum target, GLshort s, GLshort t) +{ + MULTI_TEXCOORD2( target, (GLfloat) s, (GLfloat) t ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord2svARB(GLenum target, const GLshort *v) +{ + MULTI_TEXCOORD2( target, (GLfloat) v[0], (GLfloat) v[1] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r) +{ + MULTI_TEXCOORD3( target, (GLfloat) s, (GLfloat) t, (GLfloat) r ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord3dvARB(GLenum target, const GLdouble *v) +{ + MULTI_TEXCOORD3( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r) +{ + MULTI_TEXCOORD3( target, (GLfloat) s, (GLfloat) t, (GLfloat) r ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord3ivARB(GLenum target, const GLint *v) +{ + MULTI_TEXCOORD3( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r) +{ + MULTI_TEXCOORD3( target, (GLfloat) s, (GLfloat) t, (GLfloat) r ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord3svARB(GLenum target, const GLshort *v) +{ + MULTI_TEXCOORD3( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) +{ + MULTI_TEXCOORD4( target, (GLfloat) s, (GLfloat) t, + (GLfloat) r, (GLfloat) q ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord4dvARB(GLenum target, const GLdouble *v) +{ + MULTI_TEXCOORD4( target, (GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q) +{ + MULTI_TEXCOORD4( target, (GLfloat) s, (GLfloat) t, + (GLfloat) r, (GLfloat) q ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord4ivARB(GLenum target, const GLint *v) +{ + MULTI_TEXCOORD4( target, (GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) +{ + MULTI_TEXCOORD4( target, (GLfloat) s, (GLfloat) t, + (GLfloat) r, (GLfloat) q ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord4svARB(GLenum target, const GLshort *v) +{ + MULTI_TEXCOORD4( target, (GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3] ); +} + +static void GLAPIENTRY +loopback_EvalCoord2dv( const GLdouble *u ) +{ + EVALCOORD2( (GLfloat) u[0], (GLfloat) u[1] ); +} + +static void GLAPIENTRY +loopback_EvalCoord2fv( const GLfloat *u ) +{ + EVALCOORD2( u[0], u[1] ); +} + +static void GLAPIENTRY +loopback_EvalCoord2d( GLdouble u, GLdouble v ) +{ + EVALCOORD2( (GLfloat) u, (GLfloat) v ); +} + +static void GLAPIENTRY +loopback_EvalCoord1dv( const GLdouble *u ) +{ + EVALCOORD1( (GLfloat) *u ); +} + +static void GLAPIENTRY +loopback_EvalCoord1fv( const GLfloat *u ) +{ + EVALCOORD1( (GLfloat) *u ); +} + +static void GLAPIENTRY +loopback_EvalCoord1d( GLdouble u ) +{ + EVALCOORD1( (GLfloat) u ); +} + +static void GLAPIENTRY +loopback_Materialf( GLenum face, GLenum pname, GLfloat param ) +{ + GLfloat fparam[4]; + fparam[0] = param; + MATERIALFV( face, pname, fparam ); +} + +static void GLAPIENTRY +loopback_Materiali(GLenum face, GLenum pname, GLint param ) +{ + GLfloat p = (GLfloat) param; + MATERIALFV(face, pname, &p); +} + +static void GLAPIENTRY +loopback_Materialiv(GLenum face, GLenum pname, const GLint *params ) +{ + GLfloat fparam[4]; + switch (pname) { + case GL_AMBIENT: + case GL_DIFFUSE: + case GL_SPECULAR: + case GL_EMISSION: + case GL_AMBIENT_AND_DIFFUSE: + fparam[0] = INT_TO_FLOAT( params[0] ); + fparam[1] = INT_TO_FLOAT( params[1] ); + fparam[2] = INT_TO_FLOAT( params[2] ); + fparam[3] = INT_TO_FLOAT( params[3] ); + break; + case GL_SHININESS: + fparam[0] = (GLfloat) params[0]; + break; + case GL_COLOR_INDEXES: + fparam[0] = (GLfloat) params[0]; + fparam[1] = (GLfloat) params[1]; + fparam[2] = (GLfloat) params[2]; + break; + default: + ; + } + MATERIALFV(face, pname, fparam); +} + + +static void GLAPIENTRY +loopback_Rectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2) +{ + RECTF((GLfloat) x1, (GLfloat) y1, (GLfloat) x2, (GLfloat) y2); +} + +static void GLAPIENTRY +loopback_Rectdv(const GLdouble *v1, const GLdouble *v2) +{ + RECTF((GLfloat) v1[0], (GLfloat) v1[1], (GLfloat) v2[0], (GLfloat) v2[1]); +} + +static void GLAPIENTRY +loopback_Rectfv(const GLfloat *v1, const GLfloat *v2) +{ + RECTF(v1[0], v1[1], v2[0], v2[1]); +} + +static void GLAPIENTRY +loopback_Recti(GLint x1, GLint y1, GLint x2, GLint y2) +{ + RECTF((GLfloat) x1, (GLfloat) y1, (GLfloat) x2, (GLfloat) y2); +} + +static void GLAPIENTRY +loopback_Rectiv(const GLint *v1, const GLint *v2) +{ + RECTF((GLfloat) v1[0], (GLfloat) v1[1], (GLfloat) v2[0], (GLfloat) v2[1]); +} + +static void GLAPIENTRY +loopback_Rects(GLshort x1, GLshort y1, GLshort x2, GLshort y2) +{ + RECTF((GLfloat) x1, (GLfloat) y1, (GLfloat) x2, (GLfloat) y2); +} + +static void GLAPIENTRY +loopback_Rectsv(const GLshort *v1, const GLshort *v2) +{ + RECTF((GLfloat) v1[0], (GLfloat) v1[1], (GLfloat) v2[0], (GLfloat) v2[1]); +} + +static void GLAPIENTRY +loopback_SecondaryColor3bEXT_f( GLbyte red, GLbyte green, GLbyte blue ) +{ + SECONDARYCOLORF( BYTE_TO_FLOAT(red), + BYTE_TO_FLOAT(green), + BYTE_TO_FLOAT(blue) ); +} + +static void GLAPIENTRY +loopback_SecondaryColor3dEXT_f( GLdouble red, GLdouble green, GLdouble blue ) +{ + SECONDARYCOLORF( (GLfloat) red, (GLfloat) green, (GLfloat) blue ); +} + +static void GLAPIENTRY +loopback_SecondaryColor3iEXT_f( GLint red, GLint green, GLint blue ) +{ + SECONDARYCOLORF( INT_TO_FLOAT(red), + INT_TO_FLOAT(green), + INT_TO_FLOAT(blue)); +} + +static void GLAPIENTRY +loopback_SecondaryColor3sEXT_f( GLshort red, GLshort green, GLshort blue ) +{ + SECONDARYCOLORF(SHORT_TO_FLOAT(red), + SHORT_TO_FLOAT(green), + SHORT_TO_FLOAT(blue)); +} + +static void GLAPIENTRY +loopback_SecondaryColor3uiEXT_f( GLuint red, GLuint green, GLuint blue ) +{ + SECONDARYCOLORF(UINT_TO_FLOAT(red), + UINT_TO_FLOAT(green), + UINT_TO_FLOAT(blue)); +} + +static void GLAPIENTRY +loopback_SecondaryColor3usEXT_f( GLushort red, GLushort green, GLushort blue ) +{ + SECONDARYCOLORF(USHORT_TO_FLOAT(red), + USHORT_TO_FLOAT(green), + USHORT_TO_FLOAT(blue)); +} + +static void GLAPIENTRY +loopback_SecondaryColor3ubEXT_f( GLubyte red, GLubyte green, GLubyte blue ) +{ + SECONDARYCOLORF(UBYTE_TO_FLOAT(red), + UBYTE_TO_FLOAT(green), + UBYTE_TO_FLOAT(blue)); +} + +static void GLAPIENTRY +loopback_SecondaryColor3bvEXT_f( const GLbyte *v ) +{ + SECONDARYCOLORF(BYTE_TO_FLOAT(v[0]), + BYTE_TO_FLOAT(v[1]), + BYTE_TO_FLOAT(v[2])); +} + +static void GLAPIENTRY +loopback_SecondaryColor3dvEXT_f( const GLdouble *v ) +{ + SECONDARYCOLORF( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); +} +static void GLAPIENTRY +loopback_SecondaryColor3ivEXT_f( const GLint *v ) +{ + SECONDARYCOLORF(INT_TO_FLOAT(v[0]), + INT_TO_FLOAT(v[1]), + INT_TO_FLOAT(v[2])); +} + +static void GLAPIENTRY +loopback_SecondaryColor3svEXT_f( const GLshort *v ) +{ + SECONDARYCOLORF(SHORT_TO_FLOAT(v[0]), + SHORT_TO_FLOAT(v[1]), + SHORT_TO_FLOAT(v[2])); +} + +static void GLAPIENTRY +loopback_SecondaryColor3uivEXT_f( const GLuint *v ) +{ + SECONDARYCOLORF(UINT_TO_FLOAT(v[0]), + UINT_TO_FLOAT(v[1]), + UINT_TO_FLOAT(v[2])); +} + +static void GLAPIENTRY +loopback_SecondaryColor3usvEXT_f( const GLushort *v ) +{ + SECONDARYCOLORF(USHORT_TO_FLOAT(v[0]), + USHORT_TO_FLOAT(v[1]), + USHORT_TO_FLOAT(v[2])); +} + +static void GLAPIENTRY +loopback_SecondaryColor3ubvEXT_f( const GLubyte *v ) +{ + SECONDARYCOLORF(UBYTE_TO_FLOAT(v[0]), + UBYTE_TO_FLOAT(v[1]), + UBYTE_TO_FLOAT(v[2])); +} + + +/* + * GL_NV_vertex_program: + * Always loop-back to one of the VertexAttrib[1234]f[v]NV functions. + * Note that attribute indexes DO alias conventional vertex attributes. + */ + +static void GLAPIENTRY +loopback_VertexAttrib1sNV(GLuint index, GLshort x) +{ + ATTRIB1NV(index, (GLfloat) x); +} + +static void GLAPIENTRY +loopback_VertexAttrib1dNV(GLuint index, GLdouble x) +{ + ATTRIB1NV(index, (GLfloat) x); +} + +static void GLAPIENTRY +loopback_VertexAttrib2sNV(GLuint index, GLshort x, GLshort y) +{ + ATTRIB2NV(index, (GLfloat) x, y); +} + +static void GLAPIENTRY +loopback_VertexAttrib2dNV(GLuint index, GLdouble x, GLdouble y) +{ + ATTRIB2NV(index, (GLfloat) x, (GLfloat) y); +} + +static void GLAPIENTRY +loopback_VertexAttrib3sNV(GLuint index, GLshort x, GLshort y, GLshort z) +{ + ATTRIB3NV(index, (GLfloat) x, (GLfloat) y, (GLfloat) z); +} + +static void GLAPIENTRY +loopback_VertexAttrib3dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z) +{ + ATTRIB4NV(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); +} + +static void GLAPIENTRY +loopback_VertexAttrib4sNV(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w) +{ + ATTRIB4NV(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + +static void GLAPIENTRY +loopback_VertexAttrib4dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + ATTRIB4NV(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + +static void GLAPIENTRY +loopback_VertexAttrib4ubNV(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w) +{ + ATTRIB4NV(index, UBYTE_TO_FLOAT(x), UBYTE_TO_FLOAT(y), + UBYTE_TO_FLOAT(z), UBYTE_TO_FLOAT(w)); +} + +static void GLAPIENTRY +loopback_VertexAttrib1svNV(GLuint index, const GLshort *v) +{ + ATTRIB1NV(index, (GLfloat) v[0]); +} + +static void GLAPIENTRY +loopback_VertexAttrib1dvNV(GLuint index, const GLdouble *v) +{ + ATTRIB1NV(index, (GLfloat) v[0]); +} + +static void GLAPIENTRY +loopback_VertexAttrib2svNV(GLuint index, const GLshort *v) +{ + ATTRIB2NV(index, (GLfloat) v[0], (GLfloat) v[1]); +} + +static void GLAPIENTRY +loopback_VertexAttrib2dvNV(GLuint index, const GLdouble *v) +{ + ATTRIB2NV(index, (GLfloat) v[0], (GLfloat) v[1]); +} + +static void GLAPIENTRY +loopback_VertexAttrib3svNV(GLuint index, const GLshort *v) +{ + ATTRIB3NV(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); +} + +static void GLAPIENTRY +loopback_VertexAttrib3dvNV(GLuint index, const GLdouble *v) +{ + ATTRIB3NV(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4svNV(GLuint index, const GLshort *v) +{ + ATTRIB4NV(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], + (GLfloat)v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4dvNV(GLuint index, const GLdouble *v) +{ + ATTRIB4NV(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4ubvNV(GLuint index, const GLubyte *v) +{ + ATTRIB4NV(index, UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), + UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3])); +} + + +static void GLAPIENTRY +loopback_VertexAttribs1svNV(GLuint index, GLsizei n, const GLshort *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib1svNV(index + i, v + i); +} + +static void GLAPIENTRY +loopback_VertexAttribs1fvNV(GLuint index, GLsizei n, const GLfloat *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + ATTRIB1NV(index + i, v[i]); +} + +static void GLAPIENTRY +loopback_VertexAttribs1dvNV(GLuint index, GLsizei n, const GLdouble *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib1dvNV(index + i, v + i); +} + +static void GLAPIENTRY +loopback_VertexAttribs2svNV(GLuint index, GLsizei n, const GLshort *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib2svNV(index + i, v + 2 * i); +} + +static void GLAPIENTRY +loopback_VertexAttribs2fvNV(GLuint index, GLsizei n, const GLfloat *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + ATTRIB2NV(index + i, v[2 * i], v[2 * i + 1]); +} + +static void GLAPIENTRY +loopback_VertexAttribs2dvNV(GLuint index, GLsizei n, const GLdouble *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib2dvNV(index + i, v + 2 * i); +} + +static void GLAPIENTRY +loopback_VertexAttribs3svNV(GLuint index, GLsizei n, const GLshort *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib3svNV(index + i, v + 3 * i); +} + +static void GLAPIENTRY +loopback_VertexAttribs3fvNV(GLuint index, GLsizei n, const GLfloat *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + ATTRIB3NV(index + i, v[3 * i], v[3 * i + 1], v[3 * i + 2]); +} + +static void GLAPIENTRY +loopback_VertexAttribs3dvNV(GLuint index, GLsizei n, const GLdouble *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib3dvNV(index + i, v + 3 * i); +} + +static void GLAPIENTRY +loopback_VertexAttribs4svNV(GLuint index, GLsizei n, const GLshort *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib4svNV(index + i, v + 4 * i); +} + +static void GLAPIENTRY +loopback_VertexAttribs4fvNV(GLuint index, GLsizei n, const GLfloat *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + ATTRIB4NV(index + i, v[4 * i], v[4 * i + 1], v[4 * i + 2], v[4 * i + 3]); +} + +static void GLAPIENTRY +loopback_VertexAttribs4dvNV(GLuint index, GLsizei n, const GLdouble *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib4dvNV(index + i, v + 4 * i); +} + +static void GLAPIENTRY +loopback_VertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib4ubvNV(index + i, v + 4 * i); +} + + +/* + * GL_ARB_vertex_program + * Always loop-back to one of the VertexAttrib[1234]f[v]ARB functions. + * Note that attribute indexes do NOT alias conventional attributes. + */ + +static void GLAPIENTRY +loopback_VertexAttrib1sARB(GLuint index, GLshort x) +{ + ATTRIB1ARB(index, (GLfloat) x); +} + +static void GLAPIENTRY +loopback_VertexAttrib1dARB(GLuint index, GLdouble x) +{ + ATTRIB1ARB(index, (GLfloat) x); +} + +static void GLAPIENTRY +loopback_VertexAttrib2sARB(GLuint index, GLshort x, GLshort y) +{ + ATTRIB2ARB(index, (GLfloat) x, y); +} + +static void GLAPIENTRY +loopback_VertexAttrib2dARB(GLuint index, GLdouble x, GLdouble y) +{ + ATTRIB2ARB(index, (GLfloat) x, (GLfloat) y); +} + +static void GLAPIENTRY +loopback_VertexAttrib3sARB(GLuint index, GLshort x, GLshort y, GLshort z) +{ + ATTRIB3ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z); +} + +static void GLAPIENTRY +loopback_VertexAttrib3dARB(GLuint index, GLdouble x, GLdouble y, GLdouble z) +{ + ATTRIB4ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); +} + +static void GLAPIENTRY +loopback_VertexAttrib4sARB(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w) +{ + ATTRIB4ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + +static void GLAPIENTRY +loopback_VertexAttrib4dARB(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + ATTRIB4ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + +static void GLAPIENTRY +loopback_VertexAttrib1svARB(GLuint index, const GLshort *v) +{ + ATTRIB1ARB(index, (GLfloat) v[0]); +} + +static void GLAPIENTRY +loopback_VertexAttrib1dvARB(GLuint index, const GLdouble *v) +{ + ATTRIB1ARB(index, (GLfloat) v[0]); +} + +static void GLAPIENTRY +loopback_VertexAttrib2svARB(GLuint index, const GLshort *v) +{ + ATTRIB2ARB(index, (GLfloat) v[0], (GLfloat) v[1]); +} + +static void GLAPIENTRY +loopback_VertexAttrib2dvARB(GLuint index, const GLdouble *v) +{ + ATTRIB2ARB(index, (GLfloat) v[0], (GLfloat) v[1]); +} + +static void GLAPIENTRY +loopback_VertexAttrib3svARB(GLuint index, const GLshort *v) +{ + ATTRIB3ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); +} + +static void GLAPIENTRY +loopback_VertexAttrib3dvARB(GLuint index, const GLdouble *v) +{ + ATTRIB3ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4svARB(GLuint index, const GLshort *v) +{ + ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], + (GLfloat)v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4dvARB(GLuint index, const GLdouble *v) +{ + ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4bvARB(GLuint index, const GLbyte * v) +{ + ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4ivARB(GLuint index, const GLint * v) +{ + ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4ubvARB(GLuint index, const GLubyte * v) +{ + ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4usvARB(GLuint index, const GLushort * v) +{ + ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4uivARB(GLuint index, const GLuint * v) +{ + ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4NbvARB(GLuint index, const GLbyte * v) +{ + ATTRIB4ARB(index, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), + BYTE_TO_FLOAT(v[2]), BYTE_TO_FLOAT(v[3])); +} + +static void GLAPIENTRY +loopback_VertexAttrib4NsvARB(GLuint index, const GLshort * v) +{ + ATTRIB4ARB(index, SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), + SHORT_TO_FLOAT(v[2]), SHORT_TO_FLOAT(v[3])); +} + +static void GLAPIENTRY +loopback_VertexAttrib4NivARB(GLuint index, const GLint * v) +{ + ATTRIB4ARB(index, INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), + INT_TO_FLOAT(v[2]), INT_TO_FLOAT(v[3])); +} + +static void GLAPIENTRY +loopback_VertexAttrib4NubARB(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w) +{ + ATTRIB4ARB(index, UBYTE_TO_FLOAT(x), UBYTE_TO_FLOAT(y), + UBYTE_TO_FLOAT(z), UBYTE_TO_FLOAT(w)); +} + +static void GLAPIENTRY +loopback_VertexAttrib4NubvARB(GLuint index, const GLubyte * v) +{ + ATTRIB4ARB(index, UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), + UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3])); +} + +static void GLAPIENTRY +loopback_VertexAttrib4NusvARB(GLuint index, const GLushort * v) +{ + ATTRIB4ARB(index, USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]), + USHORT_TO_FLOAT(v[2]), USHORT_TO_FLOAT(v[3])); +} + +static void GLAPIENTRY +loopback_VertexAttrib4NuivARB(GLuint index, const GLuint * v) +{ + ATTRIB4ARB(index, UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]), + UINT_TO_FLOAT(v[2]), UINT_TO_FLOAT(v[3])); +} + + + +/** + * GL_EXT_gpu_shader / GL 3.0 signed/unsigned integer-valued attributes. + * Note that attribute indexes do NOT alias conventional attributes. + */ + +static void GLAPIENTRY +loopback_VertexAttribI1iv(GLuint index, const GLint *v) +{ + ATTRIBI_1I(index, v[0]); +} + +static void GLAPIENTRY +loopback_VertexAttribI1uiv(GLuint index, const GLuint *v) +{ + ATTRIBI_1UI(index, v[0]); +} + +static void GLAPIENTRY +loopback_VertexAttribI4bv(GLuint index, const GLbyte *v) +{ + ATTRIBI_4I(index, v[0], v[1], v[2], v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttribI4sv(GLuint index, const GLshort *v) +{ + ATTRIBI_4I(index, v[0], v[1], v[2], v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttribI4ubv(GLuint index, const GLubyte *v) +{ + ATTRIBI_4UI(index, v[0], v[1], v[2], v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttribI4usv(GLuint index, const GLushort *v) +{ + ATTRIBI_4UI(index, v[0], v[1], v[2], v[3]); +} + + + + +/* + * This code never registers handlers for any of the entry points + * listed in vtxfmt.h. + */ +void +_mesa_loopback_init_api_table( struct _glapi_table *dest ) +{ + SET_Color3b(dest, loopback_Color3b_f); + SET_Color3d(dest, loopback_Color3d_f); + SET_Color3i(dest, loopback_Color3i_f); + SET_Color3s(dest, loopback_Color3s_f); + SET_Color3ui(dest, loopback_Color3ui_f); + SET_Color3us(dest, loopback_Color3us_f); + SET_Color3ub(dest, loopback_Color3ub_f); + SET_Color4b(dest, loopback_Color4b_f); + SET_Color4d(dest, loopback_Color4d_f); + SET_Color4i(dest, loopback_Color4i_f); + SET_Color4s(dest, loopback_Color4s_f); + SET_Color4ui(dest, loopback_Color4ui_f); + SET_Color4us(dest, loopback_Color4us_f); + SET_Color4ub(dest, loopback_Color4ub_f); + SET_Color3bv(dest, loopback_Color3bv_f); + SET_Color3dv(dest, loopback_Color3dv_f); + SET_Color3iv(dest, loopback_Color3iv_f); + SET_Color3sv(dest, loopback_Color3sv_f); + SET_Color3uiv(dest, loopback_Color3uiv_f); + SET_Color3usv(dest, loopback_Color3usv_f); + SET_Color3ubv(dest, loopback_Color3ubv_f); + SET_Color4bv(dest, loopback_Color4bv_f); + SET_Color4dv(dest, loopback_Color4dv_f); + SET_Color4iv(dest, loopback_Color4iv_f); + SET_Color4sv(dest, loopback_Color4sv_f); + SET_Color4uiv(dest, loopback_Color4uiv_f); + SET_Color4usv(dest, loopback_Color4usv_f); + SET_Color4ubv(dest, loopback_Color4ubv_f); + + SET_SecondaryColor3bEXT(dest, loopback_SecondaryColor3bEXT_f); + SET_SecondaryColor3dEXT(dest, loopback_SecondaryColor3dEXT_f); + SET_SecondaryColor3iEXT(dest, loopback_SecondaryColor3iEXT_f); + SET_SecondaryColor3sEXT(dest, loopback_SecondaryColor3sEXT_f); + SET_SecondaryColor3uiEXT(dest, loopback_SecondaryColor3uiEXT_f); + SET_SecondaryColor3usEXT(dest, loopback_SecondaryColor3usEXT_f); + SET_SecondaryColor3ubEXT(dest, loopback_SecondaryColor3ubEXT_f); + SET_SecondaryColor3bvEXT(dest, loopback_SecondaryColor3bvEXT_f); + SET_SecondaryColor3dvEXT(dest, loopback_SecondaryColor3dvEXT_f); + SET_SecondaryColor3ivEXT(dest, loopback_SecondaryColor3ivEXT_f); + SET_SecondaryColor3svEXT(dest, loopback_SecondaryColor3svEXT_f); + SET_SecondaryColor3uivEXT(dest, loopback_SecondaryColor3uivEXT_f); + SET_SecondaryColor3usvEXT(dest, loopback_SecondaryColor3usvEXT_f); + SET_SecondaryColor3ubvEXT(dest, loopback_SecondaryColor3ubvEXT_f); + + SET_EdgeFlagv(dest, loopback_EdgeFlagv); + + SET_Indexd(dest, loopback_Indexd); + SET_Indexi(dest, loopback_Indexi); + SET_Indexs(dest, loopback_Indexs); + SET_Indexub(dest, loopback_Indexub); + SET_Indexdv(dest, loopback_Indexdv); + SET_Indexiv(dest, loopback_Indexiv); + SET_Indexsv(dest, loopback_Indexsv); + SET_Indexubv(dest, loopback_Indexubv); + SET_Normal3b(dest, loopback_Normal3b); + SET_Normal3d(dest, loopback_Normal3d); + SET_Normal3i(dest, loopback_Normal3i); + SET_Normal3s(dest, loopback_Normal3s); + SET_Normal3bv(dest, loopback_Normal3bv); + SET_Normal3dv(dest, loopback_Normal3dv); + SET_Normal3iv(dest, loopback_Normal3iv); + SET_Normal3sv(dest, loopback_Normal3sv); + SET_TexCoord1d(dest, loopback_TexCoord1d); + SET_TexCoord1i(dest, loopback_TexCoord1i); + SET_TexCoord1s(dest, loopback_TexCoord1s); + SET_TexCoord2d(dest, loopback_TexCoord2d); + SET_TexCoord2s(dest, loopback_TexCoord2s); + SET_TexCoord2i(dest, loopback_TexCoord2i); + SET_TexCoord3d(dest, loopback_TexCoord3d); + SET_TexCoord3i(dest, loopback_TexCoord3i); + SET_TexCoord3s(dest, loopback_TexCoord3s); + SET_TexCoord4d(dest, loopback_TexCoord4d); + SET_TexCoord4i(dest, loopback_TexCoord4i); + SET_TexCoord4s(dest, loopback_TexCoord4s); + SET_TexCoord1dv(dest, loopback_TexCoord1dv); + SET_TexCoord1iv(dest, loopback_TexCoord1iv); + SET_TexCoord1sv(dest, loopback_TexCoord1sv); + SET_TexCoord2dv(dest, loopback_TexCoord2dv); + SET_TexCoord2iv(dest, loopback_TexCoord2iv); + SET_TexCoord2sv(dest, loopback_TexCoord2sv); + SET_TexCoord3dv(dest, loopback_TexCoord3dv); + SET_TexCoord3iv(dest, loopback_TexCoord3iv); + SET_TexCoord3sv(dest, loopback_TexCoord3sv); + SET_TexCoord4dv(dest, loopback_TexCoord4dv); + SET_TexCoord4iv(dest, loopback_TexCoord4iv); + SET_TexCoord4sv(dest, loopback_TexCoord4sv); + SET_Vertex2d(dest, loopback_Vertex2d); + SET_Vertex2i(dest, loopback_Vertex2i); + SET_Vertex2s(dest, loopback_Vertex2s); + SET_Vertex3d(dest, loopback_Vertex3d); + SET_Vertex3i(dest, loopback_Vertex3i); + SET_Vertex3s(dest, loopback_Vertex3s); + SET_Vertex4d(dest, loopback_Vertex4d); + SET_Vertex4i(dest, loopback_Vertex4i); + SET_Vertex4s(dest, loopback_Vertex4s); + SET_Vertex2dv(dest, loopback_Vertex2dv); + SET_Vertex2iv(dest, loopback_Vertex2iv); + SET_Vertex2sv(dest, loopback_Vertex2sv); + SET_Vertex3dv(dest, loopback_Vertex3dv); + SET_Vertex3iv(dest, loopback_Vertex3iv); + SET_Vertex3sv(dest, loopback_Vertex3sv); + SET_Vertex4dv(dest, loopback_Vertex4dv); + SET_Vertex4iv(dest, loopback_Vertex4iv); + SET_Vertex4sv(dest, loopback_Vertex4sv); + SET_MultiTexCoord1dARB(dest, loopback_MultiTexCoord1dARB); + SET_MultiTexCoord1dvARB(dest, loopback_MultiTexCoord1dvARB); + SET_MultiTexCoord1iARB(dest, loopback_MultiTexCoord1iARB); + SET_MultiTexCoord1ivARB(dest, loopback_MultiTexCoord1ivARB); + SET_MultiTexCoord1sARB(dest, loopback_MultiTexCoord1sARB); + SET_MultiTexCoord1svARB(dest, loopback_MultiTexCoord1svARB); + SET_MultiTexCoord2dARB(dest, loopback_MultiTexCoord2dARB); + SET_MultiTexCoord2dvARB(dest, loopback_MultiTexCoord2dvARB); + SET_MultiTexCoord2iARB(dest, loopback_MultiTexCoord2iARB); + SET_MultiTexCoord2ivARB(dest, loopback_MultiTexCoord2ivARB); + SET_MultiTexCoord2sARB(dest, loopback_MultiTexCoord2sARB); + SET_MultiTexCoord2svARB(dest, loopback_MultiTexCoord2svARB); + SET_MultiTexCoord3dARB(dest, loopback_MultiTexCoord3dARB); + SET_MultiTexCoord3dvARB(dest, loopback_MultiTexCoord3dvARB); + SET_MultiTexCoord3iARB(dest, loopback_MultiTexCoord3iARB); + SET_MultiTexCoord3ivARB(dest, loopback_MultiTexCoord3ivARB); + SET_MultiTexCoord3sARB(dest, loopback_MultiTexCoord3sARB); + SET_MultiTexCoord3svARB(dest, loopback_MultiTexCoord3svARB); + SET_MultiTexCoord4dARB(dest, loopback_MultiTexCoord4dARB); + SET_MultiTexCoord4dvARB(dest, loopback_MultiTexCoord4dvARB); + SET_MultiTexCoord4iARB(dest, loopback_MultiTexCoord4iARB); + SET_MultiTexCoord4ivARB(dest, loopback_MultiTexCoord4ivARB); + SET_MultiTexCoord4sARB(dest, loopback_MultiTexCoord4sARB); + SET_MultiTexCoord4svARB(dest, loopback_MultiTexCoord4svARB); + SET_EvalCoord2dv(dest, loopback_EvalCoord2dv); + SET_EvalCoord2fv(dest, loopback_EvalCoord2fv); + SET_EvalCoord2d(dest, loopback_EvalCoord2d); + SET_EvalCoord1dv(dest, loopback_EvalCoord1dv); + SET_EvalCoord1fv(dest, loopback_EvalCoord1fv); + SET_EvalCoord1d(dest, loopback_EvalCoord1d); + SET_Materialf(dest, loopback_Materialf); + SET_Materiali(dest, loopback_Materiali); + SET_Materialiv(dest, loopback_Materialiv); + SET_Rectd(dest, loopback_Rectd); + SET_Rectdv(dest, loopback_Rectdv); + SET_Rectfv(dest, loopback_Rectfv); + SET_Recti(dest, loopback_Recti); + SET_Rectiv(dest, loopback_Rectiv); + SET_Rects(dest, loopback_Rects); + SET_Rectsv(dest, loopback_Rectsv); + SET_FogCoorddEXT(dest, loopback_FogCoorddEXT); + SET_FogCoorddvEXT(dest, loopback_FogCoorddvEXT); + + SET_VertexAttrib1sNV(dest, loopback_VertexAttrib1sNV); + SET_VertexAttrib1dNV(dest, loopback_VertexAttrib1dNV); + SET_VertexAttrib2sNV(dest, loopback_VertexAttrib2sNV); + SET_VertexAttrib2dNV(dest, loopback_VertexAttrib2dNV); + SET_VertexAttrib3sNV(dest, loopback_VertexAttrib3sNV); + SET_VertexAttrib3dNV(dest, loopback_VertexAttrib3dNV); + SET_VertexAttrib4sNV(dest, loopback_VertexAttrib4sNV); + SET_VertexAttrib4dNV(dest, loopback_VertexAttrib4dNV); + SET_VertexAttrib4ubNV(dest, loopback_VertexAttrib4ubNV); + SET_VertexAttrib1svNV(dest, loopback_VertexAttrib1svNV); + SET_VertexAttrib1dvNV(dest, loopback_VertexAttrib1dvNV); + SET_VertexAttrib2svNV(dest, loopback_VertexAttrib2svNV); + SET_VertexAttrib2dvNV(dest, loopback_VertexAttrib2dvNV); + SET_VertexAttrib3svNV(dest, loopback_VertexAttrib3svNV); + SET_VertexAttrib3dvNV(dest, loopback_VertexAttrib3dvNV); + SET_VertexAttrib4svNV(dest, loopback_VertexAttrib4svNV); + SET_VertexAttrib4dvNV(dest, loopback_VertexAttrib4dvNV); + SET_VertexAttrib4ubvNV(dest, loopback_VertexAttrib4ubvNV); + SET_VertexAttribs1svNV(dest, loopback_VertexAttribs1svNV); + SET_VertexAttribs1fvNV(dest, loopback_VertexAttribs1fvNV); + SET_VertexAttribs1dvNV(dest, loopback_VertexAttribs1dvNV); + SET_VertexAttribs2svNV(dest, loopback_VertexAttribs2svNV); + SET_VertexAttribs2fvNV(dest, loopback_VertexAttribs2fvNV); + SET_VertexAttribs2dvNV(dest, loopback_VertexAttribs2dvNV); + SET_VertexAttribs3svNV(dest, loopback_VertexAttribs3svNV); + SET_VertexAttribs3fvNV(dest, loopback_VertexAttribs3fvNV); + SET_VertexAttribs3dvNV(dest, loopback_VertexAttribs3dvNV); + SET_VertexAttribs4svNV(dest, loopback_VertexAttribs4svNV); + SET_VertexAttribs4fvNV(dest, loopback_VertexAttribs4fvNV); + SET_VertexAttribs4dvNV(dest, loopback_VertexAttribs4dvNV); + SET_VertexAttribs4ubvNV(dest, loopback_VertexAttribs4ubvNV); + + SET_VertexAttrib1sARB(dest, loopback_VertexAttrib1sARB); + SET_VertexAttrib1dARB(dest, loopback_VertexAttrib1dARB); + SET_VertexAttrib2sARB(dest, loopback_VertexAttrib2sARB); + SET_VertexAttrib2dARB(dest, loopback_VertexAttrib2dARB); + SET_VertexAttrib3sARB(dest, loopback_VertexAttrib3sARB); + SET_VertexAttrib3dARB(dest, loopback_VertexAttrib3dARB); + SET_VertexAttrib4sARB(dest, loopback_VertexAttrib4sARB); + SET_VertexAttrib4dARB(dest, loopback_VertexAttrib4dARB); + SET_VertexAttrib1svARB(dest, loopback_VertexAttrib1svARB); + SET_VertexAttrib1dvARB(dest, loopback_VertexAttrib1dvARB); + SET_VertexAttrib2svARB(dest, loopback_VertexAttrib2svARB); + SET_VertexAttrib2dvARB(dest, loopback_VertexAttrib2dvARB); + SET_VertexAttrib3svARB(dest, loopback_VertexAttrib3svARB); + SET_VertexAttrib3dvARB(dest, loopback_VertexAttrib3dvARB); + SET_VertexAttrib4svARB(dest, loopback_VertexAttrib4svARB); + SET_VertexAttrib4dvARB(dest, loopback_VertexAttrib4dvARB); + SET_VertexAttrib4NubARB(dest, loopback_VertexAttrib4NubARB); + SET_VertexAttrib4NubvARB(dest, loopback_VertexAttrib4NubvARB); + SET_VertexAttrib4bvARB(dest, loopback_VertexAttrib4bvARB); + SET_VertexAttrib4ivARB(dest, loopback_VertexAttrib4ivARB); + SET_VertexAttrib4ubvARB(dest, loopback_VertexAttrib4ubvARB); + SET_VertexAttrib4usvARB(dest, loopback_VertexAttrib4usvARB); + SET_VertexAttrib4uivARB(dest, loopback_VertexAttrib4uivARB); + SET_VertexAttrib4NbvARB(dest, loopback_VertexAttrib4NbvARB); + SET_VertexAttrib4NsvARB(dest, loopback_VertexAttrib4NsvARB); + SET_VertexAttrib4NivARB(dest, loopback_VertexAttrib4NivARB); + SET_VertexAttrib4NusvARB(dest, loopback_VertexAttrib4NusvARB); + SET_VertexAttrib4NuivARB(dest, loopback_VertexAttrib4NuivARB); + + /* GL_EXT_gpu_shader4, GL 3.0 */ + SET_VertexAttribI1ivEXT(dest, loopback_VertexAttribI1iv); + SET_VertexAttribI1uivEXT(dest, loopback_VertexAttribI1uiv); + SET_VertexAttribI4bvEXT(dest, loopback_VertexAttribI4bv); + SET_VertexAttribI4svEXT(dest, loopback_VertexAttribI4sv); + SET_VertexAttribI4ubvEXT(dest, loopback_VertexAttribI4ubv); + SET_VertexAttribI4usvEXT(dest, loopback_VertexAttribI4usv); +} + + +#endif /* FEATURE_beginend */ diff --git a/mesalib/src/mesa/main/atifragshader.c b/mesalib/src/mesa/main/atifragshader.c index ff7b042d2..c74c999f8 100644 --- a/mesalib/src/mesa/main/atifragshader.c +++ b/mesalib/src/mesa/main/atifragshader.c @@ -1,796 +1,796 @@ -/** - * \file atifragshader.c - * \author David Airlie - * Copyright (C) 2004 David Airlie All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * DAVID AIRLIE 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 "main/glheader.h" -#include "main/context.h" -#include "main/hash.h" -#include "main/imports.h" -#include "main/macros.h" -#include "main/mfeatures.h" -#include "main/enums.h" -#include "main/mtypes.h" -#include "main/dispatch.h" -#include "main/atifragshader.h" - -#if FEATURE_ATI_fragment_shader - -#define MESA_DEBUG_ATI_FS 0 - -static struct ati_fragment_shader DummyShader; - - -void -_mesa_init_ati_fragment_shader_dispatch(struct _glapi_table *disp) -{ - SET_GenFragmentShadersATI(disp, _mesa_GenFragmentShadersATI); - SET_BindFragmentShaderATI(disp, _mesa_BindFragmentShaderATI); - SET_DeleteFragmentShaderATI(disp, _mesa_DeleteFragmentShaderATI); - SET_BeginFragmentShaderATI(disp, _mesa_BeginFragmentShaderATI); - SET_EndFragmentShaderATI(disp, _mesa_EndFragmentShaderATI); - SET_PassTexCoordATI(disp, _mesa_PassTexCoordATI); - SET_SampleMapATI(disp, _mesa_SampleMapATI); - SET_ColorFragmentOp1ATI(disp, _mesa_ColorFragmentOp1ATI); - SET_ColorFragmentOp2ATI(disp, _mesa_ColorFragmentOp2ATI); - SET_ColorFragmentOp3ATI(disp, _mesa_ColorFragmentOp3ATI); - SET_AlphaFragmentOp1ATI(disp, _mesa_AlphaFragmentOp1ATI); - SET_AlphaFragmentOp2ATI(disp, _mesa_AlphaFragmentOp2ATI); - SET_AlphaFragmentOp3ATI(disp, _mesa_AlphaFragmentOp3ATI); - SET_SetFragmentShaderConstantATI(disp, _mesa_SetFragmentShaderConstantATI); -} - - -/** - * Allocate and initialize a new ATI fragment shader object. - */ -struct ati_fragment_shader * -_mesa_new_ati_fragment_shader(struct gl_context *ctx, GLuint id) -{ - struct ati_fragment_shader *s = CALLOC_STRUCT(ati_fragment_shader); - (void) ctx; - if (s) { - s->Id = id; - s->RefCount = 1; - } - return s; -} - - -/** - * Delete the given ati fragment shader - */ -void -_mesa_delete_ati_fragment_shader(struct gl_context *ctx, struct ati_fragment_shader *s) -{ - GLuint i; - for (i = 0; i < MAX_NUM_PASSES_ATI; i++) { - if (s->Instructions[i]) - free(s->Instructions[i]); - if (s->SetupInst[i]) - free(s->SetupInst[i]); - } - free(s); -} - - - -static void -new_arith_inst(struct ati_fragment_shader *prog) -{ -/* set "default" instruction as not all may get defined. - there is no specified way to express a nop with ati fragment shaders we use - GL_NONE as the op enum and just set some params to 0 - so nothing to do here */ - prog->numArithInstr[prog->cur_pass >> 1]++; -} - -static void -new_tex_inst(struct ati_fragment_shader *prog) -{ -} - -static void match_pair_inst(struct ati_fragment_shader *curProg, GLuint optype) -{ - if (optype == curProg->last_optype) { - curProg->last_optype = 1; - } -} - -#if MESA_DEBUG_ATI_FS -static char * -create_dst_mod_str(GLuint mod) -{ - static char ret_str[1024]; - - memset(ret_str, 0, 1024); - if (mod & GL_2X_BIT_ATI) - strncat(ret_str, "|2X", 1024); - - if (mod & GL_4X_BIT_ATI) - strncat(ret_str, "|4X", 1024); - - if (mod & GL_8X_BIT_ATI) - strncat(ret_str, "|8X", 1024); - if (mod & GL_HALF_BIT_ATI) - strncat(ret_str, "|HA", 1024); - if (mod & GL_QUARTER_BIT_ATI) - strncat(ret_str, "|QU", 1024); - if (mod & GL_EIGHTH_BIT_ATI) - strncat(ret_str, "|EI", 1024); - - if (mod & GL_SATURATE_BIT_ATI) - strncat(ret_str, "|SAT", 1024); - - if (strlen(ret_str) == 0) - strncat(ret_str, "NONE", 1024); - return ret_str; -} - -static char *atifs_ops[] = {"ColorFragmentOp1ATI", "ColorFragmentOp2ATI", "ColorFragmentOp3ATI", - "AlphaFragmentOp1ATI", "AlphaFragmentOp2ATI", "AlphaFragmentOp3ATI" }; - -static void debug_op(GLint optype, GLuint arg_count, GLenum op, GLuint dst, - GLuint dstMask, GLuint dstMod, GLuint arg1, - GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, - GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, - GLuint arg3Rep, GLuint arg3Mod) -{ - char *op_name; - - op_name = atifs_ops[(arg_count-1)+(optype?3:0)]; - - fprintf(stderr, "%s(%s, %s", op_name, _mesa_lookup_enum_by_nr(op), - _mesa_lookup_enum_by_nr(dst)); - if (!optype) - fprintf(stderr, ", %d", dstMask); - - fprintf(stderr, ", %s", create_dst_mod_str(dstMod)); - - fprintf(stderr, ", %s, %s, %d", _mesa_lookup_enum_by_nr(arg1), - _mesa_lookup_enum_by_nr(arg1Rep), arg1Mod); - if (arg_count>1) - fprintf(stderr, ", %s, %s, %d", _mesa_lookup_enum_by_nr(arg2), - _mesa_lookup_enum_by_nr(arg2Rep), arg2Mod); - if (arg_count>2) - fprintf(stderr, ", %s, %s, %d", _mesa_lookup_enum_by_nr(arg3), - _mesa_lookup_enum_by_nr(arg3Rep), arg3Mod); - - fprintf(stderr,")\n"); - -} -#endif - -static int check_arith_arg(struct ati_fragment_shader *curProg, - GLuint optype, GLuint arg, GLuint argRep) -{ - GET_CURRENT_CONTEXT(ctx); - - if (((arg < GL_CON_0_ATI) || (arg > GL_CON_7_ATI)) && - ((arg < GL_REG_0_ATI) || (arg > GL_REG_5_ATI)) && - (arg != GL_ZERO) && (arg != GL_ONE) && - (arg != GL_PRIMARY_COLOR_ARB) && (arg != GL_SECONDARY_INTERPOLATOR_ATI)) { - _mesa_error(ctx, GL_INVALID_ENUM, "C/AFragmentOpATI(arg)"); - return 0; - } - if ((arg == GL_SECONDARY_INTERPOLATOR_ATI) && (((optype == 0) && (argRep == GL_ALPHA)) || - ((optype == 1) && ((arg == GL_ALPHA) || (argRep == GL_NONE))))) { - _mesa_error(ctx, GL_INVALID_OPERATION, "C/AFragmentOpATI(sec_interp)"); - return 0; - } - if ((arg == GL_SECONDARY_INTERPOLATOR_ATI) && (((optype == 0) && (argRep == GL_ALPHA)) || - ((optype == 1) && ((arg == GL_ALPHA) || (argRep == GL_NONE))))) { - _mesa_error(ctx, GL_INVALID_OPERATION, "C/AFragmentOpATI(sec_interp)"); - return 0; - } - if ((curProg->cur_pass == 1) && - ((arg == GL_PRIMARY_COLOR_ARB) || (arg == GL_SECONDARY_INTERPOLATOR_ATI))) { - curProg->interpinp1 = GL_TRUE; - } - return 1; -} - -GLuint GLAPIENTRY -_mesa_GenFragmentShadersATI(GLuint range) -{ - GLuint first; - GLuint i; - GET_CURRENT_CONTEXT(ctx); - - if (range == 0) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGenFragmentShadersATI(range)"); - return 0; - } - - if (ctx->ATIFragmentShader.Compiling) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGenFragmentShadersATI(insideShader)"); - return 0; - } - - first = _mesa_HashFindFreeKeyBlock(ctx->Shared->ATIShaders, range); - for (i = 0; i < range; i++) { - _mesa_HashInsert(ctx->Shared->ATIShaders, first + i, &DummyShader); - } - - return first; -} - -void GLAPIENTRY -_mesa_BindFragmentShaderATI(GLuint id) -{ - GET_CURRENT_CONTEXT(ctx); - struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; - struct ati_fragment_shader *newProg; - - if (ctx->ATIFragmentShader.Compiling) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glBindFragmentShaderATI(insideShader)"); - return; - } - - FLUSH_VERTICES(ctx, _NEW_PROGRAM); - - if (curProg->Id == id) { - return; - } - - /* unbind current */ - if (curProg->Id != 0) { - curProg->RefCount--; - if (curProg->RefCount <= 0) { - _mesa_HashRemove(ctx->Shared->ATIShaders, id); - } - } - - /* find new shader */ - if (id == 0) { - newProg = ctx->Shared->DefaultFragmentShader; - } - else { - newProg = (struct ati_fragment_shader *) - _mesa_HashLookup(ctx->Shared->ATIShaders, id); - if (!newProg || newProg == &DummyShader) { - /* allocate a new program now */ - newProg = _mesa_new_ati_fragment_shader(ctx, id); - if (!newProg) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindFragmentShaderATI"); - return; - } - _mesa_HashInsert(ctx->Shared->ATIShaders, id, newProg); - } - - } - - /* do actual bind */ - ctx->ATIFragmentShader.Current = newProg; - - ASSERT(ctx->ATIFragmentShader.Current); - if (newProg) - newProg->RefCount++; - - /*if (ctx->Driver.BindProgram) - ctx->Driver.BindProgram(ctx, target, prog); */ -} - -void GLAPIENTRY -_mesa_DeleteFragmentShaderATI(GLuint id) -{ - GET_CURRENT_CONTEXT(ctx); - - if (ctx->ATIFragmentShader.Compiling) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glDeleteFragmentShaderATI(insideShader)"); - return; - } - - if (id != 0) { - struct ati_fragment_shader *prog = (struct ati_fragment_shader *) - _mesa_HashLookup(ctx->Shared->ATIShaders, id); - if (prog == &DummyShader) { - _mesa_HashRemove(ctx->Shared->ATIShaders, id); - } - else if (prog) { - if (ctx->ATIFragmentShader.Current && - ctx->ATIFragmentShader.Current->Id == id) { - FLUSH_VERTICES(ctx, _NEW_PROGRAM); - _mesa_BindFragmentShaderATI(0); - } - } - - /* The ID is immediately available for re-use now */ - _mesa_HashRemove(ctx->Shared->ATIShaders, id); - if (prog) { - prog->RefCount--; - if (prog->RefCount <= 0) { - assert(prog != &DummyShader); - free(prog); - } - } - } -} - - -void GLAPIENTRY -_mesa_BeginFragmentShaderATI(void) -{ - GLint i; - GET_CURRENT_CONTEXT(ctx); - - if (ctx->ATIFragmentShader.Compiling) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginFragmentShaderATI(insideShader)"); - return; - } - - FLUSH_VERTICES(ctx, _NEW_PROGRAM); - - /* if the shader was already defined free instructions and get new ones - (or, could use the same mem but would need to reinitialize) */ - /* no idea if it's allowed to redefine a shader */ - for (i = 0; i < MAX_NUM_PASSES_ATI; i++) { - if (ctx->ATIFragmentShader.Current->Instructions[i]) - free(ctx->ATIFragmentShader.Current->Instructions[i]); - if (ctx->ATIFragmentShader.Current->SetupInst[i]) - free(ctx->ATIFragmentShader.Current->SetupInst[i]); - } - - /* malloc the instructions here - not sure if the best place but its - a start */ - for (i = 0; i < MAX_NUM_PASSES_ATI; i++) { - ctx->ATIFragmentShader.Current->Instructions[i] = - (struct atifs_instruction *) - calloc(1, sizeof(struct atifs_instruction) * - (MAX_NUM_INSTRUCTIONS_PER_PASS_ATI)); - ctx->ATIFragmentShader.Current->SetupInst[i] = - (struct atifs_setupinst *) - calloc(1, sizeof(struct atifs_setupinst) * - (MAX_NUM_FRAGMENT_REGISTERS_ATI)); - } - -/* can't rely on calloc for initialization as it's possible to redefine a shader (?) */ - ctx->ATIFragmentShader.Current->LocalConstDef = 0; - ctx->ATIFragmentShader.Current->numArithInstr[0] = 0; - ctx->ATIFragmentShader.Current->numArithInstr[1] = 0; - ctx->ATIFragmentShader.Current->regsAssigned[0] = 0; - ctx->ATIFragmentShader.Current->regsAssigned[1] = 0; - ctx->ATIFragmentShader.Current->NumPasses = 0; - ctx->ATIFragmentShader.Current->cur_pass = 0; - ctx->ATIFragmentShader.Current->last_optype = 0; - ctx->ATIFragmentShader.Current->interpinp1 = GL_FALSE; - ctx->ATIFragmentShader.Current->isValid = GL_FALSE; - ctx->ATIFragmentShader.Current->swizzlerq = 0; - ctx->ATIFragmentShader.Compiling = 1; -} - -void GLAPIENTRY -_mesa_EndFragmentShaderATI(void) -{ - GET_CURRENT_CONTEXT(ctx); - struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; -#if MESA_DEBUG_ATI_FS - GLint i, j; -#endif - - if (!ctx->ATIFragmentShader.Compiling) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glEndFragmentShaderATI(outsideShader)"); - return; - } - if (curProg->interpinp1 && (ctx->ATIFragmentShader.Current->cur_pass > 1)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glEndFragmentShaderATI(interpinfirstpass)"); - /* according to spec, DON'T return here */ - } - - match_pair_inst(curProg, 0); - ctx->ATIFragmentShader.Compiling = 0; - ctx->ATIFragmentShader.Current->isValid = GL_TRUE; - if ((ctx->ATIFragmentShader.Current->cur_pass == 0) || - (ctx->ATIFragmentShader.Current->cur_pass == 2)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glEndFragmentShaderATI(noarithinst)"); - } - if (ctx->ATIFragmentShader.Current->cur_pass > 1) - ctx->ATIFragmentShader.Current->NumPasses = 2; - else - ctx->ATIFragmentShader.Current->NumPasses = 1; - - ctx->ATIFragmentShader.Current->cur_pass = 0; - -#if MESA_DEBUG_ATI_FS - for (j = 0; j < MAX_NUM_PASSES_ATI; j++) { - for (i = 0; i < MAX_NUM_FRAGMENT_REGISTERS_ATI; i++) { - GLuint op = curProg->SetupInst[j][i].Opcode; - const char *op_enum = op > 5 ? _mesa_lookup_enum_by_nr(op) : "0"; - GLuint src = curProg->SetupInst[j][i].src; - GLuint swizzle = curProg->SetupInst[j][i].swizzle; - fprintf(stderr, "%2d %04X %s %d %04X\n", i, op, op_enum, src, - swizzle); - } - for (i = 0; i < curProg->numArithInstr[j]; i++) { - GLuint op0 = curProg->Instructions[j][i].Opcode[0]; - GLuint op1 = curProg->Instructions[j][i].Opcode[1]; - const char *op0_enum = op0 > 5 ? _mesa_lookup_enum_by_nr(op0) : "0"; - const char *op1_enum = op1 > 5 ? _mesa_lookup_enum_by_nr(op1) : "0"; - GLuint count0 = curProg->Instructions[j][i].ArgCount[0]; - GLuint count1 = curProg->Instructions[j][i].ArgCount[1]; - fprintf(stderr, "%2d %04X %s %d %04X %s %d\n", i, op0, op0_enum, count0, - op1, op1_enum, count1); - } - } -#endif - - if (!ctx->Driver.ProgramStringNotify(ctx, GL_FRAGMENT_SHADER_ATI, NULL)) { - ctx->ATIFragmentShader.Current->isValid = GL_FALSE; - /* XXX is this the right error? */ - _mesa_error(ctx, GL_INVALID_OPERATION, - "glEndFragmentShaderATI(driver rejected shader)"); - } -} - -void GLAPIENTRY -_mesa_PassTexCoordATI(GLuint dst, GLuint coord, GLenum swizzle) -{ - GET_CURRENT_CONTEXT(ctx); - struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; - struct atifs_setupinst *curI; - - if (!ctx->ATIFragmentShader.Compiling) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glPassTexCoordATI(outsideShader)"); - return; - } - - if (curProg->cur_pass == 1) { - match_pair_inst(curProg, 0); - curProg->cur_pass = 2; - } - if ((curProg->cur_pass > 2) || - ((1 << (dst - GL_REG_0_ATI)) & curProg->regsAssigned[curProg->cur_pass >> 1])) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glPassTexCoord(pass)"); - return; - } - if ((dst < GL_REG_0_ATI) || (dst > GL_REG_5_ATI) || - ((dst - GL_REG_0_ATI) >= ctx->Const.MaxTextureUnits)) { - _mesa_error(ctx, GL_INVALID_ENUM, "glPassTexCoordATI(dst)"); - return; - } - if (((coord < GL_REG_0_ATI) || (coord > GL_REG_5_ATI)) && - ((coord < GL_TEXTURE0_ARB) || (coord > GL_TEXTURE7_ARB) || - ((coord - GL_TEXTURE0_ARB) >= ctx->Const.MaxTextureUnits))) { - _mesa_error(ctx, GL_INVALID_ENUM, "glPassTexCoordATI(coord)"); - return; - } - if ((curProg->cur_pass == 0) && (coord >= GL_REG_0_ATI)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glPassTexCoordATI(coord)"); - return; - } - if (!(swizzle >= GL_SWIZZLE_STR_ATI) && (swizzle <= GL_SWIZZLE_STQ_DQ_ATI)) { - _mesa_error(ctx, GL_INVALID_ENUM, "glPassTexCoordATI(swizzle)"); - return; - } - if ((swizzle & 1) && (coord >= GL_REG_0_ATI)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glPassTexCoordATI(swizzle)"); - return; - } - if (coord <= GL_TEXTURE7_ARB) { - GLuint tmp = coord - GL_TEXTURE0_ARB; - if ((((curProg->swizzlerq >> (tmp * 2)) & 3) != 0) && - (((swizzle & 1) + 1) != ((curProg->swizzlerq >> (tmp * 2)) & 3))) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glPassTexCoordATI(swizzle)"); - return; - } else { - curProg->swizzlerq |= (((swizzle & 1) + 1) << (tmp * 2)); - } - } - - curProg->regsAssigned[curProg->cur_pass >> 1] |= 1 << (dst - GL_REG_0_ATI); - new_tex_inst(curProg); - - /* add the instructions */ - curI = &curProg->SetupInst[curProg->cur_pass >> 1][dst - GL_REG_0_ATI]; - - curI->Opcode = ATI_FRAGMENT_SHADER_PASS_OP; - curI->src = coord; - curI->swizzle = swizzle; - -#if MESA_DEBUG_ATI_FS - _mesa_debug(ctx, "%s(%s, %s, %s)\n", __FUNCTION__, - _mesa_lookup_enum_by_nr(dst), _mesa_lookup_enum_by_nr(coord), - _mesa_lookup_enum_by_nr(swizzle)); -#endif -} - -void GLAPIENTRY -_mesa_SampleMapATI(GLuint dst, GLuint interp, GLenum swizzle) -{ - GET_CURRENT_CONTEXT(ctx); - struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; - struct atifs_setupinst *curI; - - if (!ctx->ATIFragmentShader.Compiling) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glSampleMapATI(outsideShader)"); - return; - } - - if (curProg->cur_pass == 1) { - match_pair_inst(curProg, 0); - curProg->cur_pass = 2; - } - if ((curProg->cur_pass > 2) || - ((1 << (dst - GL_REG_0_ATI)) & curProg->regsAssigned[curProg->cur_pass >> 1])) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glSampleMapATI(pass)"); - return; - } - if ((dst < GL_REG_0_ATI) || (dst > GL_REG_5_ATI) || - ((dst - GL_REG_0_ATI) >= ctx->Const.MaxTextureUnits)) { - _mesa_error(ctx, GL_INVALID_ENUM, "glSampleMapATI(dst)"); - return; - } - if (((interp < GL_REG_0_ATI) || (interp > GL_REG_5_ATI)) && - ((interp < GL_TEXTURE0_ARB) || (interp > GL_TEXTURE7_ARB) || - ((interp - GL_TEXTURE0_ARB) >= ctx->Const.MaxTextureUnits))) { - /* is this texture5 or texture7? spec is a bit unclear there */ - _mesa_error(ctx, GL_INVALID_ENUM, "glSampleMapATI(interp)"); - return; - } - if ((curProg->cur_pass == 0) && (interp >= GL_REG_0_ATI)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glSampleMapATI(interp)"); - return; - } - if (!(swizzle >= GL_SWIZZLE_STR_ATI) && (swizzle <= GL_SWIZZLE_STQ_DQ_ATI)) { - _mesa_error(ctx, GL_INVALID_ENUM, "glSampleMapATI(swizzle)"); - return; - } - if ((swizzle & 1) && (interp >= GL_REG_0_ATI)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glSampleMapATI(swizzle)"); - return; - } - if (interp <= GL_TEXTURE7_ARB) { - GLuint tmp = interp - GL_TEXTURE0_ARB; - if ((((curProg->swizzlerq >> (tmp * 2)) & 3) != 0) && - (((swizzle & 1) + 1) != ((curProg->swizzlerq >> (tmp * 2)) & 3))) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glSampleMapATI(swizzle)"); - return; - } else { - curProg->swizzlerq |= (((swizzle & 1) + 1) << (tmp * 2)); - } - } - - curProg->regsAssigned[curProg->cur_pass >> 1] |= 1 << (dst - GL_REG_0_ATI); - new_tex_inst(curProg); - - /* add the instructions */ - curI = &curProg->SetupInst[curProg->cur_pass >> 1][dst - GL_REG_0_ATI]; - - curI->Opcode = ATI_FRAGMENT_SHADER_SAMPLE_OP; - curI->src = interp; - curI->swizzle = swizzle; - -#if MESA_DEBUG_ATI_FS - _mesa_debug(ctx, "%s(%s, %s, %s)\n", __FUNCTION__, - _mesa_lookup_enum_by_nr(dst), _mesa_lookup_enum_by_nr(interp), - _mesa_lookup_enum_by_nr(swizzle)); -#endif -} - -static void -_mesa_FragmentOpXATI(GLint optype, GLuint arg_count, GLenum op, GLuint dst, - GLuint dstMask, GLuint dstMod, GLuint arg1, - GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, - GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, - GLuint arg3Rep, GLuint arg3Mod) -{ - GET_CURRENT_CONTEXT(ctx); - struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; - GLint ci; - struct atifs_instruction *curI; - GLuint modtemp = dstMod & ~GL_SATURATE_BIT_ATI; - - if (!ctx->ATIFragmentShader.Compiling) { - _mesa_error(ctx, GL_INVALID_OPERATION, "C/AFragmentOpATI(outsideShader)"); - return; - } - - if (curProg->cur_pass==0) - curProg->cur_pass=1; - - else if (curProg->cur_pass==2) - curProg->cur_pass=3; - - /* decide whether this is a new instruction or not ... all color instructions are new, - and alpha instructions might also be new if there was no preceding color inst */ - if ((optype == 0) || (curProg->last_optype == optype)) { - if (curProg->numArithInstr[curProg->cur_pass >> 1] > 7) { - _mesa_error(ctx, GL_INVALID_OPERATION, "C/AFragmentOpATI(instrCount)"); - return; - } - /* easier to do that here slight side effect invalid instr will still be inserted as nops */ - match_pair_inst(curProg, optype); - new_arith_inst(curProg); - } - curProg->last_optype = optype; - ci = curProg->numArithInstr[curProg->cur_pass >> 1] - 1; - - /* add the instructions */ - curI = &curProg->Instructions[curProg->cur_pass >> 1][ci]; - - /* error checking */ - if ((dst < GL_REG_0_ATI) || (dst > GL_REG_5_ATI)) { - _mesa_error(ctx, GL_INVALID_ENUM, "C/AFragmentOpATI(dst)"); - return; - } - if ((modtemp != GL_NONE) && (modtemp != GL_2X_BIT_ATI) && - (modtemp != GL_4X_BIT_ATI) && (modtemp != GL_8X_BIT_ATI) && - (modtemp != GL_HALF_BIT_ATI) && !(modtemp != GL_QUARTER_BIT_ATI) && - (modtemp != GL_EIGHTH_BIT_ATI)) { - _mesa_error(ctx, GL_INVALID_ENUM, "C/AFragmentOpATI(dstMod)%x", modtemp); - return; - } - /* op checking? Actually looks like that's missing in the spec but we'll do it anyway */ - if (((op < GL_ADD_ATI) || (op > GL_DOT2_ADD_ATI)) && !(op == GL_MOV_ATI)) { - _mesa_error(ctx, GL_INVALID_ENUM, "C/AFragmentOpATI(op)"); - return; - } - if (optype == 1) { - if (((op == GL_DOT2_ADD_ATI) && (curI->Opcode[0] != GL_DOT2_ADD_ATI)) || - ((op == GL_DOT3_ATI) && (curI->Opcode[0] != GL_DOT3_ATI)) || - ((op == GL_DOT4_ATI) && (curI->Opcode[0] != GL_DOT4_ATI)) || - ((op != GL_DOT4_ATI) && (curI->Opcode[0] == GL_DOT4_ATI))) { - _mesa_error(ctx, GL_INVALID_OPERATION, "AFragmentOpATI(op)"); - return; - } - } - if ((op == GL_DOT4_ATI) && - (((arg1 == GL_SECONDARY_INTERPOLATOR_ATI) && ((arg1Rep == GL_ALPHA) || (arg1Rep == GL_NONE))) || - (((arg2 == GL_SECONDARY_INTERPOLATOR_ATI) && ((arg2Rep == GL_ALPHA) || (arg2Rep == GL_NONE)))))) { - _mesa_error(ctx, GL_INVALID_OPERATION, "C/AFragmentOpATI(sec_interp)"); - } - - if (!check_arith_arg(curProg, optype, arg1, arg1Rep)) { - return; - } - if (arg2) { - if (!check_arith_arg(curProg, optype, arg2, arg2Rep)) { - return; - } - } - if (arg3) { - if (!check_arith_arg(curProg, optype, arg3, arg3Rep)) { - return; - } - if ((arg1 >= GL_CON_0_ATI) && (arg1 <= GL_CON_7_ATI) && - (arg2 >= GL_CON_0_ATI) && (arg2 <= GL_CON_7_ATI) && - (arg3 >= GL_CON_0_ATI) && (arg3 <= GL_CON_7_ATI) && - (arg1 != arg2) && (arg1 != arg3) && (arg2 != arg3)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "C/AFragmentOpATI(3Consts)"); - return; - } - } - - /* all ok - not all fully validated though (e.g. argNMod - spec doesn't say anything) */ - - curI->Opcode[optype] = op; - curI->SrcReg[optype][0].Index = arg1; - curI->SrcReg[optype][0].argRep = arg1Rep; - curI->SrcReg[optype][0].argMod = arg1Mod; - curI->ArgCount[optype] = arg_count; - - if (arg2) { - curI->SrcReg[optype][1].Index = arg2; - curI->SrcReg[optype][1].argRep = arg2Rep; - curI->SrcReg[optype][1].argMod = arg2Mod; - } - - if (arg3) { - curI->SrcReg[optype][2].Index = arg3; - curI->SrcReg[optype][2].argRep = arg3Rep; - curI->SrcReg[optype][2].argMod = arg3Mod; - } - - curI->DstReg[optype].Index = dst; - curI->DstReg[optype].dstMod = dstMod; - curI->DstReg[optype].dstMask = dstMask; - -#if MESA_DEBUG_ATI_FS - debug_op(optype, arg_count, op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, arg3, arg3Rep, arg3Mod); -#endif - -} - -void GLAPIENTRY -_mesa_ColorFragmentOp1ATI(GLenum op, GLuint dst, GLuint dstMask, - GLuint dstMod, GLuint arg1, GLuint arg1Rep, - GLuint arg1Mod) -{ - _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_COLOR_OP, 1, op, dst, dstMask, - dstMod, arg1, arg1Rep, arg1Mod, 0, 0, 0, 0, 0, 0); -} - -void GLAPIENTRY -_mesa_ColorFragmentOp2ATI(GLenum op, GLuint dst, GLuint dstMask, - GLuint dstMod, GLuint arg1, GLuint arg1Rep, - GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, - GLuint arg2Mod) -{ - _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_COLOR_OP, 2, op, dst, dstMask, - dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, - arg2Mod, 0, 0, 0); -} - -void GLAPIENTRY -_mesa_ColorFragmentOp3ATI(GLenum op, GLuint dst, GLuint dstMask, - GLuint dstMod, GLuint arg1, GLuint arg1Rep, - GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, - GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, - GLuint arg3Mod) -{ - _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_COLOR_OP, 3, op, dst, dstMask, - dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, - arg2Mod, arg3, arg3Rep, arg3Mod); -} - -void GLAPIENTRY -_mesa_AlphaFragmentOp1ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, - GLuint arg1Rep, GLuint arg1Mod) -{ - _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_ALPHA_OP, 1, op, dst, 0, dstMod, - arg1, arg1Rep, arg1Mod, 0, 0, 0, 0, 0, 0); -} - -void GLAPIENTRY -_mesa_AlphaFragmentOp2ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, - GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, - GLuint arg2Rep, GLuint arg2Mod) -{ - _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_ALPHA_OP, 2, op, dst, 0, dstMod, - arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, 0, 0, - 0); -} - -void GLAPIENTRY -_mesa_AlphaFragmentOp3ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, - GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, - GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, - GLuint arg3Rep, GLuint arg3Mod) -{ - _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_ALPHA_OP, 3, op, dst, 0, dstMod, - arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, arg3, - arg3Rep, arg3Mod); -} - -void GLAPIENTRY -_mesa_SetFragmentShaderConstantATI(GLuint dst, const GLfloat * value) -{ - GLuint dstindex; - GET_CURRENT_CONTEXT(ctx); - - if ((dst < GL_CON_0_ATI) || (dst > GL_CON_7_ATI)) { - /* spec says nothing about what should happen here but we can't just segfault...*/ - _mesa_error(ctx, GL_INVALID_ENUM, "glSetFragmentShaderConstantATI(dst)"); - return; - } - - dstindex = dst - GL_CON_0_ATI; - if (ctx->ATIFragmentShader.Compiling) { - struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; - COPY_4V(curProg->Constants[dstindex], value); - curProg->LocalConstDef |= 1 << dstindex; - } - else { - FLUSH_VERTICES(ctx, _NEW_PROGRAM); - COPY_4V(ctx->ATIFragmentShader.GlobalConstants[dstindex], value); - } -} - -#endif /* FEATURE_ATI_fragment_shader */ +/** + * \file atifragshader.c + * \author David Airlie + * Copyright (C) 2004 David Airlie All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * DAVID AIRLIE 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 "main/glheader.h" +#include "main/context.h" +#include "main/hash.h" +#include "main/imports.h" +#include "main/macros.h" +#include "main/mfeatures.h" +#include "main/enums.h" +#include "main/mtypes.h" +#include "main/dispatch.h" +#include "main/atifragshader.h" + +#if FEATURE_ATI_fragment_shader + +#define MESA_DEBUG_ATI_FS 0 + +static struct ati_fragment_shader DummyShader; + + +void +_mesa_init_ati_fragment_shader_dispatch(struct _glapi_table *disp) +{ + SET_GenFragmentShadersATI(disp, _mesa_GenFragmentShadersATI); + SET_BindFragmentShaderATI(disp, _mesa_BindFragmentShaderATI); + SET_DeleteFragmentShaderATI(disp, _mesa_DeleteFragmentShaderATI); + SET_BeginFragmentShaderATI(disp, _mesa_BeginFragmentShaderATI); + SET_EndFragmentShaderATI(disp, _mesa_EndFragmentShaderATI); + SET_PassTexCoordATI(disp, _mesa_PassTexCoordATI); + SET_SampleMapATI(disp, _mesa_SampleMapATI); + SET_ColorFragmentOp1ATI(disp, _mesa_ColorFragmentOp1ATI); + SET_ColorFragmentOp2ATI(disp, _mesa_ColorFragmentOp2ATI); + SET_ColorFragmentOp3ATI(disp, _mesa_ColorFragmentOp3ATI); + SET_AlphaFragmentOp1ATI(disp, _mesa_AlphaFragmentOp1ATI); + SET_AlphaFragmentOp2ATI(disp, _mesa_AlphaFragmentOp2ATI); + SET_AlphaFragmentOp3ATI(disp, _mesa_AlphaFragmentOp3ATI); + SET_SetFragmentShaderConstantATI(disp, _mesa_SetFragmentShaderConstantATI); +} + + +/** + * Allocate and initialize a new ATI fragment shader object. + */ +struct ati_fragment_shader * +_mesa_new_ati_fragment_shader(struct gl_context *ctx, GLuint id) +{ + struct ati_fragment_shader *s = CALLOC_STRUCT(ati_fragment_shader); + (void) ctx; + if (s) { + s->Id = id; + s->RefCount = 1; + } + return s; +} + + +/** + * Delete the given ati fragment shader + */ +void +_mesa_delete_ati_fragment_shader(struct gl_context *ctx, struct ati_fragment_shader *s) +{ + GLuint i; + for (i = 0; i < MAX_NUM_PASSES_ATI; i++) { + if (s->Instructions[i]) + free(s->Instructions[i]); + if (s->SetupInst[i]) + free(s->SetupInst[i]); + } + free(s); +} + + + +static void +new_arith_inst(struct ati_fragment_shader *prog) +{ +/* set "default" instruction as not all may get defined. + there is no specified way to express a nop with ati fragment shaders we use + GL_NONE as the op enum and just set some params to 0 - so nothing to do here */ + prog->numArithInstr[prog->cur_pass >> 1]++; +} + +static void +new_tex_inst(struct ati_fragment_shader *prog) +{ +} + +static void match_pair_inst(struct ati_fragment_shader *curProg, GLuint optype) +{ + if (optype == curProg->last_optype) { + curProg->last_optype = 1; + } +} + +#if MESA_DEBUG_ATI_FS +static char * +create_dst_mod_str(GLuint mod) +{ + static char ret_str[1024]; + + memset(ret_str, 0, 1024); + if (mod & GL_2X_BIT_ATI) + strncat(ret_str, "|2X", 1024); + + if (mod & GL_4X_BIT_ATI) + strncat(ret_str, "|4X", 1024); + + if (mod & GL_8X_BIT_ATI) + strncat(ret_str, "|8X", 1024); + if (mod & GL_HALF_BIT_ATI) + strncat(ret_str, "|HA", 1024); + if (mod & GL_QUARTER_BIT_ATI) + strncat(ret_str, "|QU", 1024); + if (mod & GL_EIGHTH_BIT_ATI) + strncat(ret_str, "|EI", 1024); + + if (mod & GL_SATURATE_BIT_ATI) + strncat(ret_str, "|SAT", 1024); + + if (strlen(ret_str) == 0) + strncat(ret_str, "NONE", 1024); + return ret_str; +} + +static char *atifs_ops[] = {"ColorFragmentOp1ATI", "ColorFragmentOp2ATI", "ColorFragmentOp3ATI", + "AlphaFragmentOp1ATI", "AlphaFragmentOp2ATI", "AlphaFragmentOp3ATI" }; + +static void debug_op(GLint optype, GLuint arg_count, GLenum op, GLuint dst, + GLuint dstMask, GLuint dstMod, GLuint arg1, + GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, + GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, + GLuint arg3Rep, GLuint arg3Mod) +{ + char *op_name; + + op_name = atifs_ops[(arg_count-1)+(optype?3:0)]; + + fprintf(stderr, "%s(%s, %s", op_name, _mesa_lookup_enum_by_nr(op), + _mesa_lookup_enum_by_nr(dst)); + if (!optype) + fprintf(stderr, ", %d", dstMask); + + fprintf(stderr, ", %s", create_dst_mod_str(dstMod)); + + fprintf(stderr, ", %s, %s, %d", _mesa_lookup_enum_by_nr(arg1), + _mesa_lookup_enum_by_nr(arg1Rep), arg1Mod); + if (arg_count>1) + fprintf(stderr, ", %s, %s, %d", _mesa_lookup_enum_by_nr(arg2), + _mesa_lookup_enum_by_nr(arg2Rep), arg2Mod); + if (arg_count>2) + fprintf(stderr, ", %s, %s, %d", _mesa_lookup_enum_by_nr(arg3), + _mesa_lookup_enum_by_nr(arg3Rep), arg3Mod); + + fprintf(stderr,")\n"); + +} +#endif + +static int check_arith_arg(struct ati_fragment_shader *curProg, + GLuint optype, GLuint arg, GLuint argRep) +{ + GET_CURRENT_CONTEXT(ctx); + + if (((arg < GL_CON_0_ATI) || (arg > GL_CON_7_ATI)) && + ((arg < GL_REG_0_ATI) || (arg > GL_REG_5_ATI)) && + (arg != GL_ZERO) && (arg != GL_ONE) && + (arg != GL_PRIMARY_COLOR_ARB) && (arg != GL_SECONDARY_INTERPOLATOR_ATI)) { + _mesa_error(ctx, GL_INVALID_ENUM, "C/AFragmentOpATI(arg)"); + return 0; + } + if ((arg == GL_SECONDARY_INTERPOLATOR_ATI) && (((optype == 0) && (argRep == GL_ALPHA)) || + ((optype == 1) && ((arg == GL_ALPHA) || (argRep == GL_NONE))))) { + _mesa_error(ctx, GL_INVALID_OPERATION, "C/AFragmentOpATI(sec_interp)"); + return 0; + } + if ((arg == GL_SECONDARY_INTERPOLATOR_ATI) && (((optype == 0) && (argRep == GL_ALPHA)) || + ((optype == 1) && ((arg == GL_ALPHA) || (argRep == GL_NONE))))) { + _mesa_error(ctx, GL_INVALID_OPERATION, "C/AFragmentOpATI(sec_interp)"); + return 0; + } + if ((curProg->cur_pass == 1) && + ((arg == GL_PRIMARY_COLOR_ARB) || (arg == GL_SECONDARY_INTERPOLATOR_ATI))) { + curProg->interpinp1 = GL_TRUE; + } + return 1; +} + +GLuint GLAPIENTRY +_mesa_GenFragmentShadersATI(GLuint range) +{ + GLuint first; + GLuint i; + GET_CURRENT_CONTEXT(ctx); + + if (range == 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGenFragmentShadersATI(range)"); + return 0; + } + + if (ctx->ATIFragmentShader.Compiling) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGenFragmentShadersATI(insideShader)"); + return 0; + } + + first = _mesa_HashFindFreeKeyBlock(ctx->Shared->ATIShaders, range); + for (i = 0; i < range; i++) { + _mesa_HashInsert(ctx->Shared->ATIShaders, first + i, &DummyShader); + } + + return first; +} + +void GLAPIENTRY +_mesa_BindFragmentShaderATI(GLuint id) +{ + GET_CURRENT_CONTEXT(ctx); + struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; + struct ati_fragment_shader *newProg; + + if (ctx->ATIFragmentShader.Compiling) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glBindFragmentShaderATI(insideShader)"); + return; + } + + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + + if (curProg->Id == id) { + return; + } + + /* unbind current */ + if (curProg->Id != 0) { + curProg->RefCount--; + if (curProg->RefCount <= 0) { + _mesa_HashRemove(ctx->Shared->ATIShaders, id); + } + } + + /* find new shader */ + if (id == 0) { + newProg = ctx->Shared->DefaultFragmentShader; + } + else { + newProg = (struct ati_fragment_shader *) + _mesa_HashLookup(ctx->Shared->ATIShaders, id); + if (!newProg || newProg == &DummyShader) { + /* allocate a new program now */ + newProg = _mesa_new_ati_fragment_shader(ctx, id); + if (!newProg) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindFragmentShaderATI"); + return; + } + _mesa_HashInsert(ctx->Shared->ATIShaders, id, newProg); + } + + } + + /* do actual bind */ + ctx->ATIFragmentShader.Current = newProg; + + ASSERT(ctx->ATIFragmentShader.Current); + if (newProg) + newProg->RefCount++; + + /*if (ctx->Driver.BindProgram) + ctx->Driver.BindProgram(ctx, target, prog); */ +} + +void GLAPIENTRY +_mesa_DeleteFragmentShaderATI(GLuint id) +{ + GET_CURRENT_CONTEXT(ctx); + + if (ctx->ATIFragmentShader.Compiling) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glDeleteFragmentShaderATI(insideShader)"); + return; + } + + if (id != 0) { + struct ati_fragment_shader *prog = (struct ati_fragment_shader *) + _mesa_HashLookup(ctx->Shared->ATIShaders, id); + if (prog == &DummyShader) { + _mesa_HashRemove(ctx->Shared->ATIShaders, id); + } + else if (prog) { + if (ctx->ATIFragmentShader.Current && + ctx->ATIFragmentShader.Current->Id == id) { + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + _mesa_BindFragmentShaderATI(0); + } + } + + /* The ID is immediately available for re-use now */ + _mesa_HashRemove(ctx->Shared->ATIShaders, id); + if (prog) { + prog->RefCount--; + if (prog->RefCount <= 0) { + assert(prog != &DummyShader); + free(prog); + } + } + } +} + + +void GLAPIENTRY +_mesa_BeginFragmentShaderATI(void) +{ + GLint i; + GET_CURRENT_CONTEXT(ctx); + + if (ctx->ATIFragmentShader.Compiling) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginFragmentShaderATI(insideShader)"); + return; + } + + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + + /* if the shader was already defined free instructions and get new ones + (or, could use the same mem but would need to reinitialize) */ + /* no idea if it's allowed to redefine a shader */ + for (i = 0; i < MAX_NUM_PASSES_ATI; i++) { + if (ctx->ATIFragmentShader.Current->Instructions[i]) + free(ctx->ATIFragmentShader.Current->Instructions[i]); + if (ctx->ATIFragmentShader.Current->SetupInst[i]) + free(ctx->ATIFragmentShader.Current->SetupInst[i]); + } + + /* malloc the instructions here - not sure if the best place but its + a start */ + for (i = 0; i < MAX_NUM_PASSES_ATI; i++) { + ctx->ATIFragmentShader.Current->Instructions[i] = + (struct atifs_instruction *) + calloc(1, sizeof(struct atifs_instruction) * + (MAX_NUM_INSTRUCTIONS_PER_PASS_ATI)); + ctx->ATIFragmentShader.Current->SetupInst[i] = + (struct atifs_setupinst *) + calloc(1, sizeof(struct atifs_setupinst) * + (MAX_NUM_FRAGMENT_REGISTERS_ATI)); + } + +/* can't rely on calloc for initialization as it's possible to redefine a shader (?) */ + ctx->ATIFragmentShader.Current->LocalConstDef = 0; + ctx->ATIFragmentShader.Current->numArithInstr[0] = 0; + ctx->ATIFragmentShader.Current->numArithInstr[1] = 0; + ctx->ATIFragmentShader.Current->regsAssigned[0] = 0; + ctx->ATIFragmentShader.Current->regsAssigned[1] = 0; + ctx->ATIFragmentShader.Current->NumPasses = 0; + ctx->ATIFragmentShader.Current->cur_pass = 0; + ctx->ATIFragmentShader.Current->last_optype = 0; + ctx->ATIFragmentShader.Current->interpinp1 = GL_FALSE; + ctx->ATIFragmentShader.Current->isValid = GL_FALSE; + ctx->ATIFragmentShader.Current->swizzlerq = 0; + ctx->ATIFragmentShader.Compiling = 1; +} + +void GLAPIENTRY +_mesa_EndFragmentShaderATI(void) +{ + GET_CURRENT_CONTEXT(ctx); + struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; +#if MESA_DEBUG_ATI_FS + GLint i, j; +#endif + + if (!ctx->ATIFragmentShader.Compiling) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glEndFragmentShaderATI(outsideShader)"); + return; + } + if (curProg->interpinp1 && (ctx->ATIFragmentShader.Current->cur_pass > 1)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glEndFragmentShaderATI(interpinfirstpass)"); + /* according to spec, DON'T return here */ + } + + match_pair_inst(curProg, 0); + ctx->ATIFragmentShader.Compiling = 0; + ctx->ATIFragmentShader.Current->isValid = GL_TRUE; + if ((ctx->ATIFragmentShader.Current->cur_pass == 0) || + (ctx->ATIFragmentShader.Current->cur_pass == 2)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glEndFragmentShaderATI(noarithinst)"); + } + if (ctx->ATIFragmentShader.Current->cur_pass > 1) + ctx->ATIFragmentShader.Current->NumPasses = 2; + else + ctx->ATIFragmentShader.Current->NumPasses = 1; + + ctx->ATIFragmentShader.Current->cur_pass = 0; + +#if MESA_DEBUG_ATI_FS + for (j = 0; j < MAX_NUM_PASSES_ATI; j++) { + for (i = 0; i < MAX_NUM_FRAGMENT_REGISTERS_ATI; i++) { + GLuint op = curProg->SetupInst[j][i].Opcode; + const char *op_enum = op > 5 ? _mesa_lookup_enum_by_nr(op) : "0"; + GLuint src = curProg->SetupInst[j][i].src; + GLuint swizzle = curProg->SetupInst[j][i].swizzle; + fprintf(stderr, "%2d %04X %s %d %04X\n", i, op, op_enum, src, + swizzle); + } + for (i = 0; i < curProg->numArithInstr[j]; i++) { + GLuint op0 = curProg->Instructions[j][i].Opcode[0]; + GLuint op1 = curProg->Instructions[j][i].Opcode[1]; + const char *op0_enum = op0 > 5 ? _mesa_lookup_enum_by_nr(op0) : "0"; + const char *op1_enum = op1 > 5 ? _mesa_lookup_enum_by_nr(op1) : "0"; + GLuint count0 = curProg->Instructions[j][i].ArgCount[0]; + GLuint count1 = curProg->Instructions[j][i].ArgCount[1]; + fprintf(stderr, "%2d %04X %s %d %04X %s %d\n", i, op0, op0_enum, count0, + op1, op1_enum, count1); + } + } +#endif + + if (!ctx->Driver.ProgramStringNotify(ctx, GL_FRAGMENT_SHADER_ATI, NULL)) { + ctx->ATIFragmentShader.Current->isValid = GL_FALSE; + /* XXX is this the right error? */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glEndFragmentShaderATI(driver rejected shader)"); + } +} + +void GLAPIENTRY +_mesa_PassTexCoordATI(GLuint dst, GLuint coord, GLenum swizzle) +{ + GET_CURRENT_CONTEXT(ctx); + struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; + struct atifs_setupinst *curI; + + if (!ctx->ATIFragmentShader.Compiling) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glPassTexCoordATI(outsideShader)"); + return; + } + + if (curProg->cur_pass == 1) { + match_pair_inst(curProg, 0); + curProg->cur_pass = 2; + } + if ((curProg->cur_pass > 2) || + ((1 << (dst - GL_REG_0_ATI)) & curProg->regsAssigned[curProg->cur_pass >> 1])) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glPassTexCoord(pass)"); + return; + } + if ((dst < GL_REG_0_ATI) || (dst > GL_REG_5_ATI) || + ((dst - GL_REG_0_ATI) >= ctx->Const.MaxTextureUnits)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glPassTexCoordATI(dst)"); + return; + } + if (((coord < GL_REG_0_ATI) || (coord > GL_REG_5_ATI)) && + ((coord < GL_TEXTURE0_ARB) || (coord > GL_TEXTURE7_ARB) || + ((coord - GL_TEXTURE0_ARB) >= ctx->Const.MaxTextureUnits))) { + _mesa_error(ctx, GL_INVALID_ENUM, "glPassTexCoordATI(coord)"); + return; + } + if ((curProg->cur_pass == 0) && (coord >= GL_REG_0_ATI)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glPassTexCoordATI(coord)"); + return; + } + if (!(swizzle >= GL_SWIZZLE_STR_ATI) && (swizzle <= GL_SWIZZLE_STQ_DQ_ATI)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glPassTexCoordATI(swizzle)"); + return; + } + if ((swizzle & 1) && (coord >= GL_REG_0_ATI)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glPassTexCoordATI(swizzle)"); + return; + } + if (coord <= GL_TEXTURE7_ARB) { + GLuint tmp = coord - GL_TEXTURE0_ARB; + if ((((curProg->swizzlerq >> (tmp * 2)) & 3) != 0) && + (((swizzle & 1) + 1) != ((curProg->swizzlerq >> (tmp * 2)) & 3))) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glPassTexCoordATI(swizzle)"); + return; + } else { + curProg->swizzlerq |= (((swizzle & 1) + 1) << (tmp * 2)); + } + } + + curProg->regsAssigned[curProg->cur_pass >> 1] |= 1 << (dst - GL_REG_0_ATI); + new_tex_inst(curProg); + + /* add the instructions */ + curI = &curProg->SetupInst[curProg->cur_pass >> 1][dst - GL_REG_0_ATI]; + + curI->Opcode = ATI_FRAGMENT_SHADER_PASS_OP; + curI->src = coord; + curI->swizzle = swizzle; + +#if MESA_DEBUG_ATI_FS + _mesa_debug(ctx, "%s(%s, %s, %s)\n", __FUNCTION__, + _mesa_lookup_enum_by_nr(dst), _mesa_lookup_enum_by_nr(coord), + _mesa_lookup_enum_by_nr(swizzle)); +#endif +} + +void GLAPIENTRY +_mesa_SampleMapATI(GLuint dst, GLuint interp, GLenum swizzle) +{ + GET_CURRENT_CONTEXT(ctx); + struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; + struct atifs_setupinst *curI; + + if (!ctx->ATIFragmentShader.Compiling) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glSampleMapATI(outsideShader)"); + return; + } + + if (curProg->cur_pass == 1) { + match_pair_inst(curProg, 0); + curProg->cur_pass = 2; + } + if ((curProg->cur_pass > 2) || + ((1 << (dst - GL_REG_0_ATI)) & curProg->regsAssigned[curProg->cur_pass >> 1])) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glSampleMapATI(pass)"); + return; + } + if ((dst < GL_REG_0_ATI) || (dst > GL_REG_5_ATI) || + ((dst - GL_REG_0_ATI) >= ctx->Const.MaxTextureUnits)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glSampleMapATI(dst)"); + return; + } + if (((interp < GL_REG_0_ATI) || (interp > GL_REG_5_ATI)) && + ((interp < GL_TEXTURE0_ARB) || (interp > GL_TEXTURE7_ARB) || + ((interp - GL_TEXTURE0_ARB) >= ctx->Const.MaxTextureUnits))) { + /* is this texture5 or texture7? spec is a bit unclear there */ + _mesa_error(ctx, GL_INVALID_ENUM, "glSampleMapATI(interp)"); + return; + } + if ((curProg->cur_pass == 0) && (interp >= GL_REG_0_ATI)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glSampleMapATI(interp)"); + return; + } + if (!(swizzle >= GL_SWIZZLE_STR_ATI) && (swizzle <= GL_SWIZZLE_STQ_DQ_ATI)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glSampleMapATI(swizzle)"); + return; + } + if ((swizzle & 1) && (interp >= GL_REG_0_ATI)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glSampleMapATI(swizzle)"); + return; + } + if (interp <= GL_TEXTURE7_ARB) { + GLuint tmp = interp - GL_TEXTURE0_ARB; + if ((((curProg->swizzlerq >> (tmp * 2)) & 3) != 0) && + (((swizzle & 1) + 1) != ((curProg->swizzlerq >> (tmp * 2)) & 3))) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glSampleMapATI(swizzle)"); + return; + } else { + curProg->swizzlerq |= (((swizzle & 1) + 1) << (tmp * 2)); + } + } + + curProg->regsAssigned[curProg->cur_pass >> 1] |= 1 << (dst - GL_REG_0_ATI); + new_tex_inst(curProg); + + /* add the instructions */ + curI = &curProg->SetupInst[curProg->cur_pass >> 1][dst - GL_REG_0_ATI]; + + curI->Opcode = ATI_FRAGMENT_SHADER_SAMPLE_OP; + curI->src = interp; + curI->swizzle = swizzle; + +#if MESA_DEBUG_ATI_FS + _mesa_debug(ctx, "%s(%s, %s, %s)\n", __FUNCTION__, + _mesa_lookup_enum_by_nr(dst), _mesa_lookup_enum_by_nr(interp), + _mesa_lookup_enum_by_nr(swizzle)); +#endif +} + +static void +_mesa_FragmentOpXATI(GLint optype, GLuint arg_count, GLenum op, GLuint dst, + GLuint dstMask, GLuint dstMod, GLuint arg1, + GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, + GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, + GLuint arg3Rep, GLuint arg3Mod) +{ + GET_CURRENT_CONTEXT(ctx); + struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; + GLint ci; + struct atifs_instruction *curI; + GLuint modtemp = dstMod & ~GL_SATURATE_BIT_ATI; + + if (!ctx->ATIFragmentShader.Compiling) { + _mesa_error(ctx, GL_INVALID_OPERATION, "C/AFragmentOpATI(outsideShader)"); + return; + } + + if (curProg->cur_pass==0) + curProg->cur_pass=1; + + else if (curProg->cur_pass==2) + curProg->cur_pass=3; + + /* decide whether this is a new instruction or not ... all color instructions are new, + and alpha instructions might also be new if there was no preceding color inst */ + if ((optype == 0) || (curProg->last_optype == optype)) { + if (curProg->numArithInstr[curProg->cur_pass >> 1] > 7) { + _mesa_error(ctx, GL_INVALID_OPERATION, "C/AFragmentOpATI(instrCount)"); + return; + } + /* easier to do that here slight side effect invalid instr will still be inserted as nops */ + match_pair_inst(curProg, optype); + new_arith_inst(curProg); + } + curProg->last_optype = optype; + ci = curProg->numArithInstr[curProg->cur_pass >> 1] - 1; + + /* add the instructions */ + curI = &curProg->Instructions[curProg->cur_pass >> 1][ci]; + + /* error checking */ + if ((dst < GL_REG_0_ATI) || (dst > GL_REG_5_ATI)) { + _mesa_error(ctx, GL_INVALID_ENUM, "C/AFragmentOpATI(dst)"); + return; + } + if ((modtemp != GL_NONE) && (modtemp != GL_2X_BIT_ATI) && + (modtemp != GL_4X_BIT_ATI) && (modtemp != GL_8X_BIT_ATI) && + (modtemp != GL_HALF_BIT_ATI) && !(modtemp != GL_QUARTER_BIT_ATI) && + (modtemp != GL_EIGHTH_BIT_ATI)) { + _mesa_error(ctx, GL_INVALID_ENUM, "C/AFragmentOpATI(dstMod)%x", modtemp); + return; + } + /* op checking? Actually looks like that's missing in the spec but we'll do it anyway */ + if (((op < GL_ADD_ATI) || (op > GL_DOT2_ADD_ATI)) && !(op == GL_MOV_ATI)) { + _mesa_error(ctx, GL_INVALID_ENUM, "C/AFragmentOpATI(op)"); + return; + } + if (optype == 1) { + if (((op == GL_DOT2_ADD_ATI) && (curI->Opcode[0] != GL_DOT2_ADD_ATI)) || + ((op == GL_DOT3_ATI) && (curI->Opcode[0] != GL_DOT3_ATI)) || + ((op == GL_DOT4_ATI) && (curI->Opcode[0] != GL_DOT4_ATI)) || + ((op != GL_DOT4_ATI) && (curI->Opcode[0] == GL_DOT4_ATI))) { + _mesa_error(ctx, GL_INVALID_OPERATION, "AFragmentOpATI(op)"); + return; + } + } + if ((op == GL_DOT4_ATI) && + (((arg1 == GL_SECONDARY_INTERPOLATOR_ATI) && ((arg1Rep == GL_ALPHA) || (arg1Rep == GL_NONE))) || + (((arg2 == GL_SECONDARY_INTERPOLATOR_ATI) && ((arg2Rep == GL_ALPHA) || (arg2Rep == GL_NONE)))))) { + _mesa_error(ctx, GL_INVALID_OPERATION, "C/AFragmentOpATI(sec_interp)"); + } + + if (!check_arith_arg(curProg, optype, arg1, arg1Rep)) { + return; + } + if (arg2) { + if (!check_arith_arg(curProg, optype, arg2, arg2Rep)) { + return; + } + } + if (arg3) { + if (!check_arith_arg(curProg, optype, arg3, arg3Rep)) { + return; + } + if ((arg1 >= GL_CON_0_ATI) && (arg1 <= GL_CON_7_ATI) && + (arg2 >= GL_CON_0_ATI) && (arg2 <= GL_CON_7_ATI) && + (arg3 >= GL_CON_0_ATI) && (arg3 <= GL_CON_7_ATI) && + (arg1 != arg2) && (arg1 != arg3) && (arg2 != arg3)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "C/AFragmentOpATI(3Consts)"); + return; + } + } + + /* all ok - not all fully validated though (e.g. argNMod - spec doesn't say anything) */ + + curI->Opcode[optype] = op; + curI->SrcReg[optype][0].Index = arg1; + curI->SrcReg[optype][0].argRep = arg1Rep; + curI->SrcReg[optype][0].argMod = arg1Mod; + curI->ArgCount[optype] = arg_count; + + if (arg2) { + curI->SrcReg[optype][1].Index = arg2; + curI->SrcReg[optype][1].argRep = arg2Rep; + curI->SrcReg[optype][1].argMod = arg2Mod; + } + + if (arg3) { + curI->SrcReg[optype][2].Index = arg3; + curI->SrcReg[optype][2].argRep = arg3Rep; + curI->SrcReg[optype][2].argMod = arg3Mod; + } + + curI->DstReg[optype].Index = dst; + curI->DstReg[optype].dstMod = dstMod; + curI->DstReg[optype].dstMask = dstMask; + +#if MESA_DEBUG_ATI_FS + debug_op(optype, arg_count, op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, arg3, arg3Rep, arg3Mod); +#endif + +} + +void GLAPIENTRY +_mesa_ColorFragmentOp1ATI(GLenum op, GLuint dst, GLuint dstMask, + GLuint dstMod, GLuint arg1, GLuint arg1Rep, + GLuint arg1Mod) +{ + _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_COLOR_OP, 1, op, dst, dstMask, + dstMod, arg1, arg1Rep, arg1Mod, 0, 0, 0, 0, 0, 0); +} + +void GLAPIENTRY +_mesa_ColorFragmentOp2ATI(GLenum op, GLuint dst, GLuint dstMask, + GLuint dstMod, GLuint arg1, GLuint arg1Rep, + GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, + GLuint arg2Mod) +{ + _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_COLOR_OP, 2, op, dst, dstMask, + dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, + arg2Mod, 0, 0, 0); +} + +void GLAPIENTRY +_mesa_ColorFragmentOp3ATI(GLenum op, GLuint dst, GLuint dstMask, + GLuint dstMod, GLuint arg1, GLuint arg1Rep, + GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, + GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, + GLuint arg3Mod) +{ + _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_COLOR_OP, 3, op, dst, dstMask, + dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, + arg2Mod, arg3, arg3Rep, arg3Mod); +} + +void GLAPIENTRY +_mesa_AlphaFragmentOp1ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, + GLuint arg1Rep, GLuint arg1Mod) +{ + _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_ALPHA_OP, 1, op, dst, 0, dstMod, + arg1, arg1Rep, arg1Mod, 0, 0, 0, 0, 0, 0); +} + +void GLAPIENTRY +_mesa_AlphaFragmentOp2ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, + GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, + GLuint arg2Rep, GLuint arg2Mod) +{ + _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_ALPHA_OP, 2, op, dst, 0, dstMod, + arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, 0, 0, + 0); +} + +void GLAPIENTRY +_mesa_AlphaFragmentOp3ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, + GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, + GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, + GLuint arg3Rep, GLuint arg3Mod) +{ + _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_ALPHA_OP, 3, op, dst, 0, dstMod, + arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, arg3, + arg3Rep, arg3Mod); +} + +void GLAPIENTRY +_mesa_SetFragmentShaderConstantATI(GLuint dst, const GLfloat * value) +{ + GLuint dstindex; + GET_CURRENT_CONTEXT(ctx); + + if ((dst < GL_CON_0_ATI) || (dst > GL_CON_7_ATI)) { + /* spec says nothing about what should happen here but we can't just segfault...*/ + _mesa_error(ctx, GL_INVALID_ENUM, "glSetFragmentShaderConstantATI(dst)"); + return; + } + + dstindex = dst - GL_CON_0_ATI; + if (ctx->ATIFragmentShader.Compiling) { + struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; + COPY_4V(curProg->Constants[dstindex], value); + curProg->LocalConstDef |= 1 << dstindex; + } + else { + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + COPY_4V(ctx->ATIFragmentShader.GlobalConstants[dstindex], value); + } +} + +#endif /* FEATURE_ATI_fragment_shader */ diff --git a/mesalib/src/mesa/main/blend.h b/mesalib/src/mesa/main/blend.h index b0a6b0135..d74f17ef1 100644 --- a/mesalib/src/mesa/main/blend.h +++ b/mesalib/src/mesa/main/blend.h @@ -1,106 +1,106 @@ -/** - * \file blend.h - * Blending functions operations. - */ - -/* - * Mesa 3-D graphics library - * Version: 6.5.2 - * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - - -#ifndef BLEND_H -#define BLEND_H - - -#include "glheader.h" - -struct gl_context; - - -extern void GLAPIENTRY -_mesa_BlendFunc( GLenum sfactor, GLenum dfactor ); - - -extern void GLAPIENTRY -_mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB, - GLenum sfactorA, GLenum dfactorA ); - - -extern void GLAPIENTRY -_mesa_BlendFunci(GLuint buf, GLenum sfactor, GLenum dfactor); - - -extern void GLAPIENTRY -_mesa_BlendFuncSeparatei(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB, - GLenum sfactorA, GLenum dfactorA); - - -extern void GLAPIENTRY -_mesa_BlendEquation( GLenum mode ); - - -extern void GLAPIENTRY -_mesa_BlendEquationi(GLuint buf, GLenum mode); - - -extern void GLAPIENTRY -_mesa_BlendEquationSeparateEXT( GLenum modeRGB, GLenum modeA ); - - -extern void GLAPIENTRY -_mesa_BlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeA); - - -extern void GLAPIENTRY -_mesa_BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); - - -extern void GLAPIENTRY -_mesa_AlphaFunc( GLenum func, GLclampf ref ); - - -extern void GLAPIENTRY -_mesa_LogicOp( GLenum opcode ); - - -extern void GLAPIENTRY -_mesa_IndexMask( GLuint mask ); - -extern void GLAPIENTRY -_mesa_ColorMask( GLboolean red, GLboolean green, - GLboolean blue, GLboolean alpha ); - -extern void GLAPIENTRY -_mesa_ColorMaskIndexed( GLuint buf, GLboolean red, GLboolean green, - GLboolean blue, GLboolean alpha ); - - -extern void GLAPIENTRY -_mesa_ClampColorARB(GLenum target, GLenum clamp); - - -extern void -_mesa_init_color( struct gl_context * ctx ); - -#endif +/** + * \file blend.h + * Blending functions operations. + */ + +/* + * Mesa 3-D graphics library + * Version: 6.5.2 + * + * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + + +#ifndef BLEND_H +#define BLEND_H + + +#include "glheader.h" + +struct gl_context; + + +extern void GLAPIENTRY +_mesa_BlendFunc( GLenum sfactor, GLenum dfactor ); + + +extern void GLAPIENTRY +_mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB, + GLenum sfactorA, GLenum dfactorA ); + + +extern void GLAPIENTRY +_mesa_BlendFunci(GLuint buf, GLenum sfactor, GLenum dfactor); + + +extern void GLAPIENTRY +_mesa_BlendFuncSeparatei(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB, + GLenum sfactorA, GLenum dfactorA); + + +extern void GLAPIENTRY +_mesa_BlendEquation( GLenum mode ); + + +extern void GLAPIENTRY +_mesa_BlendEquationi(GLuint buf, GLenum mode); + + +extern void GLAPIENTRY +_mesa_BlendEquationSeparateEXT( GLenum modeRGB, GLenum modeA ); + + +extern void GLAPIENTRY +_mesa_BlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeA); + + +extern void GLAPIENTRY +_mesa_BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); + + +extern void GLAPIENTRY +_mesa_AlphaFunc( GLenum func, GLclampf ref ); + + +extern void GLAPIENTRY +_mesa_LogicOp( GLenum opcode ); + + +extern void GLAPIENTRY +_mesa_IndexMask( GLuint mask ); + +extern void GLAPIENTRY +_mesa_ColorMask( GLboolean red, GLboolean green, + GLboolean blue, GLboolean alpha ); + +extern void GLAPIENTRY +_mesa_ColorMaskIndexed( GLuint buf, GLboolean red, GLboolean green, + GLboolean blue, GLboolean alpha ); + + +extern void GLAPIENTRY +_mesa_ClampColorARB(GLenum target, GLenum clamp); + + +extern void +_mesa_init_color( struct gl_context * ctx ); + +#endif diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c index ae7bac14d..36a761986 100644 --- a/mesalib/src/mesa/main/bufferobj.c +++ b/mesalib/src/mesa/main/bufferobj.c @@ -42,6 +42,7 @@ #include "mfeatures.h" #include "mtypes.h" #include "texobj.h" +#include "transformfeedback.h" /* Debug flags */ @@ -821,6 +822,24 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids) _mesa_BindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, 0 ); } + /* unbind ARB_copy_buffer binding points */ + if (ctx->CopyReadBuffer == bufObj) { + _mesa_BindBufferARB( GL_COPY_READ_BUFFER, 0 ); + } + if (ctx->CopyWriteBuffer == bufObj) { + _mesa_BindBufferARB( GL_COPY_WRITE_BUFFER, 0 ); + } + + /* unbind transform feedback binding points */ + if (ctx->TransformFeedback.CurrentBuffer == bufObj) { + _mesa_BindBufferARB( GL_TRANSFORM_FEEDBACK_BUFFER, 0 ); + } + for (j = 0; j < MAX_FEEDBACK_ATTRIBS; j++) { + if (ctx->TransformFeedback.CurrentObject->Buffers[j] == bufObj) { + _mesa_BindBufferBase( GL_TRANSFORM_FEEDBACK_BUFFER, j, 0 ); + } + } + /* unbind any pixel pack/unpack pointers bound to this buffer */ if (ctx->Pack.BufferObj == bufObj) { _mesa_BindBufferARB( GL_PIXEL_PACK_BUFFER_EXT, 0 ); diff --git a/mesalib/src/mesa/main/clear.h b/mesalib/src/mesa/main/clear.h index d3d64fd62..783271920 100644 --- a/mesalib/src/mesa/main/clear.h +++ b/mesalib/src/mesa/main/clear.h @@ -1,64 +1,64 @@ -/* - * Mesa 3-D graphics library - * Version: 7.1 - * - * 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"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#ifndef CLEAR_H -#define CLEAR_H - - -#include "glheader.h" - - -extern void GLAPIENTRY -_mesa_ClearIndex( GLfloat c ); - -extern void GLAPIENTRY -_mesa_ClearColor( GLclampf red, GLclampf green, - GLclampf blue, GLclampf alpha ); - -extern void GLAPIENTRY -_mesa_ClearColorIiEXT(GLint r, GLint g, GLint b, GLint a); - -extern void GLAPIENTRY -_mesa_ClearColorIuiEXT(GLuint r, GLuint g, GLuint b, GLuint a); - - -extern void GLAPIENTRY -_mesa_Clear( GLbitfield mask ); - - -extern void GLAPIENTRY -_mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value); - -extern void GLAPIENTRY -_mesa_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value); - -extern void GLAPIENTRY -_mesa_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value); - -extern void GLAPIENTRY -_mesa_ClearBufferfi(GLenum buffer, GLint drawbuffer, - GLfloat depth, GLint stencil); - -#endif +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * 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"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef CLEAR_H +#define CLEAR_H + + +#include "glheader.h" + + +extern void GLAPIENTRY +_mesa_ClearIndex( GLfloat c ); + +extern void GLAPIENTRY +_mesa_ClearColor( GLclampf red, GLclampf green, + GLclampf blue, GLclampf alpha ); + +extern void GLAPIENTRY +_mesa_ClearColorIiEXT(GLint r, GLint g, GLint b, GLint a); + +extern void GLAPIENTRY +_mesa_ClearColorIuiEXT(GLuint r, GLuint g, GLuint b, GLuint a); + + +extern void GLAPIENTRY +_mesa_Clear( GLbitfield mask ); + + +extern void GLAPIENTRY +_mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value); + +extern void GLAPIENTRY +_mesa_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value); + +extern void GLAPIENTRY +_mesa_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value); + +extern void GLAPIENTRY +_mesa_ClearBufferfi(GLenum buffer, GLint drawbuffer, + GLfloat depth, GLint stencil); + +#endif diff --git a/mesalib/src/mesa/main/clip.c b/mesalib/src/mesa/main/clip.c index 6b9b3b58c..ba2028cf2 100644 --- a/mesalib/src/mesa/main/clip.c +++ b/mesalib/src/mesa/main/clip.c @@ -1,116 +1,116 @@ -/* - * Mesa 3-D graphics library - * Version: 6.3 - * - * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#include "glheader.h" -#include "clip.h" -#include "context.h" -#include "macros.h" -#include "mtypes.h" - -#include "math/m_matrix.h" - - -/** - * Update derived clip plane state. - */ -void -_mesa_update_clip_plane(struct gl_context *ctx, GLuint plane) -{ - if (_math_matrix_is_dirty(ctx->ProjectionMatrixStack.Top)) - _math_matrix_analyse( ctx->ProjectionMatrixStack.Top ); - - /* Clip-Space Plane = Eye-Space Plane * Projection Matrix */ - _mesa_transform_vector(ctx->Transform._ClipUserPlane[plane], - ctx->Transform.EyeUserPlane[plane], - ctx->ProjectionMatrixStack.Top->inv); -} - - -void GLAPIENTRY -_mesa_ClipPlane( GLenum plane, const GLdouble *eq ) -{ - GET_CURRENT_CONTEXT(ctx); - GLint p; - GLfloat equation[4]; - ASSERT_OUTSIDE_BEGIN_END(ctx); - - p = (GLint) plane - (GLint) GL_CLIP_PLANE0; - if (p < 0 || p >= (GLint) ctx->Const.MaxClipPlanes) { - _mesa_error( ctx, GL_INVALID_ENUM, "glClipPlane" ); - return; - } - - equation[0] = (GLfloat) eq[0]; - equation[1] = (GLfloat) eq[1]; - equation[2] = (GLfloat) eq[2]; - equation[3] = (GLfloat) eq[3]; - - /* - * The equation is transformed by the transpose of the inverse of the - * current modelview matrix and stored in the resulting eye coordinates. - * - * KW: Eqn is then transformed to the current clip space, where user - * clipping now takes place. The clip-space equations are recalculated - * whenever the projection matrix changes. - */ - if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) - _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); - - _mesa_transform_vector( equation, equation, - ctx->ModelviewMatrixStack.Top->inv ); - - if (TEST_EQ_4V(ctx->Transform.EyeUserPlane[p], equation)) - return; - - FLUSH_VERTICES(ctx, _NEW_TRANSFORM); - COPY_4FV(ctx->Transform.EyeUserPlane[p], equation); - - if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { - _mesa_update_clip_plane(ctx, p); - } - - if (ctx->Driver.ClipPlane) - ctx->Driver.ClipPlane( ctx, plane, equation ); -} - - -void GLAPIENTRY -_mesa_GetClipPlane( GLenum plane, GLdouble *equation ) -{ - GET_CURRENT_CONTEXT(ctx); - GLint p; - ASSERT_OUTSIDE_BEGIN_END(ctx); - - p = (GLint) (plane - GL_CLIP_PLANE0); - if (p < 0 || p >= (GLint) ctx->Const.MaxClipPlanes) { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetClipPlane" ); - return; - } - - equation[0] = (GLdouble) ctx->Transform.EyeUserPlane[p][0]; - equation[1] = (GLdouble) ctx->Transform.EyeUserPlane[p][1]; - equation[2] = (GLdouble) ctx->Transform.EyeUserPlane[p][2]; - equation[3] = (GLdouble) ctx->Transform.EyeUserPlane[p][3]; -} +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#include "glheader.h" +#include "clip.h" +#include "context.h" +#include "macros.h" +#include "mtypes.h" + +#include "math/m_matrix.h" + + +/** + * Update derived clip plane state. + */ +void +_mesa_update_clip_plane(struct gl_context *ctx, GLuint plane) +{ + if (_math_matrix_is_dirty(ctx->ProjectionMatrixStack.Top)) + _math_matrix_analyse( ctx->ProjectionMatrixStack.Top ); + + /* Clip-Space Plane = Eye-Space Plane * Projection Matrix */ + _mesa_transform_vector(ctx->Transform._ClipUserPlane[plane], + ctx->Transform.EyeUserPlane[plane], + ctx->ProjectionMatrixStack.Top->inv); +} + + +void GLAPIENTRY +_mesa_ClipPlane( GLenum plane, const GLdouble *eq ) +{ + GET_CURRENT_CONTEXT(ctx); + GLint p; + GLfloat equation[4]; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + p = (GLint) plane - (GLint) GL_CLIP_PLANE0; + if (p < 0 || p >= (GLint) ctx->Const.MaxClipPlanes) { + _mesa_error( ctx, GL_INVALID_ENUM, "glClipPlane" ); + return; + } + + equation[0] = (GLfloat) eq[0]; + equation[1] = (GLfloat) eq[1]; + equation[2] = (GLfloat) eq[2]; + equation[3] = (GLfloat) eq[3]; + + /* + * The equation is transformed by the transpose of the inverse of the + * current modelview matrix and stored in the resulting eye coordinates. + * + * KW: Eqn is then transformed to the current clip space, where user + * clipping now takes place. The clip-space equations are recalculated + * whenever the projection matrix changes. + */ + if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) + _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); + + _mesa_transform_vector( equation, equation, + ctx->ModelviewMatrixStack.Top->inv ); + + if (TEST_EQ_4V(ctx->Transform.EyeUserPlane[p], equation)) + return; + + FLUSH_VERTICES(ctx, _NEW_TRANSFORM); + COPY_4FV(ctx->Transform.EyeUserPlane[p], equation); + + if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { + _mesa_update_clip_plane(ctx, p); + } + + if (ctx->Driver.ClipPlane) + ctx->Driver.ClipPlane( ctx, plane, equation ); +} + + +void GLAPIENTRY +_mesa_GetClipPlane( GLenum plane, GLdouble *equation ) +{ + GET_CURRENT_CONTEXT(ctx); + GLint p; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + p = (GLint) (plane - GL_CLIP_PLANE0); + if (p < 0 || p >= (GLint) ctx->Const.MaxClipPlanes) { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetClipPlane" ); + return; + } + + equation[0] = (GLdouble) ctx->Transform.EyeUserPlane[p][0]; + equation[1] = (GLdouble) ctx->Transform.EyeUserPlane[p][1]; + equation[2] = (GLdouble) ctx->Transform.EyeUserPlane[p][2]; + equation[3] = (GLdouble) ctx->Transform.EyeUserPlane[p][3]; +} diff --git a/mesalib/src/mesa/main/clip.h b/mesalib/src/mesa/main/clip.h index 9a94542ec..a8e6d7687 100644 --- a/mesalib/src/mesa/main/clip.h +++ b/mesalib/src/mesa/main/clip.h @@ -1,47 +1,47 @@ -/** - * \file clip.h - */ - -/* - * Mesa 3-D graphics library - * Version: 3.5 - * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - - -#ifndef CLIP_H -#define CLIP_H - -#include "glheader.h" - -struct gl_context; - -extern void -_mesa_update_clip_plane(struct gl_context *ctx, GLuint plane); - -extern void GLAPIENTRY -_mesa_ClipPlane( GLenum plane, const GLdouble *equation ); - -extern void GLAPIENTRY -_mesa_GetClipPlane( GLenum plane, GLdouble *equation ); - -#endif +/** + * \file clip.h + */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + + +#ifndef CLIP_H +#define CLIP_H + +#include "glheader.h" + +struct gl_context; + +extern void +_mesa_update_clip_plane(struct gl_context *ctx, GLuint plane); + +extern void GLAPIENTRY +_mesa_ClipPlane( GLenum plane, const GLdouble *equation ); + +extern void GLAPIENTRY +_mesa_GetClipPlane( GLenum plane, GLdouble *equation ); + +#endif diff --git a/mesalib/src/mesa/main/condrender.h b/mesalib/src/mesa/main/condrender.h index 49e9953be..cf6d4ca28 100644 --- a/mesalib/src/mesa/main/condrender.h +++ b/mesalib/src/mesa/main/condrender.h @@ -1,45 +1,45 @@ -/* - * Mesa 3-D graphics library - * Version: 7.8 - * - * Copyright (C) 2009 VMware, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS 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. - */ - -#ifndef CONDRENDER_H -#define CONDRENDER_H - - -#include "glheader.h" -#include "context.h" - - -extern void GLAPIENTRY -_mesa_BeginConditionalRender(GLuint queryId, GLenum mode); - -extern void APIENTRY -_mesa_EndConditionalRender(void); - -extern GLboolean -_mesa_check_conditional_render(struct gl_context *ctx); - - -#endif /* CONDRENDER_H */ +/* + * Mesa 3-D graphics library + * Version: 7.8 + * + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + */ + +#ifndef CONDRENDER_H +#define CONDRENDER_H + + +#include "glheader.h" +#include "context.h" + + +extern void GLAPIENTRY +_mesa_BeginConditionalRender(GLuint queryId, GLenum mode); + +extern void APIENTRY +_mesa_EndConditionalRender(void); + +extern GLboolean +_mesa_check_conditional_render(struct gl_context *ctx); + + +#endif /* CONDRENDER_H */ diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h index 582eb5d49..1582a8c81 100644 --- a/mesalib/src/mesa/main/dd.h +++ b/mesalib/src/mesa/main/dd.h @@ -198,81 +198,32 @@ struct dd_function_table { GLenum srcFormat, GLenum srcType ); /** - * Called by glTexImage1D(). Simply copy the source texture data into the - * destination texture memory. The gl_texture_image fields, etc. will be - * fully initialized. - * The parameters are the same as glTexImage1D(), plus: + * Called by glTexImage[123]D() and glCopyTexImage[12]D() + * Allocate texture memory and copy the user's image to the buffer. + * The gl_texture_image fields, etc. will be fully initialized. + * The parameters are the same as glTexImage3D(), plus: + * \param dims 1, 2, or 3 indicating glTexImage1/2/3D() * \param packing describes how to unpack the source data. * \param texImage is the destination texture image. */ - void (*TexImage1D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint border, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); + void (*TexImage)(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint internalFormat, + GLint width, GLint height, GLint depth, GLint border, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing); /** - * Called by glTexImage2D(). - * - * \sa dd_function_table::TexImage1D. + * Called by glTexSubImage[123]D(). + * Replace a subset of the target texture with new texel data. */ - void (*TexImage2D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint height, GLint border, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); - - /** - * Called by glTexImage3D(). - * - * \sa dd_function_table::TexImage1D. - */ - void (*TexImage3D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint height, GLint depth, GLint border, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); - - /** - * Called by glTexSubImage1D(). Replace a subset of the target texture - * with new texel data. - * \sa dd_function_table::TexImage1D. - */ - void (*TexSubImage1D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLsizei width, - GLenum format, GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); - - /** - * Called by glTexSubImage2D(). - * - * \sa dd_function_table::TexSubImage1D. - */ - void (*TexSubImage2D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); - - /** - * Called by glTexSubImage3D(). - * - * \sa dd_function_table::TexSubImage1D. - */ - void (*TexSubImage3D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, GLint zoffset, - GLsizei width, GLsizei height, GLint depth, - GLenum format, GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); + void (*TexSubImage)(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLint depth, + GLenum format, GLenum type, + const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing); /** @@ -283,33 +234,14 @@ struct dd_function_table { struct gl_texture_image *texImage ); /** - * Called by glCopyTexSubImage1D() and glCopyTexImage1D(). + * Called by glCopyTex[Sub]Image[123]D(). */ - void (*CopyTexSubImage1D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, - struct gl_renderbuffer *rb, - GLint x, GLint y, GLsizei width); - - /** - * Called by glCopyTexSubImage2D() and glCopyTexImage2D(). - */ - void (*CopyTexSubImage2D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, - struct gl_renderbuffer *rb, - GLint x, GLint y, - GLsizei width, GLsizei height); - - /** - * Called by glCopyTexSubImage3D() and glCopyTexImage3D(). - */ - void (*CopyTexSubImage3D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, GLint zoffset, - struct gl_renderbuffer *rb, - GLint x, GLint y, - GLsizei width, GLsizei height); + void (*CopyTexSubImage)(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + struct gl_renderbuffer *rb, + GLint x, GLint y, + GLsizei width, GLsizei height); /** * Called by glGenerateMipmap() or when GL_GENERATE_MIPMAP_SGIS is enabled. @@ -337,66 +269,24 @@ struct dd_function_table { /*@{*/ /** - * Called by glCompressedTexImage1D(). - * The parameters are the same as for glCompressedTexImage1D(), plus a - * pointer to the destination texure image. - */ - void (*CompressedTexImage1D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLsizei width, GLint border, - GLsizei imageSize, const GLvoid *data); - /** - * Called by glCompressedTexImage2D(). - * - * \sa dd_function_table::CompressedTexImage1D. - */ - void (*CompressedTexImage2D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLsizei width, GLsizei height, GLint border, - GLsizei imageSize, const GLvoid *data); - - /** - * Called by glCompressedTexImage3D(). - * - * \sa dd_function_table::CompressedTexImage3D. - */ - void (*CompressedTexImage3D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLsizei width, GLsizei height, GLsizei depth, - GLint border, - GLsizei imageSize, const GLvoid *data); - - /** - * Called by glCompressedTexSubImage1D(). + * Called by glCompressedTexImage[123]D(). */ - void (*CompressedTexSubImage1D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLsizei width, - GLenum format, - GLsizei imageSize, const GLvoid *data); + void (*CompressedTexImage)(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint internalFormat, + GLsizei width, GLsizei height, GLsizei depth, + GLint border, + GLsizei imageSize, const GLvoid *data); /** - * Called by glCompressedTexSubImage2D(). + * Called by glCompressedTexSubImage[123]D(). */ - void (*CompressedTexSubImage2D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, - GLsizei width, GLint height, - GLenum format, - GLsizei imageSize, const GLvoid *data); - - /** - * Called by glCompressedTexSubImage3D(). - */ - void (*CompressedTexSubImage3D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, GLint zoffset, - GLsizei width, GLint height, GLint depth, - GLenum format, - GLsizei imageSize, const GLvoid *data); + void (*CompressedTexSubImage)(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLint height, GLint depth, + GLenum format, + GLsizei imageSize, const GLvoid *data); /** * Called by glGetCompressedTexImage. diff --git a/mesalib/src/mesa/main/depth.h b/mesalib/src/mesa/main/depth.h index b1ed1f3fd..2f428629f 100644 --- a/mesalib/src/mesa/main/depth.h +++ b/mesalib/src/mesa/main/depth.h @@ -1,68 +1,68 @@ -/** - * \file depth.h - * Depth buffer operations. - */ - -/* - * Mesa 3-D graphics library - * Version: 6.3 - * - * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#ifndef DEPTH_H -#define DEPTH_H - - -#include "glheader.h" -#include "mfeatures.h" - -struct gl_context; - - -#if _HAVE_FULL_GL - -extern void GLAPIENTRY -_mesa_ClearDepth( GLclampd depth ); - -extern void GLAPIENTRY -_mesa_ClearDepthf( GLclampf depth ); - -extern void GLAPIENTRY -_mesa_DepthFunc( GLenum func ); - -extern void GLAPIENTRY -_mesa_DepthMask( GLboolean flag ); - -extern void GLAPIENTRY -_mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax ); - -extern void -_mesa_init_depth( struct gl_context * ctx ); - -#else - -/** No-op */ -#define _mesa_init_depth( c ) ((void)0) - -#endif - -#endif +/** + * \file depth.h + * Depth buffer operations. + */ + +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef DEPTH_H +#define DEPTH_H + + +#include "glheader.h" +#include "mfeatures.h" + +struct gl_context; + + +#if _HAVE_FULL_GL + +extern void GLAPIENTRY +_mesa_ClearDepth( GLclampd depth ); + +extern void GLAPIENTRY +_mesa_ClearDepthf( GLclampf depth ); + +extern void GLAPIENTRY +_mesa_DepthFunc( GLenum func ); + +extern void GLAPIENTRY +_mesa_DepthMask( GLboolean flag ); + +extern void GLAPIENTRY +_mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax ); + +extern void +_mesa_init_depth( struct gl_context * ctx ); + +#else + +/** No-op */ +#define _mesa_init_depth( c ) ((void)0) + +#endif + +#endif diff --git a/mesalib/src/mesa/main/drawtex.h b/mesalib/src/mesa/main/drawtex.h index 78bbd5b45..13ff6f97e 100644 --- a/mesalib/src/mesa/main/drawtex.h +++ b/mesalib/src/mesa/main/drawtex.h @@ -1,61 +1,61 @@ -/* - * Copyright (C) 2009 Chia-I Wu - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS 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. - */ - -#ifndef DRAWTEX_H -#define DRAWTEX_H - - -#include "glheader.h" -#include "mfeatures.h" - - -#if FEATURE_OES_draw_texture - -extern void GLAPIENTRY -_mesa_DrawTexf(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height); - -extern void GLAPIENTRY -_mesa_DrawTexfv(const GLfloat *coords); - -extern void GLAPIENTRY -_mesa_DrawTexi(GLint x, GLint y, GLint z, GLint width, GLint height); - -extern void GLAPIENTRY -_mesa_DrawTexiv(const GLint *coords); - -extern void GLAPIENTRY -_mesa_DrawTexs(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height); - -extern void GLAPIENTRY -_mesa_DrawTexsv(const GLshort *coords); - -extern void GLAPIENTRY -_mesa_DrawTexx(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height); - -extern void GLAPIENTRY -_mesa_DrawTexxv(const GLfixed *coords); - -#endif /* FEATURE_OES_draw_texture */ - - -#endif /* DRAWTEX_H */ +/* + * Copyright (C) 2009 Chia-I Wu + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + */ + +#ifndef DRAWTEX_H +#define DRAWTEX_H + + +#include "glheader.h" +#include "mfeatures.h" + + +#if FEATURE_OES_draw_texture + +extern void GLAPIENTRY +_mesa_DrawTexf(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height); + +extern void GLAPIENTRY +_mesa_DrawTexfv(const GLfloat *coords); + +extern void GLAPIENTRY +_mesa_DrawTexi(GLint x, GLint y, GLint z, GLint width, GLint height); + +extern void GLAPIENTRY +_mesa_DrawTexiv(const GLint *coords); + +extern void GLAPIENTRY +_mesa_DrawTexs(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height); + +extern void GLAPIENTRY +_mesa_DrawTexsv(const GLshort *coords); + +extern void GLAPIENTRY +_mesa_DrawTexx(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height); + +extern void GLAPIENTRY +_mesa_DrawTexxv(const GLfixed *coords); + +#endif /* FEATURE_OES_draw_texture */ + + +#endif /* DRAWTEX_H */ diff --git a/mesalib/src/mesa/main/enable.h b/mesalib/src/mesa/main/enable.h index 685e11d47..6d90c170c 100644 --- a/mesalib/src/mesa/main/enable.h +++ b/mesalib/src/mesa/main/enable.h @@ -1,71 +1,71 @@ -/** - * \file enable.h - * Enable/disable/query GL capabilities. - */ - -/* - * Mesa 3-D graphics library - * Version: 3.5 - * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#ifndef ENABLE_H -#define ENABLE_H - - -#include "glheader.h" - -struct gl_context; - - -extern void -_mesa_set_enable( struct gl_context* ctx, GLenum cap, GLboolean state ); - -extern void GLAPIENTRY -_mesa_Disable( GLenum cap ); - -extern void GLAPIENTRY -_mesa_Enable( GLenum cap ); - -extern GLboolean GLAPIENTRY -_mesa_IsEnabled( GLenum cap ); - -extern void -_mesa_set_enablei(struct gl_context *ctx, GLenum cap, GLuint index, GLboolean state); - -extern void GLAPIENTRY -_mesa_DisableIndexed( GLenum cap, GLuint index ); - -extern void GLAPIENTRY -_mesa_EnableIndexed( GLenum cap, GLuint index ); - -extern GLboolean GLAPIENTRY -_mesa_IsEnabledIndexed( GLenum cap, GLuint index ); - -extern void GLAPIENTRY -_mesa_EnableClientState( GLenum cap ); - -extern void GLAPIENTRY -_mesa_DisableClientState( GLenum cap ); - - -#endif +/** + * \file enable.h + * Enable/disable/query GL capabilities. + */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef ENABLE_H +#define ENABLE_H + + +#include "glheader.h" + +struct gl_context; + + +extern void +_mesa_set_enable( struct gl_context* ctx, GLenum cap, GLboolean state ); + +extern void GLAPIENTRY +_mesa_Disable( GLenum cap ); + +extern void GLAPIENTRY +_mesa_Enable( GLenum cap ); + +extern GLboolean GLAPIENTRY +_mesa_IsEnabled( GLenum cap ); + +extern void +_mesa_set_enablei(struct gl_context *ctx, GLenum cap, GLuint index, GLboolean state); + +extern void GLAPIENTRY +_mesa_DisableIndexed( GLenum cap, GLuint index ); + +extern void GLAPIENTRY +_mesa_EnableIndexed( GLenum cap, GLuint index ); + +extern GLboolean GLAPIENTRY +_mesa_IsEnabledIndexed( GLenum cap, GLuint index ); + +extern void GLAPIENTRY +_mesa_EnableClientState( GLenum cap ); + +extern void GLAPIENTRY +_mesa_DisableClientState( GLenum cap ); + + +#endif diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c index cd76eeb3d..2688f7ace 100644 --- a/mesalib/src/mesa/main/extensions.c +++ b/mesalib/src/mesa/main/extensions.c @@ -112,6 +112,7 @@ static const struct extension extension_table[] = { { "GL_ARB_robustness", o(dummy_true), GL, 2010 }, { "GL_ARB_sampler_objects", o(ARB_sampler_objects), GL, 2009 }, { "GL_ARB_seamless_cube_map", o(ARB_seamless_cube_map), GL, 2009 }, + { "GL_ARB_shader_bit_encoding", o(ARB_shader_bit_encoding), GL, 2010 }, { "GL_ARB_shader_objects", o(ARB_shader_objects), GL, 2002 }, { "GL_ARB_shader_stencil_export", o(ARB_shader_stencil_export), GL, 2009 }, { "GL_ARB_shader_texture_lod", o(ARB_shader_texture_lod), GL, 2009 }, diff --git a/mesalib/src/mesa/main/ffvertex_prog.h b/mesalib/src/mesa/main/ffvertex_prog.h index 6d485bb2a..837a15efc 100644 --- a/mesalib/src/mesa/main/ffvertex_prog.h +++ b/mesalib/src/mesa/main/ffvertex_prog.h @@ -1,40 +1,40 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#ifndef FFVERTEX_PROG_H -#define FFVERTEX_PROG_H - - -struct gl_context; - -struct gl_vertex_program * -_mesa_get_fixed_func_vertex_program(struct gl_context *ctx); - - - -#endif /* FFVERTEX_PROG_H */ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + +#ifndef FFVERTEX_PROG_H +#define FFVERTEX_PROG_H + + +struct gl_context; + +struct gl_vertex_program * +_mesa_get_fixed_func_vertex_program(struct gl_context *ctx); + + + +#endif /* FFVERTEX_PROG_H */ diff --git a/mesalib/src/mesa/main/fog.h b/mesalib/src/mesa/main/fog.h index 72a0657af..9191a4a54 100644 --- a/mesalib/src/mesa/main/fog.h +++ b/mesalib/src/mesa/main/fog.h @@ -1,69 +1,69 @@ -/** - * \file fog.h - * Fog operations. - * - * \if subset - * (No-op) - * - * \endif - */ - -/* - * Mesa 3-D graphics library - * Version: 3.5 - * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#ifndef FOG_H -#define FOG_H - - -#include "glheader.h" -#include "mfeatures.h" - -struct gl_context; - - -#if _HAVE_FULL_GL - -extern void GLAPIENTRY -_mesa_Fogf(GLenum pname, GLfloat param); - -extern void GLAPIENTRY -_mesa_Fogi(GLenum pname, GLint param ); - -extern void GLAPIENTRY -_mesa_Fogfv(GLenum pname, const GLfloat *params ); - -extern void GLAPIENTRY -_mesa_Fogiv(GLenum pname, const GLint *params ); - -extern void _mesa_init_fog( struct gl_context * ctx ); - -#else - -/** No-op */ -#define _mesa_init_fog( c ) ((void)0) - -#endif - -#endif +/** + * \file fog.h + * Fog operations. + * + * \if subset + * (No-op) + * + * \endif + */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef FOG_H +#define FOG_H + + +#include "glheader.h" +#include "mfeatures.h" + +struct gl_context; + + +#if _HAVE_FULL_GL + +extern void GLAPIENTRY +_mesa_Fogf(GLenum pname, GLfloat param); + +extern void GLAPIENTRY +_mesa_Fogi(GLenum pname, GLint param ); + +extern void GLAPIENTRY +_mesa_Fogfv(GLenum pname, const GLfloat *params ); + +extern void GLAPIENTRY +_mesa_Fogiv(GLenum pname, const GLint *params ); + +extern void _mesa_init_fog( struct gl_context * ctx ); + +#else + +/** No-op */ +#define _mesa_init_fog( c ) ((void)0) + +#endif + +#endif diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c index cecb70c01..ccc0b1707 100644 --- a/mesalib/src/mesa/main/formats.c +++ b/mesalib/src/mesa/main/formats.c @@ -1319,7 +1319,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = "MESA_FORMAT_RED_RGTC1", GL_RED, GL_UNSIGNED_NORMALIZED, - 4, 0, 0, 0, + 8, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 8 /* 8 bytes per 4x4 block */ }, @@ -1328,7 +1328,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = "MESA_FORMAT_SIGNED_RED_RGTC1", GL_RED, GL_SIGNED_NORMALIZED, - 4, 0, 0, 0, + 8, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 8 /* 8 bytes per 4x4 block */ }, @@ -1337,7 +1337,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = "MESA_FORMAT_RG_RGTC2", GL_RG, GL_UNSIGNED_NORMALIZED, - 4, 4, 0, 0, + 8, 8, 0, 0, 0, 0, 0, 0, 0, 4, 4, 16 /* 16 bytes per 4x4 block */ }, @@ -1346,7 +1346,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = "MESA_FORMAT_SIGNED_RG_RGTC2", GL_RG, GL_SIGNED_NORMALIZED, - 4, 4, 0, 0, + 8, 8, 0, 0, 0, 0, 0, 0, 0, 4, 4, 16 /* 16 bytes per 4x4 block */ }, diff --git a/mesalib/src/mesa/main/hint.h b/mesalib/src/mesa/main/hint.h index 3cdd2d650..6c6206874 100644 --- a/mesalib/src/mesa/main/hint.h +++ b/mesalib/src/mesa/main/hint.h @@ -1,59 +1,59 @@ -/** - * \file hint.h - * Hints operations. - * - * \if subset - * (No-op) - * - * \endif - */ - -/* - * Mesa 3-D graphics library - * Version: 4.1 - * - * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#ifndef HINT_H -#define HINT_H - -#include "glheader.h" -#include "mfeatures.h" - -struct gl_context; - -#if _HAVE_FULL_GL - -extern void GLAPIENTRY -_mesa_Hint( GLenum target, GLenum mode ); - -extern void -_mesa_init_hint( struct gl_context * ctx ); - -#else - -/** No-op */ -#define _mesa_init_hint( c ) ((void) 0) - -#endif - -#endif +/** + * \file hint.h + * Hints operations. + * + * \if subset + * (No-op) + * + * \endif + */ + +/* + * Mesa 3-D graphics library + * Version: 4.1 + * + * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef HINT_H +#define HINT_H + +#include "glheader.h" +#include "mfeatures.h" + +struct gl_context; + +#if _HAVE_FULL_GL + +extern void GLAPIENTRY +_mesa_Hint( GLenum target, GLenum mode ); + +extern void +_mesa_init_hint( struct gl_context * ctx ); + +#else + +/** No-op */ +#define _mesa_init_hint( c ) ((void) 0) + +#endif + +#endif diff --git a/mesalib/src/mesa/main/lines.h b/mesalib/src/mesa/main/lines.h index c882fc679..8e8b3f8d6 100644 --- a/mesalib/src/mesa/main/lines.h +++ b/mesalib/src/mesa/main/lines.h @@ -1,49 +1,49 @@ -/** - * \file lines.h - * Line operations. - */ - -/* - * Mesa 3-D graphics library - * Version: 3.5 - * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - - -#ifndef LINES_H -#define LINES_H - - -#include "glheader.h" - -struct gl_context; - -extern void GLAPIENTRY -_mesa_LineWidth( GLfloat width ); - -extern void GLAPIENTRY -_mesa_LineStipple( GLint factor, GLushort pattern ); - -extern void GLAPIENTRY -_mesa_init_line( struct gl_context * ctx ); - -#endif +/** + * \file lines.h + * Line operations. + */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + + +#ifndef LINES_H +#define LINES_H + + +#include "glheader.h" + +struct gl_context; + +extern void GLAPIENTRY +_mesa_LineWidth( GLfloat width ); + +extern void GLAPIENTRY +_mesa_LineStipple( GLint factor, GLushort pattern ); + +extern void GLAPIENTRY +_mesa_init_line( struct gl_context * ctx ); + +#endif diff --git a/mesalib/src/mesa/main/matrix.h b/mesalib/src/mesa/main/matrix.h index a4e7f7cfd..2878cc134 100644 --- a/mesalib/src/mesa/main/matrix.h +++ b/mesalib/src/mesa/main/matrix.h @@ -1,113 +1,113 @@ -/* - * Mesa 3-D graphics library - * Version: 7.5 - * - * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. - * Copyright (C) 2009 VMware, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#ifndef MATRIX_H -#define MATRIX_H - - -#include "glheader.h" - -struct gl_context; - -extern void GLAPIENTRY -_mesa_Frustum( GLdouble left, GLdouble right, - GLdouble bottom, GLdouble top, - GLdouble nearval, GLdouble farval ); - -extern void GLAPIENTRY -_mesa_Ortho( GLdouble left, GLdouble right, - GLdouble bottom, GLdouble top, - GLdouble nearval, GLdouble farval ); - -extern void GLAPIENTRY -_mesa_PushMatrix( void ); - -extern void GLAPIENTRY -_mesa_PopMatrix( void ); - -extern void GLAPIENTRY -_mesa_LoadIdentity( void ); - -extern void GLAPIENTRY -_mesa_LoadMatrixf( const GLfloat *m ); - -extern void GLAPIENTRY -_mesa_LoadMatrixd( const GLdouble *m ); - -extern void GLAPIENTRY -_mesa_MatrixMode( GLenum mode ); - -extern void GLAPIENTRY -_mesa_MultMatrixf( const GLfloat *m ); - -extern void GLAPIENTRY -_mesa_MultMatrixd( const GLdouble *m ); - -extern void GLAPIENTRY -_mesa_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ); - -extern void GLAPIENTRY -_mesa_Rotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z ); - -extern void GLAPIENTRY -_mesa_Scalef( GLfloat x, GLfloat y, GLfloat z ); - -extern void GLAPIENTRY -_mesa_Scaled( GLdouble x, GLdouble y, GLdouble z ); - -extern void GLAPIENTRY -_mesa_Translatef( GLfloat x, GLfloat y, GLfloat z ); - -extern void GLAPIENTRY -_mesa_Translated( GLdouble x, GLdouble y, GLdouble z ); - -extern void GLAPIENTRY -_mesa_LoadTransposeMatrixfARB( const GLfloat *m ); - -extern void GLAPIENTRY -_mesa_LoadTransposeMatrixdARB( const GLdouble *m ); - -extern void GLAPIENTRY -_mesa_MultTransposeMatrixfARB( const GLfloat *m ); - -extern void GLAPIENTRY -_mesa_MultTransposeMatrixdARB( const GLdouble *m ); - - -extern void -_mesa_init_matrix( struct gl_context * ctx ); - -extern void -_mesa_init_transform( struct gl_context *ctx ); - -extern void -_mesa_free_matrix_data( struct gl_context *ctx ); - -extern void -_mesa_update_modelview_project( struct gl_context *ctx, GLuint newstate ); - - -#endif +/* + * Mesa 3-D graphics library + * Version: 7.5 + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef MATRIX_H +#define MATRIX_H + + +#include "glheader.h" + +struct gl_context; + +extern void GLAPIENTRY +_mesa_Frustum( GLdouble left, GLdouble right, + GLdouble bottom, GLdouble top, + GLdouble nearval, GLdouble farval ); + +extern void GLAPIENTRY +_mesa_Ortho( GLdouble left, GLdouble right, + GLdouble bottom, GLdouble top, + GLdouble nearval, GLdouble farval ); + +extern void GLAPIENTRY +_mesa_PushMatrix( void ); + +extern void GLAPIENTRY +_mesa_PopMatrix( void ); + +extern void GLAPIENTRY +_mesa_LoadIdentity( void ); + +extern void GLAPIENTRY +_mesa_LoadMatrixf( const GLfloat *m ); + +extern void GLAPIENTRY +_mesa_LoadMatrixd( const GLdouble *m ); + +extern void GLAPIENTRY +_mesa_MatrixMode( GLenum mode ); + +extern void GLAPIENTRY +_mesa_MultMatrixf( const GLfloat *m ); + +extern void GLAPIENTRY +_mesa_MultMatrixd( const GLdouble *m ); + +extern void GLAPIENTRY +_mesa_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ); + +extern void GLAPIENTRY +_mesa_Rotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z ); + +extern void GLAPIENTRY +_mesa_Scalef( GLfloat x, GLfloat y, GLfloat z ); + +extern void GLAPIENTRY +_mesa_Scaled( GLdouble x, GLdouble y, GLdouble z ); + +extern void GLAPIENTRY +_mesa_Translatef( GLfloat x, GLfloat y, GLfloat z ); + +extern void GLAPIENTRY +_mesa_Translated( GLdouble x, GLdouble y, GLdouble z ); + +extern void GLAPIENTRY +_mesa_LoadTransposeMatrixfARB( const GLfloat *m ); + +extern void GLAPIENTRY +_mesa_LoadTransposeMatrixdARB( const GLdouble *m ); + +extern void GLAPIENTRY +_mesa_MultTransposeMatrixfARB( const GLfloat *m ); + +extern void GLAPIENTRY +_mesa_MultTransposeMatrixdARB( const GLdouble *m ); + + +extern void +_mesa_init_matrix( struct gl_context * ctx ); + +extern void +_mesa_init_transform( struct gl_context *ctx ); + +extern void +_mesa_free_matrix_data( struct gl_context *ctx ); + +extern void +_mesa_update_modelview_project( struct gl_context *ctx, GLuint newstate ); + + +#endif diff --git a/mesalib/src/mesa/main/mipmap.c b/mesalib/src/mesa/main/mipmap.c index abd26b8d3..250d3c6dc 100644 --- a/mesalib/src/mesa/main/mipmap.c +++ b/mesalib/src/mesa/main/mipmap.c @@ -2133,10 +2133,10 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target, } /* The image space was allocated above so use glTexSubImage now */ - ctx->Driver.TexSubImage2D(ctx, dstImage, - 0, 0, dstWidth, dstHeight, - temp_base_format, temp_datatype, - temp_dst, &ctx->DefaultPacking); + ctx->Driver.TexSubImage(ctx, 2, dstImage, + 0, 0, 0, dstWidth, dstHeight, 1, + temp_base_format, temp_datatype, + temp_dst, &ctx->DefaultPacking); /* swap src and dest pointers */ { diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index 3a8cac9c5..ea40ffc9c 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -2895,6 +2895,7 @@ struct gl_extensions GLboolean ARB_point_sprite; GLboolean ARB_sampler_objects; GLboolean ARB_seamless_cube_map; + GLboolean ARB_shader_bit_encoding; GLboolean ARB_shader_objects; GLboolean ARB_shader_stencil_export; GLboolean ARB_shader_texture_lod; diff --git a/mesalib/src/mesa/main/multisample.c b/mesalib/src/mesa/main/multisample.c index 4eb1ab3a3..67fdb8c9d 100644 --- a/mesalib/src/mesa/main/multisample.c +++ b/mesalib/src/mesa/main/multisample.c @@ -1,62 +1,62 @@ -/* - * Mesa 3-D graphics library - * Version: 7.1 - * - * 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"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#include "main/glheader.h" -#include "main/context.h" -#include "main/macros.h" -#include "main/multisample.h" -#include "main/mtypes.h" - - -/** - * Called via glSampleCoverageARB - */ -void GLAPIENTRY -_mesa_SampleCoverageARB(GLclampf value, GLboolean invert) -{ - GET_CURRENT_CONTEXT(ctx); - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx ); - - ctx->Multisample.SampleCoverageValue = (GLfloat) CLAMP(value, 0.0, 1.0); - ctx->Multisample.SampleCoverageInvert = invert; - ctx->NewState |= _NEW_MULTISAMPLE; -} - - -/** - * Initialize the context's multisample state. - * \param ctx the GL context. - */ -void -_mesa_init_multisample(struct gl_context *ctx) -{ - ctx->Multisample.Enabled = GL_TRUE; - ctx->Multisample.SampleAlphaToCoverage = GL_FALSE; - ctx->Multisample.SampleAlphaToOne = GL_FALSE; - ctx->Multisample.SampleCoverage = GL_FALSE; - ctx->Multisample.SampleCoverageValue = 1.0; - ctx->Multisample.SampleCoverageInvert = GL_FALSE; -} +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * 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"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#include "main/glheader.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/multisample.h" +#include "main/mtypes.h" + + +/** + * Called via glSampleCoverageARB + */ +void GLAPIENTRY +_mesa_SampleCoverageARB(GLclampf value, GLboolean invert) +{ + GET_CURRENT_CONTEXT(ctx); + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx ); + + ctx->Multisample.SampleCoverageValue = (GLfloat) CLAMP(value, 0.0, 1.0); + ctx->Multisample.SampleCoverageInvert = invert; + ctx->NewState |= _NEW_MULTISAMPLE; +} + + +/** + * Initialize the context's multisample state. + * \param ctx the GL context. + */ +void +_mesa_init_multisample(struct gl_context *ctx) +{ + ctx->Multisample.Enabled = GL_TRUE; + ctx->Multisample.SampleAlphaToCoverage = GL_FALSE; + ctx->Multisample.SampleAlphaToOne = GL_FALSE; + ctx->Multisample.SampleCoverage = GL_FALSE; + ctx->Multisample.SampleCoverageValue = 1.0; + ctx->Multisample.SampleCoverageInvert = GL_FALSE; +} diff --git a/mesalib/src/mesa/main/multisample.h b/mesalib/src/mesa/main/multisample.h index c1c967bbe..e86d4092b 100644 --- a/mesalib/src/mesa/main/multisample.h +++ b/mesalib/src/mesa/main/multisample.h @@ -1,41 +1,41 @@ -/* - * Mesa 3-D graphics library - * Version: 7.1 - * - * 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"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#ifndef MULTISAMPLE_H -#define MULTISAMPLE_H - -#include "glheader.h" - -struct gl_context; - -extern void GLAPIENTRY -_mesa_SampleCoverageARB(GLclampf value, GLboolean invert); - - -extern void -_mesa_init_multisample(struct gl_context *ctx); - - -#endif +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * 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"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef MULTISAMPLE_H +#define MULTISAMPLE_H + +#include "glheader.h" + +struct gl_context; + +extern void GLAPIENTRY +_mesa_SampleCoverageARB(GLclampf value, GLboolean invert); + + +extern void +_mesa_init_multisample(struct gl_context *ctx); + + +#endif diff --git a/mesalib/src/mesa/main/pixelstore.h b/mesalib/src/mesa/main/pixelstore.h index 2995beb10..eb5081974 100644 --- a/mesalib/src/mesa/main/pixelstore.h +++ b/mesalib/src/mesa/main/pixelstore.h @@ -1,52 +1,52 @@ -/* - * Mesa 3-D graphics library - * Version: 7.1 - * - * 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"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file pixelstore.h - * glPixelStore functions. - */ - - -#ifndef PIXELSTORE_H -#define PIXELSTORE_H - - -#include "glheader.h" - -struct gl_context; - - -extern void GLAPIENTRY -_mesa_PixelStorei( GLenum pname, GLint param ); - - -extern void GLAPIENTRY -_mesa_PixelStoref( GLenum pname, GLfloat param ); - - -extern void -_mesa_init_pixelstore( struct gl_context *ctx ); - - -#endif +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * 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"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * \file pixelstore.h + * glPixelStore functions. + */ + + +#ifndef PIXELSTORE_H +#define PIXELSTORE_H + + +#include "glheader.h" + +struct gl_context; + + +extern void GLAPIENTRY +_mesa_PixelStorei( GLenum pname, GLint param ); + + +extern void GLAPIENTRY +_mesa_PixelStoref( GLenum pname, GLfloat param ); + + +extern void +_mesa_init_pixelstore( struct gl_context *ctx ); + + +#endif diff --git a/mesalib/src/mesa/main/points.c b/mesalib/src/mesa/main/points.c index 78d40f61c..87bfae27e 100644 --- a/mesalib/src/mesa/main/points.c +++ b/mesalib/src/mesa/main/points.c @@ -1,272 +1,272 @@ -/** - * \file points.c - * Point operations. - */ - -/* - * Mesa 3-D graphics library - * Version: 7.1 - * - * 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"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#include "glheader.h" -#include "context.h" -#include "macros.h" -#include "points.h" -#include "mtypes.h" - - -/** - * Set current point size. - * \param size point diameter in pixels - * \sa glPointSize(). - */ -void GLAPIENTRY -_mesa_PointSize( GLfloat size ) -{ - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (size <= 0.0) { - _mesa_error( ctx, GL_INVALID_VALUE, "glPointSize" ); - return; - } - - if (ctx->Point.Size == size) - return; - - FLUSH_VERTICES(ctx, _NEW_POINT); - ctx->Point.Size = size; - - if (ctx->Driver.PointSize) - ctx->Driver.PointSize(ctx, size); -} - - -#if _HAVE_FULL_GL - - -void GLAPIENTRY -_mesa_PointParameteri( GLenum pname, GLint param ) -{ - GLfloat p[3]; - p[0] = (GLfloat) param; - p[1] = p[2] = 0.0F; - _mesa_PointParameterfv(pname, p); -} - - -void GLAPIENTRY -_mesa_PointParameteriv( GLenum pname, const GLint *params ) -{ - GLfloat p[3]; - p[0] = (GLfloat) params[0]; - if (pname == GL_DISTANCE_ATTENUATION_EXT) { - p[1] = (GLfloat) params[1]; - p[2] = (GLfloat) params[2]; - } - _mesa_PointParameterfv(pname, p); -} - - -void GLAPIENTRY -_mesa_PointParameterf( GLenum pname, GLfloat param) -{ - GLfloat p[3]; - p[0] = param; - p[1] = p[2] = 0.0F; - _mesa_PointParameterfv(pname, p); -} - - -void GLAPIENTRY -_mesa_PointParameterfv( GLenum pname, const GLfloat *params) -{ - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - switch (pname) { - case GL_DISTANCE_ATTENUATION_EXT: - if (ctx->Extensions.EXT_point_parameters) { - if (TEST_EQ_3V(ctx->Point.Params, params)) - return; - FLUSH_VERTICES(ctx, _NEW_POINT); - COPY_3V(ctx->Point.Params, params); - ctx->Point._Attenuated = (ctx->Point.Params[0] != 1.0 || - ctx->Point.Params[1] != 0.0 || - ctx->Point.Params[2] != 0.0); - - if (ctx->Point._Attenuated) - ctx->_TriangleCaps |= DD_POINT_ATTEN; - else - ctx->_TriangleCaps &= ~DD_POINT_ATTEN; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glPointParameterf[v]{EXT,ARB}(pname)"); - return; - } - break; - case GL_POINT_SIZE_MIN_EXT: - if (ctx->Extensions.EXT_point_parameters) { - if (params[0] < 0.0F) { - _mesa_error( ctx, GL_INVALID_VALUE, - "glPointParameterf[v]{EXT,ARB}(param)" ); - return; - } - if (ctx->Point.MinSize == params[0]) - return; - FLUSH_VERTICES(ctx, _NEW_POINT); - ctx->Point.MinSize = params[0]; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glPointParameterf[v]{EXT,ARB}(pname)"); - return; - } - break; - case GL_POINT_SIZE_MAX_EXT: - if (ctx->Extensions.EXT_point_parameters) { - if (params[0] < 0.0F) { - _mesa_error( ctx, GL_INVALID_VALUE, - "glPointParameterf[v]{EXT,ARB}(param)" ); - return; - } - if (ctx->Point.MaxSize == params[0]) - return; - FLUSH_VERTICES(ctx, _NEW_POINT); - ctx->Point.MaxSize = params[0]; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glPointParameterf[v]{EXT,ARB}(pname)"); - return; - } - break; - case GL_POINT_FADE_THRESHOLD_SIZE_EXT: - if (ctx->Extensions.EXT_point_parameters) { - if (params[0] < 0.0F) { - _mesa_error( ctx, GL_INVALID_VALUE, - "glPointParameterf[v]{EXT,ARB}(param)" ); - return; - } - if (ctx->Point.Threshold == params[0]) - return; - FLUSH_VERTICES(ctx, _NEW_POINT); - ctx->Point.Threshold = params[0]; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glPointParameterf[v]{EXT,ARB}(pname)"); - return; - } - break; - case GL_POINT_SPRITE_R_MODE_NV: - /* This is one area where ARB_point_sprite and NV_point_sprite - * differ. In ARB_point_sprite the POINT_SPRITE_R_MODE is - * always ZERO. NV_point_sprite adds the S and R modes. - */ - if (ctx->Extensions.NV_point_sprite) { - GLenum value = (GLenum) params[0]; - if (value != GL_ZERO && value != GL_S && value != GL_R) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glPointParameterf[v]{EXT,ARB}(param)"); - return; - } - if (ctx->Point.SpriteRMode == value) - return; - FLUSH_VERTICES(ctx, _NEW_POINT); - ctx->Point.SpriteRMode = value; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glPointParameterf[v]{EXT,ARB}(pname)"); - return; - } - break; - case GL_POINT_SPRITE_COORD_ORIGIN: - /* This is not completely correct. GL_POINT_SPRITE_COORD_ORIGIN was - * added to point sprites when the extension was merged into OpenGL - * 2.0. It is expected that an implementation supporting OpenGL 1.4 - * and GL_ARB_point_sprite will generate an error here. - */ - if (ctx->Extensions.ARB_point_sprite) { - GLenum value = (GLenum) params[0]; - if (value != GL_LOWER_LEFT && value != GL_UPPER_LEFT) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glPointParameterf[v]{EXT,ARB}(param)"); - return; - } - if (ctx->Point.SpriteOrigin == value) - return; - FLUSH_VERTICES(ctx, _NEW_POINT); - ctx->Point.SpriteOrigin = value; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glPointParameterf[v]{EXT,ARB}(pname)"); - return; - } - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, - "glPointParameterf[v]{EXT,ARB}(pname)" ); - return; - } - - if (ctx->Driver.PointParameterfv) - (*ctx->Driver.PointParameterfv)(ctx, pname, params); -} -#endif - - - -/** - * Initialize the context point state. - * - * \param ctx GL context. - * - * Initializes __struct gl_contextRec::Point and point related constants in - * __struct gl_contextRec::Const. - */ -void -_mesa_init_point(struct gl_context *ctx) -{ - GLuint i; - - ctx->Point.SmoothFlag = GL_FALSE; - ctx->Point.Size = 1.0; - ctx->Point.Params[0] = 1.0; - ctx->Point.Params[1] = 0.0; - ctx->Point.Params[2] = 0.0; - ctx->Point._Attenuated = GL_FALSE; - ctx->Point.MinSize = 0.0; - ctx->Point.MaxSize - = MAX2(ctx->Const.MaxPointSize, ctx->Const.MaxPointSizeAA); - ctx->Point.Threshold = 1.0; - ctx->Point.PointSprite = GL_FALSE; /* GL_ARB/NV_point_sprite */ - ctx->Point.SpriteRMode = GL_ZERO; /* GL_NV_point_sprite (only!) */ - ctx->Point.SpriteOrigin = GL_UPPER_LEFT; /* GL_ARB_point_sprite */ - for (i = 0; i < Elements(ctx->Point.CoordReplace); i++) { - ctx->Point.CoordReplace[i] = GL_FALSE; /* GL_ARB/NV_point_sprite */ - } -} +/** + * \file points.c + * Point operations. + */ + +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * 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"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#include "glheader.h" +#include "context.h" +#include "macros.h" +#include "points.h" +#include "mtypes.h" + + +/** + * Set current point size. + * \param size point diameter in pixels + * \sa glPointSize(). + */ +void GLAPIENTRY +_mesa_PointSize( GLfloat size ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (size <= 0.0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glPointSize" ); + return; + } + + if (ctx->Point.Size == size) + return; + + FLUSH_VERTICES(ctx, _NEW_POINT); + ctx->Point.Size = size; + + if (ctx->Driver.PointSize) + ctx->Driver.PointSize(ctx, size); +} + + +#if _HAVE_FULL_GL + + +void GLAPIENTRY +_mesa_PointParameteri( GLenum pname, GLint param ) +{ + GLfloat p[3]; + p[0] = (GLfloat) param; + p[1] = p[2] = 0.0F; + _mesa_PointParameterfv(pname, p); +} + + +void GLAPIENTRY +_mesa_PointParameteriv( GLenum pname, const GLint *params ) +{ + GLfloat p[3]; + p[0] = (GLfloat) params[0]; + if (pname == GL_DISTANCE_ATTENUATION_EXT) { + p[1] = (GLfloat) params[1]; + p[2] = (GLfloat) params[2]; + } + _mesa_PointParameterfv(pname, p); +} + + +void GLAPIENTRY +_mesa_PointParameterf( GLenum pname, GLfloat param) +{ + GLfloat p[3]; + p[0] = param; + p[1] = p[2] = 0.0F; + _mesa_PointParameterfv(pname, p); +} + + +void GLAPIENTRY +_mesa_PointParameterfv( GLenum pname, const GLfloat *params) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + switch (pname) { + case GL_DISTANCE_ATTENUATION_EXT: + if (ctx->Extensions.EXT_point_parameters) { + if (TEST_EQ_3V(ctx->Point.Params, params)) + return; + FLUSH_VERTICES(ctx, _NEW_POINT); + COPY_3V(ctx->Point.Params, params); + ctx->Point._Attenuated = (ctx->Point.Params[0] != 1.0 || + ctx->Point.Params[1] != 0.0 || + ctx->Point.Params[2] != 0.0); + + if (ctx->Point._Attenuated) + ctx->_TriangleCaps |= DD_POINT_ATTEN; + else + ctx->_TriangleCaps &= ~DD_POINT_ATTEN; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glPointParameterf[v]{EXT,ARB}(pname)"); + return; + } + break; + case GL_POINT_SIZE_MIN_EXT: + if (ctx->Extensions.EXT_point_parameters) { + if (params[0] < 0.0F) { + _mesa_error( ctx, GL_INVALID_VALUE, + "glPointParameterf[v]{EXT,ARB}(param)" ); + return; + } + if (ctx->Point.MinSize == params[0]) + return; + FLUSH_VERTICES(ctx, _NEW_POINT); + ctx->Point.MinSize = params[0]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glPointParameterf[v]{EXT,ARB}(pname)"); + return; + } + break; + case GL_POINT_SIZE_MAX_EXT: + if (ctx->Extensions.EXT_point_parameters) { + if (params[0] < 0.0F) { + _mesa_error( ctx, GL_INVALID_VALUE, + "glPointParameterf[v]{EXT,ARB}(param)" ); + return; + } + if (ctx->Point.MaxSize == params[0]) + return; + FLUSH_VERTICES(ctx, _NEW_POINT); + ctx->Point.MaxSize = params[0]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glPointParameterf[v]{EXT,ARB}(pname)"); + return; + } + break; + case GL_POINT_FADE_THRESHOLD_SIZE_EXT: + if (ctx->Extensions.EXT_point_parameters) { + if (params[0] < 0.0F) { + _mesa_error( ctx, GL_INVALID_VALUE, + "glPointParameterf[v]{EXT,ARB}(param)" ); + return; + } + if (ctx->Point.Threshold == params[0]) + return; + FLUSH_VERTICES(ctx, _NEW_POINT); + ctx->Point.Threshold = params[0]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glPointParameterf[v]{EXT,ARB}(pname)"); + return; + } + break; + case GL_POINT_SPRITE_R_MODE_NV: + /* This is one area where ARB_point_sprite and NV_point_sprite + * differ. In ARB_point_sprite the POINT_SPRITE_R_MODE is + * always ZERO. NV_point_sprite adds the S and R modes. + */ + if (ctx->Extensions.NV_point_sprite) { + GLenum value = (GLenum) params[0]; + if (value != GL_ZERO && value != GL_S && value != GL_R) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glPointParameterf[v]{EXT,ARB}(param)"); + return; + } + if (ctx->Point.SpriteRMode == value) + return; + FLUSH_VERTICES(ctx, _NEW_POINT); + ctx->Point.SpriteRMode = value; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glPointParameterf[v]{EXT,ARB}(pname)"); + return; + } + break; + case GL_POINT_SPRITE_COORD_ORIGIN: + /* This is not completely correct. GL_POINT_SPRITE_COORD_ORIGIN was + * added to point sprites when the extension was merged into OpenGL + * 2.0. It is expected that an implementation supporting OpenGL 1.4 + * and GL_ARB_point_sprite will generate an error here. + */ + if (ctx->Extensions.ARB_point_sprite) { + GLenum value = (GLenum) params[0]; + if (value != GL_LOWER_LEFT && value != GL_UPPER_LEFT) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glPointParameterf[v]{EXT,ARB}(param)"); + return; + } + if (ctx->Point.SpriteOrigin == value) + return; + FLUSH_VERTICES(ctx, _NEW_POINT); + ctx->Point.SpriteOrigin = value; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glPointParameterf[v]{EXT,ARB}(pname)"); + return; + } + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, + "glPointParameterf[v]{EXT,ARB}(pname)" ); + return; + } + + if (ctx->Driver.PointParameterfv) + (*ctx->Driver.PointParameterfv)(ctx, pname, params); +} +#endif + + + +/** + * Initialize the context point state. + * + * \param ctx GL context. + * + * Initializes __struct gl_contextRec::Point and point related constants in + * __struct gl_contextRec::Const. + */ +void +_mesa_init_point(struct gl_context *ctx) +{ + GLuint i; + + ctx->Point.SmoothFlag = GL_FALSE; + ctx->Point.Size = 1.0; + ctx->Point.Params[0] = 1.0; + ctx->Point.Params[1] = 0.0; + ctx->Point.Params[2] = 0.0; + ctx->Point._Attenuated = GL_FALSE; + ctx->Point.MinSize = 0.0; + ctx->Point.MaxSize + = MAX2(ctx->Const.MaxPointSize, ctx->Const.MaxPointSizeAA); + ctx->Point.Threshold = 1.0; + ctx->Point.PointSprite = GL_FALSE; /* GL_ARB/NV_point_sprite */ + ctx->Point.SpriteRMode = GL_ZERO; /* GL_NV_point_sprite (only!) */ + ctx->Point.SpriteOrigin = GL_UPPER_LEFT; /* GL_ARB_point_sprite */ + for (i = 0; i < Elements(ctx->Point.CoordReplace); i++) { + ctx->Point.CoordReplace[i] = GL_FALSE; /* GL_ARB/NV_point_sprite */ + } +} diff --git a/mesalib/src/mesa/main/points.h b/mesalib/src/mesa/main/points.h index 442053c8f..306a8a572 100644 --- a/mesalib/src/mesa/main/points.h +++ b/mesalib/src/mesa/main/points.h @@ -1,59 +1,59 @@ -/** - * \file points.h - * Point operations. - */ - -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#ifndef POINTS_H -#define POINTS_H - - -#include "glheader.h" - -struct gl_context; - - -extern void GLAPIENTRY -_mesa_PointSize( GLfloat size ); - -extern void GLAPIENTRY -_mesa_PointParameteri( GLenum pname, GLint param ); - -extern void GLAPIENTRY -_mesa_PointParameteriv( GLenum pname, const GLint *params ); - -extern void GLAPIENTRY -_mesa_PointParameterf( GLenum pname, GLfloat param ); - -extern void GLAPIENTRY -_mesa_PointParameterfv( GLenum pname, const GLfloat *params ); - -extern void -_mesa_init_point( struct gl_context * ctx ); - - -#endif +/** + * \file points.h + * Point operations. + */ + +/* + * Mesa 3-D graphics library + * Version: 6.5 + * + * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef POINTS_H +#define POINTS_H + + +#include "glheader.h" + +struct gl_context; + + +extern void GLAPIENTRY +_mesa_PointSize( GLfloat size ); + +extern void GLAPIENTRY +_mesa_PointParameteri( GLenum pname, GLint param ); + +extern void GLAPIENTRY +_mesa_PointParameteriv( GLenum pname, const GLint *params ); + +extern void GLAPIENTRY +_mesa_PointParameterf( GLenum pname, GLfloat param ); + +extern void GLAPIENTRY +_mesa_PointParameterfv( GLenum pname, const GLfloat *params ); + +extern void +_mesa_init_point( struct gl_context * ctx ); + + +#endif diff --git a/mesalib/src/mesa/main/rastpos.c b/mesalib/src/mesa/main/rastpos.c index 70f67d398..a1f6f4234 100644 --- a/mesalib/src/mesa/main/rastpos.c +++ b/mesalib/src/mesa/main/rastpos.c @@ -1,566 +1,566 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.3 - * - * 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"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -/** - * \file rastpos.c - * Raster position operations. - */ - -#include "glheader.h" -#include "context.h" -#include "feedback.h" -#include "macros.h" -#include "mfeatures.h" -#include "mtypes.h" -#include "rastpos.h" -#include "state.h" -#include "main/dispatch.h" - - -#if FEATURE_rastpos - - -/** - * Helper function for all the RasterPos functions. - */ -static void -rasterpos(GLfloat x, GLfloat y, GLfloat z, GLfloat w) -{ - GET_CURRENT_CONTEXT(ctx); - GLfloat p[4]; - - p[0] = x; - p[1] = y; - p[2] = z; - p[3] = w; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - FLUSH_CURRENT(ctx, 0); - - if (ctx->NewState) - _mesa_update_state( ctx ); - - ctx->Driver.RasterPos(ctx, p); -} - - -static void GLAPIENTRY -_mesa_RasterPos2d(GLdouble x, GLdouble y) -{ - rasterpos((GLfloat)x, (GLfloat)y, (GLfloat)0.0, (GLfloat)1.0); -} - -static void GLAPIENTRY -_mesa_RasterPos2f(GLfloat x, GLfloat y) -{ - rasterpos(x, y, 0.0F, 1.0F); -} - -static void GLAPIENTRY -_mesa_RasterPos2i(GLint x, GLint y) -{ - rasterpos((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); -} - -static void GLAPIENTRY -_mesa_RasterPos2s(GLshort x, GLshort y) -{ - rasterpos(x, y, 0.0F, 1.0F); -} - -static void GLAPIENTRY -_mesa_RasterPos3d(GLdouble x, GLdouble y, GLdouble z) -{ - rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); -} - -static void GLAPIENTRY -_mesa_RasterPos3f(GLfloat x, GLfloat y, GLfloat z) -{ - rasterpos(x, y, z, 1.0F); -} - -static void GLAPIENTRY -_mesa_RasterPos3i(GLint x, GLint y, GLint z) -{ - rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); -} - -static void GLAPIENTRY -_mesa_RasterPos3s(GLshort x, GLshort y, GLshort z) -{ - rasterpos(x, y, z, 1.0F); -} - -static void GLAPIENTRY -_mesa_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w) -{ - rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); -} - -static void GLAPIENTRY -_mesa_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) -{ - rasterpos(x, y, z, w); -} - -static void GLAPIENTRY -_mesa_RasterPos4i(GLint x, GLint y, GLint z, GLint w) -{ - rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); -} - -static void GLAPIENTRY -_mesa_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w) -{ - rasterpos(x, y, z, w); -} - -static void GLAPIENTRY -_mesa_RasterPos2dv(const GLdouble *v) -{ - rasterpos((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); -} - -static void GLAPIENTRY -_mesa_RasterPos2fv(const GLfloat *v) -{ - rasterpos(v[0], v[1], 0.0F, 1.0F); -} - -static void GLAPIENTRY -_mesa_RasterPos2iv(const GLint *v) -{ - rasterpos((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); -} - -static void GLAPIENTRY -_mesa_RasterPos2sv(const GLshort *v) -{ - rasterpos(v[0], v[1], 0.0F, 1.0F); -} - -static void GLAPIENTRY -_mesa_RasterPos3dv(const GLdouble *v) -{ - rasterpos((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); -} - -static void GLAPIENTRY -_mesa_RasterPos3fv(const GLfloat *v) -{ - rasterpos(v[0], v[1], v[2], 1.0F); -} - -static void GLAPIENTRY -_mesa_RasterPos3iv(const GLint *v) -{ - rasterpos((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); -} - -static void GLAPIENTRY -_mesa_RasterPos3sv(const GLshort *v) -{ - rasterpos(v[0], v[1], v[2], 1.0F); -} - -static void GLAPIENTRY -_mesa_RasterPos4dv(const GLdouble *v) -{ - rasterpos((GLfloat) v[0], (GLfloat) v[1], - (GLfloat) v[2], (GLfloat) v[3]); -} - -static void GLAPIENTRY -_mesa_RasterPos4fv(const GLfloat *v) -{ - rasterpos(v[0], v[1], v[2], v[3]); -} - -static void GLAPIENTRY -_mesa_RasterPos4iv(const GLint *v) -{ - rasterpos((GLfloat) v[0], (GLfloat) v[1], - (GLfloat) v[2], (GLfloat) v[3]); -} - -static void GLAPIENTRY -_mesa_RasterPos4sv(const GLshort *v) -{ - rasterpos(v[0], v[1], v[2], v[3]); -} - - -/**********************************************************************/ -/*** GL_ARB_window_pos / GL_MESA_window_pos ***/ -/**********************************************************************/ - - -/** - * All glWindowPosMESA and glWindowPosARB commands call this function to - * update the current raster position. - */ -static void -window_pos3f(GLfloat x, GLfloat y, GLfloat z) -{ - GET_CURRENT_CONTEXT(ctx); - GLfloat z2; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - FLUSH_CURRENT(ctx, 0); - - z2 = CLAMP(z, 0.0F, 1.0F) * (ctx->Viewport.Far - ctx->Viewport.Near) - + ctx->Viewport.Near; - - /* set raster position */ - ctx->Current.RasterPos[0] = x; - ctx->Current.RasterPos[1] = y; - ctx->Current.RasterPos[2] = z2; - ctx->Current.RasterPos[3] = 1.0F; - - ctx->Current.RasterPosValid = GL_TRUE; - - if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) - ctx->Current.RasterDistance = ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; - else - ctx->Current.RasterDistance = 0.0; - - /* raster color = current color or index */ - ctx->Current.RasterColor[0] - = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0], 0.0F, 1.0F); - ctx->Current.RasterColor[1] - = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1], 0.0F, 1.0F); - ctx->Current.RasterColor[2] - = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2], 0.0F, 1.0F); - ctx->Current.RasterColor[3] - = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3], 0.0F, 1.0F); - ctx->Current.RasterSecondaryColor[0] - = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0], 0.0F, 1.0F); - ctx->Current.RasterSecondaryColor[1] - = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1], 0.0F, 1.0F); - ctx->Current.RasterSecondaryColor[2] - = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2], 0.0F, 1.0F); - ctx->Current.RasterSecondaryColor[3] - = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3], 0.0F, 1.0F); - - /* raster texcoord = current texcoord */ - { - GLuint texSet; - for (texSet = 0; texSet < ctx->Const.MaxTextureCoordUnits; texSet++) { - assert(texSet < Elements(ctx->Current.RasterTexCoords)); - COPY_4FV( ctx->Current.RasterTexCoords[texSet], - ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texSet] ); - } - } - - if (ctx->RenderMode==GL_SELECT) { - _mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] ); - } -} - - -/* This is just to support the GL_MESA_window_pos version */ -static void -window_pos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) -{ - GET_CURRENT_CONTEXT(ctx); - window_pos3f(x, y, z); - ctx->Current.RasterPos[3] = w; -} - - -static void GLAPIENTRY -_mesa_WindowPos2dMESA(GLdouble x, GLdouble y) -{ - window_pos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); -} - -static void GLAPIENTRY -_mesa_WindowPos2fMESA(GLfloat x, GLfloat y) -{ - window_pos4f(x, y, 0.0F, 1.0F); -} - -static void GLAPIENTRY -_mesa_WindowPos2iMESA(GLint x, GLint y) -{ - window_pos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); -} - -static void GLAPIENTRY -_mesa_WindowPos2sMESA(GLshort x, GLshort y) -{ - window_pos4f(x, y, 0.0F, 1.0F); -} - -static void GLAPIENTRY -_mesa_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z) -{ - window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); -} - -static void GLAPIENTRY -_mesa_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z) -{ - window_pos4f(x, y, z, 1.0F); -} - -static void GLAPIENTRY -_mesa_WindowPos3iMESA(GLint x, GLint y, GLint z) -{ - window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); -} - -static void GLAPIENTRY -_mesa_WindowPos3sMESA(GLshort x, GLshort y, GLshort z) -{ - window_pos4f(x, y, z, 1.0F); -} - -static void GLAPIENTRY -_mesa_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w) -{ - window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); -} - -static void GLAPIENTRY -_mesa_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w) -{ - window_pos4f(x, y, z, w); -} - -static void GLAPIENTRY -_mesa_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w) -{ - window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); -} - -static void GLAPIENTRY -_mesa_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w) -{ - window_pos4f(x, y, z, w); -} - -static void GLAPIENTRY -_mesa_WindowPos2dvMESA(const GLdouble *v) -{ - window_pos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); -} - -static void GLAPIENTRY -_mesa_WindowPos2fvMESA(const GLfloat *v) -{ - window_pos4f(v[0], v[1], 0.0F, 1.0F); -} - -static void GLAPIENTRY -_mesa_WindowPos2ivMESA(const GLint *v) -{ - window_pos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); -} - -static void GLAPIENTRY -_mesa_WindowPos2svMESA(const GLshort *v) -{ - window_pos4f(v[0], v[1], 0.0F, 1.0F); -} - -static void GLAPIENTRY -_mesa_WindowPos3dvMESA(const GLdouble *v) -{ - window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); -} - -static void GLAPIENTRY -_mesa_WindowPos3fvMESA(const GLfloat *v) -{ - window_pos4f(v[0], v[1], v[2], 1.0); -} - -static void GLAPIENTRY -_mesa_WindowPos3ivMESA(const GLint *v) -{ - window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); -} - -static void GLAPIENTRY -_mesa_WindowPos3svMESA(const GLshort *v) -{ - window_pos4f(v[0], v[1], v[2], 1.0F); -} - -static void GLAPIENTRY -_mesa_WindowPos4dvMESA(const GLdouble *v) -{ - window_pos4f((GLfloat) v[0], (GLfloat) v[1], - (GLfloat) v[2], (GLfloat) v[3]); -} - -static void GLAPIENTRY -_mesa_WindowPos4fvMESA(const GLfloat *v) -{ - window_pos4f(v[0], v[1], v[2], v[3]); -} - -static void GLAPIENTRY -_mesa_WindowPos4ivMESA(const GLint *v) -{ - window_pos4f((GLfloat) v[0], (GLfloat) v[1], - (GLfloat) v[2], (GLfloat) v[3]); -} - -static void GLAPIENTRY -_mesa_WindowPos4svMESA(const GLshort *v) -{ - window_pos4f(v[0], v[1], v[2], v[3]); -} - - -#if 0 - -/* - * OpenGL implementation of glWindowPos*MESA() - */ -void glWindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) -{ - GLfloat fx, fy; - - /* Push current matrix mode and viewport attributes */ - glPushAttrib( GL_TRANSFORM_BIT | GL_VIEWPORT_BIT ); - - /* Setup projection parameters */ - glMatrixMode( GL_PROJECTION ); - glPushMatrix(); - glLoadIdentity(); - glMatrixMode( GL_MODELVIEW ); - glPushMatrix(); - glLoadIdentity(); - - glDepthRange( z, z ); - glViewport( (int) x - 1, (int) y - 1, 2, 2 ); - - /* set the raster (window) position */ - fx = x - (int) x; - fy = y - (int) y; - glRasterPos4f( fx, fy, 0.0, w ); - - /* restore matrices, viewport and matrix mode */ - glPopMatrix(); - glMatrixMode( GL_PROJECTION ); - glPopMatrix(); - - glPopAttrib(); -} - -#endif - - -void -_mesa_init_rastpos_dispatch(struct _glapi_table *disp) -{ - SET_RasterPos2f(disp, _mesa_RasterPos2f); - SET_RasterPos2fv(disp, _mesa_RasterPos2fv); - SET_RasterPos2i(disp, _mesa_RasterPos2i); - SET_RasterPos2iv(disp, _mesa_RasterPos2iv); - SET_RasterPos2d(disp, _mesa_RasterPos2d); - SET_RasterPos2dv(disp, _mesa_RasterPos2dv); - SET_RasterPos2s(disp, _mesa_RasterPos2s); - SET_RasterPos2sv(disp, _mesa_RasterPos2sv); - SET_RasterPos3d(disp, _mesa_RasterPos3d); - SET_RasterPos3dv(disp, _mesa_RasterPos3dv); - SET_RasterPos3f(disp, _mesa_RasterPos3f); - SET_RasterPos3fv(disp, _mesa_RasterPos3fv); - SET_RasterPos3i(disp, _mesa_RasterPos3i); - SET_RasterPos3iv(disp, _mesa_RasterPos3iv); - SET_RasterPos3s(disp, _mesa_RasterPos3s); - SET_RasterPos3sv(disp, _mesa_RasterPos3sv); - SET_RasterPos4d(disp, _mesa_RasterPos4d); - SET_RasterPos4dv(disp, _mesa_RasterPos4dv); - SET_RasterPos4f(disp, _mesa_RasterPos4f); - SET_RasterPos4fv(disp, _mesa_RasterPos4fv); - SET_RasterPos4i(disp, _mesa_RasterPos4i); - SET_RasterPos4iv(disp, _mesa_RasterPos4iv); - SET_RasterPos4s(disp, _mesa_RasterPos4s); - SET_RasterPos4sv(disp, _mesa_RasterPos4sv); - - /* 197. GL_MESA_window_pos */ - SET_WindowPos2dMESA(disp, _mesa_WindowPos2dMESA); - SET_WindowPos2dvMESA(disp, _mesa_WindowPos2dvMESA); - SET_WindowPos2fMESA(disp, _mesa_WindowPos2fMESA); - SET_WindowPos2fvMESA(disp, _mesa_WindowPos2fvMESA); - SET_WindowPos2iMESA(disp, _mesa_WindowPos2iMESA); - SET_WindowPos2ivMESA(disp, _mesa_WindowPos2ivMESA); - SET_WindowPos2sMESA(disp, _mesa_WindowPos2sMESA); - SET_WindowPos2svMESA(disp, _mesa_WindowPos2svMESA); - SET_WindowPos3dMESA(disp, _mesa_WindowPos3dMESA); - SET_WindowPos3dvMESA(disp, _mesa_WindowPos3dvMESA); - SET_WindowPos3fMESA(disp, _mesa_WindowPos3fMESA); - SET_WindowPos3fvMESA(disp, _mesa_WindowPos3fvMESA); - SET_WindowPos3iMESA(disp, _mesa_WindowPos3iMESA); - SET_WindowPos3ivMESA(disp, _mesa_WindowPos3ivMESA); - SET_WindowPos3sMESA(disp, _mesa_WindowPos3sMESA); - SET_WindowPos3svMESA(disp, _mesa_WindowPos3svMESA); - SET_WindowPos4dMESA(disp, _mesa_WindowPos4dMESA); - SET_WindowPos4dvMESA(disp, _mesa_WindowPos4dvMESA); - SET_WindowPos4fMESA(disp, _mesa_WindowPos4fMESA); - SET_WindowPos4fvMESA(disp, _mesa_WindowPos4fvMESA); - SET_WindowPos4iMESA(disp, _mesa_WindowPos4iMESA); - SET_WindowPos4ivMESA(disp, _mesa_WindowPos4ivMESA); - SET_WindowPos4sMESA(disp, _mesa_WindowPos4sMESA); - SET_WindowPos4svMESA(disp, _mesa_WindowPos4svMESA); -} - - -#endif /* FEATURE_rastpos */ - - -/**********************************************************************/ -/** \name Initialization */ -/**********************************************************************/ -/*@{*/ - -/** - * Initialize the context current raster position information. - * - * \param ctx GL context. - * - * Initialize the current raster position information in - * __struct gl_contextRec::Current, and adds the extension entry points to the - * dispatcher. - */ -void _mesa_init_rastpos( struct gl_context * ctx ) -{ - int i; - - ASSIGN_4V( ctx->Current.RasterPos, 0.0, 0.0, 0.0, 1.0 ); - ctx->Current.RasterDistance = 0.0; - ASSIGN_4V( ctx->Current.RasterColor, 1.0, 1.0, 1.0, 1.0 ); - ASSIGN_4V( ctx->Current.RasterSecondaryColor, 0.0, 0.0, 0.0, 1.0 ); - for (i = 0; i < Elements(ctx->Current.RasterTexCoords); i++) - ASSIGN_4V( ctx->Current.RasterTexCoords[i], 0.0, 0.0, 0.0, 1.0 ); - ctx->Current.RasterPosValid = GL_TRUE; -} - -/*@}*/ +/* + * Mesa 3-D graphics library + * Version: 6.5.3 + * + * 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"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +/** + * \file rastpos.c + * Raster position operations. + */ + +#include "glheader.h" +#include "context.h" +#include "feedback.h" +#include "macros.h" +#include "mfeatures.h" +#include "mtypes.h" +#include "rastpos.h" +#include "state.h" +#include "main/dispatch.h" + + +#if FEATURE_rastpos + + +/** + * Helper function for all the RasterPos functions. + */ +static void +rasterpos(GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat p[4]; + + p[0] = x; + p[1] = y; + p[2] = z; + p[3] = w; + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_CURRENT(ctx, 0); + + if (ctx->NewState) + _mesa_update_state( ctx ); + + ctx->Driver.RasterPos(ctx, p); +} + + +static void GLAPIENTRY +_mesa_RasterPos2d(GLdouble x, GLdouble y) +{ + rasterpos((GLfloat)x, (GLfloat)y, (GLfloat)0.0, (GLfloat)1.0); +} + +static void GLAPIENTRY +_mesa_RasterPos2f(GLfloat x, GLfloat y) +{ + rasterpos(x, y, 0.0F, 1.0F); +} + +static void GLAPIENTRY +_mesa_RasterPos2i(GLint x, GLint y) +{ + rasterpos((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); +} + +static void GLAPIENTRY +_mesa_RasterPos2s(GLshort x, GLshort y) +{ + rasterpos(x, y, 0.0F, 1.0F); +} + +static void GLAPIENTRY +_mesa_RasterPos3d(GLdouble x, GLdouble y, GLdouble z) +{ + rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); +} + +static void GLAPIENTRY +_mesa_RasterPos3f(GLfloat x, GLfloat y, GLfloat z) +{ + rasterpos(x, y, z, 1.0F); +} + +static void GLAPIENTRY +_mesa_RasterPos3i(GLint x, GLint y, GLint z) +{ + rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); +} + +static void GLAPIENTRY +_mesa_RasterPos3s(GLshort x, GLshort y, GLshort z) +{ + rasterpos(x, y, z, 1.0F); +} + +static void GLAPIENTRY +_mesa_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + +static void GLAPIENTRY +_mesa_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + rasterpos(x, y, z, w); +} + +static void GLAPIENTRY +_mesa_RasterPos4i(GLint x, GLint y, GLint z, GLint w) +{ + rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + +static void GLAPIENTRY +_mesa_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w) +{ + rasterpos(x, y, z, w); +} + +static void GLAPIENTRY +_mesa_RasterPos2dv(const GLdouble *v) +{ + rasterpos((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); +} + +static void GLAPIENTRY +_mesa_RasterPos2fv(const GLfloat *v) +{ + rasterpos(v[0], v[1], 0.0F, 1.0F); +} + +static void GLAPIENTRY +_mesa_RasterPos2iv(const GLint *v) +{ + rasterpos((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); +} + +static void GLAPIENTRY +_mesa_RasterPos2sv(const GLshort *v) +{ + rasterpos(v[0], v[1], 0.0F, 1.0F); +} + +static void GLAPIENTRY +_mesa_RasterPos3dv(const GLdouble *v) +{ + rasterpos((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); +} + +static void GLAPIENTRY +_mesa_RasterPos3fv(const GLfloat *v) +{ + rasterpos(v[0], v[1], v[2], 1.0F); +} + +static void GLAPIENTRY +_mesa_RasterPos3iv(const GLint *v) +{ + rasterpos((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); +} + +static void GLAPIENTRY +_mesa_RasterPos3sv(const GLshort *v) +{ + rasterpos(v[0], v[1], v[2], 1.0F); +} + +static void GLAPIENTRY +_mesa_RasterPos4dv(const GLdouble *v) +{ + rasterpos((GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +_mesa_RasterPos4fv(const GLfloat *v) +{ + rasterpos(v[0], v[1], v[2], v[3]); +} + +static void GLAPIENTRY +_mesa_RasterPos4iv(const GLint *v) +{ + rasterpos((GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +_mesa_RasterPos4sv(const GLshort *v) +{ + rasterpos(v[0], v[1], v[2], v[3]); +} + + +/**********************************************************************/ +/*** GL_ARB_window_pos / GL_MESA_window_pos ***/ +/**********************************************************************/ + + +/** + * All glWindowPosMESA and glWindowPosARB commands call this function to + * update the current raster position. + */ +static void +window_pos3f(GLfloat x, GLfloat y, GLfloat z) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat z2; + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_CURRENT(ctx, 0); + + z2 = CLAMP(z, 0.0F, 1.0F) * (ctx->Viewport.Far - ctx->Viewport.Near) + + ctx->Viewport.Near; + + /* set raster position */ + ctx->Current.RasterPos[0] = x; + ctx->Current.RasterPos[1] = y; + ctx->Current.RasterPos[2] = z2; + ctx->Current.RasterPos[3] = 1.0F; + + ctx->Current.RasterPosValid = GL_TRUE; + + if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) + ctx->Current.RasterDistance = ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; + else + ctx->Current.RasterDistance = 0.0; + + /* raster color = current color or index */ + ctx->Current.RasterColor[0] + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0], 0.0F, 1.0F); + ctx->Current.RasterColor[1] + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1], 0.0F, 1.0F); + ctx->Current.RasterColor[2] + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2], 0.0F, 1.0F); + ctx->Current.RasterColor[3] + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3], 0.0F, 1.0F); + ctx->Current.RasterSecondaryColor[0] + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0], 0.0F, 1.0F); + ctx->Current.RasterSecondaryColor[1] + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1], 0.0F, 1.0F); + ctx->Current.RasterSecondaryColor[2] + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2], 0.0F, 1.0F); + ctx->Current.RasterSecondaryColor[3] + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3], 0.0F, 1.0F); + + /* raster texcoord = current texcoord */ + { + GLuint texSet; + for (texSet = 0; texSet < ctx->Const.MaxTextureCoordUnits; texSet++) { + assert(texSet < Elements(ctx->Current.RasterTexCoords)); + COPY_4FV( ctx->Current.RasterTexCoords[texSet], + ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texSet] ); + } + } + + if (ctx->RenderMode==GL_SELECT) { + _mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] ); + } +} + + +/* This is just to support the GL_MESA_window_pos version */ +static void +window_pos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + GET_CURRENT_CONTEXT(ctx); + window_pos3f(x, y, z); + ctx->Current.RasterPos[3] = w; +} + + +static void GLAPIENTRY +_mesa_WindowPos2dMESA(GLdouble x, GLdouble y) +{ + window_pos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); +} + +static void GLAPIENTRY +_mesa_WindowPos2fMESA(GLfloat x, GLfloat y) +{ + window_pos4f(x, y, 0.0F, 1.0F); +} + +static void GLAPIENTRY +_mesa_WindowPos2iMESA(GLint x, GLint y) +{ + window_pos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); +} + +static void GLAPIENTRY +_mesa_WindowPos2sMESA(GLshort x, GLshort y) +{ + window_pos4f(x, y, 0.0F, 1.0F); +} + +static void GLAPIENTRY +_mesa_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z) +{ + window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); +} + +static void GLAPIENTRY +_mesa_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z) +{ + window_pos4f(x, y, z, 1.0F); +} + +static void GLAPIENTRY +_mesa_WindowPos3iMESA(GLint x, GLint y, GLint z) +{ + window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); +} + +static void GLAPIENTRY +_mesa_WindowPos3sMESA(GLshort x, GLshort y, GLshort z) +{ + window_pos4f(x, y, z, 1.0F); +} + +static void GLAPIENTRY +_mesa_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + +static void GLAPIENTRY +_mesa_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + window_pos4f(x, y, z, w); +} + +static void GLAPIENTRY +_mesa_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w) +{ + window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + +static void GLAPIENTRY +_mesa_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w) +{ + window_pos4f(x, y, z, w); +} + +static void GLAPIENTRY +_mesa_WindowPos2dvMESA(const GLdouble *v) +{ + window_pos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); +} + +static void GLAPIENTRY +_mesa_WindowPos2fvMESA(const GLfloat *v) +{ + window_pos4f(v[0], v[1], 0.0F, 1.0F); +} + +static void GLAPIENTRY +_mesa_WindowPos2ivMESA(const GLint *v) +{ + window_pos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); +} + +static void GLAPIENTRY +_mesa_WindowPos2svMESA(const GLshort *v) +{ + window_pos4f(v[0], v[1], 0.0F, 1.0F); +} + +static void GLAPIENTRY +_mesa_WindowPos3dvMESA(const GLdouble *v) +{ + window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); +} + +static void GLAPIENTRY +_mesa_WindowPos3fvMESA(const GLfloat *v) +{ + window_pos4f(v[0], v[1], v[2], 1.0); +} + +static void GLAPIENTRY +_mesa_WindowPos3ivMESA(const GLint *v) +{ + window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); +} + +static void GLAPIENTRY +_mesa_WindowPos3svMESA(const GLshort *v) +{ + window_pos4f(v[0], v[1], v[2], 1.0F); +} + +static void GLAPIENTRY +_mesa_WindowPos4dvMESA(const GLdouble *v) +{ + window_pos4f((GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +_mesa_WindowPos4fvMESA(const GLfloat *v) +{ + window_pos4f(v[0], v[1], v[2], v[3]); +} + +static void GLAPIENTRY +_mesa_WindowPos4ivMESA(const GLint *v) +{ + window_pos4f((GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +_mesa_WindowPos4svMESA(const GLshort *v) +{ + window_pos4f(v[0], v[1], v[2], v[3]); +} + + +#if 0 + +/* + * OpenGL implementation of glWindowPos*MESA() + */ +void glWindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +{ + GLfloat fx, fy; + + /* Push current matrix mode and viewport attributes */ + glPushAttrib( GL_TRANSFORM_BIT | GL_VIEWPORT_BIT ); + + /* Setup projection parameters */ + glMatrixMode( GL_PROJECTION ); + glPushMatrix(); + glLoadIdentity(); + glMatrixMode( GL_MODELVIEW ); + glPushMatrix(); + glLoadIdentity(); + + glDepthRange( z, z ); + glViewport( (int) x - 1, (int) y - 1, 2, 2 ); + + /* set the raster (window) position */ + fx = x - (int) x; + fy = y - (int) y; + glRasterPos4f( fx, fy, 0.0, w ); + + /* restore matrices, viewport and matrix mode */ + glPopMatrix(); + glMatrixMode( GL_PROJECTION ); + glPopMatrix(); + + glPopAttrib(); +} + +#endif + + +void +_mesa_init_rastpos_dispatch(struct _glapi_table *disp) +{ + SET_RasterPos2f(disp, _mesa_RasterPos2f); + SET_RasterPos2fv(disp, _mesa_RasterPos2fv); + SET_RasterPos2i(disp, _mesa_RasterPos2i); + SET_RasterPos2iv(disp, _mesa_RasterPos2iv); + SET_RasterPos2d(disp, _mesa_RasterPos2d); + SET_RasterPos2dv(disp, _mesa_RasterPos2dv); + SET_RasterPos2s(disp, _mesa_RasterPos2s); + SET_RasterPos2sv(disp, _mesa_RasterPos2sv); + SET_RasterPos3d(disp, _mesa_RasterPos3d); + SET_RasterPos3dv(disp, _mesa_RasterPos3dv); + SET_RasterPos3f(disp, _mesa_RasterPos3f); + SET_RasterPos3fv(disp, _mesa_RasterPos3fv); + SET_RasterPos3i(disp, _mesa_RasterPos3i); + SET_RasterPos3iv(disp, _mesa_RasterPos3iv); + SET_RasterPos3s(disp, _mesa_RasterPos3s); + SET_RasterPos3sv(disp, _mesa_RasterPos3sv); + SET_RasterPos4d(disp, _mesa_RasterPos4d); + SET_RasterPos4dv(disp, _mesa_RasterPos4dv); + SET_RasterPos4f(disp, _mesa_RasterPos4f); + SET_RasterPos4fv(disp, _mesa_RasterPos4fv); + SET_RasterPos4i(disp, _mesa_RasterPos4i); + SET_RasterPos4iv(disp, _mesa_RasterPos4iv); + SET_RasterPos4s(disp, _mesa_RasterPos4s); + SET_RasterPos4sv(disp, _mesa_RasterPos4sv); + + /* 197. GL_MESA_window_pos */ + SET_WindowPos2dMESA(disp, _mesa_WindowPos2dMESA); + SET_WindowPos2dvMESA(disp, _mesa_WindowPos2dvMESA); + SET_WindowPos2fMESA(disp, _mesa_WindowPos2fMESA); + SET_WindowPos2fvMESA(disp, _mesa_WindowPos2fvMESA); + SET_WindowPos2iMESA(disp, _mesa_WindowPos2iMESA); + SET_WindowPos2ivMESA(disp, _mesa_WindowPos2ivMESA); + SET_WindowPos2sMESA(disp, _mesa_WindowPos2sMESA); + SET_WindowPos2svMESA(disp, _mesa_WindowPos2svMESA); + SET_WindowPos3dMESA(disp, _mesa_WindowPos3dMESA); + SET_WindowPos3dvMESA(disp, _mesa_WindowPos3dvMESA); + SET_WindowPos3fMESA(disp, _mesa_WindowPos3fMESA); + SET_WindowPos3fvMESA(disp, _mesa_WindowPos3fvMESA); + SET_WindowPos3iMESA(disp, _mesa_WindowPos3iMESA); + SET_WindowPos3ivMESA(disp, _mesa_WindowPos3ivMESA); + SET_WindowPos3sMESA(disp, _mesa_WindowPos3sMESA); + SET_WindowPos3svMESA(disp, _mesa_WindowPos3svMESA); + SET_WindowPos4dMESA(disp, _mesa_WindowPos4dMESA); + SET_WindowPos4dvMESA(disp, _mesa_WindowPos4dvMESA); + SET_WindowPos4fMESA(disp, _mesa_WindowPos4fMESA); + SET_WindowPos4fvMESA(disp, _mesa_WindowPos4fvMESA); + SET_WindowPos4iMESA(disp, _mesa_WindowPos4iMESA); + SET_WindowPos4ivMESA(disp, _mesa_WindowPos4ivMESA); + SET_WindowPos4sMESA(disp, _mesa_WindowPos4sMESA); + SET_WindowPos4svMESA(disp, _mesa_WindowPos4svMESA); +} + + +#endif /* FEATURE_rastpos */ + + +/**********************************************************************/ +/** \name Initialization */ +/**********************************************************************/ +/*@{*/ + +/** + * Initialize the context current raster position information. + * + * \param ctx GL context. + * + * Initialize the current raster position information in + * __struct gl_contextRec::Current, and adds the extension entry points to the + * dispatcher. + */ +void _mesa_init_rastpos( struct gl_context * ctx ) +{ + int i; + + ASSIGN_4V( ctx->Current.RasterPos, 0.0, 0.0, 0.0, 1.0 ); + ctx->Current.RasterDistance = 0.0; + ASSIGN_4V( ctx->Current.RasterColor, 1.0, 1.0, 1.0, 1.0 ); + ASSIGN_4V( ctx->Current.RasterSecondaryColor, 0.0, 0.0, 0.0, 1.0 ); + for (i = 0; i < Elements(ctx->Current.RasterTexCoords); i++) + ASSIGN_4V( ctx->Current.RasterTexCoords[i], 0.0, 0.0, 0.0, 1.0 ); + ctx->Current.RasterPosValid = GL_TRUE; +} + +/*@}*/ diff --git a/mesalib/src/mesa/main/remap.c b/mesalib/src/mesa/main/remap.c index 6da31deb3..c89fba453 100644 --- a/mesalib/src/mesa/main/remap.c +++ b/mesalib/src/mesa/main/remap.c @@ -1,226 +1,226 @@ -/* - * Mesa 3-D graphics library - * Version: 7.7 - * - * Copyright (C) 2009 Chia-I Wu - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS 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. - */ - - -/** - * \file remap.c - * Remap table management. - * - * Entries in the dispatch table are either static or dynamic. The - * dispatch table is shared by mesa core and glapi. When they are - * built separately, it is possible that a static entry in mesa core - * is dynamic, or assigned a different static offset, in glapi. The - * remap table is in charge of mapping a static entry in mesa core to - * a dynamic entry, or the corresponding static entry, in glapi. - */ - -#include "mfeatures.h" - -#if FEATURE_remap_table - -#include "remap.h" -#include "imports.h" -#include "glapi/glapi.h" - -#define MAX_ENTRY_POINTS 16 - -#define need_MESA_remap_table -#include "main/remap_helper.h" - - -/* this is global for quick access */ -int driDispatchRemapTable[driDispatchRemapTable_size]; - - -/** - * Return the spec string associated with the given function index. - * The index is available from including remap_helper.h. - * - * \param func_index an opaque function index. - * - * \return the spec string associated with the function index, or NULL. - */ -const char * -_mesa_get_function_spec(GLint func_index) -{ - if (func_index < Elements(_mesa_function_pool)) - return _mesa_function_pool + func_index; - else - return NULL; -} - - -/** - * Map a function by its spec. The function will be added to glapi, - * and the dispatch offset will be returned. - * - * \param spec a '\0'-separated string array specifying a function. - * It begins with the parameter signature of the function, - * followed by the names of the entry points. An empty entry - * point name terminates the array. - * - * \return the offset of the (re-)mapped function in the dispatch - * table, or -1. - */ -GLint -_mesa_map_function_spec(const char *spec) -{ - const char *signature; - const char *names[MAX_ENTRY_POINTS + 1]; - GLint num_names = 0; - - if (!spec) - return -1; - - signature = spec; - spec += strlen(spec) + 1; - - /* spec is terminated by an empty string */ - while (*spec) { - names[num_names] = spec; - num_names++; - if (num_names >= MAX_ENTRY_POINTS) - break; - spec += strlen(spec) + 1; - } - if (!num_names) - return -1; - - names[num_names] = NULL; - - /* add the entry points to the dispatch table */ - return _glapi_add_dispatch(names, signature); -} - - -/** - * Map an array of functions. This is a convenient function for - * use with arrays available from including remap_helper.h. - * - * Note that the dispatch offsets of the functions are not returned. - * If they are needed, _mesa_map_function_spec() should be used. - * - * \param func_array an array of function remaps. - */ -void -_mesa_map_function_array(const struct gl_function_remap *func_array) -{ - GLint i; - - if (!func_array) - return; - - for (i = 0; func_array[i].func_index != -1; i++) { - const char *spec; - GLint offset; - - spec = _mesa_get_function_spec(func_array[i].func_index); - if (!spec) { - _mesa_problem(NULL, "invalid function index %d", - func_array[i].func_index); - continue; - } - - offset = _mesa_map_function_spec(spec); - /* error checks */ - if (offset < 0) { - const char *name = spec + strlen(spec) + 1; - _mesa_warning(NULL, "failed to remap %s", name); - } - else if (func_array[i].dispatch_offset >= 0 && - offset != func_array[i].dispatch_offset) { - const char *name = spec + strlen(spec) + 1; - _mesa_problem(NULL, "%s should be mapped to %d, not %d", - name, func_array[i].dispatch_offset, offset); - } - } -} - - -/** - * Map the functions which are already static. - * - * When a extension function are incorporated into the ABI, the - * extension suffix is usually stripped. Mapping such functions - * makes sure the alternative names are available. - * - * Note that functions mapped by _mesa_init_remap_table() are - * excluded. - */ -void -_mesa_map_static_functions(void) -{ - /* Remap static functions which have alternative names and are in the ABI. - * This is to be on the safe side. glapi should have defined those names. - */ - _mesa_map_function_array(MESA_alt_functions); -} - - -/** - * Initialize the remap table. This is called in one_time_init(). - * The remap table needs to be initialized before calling the - * CALL/GET/SET macros defined in main/dispatch.h. - */ -static void -_mesa_do_init_remap_table(const char *pool, - int size, - const struct gl_function_pool_remap *remap) -{ - static GLboolean initialized = GL_FALSE; - GLint i; - - if (initialized) - return; - initialized = GL_TRUE; - - /* initialize the remap table */ - for (i = 0; i < size; i++) { - GLint offset; - const char *spec; - - /* sanity check */ - ASSERT(i == remap[i].remap_index); - spec = _mesa_function_pool + remap[i].pool_index; - - offset = _mesa_map_function_spec(spec); - /* store the dispatch offset in the remap table */ - driDispatchRemapTable[i] = offset; - if (offset < 0) - _mesa_warning(NULL, "failed to remap index %d", i); - } -} - - -void -_mesa_init_remap_table(void) -{ - _mesa_do_init_remap_table(_mesa_function_pool, - driDispatchRemapTable_size, - MESA_remap_table_functions); -} - - -#endif /* FEATURE_remap_table */ +/* + * Mesa 3-D graphics library + * Version: 7.7 + * + * Copyright (C) 2009 Chia-I Wu + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + */ + + +/** + * \file remap.c + * Remap table management. + * + * Entries in the dispatch table are either static or dynamic. The + * dispatch table is shared by mesa core and glapi. When they are + * built separately, it is possible that a static entry in mesa core + * is dynamic, or assigned a different static offset, in glapi. The + * remap table is in charge of mapping a static entry in mesa core to + * a dynamic entry, or the corresponding static entry, in glapi. + */ + +#include "mfeatures.h" + +#if FEATURE_remap_table + +#include "remap.h" +#include "imports.h" +#include "glapi/glapi.h" + +#define MAX_ENTRY_POINTS 16 + +#define need_MESA_remap_table +#include "main/remap_helper.h" + + +/* this is global for quick access */ +int driDispatchRemapTable[driDispatchRemapTable_size]; + + +/** + * Return the spec string associated with the given function index. + * The index is available from including remap_helper.h. + * + * \param func_index an opaque function index. + * + * \return the spec string associated with the function index, or NULL. + */ +const char * +_mesa_get_function_spec(GLint func_index) +{ + if (func_index < Elements(_mesa_function_pool)) + return _mesa_function_pool + func_index; + else + return NULL; +} + + +/** + * Map a function by its spec. The function will be added to glapi, + * and the dispatch offset will be returned. + * + * \param spec a '\0'-separated string array specifying a function. + * It begins with the parameter signature of the function, + * followed by the names of the entry points. An empty entry + * point name terminates the array. + * + * \return the offset of the (re-)mapped function in the dispatch + * table, or -1. + */ +GLint +_mesa_map_function_spec(const char *spec) +{ + const char *signature; + const char *names[MAX_ENTRY_POINTS + 1]; + GLint num_names = 0; + + if (!spec) + return -1; + + signature = spec; + spec += strlen(spec) + 1; + + /* spec is terminated by an empty string */ + while (*spec) { + names[num_names] = spec; + num_names++; + if (num_names >= MAX_ENTRY_POINTS) + break; + spec += strlen(spec) + 1; + } + if (!num_names) + return -1; + + names[num_names] = NULL; + + /* add the entry points to the dispatch table */ + return _glapi_add_dispatch(names, signature); +} + + +/** + * Map an array of functions. This is a convenient function for + * use with arrays available from including remap_helper.h. + * + * Note that the dispatch offsets of the functions are not returned. + * If they are needed, _mesa_map_function_spec() should be used. + * + * \param func_array an array of function remaps. + */ +void +_mesa_map_function_array(const struct gl_function_remap *func_array) +{ + GLint i; + + if (!func_array) + return; + + for (i = 0; func_array[i].func_index != -1; i++) { + const char *spec; + GLint offset; + + spec = _mesa_get_function_spec(func_array[i].func_index); + if (!spec) { + _mesa_problem(NULL, "invalid function index %d", + func_array[i].func_index); + continue; + } + + offset = _mesa_map_function_spec(spec); + /* error checks */ + if (offset < 0) { + const char *name = spec + strlen(spec) + 1; + _mesa_warning(NULL, "failed to remap %s", name); + } + else if (func_array[i].dispatch_offset >= 0 && + offset != func_array[i].dispatch_offset) { + const char *name = spec + strlen(spec) + 1; + _mesa_problem(NULL, "%s should be mapped to %d, not %d", + name, func_array[i].dispatch_offset, offset); + } + } +} + + +/** + * Map the functions which are already static. + * + * When a extension function are incorporated into the ABI, the + * extension suffix is usually stripped. Mapping such functions + * makes sure the alternative names are available. + * + * Note that functions mapped by _mesa_init_remap_table() are + * excluded. + */ +void +_mesa_map_static_functions(void) +{ + /* Remap static functions which have alternative names and are in the ABI. + * This is to be on the safe side. glapi should have defined those names. + */ + _mesa_map_function_array(MESA_alt_functions); +} + + +/** + * Initialize the remap table. This is called in one_time_init(). + * The remap table needs to be initialized before calling the + * CALL/GET/SET macros defined in main/dispatch.h. + */ +static void +_mesa_do_init_remap_table(const char *pool, + int size, + const struct gl_function_pool_remap *remap) +{ + static GLboolean initialized = GL_FALSE; + GLint i; + + if (initialized) + return; + initialized = GL_TRUE; + + /* initialize the remap table */ + for (i = 0; i < size; i++) { + GLint offset; + const char *spec; + + /* sanity check */ + ASSERT(i == remap[i].remap_index); + spec = _mesa_function_pool + remap[i].pool_index; + + offset = _mesa_map_function_spec(spec); + /* store the dispatch offset in the remap table */ + driDispatchRemapTable[i] = offset; + if (offset < 0) + _mesa_warning(NULL, "failed to remap index %d", i); + } +} + + +void +_mesa_init_remap_table(void) +{ + _mesa_do_init_remap_table(_mesa_function_pool, + driDispatchRemapTable_size, + MESA_remap_table_functions); +} + + +#endif /* FEATURE_remap_table */ diff --git a/mesalib/src/mesa/main/scissor.c b/mesalib/src/mesa/main/scissor.c index 16e8438c5..df665994a 100644 --- a/mesalib/src/mesa/main/scissor.c +++ b/mesalib/src/mesa/main/scissor.c @@ -1,100 +1,100 @@ -/* - * Mesa 3-D graphics library - * Version: 7.1 - * - * 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"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#include "main/glheader.h" -#include "main/context.h" -#include "main/mtypes.h" -#include "main/scissor.h" - - -/** - * Called via glScissor - */ -void GLAPIENTRY -_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ) -{ - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glScissor %d %d %d %d\n", x, y, width, height); - - if (width < 0 || height < 0) { - _mesa_error( ctx, GL_INVALID_VALUE, "glScissor" ); - return; - } - - _mesa_set_scissor(ctx, x, y, width, height); -} - - -/** - * Define the scissor box. - * - * \param x, y coordinates of the scissor box lower-left corner. - * \param width width of the scissor box. - * \param height height of the scissor box. - * - * \sa glScissor(). - * - * Verifies the parameters and updates __struct gl_contextRec::Scissor. On a - * change flushes the vertices and notifies the driver via - * the dd_function_table::Scissor callback. - */ -void -_mesa_set_scissor(struct gl_context *ctx, - GLint x, GLint y, GLsizei width, GLsizei height) -{ - if (x == ctx->Scissor.X && - y == ctx->Scissor.Y && - width == ctx->Scissor.Width && - height == ctx->Scissor.Height) - return; - - FLUSH_VERTICES(ctx, _NEW_SCISSOR); - ctx->Scissor.X = x; - ctx->Scissor.Y = y; - ctx->Scissor.Width = width; - ctx->Scissor.Height = height; - - if (ctx->Driver.Scissor) - ctx->Driver.Scissor( ctx, x, y, width, height ); -} - - -/** - * Initialize the context's scissor state. - * \param ctx the GL context. - */ -void -_mesa_init_scissor(struct gl_context *ctx) -{ - /* Scissor group */ - ctx->Scissor.Enabled = GL_FALSE; - ctx->Scissor.X = 0; - ctx->Scissor.Y = 0; - ctx->Scissor.Width = 0; - ctx->Scissor.Height = 0; -} +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * 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"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#include "main/glheader.h" +#include "main/context.h" +#include "main/mtypes.h" +#include "main/scissor.h" + + +/** + * Called via glScissor + */ +void GLAPIENTRY +_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glScissor %d %d %d %d\n", x, y, width, height); + + if (width < 0 || height < 0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glScissor" ); + return; + } + + _mesa_set_scissor(ctx, x, y, width, height); +} + + +/** + * Define the scissor box. + * + * \param x, y coordinates of the scissor box lower-left corner. + * \param width width of the scissor box. + * \param height height of the scissor box. + * + * \sa glScissor(). + * + * Verifies the parameters and updates __struct gl_contextRec::Scissor. On a + * change flushes the vertices and notifies the driver via + * the dd_function_table::Scissor callback. + */ +void +_mesa_set_scissor(struct gl_context *ctx, + GLint x, GLint y, GLsizei width, GLsizei height) +{ + if (x == ctx->Scissor.X && + y == ctx->Scissor.Y && + width == ctx->Scissor.Width && + height == ctx->Scissor.Height) + return; + + FLUSH_VERTICES(ctx, _NEW_SCISSOR); + ctx->Scissor.X = x; + ctx->Scissor.Y = y; + ctx->Scissor.Width = width; + ctx->Scissor.Height = height; + + if (ctx->Driver.Scissor) + ctx->Driver.Scissor( ctx, x, y, width, height ); +} + + +/** + * Initialize the context's scissor state. + * \param ctx the GL context. + */ +void +_mesa_init_scissor(struct gl_context *ctx) +{ + /* Scissor group */ + ctx->Scissor.Enabled = GL_FALSE; + ctx->Scissor.X = 0; + ctx->Scissor.Y = 0; + ctx->Scissor.Width = 0; + ctx->Scissor.Height = 0; +} diff --git a/mesalib/src/mesa/main/scissor.h b/mesalib/src/mesa/main/scissor.h index 8735ec0cd..da9385e2b 100644 --- a/mesalib/src/mesa/main/scissor.h +++ b/mesalib/src/mesa/main/scissor.h @@ -1,47 +1,47 @@ -/* - * Mesa 3-D graphics library - * Version: 7.1 - * - * 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"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#ifndef SCISSOR_H -#define SCISSOR_H - - -#include "glheader.h" - -struct gl_context; - -extern void GLAPIENTRY -_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ); - - -extern void -_mesa_set_scissor(struct gl_context *ctx, - GLint x, GLint y, GLsizei width, GLsizei height); - - -extern void -_mesa_init_scissor(struct gl_context *ctx); - - -#endif +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * 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"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef SCISSOR_H +#define SCISSOR_H + + +#include "glheader.h" + +struct gl_context; + +extern void GLAPIENTRY +_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ); + + +extern void +_mesa_set_scissor(struct gl_context *ctx, + GLint x, GLint y, GLsizei width, GLsizei height); + + +extern void +_mesa_init_scissor(struct gl_context *ctx); + + +#endif diff --git a/mesalib/src/mesa/main/stencil.h b/mesalib/src/mesa/main/stencil.h index f3a33db70..b772bfd6e 100644 --- a/mesalib/src/mesa/main/stencil.h +++ b/mesalib/src/mesa/main/stencil.h @@ -1,81 +1,81 @@ -/** - * \file stencil.h - * Stencil operations. - */ - -/* - * Mesa 3-D graphics library - * Version: 7.1 - * - * 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"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#ifndef STENCIL_H -#define STENCIL_H - - -#include "glheader.h" - -struct gl_context; - -extern void GLAPIENTRY -_mesa_ClearStencil( GLint s ); - - -extern void GLAPIENTRY -_mesa_StencilFunc( GLenum func, GLint ref, GLuint mask ); - - -extern void GLAPIENTRY -_mesa_StencilMask( GLuint mask ); - - -extern void GLAPIENTRY -_mesa_StencilOp( GLenum fail, GLenum zfail, GLenum zpass ); - - -extern void GLAPIENTRY -_mesa_ActiveStencilFaceEXT(GLenum face); - - -extern void GLAPIENTRY -_mesa_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); - - -extern void GLAPIENTRY -_mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask); - - -extern void GLAPIENTRY -_mesa_StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); - -extern void GLAPIENTRY -_mesa_StencilMaskSeparate(GLenum face, GLuint mask); - - -extern void -_mesa_update_stencil(struct gl_context *ctx); - - -extern void -_mesa_init_stencil( struct gl_context * ctx ); - -#endif +/** + * \file stencil.h + * Stencil operations. + */ + +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * 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"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef STENCIL_H +#define STENCIL_H + + +#include "glheader.h" + +struct gl_context; + +extern void GLAPIENTRY +_mesa_ClearStencil( GLint s ); + + +extern void GLAPIENTRY +_mesa_StencilFunc( GLenum func, GLint ref, GLuint mask ); + + +extern void GLAPIENTRY +_mesa_StencilMask( GLuint mask ); + + +extern void GLAPIENTRY +_mesa_StencilOp( GLenum fail, GLenum zfail, GLenum zpass ); + + +extern void GLAPIENTRY +_mesa_ActiveStencilFaceEXT(GLenum face); + + +extern void GLAPIENTRY +_mesa_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); + + +extern void GLAPIENTRY +_mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask); + + +extern void GLAPIENTRY +_mesa_StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); + +extern void GLAPIENTRY +_mesa_StencilMaskSeparate(GLenum face, GLuint mask); + + +extern void +_mesa_update_stencil(struct gl_context *ctx); + + +extern void +_mesa_init_stencil( struct gl_context * ctx ); + +#endif diff --git a/mesalib/src/mesa/main/syncobj.c b/mesalib/src/mesa/main/syncobj.c index 676038430..e1a5c6c0f 100644 --- a/mesalib/src/mesa/main/syncobj.c +++ b/mesalib/src/mesa/main/syncobj.c @@ -1,426 +1,426 @@ -/* - * Copyright © 2009 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS 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. - */ - -/** - * \file syncobj.c - * Sync object management. - * - * Unlike textures and other objects that are shared between contexts, sync - * objects are not bound to the context. As a result, the reference counting - * and delete behavior of sync objects is slightly different. References to - * sync objects are added: - * - * - By \c glFencSynce. This sets the initial reference count to 1. - * - At the start of \c glClientWaitSync. The reference is held for the - * duration of the wait call. - * - * References are removed: - * - * - By \c glDeleteSync. - * - At the end of \c glClientWaitSync. - * - * Additionally, drivers may call \c _mesa_ref_sync_object and - * \c _mesa_unref_sync_object as needed to implement \c ServerWaitSync. - * - * As with shader objects, sync object names become invalid as soon as - * \c glDeleteSync is called. For this reason \c glDeleteSync sets the - * \c DeletePending flag. All functions validate object handles by testing - * this flag. - * - * \note - * Only \c GL_ARB_sync objects are shared between contexts. If support is ever - * added for either \c GL_NV_fence or \c GL_APPLE_fence different semantics - * will need to be implemented. - * - * \author Ian Romanick - */ - -#include "glheader.h" -#include "imports.h" -#include "context.h" -#include "macros.h" -#include "mfeatures.h" -#include "get.h" -#include "dispatch.h" -#include "mtypes.h" - -#if FEATURE_ARB_sync -#include "syncobj.h" - -static struct gl_sync_object * -_mesa_new_sync_object(struct gl_context *ctx, GLenum type) -{ - struct gl_sync_object *s = MALLOC_STRUCT(gl_sync_object); - (void) ctx; - (void) type; - - return s; -} - - -static void -_mesa_delete_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj) -{ - (void) ctx; - free(syncObj); -} - - -static void -_mesa_fence_sync(struct gl_context *ctx, struct gl_sync_object *syncObj, - GLenum condition, GLbitfield flags) -{ - (void) ctx; - (void) condition; - (void) flags; - - syncObj->StatusFlag = 1; -} - - -static void -_mesa_check_sync(struct gl_context *ctx, struct gl_sync_object *syncObj) -{ - (void) ctx; - (void) syncObj; - - /* No-op for software rendering. Hardware drivers will need to determine - * whether the state of the sync object has changed. - */ -} - - -static void -_mesa_wait_sync(struct gl_context *ctx, struct gl_sync_object *syncObj, - GLbitfield flags, GLuint64 timeout) -{ - (void) ctx; - (void) syncObj; - (void) flags; - (void) timeout; - - /* No-op for software rendering. Hardware drivers will need to wait until - * the state of the sync object changes or the timeout expires. - */ -} - - -void -_mesa_init_sync_object_functions(struct dd_function_table *driver) -{ - driver->NewSyncObject = _mesa_new_sync_object; - driver->FenceSync = _mesa_fence_sync; - driver->DeleteSyncObject = _mesa_delete_sync_object; - driver->CheckSync = _mesa_check_sync; - - /* Use the same no-op wait function for both. - */ - driver->ClientWaitSync = _mesa_wait_sync; - driver->ServerWaitSync = _mesa_wait_sync; -} - - -void -_mesa_init_sync_dispatch(struct _glapi_table *disp) -{ - SET_IsSync(disp, _mesa_IsSync); - SET_DeleteSync(disp, _mesa_DeleteSync); - SET_FenceSync(disp, _mesa_FenceSync); - SET_ClientWaitSync(disp, _mesa_ClientWaitSync); - SET_WaitSync(disp, _mesa_WaitSync); - SET_GetInteger64v(disp, _mesa_GetInteger64v); - SET_GetSynciv(disp, _mesa_GetSynciv); -} - - -/** - * Allocate/init the context state related to sync objects. - */ -void -_mesa_init_sync(struct gl_context *ctx) -{ - (void) ctx; -} - - -/** - * Free the context state related to sync objects. - */ -void -_mesa_free_sync_data(struct gl_context *ctx) -{ - (void) ctx; -} - - -static int -_mesa_validate_sync(struct gl_sync_object *syncObj) -{ - return (syncObj != NULL) - && (syncObj->Type == GL_SYNC_FENCE) - && !syncObj->DeletePending; -} - - -void -_mesa_ref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj) -{ - _glthread_LOCK_MUTEX(ctx->Shared->Mutex); - syncObj->RefCount++; - _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); -} - - -void -_mesa_unref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj) -{ - _glthread_LOCK_MUTEX(ctx->Shared->Mutex); - syncObj->RefCount--; - if (syncObj->RefCount == 0) { - remove_from_list(& syncObj->link); - _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); - - ctx->Driver.DeleteSyncObject(ctx, syncObj); - } else { - _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); - } -} - - -GLboolean GLAPIENTRY -_mesa_IsSync(GLsync sync) -{ - GET_CURRENT_CONTEXT(ctx); - struct gl_sync_object *const syncObj = (struct gl_sync_object *) sync; - ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); - - return _mesa_validate_sync(syncObj) ? GL_TRUE : GL_FALSE; -} - - -void GLAPIENTRY -_mesa_DeleteSync(GLsync sync) -{ - GET_CURRENT_CONTEXT(ctx); - struct gl_sync_object *const syncObj = (struct gl_sync_object *) sync; - ASSERT_OUTSIDE_BEGIN_END(ctx); - - /* From the GL_ARB_sync spec: - * - * DeleteSync will silently ignore a value of zero. An - * INVALID_VALUE error is generated if is neither zero nor the - * name of a sync object. - */ - if (sync == 0) { - return; - } - - if (!_mesa_validate_sync(syncObj)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glDeleteSync"); - return; - } - - /* If there are no client-waits or server-waits pending on this sync, delete - * the underlying object. - */ - syncObj->DeletePending = GL_TRUE; - _mesa_unref_sync_object(ctx, syncObj); -} - - -GLsync GLAPIENTRY -_mesa_FenceSync(GLenum condition, GLbitfield flags) -{ - GET_CURRENT_CONTEXT(ctx); - struct gl_sync_object *syncObj; - ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); - - if (condition != GL_SYNC_GPU_COMMANDS_COMPLETE) { - _mesa_error(ctx, GL_INVALID_ENUM, "glFenceSync(condition=0x%x)", - condition); - return 0; - } - - if (flags != 0) { - _mesa_error(ctx, GL_INVALID_VALUE, "glFenceSync(flags=0x%x)", - condition); - return 0; - } - - syncObj = ctx->Driver.NewSyncObject(ctx, GL_SYNC_FENCE); - if (syncObj != NULL) { - syncObj->Type = GL_SYNC_FENCE; - /* The name is not currently used, and it is never visible to - * applications. If sync support is extended to provide support for - * NV_fence, this field will be used. We'll also need to add an object - * ID hashtable. - */ - syncObj->Name = 1; - syncObj->RefCount = 1; - syncObj->DeletePending = GL_FALSE; - syncObj->SyncCondition = condition; - syncObj->Flags = flags; - syncObj->StatusFlag = 0; - - ctx->Driver.FenceSync(ctx, syncObj, condition, flags); - - _glthread_LOCK_MUTEX(ctx->Shared->Mutex); - insert_at_tail(& ctx->Shared->SyncObjects, & syncObj->link); - _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); - - return (GLsync) syncObj; - } - - return NULL; -} - - -GLenum GLAPIENTRY -_mesa_ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) -{ - GET_CURRENT_CONTEXT(ctx); - struct gl_sync_object *const syncObj = (struct gl_sync_object *) sync; - GLenum ret; - ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_WAIT_FAILED); - - if (!_mesa_validate_sync(syncObj)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glClientWaitSync"); - return GL_WAIT_FAILED; - } - - if ((flags & ~GL_SYNC_FLUSH_COMMANDS_BIT) != 0) { - _mesa_error(ctx, GL_INVALID_ENUM, "glClientWaitSync(flags=0x%x)", flags); - return GL_WAIT_FAILED; - } - - _mesa_ref_sync_object(ctx, syncObj); - - /* From the GL_ARB_sync spec: - * - * ClientWaitSync returns one of four status values. A return value of - * ALREADY_SIGNALED indicates that was signaled at the time - * ClientWaitSync was called. ALREADY_SIGNALED will always be returned - * if was signaled, even if the value of is zero. - */ - ctx->Driver.CheckSync(ctx, syncObj); - if (syncObj->StatusFlag) { - ret = GL_ALREADY_SIGNALED; - } else { - ctx->Driver.ClientWaitSync(ctx, syncObj, flags, timeout); - - ret = syncObj->StatusFlag ? GL_CONDITION_SATISFIED : GL_TIMEOUT_EXPIRED; - } - - _mesa_unref_sync_object(ctx, syncObj); - return ret; -} - - -void GLAPIENTRY -_mesa_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) -{ - GET_CURRENT_CONTEXT(ctx); - struct gl_sync_object *const syncObj = (struct gl_sync_object *) sync; - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (!_mesa_validate_sync(syncObj)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glWaitSync"); - return; - } - - if (flags != 0) { - _mesa_error(ctx, GL_INVALID_ENUM, "glWaitSync(flags=0x%x)", flags); - return; - } - - /* From the GL_ARB_sync spec: - * - * If the value of is zero, then WaitSync does nothing. - */ - if (timeout == 0) { - return; - } - - ctx->Driver.ServerWaitSync(ctx, syncObj, flags, timeout); -} - - -void GLAPIENTRY -_mesa_GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, - GLint *values) -{ - GET_CURRENT_CONTEXT(ctx); - struct gl_sync_object *const syncObj = (struct gl_sync_object *) sync; - GLsizei size = 0; - GLint v[1]; - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (!_mesa_validate_sync(syncObj)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetSynciv"); - return; - } - - switch (pname) { - case GL_OBJECT_TYPE: - v[0] = syncObj->Type; - size = 1; - break; - - case GL_SYNC_CONDITION: - v[0] = syncObj->SyncCondition; - size = 1; - break; - - case GL_SYNC_STATUS: - /* Update the state of the sync by dipping into the driver. Note that - * this call won't block. It just updates state in the common object - * data from the current driver state. - */ - ctx->Driver.CheckSync(ctx, syncObj); - - v[0] = (syncObj->StatusFlag) ? GL_SIGNALED : GL_UNSIGNALED; - size = 1; - break; - - case GL_SYNC_FLAGS: - v[0] = syncObj->Flags; - size = 1; - break; - - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetSynciv(pname=0x%x)\n", pname); - return; - } - - if (size > 0) { - const GLsizei copy_count = MIN2(size, bufSize); - - memcpy(values, v, sizeof(GLint) * copy_count); - } - - if (length != NULL) { - *length = size; - } -} - -#endif /* FEATURE_ARB_sync */ +/* + * Copyright © 2009 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + */ + +/** + * \file syncobj.c + * Sync object management. + * + * Unlike textures and other objects that are shared between contexts, sync + * objects are not bound to the context. As a result, the reference counting + * and delete behavior of sync objects is slightly different. References to + * sync objects are added: + * + * - By \c glFencSynce. This sets the initial reference count to 1. + * - At the start of \c glClientWaitSync. The reference is held for the + * duration of the wait call. + * + * References are removed: + * + * - By \c glDeleteSync. + * - At the end of \c glClientWaitSync. + * + * Additionally, drivers may call \c _mesa_ref_sync_object and + * \c _mesa_unref_sync_object as needed to implement \c ServerWaitSync. + * + * As with shader objects, sync object names become invalid as soon as + * \c glDeleteSync is called. For this reason \c glDeleteSync sets the + * \c DeletePending flag. All functions validate object handles by testing + * this flag. + * + * \note + * Only \c GL_ARB_sync objects are shared between contexts. If support is ever + * added for either \c GL_NV_fence or \c GL_APPLE_fence different semantics + * will need to be implemented. + * + * \author Ian Romanick + */ + +#include "glheader.h" +#include "imports.h" +#include "context.h" +#include "macros.h" +#include "mfeatures.h" +#include "get.h" +#include "dispatch.h" +#include "mtypes.h" + +#if FEATURE_ARB_sync +#include "syncobj.h" + +static struct gl_sync_object * +_mesa_new_sync_object(struct gl_context *ctx, GLenum type) +{ + struct gl_sync_object *s = MALLOC_STRUCT(gl_sync_object); + (void) ctx; + (void) type; + + return s; +} + + +static void +_mesa_delete_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj) +{ + (void) ctx; + free(syncObj); +} + + +static void +_mesa_fence_sync(struct gl_context *ctx, struct gl_sync_object *syncObj, + GLenum condition, GLbitfield flags) +{ + (void) ctx; + (void) condition; + (void) flags; + + syncObj->StatusFlag = 1; +} + + +static void +_mesa_check_sync(struct gl_context *ctx, struct gl_sync_object *syncObj) +{ + (void) ctx; + (void) syncObj; + + /* No-op for software rendering. Hardware drivers will need to determine + * whether the state of the sync object has changed. + */ +} + + +static void +_mesa_wait_sync(struct gl_context *ctx, struct gl_sync_object *syncObj, + GLbitfield flags, GLuint64 timeout) +{ + (void) ctx; + (void) syncObj; + (void) flags; + (void) timeout; + + /* No-op for software rendering. Hardware drivers will need to wait until + * the state of the sync object changes or the timeout expires. + */ +} + + +void +_mesa_init_sync_object_functions(struct dd_function_table *driver) +{ + driver->NewSyncObject = _mesa_new_sync_object; + driver->FenceSync = _mesa_fence_sync; + driver->DeleteSyncObject = _mesa_delete_sync_object; + driver->CheckSync = _mesa_check_sync; + + /* Use the same no-op wait function for both. + */ + driver->ClientWaitSync = _mesa_wait_sync; + driver->ServerWaitSync = _mesa_wait_sync; +} + + +void +_mesa_init_sync_dispatch(struct _glapi_table *disp) +{ + SET_IsSync(disp, _mesa_IsSync); + SET_DeleteSync(disp, _mesa_DeleteSync); + SET_FenceSync(disp, _mesa_FenceSync); + SET_ClientWaitSync(disp, _mesa_ClientWaitSync); + SET_WaitSync(disp, _mesa_WaitSync); + SET_GetInteger64v(disp, _mesa_GetInteger64v); + SET_GetSynciv(disp, _mesa_GetSynciv); +} + + +/** + * Allocate/init the context state related to sync objects. + */ +void +_mesa_init_sync(struct gl_context *ctx) +{ + (void) ctx; +} + + +/** + * Free the context state related to sync objects. + */ +void +_mesa_free_sync_data(struct gl_context *ctx) +{ + (void) ctx; +} + + +static int +_mesa_validate_sync(struct gl_sync_object *syncObj) +{ + return (syncObj != NULL) + && (syncObj->Type == GL_SYNC_FENCE) + && !syncObj->DeletePending; +} + + +void +_mesa_ref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj) +{ + _glthread_LOCK_MUTEX(ctx->Shared->Mutex); + syncObj->RefCount++; + _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); +} + + +void +_mesa_unref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj) +{ + _glthread_LOCK_MUTEX(ctx->Shared->Mutex); + syncObj->RefCount--; + if (syncObj->RefCount == 0) { + remove_from_list(& syncObj->link); + _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); + + ctx->Driver.DeleteSyncObject(ctx, syncObj); + } else { + _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); + } +} + + +GLboolean GLAPIENTRY +_mesa_IsSync(GLsync sync) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_sync_object *const syncObj = (struct gl_sync_object *) sync; + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); + + return _mesa_validate_sync(syncObj) ? GL_TRUE : GL_FALSE; +} + + +void GLAPIENTRY +_mesa_DeleteSync(GLsync sync) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_sync_object *const syncObj = (struct gl_sync_object *) sync; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + /* From the GL_ARB_sync spec: + * + * DeleteSync will silently ignore a value of zero. An + * INVALID_VALUE error is generated if is neither zero nor the + * name of a sync object. + */ + if (sync == 0) { + return; + } + + if (!_mesa_validate_sync(syncObj)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glDeleteSync"); + return; + } + + /* If there are no client-waits or server-waits pending on this sync, delete + * the underlying object. + */ + syncObj->DeletePending = GL_TRUE; + _mesa_unref_sync_object(ctx, syncObj); +} + + +GLsync GLAPIENTRY +_mesa_FenceSync(GLenum condition, GLbitfield flags) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_sync_object *syncObj; + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); + + if (condition != GL_SYNC_GPU_COMMANDS_COMPLETE) { + _mesa_error(ctx, GL_INVALID_ENUM, "glFenceSync(condition=0x%x)", + condition); + return 0; + } + + if (flags != 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glFenceSync(flags=0x%x)", + condition); + return 0; + } + + syncObj = ctx->Driver.NewSyncObject(ctx, GL_SYNC_FENCE); + if (syncObj != NULL) { + syncObj->Type = GL_SYNC_FENCE; + /* The name is not currently used, and it is never visible to + * applications. If sync support is extended to provide support for + * NV_fence, this field will be used. We'll also need to add an object + * ID hashtable. + */ + syncObj->Name = 1; + syncObj->RefCount = 1; + syncObj->DeletePending = GL_FALSE; + syncObj->SyncCondition = condition; + syncObj->Flags = flags; + syncObj->StatusFlag = 0; + + ctx->Driver.FenceSync(ctx, syncObj, condition, flags); + + _glthread_LOCK_MUTEX(ctx->Shared->Mutex); + insert_at_tail(& ctx->Shared->SyncObjects, & syncObj->link); + _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); + + return (GLsync) syncObj; + } + + return NULL; +} + + +GLenum GLAPIENTRY +_mesa_ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_sync_object *const syncObj = (struct gl_sync_object *) sync; + GLenum ret; + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_WAIT_FAILED); + + if (!_mesa_validate_sync(syncObj)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glClientWaitSync"); + return GL_WAIT_FAILED; + } + + if ((flags & ~GL_SYNC_FLUSH_COMMANDS_BIT) != 0) { + _mesa_error(ctx, GL_INVALID_ENUM, "glClientWaitSync(flags=0x%x)", flags); + return GL_WAIT_FAILED; + } + + _mesa_ref_sync_object(ctx, syncObj); + + /* From the GL_ARB_sync spec: + * + * ClientWaitSync returns one of four status values. A return value of + * ALREADY_SIGNALED indicates that was signaled at the time + * ClientWaitSync was called. ALREADY_SIGNALED will always be returned + * if was signaled, even if the value of is zero. + */ + ctx->Driver.CheckSync(ctx, syncObj); + if (syncObj->StatusFlag) { + ret = GL_ALREADY_SIGNALED; + } else { + ctx->Driver.ClientWaitSync(ctx, syncObj, flags, timeout); + + ret = syncObj->StatusFlag ? GL_CONDITION_SATISFIED : GL_TIMEOUT_EXPIRED; + } + + _mesa_unref_sync_object(ctx, syncObj); + return ret; +} + + +void GLAPIENTRY +_mesa_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_sync_object *const syncObj = (struct gl_sync_object *) sync; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (!_mesa_validate_sync(syncObj)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glWaitSync"); + return; + } + + if (flags != 0) { + _mesa_error(ctx, GL_INVALID_ENUM, "glWaitSync(flags=0x%x)", flags); + return; + } + + /* From the GL_ARB_sync spec: + * + * If the value of is zero, then WaitSync does nothing. + */ + if (timeout == 0) { + return; + } + + ctx->Driver.ServerWaitSync(ctx, syncObj, flags, timeout); +} + + +void GLAPIENTRY +_mesa_GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, + GLint *values) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_sync_object *const syncObj = (struct gl_sync_object *) sync; + GLsizei size = 0; + GLint v[1]; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (!_mesa_validate_sync(syncObj)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetSynciv"); + return; + } + + switch (pname) { + case GL_OBJECT_TYPE: + v[0] = syncObj->Type; + size = 1; + break; + + case GL_SYNC_CONDITION: + v[0] = syncObj->SyncCondition; + size = 1; + break; + + case GL_SYNC_STATUS: + /* Update the state of the sync by dipping into the driver. Note that + * this call won't block. It just updates state in the common object + * data from the current driver state. + */ + ctx->Driver.CheckSync(ctx, syncObj); + + v[0] = (syncObj->StatusFlag) ? GL_SIGNALED : GL_UNSIGNALED; + size = 1; + break; + + case GL_SYNC_FLAGS: + v[0] = syncObj->Flags; + size = 1; + break; + + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetSynciv(pname=0x%x)\n", pname); + return; + } + + if (size > 0) { + const GLsizei copy_count = MIN2(size, bufSize); + + memcpy(values, v, sizeof(GLint) * copy_count); + } + + if (length != NULL) { + *length = size; + } +} + +#endif /* FEATURE_ARB_sync */ diff --git a/mesalib/src/mesa/main/texformat.h b/mesalib/src/mesa/main/texformat.h index b84117995..3cf09213a 100644 --- a/mesalib/src/mesa/main/texformat.h +++ b/mesalib/src/mesa/main/texformat.h @@ -1,39 +1,39 @@ -/* - * Mesa 3-D graphics library - * Version: 7.75 - * - * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. - * Copyright (c) 2008-2009 VMware, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef TEXFORMAT_H -#define TEXFORMAT_H - - -#include "formats.h" - -struct gl_context; - -extern gl_format -_mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat, - GLenum format, GLenum type ); - - -#endif +/* + * Mesa 3-D graphics library + * Version: 7.75 + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (c) 2008-2009 VMware, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef TEXFORMAT_H +#define TEXFORMAT_H + + +#include "formats.h" + +struct gl_context; + +extern gl_format +_mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat, + GLenum format, GLenum type ); + + +#endif diff --git a/mesalib/src/mesa/main/texgen.c b/mesalib/src/mesa/main/texgen.c index 10eaa89ad..0ace0b936 100644 --- a/mesalib/src/mesa/main/texgen.c +++ b/mesalib/src/mesa/main/texgen.c @@ -1,401 +1,401 @@ -/* - * Mesa 3-D graphics library - * Version: 7.5 - * - * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. - * Copyright (C) 2009 VMware, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file texgen.c - * - * glTexGen-related functions - */ - - -#include "main/glheader.h" -#include "main/context.h" -#include "main/enums.h" -#include "main/macros.h" -#include "main/mfeatures.h" -#include "main/texgen.h" -#include "main/texstate.h" -#include "math/m_matrix.h" -#include "main/dispatch.h" - - -#if FEATURE_texgen - - -/** - * Return texgen state for given coordinate - */ -static struct gl_texgen * -get_texgen(struct gl_texture_unit *texUnit, GLenum coord) -{ - switch (coord) { - case GL_S: - return &texUnit->GenS; - case GL_T: - return &texUnit->GenT; - case GL_R: - return &texUnit->GenR; - case GL_Q: - return &texUnit->GenQ; - default: - return NULL; - } -} - - -void GLAPIENTRY -_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) -{ - struct gl_texture_unit *texUnit; - struct gl_texgen *texgen; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE)) - _mesa_debug(ctx, "glTexGen %s %s %.1f(%s)...\n", - _mesa_lookup_enum_by_nr(coord), - _mesa_lookup_enum_by_nr(pname), - *params, - _mesa_lookup_enum_by_nr((GLenum) (GLint) *params)); - - if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glTexGen(current unit)"); - return; - } - - texUnit = _mesa_get_current_tex_unit(ctx); - - texgen = get_texgen(texUnit, coord); - if (!texgen) { - _mesa_error(ctx, GL_INVALID_ENUM, "glTexGen(coord)"); - return; - } - - switch (pname) { - case GL_TEXTURE_GEN_MODE: - { - GLenum mode = (GLenum) (GLint) params[0]; - GLbitfield bit = 0x0; - if (texgen->Mode == mode) - return; - switch (mode) { - case GL_OBJECT_LINEAR: - bit = TEXGEN_OBJ_LINEAR; - break; - case GL_EYE_LINEAR: - bit = TEXGEN_EYE_LINEAR; - break; - case GL_SPHERE_MAP: - if (coord == GL_S || coord == GL_T) - bit = TEXGEN_SPHERE_MAP; - break; - case GL_REFLECTION_MAP_NV: - if (coord != GL_Q) - bit = TEXGEN_REFLECTION_MAP_NV; - break; - case GL_NORMAL_MAP_NV: - if (coord != GL_Q) - bit = TEXGEN_NORMAL_MAP_NV; - break; - default: - ; /* nop */ - } - if (!bit) { - _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); - return; - } - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texgen->Mode = mode; - texgen->_ModeBit = bit; - } - break; - - case GL_OBJECT_PLANE: - { - if (TEST_EQ_4V(texgen->ObjectPlane, params)) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - COPY_4FV(texgen->ObjectPlane, params); - } - break; - - case GL_EYE_PLANE: - { - GLfloat tmp[4]; - /* Transform plane equation by the inverse modelview matrix */ - if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) { - _math_matrix_analyse(ctx->ModelviewMatrixStack.Top); - } - _mesa_transform_vector(tmp, params, - ctx->ModelviewMatrixStack.Top->inv); - if (TEST_EQ_4V(texgen->EyePlane, tmp)) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - COPY_4FV(texgen->EyePlane, tmp); - } - break; - - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" ); - return; - } - - if (ctx->Driver.TexGen) - ctx->Driver.TexGen( ctx, coord, pname, params ); -} - - -static void GLAPIENTRY -_mesa_TexGeniv(GLenum coord, GLenum pname, const GLint *params ) -{ - GLfloat p[4]; - p[0] = (GLfloat) params[0]; - if (pname == GL_TEXTURE_GEN_MODE) { - p[1] = p[2] = p[3] = 0.0F; - } - else { - p[1] = (GLfloat) params[1]; - p[2] = (GLfloat) params[2]; - p[3] = (GLfloat) params[3]; - } - _mesa_TexGenfv(coord, pname, p); -} - - -static void GLAPIENTRY -_mesa_TexGend(GLenum coord, GLenum pname, GLdouble param ) -{ - GLfloat p[4]; - p[0] = (GLfloat) param; - p[1] = p[2] = p[3] = 0.0F; - _mesa_TexGenfv( coord, pname, p ); -} - -#if FEATURE_ES1 - -void GLAPIENTRY -_es_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params) -{ - ASSERT(coord == GL_TEXTURE_GEN_STR_OES); - _mesa_GetTexGenfv(GL_S, pname, params); -} - - -void GLAPIENTRY -_es_TexGenf(GLenum coord, GLenum pname, GLfloat param) -{ - ASSERT(coord == GL_TEXTURE_GEN_STR_OES); - /* set S, T, and R at the same time */ - _mesa_TexGenf(GL_S, pname, param); - _mesa_TexGenf(GL_T, pname, param); - _mesa_TexGenf(GL_R, pname, param); -} - - -void GLAPIENTRY -_es_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params) -{ - ASSERT(coord == GL_TEXTURE_GEN_STR_OES); - /* set S, T, and R at the same time */ - _mesa_TexGenfv(GL_S, pname, params); - _mesa_TexGenfv(GL_T, pname, params); - _mesa_TexGenfv(GL_R, pname, params); -} - -#endif - -static void GLAPIENTRY -_mesa_TexGendv(GLenum coord, GLenum pname, const GLdouble *params ) -{ - GLfloat p[4]; - p[0] = (GLfloat) params[0]; - if (pname == GL_TEXTURE_GEN_MODE) { - p[1] = p[2] = p[3] = 0.0F; - } - else { - p[1] = (GLfloat) params[1]; - p[2] = (GLfloat) params[2]; - p[3] = (GLfloat) params[3]; - } - _mesa_TexGenfv( coord, pname, p ); -} - - -void GLAPIENTRY -_mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param ) -{ - GLfloat p[4]; - p[0] = param; - p[1] = p[2] = p[3] = 0.0F; - _mesa_TexGenfv(coord, pname, p); -} - - -void GLAPIENTRY -_mesa_TexGeni( GLenum coord, GLenum pname, GLint param ) -{ - GLint p[4]; - p[0] = param; - p[1] = p[2] = p[3] = 0; - _mesa_TexGeniv( coord, pname, p ); -} - - - -static void GLAPIENTRY -_mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ) -{ - struct gl_texture_unit *texUnit; - struct gl_texgen *texgen; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGendv(current unit)"); - return; - } - - texUnit = _mesa_get_current_tex_unit(ctx); - - texgen = get_texgen(texUnit, coord); - if (!texgen) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGendv(coord)"); - return; - } - - switch (pname) { - case GL_TEXTURE_GEN_MODE: - params[0] = ENUM_TO_DOUBLE(texgen->Mode); - break; - case GL_OBJECT_PLANE: - COPY_4V(params, texgen->ObjectPlane); - break; - case GL_EYE_PLANE: - COPY_4V(params, texgen->EyePlane); - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" ); - } -} - - - -void GLAPIENTRY -_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) -{ - struct gl_texture_unit *texUnit; - struct gl_texgen *texgen; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGenfv(current unit)"); - return; - } - - texUnit = _mesa_get_current_tex_unit(ctx); - - texgen = get_texgen(texUnit, coord); - if (!texgen) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGenfv(coord)"); - return; - } - - switch (pname) { - case GL_TEXTURE_GEN_MODE: - params[0] = ENUM_TO_FLOAT(texgen->Mode); - break; - case GL_OBJECT_PLANE: - COPY_4V(params, texgen->ObjectPlane); - break; - case GL_EYE_PLANE: - COPY_4V(params, texgen->EyePlane); - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" ); - } -} - - - -static void GLAPIENTRY -_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ) -{ - struct gl_texture_unit *texUnit; - struct gl_texgen *texgen; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGeniv(current unit)"); - return; - } - - texUnit = _mesa_get_current_tex_unit(ctx); - - texgen = get_texgen(texUnit, coord); - if (!texgen) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGeniv(coord)"); - return; - } - - switch (pname) { - case GL_TEXTURE_GEN_MODE: - params[0] = texgen->Mode; - break; - case GL_OBJECT_PLANE: - params[0] = (GLint) texgen->ObjectPlane[0]; - params[1] = (GLint) texgen->ObjectPlane[1]; - params[2] = (GLint) texgen->ObjectPlane[2]; - params[3] = (GLint) texgen->ObjectPlane[3]; - break; - case GL_EYE_PLANE: - params[0] = (GLint) texgen->EyePlane[0]; - params[1] = (GLint) texgen->EyePlane[1]; - params[2] = (GLint) texgen->EyePlane[2]; - params[3] = (GLint) texgen->EyePlane[3]; - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); - } -} - - -void -_mesa_init_texgen_dispatch(struct _glapi_table *disp) -{ - SET_GetTexGendv(disp, _mesa_GetTexGendv); - SET_GetTexGenfv(disp, _mesa_GetTexGenfv); - SET_GetTexGeniv(disp, _mesa_GetTexGeniv); - SET_TexGend(disp, _mesa_TexGend); - SET_TexGendv(disp, _mesa_TexGendv); - SET_TexGenf(disp, _mesa_TexGenf); - SET_TexGenfv(disp, _mesa_TexGenfv); - SET_TexGeni(disp, _mesa_TexGeni); - SET_TexGeniv(disp, _mesa_TexGeniv); -} - - -#endif /* FEATURE_texgen */ +/* + * Mesa 3-D graphics library + * Version: 7.5 + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * \file texgen.c + * + * glTexGen-related functions + */ + + +#include "main/glheader.h" +#include "main/context.h" +#include "main/enums.h" +#include "main/macros.h" +#include "main/mfeatures.h" +#include "main/texgen.h" +#include "main/texstate.h" +#include "math/m_matrix.h" +#include "main/dispatch.h" + + +#if FEATURE_texgen + + +/** + * Return texgen state for given coordinate + */ +static struct gl_texgen * +get_texgen(struct gl_texture_unit *texUnit, GLenum coord) +{ + switch (coord) { + case GL_S: + return &texUnit->GenS; + case GL_T: + return &texUnit->GenT; + case GL_R: + return &texUnit->GenR; + case GL_Q: + return &texUnit->GenQ; + default: + return NULL; + } +} + + +void GLAPIENTRY +_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) +{ + struct gl_texture_unit *texUnit; + struct gl_texgen *texgen; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glTexGen %s %s %.1f(%s)...\n", + _mesa_lookup_enum_by_nr(coord), + _mesa_lookup_enum_by_nr(pname), + *params, + _mesa_lookup_enum_by_nr((GLenum) (GLint) *params)); + + if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glTexGen(current unit)"); + return; + } + + texUnit = _mesa_get_current_tex_unit(ctx); + + texgen = get_texgen(texUnit, coord); + if (!texgen) { + _mesa_error(ctx, GL_INVALID_ENUM, "glTexGen(coord)"); + return; + } + + switch (pname) { + case GL_TEXTURE_GEN_MODE: + { + GLenum mode = (GLenum) (GLint) params[0]; + GLbitfield bit = 0x0; + if (texgen->Mode == mode) + return; + switch (mode) { + case GL_OBJECT_LINEAR: + bit = TEXGEN_OBJ_LINEAR; + break; + case GL_EYE_LINEAR: + bit = TEXGEN_EYE_LINEAR; + break; + case GL_SPHERE_MAP: + if (coord == GL_S || coord == GL_T) + bit = TEXGEN_SPHERE_MAP; + break; + case GL_REFLECTION_MAP_NV: + if (coord != GL_Q) + bit = TEXGEN_REFLECTION_MAP_NV; + break; + case GL_NORMAL_MAP_NV: + if (coord != GL_Q) + bit = TEXGEN_NORMAL_MAP_NV; + break; + default: + ; /* nop */ + } + if (!bit) { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); + return; + } + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texgen->Mode = mode; + texgen->_ModeBit = bit; + } + break; + + case GL_OBJECT_PLANE: + { + if (TEST_EQ_4V(texgen->ObjectPlane, params)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + COPY_4FV(texgen->ObjectPlane, params); + } + break; + + case GL_EYE_PLANE: + { + GLfloat tmp[4]; + /* Transform plane equation by the inverse modelview matrix */ + if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) { + _math_matrix_analyse(ctx->ModelviewMatrixStack.Top); + } + _mesa_transform_vector(tmp, params, + ctx->ModelviewMatrixStack.Top->inv); + if (TEST_EQ_4V(texgen->EyePlane, tmp)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + COPY_4FV(texgen->EyePlane, tmp); + } + break; + + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" ); + return; + } + + if (ctx->Driver.TexGen) + ctx->Driver.TexGen( ctx, coord, pname, params ); +} + + +static void GLAPIENTRY +_mesa_TexGeniv(GLenum coord, GLenum pname, const GLint *params ) +{ + GLfloat p[4]; + p[0] = (GLfloat) params[0]; + if (pname == GL_TEXTURE_GEN_MODE) { + p[1] = p[2] = p[3] = 0.0F; + } + else { + p[1] = (GLfloat) params[1]; + p[2] = (GLfloat) params[2]; + p[3] = (GLfloat) params[3]; + } + _mesa_TexGenfv(coord, pname, p); +} + + +static void GLAPIENTRY +_mesa_TexGend(GLenum coord, GLenum pname, GLdouble param ) +{ + GLfloat p[4]; + p[0] = (GLfloat) param; + p[1] = p[2] = p[3] = 0.0F; + _mesa_TexGenfv( coord, pname, p ); +} + +#if FEATURE_ES1 + +void GLAPIENTRY +_es_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params) +{ + ASSERT(coord == GL_TEXTURE_GEN_STR_OES); + _mesa_GetTexGenfv(GL_S, pname, params); +} + + +void GLAPIENTRY +_es_TexGenf(GLenum coord, GLenum pname, GLfloat param) +{ + ASSERT(coord == GL_TEXTURE_GEN_STR_OES); + /* set S, T, and R at the same time */ + _mesa_TexGenf(GL_S, pname, param); + _mesa_TexGenf(GL_T, pname, param); + _mesa_TexGenf(GL_R, pname, param); +} + + +void GLAPIENTRY +_es_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params) +{ + ASSERT(coord == GL_TEXTURE_GEN_STR_OES); + /* set S, T, and R at the same time */ + _mesa_TexGenfv(GL_S, pname, params); + _mesa_TexGenfv(GL_T, pname, params); + _mesa_TexGenfv(GL_R, pname, params); +} + +#endif + +static void GLAPIENTRY +_mesa_TexGendv(GLenum coord, GLenum pname, const GLdouble *params ) +{ + GLfloat p[4]; + p[0] = (GLfloat) params[0]; + if (pname == GL_TEXTURE_GEN_MODE) { + p[1] = p[2] = p[3] = 0.0F; + } + else { + p[1] = (GLfloat) params[1]; + p[2] = (GLfloat) params[2]; + p[3] = (GLfloat) params[3]; + } + _mesa_TexGenfv( coord, pname, p ); +} + + +void GLAPIENTRY +_mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param ) +{ + GLfloat p[4]; + p[0] = param; + p[1] = p[2] = p[3] = 0.0F; + _mesa_TexGenfv(coord, pname, p); +} + + +void GLAPIENTRY +_mesa_TexGeni( GLenum coord, GLenum pname, GLint param ) +{ + GLint p[4]; + p[0] = param; + p[1] = p[2] = p[3] = 0; + _mesa_TexGeniv( coord, pname, p ); +} + + + +static void GLAPIENTRY +_mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ) +{ + struct gl_texture_unit *texUnit; + struct gl_texgen *texgen; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGendv(current unit)"); + return; + } + + texUnit = _mesa_get_current_tex_unit(ctx); + + texgen = get_texgen(texUnit, coord); + if (!texgen) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGendv(coord)"); + return; + } + + switch (pname) { + case GL_TEXTURE_GEN_MODE: + params[0] = ENUM_TO_DOUBLE(texgen->Mode); + break; + case GL_OBJECT_PLANE: + COPY_4V(params, texgen->ObjectPlane); + break; + case GL_EYE_PLANE: + COPY_4V(params, texgen->EyePlane); + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" ); + } +} + + + +void GLAPIENTRY +_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) +{ + struct gl_texture_unit *texUnit; + struct gl_texgen *texgen; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGenfv(current unit)"); + return; + } + + texUnit = _mesa_get_current_tex_unit(ctx); + + texgen = get_texgen(texUnit, coord); + if (!texgen) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGenfv(coord)"); + return; + } + + switch (pname) { + case GL_TEXTURE_GEN_MODE: + params[0] = ENUM_TO_FLOAT(texgen->Mode); + break; + case GL_OBJECT_PLANE: + COPY_4V(params, texgen->ObjectPlane); + break; + case GL_EYE_PLANE: + COPY_4V(params, texgen->EyePlane); + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" ); + } +} + + + +static void GLAPIENTRY +_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ) +{ + struct gl_texture_unit *texUnit; + struct gl_texgen *texgen; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGeniv(current unit)"); + return; + } + + texUnit = _mesa_get_current_tex_unit(ctx); + + texgen = get_texgen(texUnit, coord); + if (!texgen) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGeniv(coord)"); + return; + } + + switch (pname) { + case GL_TEXTURE_GEN_MODE: + params[0] = texgen->Mode; + break; + case GL_OBJECT_PLANE: + params[0] = (GLint) texgen->ObjectPlane[0]; + params[1] = (GLint) texgen->ObjectPlane[1]; + params[2] = (GLint) texgen->ObjectPlane[2]; + params[3] = (GLint) texgen->ObjectPlane[3]; + break; + case GL_EYE_PLANE: + params[0] = (GLint) texgen->EyePlane[0]; + params[1] = (GLint) texgen->EyePlane[1]; + params[2] = (GLint) texgen->EyePlane[2]; + params[3] = (GLint) texgen->EyePlane[3]; + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); + } +} + + +void +_mesa_init_texgen_dispatch(struct _glapi_table *disp) +{ + SET_GetTexGendv(disp, _mesa_GetTexGendv); + SET_GetTexGenfv(disp, _mesa_GetTexGenfv); + SET_GetTexGeniv(disp, _mesa_GetTexGeniv); + SET_TexGend(disp, _mesa_TexGend); + SET_TexGendv(disp, _mesa_TexGendv); + SET_TexGenf(disp, _mesa_TexGenf); + SET_TexGenfv(disp, _mesa_TexGenfv); + SET_TexGeni(disp, _mesa_TexGeni); + SET_TexGeniv(disp, _mesa_TexGeniv); +} + + +#endif /* FEATURE_texgen */ diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index 694f6fa00..b16baaf91 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -2606,26 +2606,9 @@ teximage(struct gl_context *ctx, GLuint dims, border, internalFormat, texFormat); /* Give the texture to the driver. may be null. */ - ASSERT(ctx->Driver.TexImage3D); - switch (dims) { - case 1: - ctx->Driver.TexImage1D(ctx, texImage, internalFormat, - width, border, format, - type, pixels, unpack); - break; - case 2: - ctx->Driver.TexImage2D(ctx, texImage, internalFormat, - width, height, border, format, - type, pixels, unpack); - break; - case 3: - ctx->Driver.TexImage3D(ctx, texImage, internalFormat, - width, height, depth, border, format, - type, pixels, unpack); - break; - default: - _mesa_problem(ctx, "invalid dims=%u in teximage()", dims); - } + ctx->Driver.TexImage(ctx, dims, texImage, internalFormat, + width, height, depth, border, format, + type, pixels, unpack); check_gen_mipmap(ctx, target, texObj, level); @@ -2809,26 +2792,10 @@ texsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level, xoffset += texImage->Border; } - switch (dims) { - case 1: - ctx->Driver.TexSubImage1D(ctx, texImage, - xoffset, width, - format, type, pixels, &ctx->Unpack); - break; - case 2: - ctx->Driver.TexSubImage2D(ctx, texImage, - xoffset, yoffset, width, height, - format, type, pixels, &ctx->Unpack); - break; - case 3: - ctx->Driver.TexSubImage3D(ctx, texImage, - xoffset, yoffset, zoffset, - width, height, depth, - format, type, pixels, &ctx->Unpack); - break; - default: - _mesa_problem(ctx, "unexpected dims in subteximage()"); - } + ctx->Driver.TexSubImage(ctx, dims, texImage, + xoffset, yoffset, zoffset, + width, height, depth, + format, type, pixels, &ctx->Unpack); check_gen_mipmap(ctx, target, texObj, level); @@ -2959,7 +2926,7 @@ copyteximage(struct gl_context *ctx, GLuint dims, GL_NONE, GL_NONE); if (legal_texture_size(ctx, texFormat, width, height, 1)) { - GLint srcX = x, srcY = y, dstX = 0, dstY = 0; + GLint srcX = x, srcY = y, dstX = 0, dstY = 0, dstZ = 0; /* Free old texture image */ ctx->Driver.FreeTextureImageBuffer(ctx, texImage); @@ -2968,29 +2935,17 @@ copyteximage(struct gl_context *ctx, GLuint dims, border, internalFormat, texFormat); /* Allocate texture memory (no pixel data yet) */ - if (dims == 1) { - ctx->Driver.TexImage1D(ctx, texImage, internalFormat, - width, border, GL_NONE, GL_NONE, NULL, - &ctx->Unpack); - } - else { - ctx->Driver.TexImage2D(ctx, texImage, internalFormat, - width, height, border, GL_NONE, GL_NONE, - NULL, &ctx->Unpack); - } + ctx->Driver.TexImage(ctx, dims, texImage, internalFormat, + width, height, 1, border, GL_NONE, GL_NONE, + NULL, &ctx->Unpack); if (_mesa_clip_copytexsubimage(ctx, &dstX, &dstY, &srcX, &srcY, &width, &height)) { struct gl_renderbuffer *srcRb = get_copy_tex_image_source(ctx, texImage->TexFormat); - if (dims == 1) - ctx->Driver.CopyTexSubImage1D(ctx, texImage, dstX, - srcRb, srcX, srcY, width); - - else - ctx->Driver.CopyTexSubImage2D(ctx, texImage, dstX, dstY, - srcRb, srcX, srcY, width, height); + ctx->Driver.CopyTexSubImage(ctx, dims, texImage, dstX, dstY, dstZ, + srcRb, srcX, srcY, width, height); } check_gen_mipmap(ctx, target, texObj, level); @@ -3089,23 +3044,9 @@ copytexsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level, struct gl_renderbuffer *srcRb = get_copy_tex_image_source(ctx, texImage->TexFormat); - switch (dims) { - case 1: - ctx->Driver.CopyTexSubImage1D(ctx, texImage, xoffset, - srcRb, x, y, width); - break; - case 2: - ctx->Driver.CopyTexSubImage2D(ctx, texImage, xoffset, yoffset, - srcRb, x, y, width, height); - break; - case 3: - ctx->Driver.CopyTexSubImage3D(ctx, texImage, - xoffset, yoffset, zoffset, - srcRb, x, y, width, height); - break; - default: - _mesa_problem(ctx, "bad dims in copytexsubimage()"); - } + ctx->Driver.CopyTexSubImage(ctx, dims, texImage, + xoffset, yoffset, zoffset, + srcRb, x, y, width, height); check_gen_mipmap(ctx, target, texObj, level); @@ -3600,31 +3541,10 @@ compressedteximage(struct gl_context *ctx, GLuint dims, width, height, depth, border, internalFormat, texFormat); - switch (dims) { - case 1: - ASSERT(ctx->Driver.CompressedTexImage1D); - ctx->Driver.CompressedTexImage1D(ctx, texImage, - internalFormat, - width, - border, imageSize, data); - break; - case 2: - ASSERT(ctx->Driver.CompressedTexImage2D); - ctx->Driver.CompressedTexImage2D(ctx, texImage, - internalFormat, - width, height, - border, imageSize, data); - break; - case 3: - ASSERT(ctx->Driver.CompressedTexImage3D); - ctx->Driver.CompressedTexImage3D(ctx, texImage, - internalFormat, - width, height, depth, - border, imageSize, data); - break; - default: - _mesa_problem(ctx, "bad dims in compressedteximage"); - } + ctx->Driver.CompressedTexImage(ctx, dims, texImage, + internalFormat, + width, height, depth, + border, imageSize, data); check_gen_mipmap(ctx, target, texObj, level); @@ -3713,33 +3633,10 @@ compressed_tex_sub_image(GLuint dims, GLenum target, GLint level, /* error was recorded */ } else if (width > 0 && height > 0 && depth > 0) { - switch (dims) { - case 1: - if (ctx->Driver.CompressedTexSubImage1D) { - ctx->Driver.CompressedTexSubImage1D(ctx, texImage, - xoffset, width, - format, imageSize, data); - } - break; - case 2: - if (ctx->Driver.CompressedTexSubImage2D) { - ctx->Driver.CompressedTexSubImage2D(ctx, texImage, - xoffset, yoffset, - width, height, - format, imageSize, data); - } - break; - case 3: - if (ctx->Driver.CompressedTexSubImage3D) { - ctx->Driver.CompressedTexSubImage3D(ctx, texImage, - xoffset, yoffset, zoffset, - width, height, depth, - format, imageSize, data); - } - break; - default: - ; - } + ctx->Driver.CompressedTexSubImage(ctx, dims, texImage, + xoffset, yoffset, zoffset, + width, height, depth, + format, imageSize, data); check_gen_mipmap(ctx, target, texObj, level); diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c index a471bad22..e0494c940 100644 --- a/mesalib/src/mesa/main/texobj.c +++ b/mesalib/src/mesa/main/texobj.c @@ -807,30 +807,10 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex) 0, /* border */ GL_RGBA, texFormat); - switch (dims) { - case 0: - break; - case 1: - ctx->Driver.TexImage1D(ctx, texImage, GL_RGBA, - width, 0, - GL_RGBA, GL_UNSIGNED_BYTE, texel, - &ctx->DefaultPacking); - break; - case 2: - ctx->Driver.TexImage2D(ctx, texImage, GL_RGBA, - width, height, 0, - GL_RGBA, GL_UNSIGNED_BYTE, texel, - &ctx->DefaultPacking); - break; - case 3: - ctx->Driver.TexImage3D(ctx, texImage, GL_RGBA, - width, height, depth, 0, - GL_RGBA, GL_UNSIGNED_BYTE, texel, - &ctx->DefaultPacking); - break; - default: - _mesa_problem(ctx, "bad dims in _mesa_get_fallback_texture()"); - } + ctx->Driver.TexImage(ctx, dims, texImage, GL_RGBA, + width, height, depth, 0, + GL_RGBA, GL_UNSIGNED_BYTE, texel, + &ctx->DefaultPacking); } _mesa_test_texobj_completeness(ctx, texObj); diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c index d368b1868..1ced8aac9 100644 --- a/mesalib/src/mesa/main/texstore.c +++ b/mesalib/src/mesa/main/texstore.c @@ -4261,170 +4261,71 @@ store_texsubimage(struct gl_context *ctx, /** - * This is the fallback for Driver.TexImage1D(). + * Fallback code for ctx->Driver.TexImage(). + * Basically, allocate storage for the texture image, then copy the + * user's image into it. */ void -_mesa_store_teximage1d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint border, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing) +_mesa_store_teximage(struct gl_context *ctx, + GLuint dims, + struct gl_texture_image *texImage, + GLint internalFormat, + GLint width, GLint height, GLint depth, GLint border, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing) { - if (width == 0) - return; - - /* allocate storage for texture data */ - if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage, texImage->TexFormat, - width, 1, 1)) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D"); - return; - } - - store_texsubimage(ctx, texImage, - 0, 0, 0, width, 1, 1, - format, type, pixels, packing, "glTexImage1D"); -} - - -/** - * This is the fallback for Driver.TexImage2D(). - */ -void -_mesa_store_teximage2d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint height, GLint border, - GLenum format, GLenum type, const void *pixels, - const struct gl_pixelstore_attrib *packing) -{ - if (width == 0 || height == 0) - return; - - /* allocate storage for texture data */ - if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage, texImage->TexFormat, - width, height, 1)) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); - return; - } - - store_texsubimage(ctx, texImage, - 0, 0, 0, width, height, 1, - format, type, pixels, packing, "glTexImage2D"); -} - + assert(dims == 1 || dims == 2 || dims == 3); - -/** - * This is the fallback for Driver.TexImage3D(). - */ -void -_mesa_store_teximage3d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint height, GLint depth, GLint border, - GLenum format, GLenum type, const void *pixels, - const struct gl_pixelstore_attrib *packing) -{ if (width == 0 || height == 0 || depth == 0) return; /* allocate storage for texture data */ if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage, texImage->TexFormat, width, height, depth)) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D"); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage%uD", dims); return; } store_texsubimage(ctx, texImage, 0, 0, 0, width, height, depth, - format, type, pixels, packing, "glTexImage3D"); + format, type, pixels, packing, "glTexImage"); } - - /* - * This is the fallback for Driver.TexSubImage1D(). + * Fallback for Driver.TexSubImage(). */ void -_mesa_store_texsubimage1d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint width, - GLenum format, GLenum type, const void *pixels, - const struct gl_pixelstore_attrib *packing) -{ - store_texsubimage(ctx, texImage, - xoffset, 0, 0, width, 1, 1, - format, type, pixels, packing, "glTexSubImage1D"); -} - - - -/** - * This is the fallback for Driver.TexSubImage2D(). - */ -void -_mesa_store_texsubimage2d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, - GLint width, GLint height, - GLenum format, GLenum type, const void *pixels, - const struct gl_pixelstore_attrib *packing) -{ - store_texsubimage(ctx, texImage, - xoffset, yoffset, 0, width, height, 1, - format, type, pixels, packing, "glTexSubImage2D"); -} - - -/* - * This is the fallback for Driver.TexSubImage3D(). - */ -void -_mesa_store_texsubimage3d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, GLint zoffset, - GLint width, GLint height, GLint depth, - GLenum format, GLenum type, const void *pixels, - const struct gl_pixelstore_attrib *packing) +_mesa_store_texsubimage(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + GLint width, GLint height, GLint depth, + GLenum format, GLenum type, const void *pixels, + const struct gl_pixelstore_attrib *packing) { store_texsubimage(ctx, texImage, xoffset, yoffset, zoffset, width, height, depth, - format, type, pixels, packing, "glTexSubImage3D"); -} - - -/* - * Fallback for Driver.CompressedTexImage1D() - */ -void -_mesa_store_compressed_teximage1d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint border, - GLsizei imageSize, const GLvoid *data) -{ - /* no compressed 1D image formats at this time */ - (void) ctx; - (void) internalFormat; - (void) width; (void) border; - (void) imageSize; (void) data; - (void) texImage; + format, type, pixels, packing, "glTexSubImage"); } - /** - * Fallback for Driver.CompressedTexImage2D() + * Fallback for Driver.CompressedTexImage() */ void -_mesa_store_compressed_teximage2d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint height, GLint border, - GLsizei imageSize, const GLvoid *data) +_mesa_store_compressed_teximage(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint internalFormat, + GLint width, GLint height, GLint depth, + GLint border, + GLsizei imageSize, const GLvoid *data) { + /* only 2D compressed images are supported at this time */ + if (dims != 2) { + _mesa_problem(ctx, "Unexpected glCompressedTexImage1D/3D call"); + return; + } + /* This is pretty simple, because unlike the general texstore path we don't * have to worry about the usual image unpacking or image transfer * operations. @@ -4441,66 +4342,24 @@ _mesa_store_compressed_teximage2d(struct gl_context *ctx, return; } - _mesa_store_compressed_texsubimage2d(ctx, texImage, - 0, 0, - width, height, - texImage->TexFormat, - imageSize, data); -} - - - -/* - * Fallback for Driver.CompressedTexImage3D() - */ -void -_mesa_store_compressed_teximage3d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint height, GLint depth, - GLint border, - GLsizei imageSize, const GLvoid *data) -{ - /* this space intentionally left blank */ - (void) ctx; - (void) internalFormat; - (void) width; (void) height; (void) depth; - (void) border; - (void) imageSize; (void) data; - (void) texImage; -} - - - -/** - * Fallback for Driver.CompressedTexSubImage1D() - */ -void -_mesa_store_compressed_texsubimage1d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLsizei width, - GLenum format, - GLsizei imageSize, const GLvoid *data) -{ - /* there are no compressed 1D texture formats yet */ - (void) ctx; - (void) xoffset; (void) width; - (void) format; - (void) imageSize; (void) data; - (void) texImage; + _mesa_store_compressed_texsubimage(ctx, dims, texImage, + 0, 0, 0, + width, height, depth, + texImage->TexFormat, + imageSize, data); } /** - * Fallback for Driver.CompressedTexSubImage2D() + * Fallback for Driver.CompressedTexSubImage() */ void -_mesa_store_compressed_texsubimage2d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, - GLenum format, - GLsizei imageSize, const GLvoid *data) +_mesa_store_compressed_texsubimage(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, + GLenum format, + GLsizei imageSize, const GLvoid *data) { GLint bytesPerRow, dstRowStride, srcRowStride; GLint i, rows; @@ -4509,6 +4368,11 @@ _mesa_store_compressed_texsubimage2d(struct gl_context *ctx, const gl_format texFormat = texImage->TexFormat; GLuint bw, bh; + if (dims != 2) { + _mesa_problem(ctx, "Unexpected 1D/3D compressed texsubimage call"); + return; + } + _mesa_get_format_block_size(texFormat, &bw, &bh); /* these should have been caught sooner */ @@ -4552,24 +4416,3 @@ _mesa_store_compressed_texsubimage2d(struct gl_context *ctx, _mesa_unmap_teximage_pbo(ctx, &ctx->Unpack); } - - -/** - * Fallback for Driver.CompressedTexSubImage3D() - */ -void -_mesa_store_compressed_texsubimage3d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, GLint zoffset, - GLsizei width, GLsizei height, GLsizei depth, - GLenum format, - GLsizei imageSize, const GLvoid *data) -{ - /* there are no compressed 3D texture formats yet */ - (void) ctx; - (void) xoffset; (void) yoffset; (void) zoffset; - (void) width; (void) height; (void) depth; - (void) format; - (void) imageSize; (void) data; - (void) texImage; -} diff --git a/mesalib/src/mesa/main/texstore.h b/mesalib/src/mesa/main/texstore.h index 85e33b0fe..5a1c01423 100644 --- a/mesalib/src/mesa/main/texstore.h +++ b/mesalib/src/mesa/main/texstore.h @@ -90,103 +90,40 @@ _mesa_make_temp_float_image(struct gl_context *ctx, GLuint dims, GLbitfield transferOps); extern void -_mesa_store_teximage1d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint border, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); +_mesa_store_teximage(struct gl_context *ctx, + GLuint dims, + struct gl_texture_image *texImage, + GLint internalFormat, + GLint width, GLint height, GLint depth, GLint border, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing); extern void -_mesa_store_teximage2d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint height, GLint border, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); +_mesa_store_texsubimage(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + GLint width, GLint height, GLint depth, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing); extern void -_mesa_store_teximage3d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint height, GLint depth, GLint border, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); +_mesa_store_compressed_teximage(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint internalFormat, + GLint width, GLint height, GLint depth, + GLint border, + GLsizei imageSize, const GLvoid *data); extern void -_mesa_store_texsubimage1d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint width, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); - - -extern void -_mesa_store_texsubimage2d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, - GLint width, GLint height, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); - - -extern void -_mesa_store_texsubimage3d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, GLint zoffset, - GLint width, GLint height, GLint depth, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); - - -extern void -_mesa_store_compressed_teximage1d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint border, - GLsizei imageSize, const GLvoid *data); - -extern void -_mesa_store_compressed_teximage2d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint height, GLint border, - GLsizei imageSize, const GLvoid *data); - -extern void -_mesa_store_compressed_teximage3d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint height, GLint depth, - GLint border, - GLsizei imageSize, const GLvoid *data); - - -extern void -_mesa_store_compressed_texsubimage1d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLsizei width, - GLenum format, - GLsizei imageSize, const GLvoid *data); - -extern void -_mesa_store_compressed_texsubimage2d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, - GLenum format, - GLsizei imageSize, const GLvoid *data); - -extern void -_mesa_store_compressed_texsubimage3d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, GLint zoffset, - GLsizei width, GLsizei height, GLsizei depth, - GLenum format, - GLsizei imageSize, const GLvoid *data); +_mesa_store_compressed_texsubimage(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, + GLenum format, + GLsizei imageSize, const GLvoid *data); #endif diff --git a/mesalib/src/mesa/main/texturebarrier.c b/mesalib/src/mesa/main/texturebarrier.c index ef4bd45e6..56cc8718c 100644 --- a/mesalib/src/mesa/main/texturebarrier.c +++ b/mesalib/src/mesa/main/texturebarrier.c @@ -1,54 +1,54 @@ -/* - * Copyright © 2011 Marek Olšák - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS 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. - */ - -/** - * \file texturebarrier.c - * Implementation of glTextureBarrierNV. - * - * \author Marek Olšák - */ - -#include "context.h" -#include "texturebarrier.h" - - -static void -_mesa_texture_barrier(struct gl_context *ctx) -{ - /* no-op */ -} - -void -_mesa_init_texture_barrier_functions(struct dd_function_table *driver) -{ - driver->TextureBarrier = _mesa_texture_barrier; -} - -void GLAPIENTRY -_mesa_TextureBarrierNV(void) -{ - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - ctx->Driver.TextureBarrier(ctx); -} +/* + * Copyright © 2011 Marek Olšák + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + */ + +/** + * \file texturebarrier.c + * Implementation of glTextureBarrierNV. + * + * \author Marek Olšák + */ + +#include "context.h" +#include "texturebarrier.h" + + +static void +_mesa_texture_barrier(struct gl_context *ctx) +{ + /* no-op */ +} + +void +_mesa_init_texture_barrier_functions(struct dd_function_table *driver) +{ + driver->TextureBarrier = _mesa_texture_barrier; +} + +void GLAPIENTRY +_mesa_TextureBarrierNV(void) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + ctx->Driver.TextureBarrier(ctx); +} diff --git a/mesalib/src/mesa/main/texturebarrier.h b/mesalib/src/mesa/main/texturebarrier.h index ef35989b4..a84a85b21 100644 --- a/mesalib/src/mesa/main/texturebarrier.h +++ b/mesalib/src/mesa/main/texturebarrier.h @@ -1,44 +1,44 @@ -/* - * Copyright © 2011 Marek Olšák - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS 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. - */ - -/** - * \file texturebarrier.h - * GL_NV_texture_barrier - * - * \author Marek Olšák - */ - -#ifndef TEXTUREBARRIER_H -#define TEXTUREBARRIER_H - -#include "glheader.h" - -struct dd_function_table; - -extern void -_mesa_init_texture_barrier_functions(struct dd_function_table *driver); - -extern void GLAPIENTRY -_mesa_TextureBarrierNV(void); - -#endif /* TEXTUREBARRIER_H */ +/* + * Copyright © 2011 Marek Olšák + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + */ + +/** + * \file texturebarrier.h + * GL_NV_texture_barrier + * + * \author Marek Olšák + */ + +#ifndef TEXTUREBARRIER_H +#define TEXTUREBARRIER_H + +#include "glheader.h" + +struct dd_function_table; + +extern void +_mesa_init_texture_barrier_functions(struct dd_function_table *driver); + +extern void GLAPIENTRY +_mesa_TextureBarrierNV(void); + +#endif /* TEXTUREBARRIER_H */ diff --git a/mesalib/src/mesa/main/transformfeedback.c b/mesalib/src/mesa/main/transformfeedback.c index f2c1435d9..1bd76d130 100644 --- a/mesalib/src/mesa/main/transformfeedback.c +++ b/mesalib/src/mesa/main/transformfeedback.c @@ -470,7 +470,12 @@ _mesa_BindBufferRange(GLenum target, GLuint index, return; } - bufObj = _mesa_lookup_bufferobj(ctx, buffer); + if (buffer == 0) { + bufObj = ctx->Shared->NullBufferObj; + } else { + bufObj = _mesa_lookup_bufferobj(ctx, buffer); + } + if (!bufObj) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBindBufferRange(invalid buffer=%u)", buffer); @@ -518,7 +523,12 @@ _mesa_BindBufferBase(GLenum target, GLuint index, GLuint buffer) return; } - bufObj = _mesa_lookup_bufferobj(ctx, buffer); + if (buffer == 0) { + bufObj = ctx->Shared->NullBufferObj; + } else { + bufObj = _mesa_lookup_bufferobj(ctx, buffer); + } + if (!bufObj) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBindBufferBase(invalid buffer=%u)", buffer); @@ -574,7 +584,12 @@ _mesa_BindBufferOffsetEXT(GLenum target, GLuint index, GLuint buffer, return; } - bufObj = _mesa_lookup_bufferobj(ctx, buffer); + if (buffer == 0) { + bufObj = ctx->Shared->NullBufferObj; + } else { + bufObj = _mesa_lookup_bufferobj(ctx, buffer); + } + if (!bufObj) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBindBufferOffsetEXT(invalid buffer=%u)", buffer); diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c index 90afecb5d..efaaf58de 100644 --- a/mesalib/src/mesa/main/version.c +++ b/mesalib/src/mesa/main/version.c @@ -171,6 +171,7 @@ compute_version(struct gl_context *ctx) ctx->Extensions.ARB_instanced_arrays && ctx->Extensions.ARB_occlusion_query2 && ctx->Extensions.ARB_sampler_objects && + ctx->Extensions.ARB_shader_bit_encoding && ctx->Extensions.ARB_texture_rgb10_a2ui && ctx->Extensions.ARB_timer_query && ctx->Extensions.ARB_vertex_type_2_10_10_10_rev && diff --git a/mesalib/src/mesa/main/viewport.c b/mesalib/src/mesa/main/viewport.c index 9186d1bb8..a58697ab3 100644 --- a/mesalib/src/mesa/main/viewport.c +++ b/mesalib/src/mesa/main/viewport.c @@ -1,185 +1,185 @@ -/* - * Mesa 3-D graphics library - * Version: 7.5 - * - * Copyright (C) 2009 VMware, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -/** - * \file viewport.c - * glViewport and glDepthRange functions. - */ - - -#include "context.h" -#include "macros.h" -#include "mtypes.h" -#include "viewport.h" - - -/** - * Set the viewport. - * \sa Called via glViewport() or display list execution. - * - * Flushes the vertices and calls _mesa_set_viewport() with the given - * parameters. - */ -void GLAPIENTRY -_mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei height) -{ - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - _mesa_set_viewport(ctx, x, y, width, height); -} - - -/** - * Set new viewport parameters and update derived state (the _WindowMap - * matrix). Usually called from _mesa_Viewport(). - * - * \param ctx GL context. - * \param x, y coordinates of the lower left corner of the viewport rectangle. - * \param width width of the viewport rectangle. - * \param height height of the viewport rectangle. - */ -void -_mesa_set_viewport(struct gl_context *ctx, GLint x, GLint y, - GLsizei width, GLsizei height) -{ - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glViewport %d %d %d %d\n", x, y, width, height); - - if (width < 0 || height < 0) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glViewport(%d, %d, %d, %d)", x, y, width, height); - return; - } - - /* clamp width and height to the implementation dependent range */ - width = MIN2(width, (GLsizei) ctx->Const.MaxViewportWidth); - height = MIN2(height, (GLsizei) ctx->Const.MaxViewportHeight); - - ctx->Viewport.X = x; - ctx->Viewport.Width = width; - ctx->Viewport.Y = y; - ctx->Viewport.Height = height; - ctx->NewState |= _NEW_VIEWPORT; - -#if 1 - /* XXX remove this someday. Currently the DRI drivers rely on - * the WindowMap matrix being up to date in the driver's Viewport - * and DepthRange functions. - */ - _math_matrix_viewport(&ctx->Viewport._WindowMap, - ctx->Viewport.X, ctx->Viewport.Y, - ctx->Viewport.Width, ctx->Viewport.Height, - ctx->Viewport.Near, ctx->Viewport.Far, - ctx->DrawBuffer->_DepthMaxF); -#endif - - if (ctx->Driver.Viewport) { - /* Many drivers will use this call to check for window size changes - * and reallocate the z/stencil/accum/etc buffers if needed. - */ - ctx->Driver.Viewport(ctx, x, y, width, height); - } -} - - -/** - * Called by glDepthRange - * - * \param nearval specifies the Z buffer value which should correspond to - * the near clip plane - * \param farval specifies the Z buffer value which should correspond to - * the far clip plane - */ -void GLAPIENTRY -_mesa_DepthRange(GLclampd nearval, GLclampd farval) -{ - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - - if (MESA_VERBOSE&VERBOSE_API) - _mesa_debug(ctx, "glDepthRange %f %f\n", nearval, farval); - - if (ctx->Viewport.Near == nearval && - ctx->Viewport.Far == farval) - return; - - ctx->Viewport.Near = (GLfloat) CLAMP(nearval, 0.0, 1.0); - ctx->Viewport.Far = (GLfloat) CLAMP(farval, 0.0, 1.0); - ctx->NewState |= _NEW_VIEWPORT; - -#if 1 - /* XXX remove this someday. Currently the DRI drivers rely on - * the WindowMap matrix being up to date in the driver's Viewport - * and DepthRange functions. - */ - _math_matrix_viewport(&ctx->Viewport._WindowMap, - ctx->Viewport.X, ctx->Viewport.Y, - ctx->Viewport.Width, ctx->Viewport.Height, - ctx->Viewport.Near, ctx->Viewport.Far, - ctx->DrawBuffer->_DepthMaxF); -#endif - - if (ctx->Driver.DepthRange) { - ctx->Driver.DepthRange(ctx, nearval, farval); - } -} - -void GLAPIENTRY -_mesa_DepthRangef(GLclampf nearval, GLclampf farval) -{ - _mesa_DepthRange(nearval, farval); -} - -/** - * Initialize the context viewport attribute group. - * \param ctx the GL context. - */ -void _mesa_init_viewport(struct gl_context *ctx) -{ - GLfloat depthMax = 65535.0F; /* sorf of arbitrary */ - - /* Viewport group */ - ctx->Viewport.X = 0; - ctx->Viewport.Y = 0; - ctx->Viewport.Width = 0; - ctx->Viewport.Height = 0; - ctx->Viewport.Near = 0.0; - ctx->Viewport.Far = 1.0; - _math_matrix_ctr(&ctx->Viewport._WindowMap); - - _math_matrix_viewport(&ctx->Viewport._WindowMap, 0, 0, 0, 0, - 0.0F, 1.0F, depthMax); -} - - -/** - * Free the context viewport attribute group data. - * \param ctx the GL context. - */ -void _mesa_free_viewport_data(struct gl_context *ctx) -{ - _math_matrix_dtr(&ctx->Viewport._WindowMap); -} - +/* + * Mesa 3-D graphics library + * Version: 7.5 + * + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +/** + * \file viewport.c + * glViewport and glDepthRange functions. + */ + + +#include "context.h" +#include "macros.h" +#include "mtypes.h" +#include "viewport.h" + + +/** + * Set the viewport. + * \sa Called via glViewport() or display list execution. + * + * Flushes the vertices and calls _mesa_set_viewport() with the given + * parameters. + */ +void GLAPIENTRY +_mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei height) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + _mesa_set_viewport(ctx, x, y, width, height); +} + + +/** + * Set new viewport parameters and update derived state (the _WindowMap + * matrix). Usually called from _mesa_Viewport(). + * + * \param ctx GL context. + * \param x, y coordinates of the lower left corner of the viewport rectangle. + * \param width width of the viewport rectangle. + * \param height height of the viewport rectangle. + */ +void +_mesa_set_viewport(struct gl_context *ctx, GLint x, GLint y, + GLsizei width, GLsizei height) +{ + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glViewport %d %d %d %d\n", x, y, width, height); + + if (width < 0 || height < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glViewport(%d, %d, %d, %d)", x, y, width, height); + return; + } + + /* clamp width and height to the implementation dependent range */ + width = MIN2(width, (GLsizei) ctx->Const.MaxViewportWidth); + height = MIN2(height, (GLsizei) ctx->Const.MaxViewportHeight); + + ctx->Viewport.X = x; + ctx->Viewport.Width = width; + ctx->Viewport.Y = y; + ctx->Viewport.Height = height; + ctx->NewState |= _NEW_VIEWPORT; + +#if 1 + /* XXX remove this someday. Currently the DRI drivers rely on + * the WindowMap matrix being up to date in the driver's Viewport + * and DepthRange functions. + */ + _math_matrix_viewport(&ctx->Viewport._WindowMap, + ctx->Viewport.X, ctx->Viewport.Y, + ctx->Viewport.Width, ctx->Viewport.Height, + ctx->Viewport.Near, ctx->Viewport.Far, + ctx->DrawBuffer->_DepthMaxF); +#endif + + if (ctx->Driver.Viewport) { + /* Many drivers will use this call to check for window size changes + * and reallocate the z/stencil/accum/etc buffers if needed. + */ + ctx->Driver.Viewport(ctx, x, y, width, height); + } +} + + +/** + * Called by glDepthRange + * + * \param nearval specifies the Z buffer value which should correspond to + * the near clip plane + * \param farval specifies the Z buffer value which should correspond to + * the far clip plane + */ +void GLAPIENTRY +_mesa_DepthRange(GLclampd nearval, GLclampd farval) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (MESA_VERBOSE&VERBOSE_API) + _mesa_debug(ctx, "glDepthRange %f %f\n", nearval, farval); + + if (ctx->Viewport.Near == nearval && + ctx->Viewport.Far == farval) + return; + + ctx->Viewport.Near = (GLfloat) CLAMP(nearval, 0.0, 1.0); + ctx->Viewport.Far = (GLfloat) CLAMP(farval, 0.0, 1.0); + ctx->NewState |= _NEW_VIEWPORT; + +#if 1 + /* XXX remove this someday. Currently the DRI drivers rely on + * the WindowMap matrix being up to date in the driver's Viewport + * and DepthRange functions. + */ + _math_matrix_viewport(&ctx->Viewport._WindowMap, + ctx->Viewport.X, ctx->Viewport.Y, + ctx->Viewport.Width, ctx->Viewport.Height, + ctx->Viewport.Near, ctx->Viewport.Far, + ctx->DrawBuffer->_DepthMaxF); +#endif + + if (ctx->Driver.DepthRange) { + ctx->Driver.DepthRange(ctx, nearval, farval); + } +} + +void GLAPIENTRY +_mesa_DepthRangef(GLclampf nearval, GLclampf farval) +{ + _mesa_DepthRange(nearval, farval); +} + +/** + * Initialize the context viewport attribute group. + * \param ctx the GL context. + */ +void _mesa_init_viewport(struct gl_context *ctx) +{ + GLfloat depthMax = 65535.0F; /* sorf of arbitrary */ + + /* Viewport group */ + ctx->Viewport.X = 0; + ctx->Viewport.Y = 0; + ctx->Viewport.Width = 0; + ctx->Viewport.Height = 0; + ctx->Viewport.Near = 0.0; + ctx->Viewport.Far = 1.0; + _math_matrix_ctr(&ctx->Viewport._WindowMap); + + _math_matrix_viewport(&ctx->Viewport._WindowMap, 0, 0, 0, 0, + 0.0F, 1.0F, depthMax); +} + + +/** + * Free the context viewport attribute group data. + * \param ctx the GL context. + */ +void _mesa_free_viewport_data(struct gl_context *ctx) +{ + _math_matrix_dtr(&ctx->Viewport._WindowMap); +} + diff --git a/mesalib/src/mesa/main/viewport.h b/mesalib/src/mesa/main/viewport.h index 2f66c6a67..db4507bea 100644 --- a/mesalib/src/mesa/main/viewport.h +++ b/mesalib/src/mesa/main/viewport.h @@ -1,58 +1,58 @@ -/* - * Mesa 3-D graphics library - * Version: 7.5 - * - * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. - * Copyright (C) 2009 VMware, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#ifndef VIEWPORT_H -#define VIEWPORT_H - -#include "glheader.h" - -struct gl_context; - -extern void GLAPIENTRY -_mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei height); - - -extern void -_mesa_set_viewport(struct gl_context *ctx, GLint x, GLint y, - GLsizei width, GLsizei height); - - -extern void GLAPIENTRY -_mesa_DepthRange(GLclampd nearval, GLclampd farval); - -extern void GLAPIENTRY -_mesa_DepthRangef(GLclampf nearval, GLclampf farval); - - -extern void -_mesa_init_viewport(struct gl_context *ctx); - - -extern void -_mesa_free_viewport_data(struct gl_context *ctx); - - -#endif +/* + * Mesa 3-D graphics library + * Version: 7.5 + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef VIEWPORT_H +#define VIEWPORT_H + +#include "glheader.h" + +struct gl_context; + +extern void GLAPIENTRY +_mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei height); + + +extern void +_mesa_set_viewport(struct gl_context *ctx, GLint x, GLint y, + GLsizei width, GLsizei height); + + +extern void GLAPIENTRY +_mesa_DepthRange(GLclampd nearval, GLclampd farval); + +extern void GLAPIENTRY +_mesa_DepthRangef(GLclampf nearval, GLclampf farval); + + +extern void +_mesa_init_viewport(struct gl_context *ctx); + + +extern void +_mesa_free_viewport_data(struct gl_context *ctx); + + +#endif -- cgit v1.2.3