source: branches/swt/src/opengl/mesa/3dfx/fxstripdet.c

Last change on this file was 3598, checked in by jeroen, 26 years ago

* empty log message *

File size: 8.2 KB
Line 
1/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
2
3/*
4 * Mesa 3-D graphics library
5 * Version: 3.3
6 *
7 * Copyright (C) 1999 Brian Paul All Rights Reserved.
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 *
27 * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
28 * terms stated above.
29 *
30 * Thank you for your contribution, David!
31 *
32 * Please make note of the above copyright/license statement. If you
33 * contributed code or bug fixes to this code under the previous (GNU
34 * Library) license and object to the new license, your code will be
35 * removed at your request. Please see the Mesa docs/COPYRIGHT file
36 * for more information.
37 *
38 * Additional Mesa/3Dfx driver developers:
39 * Daryll Strauss <daryll@precisioninsight.com>
40 * Keith Whitwell <keith@precisioninsight.com>
41 *
42 * See fxapi.h for more revision/author details.
43 */
44
45
46#ifdef HAVE_CONFIG_H
47#include "conf.h"
48#endif
49#if defined(FX) && defined(FX_GLIDE3)
50
51#include "fxdrv.h"
52#include "vbcull.h"
53
54
55#define STRIP0(u,v) ((u1 == v1) && (u2 == v0))
56#define STRIP1(u,v) ((u0 == v0) && (u2 == v1))
57
58#define LOCAL_VARS fxVertex* gWin = FX_DRIVER_DATA(VB)->verts; \
59 GrVertex** sb = FX_DRIVER_DATA(VB)->strips_b;
60
61#define STRIPSLOCAL_VAR int sc = 0;
62
63#define INIT(a)
64
65#define SENDTRI(u0,u1,u2) FX_grDrawTriangle((GrVertex*)&(gWin[u0].f),(GrVertex*)&(gWin[u1].f),(GrVertex*)&(gWin[u2].f))
66#define FLUSHTRI() /* No-Op */
67#define STARTSTRIPS(u0,u1,u2) { sb[sc++] = (GrVertex*)&(gWin[u0].f); sb[sc++] = (GrVertex*)&(gWin[u1].f); sb[sc++] = (GrVertex*)&(gWin[u2].f); }
68#define SENDSTRIPS(v2) { sb[sc++] = (GrVertex*)&(gWin[v2].f); }
69#define FLUSHSTRIPS() FX_grDrawVertexArray(GR_TRIANGLE_STRIP,sc,sb)
70
71#define CLIPPED(a,b,c) 0
72#define CULLED(a,b,c) 0
73#define SENDCLIPTRI(a,b,c) /* NoOp */
74
75#define TAG(x) x##_fx
76
77#include "fxsdettmp.h"
78
79
80/* Clipped but no userclip */
81#define STRIP0(u,v) ((u1 == v1) && (u2 == v0)) && !clipmask[v2]
82#define STRIP1(u,v) ((u0 == v0) && (u2 == v1)) && !clipmask[v2]
83
84#define LOCAL_VARS fxVertex* gWin = FX_DRIVER_DATA(VB)->verts; \
85 GrVertex** sb = FX_DRIVER_DATA(VB)->strips_b; \
86 const GLubyte *const clipmask = VB->ClipMask; \
87 const fxMesaContext fxMesa=(fxMesaContext)VB->ctx->DriverCtx; \
88 const tfxTriClipFunc cliptri = fxMesa->clip_tri_stride;
89
90#define STRIPSLOCAL_VAR int sc = 0;
91
92#define INIT(a)
93
94#define SENDTRI(u0,u1,u2) FX_grDrawTriangle((GrVertex*)&(gWin[u0].f),(GrVertex*)&(gWin[u1].f),(GrVertex*)&(gWin[u2].f))
95#define FLUSHTRI() /* No-Op */
96#define STARTSTRIPS(u0,u1,u2) { sb[sc++] = (GrVertex*)&(gWin[u0].f); sb[sc++] = (GrVertex*)&(gWin[u1].f); sb[sc++] = (GrVertex*)&(gWin[u2].f); }
97#define SENDSTRIPS(v2) { sb[sc++] = (GrVertex*)&(gWin[v2].f); }
98#define FLUSHSTRIPS() FX_grDrawVertexArray(GR_TRIANGLE_STRIP,sc,sb)
99
100#define CLIPPED(u0,u1,u2) (clipmask[u0] | clipmask[u1] | clipmask[u2])
101#define CULLED(u0,u1,u2) (clipmask[u0] & clipmask[u1] & clipmask[u2])
102#define SENDCLIPTRI(u0,u1,u2) { \
103 GLuint vl[3]; \
104 ASSIGN_3V(vl, u0, u1, u2 ); \
105 cliptri(VB,vl,clipmask[u0] | clipmask[u1] | clipmask[u2]); \
106 }
107
108#define TAG(x) x##_fx_view_clipped
109
110#include "fxsdettmp.h"
111
112/* Clipped and might be userclip */
113#define STRIP0(u,v) ((u1 == v1) && (u2 == v0)) && !clipmask[v2]
114#define STRIP1(u,v) ((u0 == v0) && (u2 == v1)) && !clipmask[v2]
115
116#define LOCAL_VARS fxVertex* gWin = FX_DRIVER_DATA(VB)->verts; \
117 GrVertex** sb = FX_DRIVER_DATA(VB)->strips_b; \
118 const GLubyte *const clipmask = VB->ClipMask; \
119 const GLubyte *userclipmask = VB->UserClipMask; \
120 const fxMesaContext fxMesa=(fxMesaContext)VB->ctx->DriverCtx; \
121 const tfxTriClipFunc cliptri = fxMesa->clip_tri_stride;
122
123#define STRIPSLOCAL_VAR int sc = 0;
124
125#define INIT(a)
126
127#define SENDTRI(u0,u1,u2) FX_grDrawTriangle((GrVertex*)&(gWin[u0].f),(GrVertex*)&(gWin[u1].f),(GrVertex*)&(gWin[u2].f))
128#define FLUSHTRI() /* No-Op */
129#define STARTSTRIPS(u0,u1,u2) { sb[sc++] = (GrVertex*)&(gWin[u0].f); sb[sc++] = (GrVertex*)&(gWin[u1].f); sb[sc++] = (GrVertex*)&(gWin[u2].f); }
130#define SENDSTRIPS(v2) { sb[sc++] = (GrVertex*)&(gWin[v2].f); }
131#define FLUSHSTRIPS() FX_grDrawVertexArray(GR_TRIANGLE_STRIP,sc,sb)
132
133#define CLIPPED(u0,u1,u2) (clipmask[u0] | clipmask[u1] | clipmask[u2])
134#define CULLED(u0,u1,u2) (clipmask[u0] & clipmask[u1] & clipmask[u2] & CLIP_ALL_BITS)
135#define SENDCLIPTRI(u0,u1,u2) { \
136 GLuint vl[3]; \
137 GLuint imask = (clipmask[u0] | clipmask[u1] | clipmask[u2]); \
138 \
139 if (imask & CLIP_USER_BIT) { \
140 if (!(userclipmask[u2] & userclipmask[u1] & userclipmask[u0])) \
141 { ASSIGN_3V(vl, u2, u1, u0 ); \
142 imask |= (userclipmask[u2] | userclipmask[u1] | userclipmask[u0]) << 8; \
143 cliptri( VB, vl, imask );} \
144 } \
145 else { ASSIGN_3V(vl, u2, u1, u0 ); \
146 cliptri( VB, vl, imask ); } \
147 }
148
149#define TAG(x) x##_fx_clipped
150
151#include "fxsdettmp.h"
152
153
154void fxDDRenderInitGlide3(GLcontext *ctx)
155{
156#if 0
157 render_tab_fx_smooth_indirect[GL_TRIANGLES] = render_vb_triangles_smooth_indirect_sd_fx;
158 render_tab_fx_smooth_indirect_view_clipped[GL_TRIANGLES] = render_vb_triangles_smooth_indirect_sd_fx_view_clipped;
159 render_tab_fx_smooth_indirect_clipped[GL_TRIANGLES] = render_vb_triangles_smooth_indirect_sd_fx_clipped;
160#endif
161}
162
163
164#endif /* defined(FX) && FX_GLIDE3 */
Note: See TracBrowser for help on using the repository browser.