⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 t_vtx_x86_gcc.s

📁 winNT技术操作系统,国外开放的原代码和LIUX一样
💻 S
📖 第 1 页 / 共 2 页
字号:
/* Unfortunately, have to play with the stack in the non-fv case:
 */
#if !defined (STDCALL_API)
GLOBL( _tnl_x86_dispatch_attrf1 )
GLOBL( _tnl_x86_dispatch_attrf2 )
GLOBL( _tnl_x86_dispatch_attrf3 )
GLOBL( _tnl_x86_dispatch_attrf4 )
	subl	$12, %esp	/* gcc does 16 byte alignment of stack frames? */
	leal	16(%esp), %edx	/* address of first float on stack */
	movl	%edx, (%esp)	/* save as 'v' */
	call	*SUBST(0)	/* 0x0 --> tabfv[attr][n] */
	addl	$12, %esp	/* tear down frame */
	ret			/* return */
GLOBL( _tnl_x86_dispatch_attrf4_end )
GLOBL( _tnl_x86_dispatch_attrf3_end )
GLOBL( _tnl_x86_dispatch_attrf2_end )
GLOBL( _tnl_x86_dispatch_attrf1_end )

#else  /* defined(STDCALL_API) */

GLOBL( _tnl_x86_dispatch_attrf1 )
	subl	$12, %esp	/* gcc does 16 byte alignment of stack frames? */
	leal	16(%esp), %edx	/* address of first float on stack */
	movl	%edx, (%esp)	/* save as 'v' */
	call	*SUBST(0)	/* 0x0 --> tabfv[attr][n] */
	addl	$8, %esp	/* tear down frame (4 shaved off by the callee) */
	ret	$4		/* return */
GLOBL( _tnl_x86_dispatch_attrf1_end )

GLOBL( _tnl_x86_dispatch_attrf2 )
	subl	$12, %esp	/* gcc does 16 byte alignment of stack frames? */
	leal	16(%esp), %edx	/* address of first float on stack */
	movl	%edx, (%esp)	/* save as 'v' */
	call	*SUBST(0)	/* 0x0 --> tabfv[attr][n] */
	addl	$8, %esp	/* tear down frame (4 shaved off by the callee) */
	ret	$8		/* return */
GLOBL( _tnl_x86_dispatch_attrf2_end )

GLOBL( _tnl_x86_dispatch_attrf3 )
	subl	$12, %esp	/* gcc does 16 byte alignment of stack frames? */
	leal	16(%esp), %edx	/* address of first float on stack */
	movl	%edx, (%esp)	/* save as 'v' */
	call	*SUBST(0)	/* 0x0 --> tabfv[attr][n] */
	addl	$8, %esp	/* tear down frame (4 shaved off by the callee) */
	ret	$12		/* return */
GLOBL( _tnl_x86_dispatch_attrf3_end )

GLOBL( _tnl_x86_dispatch_attrf4 )
	subl	$12, %esp	/* gcc does 16 byte alignment of stack frames? */
	leal	16(%esp), %edx	/* address of first float on stack */
	movl	%edx, (%esp)	/* save as 'v' */
	call	*SUBST(0)	/* 0x0 --> tabfv[attr][n] */
	addl	$8, %esp	/* tear down frame (4 shaved off by the callee) */
	ret	$16		/* return */
GLOBL( _tnl_x86_dispatch_attrf4_end )
#endif /* defined(STDCALL_API) */

/* The fv case is simpler:
 */
GLOBL( _tnl_x86_dispatch_attrfv )
	jmp	*SUBST(0)	/* 0x0 --> tabfv[attr][n] */
GLOBL( _tnl_x86_dispatch_attrfv_end )


/* MultiTexcoord: the address of the function pointer must be
 * calculated, but can use the index argument slot to hold 'v', and
 * avoid setting up a new stack frame.
 *
 * [dBorca]
 * right, this would be the preferred approach, but gcc does not
 * clean up the stack after each function call when optimizing (-fdefer-pop);
 * can it make assumptions about what's already on the stack?  I dunno,
 * but in this case, we can't mess with the caller's stack frame, and
 * we must use a model like `_x86_dispatch_attrfv' above.  Caveat emptor!
 */

/* Also, will only need a maximum of four of each of these per context:
 */
#if !defined (STDCALL_API)
GLOBL( _tnl_x86_dispatch_multitexcoordf1 )
GLOBL( _tnl_x86_dispatch_multitexcoordf2 )
GLOBL( _tnl_x86_dispatch_multitexcoordf3 )
GLOBL( _tnl_x86_dispatch_multitexcoordf4 )
	movl	4(%esp), %ecx
	leal	8(%esp), %edx
	andl	$7, %ecx
	movl	%edx, 4(%esp)
	sall	$4, %ecx
	jmp	*SUBST(0)(%ecx)	/* 0x0 - tabfv[tex0][n] */
