
; Storm C Compiler
; Work2:Mesa3/Mesa-3.0/src/polygon.c
	mc68030
	mc68881
	XREF	_gl_pack_polygon_stipple
	XREF	_gl_error
	XREF	_q_memcpy
	XREF	_CC

	SECTION "_gl_CullFace:0",CODE


;void gl_CullFace( GLcontext *ctx, GLenum mode )
	XDEF	_gl_CullFace
_gl_CullFace
	move.l	$8(a7),d0
	move.l	4(a7),a0
L18
;   if (mode!=GL_FRONT && mode!=GL_BACK && mode!=GL_FRONT_AND_BACK)
	cmp.l	#$404,d0
	beq.b	L22
L19
	cmp.l	#$405,d0
	beq.b	L22
L20
	cmp.l	#$408,d0
	beq.b	L22
L21
;      gl_error( ctx, GL_INVALID_ENUM, "glCullFace" );
	move.l	#L17,-(a7)
	pea	$500.w
	move.l	a0,-(a7)
	jsr	_gl_error
	add.w	#$C,a7
	rts
L22
;   if (INSIDE_BEGIN_END(ctx)) 
	move.l	a0,a1
	add.l	#$E968,a1
	move.l	(a1),d1
	cmp.l	#$1A00,d1
	beq.b	L24
L23
;      gl_error( ctx, GL_INVALID_OPERATION, "glCullFace" );
	move.l	#L17,-(a7)
	pea	$502.w
	move.l	a0,-(a7)
	jsr	_gl_error
	add.w	#$C,a7
	rts
L24
;   ctx->Polygon.CullFaceMode = mode;
	move.l	a0,a1
	add.l	#$DDFC,a1
	move.l	d0,(a1)
;   ctx->NewState |= NEW_POLYGON;
	move.l	a0,a1
	add.l	#$E960,a1
	move.l	(a1),d0
	or.l	#$8,d0
	add.l	#$E960,a0
	move.l	d0,(a0)
	rts

L17
	dc.b	'glCullFace',0

	SECTION "_gl_FrontFace:0",CODE

	rts

;void gl_FrontFace( GLcontext *ctx, GLenum mode )
	XDEF	_gl_FrontFace
_gl_FrontFace
	move.l	$8(a7),d0
	move.l	4(a7),a0
L26
;   if (INSIDE_BEGIN_END(ctx)) 
	move.l	a0,a1
	add.l	#$E968,a1
	move.l	(a1),d1
	cmp.l	#$1A00,d1
	beq.b	L28
L27
;      gl_error( ctx, GL_INVALID_OPERATION, "glFrontFace" );
	move.l	#L25,-(a7)
	pea	$502.w
	move.l	a0,-(a7)
	jsr	_gl_error
	add.w	#$C,a7
	rts
L28
;   if (mode!=GL_CW && mode!=GL_CCW) 
	cmp.l	#$900,d0
	beq.b	L31
L29
	cmp.l	#$901,d0
	beq.b	L31
L30
;      gl_error( ctx, GL_INVALID_ENUM, "glFrontFace" );
	move.l	#L25,-(a7)
	pea	$500.w
	move.l	a0,-(a7)
	jsr	_gl_error
	add.w	#$C,a7
	rts
L31
;   ctx->Polygon.FrontFace = mode;
	add.l	#$DDEE,a0
	move.l	d0,(a0)
	rts

L25
	dc.b	'glFrontFace',0

	SECTION "_gl_PolygonMode:0",CODE


;void gl_PolygonMode( GLcontext *ctx, GLenum face, GLenum mode )
	XDEF	_gl_PolygonMode
_gl_PolygonMode
	move.l	d2,-(a7)
	movem.l	$C(a7),d0/d1
	move.l	$8(a7),a0
L35
;   if (INSIDE_BEGIN_END(ctx)) 
	move.l	a0,a1
	add.l	#$E968,a1
	move.l	(a1),d2
	cmp.l	#$1A00,d2
	beq.b	L37
