From 2233d4c1ee53f1cfd016b68d8249b8d934ef17ee Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 28 Jun 2007 07:15:37 -0600 Subject: remove obsolete t_save_api.c --- src/mesa/tnl/t_save_api.c | 1834 --------------------------------------------- 1 file changed, 1834 deletions(-) delete mode 100644 src/mesa/tnl/t_save_api.c (limited to 'src/mesa/tnl') diff --git a/src/mesa/tnl/t_save_api.c b/src/mesa/tnl/t_save_api.c deleted file mode 100644 index b08f05374e..0000000000 --- a/src/mesa/tnl/t_save_api.c +++ /dev/null @@ -1,1834 +0,0 @@ -/************************************************************************** - -Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas. - -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation -on the rights to use, copy, modify, merge, publish, distribute, sub -license, and/or sell copies of the Software, and to permit persons to whom -the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice (including the next -paragraph) shall be included in all copies or substantial portions of the -Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL -TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Authors: - * Keith Whitwell - */ - - - -/** - * The display list compiler attempts to store lists of vertices with the - * same vertex layout. Additionally it attempts to minimize the need - * for execute-time fixup of these vertex lists, allowing them to be - * cached on hardware. - * - * There are still some circumstances where this can be thwarted, for - * example by building a list that consists of one very long primitive - * (eg Begin(Triangles), 1000 vertices, End), and calling that list - * from inside a different begin/end object (Begin(Lines), CallList, - * End). - * - * In that case the code will have to replay the list as individual - * commands through the Exec dispatch table, or fix up the copied - * vertices at execute-time. - * - * The other case where fixup is required is when a vertex attribute - * is introduced in the middle of a primitive. Eg: - * Begin(Lines) - * TexCoord1f() Vertex2f() - * TexCoord1f() Color3f() Vertex2f() - * End() - * - * If the current value of Color isn't known at compile-time, this - * primitive will require fixup. - * - * - * The list compiler currently doesn't attempt to compile lists - * containing EvalCoord or EvalPoint commands. On encountering one of - * these, compilation falls back to opcodes. - * - * This could be improved to fallback only when a mix of EvalCoord and - * Vertex commands are issued within a single primitive. - */ - - -#include "glheader.h" -#include "context.h" -#include "dlist.h" -#include "enums.h" -#include "macros.h" -#include "api_validate.h" -#include "api_arrayelt.h" -#include "vtxfmt.h" -#include "t_save_api.h" -#include "dispatch.h" - -/* - * NOTE: Old 'parity' issue is gone, but copying can still be - * wrong-footed on replay. - */ -static GLuint _save_copy_vertices( GLcontext *ctx, - const struct tnl_vertex_list *node ) -{ - TNLcontext *tnl = TNL_CONTEXT( ctx ); - const struct tnl_prim *prim = &node->prim[node->prim_count-1]; - GLuint nr = prim->count; - GLuint sz = tnl->save.vertex_size; - const GLfloat *src = node->buffer + prim->start * sz; - GLfloat *dst = tnl->save.copied.buffer; - GLuint ovf, i; - - if (prim->mode & PRIM_END) - return 0; - - switch( prim->mode & PRIM_MODE_MASK ) - { - case GL_POINTS: - return 0; - case GL_LINES: - ovf = nr&1; - for (i = 0 ; i < ovf ; i++) - _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) ); - return i; - case GL_TRIANGLES: - ovf = nr%3; - for (i = 0 ; i < ovf ; i++) - _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) ); - return i; - case GL_QUADS: - ovf = nr&3; - for (i = 0 ; i < ovf ; i++) - _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) ); - return i; - case GL_LINE_STRIP: - if (nr == 0) - return 0; - else { - _mesa_memcpy( dst, src+(nr-1)*sz, sz*sizeof(GLfloat) ); - return 1; - } - case GL_LINE_LOOP: - case GL_TRIANGLE_FAN: - case GL_POLYGON: - if (nr == 0) - return 0; - else if (nr == 1) { - _mesa_memcpy( dst, src+0, sz*sizeof(GLfloat) ); - return 1; - } else { - _mesa_memcpy( dst, src+0, sz*sizeof(GLfloat) ); - _mesa_memcpy( dst+sz, src+(nr-1)*sz, sz*sizeof(GLfloat) ); - return 2; - } - case GL_TRIANGLE_STRIP: - case GL_QUAD_STRIP: - switch (nr) { - case 0: ovf = 0; break; - case 1: ovf = 1; break; - default: ovf = 2 + (nr&1); break; - } - for (i = 0 ; i < ovf ; i++) - _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) ); - return i; - default: - assert(0); - return 0; - } -} - - -static void -build_normal_lengths( struct tnl_vertex_list *node ) -{ - GLuint i; - GLfloat *len; - GLfloat *n = node->buffer; - GLuint stride = node->vertex_size; - GLuint count = node->count; - - len = node->normal_lengths = (GLfloat *) MALLOC( count * sizeof(GLfloat) ); - if (!len) - return; - - /* Find the normal of the first vertex: - */ - for (i = 0 ; i < _TNL_ATTRIB_NORMAL ; i++) - n += node->attrsz[i]; - - for (i = 0 ; i < count ; i++, n += stride) { - len[i] = LEN_3FV( n ); - if (len[i] > 0.0F) len[i] = 1.0F / len[i]; - } -} - -static struct tnl_vertex_store *alloc_vertex_store( GLcontext *ctx ) -{ - struct tnl_vertex_store *store = MALLOC_STRUCT(tnl_vertex_store); - (void) ctx; - store->used = 0; - store->refcount = 1; - return store; -} - -static struct tnl_primitive_store *alloc_prim_store( GLcontext *ctx ) -{ - struct tnl_primitive_store *store = MALLOC_STRUCT(tnl_primitive_store); - (void) ctx; - store->used = 0; - store->refcount = 1; - return store; -} - -static void _save_reset_counters( GLcontext *ctx ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - - tnl->save.prim = tnl->save.prim_store->buffer + tnl->save.prim_store->used; - tnl->save.buffer = (tnl->save.vertex_store->buffer + - tnl->save.vertex_store->used); - - if (tnl->save.vertex_size) - tnl->save.initial_counter = ((SAVE_BUFFER_SIZE - - tnl->save.vertex_store->used) / - tnl->save.vertex_size); - else - tnl->save.initial_counter = 0; - - if (tnl->save.initial_counter > ctx->Const.MaxArrayLockSize ) - tnl->save.initial_counter = ctx->Const.MaxArrayLockSize; - - tnl->save.counter = tnl->save.initial_counter; - tnl->save.prim_count = 0; - tnl->save.prim_max = SAVE_PRIM_SIZE - tnl->save.prim_store->used; - tnl->save.copied.nr = 0; - tnl->save.dangling_attr_ref = 0; -} - - -/* Insert the active immediate struct onto the display list currently - * being built. - */ -static void _save_compile_vertex_list( GLcontext *ctx ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct tnl_vertex_list *node; - - /* Allocate space for this structure in the display list currently - * being compiled. - */ - node = (struct tnl_vertex_list *) - _mesa_alloc_instruction(ctx, tnl->save.opcode_vertex_list, sizeof(*node)); - - if (!node) - return; - - /* Duplicate our template, increment refcounts to the storage structs: - */ - _mesa_memcpy(node->attrsz, tnl->save.attrsz, sizeof(node->attrsz)); - node->vertex_size = tnl->save.vertex_size; - node->buffer = tnl->save.buffer; - node->count = tnl->save.initial_counter - tnl->save.counter; - node->wrap_count = tnl->save.copied.nr; - node->have_materials = tnl->save.have_materials; - node->dangling_attr_ref = tnl->save.dangling_attr_ref; - node->normal_lengths = NULL; - node->prim = tnl->save.prim; - node->prim_count = tnl->save.prim_count; - node->vertex_store = tnl->save.vertex_store; - node->prim_store = tnl->save.prim_store; - - node->vertex_store->refcount++; - node->prim_store->refcount++; - - assert(node->attrsz[_TNL_ATTRIB_POS] != 0 || - node->count == 0); - - if (tnl->save.dangling_attr_ref) - ctx->ListState.CurrentList->flags |= MESA_DLIST_DANGLING_REFS; - - /* Maybe calculate normal lengths: - */ - if (tnl->CalcDListNormalLengths && - node->attrsz[_TNL_ATTRIB_NORMAL] == 3 && - !(ctx->ListState.CurrentList->flags & MESA_DLIST_DANGLING_REFS)) - build_normal_lengths( node ); - - - tnl->save.vertex_store->used += tnl->save.vertex_size * node->count; - tnl->save.prim_store->used += node->prim_count; - - /* Decide whether the storage structs are full, or can be used for - * the next vertex lists as well. - */ - if (tnl->save.vertex_store->used > - SAVE_BUFFER_SIZE - 16 * (tnl->save.vertex_size + 4)) { - - tnl->save.vertex_store->refcount--; - assert(tnl->save.vertex_store->refcount != 0); - tnl->save.vertex_store = alloc_vertex_store( ctx ); - tnl->save.vbptr = tnl->save.vertex_store->buffer; - } - - if (tnl->save.prim_store->used > SAVE_PRIM_SIZE - 6) { - tnl->save.prim_store->refcount--; - assert(tnl->save.prim_store->refcount != 0); - tnl->save.prim_store = alloc_prim_store( ctx ); - } - - /* Reset our structures for the next run of vertices: - */ - _save_reset_counters( ctx ); - - /* Copy duplicated vertices - */ - tnl->save.copied.nr = _save_copy_vertices( ctx, node ); - - - /* Deal with GL_COMPILE_AND_EXECUTE: - */ - if (ctx->ExecuteFlag) { - _tnl_playback_vertex_list( ctx, (void *) node ); - } -} - - -/* TODO -- If no new vertices have been stored, don't bother saving - * it. - */ -static void _save_wrap_buffers( GLcontext *ctx ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - GLint i = tnl->save.prim_count - 1; - GLenum mode; - - assert(i < (GLint) tnl->save.prim_max); - assert(i >= 0); - - /* Close off in-progress primitive. - */ - tnl->save.prim[i].count = ((tnl->save.initial_counter - tnl->save.counter) - - tnl->save.prim[i].start); - mode = tnl->save.prim[i].mode & ~(PRIM_BEGIN|PRIM_END); - - /* store the copied vertices, and allocate a new list. - */ - _save_compile_vertex_list( ctx ); - - /* Restart interrupted primitive - */ - tnl->save.prim[0].mode = mode; - tnl->save.prim[0].start = 0; - tnl->save.prim[0].count = 0; - tnl->save.prim_count = 1; -} - - - -/* Called only when buffers are wrapped as the result of filling the - * vertex_store struct. - */ -static void _save_wrap_filled_vertex( GLcontext *ctx ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - GLfloat *data = tnl->save.copied.buffer; - GLuint i; - - /* Emit a glEnd to close off the last vertex list. - */ - _save_wrap_buffers( ctx ); - - /* Copy stored stored vertices to start of new list. - */ - assert(tnl->save.counter > tnl->save.copied.nr); - - for (i = 0 ; i < tnl->save.copied.nr ; i++) { - _mesa_memcpy( tnl->save.vbptr, data, tnl->save.vertex_size * sizeof(GLfloat)); - data += tnl->save.vertex_size; - tnl->save.vbptr += tnl->save.vertex_size; - tnl->save.counter--; - } -} - - -static void _save_copy_to_current( GLcontext *ctx ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - GLuint i; - - /* XXX Use _TNL_FIRST_* and _TNL_LAST_* values instead? */ - for (i = _TNL_ATTRIB_POS+1 ; i <= _TNL_ATTRIB_EDGEFLAG ; i++) { - if (tnl->save.attrsz[i]) { - tnl->save.currentsz[i][0] = tnl->save.attrsz[i]; - COPY_CLEAN_4V(tnl->save.current[i], - tnl->save.attrsz[i], - tnl->save.attrptr[i]); - } - } - - /* Edgeflag requires special treatment: - * - * TODO: change edgeflag to GLfloat in Mesa. - */ - if (tnl->save.attrsz[_TNL_ATTRIB_EDGEFLAG]) { - ctx->ListState.ActiveEdgeFlag = 1; - tnl->save.CurrentFloatEdgeFlag = - tnl->save.attrptr[_TNL_ATTRIB_EDGEFLAG][0]; - ctx->ListState.CurrentEdgeFlag = - (tnl->save.CurrentFloatEdgeFlag == 1.0); - } -} - - -static void _save_copy_from_current( GLcontext *ctx ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - GLint i; - - for (i = _TNL_ATTRIB_POS+1 ; i <= _TNL_ATTRIB_EDGEFLAG ; i++) - switch (tnl->save.attrsz[i]) { - case 4: tnl->save.attrptr[i][3] = tnl->save.current[i][3]; - case 3: tnl->save.attrptr[i][2] = tnl->save.current[i][2]; - case 2: tnl->save.attrptr[i][1] = tnl->save.current[i][1]; - case 1: tnl->save.attrptr[i][0] = tnl->save.current[i][0]; - case 0: break; - } - - /* Edgeflag requires special treatment: - */ - if (tnl->save.attrsz[_TNL_ATTRIB_EDGEFLAG]) { - tnl->save.CurrentFloatEdgeFlag = (GLfloat)ctx->ListState.CurrentEdgeFlag; - tnl->save.attrptr[_TNL_ATTRIB_EDGEFLAG][0] = tnl->save.CurrentFloatEdgeFlag; - } -} - - - - -/* Flush existing data, set new attrib size, replay copied vertices. - */ -static void _save_upgrade_vertex( GLcontext *ctx, - GLuint attr, - GLuint newsz ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - GLuint oldsz; - GLuint i; - GLfloat *tmp; - - /* Store the current run of vertices, and emit a GL_END. Emit a - * BEGIN in the new buffer. - */ - if (tnl->save.initial_counter != tnl->save.counter) - _save_wrap_buffers( ctx ); - else - assert( tnl->save.copied.nr == 0 ); - - /* Do a COPY_TO_CURRENT to ensure back-copying works for the case - * when the attribute already exists in the vertex and is having - * its size increased. - */ - _save_copy_to_current( ctx ); - - /* Fix up sizes: - */ - oldsz = tnl->save.attrsz[attr]; - tnl->save.attrsz[attr] = newsz; - - tnl->save.vertex_size += newsz - oldsz; - tnl->save.counter = ((SAVE_BUFFER_SIZE - tnl->save.vertex_store->used) / - tnl->save.vertex_size); - if (tnl->save.counter > ctx->Const.MaxArrayLockSize ) - tnl->save.counter = ctx->Const.MaxArrayLockSize; - tnl->save.initial_counter = tnl->save.counter; - - /* Recalculate all the attrptr[] values: - */ - for (i = 0, tmp = tnl->save.vertex ; i < _TNL_ATTRIB_MAX ; i++) { - if (tnl->save.attrsz[i]) { - tnl->save.attrptr[i] = tmp; - tmp += tnl->save.attrsz[i]; - } - else - tnl->save.attrptr[i] = NULL; /* will not be dereferenced. */ - } - - /* Copy from current to repopulate the vertex with correct values. - */ - _save_copy_from_current( ctx ); - - /* Replay stored vertices to translate them to new format here. - * - * If there are copied vertices and the new (upgraded) attribute - * has not been defined before, this list is somewhat degenerate, - * and will need fixup at runtime. - */ - if (tnl->save.copied.nr) - { - GLfloat *data = tnl->save.copied.buffer; - GLfloat *dest = tnl->save.buffer; - GLuint j; - - /* Need to note this and fix up at runtime (or loopback): - */ - if (tnl->save.currentsz[attr][0] == 0) { - assert(oldsz == 0); - tnl->save.dangling_attr_ref = GL_TRUE; - -/* _mesa_debug(NULL, "_save_upgrade_vertex: dangling reference attr %d\n", */ -/* attr); */ - -#if 0 - /* The current strategy is to punt these degenerate cases - * through _tnl_loopback_vertex_list(), a lower-performance - * option. To minimize the impact of this, artificially - * reduce the size of this vertex_list. - */ - if (t->save.counter > 10) { - t->save.initial_counter = 10; - t->save.counter = 10; - } -#endif - } - - for (i = 0 ; i < tnl->save.copied.nr ; i++) { - for (j = 0 ; j < _TNL_ATTRIB_MAX ; j++) { - if (tnl->save.attrsz[j]) { - if (j == attr) { - if (oldsz) { - COPY_CLEAN_4V( dest, oldsz, data ); - data += oldsz; - dest += newsz; - } - else { - COPY_SZ_4V( dest, newsz, tnl->save.current[attr] ); - dest += newsz; - } - } - else { - GLint sz = tnl->save.attrsz[j]; - COPY_SZ_4V( dest, sz, data ); - data += sz; - dest += sz; - } - } - } - } - - tnl->save.vbptr = dest; - tnl->save.counter -= tnl->save.copied.nr; - } -} - - - - -/* Helper function for 'CHOOSE' macro. Do what's necessary when an - * entrypoint is called for the first time. - */ -static void do_choose( GLuint attr, GLuint sz, - void (*attr_func)( const GLfloat *), - void (*choose1)( const GLfloat *), - void (*choose2)( const GLfloat *), - void (*choose3)( const GLfloat *), - void (*choose4)( const GLfloat *), - const GLfloat *v ) -{ - GET_CURRENT_CONTEXT( ctx ); - TNLcontext *tnl = TNL_CONTEXT(ctx); - static GLfloat id[4] = { 0, 0, 0, 1 }; - int i; - - if (tnl->save.attrsz[attr] < sz) { - /* New size is larger. Need to flush existing vertices and get - * an enlarged vertex format. - */ - _save_upgrade_vertex( ctx, attr, sz ); - } - else { - /* New size is equal or smaller - just need to fill in some - * zeros. - */ - for (i = sz ; i <= tnl->save.attrsz[attr] ; i++) - tnl->save.attrptr[attr][i-1] = id[i-1]; - } - - /* Reset any active pointers for this attribute - */ - tnl->save.tabfv[attr][0] = choose1; - tnl->save.tabfv[attr][1] = choose2; - tnl->save.tabfv[attr][2] = choose3; - tnl->save.tabfv[attr][3] = choose4; - - /* Update the secondary dispatch table with the new function - */ - tnl->save.tabfv[attr][sz-1] = attr_func; - - (*attr_func)(v); -} - - - -/* Only one size for each attribute may be active at once. Eg. if - * Color3f is installed/active, then Color4f may not be, even if the - * vertex actually contains 4 color coordinates. This is because the - * 3f version won't otherwise set color[3] to 1.0 -- this is the job - * of the chooser function when switching between Color4f and Color3f. - */ -#define ATTRFV( ATTR, N ) \ -static void save_choose_##ATTR##_##N( const GLfloat *v ); \ - \ -static void save_attrib_##ATTR##_##N( const GLfloat *v ) \ -{ \ - GET_CURRENT_CONTEXT( ctx ); \ - TNLcontext *tnl = TNL_CONTEXT(ctx); \ - \ - if ((ATTR) == 0) { \ - GLuint i; \ - \ - if (N>0) tnl->save.vbptr[0] = v[0]; \ - if (N>1) tnl->save.vbptr[1] = v[1]; \ - if (N>2) tnl->save.vbptr[2] = v[2]; \ - if (N>3) tnl->save.vbptr[3] = v[3]; \ - \ - for (i = N; i < tnl->save.vertex_size; i++) \ - tnl->save.vbptr[i] = tnl->save.vertex[i]; \ - \ - tnl->save.vbptr += tnl->save.vertex_size; \ - \ - if (--tnl->save.counter == 0) \ - _save_wrap_filled_vertex( ctx ); \ - } \ - else { \ - GLfloat *dest = tnl->save.attrptr[ATTR]; \ - if (N>0) dest[0] = v[0]; \ - if (N>1) dest[1] = v[1]; \ - if (N>2) dest[2] = v[2]; \ - if (N>3) dest[3] = v[3]; \ - } \ -} - -#define CHOOSE( ATTR, N ) \ -static void save_choose_##ATTR##_##N( const GLfloat *v ) \ -{ \ - do_choose(ATTR, N, \ - save_attrib_##ATTR##_##N, \ - save_choose_##ATTR##_1, \ - save_choose_##ATTR##_2, \ - save_choose_##ATTR##_3, \ - save_choose_##ATTR##_4, \ - v ); \ -} - -#define INIT(ATTR) \ -static void save_init_##ATTR( TNLcontext *tnl ) \ -{ \ - tnl->save.tabfv[ATTR][0] = save_choose_##ATTR##_1; \ - tnl->save.tabfv[ATTR][1] = save_choose_##ATTR##_2; \ - tnl->save.tabfv[ATTR][2] = save_choose_##ATTR##_3; \ - tnl->save.tabfv[ATTR][3] = save_choose_##ATTR##_4; \ -} - -#define ATTRS( ATTRIB ) \ - ATTRFV( ATTRIB, 1 ) \ - ATTRFV( ATTRIB, 2 ) \ - ATTRFV( ATTRIB, 3 ) \ - ATTRFV( ATTRIB, 4 ) \ - CHOOSE( ATTRIB, 1 ) \ - CHOOSE( ATTRIB, 2 ) \ - CHOOSE( ATTRIB, 3 ) \ - CHOOSE( ATTRIB, 4 ) \ - INIT( ATTRIB ) \ - - -/* Generate a lot of functions. These are the actual worker - * functions, which are equivalent to those generated via codegen - * elsewhere. - */ -ATTRS( 0 ) -ATTRS( 1 ) -ATTRS( 2 ) -ATTRS( 3 ) -ATTRS( 4 ) -ATTRS( 5 ) -ATTRS( 6 ) -ATTRS( 7 ) -ATTRS( 8 ) -ATTRS( 9 ) -ATTRS( 10 ) -ATTRS( 11 ) -ATTRS( 12 ) -ATTRS( 13 ) -ATTRS( 14 ) -ATTRS( 15 ) - -ATTRS( 16 ) -ATTRS( 17 ) -ATTRS( 18 ) -ATTRS( 19 ) -ATTRS( 20 ) -ATTRS( 21 ) -ATTRS( 22 ) -ATTRS( 23 ) -ATTRS( 24 ) -ATTRS( 25 ) -ATTRS( 26 ) -ATTRS( 27 ) -ATTRS( 28 ) -ATTRS( 29 ) -ATTRS( 30 ) -ATTRS( 31 ) - - -static void _save_reset_vertex( GLcontext *ctx ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - GLuint i; - - /* conventional attributes */ - save_init_0( tnl ); - save_init_1( tnl ); - save_init_2( tnl ); - save_init_3( tnl ); - save_init_4( tnl ); - save_init_5( tnl ); - save_init_6( tnl ); - save_init_7( tnl ); - save_init_8( tnl ); - save_init_9( tnl ); - save_init_10( tnl ); - save_init_11( tnl ); - save_init_12( tnl ); - save_init_13( tnl ); - save_init_14( tnl ); - save_init_15( tnl ); - - /* generic attributes */ - save_init_16( tnl ); - save_init_17( tnl ); - save_init_18( tnl ); - save_init_19( tnl ); - save_init_20( tnl ); - save_init_21( tnl ); - save_init_22( tnl ); - save_init_23( tnl ); - save_init_24( tnl ); - save_init_25( tnl ); - save_init_26( tnl ); - save_init_27( tnl ); - save_init_28( tnl ); - save_init_29( tnl ); - save_init_30( tnl ); - save_init_31( tnl ); - - for (i = 0 ; i < _TNL_ATTRIB_MAX ; i++) - tnl->save.attrsz[i] = 0; - - tnl->save.vertex_size = 0; - tnl->save.have_materials = 0; - - _save_reset_counters( ctx ); -} - - - -/* Cope with aliasing of classic Vertex, Normal, etc. and the fan-out - * of glMultTexCoord and glProgramParamterNV by routing all these - * through a second level dispatch table. - */ -#define DISPATCH_ATTRFV( ATTR, COUNT, P ) \ -do { \ - GET_CURRENT_CONTEXT( ctx ); \ - TNLcontext *tnl = TNL_CONTEXT(ctx); \ - tnl->save.tabfv[ATTR][COUNT-1]( P ); \ -} while (0) - -#define DISPATCH_ATTR1FV( ATTR, V ) DISPATCH_ATTRFV( ATTR, 1, V ) -#define DISPATCH_ATTR2FV( ATTR, V ) DISPATCH_ATTRFV( ATTR, 2, V ) -#define DISPATCH_ATTR3FV( ATTR, V ) DISPATCH_ATTRFV( ATTR, 3, V ) -#define DISPATCH_ATTR4FV( ATTR, V ) DISPATCH_ATTRFV( ATTR, 4, V ) - -#define DISPATCH_ATTR1F( ATTR, S ) DISPATCH_ATTRFV( ATTR, 1, &(S) ) - -#if defined(USE_X86_ASM) && 0 /* will break register calling convention */ -/* Naughty cheat: - */ -#define DISPATCH_ATTR2F( ATTR, S,T ) DISPATCH_ATTRFV( ATTR, 2, &(S) ) -#define DISPATCH_ATTR3F( ATTR, S,T,R ) DISPATCH_ATTRFV( ATTR, 3, &(S) ) -#define DISPATCH_ATTR4F( ATTR, S,T,R,Q ) DISPATCH_ATTRFV( ATTR, 4, &(S) ) -#else -/* Safe: - */ -#define DISPATCH_ATTR2F( ATTR, S,T ) \ -do { \ - GLfloat v[2]; \ - v[0] = S; v[1] = T; \ - DISPATCH_ATTR2FV( ATTR, v ); \ -} while (0) -#define DISPATCH_ATTR3F( ATTR, S,T,R ) \ -do { \ - GLfloat v[3]; \ - v[0] = S; v[1] = T; v[2] = R; \ - DISPATCH_ATTR3FV( ATTR, v ); \ -} while (0) -#define DISPATCH_ATTR4F( ATTR, S,T,R,Q ) \ -do { \ - GLfloat v[4]; \ - v[0] = S; v[1] = T; v[2] = R; v[3] = Q; \ - DISPATCH_ATTR4FV( ATTR, v ); \ -} while (0) -#endif - - -static void enum_error( void ) -{ - GET_CURRENT_CONTEXT( ctx ); - _mesa_compile_error( ctx, GL_INVALID_ENUM, "glVertexAttrib" ); -} - -static void GLAPIENTRY _save_Vertex2f( GLfloat x, GLfloat y ) -{ - DISPATCH_ATTR2F( _TNL_ATTRIB_POS, x, y ); -} - -static void GLAPIENTRY _save_Vertex2fv( const GLfloat *v ) -{ - DISPATCH_ATTR2FV( _TNL_ATTRIB_POS, v ); -} - -static void GLAPIENTRY _save_Vertex3f( GLfloat x, GLfloat y, GLfloat z ) -{ - DISPATCH_ATTR3F( _TNL_ATTRIB_POS, x, y, z ); -} - -static void GLAPIENTRY _save_Vertex3fv( const GLfloat *v ) -{ - DISPATCH_ATTR3FV( _TNL_ATTRIB_POS, v ); -} - -static void GLAPIENTRY _save_Vertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) -{ - DISPATCH_ATTR4F( _TNL_ATTRIB_POS, x, y, z, w ); -} - -static void GLAPIENTRY _save_Vertex4fv( const GLfloat *v ) -{ - DISPATCH_ATTR4FV( _TNL_ATTRIB_POS, v ); -} - -static void GLAPIENTRY _save_TexCoord1f( GLfloat x ) -{ - DISPATCH_ATTR1F( _TNL_ATTRIB_TEX0, x ); -} - -static void GLAPIENTRY _save_TexCoord1fv( const GLfloat *v ) -{ - DISPATCH_ATTR1FV( _TNL_ATTRIB_TEX0, v ); -} - -static void GLAPIENTRY _save_TexCoord2f( GLfloat x, GLfloat y ) -{ - DISPATCH_ATTR2F( _TNL_ATTRIB_TEX0, x, y ); -} - -static void GLAPIENTRY _save_TexCoord2fv( const GLfloat *v ) -{ - DISPATCH_ATTR2FV( _TNL_ATTRIB_TEX0, v ); -} - -static void GLAPIENTRY _save_TexCoord3f( GLfloat x, GLfloat y, GLfloat z ) -{ - DISPATCH_ATTR3F( _TNL_ATTRIB_TEX0, x, y, z ); -} - -static void GLAPIENTRY _save_TexCoord3fv( const GLfloat *v ) -{ - DISPATCH_ATTR3FV( _TNL_ATTRIB_TEX0, v ); -} - -static void GLAPIENTRY _save_TexCoord4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) -{ - DISPATCH_ATTR4F( _TNL_ATTRIB_TEX0, x, y, z, w ); -} - -static void GLAPIENTRY _save_TexCoord4fv( const GLfloat *v ) -{ - DISPATCH_ATTR4FV( _TNL_ATTRIB_TEX0, v ); -} - -static void GLAPIENTRY _save_Normal3f( GLfloat x, GLfloat y, GLfloat z ) -{ - DISPATCH_ATTR3F( _TNL_ATTRIB_NORMAL, x, y, z ); -} - -static void GLAPIENTRY _save_Normal3fv( const GLfloat *v ) -{ - DISPATCH_ATTR3FV( _TNL_ATTRIB_NORMAL, v ); -} - -static void GLAPIENTRY _save_FogCoordfEXT( GLfloat x ) -{ - DISPATCH_ATTR1F( _TNL_ATTRIB_FOG, x ); -} - -static void GLAPIENTRY _save_FogCoordfvEXT( const GLfloat *v ) -{ - DISPATCH_ATTR1FV( _TNL_ATTRIB_FOG, v ); -} - -static void GLAPIENTRY _save_Color3f( GLfloat x, GLfloat y, GLfloat z ) -{ - DISPATCH_ATTR3F( _TNL_ATTRIB_COLOR0, x, y, z ); -} - -static void GLAPIENTRY _save_Color3fv( const GLfloat *v ) -{ - DISPATCH_ATTR3FV( _TNL_ATTRIB_COLOR0, v ); -} - -static void GLAPIENTRY _save_Color4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) -{ - DISPATCH_ATTR4F( _TNL_ATTRIB_COLOR0, x, y, z, w ); -} - -static void GLAPIENTRY _save_Color4fv( const GLfloat *v ) -{ - DISPATCH_ATTR4FV( _TNL_ATTRIB_COLOR0, v ); -} - -static void GLAPIENTRY _save_SecondaryColor3fEXT( GLfloat x, GLfloat y, GLfloat z ) -{ - DISPATCH_ATTR3F( _TNL_ATTRIB_COLOR1, x, y, z ); -} - -static void GLAPIENTRY _save_SecondaryColor3fvEXT( const GLfloat *v ) -{ - DISPATCH_ATTR3FV( _TNL_ATTRIB_COLOR1, v ); -} - -static void GLAPIENTRY _save_MultiTexCoord1f( GLenum target, GLfloat x ) -{ - GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; - DISPATCH_ATTR1F( attr, x ); -} - -static void GLAPIENTRY _save_MultiTexCoord1fv( GLenum target, const GLfloat *v ) -{ - GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; - DISPATCH_ATTR1FV( attr, v ); -} - -static void GLAPIENTRY _save_MultiTexCoord2f( GLenum target, GLfloat x, GLfloat y ) -{ - GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; - DISPATCH_ATTR2F( attr, x, y ); -} - -static void GLAPIENTRY _save_MultiTexCoord2fv( GLenum target, const GLfloat *v ) -{ - GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; - DISPATCH_ATTR2FV( attr, v ); -} - -static void GLAPIENTRY _save_MultiTexCoord3f( GLenum target, GLfloat x, GLfloat y, - GLfloat z) -{ - GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; - DISPATCH_ATTR3F( attr, x, y, z ); -} - -static void GLAPIENTRY _save_MultiTexCoord3fv( GLenum target, const GLfloat *v ) -{ - GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; - DISPATCH_ATTR3FV( attr, v ); -} - -static void GLAPIENTRY _save_MultiTexCoord4f( GLenum target, GLfloat x, GLfloat y, - GLfloat z, GLfloat w ) -{ - GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; - DISPATCH_ATTR4F( attr, x, y, z, w ); -} - -static void GLAPIENTRY _save_MultiTexCoord4fv( GLenum target, const GLfloat *v ) -{ - GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; - DISPATCH_ATTR4FV( attr, v ); -} - - - -static void GLAPIENTRY -_save_VertexAttrib1fNV(GLuint index, GLfloat x) -{ - if (index < MAX_VERTEX_PROGRAM_ATTRIBS) { - if (index > 0) - index += VERT_ATTRIB_GENERIC0; - DISPATCH_ATTR1F( index, x ); - } - else - enum_error(); -} - -static void GLAPIENTRY -_save_VertexAttrib1fvNV(GLuint index, const GLfloat *v) -{ - if (index < MAX_VERTEX_PROGRAM_ATTRIBS) { - if (index > 0) - index += VERT_ATTRIB_GENERIC0; - DISPATCH_ATTR1FV( index, v ); - } - else - enum_error(); -} - -static void GLAPIENTRY -_save_VertexAttrib2fNV(GLuint index, GLfloat x, GLfloat y) -{ - if (index < MAX_VERTEX_PROGRAM_ATTRIBS) { - if (index > 0) - index += VERT_ATTRIB_GENERIC0; - DISPATCH_ATTR2F( index, x, y ); - } - else - enum_error(); -} - -static void GLAPIENTRY -_save_VertexAttrib2fvNV(GLuint index, const GLfloat *v) -{ - if (index < MAX_VERTEX_PROGRAM_ATTRIBS) { - if (index > 0) - index += VERT_ATTRIB_GENERIC0; - DISPATCH_ATTR2FV( index, v ); - } - else - enum_error(); -} - -static void GLAPIENTRY -_save_VertexAttrib3fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z) -{ - if (index < MAX_VERTEX_PROGRAM_ATTRIBS) { - if (index > 0) - index += VERT_ATTRIB_GENERIC0; - DISPATCH_ATTR3F( index, x, y, z ); - } - else - enum_error(); -} - -static void GLAPIENTRY -_save_VertexAttrib3fvNV(GLuint index, const GLfloat *v) -{ - if (index < MAX_VERTEX_PROGRAM_ATTRIBS) { - if (index > 0) - index += VERT_ATTRIB_GENERIC0; - DISPATCH_ATTR3FV( index, v ); - } - else - enum_error(); -} - -static void GLAPIENTRY -_save_VertexAttrib4fNV(GLuint index, GLfloat x, GLfloat y, - GLfloat z, GLfloat w) -{ - if (index < MAX_VERTEX_PROGRAM_ATTRIBS) { - if (index > 0) - index += VERT_ATTRIB_GENERIC0; - DISPATCH_ATTR4F( index, x, y, z, w ); - } - else - enum_error(); -} - -static void GLAPIENTRY -_save_VertexAttrib4fvNV(GLuint index, const GLfloat *v) -{ - if (index < MAX_VERTEX_PROGRAM_ATTRIBS) { - if (index > 0) - index += VERT_ATTRIB_GENERIC0; - DISPATCH_ATTR4FV( index, v ); - } - else - enum_error(); -} - -static void GLAPIENTRY -_save_VertexAttrib1fARB(GLuint index, GLfloat x) -{ - if (index < MAX_VERTEX_ATTRIBS) { - if (index > 0) - index += VERT_ATTRIB_GENERIC0; - DISPATCH_ATTR1F( index, x ); - } - else - enum_error(); -} - -static void GLAPIENTRY -_save_VertexAttrib1fvARB(GLuint index, const GLfloat *v) -{ - if (index < MAX_VERTEX_ATTRIBS) { - if (index > 0) - index += VERT_ATTRIB_GENERIC0; - DISPATCH_ATTR1FV( index, v ); - } - else - enum_error(); -} - -static void GLAPIENTRY -_save_VertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y) -{ - if (index < MAX_VERTEX_ATTRIBS) { - if (index > 0) - index += VERT_ATTRIB_GENERIC0; - DISPATCH_ATTR2F( index, x, y ); - } - else - enum_error(); -} - -static void GLAPIENTRY -_save_VertexAttrib2fvARB(GLuint index, const GLfloat *v) -{ - if (index < MAX_VERTEX_ATTRIBS) { - if (index > 0) - index += VERT_ATTRIB_GENERIC0; - DISPATCH_ATTR2FV( index, v ); - } - else - enum_error(); -} - -static void GLAPIENTRY -_save_VertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z) -{ - if (index < MAX_VERTEX_ATTRIBS) { - if (index > 0) - index += VERT_ATTRIB_GENERIC0; - DISPATCH_ATTR3F( index, x, y, z ); - } - else - enum_error(); -} - -static void GLAPIENTRY -_save_VertexAttrib3fvARB(GLuint index, const GLfloat *v) -{ - if (index < MAX_VERTEX_ATTRIBS) { - if (index > 0) - index += VERT_ATTRIB_GENERIC0; - DISPATCH_ATTR3FV( index, v ); - } - else - enum_error(); -} - -static void GLAPIENTRY -_save_VertexAttrib4fARB(GLuint index, GLfloat x, GLfloat y, - GLfloat z, GLfloat w) -{ - if (index < MAX_VERTEX_ATTRIBS) { - if (index > 0) - index += VERT_ATTRIB_GENERIC0; - DISPATCH_ATTR4F( index, x, y, z, w ); - } - else - enum_error(); -} - -static void GLAPIENTRY -_save_VertexAttrib4fvARB(GLuint index, const GLfloat *v) -{ - if (index < MAX_VERTEX_ATTRIBS) { - if (index > 0) - index += VERT_ATTRIB_GENERIC0; - DISPATCH_ATTR4FV( index, v ); - } - else - enum_error(); -} - - -/* Materials: - * - * These are treated as per-vertex attributes, at indices above where - * the NV_vertex_program leaves off. There are a lot of good things - * about treating materials this way. - * - * However: I don't want to double the number of generated functions - * just to cope with this, so I unroll the 'C' varients of CHOOSE and - * ATTRF into this function, and dispense with codegen and - * second-level dispatch. - * - * There is no aliasing of material attributes with other entrypoints. - */ -#define MAT_ATTR( A, N, params ) \ -do { \ - if (tnl->save.attrsz[A] < N) { \ - _save_upgrade_vertex( ctx, A, N ); \ - tnl->save.have_materials = GL_TRUE; \ - } \ - \ - { \ - GLfloat *dest = tnl->save.attrptr[A]; \ - if (N>0) dest[0] = params[0]; \ - if (N>1) dest[1] = params[1]; \ - if (N>2) dest[2] = params[2]; \ - if (N>3) dest[3] = params[3]; \ - } \ -} while (0) - - -#define MAT( ATTR, N, face, params ) \ -do { \ - if (face != GL_BACK) \ - MAT_ATTR( ATTR, N, params ); /* front */ \ - if (face != GL_FRONT) \ - MAT_ATTR( ATTR + 1, N, params ); /* back */ \ -} while (0) - - -/* NOTE: Have to remove/deal-with colormaterial crossovers, probably - * later on - in the meantime just store everything. - */ -static void GLAPIENTRY _save_Materialfv( GLenum face, GLenum pname, - const GLfloat *params ) -{ - GET_CURRENT_CONTEXT( ctx ); - TNLcontext *tnl = TNL_CONTEXT(ctx); - - switch (pname) { - case GL_EMISSION: - MAT( _TNL_ATTRIB_MAT_FRONT_EMISSION, 4, face, params ); - break; - case GL_AMBIENT: - MAT( _TNL_ATTRIB_MAT_FRONT_AMBIENT, 4, face, params ); - break; - case GL_DIFFUSE: - MAT( _TNL_ATTRIB_MAT_FRONT_DIFFUSE, 4, face, params ); - break; - case GL_SPECULAR: - MAT( _TNL_ATTRIB_MAT_FRONT_SPECULAR, 4, face, params ); - break; - case GL_SHININESS: - MAT( _TNL_ATTRIB_MAT_FRONT_SHININESS, 1, face, params ); - break; - case GL_COLOR_INDEXES: - MAT( _TNL_ATTRIB_MAT_FRONT_INDEXES, 3, face, params ); - break; - case GL_AMBIENT_AND_DIFFUSE: - MAT( _TNL_ATTRIB_MAT_FRONT_AMBIENT, 4, face, params ); - MAT( _TNL_ATTRIB_MAT_FRONT_DIFFUSE, 4, face, params ); - break; - default: - _mesa_compile_error( ctx, GL_INVALID_ENUM, "glMaterialfv" ); - return; - } -} - - -#define IDX_ATTR( A, IDX ) \ -do { \ - GET_CURRENT_CONTEXT( ctx ); \ - TNLcontext *tnl = TNL_CONTEXT(ctx); \ - \ - if (tnl->save.attrsz[A] < 1) { \ - _save_upgrade_vertex( ctx, A, 1 ); \ - } \ - \ - { \ - GLfloat *dest = tnl->save.attrptr[A]; \ - dest[0] = IDX; \ - } \ -} while (0) - - -static void GLAPIENTRY _save_EdgeFlag( GLboolean b ) -{ - IDX_ATTR( _TNL_ATTRIB_EDGEFLAG, (GLfloat)b ); -} - - -static void GLAPIENTRY _save_Indexf( GLfloat f ) -{ - IDX_ATTR( _TNL_ATTRIB_COLOR_INDEX, f ); -} - -static void GLAPIENTRY _save_Indexfv( const GLfloat *f ) -{ - IDX_ATTR( _TNL_ATTRIB_COLOR_INDEX, f[0] ); -} - - - - -/* Cope with EvalCoord/CallList called within a begin/end object: - * -- Flush current buffer - * -- Fallback to opcodes for the rest of the begin/end object. - */ -#define FALLBACK(ctx) \ -do { \ - TNLcontext *tnl = TNL_CONTEXT(ctx); \ - \ - if (tnl->save.initial_counter != tnl->save.counter || \ - tnl->save.prim_count) \ - _save_compile_vertex_list( ctx ); \ - \ - _save_copy_to_current( ctx ); \ - _save_reset_vertex( ctx ); \ - _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt ); \ - ctx->Driver.SaveNeedFlush = 0; \ -} while (0) - -static void GLAPIENTRY _save_EvalCoord1f( GLfloat u ) -{ - GET_CURRENT_CONTEXT(ctx); - FALLBACK(ctx); - CALL_EvalCoord1f(ctx->Save, ( u )); -} - -static void GLAPIENTRY _save_EvalCoord1fv( const GLfloat *v ) -{ - GET_CURRENT_CONTEXT(ctx); - FALLBACK(ctx); - CALL_EvalCoord1fv(ctx->Save, ( v )); -} - -static void GLAPIENTRY _save_EvalCoord2f( GLfloat u, GLfloat v ) -{ - GET_CURRENT_CONTEXT(ctx); - FALLBACK(ctx); - CALL_EvalCoord2f(ctx->Save, ( u, v )); -} - -static void GLAPIENTRY _save_EvalCoord2fv( const GLfloat *v ) -{ - GET_CURRENT_CONTEXT(ctx); - FALLBACK(ctx); - CALL_EvalCoord2fv(ctx->Save, ( v )); -} - -static void GLAPIENTRY _save_EvalPoint1( GLint i ) -{ - GET_CURRENT_CONTEXT(ctx); - FALLBACK(ctx); - CALL_EvalPoint1(ctx->Save, ( i )); -} - -static void GLAPIENTRY _save_EvalPoint2( GLint i, GLint j ) -{ - GET_CURRENT_CONTEXT(ctx); - FALLBACK(ctx); - CALL_EvalPoint2(ctx->Save, ( i, j )); -} - -static void GLAPIENTRY _save_CallList( GLuint l ) -{ - GET_CURRENT_CONTEXT(ctx); - FALLBACK(ctx); - CALL_CallList(ctx->Save, ( l )); -} - -static void GLAPIENTRY _save_CallLists( GLsizei n, GLenum type, const GLvoid *v ) -{ - GET_CURRENT_CONTEXT(ctx); - FALLBACK(ctx); - CALL_CallLists(ctx->Save, ( n, type, v )); -} - - - - -/** - * Called via ctx->Driver.NotifySaveBegin(ctx, mode) when we get a - * glBegin() call while compiling a display list. - * See save_Begin() in dlist.c - * - * This plugs in our special TNL-related display list functions. - * All subsequent glBegin/glVertex/glEnd()s found while compiling a - * display list will get routed to the functions in this file. - * - * Updating of ctx->Driver.CurrentSavePrimitive is already taken care of. - */ -static GLboolean _save_NotifyBegin( GLcontext *ctx, GLenum mode ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - - if (1) { - GLuint i = tnl->save.prim_count++; - - assert(i < tnl->save.prim_max); - tnl->save.prim[i].mode = mode | PRIM_BEGIN; - tnl->save.prim[i].start = tnl->save.initial_counter - tnl->save.counter; - tnl->save.prim[i].count = 0; - - _mesa_install_save_vtxfmt( ctx, &tnl->save_vtxfmt ); - ctx->Driver.SaveNeedFlush = 1; - return GL_TRUE; - } - else - return GL_FALSE; -} - - - -static void GLAPIENTRY _save_End( void ) -{ - GET_CURRENT_CONTEXT( ctx ); - TNLcontext *tnl = TNL_CONTEXT(ctx); - GLint i = tnl->save.prim_count - 1; - - ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END; - if (ctx->ExecuteFlag) - ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END; - - tnl->save.prim[i].mode |= PRIM_END; - tnl->save.prim[i].count = ((tnl->save.initial_counter - tnl->save.counter) - - tnl->save.prim[i].start); - - if (i == (GLint) tnl->save.prim_max - 1) { - _save_compile_vertex_list( ctx ); - assert(tnl->save.copied.nr == 0); - } - - /* Swap out this vertex format while outside begin/end. Any color, - * etc. received between here and the next begin will be compiled - * as opcodes. - */ - _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt ); -} - - -/* These are all errors as this vtxfmt is only installed inside - * begin/end pairs. - */ -static void GLAPIENTRY _save_DrawElements(GLenum mode, GLsizei count, GLenum type, - const GLvoid *indices) -{ - GET_CURRENT_CONTEXT(ctx); - (void) mode; (void) count; (void) type; (void) indices; - _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glDrawElements" ); -} - - -static void GLAPIENTRY _save_DrawRangeElements(GLenum mode, - GLuint start, GLuint end, - GLsizei count, GLenum type, - const GLvoid *indices) -{ - GET_CURRENT_CONTEXT(ctx); - (void) mode; (void) start; (void) end; (void) count; (void) type; (void) indices; - _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glDrawRangeElements" ); -} - -static void GLAPIENTRY _save_DrawArrays(GLenum mode, GLint start, GLsizei count) -{ - GET_CURRENT_CONTEXT(ctx); - (void) mode; (void) start; (void) count; - _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glDrawArrays" ); -} - -static void GLAPIENTRY _save_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) -{ - GET_CURRENT_CONTEXT(ctx); - (void) x1; (void) y1; (void) x2; (void) y2; - _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glRectf" ); -} - -static void GLAPIENTRY _save_EvalMesh1( GLenum mode, GLint i1, GLint i2 ) -{ - GET_CURRENT_CONTEXT(ctx); - (void) mode; (void) i1; (void) i2; - _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glEvalMesh1" ); -} - -static void GLAPIENTRY _save_EvalMesh2( GLenum mode, GLint i1, GLint i2, - GLint j1, GLint j2 ) -{ - GET_CURRENT_CONTEXT(ctx); - (void) mode; (void) i1; (void) i2; (void) j1; (void) j2; - _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glEvalMesh2" ); -} - -/** - * This is only called if someone tries to compile nested glBegin()s - * in their display list. - */ -static void GLAPIENTRY _save_Begin( GLenum mode ) -{ - GET_CURRENT_CONTEXT( ctx ); - (void) mode; - _mesa_compile_error(ctx, GL_INVALID_OPERATION, - "glBegin(called inside glBegin/End)"); -} - - -/* Unlike the functions above, these are to be hooked into the vtxfmt - * maintained in ctx->ListState, active when the list is known or - * suspected to be outside any begin/end primitive. - */ -static void GLAPIENTRY _save_OBE_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) -{ - GET_CURRENT_CONTEXT(ctx); - _save_NotifyBegin( ctx, GL_QUADS | PRIM_WEAK ); - CALL_Vertex2f(GET_DISPATCH(), ( x1, y1 )); - CALL_Vertex2f(GET_DISPATCH(), ( x2, y1 )); - CALL_Vertex2f(GET_DISPATCH(), ( x2, y2 )); - CALL_Vertex2f(GET_DISPATCH(), ( x1, y2 )); - CALL_End(GET_DISPATCH(), ()); -} - - -static void GLAPIENTRY _save_OBE_DrawArrays(GLenum mode, GLint start, GLsizei count) -{ - GET_CURRENT_CONTEXT(ctx); - GLint i; - - if (!_mesa_validate_DrawArrays( ctx, mode, start, count )) - return; - - _ae_map_vbos( ctx ); - - _save_NotifyBegin( ctx, mode | PRIM_WEAK ); - for (i = 0; i < count; i++) - CALL_ArrayElement(GET_DISPATCH(), (start + i)); - CALL_End(GET_DISPATCH(), ()); - - _ae_unmap_vbos( ctx ); -} - - -static void GLAPIENTRY _save_OBE_DrawElements(GLenum mode, GLsizei count, GLenum type, - const GLvoid *indices) -{ - GET_CURRENT_CONTEXT(ctx); - GLint i; - - if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices )) - return; - - _ae_map_vbos( ctx ); - - _save_NotifyBegin( ctx, mode | PRIM_WEAK ); - - switch (type) { - case GL_UNSIGNED_BYTE: - for (i = 0 ; i < count ; i++) - CALL_ArrayElement(GET_DISPATCH(), ( ((GLubyte *)indices)[i] )); - break; - case GL_UNSIGNED_SHORT: - for (i = 0 ; i < count ; i++) - CALL_ArrayElement(GET_DISPATCH(), ( ((GLushort *)indices)[i] )); - break; - case GL_UNSIGNED_INT: - for (i = 0 ; i < count ; i++) - CALL_ArrayElement(GET_DISPATCH(), ( ((GLuint *)indices)[i] )); - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glDrawElements(type)" ); - break; - } - - CALL_End(GET_DISPATCH(), ()); - - _ae_unmap_vbos( ctx ); -} - -static void GLAPIENTRY _save_OBE_DrawRangeElements(GLenum mode, - GLuint start, GLuint end, - GLsizei count, GLenum type, - const GLvoid *indices) -{ - GET_CURRENT_CONTEXT(ctx); - if (_mesa_validate_DrawRangeElements( ctx, mode, - start, end, - count, type, indices )) - _save_OBE_DrawElements( mode, count, type, indices ); -} - - - - - -static void _save_vtxfmt_init( GLcontext *ctx ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - GLvertexformat *vfmt = &tnl->save_vtxfmt; - - vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */ - vfmt->Begin = _save_Begin; - vfmt->Color3f = _save_Color3f; - vfmt->Color3fv = _save_Color3fv; - vfmt->Color4f = _save_Color4f; - vfmt->Color4fv = _save_Color4fv; - vfmt->EdgeFlag = _save_EdgeFlag; - vfmt->End = _save_End; - vfmt->FogCoordfEXT = _save_FogCoordfEXT; - vfmt->FogCoordfvEXT = _save_FogCoordfvEXT; - vfmt->Indexf = _save_Indexf; - vfmt->Indexfv = _save_Indexfv; - vfmt->Materialfv = _save_Materialfv; - vfmt->MultiTexCoord1fARB = _save_MultiTexCoord1f; - vfmt->MultiTexCoord1fvARB = _save_MultiTexCoord1fv; - vfmt->MultiTexCoord2fARB = _save_MultiTexCoord2f; - vfmt->MultiTexCoord2fvARB = _save_MultiTexCoord2fv; - vfmt->MultiTexCoord3fARB = _save_MultiTexCoord3f; - vfmt->MultiTexCoord3fvARB = _save_MultiTexCoord3fv; - vfmt->MultiTexCoord4fARB = _save_MultiTexCoord4f; - vfmt->MultiTexCoord4fvARB = _save_MultiTexCoord4fv; - vfmt->Normal3f = _save_Normal3f; - vfmt->Normal3fv = _save_Normal3fv; - vfmt->SecondaryColor3fEXT = _save_SecondaryColor3fEXT; - vfmt->SecondaryColor3fvEXT = _save_SecondaryColor3fvEXT; - vfmt->TexCoord1f = _save_TexCoord1f; - vfmt->TexCoord1fv = _save_TexCoord1fv; - vfmt->TexCoord2f = _save_TexCoord2f; - vfmt->TexCoord2fv = _save_TexCoord2fv; - vfmt->TexCoord3f = _save_TexCoord3f; - vfmt->TexCoord3fv = _save_TexCoord3fv; - vfmt->TexCoord4f = _save_TexCoord4f; - vfmt->TexCoord4fv = _save_TexCoord4fv; - vfmt->Vertex2f = _save_Vertex2f; - vfmt->Vertex2fv = _save_Vertex2fv; - vfmt->Vertex3f = _save_Vertex3f; - vfmt->Vertex3fv = _save_Vertex3fv; - vfmt->Vertex4f = _save_Vertex4f; - vfmt->Vertex4fv = _save_Vertex4fv; - vfmt->VertexAttrib1fNV = _save_VertexAttrib1fNV; - vfmt->VertexAttrib1fvNV = _save_VertexAttrib1fvNV; - vfmt->VertexAttrib2fNV = _save_VertexAttrib2fNV; - vfmt->VertexAttrib2fvNV = _save_VertexAttrib2fvNV; - vfmt->VertexAttrib3fNV = _save_VertexAttrib3fNV; - vfmt->VertexAttrib3fvNV = _save_VertexAttrib3fvNV; - vfmt->VertexAttrib4fNV = _save_VertexAttrib4fNV; - vfmt->VertexAttrib4fvNV = _save_VertexAttrib4fvNV; - vfmt->VertexAttrib1fARB = _save_VertexAttrib1fARB; - vfmt->VertexAttrib1fvARB = _save_VertexAttrib1fvARB; - vfmt->VertexAttrib2fARB = _save_VertexAttrib2fARB; - vfmt->VertexAttrib2fvARB = _save_VertexAttrib2fvARB; - vfmt->VertexAttrib3fARB = _save_VertexAttrib3fARB; - vfmt->VertexAttrib3fvARB = _save_VertexAttrib3fvARB; - vfmt->VertexAttrib4fARB = _save_VertexAttrib4fARB; - vfmt->VertexAttrib4fvARB = _save_VertexAttrib4fvARB; - - /* This will all require us to fallback to saving the list as opcodes: - */ - vfmt->CallList = _save_CallList; /* inside begin/end */ - vfmt->CallLists = _save_CallLists; /* inside begin/end */ - vfmt->EvalCoord1f = _save_EvalCoord1f; - vfmt->EvalCoord1fv = _save_EvalCoord1fv; - vfmt->EvalCoord2f = _save_EvalCoord2f; - vfmt->EvalCoord2fv = _save_EvalCoord2fv; - vfmt->EvalPoint1 = _save_EvalPoint1; - vfmt->EvalPoint2 = _save_EvalPoint2; - - /* These are all errors as we at least know we are in some sort of - * begin/end pair: - */ - vfmt->EvalMesh1 = _save_EvalMesh1; - vfmt->EvalMesh2 = _save_EvalMesh2; - vfmt->Begin = _save_Begin; - vfmt->Rectf = _save_Rectf; - vfmt->DrawArrays = _save_DrawArrays; - vfmt->DrawElements = _save_DrawElements; - vfmt->DrawRangeElements = _save_DrawRangeElements; - -} - - -void _tnl_SaveFlushVertices( GLcontext *ctx ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - - /* Noop when we are actually active: - */ - if (ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM || - ctx->Driver.CurrentSavePrimitive <= GL_POLYGON) - return; - - if (tnl->save.initial_counter != tnl->save.counter || - tnl->save.prim_count) - _save_compile_vertex_list( ctx ); - - _save_copy_to_current( ctx ); - _save_reset_vertex( ctx ); - ctx->Driver.SaveNeedFlush = 0; -} - -void _tnl_NewList( GLcontext *ctx, GLuint list, GLenum mode ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - - (void) list; (void) mode; - - if (!tnl->save.prim_store) - tnl->save.prim_store = alloc_prim_store( ctx ); - - if (!tnl->save.vertex_store) { - tnl->save.vertex_store = alloc_vertex_store( ctx ); - tnl->save.vbptr = tnl->save.vertex_store->buffer; - } - - _save_reset_vertex( ctx ); - ctx->Driver.SaveNeedFlush = 0; -} - -void _tnl_EndList( GLcontext *ctx ) -{ - (void) ctx; - assert(TNL_CONTEXT(ctx)->save.vertex_size == 0); -} - -void _tnl_BeginCallList( GLcontext *ctx, struct mesa_display_list *dlist ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - tnl->save.replay_flags |= dlist->flags; - tnl->save.replay_flags |= tnl->LoopbackDListCassettes; -} - -void _tnl_EndCallList( GLcontext *ctx ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - - if (ctx->ListState.CallDepth == 1) - tnl->save.replay_flags = 0; -} - - -static void _tnl_destroy_vertex_list( GLcontext *ctx, void *data ) -{ - struct tnl_vertex_list *node = (struct tnl_vertex_list *)data; - (void) ctx; - - if ( --node->vertex_store->refcount == 0 ) - FREE( node->vertex_store ); - - if ( --node->prim_store->refcount == 0 ) - FREE( node->prim_store ); - - if ( node->normal_lengths ) - FREE( node->normal_lengths ); -} - - -static void _tnl_print_vertex_list( GLcontext *ctx, void *data ) -{ - struct tnl_vertex_list *node = (struct tnl_vertex_list *)data; - GLuint i; - (void) ctx; - - _mesa_debug(NULL, "TNL-VERTEX-LIST, %u vertices %d primitives, %d vertsize\n", - node->count, - node->prim_count, - node->vertex_size); - - for (i = 0 ; i < node->prim_count ; i++) { - struct tnl_prim *prim = &node->prim[i]; - _mesa_debug(NULL, " prim %d: %s %d..%d %s %s\n", - i, - _mesa_lookup_enum_by_nr(prim->mode & PRIM_MODE_MASK), - prim->start, - prim->start + prim->count, - (prim->mode & PRIM_BEGIN) ? "BEGIN" : "(wrap)", - (prim->mode & PRIM_END) ? "END" : "(wrap)"); - } -} - - -static void _save_current_init( GLcontext *ctx ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - GLint i; - - for (i = 0; i < _TNL_ATTRIB_MAT_FRONT_AMBIENT; i++) { - ASSERT(i < VERT_ATTRIB_MAX); - tnl->save.currentsz[i] = &ctx->ListState.ActiveAttribSize[i]; - tnl->save.current[i] = ctx->ListState.CurrentAttrib[i]; - } - - for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) { - const GLuint j = i - _TNL_FIRST_MAT; - ASSERT(j < MAT_ATTRIB_MAX); - tnl->save.currentsz[i] = &ctx->ListState.ActiveMaterialSize[j]; - tnl->save.current[i] = ctx->ListState.CurrentMaterial[j]; - } - - tnl->save.currentsz[_TNL_ATTRIB_EDGEFLAG] = &ctx->ListState.ActiveEdgeFlag; - tnl->save.current[_TNL_ATTRIB_EDGEFLAG] = &tnl->save.CurrentFloatEdgeFlag; -} - -/** - * Initialize the display list compiler - */ -void _tnl_save_init( GLcontext *ctx ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct tnl_vertex_arrays *tmp = &tnl->save_inputs; - GLuint i; - - - for (i = 0; i < _TNL_ATTRIB_MAX; i++) - _mesa_vector4f_init( &tmp->Attribs[i], 0, NULL); - - tnl->save.opcode_vertex_list = - _mesa_alloc_opcode( ctx, - sizeof(struct tnl_vertex_list), - _tnl_playback_vertex_list, - _tnl_destroy_vertex_list, - _tnl_print_vertex_list ); - - ctx->Driver.NotifySaveBegin = _save_NotifyBegin; - - _save_vtxfmt_init( ctx ); - _save_current_init( ctx ); - - /* Hook our array functions into the outside-begin-end vtxfmt in - * ctx->ListState. - */ - ctx->ListState.ListVtxfmt.Rectf = _save_OBE_Rectf; - ctx->ListState.ListVtxfmt.DrawArrays = _save_OBE_DrawArrays; - ctx->ListState.ListVtxfmt.DrawElements = _save_OBE_DrawElements; - ctx->ListState.ListVtxfmt.DrawRangeElements = _save_OBE_DrawRangeElements; - _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt ); -} - - -/** - * Deallocate the immediate-mode buffer for the given context, if - * its reference count goes to zero. - */ -void _tnl_save_destroy( GLcontext *ctx ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - - /* Decrement the refcounts. References may still be held by - * display lists yet to be destroyed, so it may not yet be time to - * free these items. - */ - if (tnl->save.prim_store && - --tnl->save.prim_store->refcount == 0 ) - FREE( tnl->save.prim_store ); - - if (tnl->save.vertex_store && - --tnl->save.vertex_store->refcount == 0 ) - FREE( tnl->save.vertex_store ); -} -- cgit v1.2.3 From c223c6b663cd5db39ba19c2be74b88cc3b8f53f3 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 4 Jul 2007 13:15:20 -0600 Subject: Be more consistant with paths in #includes. Eventually, eliminate a bunch of -I flags. --- src/mesa/main/api_arrayelt.c | 4 ++-- src/mesa/main/api_loopback.c | 8 ++++---- src/mesa/main/api_noop.c | 2 +- src/mesa/main/arrayobj.c | 2 +- src/mesa/main/context.c | 14 +++++++------- src/mesa/main/context.h | 2 +- src/mesa/main/dlist.c | 18 +++++++++--------- src/mesa/main/execmem.c | 2 +- src/mesa/main/hash.c | 2 +- src/mesa/main/mtypes.h | 4 ++-- src/mesa/main/state.c | 12 ++++++------ src/mesa/main/texenvprogram.c | 8 ++++---- src/mesa/main/varray.c | 2 +- src/mesa/main/vtxfmt_tmp.h | 4 ++-- src/mesa/math/m_eval.c | 4 ++-- src/mesa/math/m_eval.h | 2 +- src/mesa/math/m_translate.h | 4 ++-- src/mesa/math/m_xform.c | 4 ++-- src/mesa/shader/arbprogparse.c | 8 ++++---- src/mesa/shader/prog_execute.c | 2 +- src/mesa/shader/shader_api.c | 7 +++---- src/mesa/shader/slang/slang_builtin.c | 16 ++++++++-------- src/mesa/shader/slang/slang_builtin.h | 2 +- src/mesa/shader/slang/slang_codegen.c | 14 +++++++------- src/mesa/shader/slang/slang_compile.c | 10 +++++----- src/mesa/shader/slang/slang_emit.c | 14 +++++++------- src/mesa/shader/slang/slang_ir.c | 2 +- src/mesa/shader/slang/slang_label.h | 6 +++--- src/mesa/shader/slang/slang_link.c | 20 ++++++++++---------- src/mesa/shader/slang/slang_preprocess.c | 2 +- src/mesa/shader/slang/slang_typeinfo.c | 4 ++-- src/mesa/shader/slang/slang_vartable.c | 4 ++-- src/mesa/swrast/s_atifragshader.c | 7 +++---- src/mesa/swrast/s_context.c | 2 +- src/mesa/swrast/s_context.h | 4 ++-- src/mesa/swrast/s_fragprog.c | 10 +++++----- src/mesa/swrast/swrast.h | 2 +- src/mesa/tnl/t_context.c | 12 ++++++------ src/mesa/tnl/t_context.h | 4 ++-- src/mesa/tnl/t_pipeline.c | 10 +++++----- src/mesa/tnl/t_vb_program.c | 10 +++++----- src/mesa/tnl/t_vp_build.c | 10 +++++----- src/mesa/tnl/tnl.h | 2 +- src/mesa/vbo/vbo.h | 2 +- src/mesa/vbo/vbo_context.c | 6 +++--- src/mesa/vbo/vbo_exec.c | 16 ++++++++-------- src/mesa/vbo/vbo_exec.h | 2 +- src/mesa/vbo/vbo_exec_api.c | 20 ++++++++++---------- src/mesa/vbo/vbo_exec_array.c | 12 ++++++------ src/mesa/vbo/vbo_exec_draw.c | 10 +++++----- src/mesa/vbo/vbo_exec_eval.c | 10 +++++----- src/mesa/vbo/vbo_rebase.c | 6 +++--- src/mesa/vbo/vbo_save.c | 8 ++++---- src/mesa/vbo/vbo_save.h | 2 +- src/mesa/vbo/vbo_save_api.c | 18 +++++++++--------- src/mesa/vbo/vbo_save_draw.c | 14 +++++++------- src/mesa/vbo/vbo_save_loopback.c | 16 ++++++++-------- src/mesa/vbo/vbo_split.c | 6 +++--- src/mesa/vbo/vbo_split_copy.c | 10 +++++----- src/mesa/vbo/vbo_split_inplace.c | 6 +++--- 60 files changed, 222 insertions(+), 224 deletions(-) (limited to 'src/mesa/tnl') diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c index 1899975213..72091b0789 100644 --- a/src/mesa/main/api_arrayelt.c +++ b/src/mesa/main/api_arrayelt.c @@ -31,8 +31,8 @@ #include "context.h" #include "imports.h" #include "macros.h" -#include "glapioffsets.h" -#include "dispatch.h" +#include "glapi/glapioffsets.h" +#include "glapi/dispatch.h" typedef void (GLAPIENTRY *array_func)( const void * ); diff --git a/src/mesa/main/api_loopback.c b/src/mesa/main/api_loopback.c index efe5a77d58..924d7134a2 100644 --- a/src/mesa/main/api_loopback.c +++ b/src/mesa/main/api_loopback.c @@ -30,14 +30,14 @@ #include "glheader.h" -#include "glapi.h" -#include "glapitable.h" #include "macros.h" #include "colormac.h" #include "api_loopback.h" -#include "glthread.h" #include "mtypes.h" -#include "dispatch.h" +#include "glapi/glapi.h" +#include "glapi/glapitable.h" +#include "glapi/glthread.h" +#include "glapi/dispatch.h" /* KW: A set of functions to convert unusual Color/Normal/Vertex/etc * calls to a smaller set of driver-provided formats. Currently just diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c index 0c1a35361f..3df64362ea 100644 --- a/src/mesa/main/api_noop.c +++ b/src/mesa/main/api_noop.c @@ -31,7 +31,7 @@ #include "light.h" #include "macros.h" #include "dlist.h" -#include "dispatch.h" +#include "glapi/dispatch.h" /** diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index d601ee461e..f08f99d8e1 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -46,7 +46,7 @@ #include "bufferobj.h" #endif #include "arrayobj.h" -#include "dispatch.h" +#include "glapi/dispatch.h" /** diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 255023c0fa..21adcf3210 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -97,12 +97,9 @@ #include "fog.h" #include "framebuffer.h" #include "get.h" -#include "glthread.h" -#include "glapioffsets.h" #include "histogram.h" #include "hint.h" #include "hash.h" -#include "atifragshader.h" #include "light.h" #include "lines.h" #include "macros.h" @@ -110,9 +107,6 @@ #include "pixel.h" #include "points.h" #include "polygon.h" -#if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program -#include "program.h" -#endif #include "queryobj.h" #include "rastpos.h" #include "simple_list.h" @@ -126,13 +120,19 @@ #include "varray.h" #include "version.h" #include "vtxfmt.h" +#include "glapi/glthread.h" +#include "glapi/glapioffsets.h" +#if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program +#include "shader/program.h" +#endif +#include "shader/shader_api.h" +#include "shader/atifragshader.h" #if _HAVE_FULL_GL #include "math/m_translate.h" #include "math/m_matrix.h" #include "math/m_xform.h" #include "math/mathmod.h" #endif -#include "shader_api.h" #ifdef USE_SPARC_ASM #include "sparc/sparc.h" diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index b6a9d13149..099912aa15 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -49,7 +49,7 @@ #define CONTEXT_H -#include "glapi.h" +#include "glapi/glapi.h" #include "imports.h" #include "mtypes.h" diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 91ddcbf9ed..293ee5fa34 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -33,10 +33,6 @@ #include "api_arrayelt.h" #include "api_loopback.h" #include "config.h" -#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program -#include "arbprogram.h" -#include "program.h" -#endif #include "attrib.h" #include "blend.h" #include "buffers.h" @@ -57,7 +53,7 @@ #include "extensions.h" #include "feedback.h" #include "get.h" -#include "glapi.h" +#include "glapi/glapi.h" #include "hash.h" #include "histogram.h" #include "image.h" @@ -76,18 +72,22 @@ #include "texstate.h" #include "mtypes.h" #include "varray.h" +#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program +#include "shader/arbprogram.h" +#include "shader/program.h" +#endif #if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program -#include "nvprogram.h" -#include "program.h" +#include "shader/nvprogram.h" +#include "shader/program.h" #endif #if FEATURE_ATI_fragment_shader -#include "atifragshader.h" +#include "shader/atifragshader.h" #endif #include "math/m_matrix.h" #include "math/m_xform.h" -#include "dispatch.h" +#include "glapi/dispatch.h" /** diff --git a/src/mesa/main/execmem.c b/src/mesa/main/execmem.c index df3095232d..40f66d7da2 100644 --- a/src/mesa/main/execmem.c +++ b/src/mesa/main/execmem.c @@ -32,7 +32,7 @@ #include "imports.h" -#include "glthread.h" +#include "glapi/glthread.h" diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c index 2d5bcc3e01..ffb2c4d946 100644 --- a/src/mesa/main/hash.c +++ b/src/mesa/main/hash.c @@ -37,7 +37,7 @@ #include "glheader.h" #include "imports.h" -#include "glthread.h" +#include "glapi/glthread.h" #include "hash.h" diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 05c08c19fe..709b88d2ef 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -38,8 +38,8 @@ #include "glheader.h" #include /* __GLcontextModes (GLvisual) */ #include "config.h" /* Hardwired parameters */ -#include "glapitable.h" -#include "glthread.h" +#include "glapi/glapitable.h" +#include "glapi/glthread.h" #include "math/m_matrix.h" /* GLmatrix */ #include "bitset.h" diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 0a83abc7dd..66f8ac6408 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -35,10 +35,10 @@ #include "accum.h" #include "api_loopback.h" #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program -#include "arbprogram.h" +#include "shader/arbprogram.h" #endif #if FEATURE_ATI_fragment_shader -#include "atifragshader.h" +#include "shader/atifragshader.h" #endif #include "attrib.h" #include "blend.h" @@ -85,18 +85,18 @@ #include "mtypes.h" #include "varray.h" #if FEATURE_NV_vertex_program -#include "nvprogram.h" +#include "shader/nvprogram.h" #endif #if FEATURE_NV_fragment_program -#include "nvprogram.h" -#include "program.h" +#include "shader/nvprogram.h" +#include "shader/program.h" #include "texenvprogram.h" #endif #if FEATURE_ARB_shader_objects #include "shaders.h" #endif #include "debug.h" -#include "dispatch.h" +#include "glapi/dispatch.h" diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 1a46c10ffa..72b54b27d9 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -28,10 +28,10 @@ #include "glheader.h" #include "macros.h" #include "enums.h" -#include "prog_parameter.h" -#include "prog_instruction.h" -#include "prog_print.h" -#include "prog_statevars.h" +#include "shader/prog_parameter.h" +#include "shader/prog_instruction.h" +#include "shader/prog_print.h" +#include "shader/prog_statevars.h" #include "texenvprogram.h" /** diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index bf1ad0165e..fe4a7c684f 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -32,7 +32,7 @@ #include "mtypes.h" #include "varray.h" #include "arrayobj.h" -#include "dispatch.h" +#include "glapi/dispatch.h" /** diff --git a/src/mesa/main/vtxfmt_tmp.h b/src/mesa/main/vtxfmt_tmp.h index 783b06558d..6f5d01e40f 100644 --- a/src/mesa/main/vtxfmt_tmp.h +++ b/src/mesa/main/vtxfmt_tmp.h @@ -29,8 +29,8 @@ #define PRE_LOOPBACK( FUNC ) #endif -#include "dispatch.h" -#include "glapioffsets.h" +#include "glapi/dispatch.h" +#include "glapi/glapioffsets.h" static void GLAPIENTRY TAG(ArrayElement)( GLint i ) { diff --git a/src/mesa/math/m_eval.c b/src/mesa/math/m_eval.c index 42ffd4133d..d324673c5d 100644 --- a/src/mesa/math/m_eval.c +++ b/src/mesa/math/m_eval.c @@ -37,8 +37,8 @@ */ -#include "glheader.h" -#include "config.h" +#include "main/glheader.h" +#include "main/config.h" #include "m_eval.h" static GLfloat inv_tab[MAX_EVAL_ORDER]; diff --git a/src/mesa/math/m_eval.h b/src/mesa/math/m_eval.h index a23cbd402e..d73ecaafb2 100644 --- a/src/mesa/math/m_eval.h +++ b/src/mesa/math/m_eval.h @@ -26,7 +26,7 @@ #ifndef _M_EVAL_H #define _M_EVAL_H -#include "glheader.h" +#include "main/glheader.h" void _math_init_eval( void ); diff --git a/src/mesa/math/m_translate.h b/src/mesa/math/m_translate.h index 0bcf96005c..c677682d50 100644 --- a/src/mesa/math/m_translate.h +++ b/src/mesa/math/m_translate.h @@ -26,8 +26,8 @@ #ifndef _M_TRANSLATE_H_ #define _M_TRANSLATE_H_ -#include "config.h" -#include "mtypes.h" /* hack for GLchan */ +#include "main/config.h" +#include "main/mtypes.h" /* hack for GLchan */ /** diff --git a/src/mesa/math/m_xform.c b/src/mesa/math/m_xform.c index fa3f57a8e5..901ae5b416 100644 --- a/src/mesa/math/m_xform.c +++ b/src/mesa/math/m_xform.c @@ -33,8 +33,8 @@ * 3. Transformation of a point p by a matrix M is: p' = M * p */ -#include "glheader.h" -#include "macros.h" +#include "main/glheader.h" +#include "main/macros.h" #include "m_eval.h" #include "m_matrix.h" diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index 5d8f763741..9a5290d920 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -30,10 +30,10 @@ * \author Karl Rasche */ -#include "glheader.h" -#include "imports.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "shader/grammar/grammar_mesa.h" #include "arbprogparse.h" -#include "grammar_mesa.h" #include "program.h" #include "prog_parameter.h" #include "prog_statevars.h" @@ -3573,7 +3573,7 @@ parse_instructions(GLcontext * ctx, const GLubyte * inst, /* XXX temporary */ LONGSTRING static char core_grammar_text[] = -#include "grammar_syn.h" +#include "shader/grammar/grammar_syn.h" ; diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c index 9faf9d8613..28d195d0ee 100644 --- a/src/mesa/shader/prog_execute.c +++ b/src/mesa/shader/prog_execute.c @@ -43,7 +43,7 @@ #include "prog_instruction.h" #include "prog_parameter.h" #include "prog_print.h" -#include "slang_library_noise.h" +#include "shader/slang/slang_library_noise.h" /* See comments below for info about this */ diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index 3a54e68d0d..66509d56db 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -43,10 +43,9 @@ #include "prog_parameter.h" #include "prog_print.h" #include "prog_statevars.h" -#include "shader_api.h" - -#include "slang_compile.h" -#include "slang_link.h" +#include "shader/shader_api.h" +#include "shader/slang/slang_compile.h" +#include "shader/slang/slang_link.h" diff --git a/src/mesa/shader/slang/slang_builtin.c b/src/mesa/shader/slang/slang_builtin.c index 6ee0fd33b6..1081d8ff8d 100644 --- a/src/mesa/shader/slang/slang_builtin.c +++ b/src/mesa/shader/slang/slang_builtin.c @@ -28,14 +28,14 @@ * \author Brian Paul */ -#include "imports.h" -#include "slang_builtin.h" -#include "slang_ir.h" -#include "mtypes.h" -#include "program.h" -#include "prog_instruction.h" -#include "prog_parameter.h" -#include "prog_statevars.h" +#include "main/imports.h" +#include "main/mtypes.h" +#include "shader/program.h" +#include "shader/prog_instruction.h" +#include "shader/prog_parameter.h" +#include "shader/prog_statevars.h" +#include "shader/slang/slang_ir.h" +#include "shader/slang/slang_builtin.h" /** diff --git a/src/mesa/shader/slang/slang_builtin.h b/src/mesa/shader/slang/slang_builtin.h index ae20c844d5..58629f4f7f 100644 --- a/src/mesa/shader/slang/slang_builtin.h +++ b/src/mesa/shader/slang/slang_builtin.h @@ -26,7 +26,7 @@ #ifndef SLANG_BUILTIN_H #define SLANG_BUILTIN_H -#include "prog_parameter.h" +#include "shader/prog_parameter.h" #include "slang_utility.h" #include "slang_ir.h" diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index f3a6d04428..2b5196f095 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -37,13 +37,13 @@ -#include "imports.h" -#include "macros.h" -#include "mtypes.h" -#include "program.h" -#include "prog_instruction.h" -#include "prog_parameter.h" -#include "prog_statevars.h" +#include "main/imports.h" +#include "main/macros.h" +#include "main/mtypes.h" +#include "shader/program.h" +#include "shader/prog_instruction.h" +#include "shader/prog_parameter.h" +#include "shader/prog_statevars.h" #include "slang_typeinfo.h" #include "slang_codegen.h" #include "slang_compile.h" diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index a4dd5b8b4a..70f5aac16d 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -28,11 +28,11 @@ * \author Michal Krol */ -#include "imports.h" -#include "context.h" -#include "program.h" -#include "prog_parameter.h" -#include "grammar_mesa.h" +#include "main/imports.h" +#include "main/context.h" +#include "shader/program.h" +#include "shader/prog_parameter.h" +#include "shader/grammar/grammar_mesa.h" #include "slang_codegen.h" #include "slang_compile.h" #include "slang_preprocess.h" diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index 7804e19236..02c74095a9 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -36,13 +36,13 @@ ***/ -#include "imports.h" -#include "context.h" -#include "macros.h" -#include "program.h" -#include "prog_instruction.h" -#include "prog_parameter.h" -#include "prog_print.h" +#include "main/imports.h" +#include "main/context.h" +#include "main/macros.h" +#include "shader/program.h" +#include "shader/prog_instruction.h" +#include "shader/prog_parameter.h" +#include "shader/prog_print.h" #include "slang_builtin.h" #include "slang_emit.h" #include "slang_mem.h" diff --git a/src/mesa/shader/slang/slang_ir.c b/src/mesa/shader/slang/slang_ir.c index a6903cc8b6..a29f302687 100644 --- a/src/mesa/shader/slang/slang_ir.c +++ b/src/mesa/shader/slang/slang_ir.c @@ -27,7 +27,7 @@ #include "context.h" #include "slang_ir.h" #include "slang_mem.h" -#include "prog_print.h" +#include "shader/prog_print.h" static const slang_ir_info IrInfo[] = { diff --git a/src/mesa/shader/slang/slang_label.h b/src/mesa/shader/slang/slang_label.h index 0f1a45b30f..87068ae7a7 100644 --- a/src/mesa/shader/slang/slang_label.h +++ b/src/mesa/shader/slang/slang_label.h @@ -1,9 +1,9 @@ #ifndef SLANG_LABEL_H #define SLANG_LABEL_H 1 -#include "imports.h" -#include "mtypes.h" -#include "prog_instruction.h" +#include "main/imports.h" +#include "main/mtypes.h" +#include "shader/prog_instruction.h" struct slang_label_ diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index d6d1c7523e..eaa29ba094 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -28,16 +28,16 @@ * \author Brian Paul */ -#include "imports.h" -#include "context.h" -#include "hash.h" -#include "macros.h" -#include "program.h" -#include "prog_instruction.h" -#include "prog_parameter.h" -#include "prog_print.h" -#include "prog_statevars.h" -#include "shader_api.h" +#include "main/imports.h" +#include "main/context.h" +#include "main/hash.h" +#include "main/macros.h" +#include "shader/program.h" +#include "shader/prog_instruction.h" +#include "shader/prog_parameter.h" +#include "shader/prog_print.h" +#include "shader/prog_statevars.h" +#include "shader/shader_api.h" #include "slang_link.h" diff --git a/src/mesa/shader/slang/slang_preprocess.c b/src/mesa/shader/slang/slang_preprocess.c index 72281eda57..076e982f8f 100644 --- a/src/mesa/shader/slang/slang_preprocess.c +++ b/src/mesa/shader/slang/slang_preprocess.c @@ -29,7 +29,7 @@ */ #include "imports.h" -#include "grammar_mesa.h" +#include "shader/grammar/grammar_mesa.h" #include "slang_preprocess.h" LONGSTRING static const char *slang_pp_directives_syn = diff --git a/src/mesa/shader/slang/slang_typeinfo.c b/src/mesa/shader/slang/slang_typeinfo.c index da0b32bc44..8a1c3abf48 100644 --- a/src/mesa/shader/slang/slang_typeinfo.c +++ b/src/mesa/shader/slang/slang_typeinfo.c @@ -28,12 +28,12 @@ * \author Michal Krol */ -#include "imports.h" +#include "main/imports.h" +#include "shader/prog_instruction.h" #include "slang_typeinfo.h" #include "slang_compile.h" #include "slang_log.h" #include "slang_mem.h" -#include "prog_instruction.h" /** diff --git a/src/mesa/shader/slang/slang_vartable.c b/src/mesa/shader/slang/slang_vartable.c index 8a3c299d19..1d817000c6 100644 --- a/src/mesa/shader/slang/slang_vartable.c +++ b/src/mesa/shader/slang/slang_vartable.c @@ -1,11 +1,11 @@ -#include "imports.h" +#include "main/imports.h" +#include "shader/prog_instruction.h" #include "slang_compile.h" #include "slang_compile_variable.h" #include "slang_mem.h" #include "slang_vartable.h" #include "slang_ir.h" -#include "prog_instruction.h" static int dbg = 0; diff --git a/src/mesa/swrast/s_atifragshader.c b/src/mesa/swrast/s_atifragshader.c index 947054faa3..55ec757ee0 100644 --- a/src/mesa/swrast/s_atifragshader.c +++ b/src/mesa/swrast/s_atifragshader.c @@ -23,11 +23,10 @@ #include "glheader.h" #include "colormac.h" #include "context.h" -#include "atifragshader.h" #include "macros.h" -#include "program.h" - -#include "s_atifragshader.h" +#include "shader/program.h" +#include "shader/atifragshader.h" +#include "swrast/s_atifragshader.h" /** diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index 791850cb50..3956925651 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -31,9 +31,9 @@ #include "context.h" #include "colormac.h" #include "mtypes.h" -#include "prog_statevars.h" #include "teximage.h" #include "swrast.h" +#include "shader/prog_statevars.h" #include "s_blend.h" #include "s_context.h" #include "s_lines.h" diff --git a/src/mesa/swrast/s_context.h b/src/mesa/swrast/s_context.h index f118eb92ca..daa07e1578 100644 --- a/src/mesa/swrast/s_context.h +++ b/src/mesa/swrast/s_context.h @@ -43,10 +43,10 @@ #ifndef S_CONTEXT_H #define S_CONTEXT_H -#include "mtypes.h" +#include "main/mtypes.h" +#include "shader/prog_execute.h" #include "swrast.h" #include "s_span.h" -#include "prog_execute.h" typedef void (*texture_sample_func)(GLcontext *ctx, diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c index 923b67e78e..14c9868c18 100644 --- a/src/mesa/swrast/s_fragprog.c +++ b/src/mesa/swrast/s_fragprog.c @@ -22,11 +22,11 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "glheader.h" -#include "colormac.h" -#include "context.h" -#include "prog_instruction.h" -#include "texstate.h" +#include "main/glheader.h" +#include "main/colormac.h" +#include "main/context.h" +#include "main/texstate.h" +#include "shader/prog_instruction.h" #include "s_fragprog.h" #include "s_span.h" diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h index d101a9e2ae..85a27fd55b 100644 --- a/src/mesa/swrast/swrast.h +++ b/src/mesa/swrast/swrast.h @@ -32,7 +32,7 @@ #ifndef SWRAST_H #define SWRAST_H -#include "mtypes.h" +#include "main/mtypes.h" /** * \struct SWvertex diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c index 3017c73cf1..3b8dd18bbb 100644 --- a/src/mesa/tnl/t_context.c +++ b/src/mesa/tnl/t_context.c @@ -26,12 +26,12 @@ */ -#include "glheader.h" -#include "imports.h" -#include "context.h" -#include "macros.h" -#include "mtypes.h" -#include "light.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/mtypes.h" +#include "main/light.h" #include "tnl.h" #include "t_context.h" diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h index 31b89aca41..baf283ef0f 100644 --- a/src/mesa/tnl/t_context.h +++ b/src/mesa/tnl/t_context.h @@ -49,8 +49,8 @@ #ifndef _T_CONTEXT_H #define _T_CONTEXT_H -#include "glheader.h" -#include "mtypes.h" +#include "main/glheader.h" +#include "main/mtypes.h" #include "math/m_matrix.h" #include "math/m_vector.h" diff --git a/src/mesa/tnl/t_pipeline.c b/src/mesa/tnl/t_pipeline.c index c7188da34a..2a0ed8852a 100644 --- a/src/mesa/tnl/t_pipeline.c +++ b/src/mesa/tnl/t_pipeline.c @@ -25,11 +25,11 @@ * Keith Whitwell */ -#include "glheader.h" -#include "context.h" -#include "imports.h" -#include "state.h" -#include "mtypes.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/imports.h" +#include "main/state.h" +#include "main/mtypes.h" #include "t_context.h" #include "t_pipeline.h" diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c index 9961af70ce..f8e561ac57 100644 --- a/src/mesa/tnl/t_vb_program.c +++ b/src/mesa/tnl/t_vb_program.c @@ -35,16 +35,16 @@ #include "context.h" #include "macros.h" #include "imports.h" -#include "prog_instruction.h" -#include "prog_statevars.h" -#include "prog_execute.h" +#include "shader/prog_instruction.h" +#include "shader/prog_statevars.h" +#include "shader/prog_execute.h" +#include "swrast/s_context.h" +#include "swrast/s_texfilter.h" #include "tnl.h" #include "t_context.h" #include "t_pipeline.h" -#include "swrast/s_context.h" -#include "swrast/s_texfilter.h" /** * XXX the texture sampling code in this module is a bit of a hack. diff --git a/src/mesa/tnl/t_vp_build.c b/src/mesa/tnl/t_vp_build.c index 2a1cae77f2..ee1a2498b3 100644 --- a/src/mesa/tnl/t_vp_build.c +++ b/src/mesa/tnl/t_vp_build.c @@ -33,11 +33,11 @@ #include "glheader.h" #include "macros.h" #include "enums.h" -#include "program.h" -#include "prog_instruction.h" -#include "prog_parameter.h" -#include "prog_print.h" -#include "prog_statevars.h" +#include "shader/program.h" +#include "shader/prog_instruction.h" +#include "shader/prog_parameter.h" +#include "shader/prog_print.h" +#include "shader/prog_statevars.h" #include "t_context.h" /* NOTE: very light dependency on this */ #include "t_vp_build.h" diff --git a/src/mesa/tnl/tnl.h b/src/mesa/tnl/tnl.h index 20bed5546d..047b764dcb 100644 --- a/src/mesa/tnl/tnl.h +++ b/src/mesa/tnl/tnl.h @@ -29,7 +29,7 @@ #ifndef _TNL_H #define _TNL_H -#include "mtypes.h" +#include "main/mtypes.h" diff --git a/src/mesa/vbo/vbo.h b/src/mesa/vbo/vbo.h index 874a5f9e0e..04c59c05b2 100644 --- a/src/mesa/vbo/vbo.h +++ b/src/mesa/vbo/vbo.h @@ -32,7 +32,7 @@ #ifndef _VBO_H #define _VBO_H -#include "mtypes.h" +#include "main/mtypes.h" struct _mesa_prim { GLuint mode:8; diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c index f64f59d11e..ad4556c500 100644 --- a/src/mesa/vbo/vbo_context.c +++ b/src/mesa/vbo/vbo_context.c @@ -25,11 +25,11 @@ * Keith Whitwell */ -#include "mtypes.h" +#include "main/imports.h" +#include "main/mtypes.h" +#include "main/api_arrayelt.h" #include "vbo.h" #include "vbo_context.h" -#include "imports.h" -#include "api_arrayelt.h" /* Reach out and grab this to use as the default: */ diff --git a/src/mesa/vbo/vbo_exec.c b/src/mesa/vbo/vbo_exec.c index 7d95873247..1efa74945d 100644 --- a/src/mesa/vbo/vbo_exec.c +++ b/src/mesa/vbo/vbo_exec.c @@ -26,14 +26,14 @@ */ -#include "api_arrayelt.h" -#include "glheader.h" -#include "imports.h" -#include "context.h" -#include "macros.h" -#include "mtypes.h" -#include "dlist.h" -#include "vtxfmt.h" +#include "main/api_arrayelt.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/mtypes.h" +#include "main/dlist.h" +#include "main/vtxfmt.h" #include "vbo_context.h" diff --git a/src/mesa/vbo/vbo_exec.h b/src/mesa/vbo/vbo_exec.h index a9b01e08e6..b7e8c9fe79 100644 --- a/src/mesa/vbo/vbo_exec.h +++ b/src/mesa/vbo/vbo_exec.h @@ -34,7 +34,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef __VBO_EXEC_H__ #define __VBO_EXEC_H__ -#include "mtypes.h" +#include "main/mtypes.h" #include "vbo.h" #include "vbo_attrib.h" diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 2d4ded0f98..7f56b3b629 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -30,16 +30,16 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * Keith Whitwell */ -#include "glheader.h" -#include "context.h" -#include "macros.h" -#include "vtxfmt.h" -#include "dlist.h" -#include "state.h" -#include "light.h" -#include "api_arrayelt.h" -#include "api_noop.h" -#include "dispatch.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/vtxfmt.h" +#include "main/dlist.h" +#include "main/state.h" +#include "main/light.h" +#include "main/api_arrayelt.h" +#include "main/api_noop.h" +#include "glapi/dispatch.h" #include "vbo_context.h" diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 1e4c310203..77f3cf1455 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -25,12 +25,12 @@ * **************************************************************************/ -#include "glheader.h" -#include "context.h" -#include "state.h" -#include "api_validate.h" -#include "api_noop.h" -#include "dispatch.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/state.h" +#include "main/api_validate.h" +#include "main/api_noop.h" +#include "glapi/dispatch.h" #include "vbo_context.h" diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index d8f167b357..0ef26cdfe3 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -25,11 +25,11 @@ * Keith Whitwell */ -#include "glheader.h" -#include "context.h" -#include "enums.h" -#include "state.h" -#include "macros.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/enums.h" +#include "main/state.h" +#include "main/macros.h" #include "vbo_context.h" diff --git a/src/mesa/vbo/vbo_exec_eval.c b/src/mesa/vbo/vbo_exec_eval.c index fe533290bd..0ba5585d24 100644 --- a/src/mesa/vbo/vbo_exec_eval.c +++ b/src/mesa/vbo/vbo_exec_eval.c @@ -25,13 +25,13 @@ * Keith Whitwell */ -#include "glheader.h" -#include "api_eval.h" -#include "context.h" -#include "macros.h" +#include "main/glheader.h" +#include "main/api_eval.h" +#include "main/context.h" +#include "main/macros.h" #include "math/m_eval.h" +#include "glapi/dispatch.h" #include "vbo_exec.h" -#include "dispatch.h" static void clear_active_eval1( struct vbo_exec_context *exec, GLuint attr ) diff --git a/src/mesa/vbo/vbo_rebase.c b/src/mesa/vbo/vbo_rebase.c index bc4211d852..dae778e741 100644 --- a/src/mesa/vbo/vbo_rebase.c +++ b/src/mesa/vbo/vbo_rebase.c @@ -46,9 +46,9 @@ * of zero. */ -#include "glheader.h" -#include "imports.h" -#include "mtypes.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/mtypes.h" #include "vbo.h" diff --git a/src/mesa/vbo/vbo_save.c b/src/mesa/vbo/vbo_save.c index e7f4687963..87248e10f3 100644 --- a/src/mesa/vbo/vbo_save.c +++ b/src/mesa/vbo/vbo_save.c @@ -26,10 +26,10 @@ */ -#include "mtypes.h" -#include "dlist.h" -#include "vtxfmt.h" -#include "imports.h" +#include "main/mtypes.h" +#include "main/dlist.h" +#include "main/vtxfmt.h" +#include "main/imports.h" #include "vbo_context.h" diff --git a/src/mesa/vbo/vbo_save.h b/src/mesa/vbo/vbo_save.h index b81f275a60..b7e9baabf8 100644 --- a/src/mesa/vbo/vbo_save.h +++ b/src/mesa/vbo/vbo_save.h @@ -34,7 +34,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef VBO_SAVE_H #define VBO_SAVE_H -#include "mtypes.h" +#include "main/mtypes.h" #include "vbo.h" #include "vbo_attrib.h" diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index e7794c2a6c..aded738143 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -67,15 +67,15 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "glheader.h" -#include "context.h" -#include "dlist.h" -#include "enums.h" -#include "macros.h" -#include "api_validate.h" -#include "api_arrayelt.h" -#include "vtxfmt.h" -#include "dispatch.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/dlist.h" +#include "main/enums.h" +#include "main/macros.h" +#include "main/api_validate.h" +#include "main/api_arrayelt.h" +#include "main/vtxfmt.h" +#include "glapi/dispatch.h" #include "vbo_context.h" diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c index 8940551d08..3c6f0fccd9 100644 --- a/src/mesa/vbo/vbo_save_draw.c +++ b/src/mesa/vbo/vbo_save_draw.c @@ -26,13 +26,13 @@ * Keith Whitwell */ -#include "glheader.h" -#include "context.h" -#include "imports.h" -#include "mtypes.h" -#include "macros.h" -#include "light.h" -#include "state.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/imports.h" +#include "main/mtypes.h" +#include "main/macros.h" +#include "main/light.h" +#include "main/state.h" #include "vbo_context.h" diff --git a/src/mesa/vbo/vbo_save_loopback.c b/src/mesa/vbo/vbo_save_loopback.c index 430333b84d..f2cef698fb 100644 --- a/src/mesa/vbo/vbo_save_loopback.c +++ b/src/mesa/vbo/vbo_save_loopback.c @@ -28,17 +28,17 @@ #include "swrast_setup/swrast_setup.h" #include "swrast/swrast.h" #include "tnl/tnl.h" -#include "context.h" +#include "main/context.h" +#include "main/glheader.h" +#include "main/enums.h" +#include "main/imports.h" +#include "main/macros.h" +#include "main/mtypes.h" +#include "glapi/dispatch.h" +#include "glapi/glapi.h" #include "vbo_context.h" -#include "glheader.h" -#include "enums.h" -#include "glapi.h" -#include "imports.h" -#include "macros.h" -#include "mtypes.h" -#include "dispatch.h" typedef void (*attr_func)( GLcontext *ctx, GLint target, const GLfloat * ); diff --git a/src/mesa/vbo/vbo_split.c b/src/mesa/vbo/vbo_split.c index ef205a3bb1..58e879628d 100644 --- a/src/mesa/vbo/vbo_split.c +++ b/src/mesa/vbo/vbo_split.c @@ -47,9 +47,9 @@ * limitations on drivers which want to use it as a fallback path. */ -#include "glheader.h" -#include "imports.h" -#include "mtypes.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/mtypes.h" #include "vbo_split.h" #include "vbo.h" diff --git a/src/mesa/vbo/vbo_split_copy.c b/src/mesa/vbo/vbo_split_copy.c index e142dde680..e5c4429350 100644 --- a/src/mesa/vbo/vbo_split_copy.c +++ b/src/mesa/vbo/vbo_split_copy.c @@ -29,11 +29,11 @@ /* Split indexed primitives with per-vertex copying. */ -#include "glheader.h" -#include "imports.h" -#include "macros.h" -#include "enums.h" -#include "mtypes.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/macros.h" +#include "main/enums.h" +#include "main/mtypes.h" #include "vbo_split.h" #include "vbo.h" diff --git a/src/mesa/vbo/vbo_split_inplace.c b/src/mesa/vbo/vbo_split_inplace.c index ea62866e7c..958afccd0c 100644 --- a/src/mesa/vbo/vbo_split_inplace.c +++ b/src/mesa/vbo/vbo_split_inplace.c @@ -27,9 +27,9 @@ */ -#include "mtypes.h" -#include "macros.h" -#include "enums.h" +#include "main/mtypes.h" +#include "main/macros.h" +#include "main/enums.h" #include "vbo_split.h" -- cgit v1.2.3 From af2aa8e9cf88a9ee3ec338eddc9a47bf2f142cb7 Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 21 Jul 2007 10:06:18 -0600 Subject: Remove ctx->Point._Size and ctx->Line._Width. The clamping for these values depends on whether we're drawing AA or non-AA points, lines. Defer clamping until drawing time. Drivers could compute and keep clamped AA and clamped non-AA values if desired. --- src/mesa/drivers/dri/i810/i810state.c | 10 ++++++++-- src/mesa/drivers/dri/i810/i810tris.c | 4 +++- src/mesa/drivers/dri/i965/brw_sf_state.c | 6 ++++-- src/mesa/drivers/dri/mach64/mach64_native_vb.c | 2 +- src/mesa/drivers/dri/mach64/mach64_tris.c | 13 ++++++++----- src/mesa/drivers/dri/mga/mgatris.c | 10 +++++++--- src/mesa/drivers/dri/r200/r200_state.c | 4 +++- src/mesa/drivers/dri/r300/r300_state.c | 9 +++++---- src/mesa/drivers/dri/savage/savagetris.c | 16 ++++++++++++---- src/mesa/drivers/dri/tdfx/tdfx_tris.c | 2 +- src/mesa/main/lines.c | 8 ++------ src/mesa/main/mtypes.h | 2 -- src/mesa/main/points.c | 5 ----- src/mesa/main/state.c | 4 ++-- src/mesa/swrast/s_aalinetemp.h | 4 +++- src/mesa/swrast/s_lines.c | 16 +++++++++------- src/mesa/swrast/s_points.c | 8 ++++---- src/mesa/tnl/t_vertex.c | 2 +- src/mesa/tnl_dd/t_dd_vb.c | 2 +- 19 files changed, 74 insertions(+), 53 deletions(-) (limited to 'src/mesa/tnl') diff --git a/src/mesa/drivers/dri/i810/i810state.c b/src/mesa/drivers/dri/i810/i810state.c index 3ad25282d9..e0d5b2b487 100644 --- a/src/mesa/drivers/dri/i810/i810state.c +++ b/src/mesa/drivers/dri/i810/i810state.c @@ -380,7 +380,10 @@ static void i810CullFaceFrontFace(GLcontext *ctx, GLenum unused) static void i810LineWidth( GLcontext *ctx, GLfloat widthf ) { i810ContextPtr imesa = I810_CONTEXT( ctx ); - int width = (int)ctx->Line._Width; + /* AA, non-AA limits are same */ + const int width = (int) CLAMP(ctx->Line.Width, + ctx->Const.MinLineWidth, + ctx->Const.MaxLineWidth); imesa->LcsLineWidth = 0; if (width & 1) imesa->LcsLineWidth |= LCS_LINEWIDTH_1_0; @@ -396,7 +399,10 @@ static void i810LineWidth( GLcontext *ctx, GLfloat widthf ) static void i810PointSize( GLcontext *ctx, GLfloat sz ) { i810ContextPtr imesa = I810_CONTEXT( ctx ); - int size = (int)ctx->Point._Size; + /* AA, non-AA limits are same */ + const int size = (int) CLAMP(ctx->Point.Size, + ctx->Const.MinPointSize, + ctx->Const.MaxPointSize); imesa->LcsPointSize = 0; if (size & 1) imesa->LcsPointSize |= LCS_LINEWIDTH_1_0; diff --git a/src/mesa/drivers/dri/i810/i810tris.c b/src/mesa/drivers/dri/i810/i810tris.c index 3e09427bb9..2c4ee06633 100644 --- a/src/mesa/drivers/dri/i810/i810tris.c +++ b/src/mesa/drivers/dri/i810/i810tris.c @@ -112,7 +112,9 @@ static __inline__ void i810_draw_quad( i810ContextPtr imesa, static __inline__ void i810_draw_point( i810ContextPtr imesa, i810VertexPtr tmp ) { - GLfloat sz = imesa->glCtx->Point._Size * .5; + GLfloat sz = 0.5 * CLAMP(imesa->glCtx->Point.Size, + imesa->glCtx->Const.MinPointSize, + imesa->glCtx->Const.MaxPointSize); int vertsize = imesa->vertex_size; GLuint *vb = i810AllocDmaLow( imesa, 2 * 4 * vertsize ); int j; diff --git a/src/mesa/drivers/dri/i965/brw_sf_state.c b/src/mesa/drivers/dri/i965/brw_sf_state.c index bfac52d765..9a6e5f5f19 100644 --- a/src/mesa/drivers/dri/i965/brw_sf_state.c +++ b/src/mesa/drivers/dri/i965/brw_sf_state.c @@ -173,7 +173,8 @@ static void upload_sf_unit( struct brw_context *brw ) /* _NEW_LINE */ - sf.sf6.line_width = brw->attribs.Line->_Width * (1<<1); + /* XXX use ctx->Const.Min/MaxLineWidth here */ + sf.sf6.line_width = CLAMP(brw->attribs.Line->Width, 1.0, 5.0) * (1<<1); sf.sf6.line_endcap_aa_region_width = 1; if (brw->attribs.Line->SmoothFlag) @@ -183,7 +184,8 @@ static void upload_sf_unit( struct brw_context *brw ) /* _NEW_POINT */ sf.sf6.point_rast_rule = 1; /* opengl conventions */ - sf.sf7.point_size = brw->attribs.Point->_Size * (1<<3); + /* XXX clamp max depends on AA vs. non-AA */ + sf.sf7.point_size = CLAMP(brw->attribs.Point->Size, 1.0, 3.0) * (1<<3); sf.sf7.use_point_size_state = !brw->attribs.Point->_Attenuated; /* might be BRW_NEW_PRIMITIVE if we have to adjust pv for polygons: diff --git a/src/mesa/drivers/dri/mach64/mach64_native_vb.c b/src/mesa/drivers/dri/mach64/mach64_native_vb.c index 75cf0e2ed2..248fa2a9a2 100644 --- a/src/mesa/drivers/dri/mach64/mach64_native_vb.c +++ b/src/mesa/drivers/dri/mach64/mach64_native_vb.c @@ -103,7 +103,7 @@ void TAG(translate_vertex)(GLcontext *ctx, assert( p + 1 - (CARD32 *)src == 10 ); - dst->pointSize = ctx->Point._Size; + dst->pointSize = ctx->Point.Size; } diff --git a/src/mesa/drivers/dri/mach64/mach64_tris.c b/src/mesa/drivers/dri/mach64/mach64_tris.c index 08cc1849a1..369f610442 100644 --- a/src/mesa/drivers/dri/mach64/mach64_tris.c +++ b/src/mesa/drivers/dri/mach64/mach64_tris.c @@ -673,7 +673,10 @@ static __inline void mach64_draw_line( mach64ContextPtr mmesa, #if MACH64_NATIVE_VTXFMT GLcontext *ctx = mmesa->glCtx; const GLuint vertsize = mmesa->vertex_size; - GLint width = (GLint)(mmesa->glCtx->Line._Width * 2.0); /* 2 fractional bits for hardware */ + /* 2 fractional bits for hardware: */ + const int width = (int) (2.0 * CLAMP(mmesa->glCtx->Line.Width, + mmesa->glCtx->Const.MinLineWidth, + mmesa->glCtx->Const.MaxLineWidth)); GLfloat ooa; GLuint *pxy0, *pxy1; GLuint xy0old, xy0, xy1old, xy1; @@ -691,9 +694,6 @@ static __inline void mach64_draw_line( mach64ContextPtr mmesa, mach64_print_vertex( ctx, v1 ); } - if( !width ) - width = 1; /* round to the nearest supported width */ - pxy0 = &v0->ui[xyoffset]; xy0old = *pxy0; xy0 = LE32_IN( &xy0old ); @@ -961,7 +961,10 @@ static __inline void mach64_draw_point( mach64ContextPtr mmesa, #if MACH64_NATIVE_VTXFMT GLcontext *ctx = mmesa->glCtx; const GLuint vertsize = mmesa->vertex_size; - GLint sz = (GLint)(mmesa->glCtx->Point._Size * 2.0); /* 2 fractional bits for hardware */ + /* 2 fractional bits for hardware: */ + GLint sz = (GLint) (2.0 * CLAMP(mmesa->glCtx->Point.Size, + ctx->Const.MinPointSize, + ctx->Const.MaxPointSize)); GLfloat ooa; GLuint *pxy; GLuint xyold, xy; diff --git a/src/mesa/drivers/dri/mga/mgatris.c b/src/mesa/drivers/dri/mga/mgatris.c index 2b7ea05b14..91b413ae76 100644 --- a/src/mesa/drivers/dri/mga/mgatris.c +++ b/src/mesa/drivers/dri/mga/mgatris.c @@ -104,8 +104,10 @@ static void __inline__ mga_draw_quad( mgaContextPtr mmesa, static __inline__ void mga_draw_point( mgaContextPtr mmesa, mgaVertexPtr tmp ) { - GLfloat sz = mmesa->glCtx->Point._Size * .5; - int vertex_size = mmesa->vertex_size; + const GLfloat sz = 0.5 * CLAMP(mmesa->glCtx->Point.Size, + mmesa->glCtx->Const.MinPointSize, + mmesa->glCtx->Const.MaxPointSize); + const int vertex_size = mmesa->vertex_size; GLuint *vb = mgaAllocDmaLow( mmesa, 6 * 4 * vertex_size ); int j; @@ -165,7 +167,9 @@ static __inline__ void mga_draw_line( mgaContextPtr mmesa, GLuint vertex_size = mmesa->vertex_size; GLuint *vb = mgaAllocDmaLow( mmesa, 6 * 4 * vertex_size ); GLfloat dx, dy, ix, iy; - GLfloat width = mmesa->glCtx->Line._Width; + const GLfloat width = CLAMP(mmesa->glCtx->Line.Width, + mmesa->glCtx->Const.MinLineWidth, + mmesa->glCtx->Const.MaxLineWidth); GLint j; #if 0 diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index 2115799b9b..1d975ecd57 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -772,9 +772,11 @@ static void r200LineWidth( GLcontext *ctx, GLfloat widthf ) R200_STATECHANGE( rmesa, set ); /* Line width is stored in U6.4 format. + * Same min/max limits for AA, non-AA lines. */ rmesa->hw.lin.cmd[LIN_SE_LINE_WIDTH] &= ~0xffff; - rmesa->hw.lin.cmd[LIN_SE_LINE_WIDTH] |= (GLuint)(ctx->Line._Width * 16.0); + rmesa->hw.lin.cmd[LIN_SE_LINE_WIDTH] |= (GLuint) + (CLAMP(widthf, ctx->Const.MinLineWidth, ctx->Const.MaxLineWidth) * 16.0); if ( widthf > 1.0 ) { rmesa->hw.set.cmd[SET_SE_CNTL] |= R200_WIDELINE_ENABLE; diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index a790acacfe..088216c76e 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -733,8 +733,8 @@ static void r300Fogfv(GLcontext * ctx, GLenum pname, const GLfloat * param) static void r300PointSize(GLcontext * ctx, GLfloat size) { r300ContextPtr r300 = R300_CONTEXT(ctx); - - size = ctx->Point._Size; + /* same size limits for AA, non-AA points */ + size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize); R300_STATECHANGE(r300, ps); r300->hw.ps.cmd[R300_PS_POINTSIZE] = @@ -749,8 +749,9 @@ static void r300LineWidth(GLcontext * ctx, GLfloat widthf) { r300ContextPtr r300 = R300_CONTEXT(ctx); - widthf = ctx->Line._Width; - + widthf = CLAMP(widthf, + ctx->Const.MinPointSize, + ctx->Const.MaxPointSize); R300_STATECHANGE(r300, lcntl); r300->hw.lcntl.cmd[1] = R300_LINE_CNT_HO | R300_LINE_CNT_VE | (int)(widthf * 6.0); diff --git a/src/mesa/drivers/dri/savage/savagetris.c b/src/mesa/drivers/dri/savage/savagetris.c index 3dd821a4d3..4ce2f60b4f 100644 --- a/src/mesa/drivers/dri/savage/savagetris.c +++ b/src/mesa/drivers/dri/savage/savagetris.c @@ -131,7 +131,9 @@ static __inline__ void savage_draw_point (savageContextPtr imesa, u_int32_t *vb = savageAllocVtxBuf (imesa, 6*vertsize); const GLfloat x = tmp->v.x; const GLfloat y = tmp->v.y; - const GLfloat sz = imesa->glCtx->Point._Size * .5; + const GLfloat sz = 0.5 * CLAMP(imesa->glCtx->Point.Size, + imesa->glCtx->Const.MinPointSize, + imesa->glCtx->Const.MaxPointSize); GLuint j; *(float *)&vb[0] = x - sz; @@ -164,7 +166,9 @@ static __inline__ void savage_draw_line (savageContextPtr imesa, savageVertexPtr v1 ) { GLuint vertsize = imesa->HwVertexSize; u_int32_t *vb = savageAllocVtxBuf (imesa, 6*vertsize); - GLfloat width = imesa->glCtx->Line._Width; + const GLfloat width = CLAMP(imesa->glCtx->Line.Width, + imesa->glCtx->Const.MinLineWidth, + imesa->glCtx->Const.MaxLineWidth); GLfloat dx, dy, ix, iy; GLuint j; @@ -234,7 +238,9 @@ static __inline__ void savage_ptex_line (savageContextPtr imesa, savageVertexPtr v1 ) { GLuint vertsize = imesa->HwVertexSize; u_int32_t *vb = savageAllocVtxBuf (imesa, 6*vertsize); - GLfloat width = imesa->glCtx->Line._Width; + const GLfloat width = CLAMP(imesa->glCtx->Line.Width, + imesa->glCtx->Const.MinLineWidth, + imesa->glCtx->Const.MaxLineWidth); GLfloat dx, dy, ix, iy; savageVertex tmp0, tmp1; GLuint j; @@ -281,7 +287,9 @@ static __inline__ void savage_ptex_point (savageContextPtr imesa, u_int32_t *vb = savageAllocVtxBuf (imesa, 6*vertsize); const GLfloat x = v0->v.x; const GLfloat y = v0->v.y; - const GLfloat sz = imesa->glCtx->Point._Size * .5; + const GLfloat sz = 0.5 * CLAMP(imesa->glCtx->Point.Size, + imesa->glCtx->Const.MinPointSize, + imesa->glCtx->Const.MaxPointSize); savageVertex tmp; GLuint j; diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tris.c b/src/mesa/drivers/dri/tdfx/tdfx_tris.c index 96f9ae27fc..7252a7e7dc 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tris.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_tris.c @@ -184,7 +184,7 @@ tdfx_translate_vertex( GLcontext *ctx, const tdfxVertex *src, SWvertex *dst) } } - dst->pointSize = ctx->Point._Size; + dst->pointSize = ctx->Point.Size; } diff --git a/src/mesa/main/lines.c b/src/mesa/main/lines.c index dc7195d4eb..0c2dbf915a 100644 --- a/src/mesa/main/lines.c +++ b/src/mesa/main/lines.c @@ -55,9 +55,6 @@ _mesa_LineWidth( GLfloat width ) FLUSH_VERTICES(ctx, _NEW_LINE); ctx->Line.Width = width; - ctx->Line._Width = CLAMP(width, - ctx->Const.MinLineWidth, - ctx->Const.MaxLineWidth); if (ctx->Driver.LineWidth) ctx->Driver.LineWidth(ctx, width); @@ -105,13 +102,12 @@ _mesa_LineStipple( GLint factor, GLushort pattern ) * Initializes __GLcontextRec::Line and line related constants in * __GLcontextRec::Const. */ -void GLAPIENTRY _mesa_init_line( GLcontext * ctx ) +void GLAPIENTRY +_mesa_init_line( GLcontext * ctx ) { - /* Line group */ ctx->Line.SmoothFlag = GL_FALSE; ctx->Line.StippleFlag = GL_FALSE; ctx->Line.Width = 1.0; - ctx->Line._Width = 1.0; ctx->Line.StipplePattern = 0xffff; ctx->Line.StippleFactor = 1; } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 709b88d2ef..a5fdd88262 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -917,7 +917,6 @@ struct gl_line_attrib GLushort StipplePattern; /**< Stipple pattern */ GLint StippleFactor; /**< Stipple repeat factor */ GLfloat Width; /**< Line width */ - GLfloat _Width; /**< Clamped Line width */ }; @@ -1063,7 +1062,6 @@ struct gl_point_attrib { GLboolean SmoothFlag; /**< True if GL_POINT_SMOOTH is enabled */ GLfloat Size; /**< User-specified point size */ - GLfloat _Size; /**< Size clamped to Const.Min/MaxPointSize */ GLfloat Params[3]; /**< GL_EXT_point_parameters */ GLfloat MinSize, MaxSize; /**< GL_EXT_point_parameters */ GLfloat Threshold; /**< GL_EXT_point_parameters */ diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c index 0f562420b0..e83db5de78 100644 --- a/src/mesa/main/points.c +++ b/src/mesa/main/points.c @@ -57,10 +57,6 @@ _mesa_PointSize( GLfloat size ) FLUSH_VERTICES(ctx, _NEW_POINT); ctx->Point.Size = size; - /* XXX correct clamp limits? */ - ctx->Point._Size = CLAMP(ctx->Point.Size, - ctx->Point.MinSize, - ctx->Point.MaxSize); if (ctx->Driver.PointSize) ctx->Driver.PointSize(ctx, size); @@ -253,7 +249,6 @@ _mesa_init_point(GLcontext *ctx) ctx->Point.SmoothFlag = GL_FALSE; ctx->Point.Size = 1.0; - ctx->Point._Size = 1.0; ctx->Point.Params[0] = 1.0; ctx->Point.Params[1] = 0.0; ctx->Point.Params[2] = 0.0; diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 66f8ac6408..444f227760 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -1068,7 +1068,7 @@ update_tricaps(GLcontext *ctx, GLbitfield new_state) if (1/*new_state & _NEW_POINT*/) { if (ctx->Point.SmoothFlag) ctx->_TriangleCaps |= DD_POINT_SMOOTH; - if (ctx->Point._Size != 1.0F) + if (ctx->Point.Size != 1.0F) ctx->_TriangleCaps |= DD_POINT_SIZE; if (ctx->Point._Attenuated) ctx->_TriangleCaps |= DD_POINT_ATTEN; @@ -1082,7 +1082,7 @@ update_tricaps(GLcontext *ctx, GLbitfield new_state) ctx->_TriangleCaps |= DD_LINE_SMOOTH; if (ctx->Line.StippleFlag) ctx->_TriangleCaps |= DD_LINE_STIPPLE; - if (ctx->Line._Width != 1.0) + if (ctx->Line.Width != 1.0) ctx->_TriangleCaps |= DD_LINE_WIDTH; } diff --git a/src/mesa/swrast/s_aalinetemp.h b/src/mesa/swrast/s_aalinetemp.h index 69a1f0cd39..e7911fec3b 100644 --- a/src/mesa/swrast/s_aalinetemp.h +++ b/src/mesa/swrast/s_aalinetemp.h @@ -132,7 +132,9 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1) line.dx = line.x1 - line.x0; line.dy = line.y1 - line.y0; line.len = SQRTF(line.dx * line.dx + line.dy * line.dy); - line.halfWidth = 0.5F * ctx->Line._Width; + line.halfWidth = 0.5F * CLAMP(ctx->Line.Width, + ctx->Const.MinLineWidthAA, + ctx->Const.MaxLineWidthAA); if (line.len == 0.0 || IS_INF_OR_NAN(line.len)) return; diff --git a/src/mesa/swrast/s_lines.c b/src/mesa/swrast/s_lines.c index 781146e67f..15ef6233ed 100644 --- a/src/mesa/swrast/s_lines.c +++ b/src/mesa/swrast/s_lines.c @@ -63,12 +63,13 @@ compute_stipple_mask( GLcontext *ctx, GLuint len, GLubyte mask[] ) static void draw_wide_line( GLcontext *ctx, SWspan *span, GLboolean xMajor ) { - GLint width, start; + const GLint width = (GLint) CLAMP(ctx->Line.Width, + ctx->Const.MinLineWidth, + ctx->Const.MaxLineWidth); + GLint start; ASSERT(span->end < MAX_WIDTH); - width = (GLint) CLAMP( ctx->Line._Width, MIN_LINE_WIDTH, MAX_LINE_WIDTH ); - if (width & 1) start = width / 2; else @@ -143,7 +144,7 @@ draw_wide_line( GLcontext *ctx, SWspan *span, GLboolean xMajor ) span.arrayMask |= SPAN_MASK; \ compute_stipple_mask(ctx, span.end, span.array->mask); \ } \ - if (ctx->Line._Width > 1.0) { \ + if (ctx->Line.Width > 1.0) { \ draw_wide_line(ctx, &span, (GLboolean)(dx > dy)); \ } \ else { \ @@ -161,7 +162,7 @@ draw_wide_line( GLcontext *ctx, SWspan *span, GLboolean xMajor ) span.arrayMask |= SPAN_MASK; \ compute_stipple_mask(ctx, span.end, span.array->mask); \ } \ - if (ctx->Line._Width > 1.0) { \ + if (ctx->Line.Width > 1.0) { \ draw_wide_line(ctx, &span, (GLboolean)(dx > dy)); \ } \ else { \ @@ -180,7 +181,7 @@ draw_wide_line( GLcontext *ctx, SWspan *span, GLboolean xMajor ) span.arrayMask |= SPAN_MASK; \ compute_stipple_mask(ctx, span.end, span.array->mask); \ } \ - if (ctx->Line._Width > 1.0) { \ + if (ctx->Line.Width > 1.0) { \ draw_wide_line(ctx, &span, (GLboolean)(dx > dy)); \ } \ else { \ @@ -274,7 +275,7 @@ _swrast_choose_line( GLcontext *ctx ) USE(general_line); } else if (ctx->Depth.Test - || ctx->Line._Width != 1.0 + || ctx->Line.Width != 1.0 || ctx->Line.StippleFlag) { /* no texture, but Z, fog, width>1, stipple, etc. */ if (rgbmode) @@ -284,6 +285,7 @@ _swrast_choose_line( GLcontext *ctx ) } else { ASSERT(!ctx->Depth.Test); + ASSERT(ctx->Line.Width == 1.0); /* simple lines */ if (rgbmode) USE(simple_no_z_rgba_line); diff --git a/src/mesa/swrast/s_points.c b/src/mesa/swrast/s_points.c index 8eba53c807..4768fbea97 100644 --- a/src/mesa/swrast/s_points.c +++ b/src/mesa/swrast/s_points.c @@ -76,7 +76,7 @@ sprite_point(GLcontext *ctx, const SWvertex *vert) } else { /* use constant point size */ - size = ctx->Point._Size; /* already clamped to user range */ + size = ctx->Point.Size; } /* clamp to non-AA implementation limits */ size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize); @@ -227,7 +227,7 @@ smooth_point(GLcontext *ctx, const SWvertex *vert) } else { /* use constant point size */ - size = ctx->Point._Size; /* this is already clamped */ + size = ctx->Point.Size; } /* clamp to AA implementation limits */ size = CLAMP(size, ctx->Const.MinPointSizeAA, ctx->Const.MaxPointSizeAA); @@ -361,7 +361,7 @@ large_point(GLcontext *ctx, const SWvertex *vert) } else { /* use constant point size */ - size = ctx->Point._Size; /* already clamped to user range */ + size = ctx->Point.Size; } /* clamp to non-AA implementation limits */ size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize); @@ -550,7 +550,7 @@ _swrast_choose_point(GLcontext *ctx) else if (ctx->Point.SmoothFlag) { swrast->Point = smooth_point; } - else if (ctx->Point._Size > 1.0 || + else if (ctx->Point.Size > 1.0 || ctx->Point._Attenuated || ctx->VertexProgram.PointSizeEnabled) { swrast->Point = large_point; diff --git a/src/mesa/tnl/t_vertex.c b/src/mesa/tnl/t_vertex.c index 6aae602037..a6728c318f 100644 --- a/src/mesa/tnl/t_vertex.c +++ b/src/mesa/tnl/t_vertex.c @@ -233,7 +233,7 @@ void _tnl_get_attr( GLcontext *ctx, const void *vin, /* If the hardware vertex doesn't have point size then use size from * GLcontext. XXX this will be wrong if drawing attenuated points! */ - dest[0] = ctx->Point._Size; + dest[0] = ctx->Point.Size; } else { _mesa_memcpy( dest, ctx->Current.Attrib[attr], 4*sizeof(GLfloat)); diff --git a/src/mesa/tnl_dd/t_dd_vb.c b/src/mesa/tnl_dd/t_dd_vb.c index ab3bb37631..3cedd90119 100644 --- a/src/mesa/tnl_dd/t_dd_vb.c +++ b/src/mesa/tnl_dd/t_dd_vb.c @@ -184,7 +184,7 @@ void TAG(translate_vertex)(GLcontext *ctx, } } - dst->pointSize = ctx->Point._Size; + dst->pointSize = ctx->Point.Size; } -- cgit v1.2.3