]> icculus.org git repositories - btb/d2x.git/blob - unused/pa_null/poly_acc.c
cruft removal
[btb/d2x.git] / unused / pa_null / poly_acc.c
1 /*
2 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
3 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
4 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
5 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
6 IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
7 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
8 FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
9 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
10 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.  
11 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
12 */
13
14 char poly_acc_rcsid[] = "$Id: poly_acc.c,v 1.1.1.1 2001-01-19 03:30:14 bradleyb Exp $";
15 static unsigned poly_count;
16
17 //
18 //                                                         Includes
19 //
20 #include <math.h>
21 #include <limits.h>
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <string.h>
25
26 #include "pa_enabl.h"        // needs to occur early.
27
28 #if defined(POLY_ACC)
29
30 #include "pstypes.h"
31 #include "fix.h"
32 #include "3d.h"
33 #include "gr.h"
34 #include "grdef.h"
35 #include "texmap.h"
36 #include "mono.h"
37 #include "debug.h"
38 #include "error.h"
39 #include "poly_acc.h"
40
41 //
42 //                                                          Defines
43 //
44 #define TEX_SIZE        64
45 #define TEX_CACHE       (64)
46 #define CHROMA_COLOR    0x0001
47 #define MODE_110        S3DTK_MODE640x480x15           // 640x480x15
48 #define DMA_SIZE        1024
49 #define DMA_VERT_WORDS  (sizeof(S3DTK_VERTEX_TEX) / sizeof(unsigned long))
50 #define NDL             5               // stolen from main/game.h. how many filter levels there are.
51
52 enum { OP_TMAP, OP_FLAT, OP_BLIT, OP_BLIT_TRANSPARENT, OP_BLIT_SCALE };
53
54 //
55 //                                                           Variables
56 //
57 extern ubyte scale_rle_data[1024];      // from 2d\scale.c
58 unsigned short pa_clut[256];            // translate from 8 bit pixels to 15 bit pixels.
59 static short pa_clut_save_buf[256];     // used to save/restore the clut.
60 int pa_filter_mode = NDL-1;             //  For Virge filtering control, set in Custom Detail Level menu.
61
62
63 static pa_initted = 0;
64 static pa_card_initted = 0;     //$$hack, library doesn't seem to correctly init card twice.
65 static ULONG old_mode;
66
67 /* S3D Toolkit function list */
68 static S3DTK_LPFUNCTIONLIST pS3DTK_Funct;
69 static S3DTK_VERTEX_TEX verts[MAX_TMAP_VERTS];
70 static S3DTK_LPVERTEX_TEX trifan[MAX_TMAP_VERTS];
71
72 /* buffer definitions */
73 static int backBuffer = 1;                    /* index of back buffer                          */
74 static S3DTK_SURFACE displaySurf[2];          /* one for front buffer and one for back buffer  */
75 static S3DTK_RECTAREA fullScreenRect = { 0, 0, 640, 480 };
76
77 /* physical properties */
78 static ULONG screenFormat = S3DTK_VIDEORGB15;   /* format of the surface as defined in S3DTK.H */
79 static float width=640, height=480;             /* screen's dimension                          */
80
81 // memory manager variables.
82 static ULONG totalMemory;                  /* frame buffer size                           */
83 static ULONG memoryUsed;                   /* frame buffer allocated                      */
84 static char *frameBuffer;                  /* linear address of frame buffer starts at    */
85
86 // cache variables.
87 static S3DTK_SURFACE cache_slots[TEX_CACHE];
88 static struct
89 {
90     uint tag;
91     uint age;
92 } cache_tags[TEX_CACHE];
93 static int cache_age = 0;
94
95 // dma vars.
96 static unsigned long dma_buf[DMA_SIZE];     // simulated dma ring buffer.
97 static int dma_head, dma_tail;              // head and tail of ring buffer.
98 static op_extra_words[] =                   // how many extra words are needed besides the vertex info
99 { 7, 5, 10, 11, 5 };                        // plus 1. avoids (head == tail) == (tail == head).
100 static filter_tmap[] = {
101     S3DTK_TEX1TPP, S3DTK_TEXM1TPP, S3DTK_TEX4TPP, S3DTK_TEX4TPP, S3DTK_TEXM4TPP
102 };
103 static filter_scale[] = {
104     S3DTK_TEX1TPP, S3DTK_TEX4TPP, S3DTK_TEX4TPP, S3DTK_TEX4TPP, S3DTK_TEX4TPP
105 };
106 static filter_robot[] = {       // actually how to filter non-perspective triangles.
107     S3DTK_TEX1TPP, S3DTK_TEXM1TPP, S3DTK_TEXM1TPP, S3DTK_TEX4TPP, S3DTK_TEXM4TPP
108 };
109
110 // misc
111 static int pa_3d_x_off = 0, pa_3d_y_off = 0;
112
113 // local prototypes.
114 static int pa_cache_search(grs_bitmap *bp);
115 static BOOL allocSurf(S3DTK_SURFACE *surf, ULONG width, ULONG height, ULONG bpp, ULONG format);
116 extern uint texmerge_get_unique_id( grs_bitmap * bmp );
117 extern void decode_row(grs_bitmap * bmp, int y);
118 static unsigned get_pow2(unsigned wh);
119 static unsigned long dma_get(void);
120 static void dma_put(unsigned long d);
121 static int dma_space(void);
122 static int CheckForSpecificCard(void);
123
124 //
125 //                                                           Routines
126 //
127 int pa_init(void)                       // init library.
128 {
129 }
130
131 void pa_reset(void)                         // cleans up library.
132 {
133 }
134
135 int pa_detect(int mode)                 // detect card and whether mode is supported.
136 {
137 }
138
139 void pa_set_mode(int mode)           // sets display mode if valid PA mode.
140 {
141 }
142
143 // type 0==0..63, 1==0..255.
144 void pa_update_clut(unsigned char *pal, int start, int count, int type)
145 {
146 }
147
148 void pa_save_clut(void)
149 {
150 }
151
152 void pa_restore_clut(void)
153 {
154 }
155
156 void pa_step_up(int r, int g, int b)
157 {
158 }
159
160 // get the address of a card's framebuffer and lock it in.
161 void *pa_get_buffer_address(int which)
162 {
163 }
164
165 void pa_clear_buffer(int buffer, ushort color)
166 {
167 }
168
169
170 void pa_set_3d_offset(int x, int y)     // where on screen the triangles should be drawn.
171 {
172 }
173
174 void pa_draw_tmap(grs_bitmap * srcb, g3ds_tmap * tmap, int transparency_on, int lighting_on, int perspective, fix min_z)
175 {
176 }
177
178 void pa_draw_flat(g3ds_tmap *tmap, int color, int alpha)
179 {
180 }
181
182 //
183 //  perform a blit using hw if screen to screen, otherwise copy mem to mem.
184 //
185 void pa_blit(grs_bitmap *dst, int dx, int dy, grs_bitmap *src, int sx, int sy, int w, int h)
186 {
187 }
188
189 //
190 //  perform a transparent blit using hw if screen to screen, otherwise copy mem to mem.
191 //
192 void pa_blit_transparent(grs_bitmap *dst, int dx, int dy, grs_bitmap *src, int sx, int sy, int w, int h)
193 {
194 }
195
196 //
197 //  performs 2d scaling by applying a bitmap to a 3D sqaure and using the texture mapper to draw it.
198 //  NOTE:Only support RLE bitmaps.
199 //
200 void pa_blit_scale(grs_bitmap *source_bmp, grs_bitmap *dest_bmp,
201     int x0, int y0, int x1, int y1,
202     fix u0, fix v0,  fix u1, fix v1, int orient
203 )
204 {
205 }
206
207 int pa_blit_lit(grs_bitmap *dst, int dx, int dy, grs_bitmap *src, int sx, int sy, int w, int h)
208 {
209 }
210
211 int pa_rect(int sx, int sy, int ex, int ey)
212 {
213 }
214
215 void pa_swap_buffer(void)
216 {
217 }
218
219 #pragma off (unreferenced)
220 void pa_ibitblt(void *src, void *dst, void *mask)
221 #pragma on (unreferenced)
222 {
223 }
224
225 //
226 //    Allocate space for TEX_CACHE textures on the 3D card.
227 //
228 void pa_init_cache(void)
229 {
230 }
231
232 //
233 //  implements a primitive LRU to keep from destroying active textures. Primitive because it uses
234 //  an array search to find the oldest element.
235 //
236 static int pa_cache_search(grs_bitmap *bmp)
237 {
238 }
239
240 /***************************************************************************
241  *
242  *  Memory management routines
243  *
244  ***************************************************************************/
245 static BOOL initMemoryBuffer(void)
246 {
247 }
248
249 static void allocInit(S3DTK_LPFUNCTIONLIST pS3DTK_Funct)
250 {
251 }
252
253 static BOOL allocSurf(S3DTK_SURFACE *surf, ULONG width, ULONG height, ULONG bpp, ULONG format)
254 {
255 }
256
257 /* convert width/height to power of 2; if power of 2, return it. Else
258    subtract 1 from next higher power of 2 */
259 static unsigned get_pow2(unsigned wh)
260 {
261 }
262
263 int pa_dma_poll(void)
264 {
265 }
266
267 static unsigned long dma_get(void)
268 {
269 }
270
271 static void dma_put(unsigned long d)
272 {
273 }
274
275 // return number of free entries in dma_buf
276 static int dma_space(void)
277 {
278 }
279
280 static void dma_add_verts(int nv)
281 {
282 }
283
284 static void dma_get_verts(void)
285 {
286 }
287
288 // see's if a command of 'type' is in dma buffer. Intended use is to serialize access to scale sprite buffer.
289 static int op_pending(int type)
290 {
291 }
292
293 //
294 //  waits for current async op to complete.
295 //
296 static pa_idle_cnt[2];      //$$
297 int pa_idle(void)
298 {
299 }
300
301 void pa_sync(void)
302 {
303 }
304
305 void pa_flush(void)
306 {
307 }
308
309 //used in Rendition version, but not in S3 version
310 void pa_about_to_flip()
311 {
312 }
313
314 // used by 3Dfx
315 void pa_set_write_mode (int mode)
316 {
317 }
318
319 // used by 3Dfx
320 void pa_set_frontbuffer_current(void)
321 {
322 }
323
324 #endif      // defined POLY_ACC
325