GLOBL( _tnl_x86_dispatch_multitexcoordf4_end )
GLOBL( _tnl_x86_dispatch_multitexcoordf3_end )
GLOBL( _tnl_x86_dispatch_multitexcoordf2_end )
GLOBL( _tnl_x86_dispatch_multitexcoordf1_end )

GLOBL( _tnl_x86_dispatch_multitexcoordfv )
	movl	4(%esp), %ecx
	movl	8(%esp), %edx
	andl	$7, %ecx
	movl	%edx, 4(%esp)
	sall	$4, %ecx
	jmp	*SUBST(0)(%ecx)	/* 0x0 - tabfv[tex0][n] */
GLOBL( _tnl_x86_dispatch_multitexcoordfv_end )

#else  /* defined (STDCALL_API) */

GLOBL( _tnl_x86_dispatch_multitexcoordf1 )
	subl	$12, %esp	/* gcc does 16 byte alignment of stack frames? */
	movl	16(%esp), %ecx
	leal	20(%esp), %edx
	andl	$7, %ecx
	movl	%edx, (%esp)
	sall	$4, %ecx
	call	*SUBST(0)(%ecx)	/* 0x0 - tabfv[tex0][n] */
	addl	$8, %esp	/* tear down frame (4 shaved off by the callee) */
	ret	$8		/* return */
GLOBL( _tnl_x86_dispatch_multitexcoordf1_end )

GLOBL( _tnl_x86_dispatch_multitexcoordf2 )
	subl	$12, %esp	/* gcc does 16 byte alignment of stack frames? */
	movl	16(%esp), %ecx
	leal	20(%esp), %edx
	andl	$7, %ecx
	movl	%edx, (%esp)
	sall	$4, %ecx
	call	*SUBST(0)(%ecx)	/* 0x0 - tabfv[tex0][n] */
	addl	$8, %esp	/* tear down frame (4 shaved off by the callee) */
	ret	$12		/* return */
GLOBL( _tnl_x86_dispatch_multitexcoordf2_end )

GLOBL( _tnl_x86_dispatch_multitexcoordf3 )
	subl	$12, %esp	/* gcc does 16 byte alignment of stack frames? */
	movl	16(%esp), %ecx
	leal	20(%esp), %edx
	andl	$7, %ecx
	movl	%edx, (%esp)
	sall	$4, %ecx
	call	*SUBST(0)(%ecx)	/* 0x0 - tabfv[tex0][n] */
	addl	$8, %esp	/* tear down frame (4 shaved off by the callee) */
	ret	$16		/* return */
GLOBL( _tnl_x86_dispatch_multitexcoordf3_end )

GLOBL( _tnl_x86_dispatch_multitexcoordf4 )
	subl	$12, %esp	/* gcc does 16 byte alignment of stack frames? */
	movl	16(%esp), %ecx
	leal	20(%esp), %edx
	andl	$7, %ecx
	movl	%edx, (%esp)
	sall	$4, %ecx
	call	*SUBST(0)(%ecx)	/* 0x0 - tabfv[tex0][n] */
	addl	$8, %esp	/* tear down frame (4 shaved off by the callee) */
	ret	$20		/* return */
GLOBL( _tnl_x86_dispatch_multitexcoordf4_end )

GLOBL( _tnl_x86_dispatch_multitexcoordfv )
	subl	$12, %esp	/* gcc does 16 byte alignment of stack frames? */
	movl	16(%esp), %ecx
	movl	20(%esp), %edx
	andl	$7, %ecx
	movl	%edx, (%esp)
	sall	$4, %ecx
	call	*SUBST(0)(%ecx)	/* 0x0 - tabfv[tex0][n] */
	addl	$8, %esp	/* tear down frame (4 shaved off by the callee) */
	ret	$8		/* return */
GLOBL( _tnl_x86_dispatch_multitexcoordfv_end )
#endif /* defined (STDCALL_API) */


/* VertexAttrib: the address of the function pointer must be
 * calculated.
 */
#if !defined (STDCALL_API)
GLOBL( _tnl_x86_dispatch_vertexattribf1 )
GLOBL( _tnl_x86_dispatch_vertexattribf2 )
GLOBL( _tnl_x86_dispatch_vertexattribf3 )
GLOBL( _tnl_x86_dispatch_vertexattribf4 )
	movl	4(%esp), %eax
	cmpl	$16, %eax
	jb	.8		/* "cmovge" is not supported on all CPUs */
	movl	$16, %eax
.8:
	leal	8(%esp), %ecx	/* calculate 'v' */
	movl	%ecx, 4(%esp)	/* save in 1st arg slot */
	sall	$4, %eax
	jmp	*SUBST(0)(%eax)	/* 0x0 - tabfv[0][n] */