L36
;      gl_error( ctx, GL_INVALID_OPERATION, "glPolygonMode" );
	move.l	#L32,-(a7)
	pea	$502.w
	move.l	a0,-(a7)
	jsr	_gl_error
	add.w	#$C,a7
	move.l	(a7)+,d2
	rts
L37
;   if (face!=GL_FRONT && face!=GL_BACK && face!=GL_FRONT_AND_BACK)
	cmp.l	#$404,d0
	beq.b	L41
L38
	cmp.l	#$405,d0
	beq.b	L41
L39
	cmp.l	#$408,d0
	beq.b	L41
L40
;      gl_error( ctx, GL_INVALID_ENUM, "glPolygonMode(face)" );
	move.l	#L33,-(a7)
	pea	$500.w
	move.l	a0,-(a7)
	jsr	_gl_error
	add.w	#$C,a7
	move.l	(a7)+,d2
	rts
L41
;   else if (mode!=GL_POINT && mode!=GL_LINE && mode!=GL_FILL)
	cmp.l	#$1B00,d1
	beq.b	L45
L42
	cmp.l	#$1B01,d1
	beq.b	L45
L43
	cmp.l	#$1B02,d1
	beq.b	L45
L44
;      gl_error( ctx, GL_INVALID_ENUM, "glPolygonMode(mode)" );
	move.l	#L34,-(a7)
	pea	$500.w
	move.l	a0,-(a7)
	jsr	_gl_error
	add.w	#$C,a7
	move.l	(a7)+,d2
	rts
L45
;   if (face==GL_FRONT || face==GL_FRONT_AND_BACK) 
	cmp.l	#$404,d0
	beq.b	L47
L46
	cmp.l	#$408,d0
	bne.b	L48
L47
;      ctx->Polygon.FrontMode = mode;
	move.l	a0,a1
	add.l	#$DDF2,a1
	move.l	d1,(a1)
L48
;   if (face==GL_BACK || face==GL_FRONT_AND_BACK) 
	cmp.l	#$405,d0
	beq.b	L50
L49
	cmp.l	#$408,d0
	bne.b	L51
L50
;      ctx->Polygon.BackMode = mode;
	move.l	a0,a1
	add.l	#$DDF6,a1
	move.l	d1,(a1)
