diff options
author | Michal Krol <mjkrol@gmail.org> | 2006-04-11 11:41:11 +0000 |
---|---|---|
committer | Michal Krol <mjkrol@gmail.org> | 2006-04-11 11:41:11 +0000 |
commit | bb38cadb1c5f2dc13096a091bdaf61dc3e3cfa4d (patch) | |
tree | 8474881f1f529e1217d3442a98defb1a667b8403 /src/mesa/swrast_setup | |
parent | d90ad3fd876860b7a2ba763c031e46f76e4c47c6 (diff) |
More GLSL code:
- use macros to access and modify render inputs bit-field;
- un-alias generic vertex attributes for ARB vertex calls;
- use MAX_VERTEX_PROGRAM_ATTRIBS (NV code) or MAX_VERTEX_ATTRIBS
(ARB code) in place of VERT_ATTRIB_MAX;
- define VERT_ATTRIB_GENERIC0..15 for un-aliased vertex
attributes for ARB_vertex_shader;
- fix generic attribute index range check in arbprogparse.c;
- interface GLSL varyings between vertex and fragment shader;
- use 64-bit optimised bitset (bitset.h) for render inputs;
Diffstat (limited to 'src/mesa/swrast_setup')
-rw-r--r-- | src/mesa/swrast_setup/ss_context.c | 76 | ||||
-rw-r--r-- | src/mesa/swrast_setup/ss_context.h | 7 |
2 files changed, 46 insertions, 37 deletions
diff --git a/src/mesa/swrast_setup/ss_context.c b/src/mesa/swrast_setup/ss_context.c index c63646ca97..7b25d14a0c 100644 --- a/src/mesa/swrast_setup/ss_context.c +++ b/src/mesa/swrast_setup/ss_context.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.1 + * Version: 6.5 * - * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -93,7 +93,6 @@ do { \ e++; \ } while (0) - /* * We patch this function into tnl->Driver.Render.Start. * It's called when we start rendering a vertex buffer. @@ -119,43 +118,52 @@ _swsetup_RenderStart( GLcontext *ctx ) VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr; - if (tnl->render_inputs != swsetup->last_index) { - GLuint index = tnl->render_inputs; + if (!RENDERINPUTS_EQUAL(tnl->render_inputs_bitset, swsetup->last_index_bitset)) { + DECLARE_RENDERINPUTS(index_bitset); struct tnl_attr_map map[_TNL_ATTRIB_MAX]; int i, e = 0; + RENDERINPUTS_COPY( index_bitset, tnl->render_inputs_bitset ); + EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, win ); - - if (index & _TNL_BIT_COLOR0) - EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4CHAN_4F_RGBA, color ); - - if (index & _TNL_BIT_COLOR1) - EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_4CHAN_4F_RGBA, specular); - - if (index & _TNL_BIT_FOG) - EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1F, fog); - - if (index & _TNL_BITS_TEX_ANY) { - for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) { - if (index & _TNL_BIT_TEX(i)) { - EMIT_ATTR( _TNL_ATTRIB_TEX0+i, EMIT_4F, texcoord[i] ); - } - } + + if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR0 )) + EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4CHAN_4F_RGBA, color ); + + if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 )) + EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_4CHAN_4F_RGBA, specular); + + if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG )) + EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1F, fog); + + if (RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX )) { + for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) { + if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX(i) )) { + EMIT_ATTR( _TNL_ATTRIB_TEX(i), EMIT_4F, texcoord[i] ); + } + } } - - if (index & _TNL_BIT_INDEX) - EMIT_ATTR( _TNL_ATTRIB_INDEX, EMIT_1F, index ); - - if (index & _TNL_BIT_POINTSIZE) - EMIT_ATTR( _TNL_ATTRIB_POINTSIZE, EMIT_1F, pointSize ); - + + if (RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_FIRST_ATTRIBUTE, _TNL_LAST_ATTRIBUTE )) { + for (i = 0; i < MAX_VERTEX_ATTRIBS; i++) { + if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_ATTRIBUTE(i) )) { + EMIT_ATTR( _TNL_ATTRIB_ATTRIBUTE(i), VARYING_EMIT_STYLE, attribute[i] ); + } + } + } + + if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_INDEX )) + EMIT_ATTR( _TNL_ATTRIB_INDEX, EMIT_1F, index ); + + if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_POINTSIZE )) + EMIT_ATTR( _TNL_ATTRIB_POINTSIZE, EMIT_1F, pointSize ); + _tnl_install_attrs( ctx, map, e, - ctx->Viewport._WindowMap.m, - sizeof(SWvertex) ); - - swsetup->last_index = index; - } + ctx->Viewport._WindowMap.m, + sizeof(SWvertex) ); + RENDERINPUTS_COPY( swsetup->last_index_bitset, index_bitset ); + } } /* @@ -205,7 +213,7 @@ _swsetup_Wakeup( GLcontext *ctx ) _swsetup_InvalidateState( ctx, ~0 ); swsetup->verts = (SWvertex *)tnl->clipspace.vertex_buf; - swsetup->last_index = 0; + RENDERINPUTS_ZERO( swsetup->last_index_bitset ); } diff --git a/src/mesa/swrast_setup/ss_context.h b/src/mesa/swrast_setup/ss_context.h index 2c6e4faf3d..e5d890447a 100644 --- a/src/mesa/swrast_setup/ss_context.h +++ b/src/mesa/swrast_setup/ss_context.h @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 4.1 + * Version: 6.5 * - * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -32,11 +32,12 @@ #include "mtypes.h" #include "swrast/swrast.h" #include "swrast_setup.h" +#include "tnl/t_context.h" typedef struct { GLuint NewState; GLenum render_prim; - GLuint last_index; + DECLARE_RENDERINPUTS(last_index_bitset); SWvertex *verts; } SScontext; |