GLOBL( _tnl_x86_dispatch_vertexattribf4_end )
GLOBL( _tnl_x86_dispatch_vertexattribf3_end )
GLOBL( _tnl_x86_dispatch_vertexattribf2_end )
GLOBL( _tnl_x86_dispatch_vertexattribf1_end )

GLOBL( _tnl_x86_dispatch_vertexattribfv )
	movl	4(%esp), %eax
	cmpl	$16, %eax
	jb	.9		/* "cmovge" is not supported on all CPUs */
	movl	$16, %eax
.9:
	movl	8(%esp), %ecx	/* load 'v' */
	movl	%ecx, 4(%esp)	/* save in 1st arg slot */
	sall	$4, %eax
	jmp	*SUBST(0)(%eax)	/* 0x0 - tabfv[0][n] */
GLOBL( _tnl_x86_dispatch_vertexattribfv_end )

#else  /* defined (STDCALL_API) */

GLOBL( _tnl_x86_dispatch_vertexattribf1 )
	subl	$12, %esp	/* gcc does 16 byte alignment of stack frames? */
	movl	16(%esp), %eax
	cmpl	$16, %eax
	jb	.81		/* "cmovge" is not supported on all CPUs */
	movl	$16, %eax
.81:
	leal	20(%esp), %ecx	/* load 'v' */
	movl	%ecx, (%esp)	/* save in 1st arg slot */
	sall	$4, %eax
	call	*SUBST(0)(%eax)	/* 0x0 - tabfv[0][n] */
	addl	$8, %esp	/* tear down frame (4 shaved off by the callee) */
	ret	$8		/* return */
GLOBL( _tnl_x86_dispatch_vertexattribf1_end )

GLOBL( _tnl_x86_dispatch_vertexattribf2 )
	subl	$12, %esp	/* gcc does 16 byte alignment of stack frames? */
	movl	16(%esp), %eax
	cmpl	$16, %eax
	jb	.82		/* "cmovge" is not supported on all CPUs */
	movl	$16, %eax
.82:
	leal	20(%esp), %ecx	/* load 'v' */
	movl	%ecx, (%esp)	/* save in 1st arg slot */
	sall	$4, %eax
	call	*SUBST(0)(%eax)	/* 0x0 - tabfv[0][n] */
	addl	$8, %esp	/* tear down frame (4 shaved off by the callee) */
	ret	$12		/* return */
GLOBL( _tnl_x86_dispatch_vertexattribf2_end )

GLOBL( _tnl_x86_dispatch_vertexattribf3 )
	subl	$12, %esp	/* gcc does 16 byte alignment of stack frames? */
	movl	16(%esp), %eax
	cmpl	$16, %eax
	jb	.83		/* "cmovge" is not supported on all CPUs */
	movl	$16, %eax
.83:
	leal	20(%esp), %ecx	/* load 'v' */
	movl	%ecx, (%esp)	/* save in 1st arg slot */
	sall	$4, %eax
	call	*SUBST(0)(%eax)	/* 0x0 - tabfv[0][n] */
	addl	$8, %esp	/* tear down frame (4 shaved off by the callee) */
	ret	$16		/* return */
GLOBL( _tnl_x86_dispatch_vertexattribf3_end )

GLOBL( _tnl_x86_dispatch_vertexattribf4 )
	subl	$12, %esp	/* gcc does 16 byte alignment of stack frames? */
	movl	16(%esp), %eax
	cmpl	$16, %eax
	jb	.84		/* "cmovge" is not supported on all CPUs */
	movl	$16, %eax
.84:
	leal	20(%esp), %ecx	/* load 'v' */
	movl	%ecx, (%esp)	/* save in 1st arg slot */
	sall	$4, %eax
	call	*SUBST(0)(%eax)	/* 0x0 - tabfv[0][n] */
	addl	$8, %esp	/* tear down frame (4 shaved off by the callee) */
	ret	$20		/* return */
GLOBL( _tnl_x86_dispatch_vertexattribf4_end )

GLOBL( _tnl_x86_dispatch_vertexattribfv )
	subl	$12, %esp	/* gcc does 16 byte alignment of stack frames? */
	movl	16(%esp), %eax
	cmpl	$16, %eax
	jb	.9		/* "cmovge" is not supported on all CPUs */
	movl	$16, %eax
.9:
	movl	20(%esp), %ecx	/* load 'v' */
	movl	%ecx, (%esp)	/* save in 1st arg slot */
	sall	$4, %eax
	call	*SUBST(0)(%eax)	/* 0x0 - tabfv[0][n] */
	addl	$8, %esp	/* tear down frame (4 shaved off by the callee) */
	ret	$8		/* return */
GLOBL( _tnl_x86_dispatch_vertexattribfv_end )
#endif /* defined (STDCALL_API) */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -