remove vtxfmt code, switch over to vbo

This commit is contained in:
Keith Whitwell 2006-10-31 12:11:10 +00:00
parent 70dd0126bd
commit 80c88304fc
26 changed files with 21 additions and 6923 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

File diff suppressed because it is too large Load diff

View file

@ -1,123 +0,0 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.h,v 1.1 2002/10/30 12:51:53 alanh Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
The Weather Channel (TM) funded Tungsten Graphics to develop the
initial release of the Radeon 8500 driver under the XFree86 license.
This notice must be preserved.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
*/
#ifndef __R200_VTXFMT_H__
#define __R200_VTXFMT_H__
#include "r200_context.h"
extern void r200VtxfmtUpdate( GLcontext *ctx );
extern void r200VtxfmtInit( GLcontext *ctx, GLboolean useCodegen );
extern void r200VtxfmtInvalidate( GLcontext *ctx );
extern void r200VtxfmtDestroy( GLcontext *ctx );
extern void r200VtxfmtInitChoosers( GLvertexformat *vfmt );
extern void r200VtxfmtMakeCurrent( GLcontext *ctx );
extern void r200VtxfmtUnbindContext( GLcontext *ctx );
extern void r200_copy_to_current( GLcontext *ctx );
extern void VFMT_FALLBACK( const char *caller );
#define DFN( FUNC, CACHE) \
do { \
char *start = (char *)&FUNC; \
char *end = (char *)&FUNC##_end; \
insert_at_head( &CACHE, dfn ); \
dfn->key[0] = key[0]; \
dfn->key[1] = key[1]; \
dfn->code = _mesa_exec_malloc( end - start ); \
_mesa_memcpy(dfn->code, start, end - start); \
} \
while ( 0 )
#define FIXUP( CODE, OFFSET, CHECKVAL, NEWVAL ) \
do { \
int *icode = (int *)(CODE+OFFSET); \
assert (*icode == CHECKVAL); \
*icode = (int)NEWVAL; \
} while (0)
/* Useful for figuring out the offsets:
*/
#define FIXUP2( CODE, OFFSET, CHECKVAL, NEWVAL ) \
do { \
while (*(int *)(CODE+OFFSET) != CHECKVAL) OFFSET++; \
/*fprintf(stderr, "%s/%d CVAL %x OFFSET %d VAL %x\n", __FUNCTION__,*/ \
/* __LINE__, CHECKVAL, OFFSET, (int)(NEWVAL));*/ \
*(int *)(CODE+OFFSET) = (int)(NEWVAL); \
OFFSET += 4; \
} while (0)
/*
*/
void r200InitCodegen( struct dfn_generators *gen, GLboolean useCodegen );
void r200InitX86Codegen( struct dfn_generators *gen );
void r200InitSSECodegen( struct dfn_generators *gen );
/* Defined in r200_vtxfmt_x86.c
*/
struct dynfn *r200_makeX86Vertex2f( GLcontext *, const int * );
struct dynfn *r200_makeX86Vertex2fv( GLcontext *, const int * );
struct dynfn *r200_makeX86Vertex3f( GLcontext *, const int * );
struct dynfn *r200_makeX86Vertex3fv( GLcontext *, const int * );
struct dynfn *r200_makeX86Color4ub( GLcontext *, const int * );
struct dynfn *r200_makeX86Color4ubv( GLcontext *, const int * );
struct dynfn *r200_makeX86Color3ub( GLcontext *, const int * );
struct dynfn *r200_makeX86Color3ubv( GLcontext *, const int * );
struct dynfn *r200_makeX86Color4f( GLcontext *, const int * );
struct dynfn *r200_makeX86Color4fv( GLcontext *, const int * );
struct dynfn *r200_makeX86Color3f( GLcontext *, const int * );
struct dynfn *r200_makeX86Color3fv( GLcontext *, const int * );
struct dynfn *r200_makeX86SecondaryColor3ubEXT( GLcontext *, const int * );
struct dynfn *r200_makeX86SecondaryColor3ubvEXT( GLcontext *, const int * );
struct dynfn *r200_makeX86SecondaryColor3fEXT( GLcontext *, const int * );
struct dynfn *r200_makeX86SecondaryColor3fvEXT( GLcontext *, const int * );
struct dynfn *r200_makeX86Normal3f( GLcontext *, const int * );
struct dynfn *r200_makeX86Normal3fv( GLcontext *, const int * );
struct dynfn *r200_makeX86TexCoord2f( GLcontext *, const int * );
struct dynfn *r200_makeX86TexCoord2fv( GLcontext *, const int * );
struct dynfn *r200_makeX86TexCoord1f( GLcontext *, const int * );
struct dynfn *r200_makeX86TexCoord1fv( GLcontext *, const int * );
struct dynfn *r200_makeX86MultiTexCoord2fARB( GLcontext *, const int * );
struct dynfn *r200_makeX86MultiTexCoord2fvARB( GLcontext *, const int * );
struct dynfn *r200_makeX86MultiTexCoord1fARB( GLcontext *, const int * );
struct dynfn *r200_makeX86MultiTexCoord1fvARB( GLcontext *, const int * );
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,234 +0,0 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_sse.c,v 1.1 2002/10/30 12:51:53 alanh Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
The Weather Channel (TM) funded Tungsten Graphics to develop the
initial release of the Radeon 8500 driver under the XFree86 license.
This notice must be preserved.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
*/
#include "glheader.h"
#include "imports.h"
#include "simple_list.h"
#include "r200_vtxfmt.h"
#if defined(USE_SSE_ASM)
#include "x86/common_x86_asm.h"
#define EXTERN( FUNC ) \
extern const char *FUNC; \
extern const char *FUNC##_end
EXTERN( _sse_Attribute2fv );
EXTERN( _sse_Attribute2f );
EXTERN( _sse_Attribute3fv );
EXTERN( _sse_Attribute3f );
EXTERN( _sse_MultiTexCoord2fv );
EXTERN( _sse_MultiTexCoord2f );
EXTERN( _sse_MultiTexCoord2fv_2 );
EXTERN( _sse_MultiTexCoord2f_2 );
/* Build specialized versions of the immediate calls on the fly for
* the current state.
*/
static struct dynfn *r200_makeSSEAttribute2fv( struct dynfn * cache, const int * key,
const char * name, void * dest)
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key[0] );
DFN ( _sse_Attribute2fv, (*cache) );
FIXUP(dfn->code, 10, 0x0, (int)dest);
return dfn;
}
static struct dynfn *r200_makeSSEAttribute2f( struct dynfn * cache, const int * key,
const char * name, void * dest )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key[0] );
DFN ( _sse_Attribute2f, (*cache) );
FIXUP(dfn->code, 8, 0x0, (int)dest);
return dfn;
}
static struct dynfn *r200_makeSSEAttribute3fv( struct dynfn * cache, const int * key,
const char * name, void * dest)
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key[0] );
DFN ( _sse_Attribute3fv, (*cache) );
FIXUP(dfn->code, 13, 0x0, (int)dest);
FIXUP(dfn->code, 18, 0x8, 8+(int)dest);
return dfn;
}
static struct dynfn *r200_makeSSEAttribute3f( struct dynfn * cache, const int * key,
const char * name, void * dest )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key[0] );
DFN ( _sse_Attribute3f, (*cache) );
FIXUP(dfn->code, 12, 0x0, (int)dest);
FIXUP(dfn->code, 17, 0x8, 8+(int)dest);
return dfn;
}
static struct dynfn *r200_makeSSENormal3fv( GLcontext *ctx, const int *key )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
return r200_makeSSEAttribute3fv( & rmesa->vb.dfn_cache.Normal3fv, key,
__FUNCTION__, rmesa->vb.normalptr );
}
static struct dynfn *r200_makeSSENormal3f( GLcontext *ctx, const int * key )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
return r200_makeSSEAttribute3f( & rmesa->vb.dfn_cache.Normal3f, key,
__FUNCTION__, rmesa->vb.normalptr );
}
static struct dynfn *r200_makeSSEColor3fv( GLcontext *ctx, const int * key )
{
if (VTX_COLOR(key[0],0) != R200_VTX_FP_RGB)
return NULL;
else
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
return r200_makeSSEAttribute3fv( & rmesa->vb.dfn_cache.Color3fv, key,
__FUNCTION__, rmesa->vb.floatcolorptr );
}
}
static struct dynfn *r200_makeSSEColor3f( GLcontext *ctx, const int * key )
{
if (VTX_COLOR(key[0],0) != R200_VTX_FP_RGB)
return NULL;
else
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
return r200_makeSSEAttribute3f( & rmesa->vb.dfn_cache.Color3f, key,
__FUNCTION__, rmesa->vb.floatcolorptr );
}
}
#if 0 /* Temporarily disabled as it is broken w/the new cubemap code. - idr */
static struct dynfn *r200_makeSSETexCoord2fv( GLcontext *ctx, const int * key )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
return r200_makeSSEAttribute2fv( & rmesa->vb.dfn_cache.TexCoord2fv, key,
__FUNCTION__, rmesa->vb.texcoordptr[0] );
}
static struct dynfn *r200_makeSSETexCoord2f( GLcontext *ctx, const int * key )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
return r200_makeSSEAttribute2f( & rmesa->vb.dfn_cache.TexCoord2f, key,
__FUNCTION__, rmesa->vb.texcoordptr[0] );
}
static struct dynfn *r200_makeSSEMultiTexCoord2fv( GLcontext *ctx, const int * key )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
r200ContextPtr rmesa = R200_CONTEXT(ctx);
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key[0] );
if (rmesa->vb.texcoordptr[1] == rmesa->vb.texcoordptr[0]+4) {
DFN ( _sse_MultiTexCoord2fv, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
FIXUP(dfn->code, 18, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
} else {
DFN ( _sse_MultiTexCoord2fv_2, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
FIXUP(dfn->code, 14, 0x0, (int)rmesa->vb.texcoordptr);
}
return dfn;
}
static struct dynfn *r200_makeSSEMultiTexCoord2f( GLcontext *ctx, const int * key )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
r200ContextPtr rmesa = R200_CONTEXT(ctx);
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key[0] );
if (rmesa->vb.texcoordptr[1] == rmesa->vb.texcoordptr[0]+4) {
DFN ( _sse_MultiTexCoord2f, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
FIXUP(dfn->code, 16, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
} else {
DFN ( _sse_MultiTexCoord2f_2, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
FIXUP(dfn->code, 15, 0x0, (int)rmesa->vb.texcoordptr);
}
return dfn;
}
#endif
void r200InitSSECodegen( struct dfn_generators *gen )
{
if ( cpu_has_xmm ) {
gen->Normal3fv = (void *) r200_makeSSENormal3fv;
gen->Normal3f = (void *) r200_makeSSENormal3f;
gen->Color3fv = (void *) r200_makeSSEColor3fv;
gen->Color3f = (void *) r200_makeSSEColor3f;
#if 0 /* Temporarily disabled as it is broken w/the new cubemap code. - idr */
gen->TexCoord2fv = (void *) r200_makeSSETexCoord2fv;
gen->TexCoord2f = (void *) r200_makeSSETexCoord2f;
gen->MultiTexCoord2fvARB = (void *) r200_makeSSEMultiTexCoord2fv;
gen->MultiTexCoord2fARB = (void *) r200_makeSSEMultiTexCoord2f;
#endif
}
}
#else
void r200InitSSECodegen( struct dfn_generators *gen )
{
(void) gen;
}
#endif

View file

@ -1,440 +0,0 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_x86.c,v 1.2 2002/12/16 16:18:56 dawes Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
The Weather Channel (TM) funded Tungsten Graphics to develop the
initial release of the Radeon 8500 driver under the XFree86 license.
This notice must be preserved.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
*/
#include "glheader.h"
#include "imports.h"
#include "simple_list.h"
#include "r200_vtxfmt.h"
#if defined(USE_X86_ASM)
#define EXTERN( FUNC ) \
extern const char *FUNC; \
extern const char *FUNC##_end
EXTERN ( _x86_Attribute2fv );
EXTERN ( _x86_Attribute2f );
EXTERN ( _x86_Attribute3fv );
EXTERN ( _x86_Attribute3f );
EXTERN ( _x86_Vertex3fv_6 );
EXTERN ( _x86_Vertex3fv_8 );
EXTERN ( _x86_Vertex3fv );
EXTERN ( _x86_Vertex3f_4 );
EXTERN ( _x86_Vertex3f_6 );
EXTERN ( _x86_Vertex3f );
EXTERN ( _x86_Color4ubv_ub );
EXTERN ( _x86_Color4ubv_4f );
EXTERN ( _x86_Color4ub_ub );
EXTERN ( _x86_MultiTexCoord2fv );
EXTERN ( _x86_MultiTexCoord2fv_2 );
EXTERN ( _x86_MultiTexCoord2f );
EXTERN ( _x86_MultiTexCoord2f_2 );
/* Build specialized versions of the immediate calls on the fly for
* the current state. Generic x86 versions.
*/
struct dynfn *r200_makeX86Vertex3f( GLcontext *ctx, const int *key )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x 0x%08x %d\n", __FUNCTION__,
key[0], key[1], rmesa->vb.vertex_size );
switch (rmesa->vb.vertex_size) {
case 4: {
DFN ( _x86_Vertex3f_4, rmesa->vb.dfn_cache.Vertex3f );
FIXUP(dfn->code, 2, 0x0, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 25, 0x0, (int)&rmesa->vb.vertex[3]);
FIXUP(dfn->code, 36, 0x0, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 46, 0x0, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 51, 0x0, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 60, 0x0, (int)&rmesa->vb.notify);
break;
}
case 6: {
DFN ( _x86_Vertex3f_6, rmesa->vb.dfn_cache.Vertex3f );
FIXUP(dfn->code, 3, 0x0, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 28, 0x0, (int)&rmesa->vb.vertex[3]);
FIXUP(dfn->code, 34, 0x0, (int)&rmesa->vb.vertex[4]);
FIXUP(dfn->code, 40, 0x0, (int)&rmesa->vb.vertex[5]);
FIXUP(dfn->code, 57, 0x0, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 63, 0x0, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 70, 0x0, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 79, 0x0, (int)&rmesa->vb.notify);
break;
}
default: {
DFN ( _x86_Vertex3f, rmesa->vb.dfn_cache.Vertex3f );
FIXUP(dfn->code, 3, 0x0, (int)&rmesa->vb.vertex[3]);
FIXUP(dfn->code, 9, 0x0, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 37, 0x0, rmesa->vb.vertex_size-3);
FIXUP(dfn->code, 44, 0x0, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 50, 0x0, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 56, 0x0, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 67, 0x0, (int)&rmesa->vb.notify);
break;
}
}
return dfn;
}
struct dynfn *r200_makeX86Vertex3fv( GLcontext *ctx, const int *key )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x 0x%08x %d\n", __FUNCTION__,
key[0], key[1], rmesa->vb.vertex_size );
switch (rmesa->vb.vertex_size) {
case 6: {
DFN ( _x86_Vertex3fv_6, rmesa->vb.dfn_cache.Vertex3fv );
FIXUP(dfn->code, 1, 0x00000000, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 27, 0x0000001c, (int)&rmesa->vb.vertex[3]);
FIXUP(dfn->code, 33, 0x00000020, (int)&rmesa->vb.vertex[4]);
FIXUP(dfn->code, 45, 0x00000024, (int)&rmesa->vb.vertex[5]);
FIXUP(dfn->code, 56, 0x00000000, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 61, 0x00000004, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 67, 0x00000004, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 76, 0x00000008, (int)&rmesa->vb.notify);
break;
}
case 8: {
DFN ( _x86_Vertex3fv_8, rmesa->vb.dfn_cache.Vertex3fv );
FIXUP(dfn->code, 1, 0x00000000, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 27, 0x0000001c, (int)&rmesa->vb.vertex[3]);
FIXUP(dfn->code, 33, 0x00000020, (int)&rmesa->vb.vertex[4]);
FIXUP(dfn->code, 45, 0x0000001c, (int)&rmesa->vb.vertex[5]);
FIXUP(dfn->code, 51, 0x00000020, (int)&rmesa->vb.vertex[6]);
FIXUP(dfn->code, 63, 0x00000024, (int)&rmesa->vb.vertex[7]);
FIXUP(dfn->code, 74, 0x00000000, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 79, 0x00000004, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 85, 0x00000004, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 94, 0x00000008, (int)&rmesa->vb.notify);
break;
}
default: {
DFN ( _x86_Vertex3fv, rmesa->vb.dfn_cache.Vertex3fv );
FIXUP(dfn->code, 8, 0x01010101, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 32, 0x00000006, rmesa->vb.vertex_size-3);
FIXUP(dfn->code, 37, 0x00000058, (int)&rmesa->vb.vertex[3]);
FIXUP(dfn->code, 45, 0x01010101, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 50, 0x02020202, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 58, 0x02020202, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 67, 0x0, (int)&rmesa->vb.notify);
break;
}
}
return dfn;
}
static struct dynfn *
r200_makeX86Attribute2fv( struct dynfn * cache, const int *key,
const char * name, void * dest )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key[0] );
DFN ( _x86_Attribute2fv, (*cache) );
FIXUP(dfn->code, 11, 0x0, (int)dest);
FIXUP(dfn->code, 16, 0x4, 4+(int)dest);
return dfn;
}
static struct dynfn *
r200_makeX86Attribute2f( struct dynfn * cache, const int *key,
const char * name, void * dest )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key[0] );
DFN ( _x86_Attribute2f, (*cache) );
FIXUP(dfn->code, 1, 0x0, (int)dest);
return dfn;
}
static struct dynfn *
r200_makeX86Attribute3fv( struct dynfn * cache, const int *key,
const char * name, void * dest )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key[0] );
DFN ( _x86_Attribute3fv, (*cache) );
FIXUP(dfn->code, 14, 0x0, (int)dest);
FIXUP(dfn->code, 20, 0x4, 4+(int)dest);
FIXUP(dfn->code, 25, 0x8, 8+(int)dest);
return dfn;
}
static struct dynfn *
r200_makeX86Attribute3f( struct dynfn * cache, const int *key,
const char * name, void * dest )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key[0] );
DFN ( _x86_Attribute3f, (*cache) );
FIXUP(dfn->code, 14, 0x0, (int)dest);
FIXUP(dfn->code, 20, 0x4, 4+(int)dest);
FIXUP(dfn->code, 25, 0x8, 8+(int)dest);
return dfn;
}
struct dynfn *r200_makeX86Normal3fv( GLcontext *ctx, const int *key )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
return r200_makeX86Attribute3fv( & rmesa->vb.dfn_cache.Normal3fv, key,
__FUNCTION__, rmesa->vb.normalptr );
}
struct dynfn *r200_makeX86Normal3f( GLcontext *ctx, const int *key )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
return r200_makeX86Attribute3f( & rmesa->vb.dfn_cache.Normal3f, key,
__FUNCTION__, rmesa->vb.normalptr );
}
struct dynfn *r200_makeX86Color4ubv( GLcontext *ctx, const int *key )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
r200ContextPtr rmesa = R200_CONTEXT(ctx);
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key[0] );
if (VTX_COLOR(key[0],0) == R200_VTX_PK_RGBA) {
DFN ( _x86_Color4ubv_ub, rmesa->vb.dfn_cache.Color4ubv);
FIXUP(dfn->code, 5, 0x12345678, (int)rmesa->vb.colorptr);
return dfn;
}
else {
DFN ( _x86_Color4ubv_4f, rmesa->vb.dfn_cache.Color4ubv);
FIXUP(dfn->code, 2, 0x00000000, (int)_mesa_ubyte_to_float_color_tab);
FIXUP(dfn->code, 27, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr);
FIXUP(dfn->code, 33, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr+4);
FIXUP(dfn->code, 55, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr+8);
FIXUP(dfn->code, 61, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr+12);
return dfn;
}
}
struct dynfn *r200_makeX86Color4ub( GLcontext *ctx, const int *key )
{
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key[0] );
if (VTX_COLOR(key[0],0) == R200_VTX_PK_RGBA) {
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
r200ContextPtr rmesa = R200_CONTEXT(ctx);
DFN ( _x86_Color4ub_ub, rmesa->vb.dfn_cache.Color4ub );
FIXUP(dfn->code, 18, 0x0, (int)rmesa->vb.colorptr);
FIXUP(dfn->code, 24, 0x0, (int)rmesa->vb.colorptr+1);
FIXUP(dfn->code, 30, 0x0, (int)rmesa->vb.colorptr+2);
FIXUP(dfn->code, 36, 0x0, (int)rmesa->vb.colorptr+3);
return dfn;
}
else
return NULL;
}
struct dynfn *r200_makeX86Color3fv( GLcontext *ctx, const int *key )
{
if (VTX_COLOR(key[0],0) != R200_VTX_FP_RGB)
return NULL;
else
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
return r200_makeX86Attribute3fv( & rmesa->vb.dfn_cache.Color3fv, key,
__FUNCTION__, rmesa->vb.floatcolorptr );
}
}
struct dynfn *r200_makeX86Color3f( GLcontext *ctx, const int *key )
{
if (VTX_COLOR(key[0],0) != R200_VTX_FP_RGB)
return NULL;
else
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
return r200_makeX86Attribute3f( & rmesa->vb.dfn_cache.Color3f, key,
__FUNCTION__, rmesa->vb.floatcolorptr );
}
}
#if 0 /* Temporarily disabled as it is broken w/the new cubemap code. - idr */
struct dynfn *r200_makeX86TexCoord2fv( GLcontext *ctx, const int *key )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
return r200_makeX86Attribute2fv( & rmesa->vb.dfn_cache.TexCoord2fv, key,
__FUNCTION__, rmesa->vb.texcoordptr[0] );
}
struct dynfn *r200_makeX86TexCoord2f( GLcontext *ctx, const int *key )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
return r200_makeX86Attribute2f( & rmesa->vb.dfn_cache.TexCoord2f, key,
__FUNCTION__, rmesa->vb.texcoordptr[0] );
}
struct dynfn *r200_makeX86MultiTexCoord2fvARB( GLcontext *ctx, const int *key )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
r200ContextPtr rmesa = R200_CONTEXT(ctx);
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x 0x%08x\n", __FUNCTION__, key[0], key[1] );
if (rmesa->vb.texcoordptr[1] == rmesa->vb.texcoordptr[0]+4) {
DFN ( _x86_MultiTexCoord2fv, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
FIXUP(dfn->code, 21, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
FIXUP(dfn->code, 27, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]+4);
} else {
DFN ( _x86_MultiTexCoord2fv_2, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
FIXUP(dfn->code, 14, 0x0, (int)rmesa->vb.texcoordptr);
}
return dfn;
}
struct dynfn *r200_makeX86MultiTexCoord2fARB( GLcontext *ctx,
const int *key )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
r200ContextPtr rmesa = R200_CONTEXT(ctx);
if (R200_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x 0x%08x\n", __FUNCTION__, key[0], key[1] );
if (rmesa->vb.texcoordptr[1] == rmesa->vb.texcoordptr[0]+4) {
DFN ( _x86_MultiTexCoord2f, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
FIXUP(dfn->code, 20, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
FIXUP(dfn->code, 26, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]+4);
}
else {
/* Note: this might get generated multiple times, even though the
* actual emitted code is the same.
*/
DFN ( _x86_MultiTexCoord2f_2, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
FIXUP(dfn->code, 18, 0x0, (int)rmesa->vb.texcoordptr);
}
return dfn;
}
#endif
void r200InitX86Codegen( struct dfn_generators *gen )
{
gen->Vertex3f = r200_makeX86Vertex3f;
gen->Vertex3fv = r200_makeX86Vertex3fv;
gen->Color4ub = r200_makeX86Color4ub; /* PKCOLOR only */
gen->Color4ubv = r200_makeX86Color4ubv; /* PKCOLOR only */
gen->Normal3f = r200_makeX86Normal3f;
gen->Normal3fv = r200_makeX86Normal3fv;
#if 0 /* Temporarily disabled as it is broken w/the new cubemap code. - idr */
gen->TexCoord2f = r200_makeX86TexCoord2f;
gen->TexCoord2fv = r200_makeX86TexCoord2fv;
gen->MultiTexCoord2fARB = r200_makeX86MultiTexCoord2fARB;
gen->MultiTexCoord2fvARB = r200_makeX86MultiTexCoord2fvARB;
#endif
gen->Color3f = r200_makeX86Color3f;
gen->Color3fv = r200_makeX86Color3fv;
/* Not done:
*/
/* gen->Vertex2f = r200_makeX86Vertex2f; */
/* gen->Vertex2fv = r200_makeX86Vertex2fv; */
/* gen->Color3ub = r200_makeX86Color3ub; */
/* gen->Color3ubv = r200_makeX86Color3ubv; */
/* gen->Color4f = r200_makeX86Color4f; */
/* gen->Color4fv = r200_makeX86Color4fv; */
/* gen->TexCoord1f = r200_makeX86TexCoord1f; */
/* gen->TexCoord1fv = r200_makeX86TexCoord1fv; */
/* gen->MultiTexCoord1fARB = r200_makeX86MultiTexCoord1fARB; */
/* gen->MultiTexCoord1fvARB = r200_makeX86MultiTexCoord1fvARB; */
}
#else
void r200InitX86Codegen( struct dfn_generators *gen )
{
(void) gen;
}
#endif

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

File diff suppressed because it is too large Load diff

View file

@ -1,120 +0,0 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.h,v 1.3 2002/12/21 17:02:16 dawes Exp $ */
/**************************************************************************
Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
Tungsten Graphics Inc., Cedar Park, Texas.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
*/
#ifndef __RADEON_VTXFMT_H__
#define __RADEON_VTXFMT_H__
#include "radeon_context.h"
extern void radeonVtxfmtUpdate( GLcontext *ctx );
extern void radeonVtxfmtInit( GLcontext *ctx, GLboolean useCodegen );
extern void radeonVtxfmtInvalidate( GLcontext *ctx );
extern void radeonVtxfmtDestroy( GLcontext *ctx );
extern void radeonVtxfmtInitChoosers( GLvertexformat *vfmt );
extern void radeonVtxfmtMakeCurrent( GLcontext *ctx );
extern void radeonVtxfmtUnbindContext( GLcontext *ctx );
extern void radeon_copy_to_current( GLcontext *ctx );
#define DFN( FUNC, CACHE) \
do { \
char *start = (char *)&FUNC; \
char *end = (char *)&FUNC##_end; \
insert_at_head( &CACHE, dfn ); \
dfn->key = key; \
dfn->code = _mesa_exec_malloc( end - start ); \
_mesa_memcpy(dfn->code, start, end - start); \
} \
while ( 0 )
#define FIXUP( CODE, OFFSET, CHECKVAL, NEWVAL ) \
do { \
int *icode = (int *)(CODE+OFFSET); \
assert (*icode == CHECKVAL); \
*icode = (int)NEWVAL; \
} while (0)
/* Useful for figuring out the offsets:
*/
#define FIXUP2( CODE, OFFSET, CHECKVAL, NEWVAL ) \
do { \
while (*(int *)(CODE+OFFSET) != CHECKVAL) OFFSET++; \
fprintf(stderr, "%s/%d CVAL %x OFFSET %d VAL %x\n", __FUNCTION__, \
__LINE__, CHECKVAL, OFFSET, (int)(NEWVAL)); \
*(int *)(CODE+OFFSET) = (int)(NEWVAL); \
OFFSET += 4; \
} while (0)
/*
*/
void radeonInitCodegen( struct dfn_generators *gen, GLboolean useCodegen );
void radeonInitX86Codegen( struct dfn_generators *gen );
void radeonInitSSECodegen( struct dfn_generators *gen );
/* Defined in radeon_vtxfmt_x86.c
*/
struct dynfn *radeon_makeX86Vertex2f( GLcontext *, int );
struct dynfn *radeon_makeX86Vertex2fv( GLcontext *, int );
struct dynfn *radeon_makeX86Vertex3f( GLcontext *, int );
struct dynfn *radeon_makeX86Vertex3fv( GLcontext *, int );
struct dynfn *radeon_makeX86Color4ub( GLcontext *, int );
struct dynfn *radeon_makeX86Color4ubv( GLcontext *, int );
struct dynfn *radeon_makeX86Color3ub( GLcontext *, int );
struct dynfn *radeon_makeX86Color3ubv( GLcontext *, int );
struct dynfn *radeon_makeX86Color4f( GLcontext *, int );
struct dynfn *radeon_makeX86Color4fv( GLcontext *, int );
struct dynfn *radeon_makeX86Color3f( GLcontext *, int );
struct dynfn *radeon_makeX86Color3fv( GLcontext *, int );
struct dynfn *radeon_makeX86SecondaryColor3ubEXT( GLcontext *, int );
struct dynfn *radeon_makeX86SecondaryColor3ubvEXT( GLcontext *, int );
struct dynfn *radeon_makeX86SecondaryColor3fEXT( GLcontext *, int );
struct dynfn *radeon_makeX86SecondaryColor3fvEXT( GLcontext *, int );
struct dynfn *radeon_makeX86Normal3f( GLcontext *, int );
struct dynfn *radeon_makeX86Normal3fv( GLcontext *, int );
struct dynfn *radeon_makeX86TexCoord2f( GLcontext *, int );
struct dynfn *radeon_makeX86TexCoord2fv( GLcontext *, int );
struct dynfn *radeon_makeX86TexCoord1f( GLcontext *, int );
struct dynfn *radeon_makeX86TexCoord1fv( GLcontext *, int );
struct dynfn *radeon_makeX86MultiTexCoord2fARB( GLcontext *, int );
struct dynfn *radeon_makeX86MultiTexCoord2fvARB( GLcontext *, int );
struct dynfn *radeon_makeX86MultiTexCoord1fARB( GLcontext *, int );
struct dynfn *radeon_makeX86MultiTexCoord1fvARB( GLcontext *, int );
#endif

View file

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

View file

@ -1,236 +0,0 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_sse.c,v 1.1 2002/10/30 12:51:58 alanh Exp $ */
/**************************************************************************
Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
Tungsten Graphics Inc., Cedar Park, Texas.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
*/
#include "glheader.h"
#include "imports.h"
#include "simple_list.h"
#include "radeon_vtxfmt.h"
#if defined(USE_SSE_ASM)
#include "x86/common_x86_asm.h"
#define EXTERN( FUNC ) \
extern const char *FUNC; \
extern const char *FUNC##_end
EXTERN( _sse_Attribute2fv );
EXTERN( _sse_Attribute2f );
EXTERN( _sse_Attribute3fv );
EXTERN( _sse_Attribute3f );
EXTERN( _sse_MultiTexCoord2fv );
EXTERN( _sse_MultiTexCoord2f );
EXTERN( _sse_MultiTexCoord2fv_2 );
EXTERN( _sse_MultiTexCoord2f_2 );
/* Build specialized versions of the immediate calls on the fly for
* the current state.
*/
static struct dynfn *radeon_makeSSEAttribute2fv( struct dynfn * cache, int key,
const char * name, void * dest)
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key );
DFN ( _sse_Attribute2fv, (*cache) );
FIXUP(dfn->code, 10, 0x0, (int)dest);
return dfn;
}
static struct dynfn *radeon_makeSSEAttribute2f( struct dynfn * cache, int key,
const char * name, void * dest )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key );
DFN ( _sse_Attribute2f, (*cache) );
FIXUP(dfn->code, 8, 0x0, (int)dest);
return dfn;
}
static struct dynfn *radeon_makeSSEAttribute3fv( struct dynfn * cache, int key,
const char * name, void * dest)
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key );
DFN ( _sse_Attribute3fv, (*cache) );
FIXUP(dfn->code, 13, 0x0, (int)dest);
FIXUP(dfn->code, 18, 0x8, 8+(int)dest);
return dfn;
}
static struct dynfn *radeon_makeSSEAttribute3f( struct dynfn * cache, int key,
const char * name, void * dest )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key );
DFN ( _sse_Attribute3f, (*cache) );
FIXUP(dfn->code, 12, 0x0, (int)dest);
FIXUP(dfn->code, 17, 0x8, 8+(int)dest);
return dfn;
}
static struct dynfn * radeon_makeSSENormal3fv( GLcontext *ctx, int key )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
return radeon_makeSSEAttribute3fv( & rmesa->vb.dfn_cache.Normal3fv, key,
__FUNCTION__, rmesa->vb.normalptr );
}
static struct dynfn *radeon_makeSSENormal3f( GLcontext *ctx, int key )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
return radeon_makeSSEAttribute3f( & rmesa->vb.dfn_cache.Normal3f, key,
__FUNCTION__, rmesa->vb.normalptr );
}
static struct dynfn *radeon_makeSSEColor3fv( GLcontext *ctx, int key )
{
if (key & (RADEON_CP_VC_FRMT_PKCOLOR|RADEON_CP_VC_FRMT_FPALPHA))
return NULL;
else
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
return radeon_makeSSEAttribute3fv( & rmesa->vb.dfn_cache.Color3fv, key,
__FUNCTION__, rmesa->vb.floatcolorptr );
}
}
static struct dynfn *radeon_makeSSEColor3f( GLcontext *ctx, int key )
{
if (key & (RADEON_CP_VC_FRMT_PKCOLOR|RADEON_CP_VC_FRMT_FPALPHA))
return NULL;
else
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
return radeon_makeSSEAttribute3f( & rmesa->vb.dfn_cache.Color3f, key,
__FUNCTION__, rmesa->vb.floatcolorptr );
}
}
static struct dynfn *radeon_makeSSETexCoord2fv( GLcontext *ctx, int key )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
return radeon_makeSSEAttribute2fv( & rmesa->vb.dfn_cache.TexCoord2fv, key,
__FUNCTION__, rmesa->vb.texcoordptr[0] );
}
static struct dynfn *radeon_makeSSETexCoord2f( GLcontext *ctx, int key )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
return radeon_makeSSEAttribute2f( & rmesa->vb.dfn_cache.TexCoord2f, key,
__FUNCTION__, rmesa->vb.texcoordptr[0] );
}
#if 0 /* Temporarily disabled - probably needs adjustments for more than 2 tex units -rs */
static struct dynfn *radeon_makeSSEMultiTexCoord2fv( GLcontext *ctx, int key )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key );
if ((key & (RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) ==
(RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) {
DFN ( _sse_MultiTexCoord2fv, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
FIXUP(dfn->code, 18, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
} else {
DFN ( _sse_MultiTexCoord2fv_2, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
FIXUP(dfn->code, 14, 0x0, (int)rmesa->vb.texcoordptr);
}
return dfn;
}
static struct dynfn *radeon_makeSSEMultiTexCoord2f( GLcontext *ctx, int key )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key );
if ((key & (RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) ==
(RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) {
DFN ( _sse_MultiTexCoord2f, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
FIXUP(dfn->code, 16, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
} else {
DFN ( _sse_MultiTexCoord2f_2, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
FIXUP(dfn->code, 15, 0x0, (int)rmesa->vb.texcoordptr);
}
return dfn;
}
#endif
void radeonInitSSECodegen( struct dfn_generators *gen )
{
if ( cpu_has_xmm ) {
gen->Normal3fv = (void *) radeon_makeSSENormal3fv;
gen->Normal3f = (void *) radeon_makeSSENormal3f;
gen->Color3fv = (void *) radeon_makeSSEColor3fv;
gen->Color3f = (void *) radeon_makeSSEColor3f;
gen->TexCoord2fv = (void *) radeon_makeSSETexCoord2fv;
gen->TexCoord2f = (void *) radeon_makeSSETexCoord2f;
#if 0 /* Temporarily disabled - probably needs adjustments for more than 2 tex units -rs */
gen->MultiTexCoord2fvARB = (void *) radeon_makeSSEMultiTexCoord2fv;
gen->MultiTexCoord2fARB = (void *) radeon_makeSSEMultiTexCoord2f;
#endif
}
}
#else
void radeonInitSSECodegen( struct dfn_generators *gen )
{
(void) gen;
}
#endif

View file

@ -1,440 +0,0 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_x86.c,v 1.2 2002/12/21 17:02:16 dawes Exp $ */
/**************************************************************************
Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
Tungsten Graphics Inc., Cedar Park, Texas.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
*/
#include "glheader.h"
#include "imports.h"
#include "simple_list.h"
#include "radeon_vtxfmt.h"
#if defined(USE_X86_ASM)
#define EXTERN( FUNC ) \
extern const char *FUNC; \
extern const char *FUNC##_end
EXTERN ( _x86_Attribute2fv );
EXTERN ( _x86_Attribute2f );
EXTERN ( _x86_Attribute3fv );
EXTERN ( _x86_Attribute3f );
EXTERN ( _x86_Vertex3fv_6 );
EXTERN ( _x86_Vertex3fv_8 );
EXTERN ( _x86_Vertex3fv );
EXTERN ( _x86_Vertex3f_4 );
EXTERN ( _x86_Vertex3f_6 );
EXTERN ( _x86_Vertex3f );
EXTERN ( _x86_Color4ubv_ub );
EXTERN ( _x86_Color4ubv_4f );
EXTERN ( _x86_Color4ub_ub );
EXTERN ( _x86_MultiTexCoord2fv );
EXTERN ( _x86_MultiTexCoord2fv_2 );
EXTERN ( _x86_MultiTexCoord2f );
EXTERN ( _x86_MultiTexCoord2f_2 );
/* Build specialized versions of the immediate calls on the fly for
* the current state. Generic x86 versions.
*/
struct dynfn *radeon_makeX86Vertex3f( GLcontext *ctx, int key )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x %d\n", __FUNCTION__, key, rmesa->vb.vertex_size );
switch (rmesa->vb.vertex_size) {
case 4: {
DFN ( _x86_Vertex3f_4, rmesa->vb.dfn_cache.Vertex3f );
FIXUP(dfn->code, 2, 0x0, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 25, 0x0, (int)&rmesa->vb.vertex[3]);
FIXUP(dfn->code, 36, 0x0, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 46, 0x0, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 51, 0x0, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 60, 0x0, (int)&rmesa->vb.notify);
break;
}
case 6: {
DFN ( _x86_Vertex3f_6, rmesa->vb.dfn_cache.Vertex3f );
FIXUP(dfn->code, 3, 0x0, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 28, 0x0, (int)&rmesa->vb.vertex[3]);
FIXUP(dfn->code, 34, 0x0, (int)&rmesa->vb.vertex[4]);
FIXUP(dfn->code, 40, 0x0, (int)&rmesa->vb.vertex[5]);
FIXUP(dfn->code, 57, 0x0, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 63, 0x0, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 70, 0x0, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 79, 0x0, (int)&rmesa->vb.notify);
break;
}
default: {
DFN ( _x86_Vertex3f, rmesa->vb.dfn_cache.Vertex3f );
FIXUP(dfn->code, 3, 0x0, (int)&rmesa->vb.vertex[3]);
FIXUP(dfn->code, 9, 0x0, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 37, 0x0, rmesa->vb.vertex_size-3);
FIXUP(dfn->code, 44, 0x0, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 50, 0x0, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 56, 0x0, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 67, 0x0, (int)&rmesa->vb.notify);
break;
}
}
return dfn;
}
struct dynfn *radeon_makeX86Vertex3fv( GLcontext *ctx, int key )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x %d\n", __FUNCTION__, key, rmesa->vb.vertex_size );
switch (rmesa->vb.vertex_size) {
case 6: {
DFN ( _x86_Vertex3fv_6, rmesa->vb.dfn_cache.Vertex3fv );
FIXUP(dfn->code, 1, 0x00000000, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 27, 0x0000001c, (int)&rmesa->vb.vertex[3]);
FIXUP(dfn->code, 33, 0x00000020, (int)&rmesa->vb.vertex[4]);
FIXUP(dfn->code, 45, 0x00000024, (int)&rmesa->vb.vertex[5]);
FIXUP(dfn->code, 56, 0x00000000, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 61, 0x00000004, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 67, 0x00000004, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 76, 0x00000008, (int)&rmesa->vb.notify);
break;
}
case 8: {
DFN ( _x86_Vertex3fv_8, rmesa->vb.dfn_cache.Vertex3fv );
FIXUP(dfn->code, 1, 0x00000000, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 27, 0x0000001c, (int)&rmesa->vb.vertex[3]);
FIXUP(dfn->code, 33, 0x00000020, (int)&rmesa->vb.vertex[4]);
FIXUP(dfn->code, 45, 0x0000001c, (int)&rmesa->vb.vertex[5]);
FIXUP(dfn->code, 51, 0x00000020, (int)&rmesa->vb.vertex[6]);
FIXUP(dfn->code, 63, 0x00000024, (int)&rmesa->vb.vertex[7]);
FIXUP(dfn->code, 74, 0x00000000, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 79, 0x00000004, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 85, 0x00000004, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 94, 0x00000008, (int)&rmesa->vb.notify);
break;
}
default: {
DFN ( _x86_Vertex3fv, rmesa->vb.dfn_cache.Vertex3fv );
FIXUP(dfn->code, 8, 0x01010101, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 32, 0x00000006, rmesa->vb.vertex_size-3);
FIXUP(dfn->code, 37, 0x00000058, (int)&rmesa->vb.vertex[3]);
FIXUP(dfn->code, 45, 0x01010101, (int)&rmesa->vb.dmaptr);
FIXUP(dfn->code, 50, 0x02020202, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 58, 0x02020202, (int)&rmesa->vb.counter);
FIXUP(dfn->code, 67, 0x0, (int)&rmesa->vb.notify);
break;
}
}
return dfn;
}
static struct dynfn *
radeon_makeX86Attribute2fv( struct dynfn * cache, int key,
const char * name, void * dest )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key );
DFN ( _x86_Attribute2fv, (*cache) );
FIXUP(dfn->code, 11, 0x0, (int)dest);
FIXUP(dfn->code, 16, 0x4, 4+(int)dest);
return dfn;
}
static struct dynfn *
radeon_makeX86Attribute2f( struct dynfn * cache, int key,
const char * name, void * dest )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key );
DFN ( _x86_Attribute2f, (*cache) );
FIXUP(dfn->code, 1, 0x0, (int)dest);
return dfn;
}
static struct dynfn *
radeon_makeX86Attribute3fv( struct dynfn * cache, int key,
const char * name, void * dest )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key );
DFN ( _x86_Attribute3fv, (*cache) );
FIXUP(dfn->code, 14, 0x0, (int)dest);
FIXUP(dfn->code, 20, 0x4, 4+(int)dest);
FIXUP(dfn->code, 25, 0x8, 8+(int)dest);
return dfn;
}
static struct dynfn *
radeon_makeX86Attribute3f( struct dynfn * cache, int key,
const char * name, void * dest )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", name, key );
DFN ( _x86_Attribute3f, (*cache) );
FIXUP(dfn->code, 14, 0x0, (int)dest);
FIXUP(dfn->code, 20, 0x4, 4+(int)dest);
FIXUP(dfn->code, 25, 0x8, 8+(int)dest);
return dfn;
}
struct dynfn *radeon_makeX86Normal3fv( GLcontext *ctx, int key )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
return radeon_makeX86Attribute3fv( & rmesa->vb.dfn_cache.Normal3fv, key,
__FUNCTION__, rmesa->vb.normalptr );
}
struct dynfn *radeon_makeX86Normal3f( GLcontext *ctx, int key )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
return radeon_makeX86Attribute3f( & rmesa->vb.dfn_cache.Normal3f, key,
__FUNCTION__, rmesa->vb.normalptr );
}
struct dynfn *radeon_makeX86Color4ubv( GLcontext *ctx, int key )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key );
if (key & RADEON_CP_VC_FRMT_PKCOLOR) {
DFN ( _x86_Color4ubv_ub, rmesa->vb.dfn_cache.Color4ubv);
FIXUP(dfn->code, 5, 0x12345678, (int)rmesa->vb.colorptr);
return dfn;
}
else {
DFN ( _x86_Color4ubv_4f, rmesa->vb.dfn_cache.Color4ubv);
FIXUP(dfn->code, 2, 0x00000000, (int)_mesa_ubyte_to_float_color_tab);
FIXUP(dfn->code, 27, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr);
FIXUP(dfn->code, 33, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr+4);
FIXUP(dfn->code, 55, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr+8);
FIXUP(dfn->code, 61, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr+12);
return dfn;
}
}
struct dynfn *radeon_makeX86Color4ub( GLcontext *ctx, int key )
{
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key );
if (key & RADEON_CP_VC_FRMT_PKCOLOR) {
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
DFN ( _x86_Color4ub_ub, rmesa->vb.dfn_cache.Color4ub );
FIXUP(dfn->code, 18, 0x0, (int)rmesa->vb.colorptr);
FIXUP(dfn->code, 24, 0x0, (int)rmesa->vb.colorptr+1);
FIXUP(dfn->code, 30, 0x0, (int)rmesa->vb.colorptr+2);
FIXUP(dfn->code, 36, 0x0, (int)rmesa->vb.colorptr+3);
return dfn;
}
else
return NULL;
}
struct dynfn *radeon_makeX86Color3fv( GLcontext *ctx, int key )
{
if (key & (RADEON_CP_VC_FRMT_PKCOLOR|RADEON_CP_VC_FRMT_FPALPHA))
return NULL;
else
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
return radeon_makeX86Attribute3fv( & rmesa->vb.dfn_cache.Color3fv, key,
__FUNCTION__, rmesa->vb.floatcolorptr );
}
}
struct dynfn *radeon_makeX86Color3f( GLcontext *ctx, int key )
{
if (key & (RADEON_CP_VC_FRMT_PKCOLOR|RADEON_CP_VC_FRMT_FPALPHA))
return NULL;
else
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
return radeon_makeX86Attribute3f( & rmesa->vb.dfn_cache.Color3f, key,
__FUNCTION__, rmesa->vb.floatcolorptr );
}
}
struct dynfn *radeon_makeX86TexCoord2fv( GLcontext *ctx, int key )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
return radeon_makeX86Attribute2fv( & rmesa->vb.dfn_cache.TexCoord2fv, key,
__FUNCTION__, rmesa->vb.texcoordptr[0] );
}
struct dynfn *radeon_makeX86TexCoord2f( GLcontext *ctx, int key )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
return radeon_makeX86Attribute2f( & rmesa->vb.dfn_cache.TexCoord2f, key,
__FUNCTION__, rmesa->vb.texcoordptr[0] );
}
#if 0 /* Temporarily disabled - probably needs adjustments for more than 2 tex units -rs */
struct dynfn *radeon_makeX86MultiTexCoord2fvARB( GLcontext *ctx, int key )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key );
if ((key & (RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) ==
(RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) {
DFN ( _x86_MultiTexCoord2fv, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
FIXUP(dfn->code, 21, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
FIXUP(dfn->code, 27, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]+4);
} else {
DFN ( _x86_MultiTexCoord2fv_2, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
FIXUP(dfn->code, 14, 0x0, (int)rmesa->vb.texcoordptr);
}
return dfn;
}
struct dynfn *radeon_makeX86MultiTexCoord2fARB( GLcontext *ctx,
int key )
{
struct dynfn *dfn = MALLOC_STRUCT( dynfn );
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
if (RADEON_DEBUG & DEBUG_CODEGEN)
fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key );
if ((key & (RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) ==
(RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) {
DFN ( _x86_MultiTexCoord2f, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
FIXUP(dfn->code, 20, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
FIXUP(dfn->code, 26, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]+4);
}
else {
/* Note: this might get generated multiple times, even though the
* actual emitted code is the same.
*/
DFN ( _x86_MultiTexCoord2f_2, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
FIXUP(dfn->code, 18, 0x0, (int)rmesa->vb.texcoordptr);
}
return dfn;
}
#endif
void radeonInitX86Codegen( struct dfn_generators *gen )
{
gen->Vertex3f = radeon_makeX86Vertex3f;
gen->Vertex3fv = radeon_makeX86Vertex3fv;
gen->Color4ub = radeon_makeX86Color4ub; /* PKCOLOR only */
gen->Color4ubv = radeon_makeX86Color4ubv; /* PKCOLOR only */
gen->Normal3f = radeon_makeX86Normal3f;
gen->Normal3fv = radeon_makeX86Normal3fv;
gen->TexCoord2f = radeon_makeX86TexCoord2f;
gen->TexCoord2fv = radeon_makeX86TexCoord2fv;
#if 0 /* Temporarily disabled - probably needs adjustments for more than 2 tex units -rs */
gen->MultiTexCoord2fARB = radeon_makeX86MultiTexCoord2fARB;
gen->MultiTexCoord2fvARB = radeon_makeX86MultiTexCoord2fvARB;
#endif
gen->Color3f = radeon_makeX86Color3f;
gen->Color3fv = radeon_makeX86Color3fv;
/* Not done:
*/
/* gen->Vertex2f = radeon_makeX86Vertex2f; */
/* gen->Vertex2fv = radeon_makeX86Vertex2fv; */
/* gen->Color3ub = radeon_makeX86Color3ub; */
/* gen->Color3ubv = radeon_makeX86Color3ubv; */
/* gen->Color4f = radeon_makeX86Color4f; */
/* gen->Color4fv = radeon_makeX86Color4fv; */
/* gen->TexCoord1f = radeon_makeX86TexCoord1f; */
/* gen->TexCoord1fv = radeon_makeX86TexCoord1fv; */
/* gen->MultiTexCoord1fARB = radeon_makeX86MultiTexCoord1fARB; */
/* gen->MultiTexCoord1fvARB = radeon_makeX86MultiTexCoord1fvARB; */
}
#else
void radeonInitX86Codegen( struct dfn_generators *gen )
{
(void) gen;
}
#endif

View file

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