L51
;   if (ctx->Polygon.FrontMode!=GL_FILL || ctx->Polygon.BackMode!=
	move.l	a0,a1
	add.l	#$DDEE,a1
	move.l	4(a1),d0
	cmp.l	#$1B02,d0
	bne.b	L53
L52
	move.l	a0,a1
	add.l	#$DDEE,a1
	move.l	$8(a1),d0
	cmp.l	#$1B02,d0
	beq.b	L54
L53
;      ctx->Polygon.Unfilled = GL_TRUE;
	move.l	a0,a1
	add.l	#$DDFA,a1
	move.b	#1,(a1)
	bra.b	L55
L54
;      ctx->Polygon.Unfilled = GL_FALSE;
	move.l	a0,a1
	add.l	#$DDFA,a1
	clr.b	(a1)
L55
;   ctx->NewState |= NEW_POLYGON;
	move.l	a0,a1
	add.l	#$E960,a1
	move.l	(a1),d0
	or.l	#$8,d0
	add.l	#$E960,a0
	move.l	d0,(a0)
	move.l	(a7)+,d2
	rts

L32
	dc.b	'glPolygonMode',0
L33
	dc.b	'glPolygonMode(face)',0
L34
	dc.b	'glPolygonMode(mode)',0

	SECTION "_gl_PolygonStipple:0",CODE


;void gl_PolygonStipple( GLcontext *ctx, const GLuint pattern[32] )
	XDEF	_gl_PolygonStipple
_gl_PolygonStipple
	move.l	a2,-(a7)
	move.l	$C(a7),a0
	move.l	$8(a7),a2
L57
;   if (INSIDE_BEGIN_END(ctx)) 
	move.l	a2,a1
	add.l	#$E968,a1
	move.l	(a1),d0
	cmp.l	#$1A00,d0
	beq.b	L59
L58
;      gl_error( ctx, GL_INVALID_OPERATION, "glPolygonStipple" )
	move.l	#L56,-(a7)
	pea	$502.w
	move.l	a2,-(a7)
	jsr	_gl_error
	add.w	#$C,a7
	move.l	(a7)+,a2
	rts
L59
;   MEMCPY( ctx->Poly
	pea	$80.w
	move.l	a0,-(a7)
	move.l	a2,a0
	add.l	#$DE12,a0
	pea	(a0)
	jsr	_q_memcpy
	add.w	#$C,a7
;   if (ctx->Polygon.StippleFlag) 
	move.l	a2,a0
	add.l	#$DDEE,a0
	tst.b	$17(a0)
	beq.b	L61
L60
;      ctx->NewState |= NEW_RASTER_OPS;
	move.l	a2,a0
	add.l	#$E960,a0
	move.l	(a0),d0
	or.l	#2,d0
	move.l	a2,a0
	add.l	#$E960,a0
	move.l	d0,(a0)
L61
	move.l	(a7)+,a2
	rts

L56
	dc.b	'glPolygonStipple',0

	SECTION "_gl_GetPolygonStipple:0",CODE


;void gl_GetPolygonStipple( GLcontext *ctx, GLubyte *dest )
	XDEF	_gl_GetPolygonStipple
_gl_GetPolygonStipple
	move.l	a2,-(a7)
	movem.l	$8(a7),a0/a1
L63
;   if (INSIDE_BEGIN_END(ctx)) 
	move.l	a0,a2
	add.l	#$E968,a2
	move.l	(a2),d0
	cmp.l	#$1A00,d0
	beq.b	L65
L64
;      gl_error( ctx, GL_INVALID_OPERATION, "glPolygonOffset" );
	move.l	#L62,-(a7)
	pea	$502.w
	move.l	a0,-(a7)
	jsr	_gl_error
	add.w	#$C,a7
	move.l	(a7)+,a2
	rts
L65
;   gl_pack_polygon_stipple( ctx, ctx->PolygonStipple, dest );
	move.l	a1,-(a7)
	move.l	a0,a1
	add.l	#$DE12,a1
	pea	(a1)
	move.l	a0,-(a7)
	jsr	_gl_pack_polygon_stipple
	add.w	#$C,a7
	move.l	(a7)+,a2
	rts

L62
	dc.b	'glPolygonOffset',0

	SECTION "_gl_PolygonOffset:0",CODE


;void gl_PolygonOffset( GLcontext *ctx,
	XDEF	_gl_PolygonOffset
_gl_PolygonOffset
	move.l	4(a7),a0
	fmove.s	$C(a7),fp0
	fmove.s	$8(a7),fp1
L67
;   if (INSIDE_BEGIN_END(ctx)) 
	move.l	a0,a1
	add.l	#$E968,a1
	move.l	(a1),d0
	cmp.l	#$1A00,d0
	beq.b	L69
L68
;      gl_error( ctx, GL_INVALID_OPERATION, "glPolygonOffset" );
	move.l	#L66,-(a7)
	pea	$502.w
	move.l	a0,-(a7)
	jsr	_gl_error
	add.w	#$C,a7
	rts
L69
;   ctx->Polygon.OffsetFactor = factor;
	move.l	a0,a1
	add.l	#$DE06,a1
	fmove.s	fp1,(a1)
;   ctx->Polygon.OffsetUnits = units;
	add.l	#$DE0A,a0
	fmove.s	fp0,(a0)
	rts

L66
	dc.b	'glPolygonOffset',0

	END
