KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
pvr.h
Go to the documentation of this file.
1/* KallistiOS ##version##
2
3 dc/pvr.h
4 Copyright (C) 2002 Megan Potter
5 Copyright (C) 2014 Lawrence Sebald
6 Copyright (C) 2023 Ruslan Rostovtsev
7
8 Low-level PVR 3D interface for the DC
9*/
10
11/** \file dc/pvr.h
12 \brief Low-level PVR (3D hardware) interface.
13 \ingroup pvr
14
15 This file provides support for using the PVR 3D hardware in the Dreamcast.
16 Note that this does not handle any sort of perspective transformations or
17 anything of the like. This is just a very thin wrapper around the actual
18 hardware support.
19
20 This file is used for pretty much everything related to the PVR, from memory
21 management to actual primitive rendering.
22
23 \note
24 This API does \a not handle any sort of transformations
25 (including perspective!) so for that, you should look to KGL.
26
27 \author Megan Potter
28 \author Roger Cattermole
29 \author Paul Boese
30 \author Brian Paul
31 \author Lawrence Sebald
32 \author Benoit Miller
33 \author Ruslan Rostovtsev
34*/
35
36#ifndef __DC_PVR_H
37#define __DC_PVR_H
38
39#include <sys/cdefs.h>
40__BEGIN_DECLS
41
42#include <stdalign.h>
43#include <stdbool.h>
44
45#include <arch/memory.h>
46#include <arch/types.h>
47#include <arch/cache.h>
48#include <dc/sq.h>
49#include <dc/pvr_dma.h>
50#include <kos/img.h>
51#include <kos/regfield.h>
52
53/** \defgroup pvr PowerVR API
54 \brief Low-level PowerVR GPU Driver.
55 \ingroup video
56*/
57
58/* Data types ********************************************************/
59
60/** \brief PVR texture memory pointer.
61 \ingroup pvr_vram
62
63 Unlike the old "TA" system, PVR pointers in the new system are actually SH-4
64 compatible pointers and can be used directly in place of ta_txr_map().
65
66 Not that anyone probably even remembers the old TA system anymore...
67*/
68typedef void *pvr_ptr_t;
69
70/** \defgroup pvr_lists Polygon Lists
71 \brief Types pertaining to PVR list types: opaque, pt, tr, etc
72 \ingroup pvr
73*/
74
75/** \brief PVR list specification.
76 \ingroup pvr_lists
77
78 Each primitive in the PVR is submitted to one of the hardware primitive
79 lists. This type is an identifier for a list.
80
81 \see pvr_lists
82*/
83typedef uint32_t pvr_list_t;
84
85/** \defgroup pvr_geometry Geometry
86 \brief PVR API for managing scene geometry
87 \ingroup pvr
88*/
89
90/** \defgroup pvr_primitives Primitives
91 \brief Polygon and sprite management
92 \ingroup pvr_geometry
93*/
94
95/** \defgroup pvr_ctx Contexts
96 \brief User-friendly intermittent primitive representation
97 \ingroup pvr_primitives
98*/
99
100/** \brief PVR polygon context.
101 \ingroup pvr_ctx
102
103 You should use this more human readable format for specifying your polygon
104 contexts, and then compile them into polygon headers when you are ready to
105 start using them.
106
107 This has embedded structures in it for two reasons; the first reason is to
108 make it easier for me to add new stuff later without breaking existing code.
109 The second reason is to make it more readable and usable.
110
111 Unfortunately, it seems that Doxygen chokes up a little bit on this
112 structure, and others like it. The documentation should still be mostly
113 understandable though...
114
115 \headerfile dc/pvr.h
116*/
117typedef struct {
118 int list_type; /**< \brief Primitive list
119 \see pvr_lists */
120 struct {
121 int alpha; /**< \brief Enable or disable alpha outside modifier
122 \see pvr_alpha_switch */
123 int shading; /**< \brief Shading type
124 \see pvr_shading_types */
125 int fog_type; /**< \brief Fog type outside modifier
126 \see pvr_fog_types */
127 int culling; /**< \brief Culling mode
128 \see pvr_cull_modes */
129 int color_clamp; /**< \brief Color clamp enable/disable outside modifier
130 \see pvr_colclamp_switch */
131 int clip_mode; /**< \brief Clipping mode
132 \see pvr_clip_modes */
133 int modifier_mode; /**< \brief Modifier mode */
134 int specular; /**< \brief Offset color enable/disable outside modifier
135 \see pvr_offset_switch */
136 int alpha2; /**< \brief Enable/disable alpha inside modifier
137 \see pvr_alpha_switch */
138 int fog_type2; /**< \brief Fog type inside modifier
139 \see pvr_fog_types */
140 int color_clamp2; /**< \brief Color clamp enable/disable inside modifier
141 \see pvr_colclamp_switch */
142 } gen; /**< \brief General parameters */
143 struct {
144 int src; /**< \brief Source blending mode outside modifier
145 \see pvr_blend_modes */
146 int dst; /**< \brief Dest blending mode outside modifier
147 \see pvr_blend_modes */
148 int src_enable; /**< \brief Source blending enable outside modifier
149 \see pvr_blend_switch */
150 int dst_enable; /**< \brief Dest blending enable outside modifier
151 \see pvr_blend_switch */
152 int src2; /**< \brief Source blending mode inside modifier
153 \see pvr_blend_modes */
154 int dst2; /**< \brief Dest blending mode inside modifier
155 \see pvr_blend_modes */
156 int src_enable2; /**< \brief Source blending mode inside modifier
157 \see pvr_blend_switch */
158 int dst_enable2; /**< \brief Dest blending mode inside modifier
159 \see pvr_blend_switch */
160 } blend; /**< \brief Blending parameters */
161 struct {
162 int color; /**< \brief Color format in vertex
163 \see pvr_color_fmts */
164 int uv; /**< \brief U/V data format in vertex
165 \see pvr_uv_fmts */
166 int modifier; /**< \brief Enable or disable modifier effect
167 \see pvr_mod_switch */
168 } fmt; /**< \brief Format control */
169 struct {
170 int comparison; /**< \brief Depth comparison mode
171 \see pvr_depth_modes */
172 int write; /**< \brief Enable or disable depth writes
173 \see pvr_depth_switch */
174 } depth; /**< \brief Depth comparison/write modes */
175 struct {
176 int enable; /**< \brief Enable/disable texturing
177 \see pvr_txr_switch */
178 int filter; /**< \brief Filtering mode
179 \see pvr_filter_modes */
180 int mipmap; /**< \brief Enable/disable mipmaps
181 \see pvr_mip_switch */
182 int mipmap_bias; /**< \brief Mipmap bias
183 \see pvr_mip_bias */
184 int uv_flip; /**< \brief Enable/disable U/V flipping
185 \see pvr_uv_flip */
186 int uv_clamp; /**< \brief Enable/disable U/V clamping
187 \see pvr_uv_clamp */
188 int alpha; /**< \brief Enable/disable texture alpha
189 \see pvr_txralpha_switch */
190 int env; /**< \brief Texture color contribution
191 \see pvr_txrenv_modes */
192 int width; /**< \brief Texture width (requires a power of 2) */
193 int height; /**< \brief Texture height (requires a power of 2) */
194 int format; /**< \brief Texture format
195 \see pvr_txr_fmts */
196 pvr_ptr_t base; /**< \brief Texture pointer */
197 } txr; /**< \brief Texturing params outside modifier */
198 struct {
199 int enable; /**< \brief Enable/disable texturing
200 \see pvr_txr_switch */
201 int filter; /**< \brief Filtering mode
202 \see pvr_filter_modes */
203 int mipmap; /**< \brief Enable/disable mipmaps
204 \see pvr_mip_switch */
205 int mipmap_bias; /**< \brief Mipmap bias
206 \see pvr_mip_bias */
207 int uv_flip; /**< \brief Enable/disable U/V flipping
208 \see pvr_uv_flip */
209 int uv_clamp; /**< \brief Enable/disable U/V clamping
210 \see pvr_uv_clamp */
211 int alpha; /**< \brief Enable/disable texture alpha
212 \see pvr_txralpha_switch */
213 int env; /**< \brief Texture color contribution
214 \see pvr_txrenv_modes */
215 int width; /**< \brief Texture width (requires a power of 2) */
216 int height; /**< \brief Texture height (requires a power of 2) */
217 int format; /**< \brief Texture format
218 \see pvr_txr_fmts */
219 pvr_ptr_t base; /**< \brief Texture pointer */
220 } txr2; /**< \brief Texturing params inside modifier */
222
223/** \brief PVR sprite context.
224 \ingroup pvr_ctx
225
226 You should use this more human readable format for specifying your sprite
227 contexts, and then compile them into sprite headers when you are ready to
228 start using them.
229
230 Unfortunately, it seems that Doxygen chokes up a little bit on this
231 structure, and others like it. The documentation should still be mostly
232 understandable though...
233
234 \headerfile dc/pvr.h
235*/
236typedef struct {
237 int list_type; /**< \brief Primitive list
238 \see pvr_lists */
239 struct {
240 int alpha; /**< \brief Enable or disable alpha
241 \see pvr_alpha_switch */
242 int fog_type; /**< \brief Fog type
243 \see pvr_fog_types */
244 int culling; /**< \brief Culling mode
245 \see pvr_cull_modes */
246 int color_clamp; /**< \brief Color clamp enable/disable
247 \see pvr_colclamp_switch */
248 int clip_mode; /**< \brief Clipping mode
249 \see pvr_clip_modes */
250 int specular; /**< \brief Offset color enable/disable
251 \see pvr_offset_switch */
252 } gen; /**< \brief General parameters */
253 struct {
254 int src; /**< \brief Source blending mode
255 \see pvr_blend_modes */
256 int dst; /**< \brief Dest blending mode
257 \see pvr_blend_modes */
258 int src_enable; /**< \brief Source blending enable
259 \see pvr_blend_switch */
260 int dst_enable; /**< \brief Dest blending enable
261 \see pvr_blend_switch */
262 } blend;
263 struct {
264 int comparison; /**< \brief Depth comparison mode
265 \see pvr_depth_modes */
266 int write; /**< \brief Enable or disable depth writes
267 \see pvr_depth_switch */
268 } depth; /**< \brief Depth comparison/write modes */
269 struct {
270 int enable; /**< \brief Enable/disable texturing
271 \see pvr_txr_switch */
272 int filter; /**< \brief Filtering mode
273 \see pvr_filter_modes */
274 int mipmap; /**< \brief Enable/disable mipmaps
275 \see pvr_mip_switch */
276 int mipmap_bias; /**< \brief Mipmap bias
277 \see pvr_mip_bias */
278 int uv_flip; /**< \brief Enable/disable U/V flipping
279 \see pvr_uv_flip */
280 int uv_clamp; /**< \brief Enable/disable U/V clamping
281 \see pvr_uv_clamp */
282 int alpha; /**< \brief Enable/disable texture alpha
283 \see pvr_txralpha_switch */
284 int env; /**< \brief Texture color contribution
285 \see pvr_txrenv_modes */
286 int width; /**< \brief Texture width (requires a power of 2) */
287 int height; /**< \brief Texture height (requires a power of 2) */
288 int format; /**< \brief Texture format
289 \see pvr_txr_fmts */
290 pvr_ptr_t base; /**< \brief Texture pointer */
291 } txr; /**< \brief Texturing params */
293
294/* Constants for the above structure; thanks to Benoit Miller for these */
295
296/** \defgroup pvr_lists_types Types
297 \brief Values of various PVR polygon list types
298 \ingroup pvr_lists
299
300 Each primitive submitted to the PVR must be placed in one of these lists,
301 depending on its characteristics.
302
303 @{
304*/
305#define PVR_LIST_OP_POLY 0 /**< \brief Opaque polygon list */
306#define PVR_LIST_OP_MOD 1 /**< \brief Opaque modifier list */
307#define PVR_LIST_TR_POLY 2 /**< \brief Translucent polygon list */
308#define PVR_LIST_TR_MOD 3 /**< \brief Translucent modifier list*/
309#define PVR_LIST_PT_POLY 4 /**< \brief Punch-thru polygon list */
310/** @} */
311
312/** \defgroup pvr_ctx_attrib Attributes
313 \brief PVR primitive context attributes
314 \ingroup pvr_ctx
315*/
316
317/** \defgroup pvr_shading_types Shading Modes
318 \brief PowerVR primitive context shading modes
319 \ingroup pvr_ctx_attrib
320
321 Each polygon can define how it wants to be shaded, be it with flat or
322 Gouraud shading using these constants in the appropriate place in its
323 pvr_poly_cxt_t.
324
325 @{
326*/
327#define PVR_SHADE_FLAT 0 /**< \brief Use flat shading */
328#define PVR_SHADE_GOURAUD 1 /**< \brief Use Gouraud shading */
329/** @} */
330
331/** \defgroup pvr_ctx_depth Depth
332 \brief Depth attributes for PVR polygon contexts
333 \ingroup pvr_ctx_attrib
334*/
335
336/** \defgroup pvr_depth_modes Comparison Modes
337 \brief PowerVR depth comparison modes
338 \ingroup pvr_ctx_depth
339
340 These set the depth function used for comparisons.
341
342 @{
343*/
344#define PVR_DEPTHCMP_NEVER 0 /**< \brief Never pass */
345#define PVR_DEPTHCMP_LESS 1 /**< \brief Less than */
346#define PVR_DEPTHCMP_EQUAL 2 /**< \brief Equal to */
347#define PVR_DEPTHCMP_LEQUAL 3 /**< \brief Less than or equal to */
348#define PVR_DEPTHCMP_GREATER 4 /**< \brief Greater than */
349#define PVR_DEPTHCMP_NOTEQUAL 5 /**< \brief Not equal to */
350#define PVR_DEPTHCMP_GEQUAL 6 /**< \brief Greater than or equal to */
351#define PVR_DEPTHCMP_ALWAYS 7 /**< \brief Always pass */
352/** @} */
353
354/** \defgroup pvr_cull_modes Culling Modes
355 \brief PowerVR primitive context culling modes
356 \ingroup pvr_ctx_attrib
357
358 These culling modes can be set by polygons to determine when they are
359 culled. They work pretty much as you'd expect them to if you've ever used
360 any 3D hardware before.
361
362 @{
363*/
364#define PVR_CULLING_NONE 0 /**< \brief Disable culling */
365#define PVR_CULLING_SMALL 1 /**< \brief Cull if small */
366#define PVR_CULLING_CCW 2 /**< \brief Cull if counterclockwise */
367#define PVR_CULLING_CW 3 /**< \brief Cull if clockwise */
368/** @} */
369
370/** \defgroup pvr_depth_switch Write Toggle
371 \brief Enable or Disable Depth Writes.
372 \ingroup pvr_ctx_depth
373 @{
374*/
375#define PVR_DEPTHWRITE_ENABLE 0 /**< \brief Update the Z value */
376#define PVR_DEPTHWRITE_DISABLE 1 /**< \brief Do not update the Z value */
377/** @} */
378
379/** \defgroup pvr_ctx_texture Texture
380 \brief Texture attributes for PVR polygon contexts
381 \ingroup pvr_ctx_attrib
382*/
383
384/** \defgroup pvr_txr_switch Toggle
385 \brief Enable or Disable Texturing on Polygons.
386 \ingroup pvr_ctx_texture
387
388 @{
389*/
390#define PVR_TEXTURE_DISABLE 0 /**< \brief Disable texturing */
391#define PVR_TEXTURE_ENABLE 1 /**< \brief Enable texturing */
392/** @} */
393
394/** \defgroup pvr_blend Blending
395 \brief Blending attributes for PVR primitive contexts
396 \ingroup pvr_ctx_attrib
397*/
398
399/** \defgroup pvr_blend_modes Blending Modes
400 \brief Blending modes for PowerVR primitive contexts
401 \ingroup pvr_blend
402
403 These are all the blending modes that can be done with regard to alpha
404 blending on the PVR.
405
406 @{
407*/
408#define PVR_BLEND_ZERO 0 /**< \brief None of this color */
409#define PVR_BLEND_ONE 1 /**< \brief All of this color */
410#define PVR_BLEND_DESTCOLOR 2 /**< \brief Destination color */
411#define PVR_BLEND_INVDESTCOLOR 3 /**< \brief Inverse of destination color */
412#define PVR_BLEND_SRCALPHA 4 /**< \brief Blend with source alpha */
413#define PVR_BLEND_INVSRCALPHA 5 /**< \brief Blend with inverse source alpha */
414#define PVR_BLEND_DESTALPHA 6 /**< \brief Blend with destination alpha */
415#define PVR_BLEND_INVDESTALPHA 7 /**< \brief Blend with inverse destination alpha */
416/** @} */
417
418/** \defgroup pvr_blend_switch Blending Toggle
419 \brief Enable or Disable Blending.
420 \ingroup pvr_blend
421
422 @{
423*/
424#define PVR_BLEND_DISABLE 0 /**< \brief Disable blending */
425#define PVR_BLEND_ENABLE 1 /**< \brief Enable blending */
426/** @} */
427
428/** \defgroup pvr_fog_types Fog Modes
429 \brief PowerVR primitive context fog modes
430 \ingroup pvr_ctx_attrib
431
432 Each polygon can decide what fog type is used with regard to it using these
433 constants in its pvr_poly_cxt_t.
434
435 @{
436*/
437#define PVR_FOG_TABLE 0 /**< \brief Table fog */
438#define PVR_FOG_VERTEX 1 /**< \brief Vertex fog */
439#define PVR_FOG_DISABLE 2 /**< \brief Disable fog */
440#define PVR_FOG_TABLE2 3 /**< \brief Table fog mode 2 */
441/** @} */
442
443/** \defgroup pvr_clip_modes Clipping Modes
444 \brief PowerVR primitive context clipping modes
445 \ingroup pvr_ctx_attrib
446
447 These control how primitives are clipped against the user clipping area.
448
449 @{
450*/
451#define PVR_USERCLIP_DISABLE 0 /**< \brief Disable clipping */
452#define PVR_USERCLIP_INSIDE 2 /**< \brief Enable clipping inside area */
453#define PVR_USERCLIP_OUTSIDE 3 /**< \brief Enable clipping outside area */
454/** @} */
455
456/** \defgroup pvr_ctx_color Color
457 \brief Color attributes for PowerVR primitive contexts
458 \ingroup pvr_ctx_attrib
459*/
460
461/** \defgroup pvr_colclamp_switch Clamping Toggle
462 \brief Enable or Disable Color Clamping
463 \ingroup pvr_ctx_color
464
465 Enabling color clamping will clamp colors between the minimum and maximum
466 values before any sort of fog processing.
467
468 @{
469*/
470#define PVR_CLRCLAMP_DISABLE 0 /**< \brief Disable color clamping */
471#define PVR_CLRCLAMP_ENABLE 1 /**< \brief Enable color clamping */
472/** @} */
473
474/** \defgroup pvr_offset_switch Offset Toggle
475 \brief Enable or Disable Offset Color
476 \ingroup pvr_ctx_color
477
478 Enabling offset color calculation allows for "specular" like effects on a
479 per-vertex basis, by providing an additive color in the calculation of the
480 final pixel colors. In vertex types with a "oargb" parameter, that's what it
481 is for.
482
483 \note
484 This must be enabled for bumpmap polygons in order to allow you to
485 specify the parameters in the oargb field of the vertices.
486
487 @{
488*/
489#define PVR_SPECULAR_DISABLE 0 /**< \brief Disable offset colors */
490#define PVR_SPECULAR_ENABLE 1 /**< \brief Enable offset colors */
491/** @} */
492
493/** \defgroup pvr_alpha_switch Alpha Toggle
494 \brief Enable or Disable Alpha Blending
495 \ingroup pvr_blend
496
497 This causes the alpha value in the vertex color to be paid attention to. It
498 really only makes sense to enable this for translucent or punch-thru polys.
499
500 @{
501*/
502#define PVR_ALPHA_DISABLE 0 /**< \brief Disable alpha blending */
503#define PVR_ALPHA_ENABLE 1 /**< \brief Enable alpha blending */
504/** @} */
505
506/** \defgroup pvr_txralpha_switch Alpha Toggle
507 \brief Enable or Disable Texture Alpha Blending
508 \ingroup pvr_ctx_texture
509
510 This causes the alpha value in the texel color to be paid attention to. It
511 really only makes sense to enable this for translucent or punch-thru polys.
512
513 @{
514*/
515#define PVR_TXRALPHA_ENABLE 0 /**< \brief Enable alpha blending */
516#define PVR_TXRALPHA_DISABLE 1 /**< \brief Disable alpha blending */
517/** @} */
518
519/** \defgroup pvr_uv_flip U/V Flip Mode
520 \brief Enable or disable U/V flipping on the PVR
521 \ingroup pvr_ctx_texture
522
523 These flags determine what happens when U/V coordinate values exceed 1.0.
524 In any of the flipped cases, the specified coordinate value will flip around
525 after 1.0, essentially mirroring the image. So, if you displayed an image
526 with a U coordinate of 0.0 on the left hand side and 2.0 on the right hand
527 side with U flipping turned on, you'd have an image that was displayed twice
528 as if mirrored across the middle. This mirroring behavior happens at every
529 unit boundary (so at 2.0 it returns to normal, at 3.0 it flips, etc).
530
531 The default case is to disable mirroring. In addition, clamping of the U/V
532 coordinates by PVR_UVCLAMP_U, PVR_UVCLAMP_V, or PVR_UVCLAMP_UV will disable
533 the mirroring behavior.
534 @{
535*/
536#define PVR_UVFLIP_NONE 0 /**< \brief No flipped coordinates */
537#define PVR_UVFLIP_V 1 /**< \brief Flip V only */
538#define PVR_UVFLIP_U 2 /**< \brief Flip U only */
539#define PVR_UVFLIP_UV 3 /**< \brief Flip U and V */
540/** @} */
541
542/** \defgroup pvr_uv_clamp U/V Clamp Mode
543 \brief Enable or disable clamping of U/V on the PVR
544 \ingroup pvr_ctx_texture
545
546 These flags determine whether clamping will be applied to U/V coordinate
547 values that exceed 1.0. If enabled, these modes will explicitly override the
548 flip/mirroring modes (PVR_UVFLIP_U, PVR_UVFLIP_V, and PVR_UVFLIP_UV), and
549 will instead ensure that the coordinate(s) in question never exceed 1.0.
550 @{
551*/
552#define PVR_UVCLAMP_NONE 0 /**< \brief Disable clamping */
553#define PVR_UVCLAMP_V 1 /**< \brief Clamp V only */
554#define PVR_UVCLAMP_U 2 /**< \brief Clamp U only */
555#define PVR_UVCLAMP_UV 3 /**< \brief Clamp U and V */
556/** @} */
557
558/** \defgroup pvr_filter_modes Sampling Modes
559 \brief PowerVR texture sampling modes
560 \ingroup pvr_ctx_texture
561
562 @{
563*/
564#define PVR_FILTER_NONE 0 /**< \brief No filtering (point sample) */
565#define PVR_FILTER_NEAREST 0 /**< \brief No filtering (point sample) */
566#define PVR_FILTER_BILINEAR 2 /**< \brief Bilinear interpolation */
567#define PVR_FILTER_TRILINEAR1 4 /**< \brief Trilinear interpolation pass 1 */
568#define PVR_FILTER_TRILINEAR2 6 /**< \brief Trilinear interpolation pass 2 */
569/** @} */
570
571/** \defgroup pvr_mip_bias Mipmap Bias Modes
572 \brief Mipmap bias modes for PowerVR primitive contexts
573 \ingroup pvr_ctx_texture
574
575 @{
576*/
577#define PVR_MIPBIAS_NORMAL PVR_MIPBIAS_1_00 /* txr_mipmap_bias */
578#define PVR_MIPBIAS_0_25 1
579#define PVR_MIPBIAS_0_50 2
580#define PVR_MIPBIAS_0_75 3
581#define PVR_MIPBIAS_1_00 4
582#define PVR_MIPBIAS_1_25 5
583#define PVR_MIPBIAS_1_50 6
584#define PVR_MIPBIAS_1_75 7
585#define PVR_MIPBIAS_2_00 8
586#define PVR_MIPBIAS_2_25 9
587#define PVR_MIPBIAS_2_50 10
588#define PVR_MIPBIAS_2_75 11
589#define PVR_MIPBIAS_3_00 12
590#define PVR_MIPBIAS_3_25 13
591#define PVR_MIPBIAS_3_50 14
592#define PVR_MIPBIAS_3_75 15
593/** @} */
594
595/** \defgroup pvr_txrenv_modes Color Calculation Modes
596 \brief PowerVR texture color calculation modes
597 \ingroup pvr_ctx_texture
598
599 @{
600*/
601#define PVR_TXRENV_REPLACE 0 /**< \brief C = Ct, A = At */
602#define PVR_TXRENV_MODULATE 1 /**< \brief C = Cs * Ct, A = At */
603#define PVR_TXRENV_DECAL 2 /**< \brief C = (Cs * At) + (Cs * (1-At)), A = As */
604#define PVR_TXRENV_MODULATEALPHA 3 /**< \brief C = Cs * Ct, A = As * At */
605/** @} */
606
607/** \defgroup pvr_mip_switch Mipmap Toggle
608 \brief Enable or Disable Mipmap Processing
609 \ingroup pvr_ctx_texture
610
611 @{
612*/
613#define PVR_MIPMAP_DISABLE 0 /**< \brief Disable mipmap processing */
614#define PVR_MIPMAP_ENABLE 1 /**< \brief Enable mipmap processing */
615/** @} */
616
617/** \defgroup pvr_txr_fmts Formats
618 \brief PowerVR texture formats
619 \ingroup pvr_txr_mgmt
620
621 These are the texture formats that the PVR supports. Note that some of
622 these, you can OR together with other values.
623
624 @{
625*/
626#define PVR_TXRFMT_NONE 0 /**< \brief No texture */
627#define PVR_TXRFMT_VQ_DISABLE (0 << 30) /**< \brief Not VQ encoded */
628#define PVR_TXRFMT_VQ_ENABLE (1 << 30) /**< \brief VQ encoded */
629#define PVR_TXRFMT_ARGB1555 (0 << 27) /**< \brief 16-bit ARGB1555 */
630#define PVR_TXRFMT_RGB565 (1 << 27) /**< \brief 16-bit RGB565 */
631#define PVR_TXRFMT_ARGB4444 (2 << 27) /**< \brief 16-bit ARGB4444 */
632#define PVR_TXRFMT_YUV422 (3 << 27) /**< \brief YUV422 format */
633#define PVR_TXRFMT_BUMP (4 << 27) /**< \brief Bumpmap format */
634#define PVR_TXRFMT_PAL4BPP (5 << 27) /**< \brief 4BPP paletted format */
635#define PVR_TXRFMT_PAL8BPP (6 << 27) /**< \brief 8BPP paletted format */
636#define PVR_TXRFMT_TWIDDLED (0 << 26) /**< \brief Texture is twiddled */
637#define PVR_TXRFMT_NONTWIDDLED (1 << 26) /**< \brief Texture is not twiddled */
638#define PVR_TXRFMT_POW2_STRIDE (0 << 25) /**< \brief Stride is a power-of-two */
639#define PVR_TXRFMT_X32_STRIDE (1 << 25) /**< \brief Stride is multiple of 32 */
640
641/* Backward compatibility */
642#define PVR_TXRFMT_NOSTRIDE PVR_TXRFMT_POW2_STRIDE
643#define PVR_TXRFMT_STRIDE PVR_TXRFMT_X32_STRIDE
644
645/* OR one of these into your texture format if you need it. Note that
646 these coincide with the twiddled/stride bits, so you can't have a
647 non-twiddled/strided texture that's paletted! */
648
649/** \brief 8BPP palette selector
650
651 \param x The palette index */
652#define PVR_TXRFMT_8BPP_PAL(x) ((x) << 25)
653
654/** \brief 4BPP palette selector
655
656 \param x The palette index */
657#define PVR_TXRFMT_4BPP_PAL(x) ((x) << 21)
658/** @} */
659
660/** \defgroup pvr_color_fmts Vertex Formats
661 \brief Color formats for PowerVR vertices
662 \ingroup pvr_ctx_color
663
664 These control how colors are represented in polygon data.
665
666 @{
667*/
668#define PVR_CLRFMT_ARGBPACKED 0 /**< \brief 32-bit integer ARGB */
669#define PVR_CLRFMT_4FLOATS 1 /**< \brief 4 floating point values */
670#define PVR_CLRFMT_INTENSITY 2 /**< \brief Intensity color */
671#define PVR_CLRFMT_INTENSITY_PREV 3 /**< \brief Use last intensity */
672/** @} */
673
674/** \defgroup pvr_uv_fmts U/V Data Format
675 \brief U/V data format for PVR textures
676 \ingroup pvr_ctx_texture
677 @{
678*/
679#define PVR_UVFMT_32BIT 0 /**< \brief 32-bit floating point U/V */
680#define PVR_UVFMT_16BIT 1 /**< \brief 16-bit floating point U/V */
681/** @} */
682
683/** \defgroup pvr_ctx_modvol Modifier Volumes
684 \brief PowerVR modifier volume polygon context attributes
685 \ingroup pvr_ctx_attrib
686*/
687
688/** \defgroup pvr_mod_switch Toggle
689 \brief Enable or Disable Modifier Effects
690 \ingroup pvr_ctx_modvol
691 @{
692*/
693#define PVR_MODIFIER_DISABLE 0 /**< \brief Disable modifier effects */
694#define PVR_MODIFIER_ENABLE 1 /**< \brief Enable modifier effects */
695/** @} */
696
697/** \defgroup pvr_mod_types Types
698 \brief Modifier volume types for PowerVR primitive contexts
699 \ingroup pvr_ctx_modvol
700 @{
701*/
702#define PVR_MODIFIER_CHEAP_SHADOW 0
703#define PVR_MODIFIER_NORMAL 1
704/** @} */
705
706/** \defgroup pvr_mod_modes Modes
707 \brief Modifier volume modes for PowerVR primitive contexts
708 \ingroup pvr_ctx_modvol
709
710 All triangles in a single modifier volume should be of the other poly type,
711 except for the last one. That should be either of the other two types,
712 depending on whether you want an inclusion or exclusion volume.
713
714 @{
715*/
716#define PVR_MODIFIER_OTHER_POLY 0 /**< \brief Not the last polygon in the volume */
717#define PVR_MODIFIER_INCLUDE_LAST_POLY 1 /**< \brief Last polygon, inclusion volume */
718#define PVR_MODIFIER_EXCLUDE_LAST_POLY 2 /**< \brief Last polygon, exclusion volume */
719/** @} */
720
721/** \defgroup pvr_primitives_headers Headers
722 \brief Compiled headers for polygons and sprites
723 \ingroup pvr_primitives
724
725 @{
726*/
727
728/** \brief PVR polygon header.
729
730 This is the hardware equivalent of a rendering context; you'll create one of
731 these from your pvr_poly_cxt_t and use it for submission to the hardware.
732
733 \headerfile dc/pvr.h
734*/
735typedef struct pvr_poly_hdr {
736 alignas(32)
737 uint32_t cmd; /**< \brief TA command */
738 uint32_t mode1; /**< \brief Parameter word 1 */
739 uint32_t mode2; /**< \brief Parameter word 2 */
740 uint32_t mode3; /**< \brief Parameter word 3 */
741 uint32_t d1; /**< \brief Dummy value */
742 uint32_t d2; /**< \brief Dummy value */
743 uint32_t d3; /**< \brief Dummy value */
744 uint32_t d4; /**< \brief Dummy value */
746
747/** \brief PVR polygon header with intensity color.
748
749 This is the equivalent of pvr_poly_hdr_t, but for use with intensity color.
750
751 \headerfile dc/pvr.h
752*/
753typedef struct pvr_poly_ic_hdr {
754 alignas(32)
755 uint32_t cmd; /**< \brief TA command */
756 uint32_t mode1; /**< \brief Parameter word 1 */
757 uint32_t mode2; /**< \brief Parameter word 2 */
758 uint32_t mode3; /**< \brief Parameter word 3 */
759 float a; /**< \brief Face color alpha component */
760 float r; /**< \brief Face color red component */
761 float g; /**< \brief Face color green component */
762 float b; /**< \brief Face color blue component */
764
765/** \brief PVR polygon header to be used with modifier volumes.
766
767 This is the equivalent of a pvr_poly_hdr_t for use when a polygon is to be
768 used with modifier volumes.
769
770 \headerfile dc/pvr.h
771*/
772typedef struct pvr_poly_mod_hdr {
773 alignas(32)
774 uint32_t cmd; /**< \brief TA command */
775 uint32_t mode1; /**< \brief Parameter word 1 */
776 uint32_t mode2_0; /**< \brief Parameter word 2 (outside volume) */
777 uint32_t mode3_0; /**< \brief Parameter word 3 (outside volume) */
778 uint32_t mode2_1; /**< \brief Parameter word 2 (inside volume) */
779 uint32_t mode3_1; /**< \brief Parameter word 3 (inside volume) */
780 uint32_t d1; /**< \brief Dummy value */
781 uint32_t d2; /**< \brief Dummy value */
783
784/** \brief PVR polygon header specifically for sprites.
785
786 This is the equivalent of a pvr_poly_hdr_t for use when a quad/sprite is to
787 be rendered. Note that the color data is here, not in the vertices.
788
789 \headerfile dc/pvr.h
790*/
791typedef struct pvr_sprite_hdr {
792 alignas(32)
793 uint32_t cmd; /**< \brief TA command */
794 uint32_t mode1; /**< \brief Parameter word 1 */
795 uint32_t mode2; /**< \brief Parameter word 2 */
796 uint32_t mode3; /**< \brief Parameter word 3 */
797 uint32_t argb; /**< \brief Sprite face color */
798 uint32_t oargb; /**< \brief Sprite offset color */
799 uint32_t d1; /**< \brief Dummy value */
800 uint32_t d2; /**< \brief Dummy value */
802
803/** \brief Modifier volume header.
804
805 This is the header that should be submitted when dealing with setting a
806 modifier volume.
807
808 \headerfile dc/pvr.h
809*/
810typedef struct pvr_mod_hdr {
811 alignas(32)
812 uint32_t cmd; /**< \brief TA command */
813 uint32_t mode1; /**< \brief Parameter word 1 */
814 uint32_t d1; /**< \brief Dummy value */
815 uint32_t d2; /**< \brief Dummy value */
816 uint32_t d3; /**< \brief Dummy value */
817 uint32_t d4; /**< \brief Dummy value */
818 uint32_t d5; /**< \brief Dummy value */
819 uint32_t d6; /**< \brief Dummy value */
821
822/** @} */
823
824/** \defgroup pvr_vertex_types Vertices
825 \brief PowerVR vertex types
826 \ingroup pvr_geometry
827
828 @{
829*/
830
831/** \brief Generic PVR vertex type.
832
833 The PVR chip itself supports many more vertex types, but this is the main
834 one that can be used with both textured and non-textured polygons, and is
835 fairly fast.
836
837 \headerfile dc/pvr.h
838*/
839typedef struct pvr_vertex {
840 alignas(32)
841 uint32_t flags; /**< \brief TA command (vertex flags) */
842 float x; /**< \brief X coordinate */
843 float y; /**< \brief Y coordinate */
844 float z; /**< \brief Z coordinate */
845 float u; /**< \brief Texture U coordinate */
846 float v; /**< \brief Texture V coordinate */
847 uint32_t argb; /**< \brief Vertex color */
848 uint32_t oargb; /**< \brief Vertex offset color */
850
851/** \brief PVR vertex type: Non-textured, packed color, affected by modifier
852 volume.
853
854 This vertex type has two copies of colors. The second color is used when
855 enclosed within a modifier volume.
856
857 \headerfile dc/pvr.h
858*/
859typedef struct pvr_vertex_pcm {
860 alignas(32)
861 uint32_t flags; /**< \brief TA command (vertex flags) */
862 float x; /**< \brief X coordinate */
863 float y; /**< \brief Y coordinate */
864 float z; /**< \brief Z coordinate */
865 uint32_t argb0; /**< \brief Vertex color (outside volume) */
866 uint32_t argb1; /**< \brief Vertex color (inside volume) */
867 uint32_t d1; /**< \brief Dummy value */
868 uint32_t d2; /**< \brief Dummy value */
870
871/** \brief PVR vertex type: Textured, packed color, affected by modifier volume.
872
873 Note that this vertex type has two copies of colors, offset colors, and
874 texture coords. The second set of texture coords, colors, and offset colors
875 are used when enclosed within a modifier volume.
876
877 \headerfile dc/pvr.h
878*/
879typedef struct pvr_vertex_tpcm {
880 alignas(32)
881 uint32_t flags; /**< \brief TA command (vertex flags) */
882 float x; /**< \brief X coordinate */
883 float y; /**< \brief Y coordinate */
884 float z; /**< \brief Z coordinate */
885 float u0; /**< \brief Texture U coordinate (outside) */
886 float v0; /**< \brief Texture V coordinate (outside) */
887 uint32_t argb0; /**< \brief Vertex color (outside) */
888 uint32_t oargb0; /**< \brief Vertex offset color (outside) */
889 float u1; /**< \brief Texture U coordinate (inside) */
890 float v1; /**< \brief Texture V coordinate (inside) */
891 uint32_t argb1; /**< \brief Vertex color (inside) */
892 uint32_t oargb1; /**< \brief Vertex offset color (inside) */
893 uint32_t d1; /**< \brief Dummy value */
894 uint32_t d2; /**< \brief Dummy value */
895 uint32_t d3; /**< \brief Dummy value */
896 uint32_t d4; /**< \brief Dummy value */
898
899/** \brief PVR vertex type: Textured sprite.
900
901 This vertex type is to be used with the sprite polygon header and the sprite
902 related commands to draw textured sprites. Note that there is no fourth Z
903 coordinate. I suppose it just gets interpolated?
904
905 The U/V coordinates in here are in the 16-bit per coordinate form. Also,
906 like the fourth Z value, there is no fourth U or V, so it must get
907 interpolated from the others.
908
909 \headerfile dc/pvr.h
910*/
911typedef struct pvr_sprite_txr {
912 alignas(32)
913 uint32_t flags; /**< \brief TA command (vertex flags) */
914 float ax; /**< \brief First X coordinate */
915 float ay; /**< \brief First Y coordinate */
916 float az; /**< \brief First Z coordinate */
917 float bx; /**< \brief Second X coordinate */
918 float by; /**< \brief Second Y coordinate */
919 float bz; /**< \brief Second Z coordinate */
920 float cx; /**< \brief Third X coordinate */
921 float cy; /**< \brief Third Y coordinate */
922 float cz; /**< \brief Third Z coordinate */
923 float dx; /**< \brief Fourth X coordinate */
924 float dy; /**< \brief Fourth Y coordinate */
925 uint32_t dummy; /**< \brief Dummy value */
926 uint32_t auv; /**< \brief First U/V texture coordinates */
927 uint32_t buv; /**< \brief Second U/V texture coordinates */
928 uint32_t cuv; /**< \brief Third U/V texture coordinates */
930
931/** \brief PVR vertex type: Untextured sprite.
932
933 This vertex type is to be used with the sprite polygon header and the sprite
934 related commands to draw untextured sprites (aka, quads).
935*/
936typedef struct pvr_sprite_col {
937 alignas(32)
938 uint32_t flags; /**< \brief TA command (vertex flags) */
939 float ax; /**< \brief First X coordinate */
940 float ay; /**< \brief First Y coordinate */
941 float az; /**< \brief First Z coordinate */
942 float bx; /**< \brief Second X coordinate */
943 float by; /**< \brief Second Y coordinate */
944 float bz; /**< \brief Second Z coordinate */
945 float cx; /**< \brief Third X coordinate */
946 float cy; /**< \brief Third Y coordinate */
947 float cz; /**< \brief Third Z coordinate */
948 float dx; /**< \brief Fourth X coordinate */
949 float dy; /**< \brief Fourth Y coordinate */
950 uint32_t d1; /**< \brief Dummy value */
951 uint32_t d2; /**< \brief Dummy value */
952 uint32_t d3; /**< \brief Dummy value */
953 uint32_t d4; /**< \brief Dummy value */
955
956/** \brief PVR vertex type: Modifier volume.
957
958 This vertex type is to be used with the modifier volume header to specify
959 triangular modifier areas.
960*/
961typedef struct pvr_modifier_vol {
962 alignas(32)
963 uint32_t flags; /**< \brief TA command (vertex flags) */
964 float ax; /**< \brief First X coordinate */
965 float ay; /**< \brief First Y coordinate */
966 float az; /**< \brief First Z coordinate */
967 float bx; /**< \brief Second X coordinate */
968 float by; /**< \brief Second Y coordinate */
969 float bz; /**< \brief Second Z coordinate */
970 float cx; /**< \brief Third X coordinate */
971 float cy; /**< \brief Third Y coordinate */
972 float cz; /**< \brief Third Z coordinate */
973 uint32_t d1; /**< \brief Dummy value */
974 uint32_t d2; /**< \brief Dummy value */
975 uint32_t d3; /**< \brief Dummy value */
976 uint32_t d4; /**< \brief Dummy value */
977 uint32_t d5; /**< \brief Dummy value */
978 uint32_t d6; /**< \brief Dummy value */
980
981/** \brief Pack four floating point color values into a 32-bit integer form.
982
983 All of the color values should be between 0 and 1.
984
985 \param a Alpha value
986 \param r Red value
987 \param g Green value
988 \param b Blue value
989 \return The packed color value
990*/
991#define PVR_PACK_COLOR(a, r, g, b) ( \
992 ( ((uint8_t)( (a) * 255 ) ) << 24 ) | \
993 ( ((uint8_t)( (r) * 255 ) ) << 16 ) | \
994 ( ((uint8_t)( (g) * 255 ) ) << 8 ) | \
995 ( ((uint8_t)( (b) * 255 ) ) << 0 ) )
996
997/** \brief Pack two floating point coordinates into one 32-bit value,
998 truncating them to 16-bits each.
999
1000 \param u First coordinate to pack
1001 \param v Second coordinate to pack
1002 \return The packed coordinates
1003*/
1004static inline uint32_t PVR_PACK_16BIT_UV(float u, float v) {
1005 union {
1006 float f;
1007 uint32_t i;
1008 } u2, v2;
1009
1010 u2.f = u;
1011 v2.f = v;
1012
1013 return (u2.i & 0xFFFF0000) | (v2.i >> 16);
1014}
1015
1016/** @} */
1017
1018/** \defgroup pvr_commands TA Command Values
1019 \brief Command values for submitting data to the TA
1020 \ingroup pvr_primitives_headers
1021
1022 These are are appropriate values for TA commands. Use whatever goes with the
1023 primitive type you're using.
1024
1025 @{
1026*/
1027#define PVR_CMD_POLYHDR 0x80840000 /**< \brief PVR polygon header.
1028Striplength set to 2 */
1029#define PVR_CMD_VERTEX 0xe0000000 /**< \brief PVR vertex data */
1030#define PVR_CMD_VERTEX_EOL 0xf0000000 /**< \brief PVR vertex, end of strip */
1031#define PVR_CMD_USERCLIP 0x20000000 /**< \brief PVR user clipping area */
1032#define PVR_CMD_MODIFIER 0x80000000 /**< \brief PVR modifier volume */
1033#define PVR_CMD_SPRITE 0xA0000000 /**< \brief PVR sprite header */
1034/** @} */
1035
1036/** \cond
1037 Deprecated macros, replaced by the pvr_bitmasks macros below.
1038 */
1039#define PVR_TA_CMD_TYPE_SHIFT 24
1040#define PVR_TA_CMD_TYPE_MASK (7 << PVR_TA_CMD_TYPE_SHIFT)
1041
1042#define PVR_TA_CMD_USERCLIP_SHIFT 16
1043#define PVR_TA_CMD_USERCLIP_MASK (3 << PVR_TA_CMD_USERCLIP_SHIFT)
1044
1045#define PVR_TA_CMD_CLRFMT_SHIFT 4
1046#define PVR_TA_CMD_CLRFMT_MASK (7 << PVR_TA_CMD_CLRFMT_SHIFT)
1047
1048#define PVR_TA_CMD_SPECULAR_SHIFT 2
1049#define PVR_TA_CMD_SPECULAR_MASK (1 << PVR_TA_CMD_SPECULAR_SHIFT)
1050
1051#define PVR_TA_CMD_SHADE_SHIFT 1
1052#define PVR_TA_CMD_SHADE_MASK (1 << PVR_TA_CMD_SHADE_SHIFT)
1053
1054#define PVR_TA_CMD_UVFMT_SHIFT 0
1055#define PVR_TA_CMD_UVFMT_MASK (1 << PVR_TA_CMD_UVFMT_SHIFT)
1056
1057#define PVR_TA_CMD_MODIFIER_SHIFT 7
1058#define PVR_TA_CMD_MODIFIER_MASK (1 << PVR_TA_CMD_MODIFIER_SHIFT)
1059
1060#define PVR_TA_CMD_MODIFIERMODE_SHIFT 6
1061#define PVR_TA_CMD_MODIFIERMODE_MASK (1 << PVR_TA_CMD_MODIFIERMODE_SHIFT)
1062
1063#define PVR_TA_PM1_DEPTHCMP_SHIFT 29
1064#define PVR_TA_PM1_DEPTHCMP_MASK (7 << PVR_TA_PM1_DEPTHCMP_SHIFT)
1065
1066#define PVR_TA_PM1_CULLING_SHIFT 27
1067#define PVR_TA_PM1_CULLING_MASK (3 << PVR_TA_PM1_CULLING_SHIFT)
1068
1069#define PVR_TA_PM1_DEPTHWRITE_SHIFT 26
1070#define PVR_TA_PM1_DEPTHWRITE_MASK (1 << PVR_TA_PM1_DEPTHWRITE_SHIFT)
1071
1072#define PVR_TA_PM1_TXRENABLE_SHIFT 25
1073#define PVR_TA_PM1_TXRENABLE_MASK (1 << PVR_TA_PM1_TXRENABLE_SHIFT)
1074
1075#define PVR_TA_PM1_MODIFIERINST_SHIFT 29
1076#define PVR_TA_PM1_MODIFIERINST_MASK (3 << PVR_TA_PM1_MODIFIERINST_SHIFT)
1077
1078#define PVR_TA_PM2_SRCBLEND_SHIFT 29
1079#define PVR_TA_PM2_SRCBLEND_MASK (7 << PVR_TA_PM2_SRCBLEND_SHIFT)
1080
1081#define PVR_TA_PM2_DSTBLEND_SHIFT 26
1082#define PVR_TA_PM2_DSTBLEND_MASK (7 << PVR_TA_PM2_DSTBLEND_SHIFT)
1083
1084#define PVR_TA_PM2_SRCENABLE_SHIFT 25
1085#define PVR_TA_PM2_SRCENABLE_MASK (1 << PVR_TA_PM2_SRCENABLE_SHIFT)
1086
1087#define PVR_TA_PM2_DSTENABLE_SHIFT 24
1088#define PVR_TA_PM2_DSTENABLE_MASK (1 << PVR_TA_PM2_DSTENABLE_SHIFT)
1089
1090#define PVR_TA_PM2_FOG_SHIFT 22
1091#define PVR_TA_PM2_FOG_MASK (3 << PVR_TA_PM2_FOG_SHIFT)
1092
1093#define PVR_TA_PM2_CLAMP_SHIFT 21
1094#define PVR_TA_PM2_CLAMP_MASK (1 << PVR_TA_PM2_CLAMP_SHIFT)
1095
1096#define PVR_TA_PM2_ALPHA_SHIFT 20
1097#define PVR_TA_PM2_ALPHA_MASK (1 << PVR_TA_PM2_ALPHA_SHIFT)
1098
1099#define PVR_TA_PM2_TXRALPHA_SHIFT 19
1100#define PVR_TA_PM2_TXRALPHA_MASK (1 << PVR_TA_PM2_TXRALPHA_SHIFT)
1101
1102#define PVR_TA_PM2_UVFLIP_SHIFT 17
1103#define PVR_TA_PM2_UVFLIP_MASK (3 << PVR_TA_PM2_UVFLIP_SHIFT)
1104
1105#define PVR_TA_PM2_UVCLAMP_SHIFT 15
1106#define PVR_TA_PM2_UVCLAMP_MASK (3 << PVR_TA_PM2_UVCLAMP_SHIFT)
1107
1108#define PVR_TA_PM2_FILTER_SHIFT 12
1109#define PVR_TA_PM2_FILTER_MASK (7 << PVR_TA_PM2_FILTER_SHIFT)
1110
1111#define PVR_TA_PM2_MIPBIAS_SHIFT 8
1112#define PVR_TA_PM2_MIPBIAS_MASK (15 << PVR_TA_PM2_MIPBIAS_SHIFT)
1113
1114#define PVR_TA_PM2_TXRENV_SHIFT 6
1115#define PVR_TA_PM2_TXRENV_MASK (3 << PVR_TA_PM2_TXRENV_SHIFT)
1116
1117#define PVR_TA_PM2_USIZE_SHIFT 3
1118#define PVR_TA_PM2_USIZE_MASK (7 << PVR_TA_PM2_USIZE_SHIFT)
1119
1120#define PVR_TA_PM2_VSIZE_SHIFT 0
1121#define PVR_TA_PM2_VSIZE_MASK (7 << PVR_TA_PM2_VSIZE_SHIFT)
1122
1123#define PVR_TA_PM3_MIPMAP_SHIFT 31
1124#define PVR_TA_PM3_MIPMAP_MASK (1 << PVR_TA_PM3_MIPMAP_SHIFT)
1125
1126#define PVR_TA_PM3_TXRFMT_SHIFT 0
1127#define PVR_TA_PM3_TXRFMT_MASK 0xffffffff
1128/** \endcond */
1129
1130/** \defgroup pvr_bitmasks Constants and Masks
1131 \brief Polygon header constants and masks
1132 \ingroup pvr_primitives_headers
1133
1134 Note that thanks to the arrangement of constants, this is mainly a matter of
1135 bit shifting to compile headers...
1136
1137 @{
1138*/
1139#define PVR_TA_CMD_TYPE GENMASK(26, 24)
1140#define PVR_TA_CMD_USERCLIP GENMASK(17, 16)
1141#define PVR_TA_CMD_MODIFIER BIT(7)
1142#define PVR_TA_CMD_MODIFIERMODE BIT(6)
1143#define PVR_TA_CMD_CLRFMT GENMASK(5, 4)
1144#define PVR_TA_CMD_TXRENABLE BIT(3)
1145#define PVR_TA_CMD_SPECULAR BIT(2)
1146#define PVR_TA_CMD_SHADE BIT(1)
1147#define PVR_TA_CMD_UVFMT BIT(0)
1148#define PVR_TA_PM1_DEPTHCMP GENMASK(31, 29)
1149#define PVR_TA_PM1_CULLING GENMASK(28, 27)
1150#define PVR_TA_PM1_DEPTHWRITE BIT(26)
1151#define PVR_TA_PM1_TXRENABLE BIT(25)
1152#define PVR_TA_PM1_MODIFIERINST GENMASK(30, 29)
1153#define PVR_TA_PM2_SRCBLEND GENMASK(31, 29)
1154#define PVR_TA_PM2_DSTBLEND GENMASK(28, 26)
1155#define PVR_TA_PM2_SRCENABLE BIT(25)
1156#define PVR_TA_PM2_DSTENABLE BIT(24)
1157#define PVR_TA_PM2_FOG GENMASK(23, 22)
1158#define PVR_TA_PM2_CLAMP BIT(21)
1159#define PVR_TA_PM2_ALPHA BIT(20)
1160#define PVR_TA_PM2_TXRALPHA BIT(19)
1161#define PVR_TA_PM2_UVFLIP GENMASK(18, 17)
1162#define PVR_TA_PM2_UVCLAMP GENMASK(16, 15)
1163#define PVR_TA_PM2_FILTER GENMASK(14, 12)
1164#define PVR_TA_PM2_MIPBIAS GENMASK(11, 8)
1165#define PVR_TA_PM2_TXRENV GENMASK(7, 6)
1166#define PVR_TA_PM2_USIZE GENMASK(5, 3)
1167#define PVR_TA_PM2_VSIZE GENMASK(2, 0)
1168#define PVR_TA_PM3_MIPMAP BIT(31)
1169#define PVR_TA_PM3_TXRFMT GENMASK(30, 21)
1170/** @} */
1171
1172/**** Register macros ***************************************************/
1173
1174/** \defgroup pvr_registers Registers
1175 \brief Direct PVR register and memory access
1176 \ingroup pvr
1177 @{
1178*/
1179
1180/* We use these macros to do all PVR register access, so that it's
1181 simple later on to hook them for debugging or whatnot. */
1182
1183#define PVR_REGISTERS_BASE 0xa05f8000 /**< \brief PVR Register Base */
1184
1185/** \brief Retrieve a PVR register value
1186
1187 \param REG The register to fetch. See \ref pvr_regs.
1188
1189 \return The value of that register (32-bits)
1190*/
1191#define PVR_GET(REG) (* ( (vuint32*)( PVR_REGISTERS_BASE + (REG) ) ) )
1192
1193/** \brief Set a PVR register value
1194
1195 \param REG The register to set. See \ref pvr_regs.
1196 \param VALUE The value to set in the register (32-bits)
1197*/
1198#define PVR_SET(REG, VALUE) PVR_GET(REG) = (VALUE)
1199
1200/** @} */
1201
1202/** \defgroup pvr_regs Offsets
1203 \brief PowerVR register offsets
1204 \ingroup pvr_registers
1205
1206 The registers themselves; these are from Maiwe's powervr-reg.txt.
1207
1208 \note
1209 2D specific registers have been excluded for now (like
1210 vsync, hsync, v/h size, etc)
1211
1212 @{
1213*/
1214
1215#define PVR_ID 0x0000 /**< \brief Chip ID */
1216#define PVR_REVISION 0x0004 /**< \brief Chip revision */
1217#define PVR_RESET 0x0008 /**< \brief Reset pins */
1218
1219#define PVR_ISP_START 0x0014 /**< \brief Start the ISP/TSP */
1220#define PVR_UNK_0018 0x0018 /**< \brief ?? */
1221
1222#define PVR_ISP_VERTBUF_ADDR 0x0020 /**< \brief Vertex buffer address for scene rendering */
1223
1224#define PVR_ISP_TILEMAT_ADDR 0x002c /**< \brief Tile matrix address for scene rendering */
1225#define PVR_SPANSORT_CFG 0x0030 /**< \brief ?? -- write 0x101 for now */
1226
1227#define PVR_BORDER_COLOR 0x0040 /**< \brief Border Color in RGB888 */
1228#define PVR_FB_CFG_1 0x0044 /**< \brief Framebuffer config 1 */
1229#define PVR_FB_CFG_2 0x0048 /**< \brief Framebuffer config 2 */
1230#define PVR_RENDER_MODULO 0x004c /**< \brief Render modulo */
1231#define PVR_FB_ADDR 0x0050 /**< \brief Framebuffer start address */
1232#define PVR_FB_IL_ADDR 0x0054 /**< \brief Framebuffer odd-field start address for interlace */
1233
1234#define PVR_FB_SIZE 0x005c /**< \brief Framebuffer display size */
1235#define PVR_RENDER_ADDR 0x0060 /**< \brief Render output address */
1236#define PVR_RENDER_ADDR_2 0x0064 /**< \brief Output for strip-buffering */
1237#define PVR_PCLIP_X 0x0068 /**< \brief Horizontal clipping area */
1238#define PVR_PCLIP_Y 0x006c /**< \brief Vertical clipping area */
1239
1240#define PVR_CHEAP_SHADOW 0x0074 /**< \brief Cheap shadow control */
1241#define PVR_OBJECT_CLIP 0x0078 /**< \brief Distance for polygon culling */
1242#define PVR_UNK_007C 0x007c /**< \brief ?? -- write 0x0027df77 for now */
1243#define PVR_UNK_0080 0x0080 /**< \brief ?? -- write 7 for now */
1244#define PVR_TEXTURE_CLIP 0x0084 /**< \brief Distance for texture clipping */
1245#define PVR_BGPLANE_Z 0x0088 /**< \brief Distance for background plane */
1246#define PVR_BGPLANE_CFG 0x008c /**< \brief Background plane config */
1247
1248#define PVR_UNK_0098 0x0098 /**< \brief ?? -- write 0x00800408 for now */
1249
1250#define PVR_UNK_00A0 0x00a0 /**< \brief ?? -- write 0x20 for now */
1251
1252#define PVR_UNK_00A8 0x00a8 /**< \brief ?? -- write 0x15d1c951 for now */
1253
1254#define PVR_FOG_TABLE_COLOR 0x00b0 /**< \brief Table fog color */
1255#define PVR_FOG_VERTEX_COLOR 0x00b4 /**< \brief Vertex fog color */
1256#define PVR_FOG_DENSITY 0x00b8 /**< \brief Fog density coefficient */
1257#define PVR_COLOR_CLAMP_MAX 0x00bc /**< \brief RGB Color clamp max */
1258#define PVR_COLOR_CLAMP_MIN 0x00c0 /**< \brief RGB Color clamp min */
1259#define PVR_GUN_POS 0x00c4 /**< \brief Light gun position */
1260#define PVR_HPOS_IRQ 0x00c8 /**< \brief Horizontal position IRQ */
1261#define PVR_VPOS_IRQ 0x00cc /**< \brief Vertical position IRQ */
1262#define PVR_IL_CFG 0x00d0 /**< \brief Interlacing config */
1263#define PVR_BORDER_X 0x00d4 /**< \brief Window border X position */
1264#define PVR_SCAN_CLK 0x00d8 /**< \brief Clock and scanline values */
1265#define PVR_BORDER_Y 0x00dc /**< \brief Window border Y position */
1266
1267#define PVR_TXR_STRIDE_MULT 0x00e4 /**< \brief Multiplier for stride width in increments of 32 */
1268#define PVR_TEXTURE_MODULO PVR_TXR_STRIDE_MULT /* Backward compatibility */
1269#define PVR_VIDEO_CFG 0x00e8 /**< \brief Misc video config */
1270#define PVR_BITMAP_X 0x00ec /**< \brief Bitmap window X position */
1271#define PVR_BITMAP_Y 0x00f0 /**< \brief Bitmap window Y position */
1272#define PVR_SCALER_CFG 0x00f4 /**< \brief Smoothing scaler */
1273
1274#define PVR_PALETTE_CFG 0x0108 /**< \brief Palette format */
1275#define PVR_SYNC_STATUS 0x010c /**< \brief V/H blank status */
1276#define PVR_UNK_0110 0x0110 /**< \brief ?? -- write 0x93f39 for now */
1277#define PVR_UNK_0114 0x0114 /**< \brief ?? -- write 0x200000 for now */
1278#define PVR_UNK_0118 0x0118 /**< \brief ?? -- write 0x8040 for now */
1279
1280#define PVR_TA_OPB_START 0x0124 /**< \brief Object Pointer Buffer start for TA usage */
1281#define PVR_TA_VERTBUF_START 0x0128 /**< \brief Vertex buffer start for TA usage */
1282#define PVR_TA_OPB_END 0x012c /**< \brief OPB end for TA usage */
1283#define PVR_TA_VERTBUF_END 0x0130 /**< \brief Vertex buffer end for TA usage */
1284#define PVR_TA_OPB_POS 0x0134 /**< \brief Top used memory location in OPB for TA usage */
1285#define PVR_TA_VERTBUF_POS 0x0138 /**< \brief Top used memory location in vertbuf for TA usage */
1286#define PVR_TILEMAT_CFG 0x013c /**< \brief Tile matrix size config */
1287#define PVR_OPB_CFG 0x0140 /**< \brief Active lists / list size */
1288#define PVR_TA_INIT 0x0144 /**< \brief Initialize vertex reg. params */
1289#define PVR_YUV_ADDR 0x0148 /**< \brief YUV conversion destination */
1290#define PVR_YUV_CFG 0x014c /**< \brief YUV configuration */
1291#define PVR_YUV_STAT 0x0150 /**< \brief The number of YUV macroblocks converted */
1292
1293#define PVR_UNK_0160 0x0160 /**< \brief ?? */
1294#define PVR_TA_OPB_INIT 0x0164 /**< \brief Object pointer buffer position init */
1295
1296#define PVR_FOG_TABLE_BASE 0x0200 /**< \brief Base of the fog table */
1297
1298#define PVR_PALETTE_TABLE_BASE 0x1000 /**< \brief Base of the palette table */
1299/** @} */
1300
1301/** \defgroup pvr_addresses Addresses and Constants
1302 \brief Miscellaneous Addresses and Constants
1303 \ingroup pvr_registers
1304
1305 Useful PVR memory locations and values.
1306
1307 @{
1308*/
1309#define PVR_TA_INPUT 0x10000000 /**< \brief TA command input (64-bit, TA) */
1310#define PVR_TA_YUV_CONV 0x10800000 /**< \brief YUV converter (64-bit, TA) */
1311#define PVR_TA_TEX_MEM 0x11000000 /**< \brief VRAM 64-bit, TA=>VRAM */
1312#define PVR_TA_TEX_MEM_32 0x13000000 /**< \brief VRAM 32-bit, TA->VRAM */
1313#define PVR_RAM_BASE_32_P0 0x05000000 /**< \brief VRAM 32-bit, P0 area, PVR->VRAM */
1314#define PVR_RAM_BASE_64_P0 0x04000000 /**< \brief VRAM 64-bit, P0 area, PVR->VRAM */
1315#define PVR_RAM_BASE 0xa5000000 /**< \brief VRAM 32-bit, P2 area, PVR->VRAM */
1316#define PVR_RAM_INT_BASE 0xa4000000 /**< \brief VRAM 64-bit, P2 area, PVR->VRAM */
1317
1318#define PVR_RAM_SIZE (8*1024*1024) /**< \brief RAM size in bytes */
1319
1320#define PVR_RAM_TOP (PVR_RAM_BASE + PVR_RAM_SIZE) /**< \brief Top of raw PVR RAM */
1321#define PVR_RAM_INT_TOP (PVR_RAM_INT_BASE + PVR_RAM_SIZE) /**< \brief Top of int PVR RAM */
1322/** @} */
1323
1324/* Register content defines, as needed; these will be filled in over time
1325 as the implementation requires them. There's too many to do otherwise. */
1326
1327/** \defgroup pvr_reset_vals Reset Values
1328 \brief Values used to reset parts of the PVR
1329 \ingroup pvr_registers
1330
1331 These values are written to the PVR_RESET register in order to reset the
1332 system or to take it out of reset.
1333
1334 @{
1335*/
1336#define PVR_RESET_ALL 0xffffffff /**< \brief Reset the whole PVR */
1337#define PVR_RESET_NONE 0x00000000 /**< \brief Cancel reset state */
1338#define PVR_RESET_TA 0x00000001 /**< \brief Reset only the TA */
1339#define PVR_RESET_ISPTSP 0x00000002 /**< \brief Reset only the ISP/TSP */
1340/** @} */
1341
1342/** \defgroup pvr_go Init/Start Values
1343 \brief Values to be written to registers to conform or start operations.
1344 \ingroup pvr_registers
1345 @{
1346*/
1347#define PVR_ISP_START_GO 0xffffffff /**< \brief Write to the PVR_ISP_START register to start rendering */
1348
1349#define PVR_TA_INIT_GO 0x80000000 /**< \brief Write to the PVR_TA_INIT register to confirm settings */
1350/** @} */
1351
1352/* Initialization ****************************************************/
1353/** \defgroup pvr_init Initialization
1354 \brief Driver initialization and shutdown
1355 \ingroup pvr
1356
1357 Initialization and shutdown: stuff you should only ever have to do
1358 once in your program.
1359*/
1360
1361/** \defgroup pvr_binsizes Primitive Bin Sizes
1362 \brief Available sizes for primitive bins
1363 \ingroup pvr_init
1364 @{
1365*/
1366#define PVR_BINSIZE_0 0 /**< \brief 0-length (disables the list) */
1367#define PVR_BINSIZE_8 8 /**< \brief 8-word (32-byte) length */
1368#define PVR_BINSIZE_16 16 /**< \brief 16-word (64-byte) length */
1369#define PVR_BINSIZE_32 32 /**< \brief 32-word (128-byte) length */
1370/** @} */
1371
1372/** \brief PVR initialization structure
1373 \ingroup pvr_init
1374
1375 This structure defines how the PVR initializes various parts of the system,
1376 including the primitive bin sizes, the vertex buffer size, and whether
1377 vertex DMA will be enabled.
1378
1379 You essentially fill one of these in, and pass it to pvr_init().
1380
1381 \headerfile dc/pvr.h
1382*/
1383typedef struct {
1384 /** \brief Bin sizes.
1385
1386 The bins go in the following order: opaque polygons, opaque modifiers,
1387 translucent polygons, translucent modifiers, punch-thrus
1388 */
1389 int opb_sizes[5];
1390
1391 /** \brief Vertex buffer size (should be a nice round number) */
1393
1394 /** \brief Enable vertex DMA?
1395
1396 Set to non-zero if we want to enable vertex DMA mode. Note that if this
1397 is set, then _all_ enabled lists need to have a vertex buffer assigned,
1398 even if you never use that list for anything.
1399 */
1401
1402 /** \brief Enable horizontal scaling?
1403
1404 Set to non-zero if horizontal scaling is to be enabled. By enabling this
1405 setting and stretching your image to double the native screen width, you
1406 can get horizontal full-screen anti-aliasing. */
1408
1409 /** \brief Disable translucent polygon autosort?
1410
1411 Set to non-zero to disable translucent polygon autosorting. By enabling
1412 this setting, the PVR acts more like a traditional Z-buffered system
1413 when rendering translucent polygons, meaning you must pre-sort them
1414 yourself if you want them to appear in the right order. */
1416
1417
1418 /** \brief OPB Overflow Count.
1419
1420 Preallocates this many extra OPBs (sets of tile bins), allowing the PVR
1421 to use the extra space when there's too much geometry in the first OPB.
1422
1423 Increasing this value can eliminate artifacts where pieces of geometry
1424 flicker in and out of existence along the tile boundaries. */
1425
1427
1429
1430/** \brief Initialize the PVR chip to ready status.
1431 \ingroup pvr_init
1432
1433 This function enables the specified lists and uses the specified parameters.
1434 Note that bins and vertex buffers come from the texture memory pool, so only
1435 allocate what you actually need. Expects that a 2D mode was initialized
1436 already using the vid_* API.
1437
1438 \param params The set of parameters to initialize with
1439 \retval 0 On success
1440 \retval -1 If the PVR has already been initialized or the video
1441 mode active is not suitable for 3D
1442*/
1444
1445/** \brief Simple PVR initialization.
1446 \ingroup pvr_init
1447
1448 This simpler function initializes the PVR using 16/16 for the opaque
1449 and translucent lists' bin sizes, and 0's for everything else. It sets 512KB
1450 of vertex buffer. This is equivalent to the old ta_init_defaults() for now.
1451
1452 \retval 0 On success
1453 \retval -1 If the PVR has already been initialized or the video
1454 mode active is not suitable for 3D
1455*/
1457
1458/** \brief Shut down the PVR chip from ready status.
1459 \ingroup pvr_init
1460
1461 This essentially leaves the video system in 2D mode as it was before the
1462 init.
1463
1464 \retval 0 On success
1465 \retval -1 If the PVR has not been initialized
1466*/
1468
1469
1470/* Misc parameters ***************************************************/
1471
1472/** \defgroup pvr_global Global State
1473 \brief PowerVR functionality which is managed globally
1474 \ingroup pvr
1475
1476 These are miscellaneous parameters you can set which affect the
1477 rendering process.
1478*/
1479
1480/** \brief Set the background plane color.
1481 \ingroup pvr_global
1482
1483 This function sets the color of the area of the screen not covered by any
1484 other polygons.
1485
1486 \param r Red component of the color to set
1487 \param g Green component of the color to set
1488 \param b Blue component of the color to set
1489*/
1490void pvr_set_bg_color(float r, float g, float b);
1491
1492/** \brief Set cheap shadow parameters.
1493 \ingroup pvr_global
1494
1495 This function sets up the PVR cheap shadow parameters for use. You can only
1496 specify one scale value per frame, so the effect that you can get from this
1497 is somewhat limited, but if you want simple shadows, this is the easiest way
1498 to do it.
1499
1500 Polygons affected by a shadow modifier volume will effectively multiply
1501 their final color by the scale value set here when shadows are enabled and
1502 the polygon is inside the modifier (or outside for exclusion volumes).
1503
1504 \param enable Set to non-zero to enable cheap shadow mode.
1505 \param scale_value Floating point value (between 0 and 1) representing
1506 how colors of polygons affected by and inside the
1507 volume will be modified by the shadow volume.
1508*/
1509void pvr_set_shadow_scale(int enable, float scale_value);
1510
1511/** \brief Set Z clipping depth.
1512 \ingroup pvr_global
1513
1514 This function sets the Z clipping depth. The default value for this is
1515 0.0001.
1516
1517 \param zc The new value to set the z clip parameter to.
1518*/
1519void pvr_set_zclip(float zc);
1520
1521/** \brief Retrieve the current VBlank count.
1522 \ingroup pvr_stats
1523
1524 This function retrieves the number of VBlank interrupts that have occurred
1525 since the PVR was initialized.
1526
1527 \return The number of VBlanks since init
1528*/
1530
1531/** \defgroup pvr_stats Profiling
1532 \brief Rendering stats and metrics for profiling
1533 \ingroup pvr
1534*/
1535
1536/** \brief PVR statistics structure.
1537 \ingroup pvr_stats
1538
1539 This structure is used to hold various statistics about the operation of the
1540 PVR since initialization.
1541
1542 \headerfile dc/pvr.h
1543*/
1544typedef struct pvr_stats {
1545 uint64_t frame_last_time; /**< \brief Ready-to-Ready length for the last frame in nanoseconds */
1546 uint64_t reg_last_time; /**< \brief Registration time for the last frame in nanoseconds */
1547 uint64_t rnd_last_time; /**< \brief Rendering time for the last frame in nanoseconds */
1548 uint64_t buf_last_time; /**< \brief DMA buffer file time for the last frame in nanoseconds */
1549 size_t frame_count; /**< \brief Total number of rendered/viewed frames */
1550 size_t vbl_count; /**< \brief VBlank count */
1551 size_t vtx_buffer_used; /**< \brief Number of bytes used in the vertex buffer for the last frame */
1552 size_t vtx_buffer_used_max; /**< \brief Number of bytes used in the vertex buffer for the largest frame */
1553 float frame_rate; /**< \brief Current frame rate (per second) */
1554 uint32_t enabled_list_mask; /**< \brief Which lists are enabled? */
1555 /* ... more later as it's implemented ... */
1556} pvr_stats_t;
1557
1558/** \brief Get the current statistics from the PVR.
1559 \ingroup pvr_stats
1560
1561 This function fills in the pvr_stats_t structure passed in with the current
1562 statistics of the system.
1563
1564 \param stat The statistics structure to fill in. Must not be
1565 NULL
1566 \retval 0 On success
1567 \retval -1 If the PVR is not initialized
1568*/
1570
1571
1572/* Palette management ************************************************/
1573/** \defgroup pvr_pal_mgmt Palettes
1574 \brief Color palette management API of the PowerVR
1575 \ingroup pvr_global
1576
1577 In addition to its 16-bit truecolor modes, the PVR also supports some
1578 nice paletted modes.
1579
1580 \remark
1581 These aren't useful for super high quality images most of the time,
1582 but they can be useful for doing some interesting special effects,
1583 like the old cheap "worm hole".
1584*/
1585
1586/** \defgroup pvr_palfmt Formats
1587 \brief Color palette formats of the PowerVR
1588 \ingroup pvr_pal_mgmt
1589
1590 Entries in the PVR's palettes can be of any of these formats. Note that you
1591 can only have one format active at a time.
1592
1593 @{
1594*/
1595typedef enum pvr_palfmt {
1596 PVR_PAL_ARGB1555, /**< \brief 16-bit ARGB1555 palette format */
1597 PVR_PAL_RGB565, /**< \brief 16-bit RGB565 palette format */
1598 PVR_PAL_ARGB4444, /**< \brief 16-bit ARGB4444 palette format */
1599 PVR_PAL_ARGB8888, /**< \brief 32-bit ARGB8888 palette format */
1600} pvr_palfmt_t;
1601/** @} */
1602
1603/** \brief Set the palette format.
1604 \ingroup pvr_pal_mgmt
1605
1606 This function sets the currently active palette format on the PVR. Each
1607 entry in the palette table is 32-bits in length, regardless of what color
1608 format is in use.
1609
1610 Be sure to use care when using the PVR_PAL_ARGB8888 format. Rendering speed
1611 is greatly affected (cut about in half) if you use any filtering with
1612 paletted textures with ARGB8888 entries in the palette.
1613
1614 \param fmt The format to use
1615 \see pvr_palfmt_t
1616*/
1618
1619/** \brief Set a palette value.
1620 \ingroup pvr_pal_mgmt
1621
1622 Note that while the color format is variable, each entry is still 32-bits in
1623 length regardless (and you only get a total of 1024 of them). If using one
1624 of the 16-bit palette formats, only the low-order 16-bits of the entry are
1625 valid, and the high bits should be filled in with 0.
1626
1627 \param idx The index to set to (0-1023)
1628 \param value The color value to set in that palette entry
1629*/
1630static inline void pvr_set_pal_entry(uint32_t idx, uint32_t value) {
1631 PVR_SET(PVR_PALETTE_TABLE_BASE + 4 * idx, value);
1632}
1633
1634
1635/* Hardware Fog parameters *******************************************/
1636/** \defgroup pvr_fog Fog
1637 \brief Hardware Fog API for the PowerVR
1638 \ingroup pvr_global
1639
1640 \note
1641 Thanks to Paul Boese for figuring this stuff out
1642*/
1643
1644/** \brief Set the table fog color.
1645 \ingroup pvr_fog
1646
1647 This function sets the color of fog for table fog. 0-1 range for all colors.
1648
1649 \param a Alpha value of the fog
1650 \param r Red value of the fog
1651 \param g Green value of the fog
1652 \param b Blue value of the fog
1653*/
1654void pvr_fog_table_color(float a, float r, float g, float b);
1655
1656/** \brief Set the vertex fog color.
1657 \ingroup pvr_fog
1658
1659 This function sets the fog color for vertex fog. 0-1 range for all colors.
1660 This function is currently not implemented, as vertex fog is not supported
1661 by KOS. Calling this function will cause an assertion failure.
1662
1663 \param a Alpha value of the fog
1664 \param r Red value of the fog
1665 \param g Green value of the fog
1666 \param b Blue value of the fog
1667*/
1668void pvr_fog_vertex_color(float a, float r, float g, float b);
1669
1670/** \brief Set the fog far depth.
1671 \ingroup pvr_fog
1672
1673 This function sets the PVR_FOG_DENSITY register appropriately for the
1674 specified value.
1675
1676 \param d The depth to set
1677*/
1678void pvr_fog_far_depth(float d);
1679
1680/** \brief Initialize the fog table using an exp2 algorithm (like GL_EXP2).
1681 \ingroup pvr_fog
1682
1683 This function will automatically set the PVR_FOG_DENSITY register to
1684 259.999999 as a part of its processing, then set up the fog table.
1685
1686 \param density Fog density value
1687*/
1688void pvr_fog_table_exp2(float density);
1689
1690/** \brief Initialize the fog table using an exp algorithm (like GL_EXP).
1691 \ingroup pvr_fog
1692
1693 This function will automatically set the PVR_FOG_DENSITY register to
1694 259.999999 as a part of its processing, then set up the fog table.
1695
1696 \param density Fog density value
1697*/
1698void pvr_fog_table_exp(float density);
1699
1700/** \brief Initialize the fog table using a linear algorithm (like GL_LINEAR).
1701 \ingroup pvr_fog
1702
1703 This function will set the PVR_FOG_DENSITY register to the as appropriate
1704 for the end value, and initialize the fog table for perspectively correct
1705 linear fog.
1706
1707 \param start Fog start point
1708 \param end Fog end point
1709*/
1710void pvr_fog_table_linear(float start, float end);
1711
1712/** \brief Set a custom fog table from float values
1713 \ingroup pvr_fog
1714
1715 This function allows you to specify whatever values you need to for your fog
1716 parameters. All values should be clamped between 0 and 1, and its your
1717 responsibility to set up the PVR_FOG_DENSITY register by calling
1718 pvr_fog_far_depth() with an appropriate value. The table passed in should
1719 have 129 entries, where the 0th entry is farthest from the eye and the last
1720 entry is nearest. Higher values = heavier fog.
1721
1722 \param tbl1 The table of fog values to set
1723*/
1724void pvr_fog_table_custom(float tbl1[]);
1725
1726
1727/* Memory management *************************************************/
1728
1729/** \defgroup pvr_vram VRAM
1730 \brief Video memory access and management
1731 \ingroup pvr
1732*/
1733
1734/** \defgroup pvr_mem_mgmt Allocator
1735 \brief Memory management API for VRAM
1736 \ingroup pvr_vram
1737
1738 PVR memory management in KOS uses a modified dlmalloc; see the
1739 source file pvr_mem_core.c for more info.
1740*/
1741
1742/** \brief Allocate a chunk of memory from texture space.
1743 \ingroup pvr_mem_mgmt
1744
1745 This function acts as the memory allocator for the PVR texture RAM pool. It
1746 acts exactly as one would expect a malloc() function to act, returning a
1747 normal pointer that can be directly written to if one desires to do so. All
1748 allocations will be aligned to a 32-byte boundary.
1749
1750 \param size The amount of memory to allocate
1751
1752 \return A pointer to the memory on success, NULL on error
1753*/
1755
1756/** \brief Free a block of allocated memory in the PVR RAM pool.
1757 \ingroup pvr_mem_mgmt
1758
1759 This function frees memory previously allocated with pvr_mem_malloc().
1760
1761 \param chunk The location of the start of the block to free
1762*/
1764
1765/** \brief Return the number of bytes available still in the PVR RAM pool.
1766 \ingroup pvr_mem_mgmt
1767
1768 \return The number of bytes available
1769*/
1770uint32_t pvr_mem_available(void);
1771
1772/** \brief Reset the PVR RAM pool.
1773 \ingroup pvr_mem_mgmt
1774
1775 This will essentially free any blocks allocated within the pool. There's
1776 generally not many good reasons for doing this.
1777*/
1778void pvr_mem_reset(void);
1779
1780/** \brief Print the list of allocated blocks in the PVR RAM pool.
1781 \ingroup pvr_mem_mgmt
1782
1783 This function only works if you've enabled KM_DBG in pvr_mem.c.
1784*/
1786
1787/** \brief Print statistics about the PVR RAM pool.
1788 \ingroup pvr_mem_mgmt
1789
1790 This prints out statistics like what malloc_stats() provides. Also, if
1791 KM_DBG is enabled in pvr_mem.c, it prints the list of allocated blocks.
1792*/
1793void pvr_mem_stats(void);
1794
1795/* Scene rendering ***************************************************/
1796/** \defgroup pvr_scene_mgmt Scene Submission
1797 \brief PowerVR API for submitting scene geometry
1798 \ingroup pvr
1799
1800 This API is used to submit triangle strips to the PVR via the TA
1801 interface in the chip.
1802
1803 An important side note about the PVR is that all primitive types
1804 must be submitted grouped together. If you have 10 polygons for each
1805 list type, then the PVR must receive them via the TA by list type,
1806 with a list delimiter in between.
1807
1808 So there are two modes you can use here. The first mode allows you to
1809 submit data directly to the TA. Your data will be forwarded to the
1810 chip for processing as it is fed to the PVR module. If your data
1811 is easily sorted into the primitive types, then this is the fastest
1812 mode for submitting data.
1813
1814 The second mode allows you to submit data via main-RAM vertex buffers,
1815 which will be queued until the proper primitive type is active. In this
1816 case, each piece of data is copied into the vertex buffer while the
1817 wrong list is activated, and when the proper list becomes activated,
1818 the data is all sent at once. Ideally this would be via DMA, right
1819 now it is by store queues. This has the advantage of allowing you to
1820 send data in any order and have the PVR functions resolve how it should
1821 get sent to the hardware, but it is slower.
1822
1823 The nice thing is that any combination of these modes can be used. You
1824 can assign a vertex buffer for any list, and it will be used to hold the
1825 incoming vertex data until the proper list has come up. Or if the proper
1826 list is already up, the data will be submitted directly. So if most of
1827 your polygons are opaque, and you only have a couple of translucents,
1828 you can set a small buffer to gather translucent data and then it will
1829 get sent when you do a pvr_end_scene().
1830
1831 Thanks to Mikael Kalms for the idea for this API.
1832
1833 \note
1834 Another somewhat subtle point that bears mentioning is that in the normal
1835 case (interrupts enabled) an interrupt handler will automatically take
1836 care of starting a frame rendering (after scene_finish()) and also
1837 flipping pages when appropriate.
1838*/
1839
1840/** \defgroup pvr_vertex_dma Vertex DMA
1841 \brief Use the DMA to transfer inactive lists to the PVR
1842 \ingroup pvr_scene_mgmt
1843*/
1844
1845/** \brief Is vertex DMA enabled?
1846 \ingroup pvr_vertex_dma
1847
1848 \return Non-zero if vertex DMA was enabled at init time
1849*/
1851
1852/** \brief Setup a vertex buffer for one of the list types.
1853 \ingroup pvr_list_mgmt
1854
1855 If the specified list type already has a vertex buffer, it will be replaced
1856 by the new one.
1857
1858 \note
1859 Each buffer should actually be twice as long as what you will need to hold
1860 two frames worth of data).
1861
1862 \warning
1863 You should generally not try to do this at any time besides before a frame
1864 is begun, or Bad Things May Happen.
1865
1866 \param list The primitive list to set the buffer for.
1867 \param buffer The location of the buffer in main RAM. This must be
1868 aligned to a 32-byte boundary.
1869 \param len The length of the buffer. This must be a multiple of
1870 64, and must be at least 128 (even if you're not
1871 using the list).
1872
1873 \return The old buffer location (if any)
1874*/
1875void *pvr_set_vertbuf(pvr_list_t list, void *buffer, int len);
1876
1877/** \brief Retrieve a pointer to the current output location in the DMA buffer
1878 for the requested list.
1879 \ingroup pvr_vertex_dma
1880
1881 Vertex DMA must globally be enabled for this to work. Data may be added to
1882 this buffer by the user program directly; however, make sure to call
1883 pvr_vertbuf_written() to notify the system of any such changes.
1884
1885 \param list The primitive list to get the buffer for.
1886
1887 \return The tail of that list's buffer.
1888*/
1890
1891/** \brief Notify the PVR system that data have been written into the output
1892 buffer for the given list.
1893 \ingroup pvr_vertex_dma
1894
1895 This should always be done after writing data directly to these buffers or
1896 it will get overwritten by other data.
1897
1898 \param list The primitive list that was modified.
1899 \param amt Number of bytes written. Must be a multiple of 32.
1900*/
1901void pvr_vertbuf_written(pvr_list_t list, uint32_t amt);
1902
1903/** \brief Set the translucent polygon sort mode for the next frame.
1904 \ingroup pvr_scene_mgmt
1905
1906 This function sets the translucent polygon sort mode for the next frame of
1907 output, potentially switching between autosort and presort mode.
1908
1909 For most programs, you'll probably want to set this at initialization time
1910 (with the autosort_disabled field in the pvr_init_params_t structure) and
1911 not mess with it per-frame. It is recommended that if you do use this
1912 function to change the mode that you should set it each frame to ensure that
1913 the mode is set properly.
1914
1915 \param presort Set to 1 to set the presort mode for translucent
1916 polygons, set to 0 to use autosort mode.
1917*/
1918void pvr_set_presort_mode(int presort);
1919
1920/** \brief Begin collecting data for a frame of 3D output to the off-screen
1921 frame buffer.
1922 \ingroup pvr_scene_mgmt
1923
1924 You must call this function (or pvr_scene_begin_txr()) for ever frame of
1925 output.
1926*/
1928
1929/** \brief Begin collecting data for a frame of 3D output to the specified
1930 texture.
1931 \ingroup pvr_scene_mgmt
1932
1933 This function currently only supports outputting at the same size as the
1934 actual screen. Thus, make sure rx and ry are at least large enough for that.
1935 For a 640x480 output, rx will generally be 1024 on input and ry 512, as
1936 these are the smallest values that are powers of two and will hold the full
1937 screen sized output.
1938
1939 \param txr The texture to render to.
1940 \param rx Width of the texture buffer (in pixels).
1941 \param ry Height of the texture buffer (in pixels).
1942*/
1943void pvr_scene_begin_txr(pvr_ptr_t txr, uint32_t *rx, uint32_t *ry);
1944
1945
1946/** \defgroup pvr_list_mgmt Polygon Lists
1947 \brief PVR API for managing list submission
1948 \ingroup pvr_scene_mgmt
1949*/
1950
1951/** \brief Begin collecting data for the given list type.
1952 \ingroup pvr_list_mgmt
1953
1954 Lists do not have to be submitted in any particular order, but all types of
1955 a list must be submitted at once (unless vertex DMA mode is enabled).
1956
1957 Note that there is no need to call this function in DMA mode unless you want
1958 to make use of pvr_prim() for compatibility. This function will
1959 automatically call pvr_list_finish() if a list is already opened before
1960 opening the new list.
1961
1962 \param list The list to open.
1963 \retval 0 On success.
1964 \retval -1 If the specified list has already been closed.
1965*/
1967
1968/** \brief End collecting data for the current list type.
1969 \ingroup pvr_list_mgmt
1970
1971 Lists can never be opened again within a single frame once they have been
1972 closed. Thus submitting a primitive that belongs in a closed list is
1973 considered an error. Closing a list that is already closed is also an error.
1974
1975 Note that if you open a list but do not submit any primitives, a blank one
1976 will be submitted to satisfy the hardware. If vertex DMA mode is enabled,
1977 then this simply sets the current list pointer to no list, and none of the
1978 above restrictions apply.
1979
1980 \retval 0 On success.
1981 \retval -1 On error.
1982*/
1984
1985/** \brief Submit a primitive of the current list type.
1986 \ingroup pvr_list_mgmt
1987
1988 Note that any values submitted in this fashion will go directly to the
1989 hardware without any sort of buffering, and submitting a primitive of the
1990 wrong type will quite likely ruin your scene. Note that this also will not
1991 work if you haven't begun any list types (i.e., all data is queued). If DMA
1992 is enabled, the primitive will be appended to the end of the currently
1993 selected list's buffer.
1994
1995 \warning
1996 \p data must be 32-byte aligned!
1997
1998 \param data The primitive to submit.
1999 \param size The length of the primitive, in bytes. Must be a
2000 multiple of 32.
2001
2002 \retval 0 On success.
2003 \retval -1 On error.
2004*/
2005int pvr_prim(void *data, int size);
2006
2007/** \defgroup pvr_direct Direct Rendering
2008 \brief API for using direct rendering with the PVR
2009 \ingroup pvr_scene_mgmt
2010
2011 @{
2012*/
2013
2014/** \brief Direct Rendering state variable type. */
2015typedef uint32_t pvr_dr_state_t;
2016
2017/** \brief Initialize a state variable for Direct Rendering.
2018
2019 Store Queues are used.
2020
2021 \param vtx_buf_ptr A variable of type pvr_dr_state_t to init.
2022*/
2023void pvr_dr_init(pvr_dr_state_t *vtx_buf_ptr);
2024
2025/** \brief Obtain the target address for Direct Rendering.
2026
2027 \param vtx_buf_ptr State variable for Direct Rendering. Should be of
2028 type pvr_dr_state_t, and must have been initialized
2029 previously in the scene with pvr_dr_init().
2030
2031 \return A write-only destination address where a primitive
2032 should be written to get ready to submit it to the
2033 TA in DR mode.
2034*/
2035#define pvr_dr_target(vtx_buf_ptr) \
2036 ({ (vtx_buf_ptr) ^= 32; \
2037 (pvr_vertex_t *)(MEM_AREA_SQ_BASE | (vtx_buf_ptr)); \
2038 })
2039
2040/** \brief Commit a primitive written into the Direct Rendering target address.
2041
2042 \param addr The address returned by pvr_dr_target(), after you
2043 have written the primitive to it.
2044*/
2045#define pvr_dr_commit(addr) sq_flush(addr)
2046
2047/** \brief Finish work with Direct Rendering.
2048
2049 Called atomatically in pvr_scene_finish().
2050 Use it manually if you want to release Store Queues earlier.
2051
2052*/
2053void pvr_dr_finish(void);
2054
2055/** \brief Upload a 32-byte payload to the Tile Accelerator
2056
2057 Upload the given payload to the Tile Accelerator. The difference with the
2058 Direct Rendering approach above is that the Store Queues are not used, and
2059 therefore can be used for anything else.
2060
2061 \param data A pointer to the 32-byte payload.
2062 The pointer must be aligned to 8 bytes.
2063*/
2064void pvr_send_to_ta(void *data);
2065
2066/** @} */
2067
2068/** \brief Submit a primitive of the given list type.
2069 \ingroup pvr_list_mgmt
2070
2071 Data will be queued in a vertex buffer, thus one must be available for the
2072 list specified (will be asserted by the code).
2073
2074 \param list The list to submit to.
2075 \param data The primitive to submit.
2076 \param size The size of the primitive in bytes. This must be a
2077 multiple of 32.
2078
2079 \retval 0 On success.
2080 \retval -1 On error.
2081*/
2082int pvr_list_prim(pvr_list_t list, void *data, int size);
2083
2084/** \brief Flush the buffered data of the given list type to the TA.
2085 \ingroup pvr_list_mgmt
2086
2087 This function is currently not implemented, and calling it will result in an
2088 assertion failure. It is intended to be used later in a "hybrid" mode where
2089 both direct and DMA TA submission is possible.
2090
2091 \param list The list to flush.
2092
2093 \retval -1 On error (it is not possible to succeed).
2094*/
2096
2097/** \brief Call this after you have finished submitting all data for a frame.
2098 \ingroup pvr_scene_mgmt
2099
2100 Once this has been called, you can not submit any more data until one of the
2101 pvr_scene_begin() or pvr_scene_begin_txr() functions is called again.
2102
2103 \retval 0 On success.
2104 \retval -1 On error (no scene started).
2105*/
2107
2108/** \brief Block the caller until the PVR system is ready for another frame to
2109 be submitted.
2110 \ingroup pvr_scene_mgmt
2111
2112 The PVR system allocates enough space for two frames: one in data collection
2113 mode, and another in rendering mode. If a frame is currently rendering, and
2114 another frame has already been closed, then the caller cannot do anything
2115 else until the rendering frame completes. Note also that the new frame
2116 cannot be activated except during a vertical blanking period, so this
2117 essentially waits until a rendered frame is complete and a vertical blank
2118 happens.
2119
2120 \retval 0 On success. A new scene can be started now.
2121 \retval -1 On error. Something is probably very wrong...
2122*/
2124
2125/** \brief Check if the PVR system is ready for another frame to be submitted.
2126 \ingroup pvr_scene_mgmt
2127
2128 \retval 0 If the PVR is ready for a new scene. You must call
2129 pvr_wait_ready() afterwards, before starting a new
2130 scene.
2131 \retval -1 If the PVR is not ready for a new scene yet.
2132*/
2134
2135
2136/* Primitive handling ************************************************/
2137
2138/** \defgroup pvr_primitives_compilation Compilation
2139 \brief API for compiling primitive contexts
2140 into headers
2141 \ingroup pvr_ctx
2142*/
2143
2144/** \brief Compile a polygon context into a polygon header.
2145 \ingroup pvr_primitives_compilation
2146
2147 This function compiles a pvr_poly_cxt_t into the form needed by the hardware
2148 for rendering. This is for use with normal polygon headers.
2149
2150 \param dst Where to store the compiled header.
2151 \param src The context to compile.
2152*/
2154
2155/** \defgroup pvr_ctx_init Initialization
2156 \brief Functions for initializing PVR polygon contexts
2157 \ingroup pvr_ctx
2158*/
2159
2160/** \brief Fill in a polygon context for non-textured polygons.
2161 \ingroup pvr_ctx_init
2162
2163 This function fills in a pvr_poly_cxt_t with default parameters appropriate
2164 for rendering a non-textured polygon in the given list.
2165
2166 \param dst Where to store the polygon context.
2167 \param list The primitive list to be used.
2168*/
2170
2171/** \brief Fill in a polygon context for a textured polygon.
2172 \ingroup pvr_ctx_init
2173
2174 This function fills in a pvr_poly_cxt_t with default parameters appropriate
2175 for rendering a textured polygon in the given list.
2176
2177 \param dst Where to store the polygon context.
2178 \param list The primitive list to be used.
2179 \param textureformat The format of the texture used.
2180 \param tw The width of the texture, in pixels.
2181 \param th The height of the texture, in pixels.
2182 \param textureaddr A pointer to the texture.
2183 \param filtering The type of filtering to use.
2184
2185 \see pvr_txr_fmts
2186 \see pvr_filter_modes
2187*/
2189 int textureformat, int tw, int th, pvr_ptr_t textureaddr,
2190 int filtering);
2191
2192/** \brief Compile a sprite context into a sprite header.
2193 \ingroup pvr_primitives_compilation
2194
2195 This function compiles a pvr_sprite_cxt_t into the form needed by the
2196 hardware for rendering. This is for use with sprite headers.
2197
2198 \param dst Where to store the compiled header.
2199 \param src The context to compile.
2200*/
2202 const pvr_sprite_cxt_t *src);
2203
2204/** \brief Fill in a sprite context for non-textured sprites.
2205 \ingroup pvr_ctx_init
2206
2207 This function fills in a pvr_sprite_cxt_t with default parameters
2208 appropriate for rendering a non-textured sprite in the given list.
2209
2210 \param dst Where to store the sprite context.
2211 \param list The primitive list to be used.
2212*/
2214
2215/** \brief Fill in a sprite context for a textured sprite.
2216 \ingroup pvr_ctx_init
2217
2218 This function fills in a pvr_sprite_cxt_t with default parameters
2219 appropriate for rendering a textured sprite in the given list.
2220
2221 \param dst Where to store the sprite context.
2222 \param list The primitive list to be used.
2223 \param textureformat The format of the texture used.
2224 \param tw The width of the texture, in pixels.
2225 \param th The height of the texture, in pixels.
2226 \param textureaddr A pointer to the texture.
2227 \param filtering The type of filtering to use.
2228
2229 \see pvr_txr_fmts
2230 \see pvr_filter_modes
2231*/
2233 int textureformat, int tw, int th, pvr_ptr_t textureaddr,
2234 int filtering);
2235
2236/** \brief Create a modifier volume header.
2237 \ingroup pvr_primitives_compilation
2238
2239 This function fills in a modifier volume header with the parameters
2240 specified. Note that unlike for polygons and sprites, there is no context
2241 step for modifiers.
2242
2243 \param dst Where to store the modifier header.
2244 \param list The primitive list to be used.
2245 \param mode The mode for this modifier.
2246 \param cull The culling mode to use.
2247
2248 \see pvr_mod_modes
2249 \see pvr_cull_modes
2250*/
2251void pvr_mod_compile(pvr_mod_hdr_t *dst, pvr_list_t list, uint32_t mode,
2252 uint32_t cull);
2253
2254/** \brief Compile a polygon context into a polygon header that is affected by
2255 modifier volumes.
2256 \ingroup pvr_primitives_compilation
2257
2258 This function works pretty similarly to pvr_poly_compile(), but compiles
2259 into the header type that is affected by a modifier volume. The context
2260 should have been created with either pvr_poly_cxt_col_mod() or
2261 pvr_poly_cxt_txr_mod().
2262
2263 \param dst Where to store the compiled header.
2264 \param src The context to compile.
2265*/
2267
2268/** \brief Fill in a polygon context for non-textured polygons affected by a
2269 modifier volume.
2270 \ingroup pvr_ctx_init
2271
2272 This function fills in a pvr_poly_cxt_t with default parameters appropriate
2273 for rendering a non-textured polygon in the given list that will be affected
2274 by modifier volumes.
2275
2276 \param dst Where to store the polygon context.
2277 \param list The primitive list to be used.
2278*/
2280
2281/** \brief Fill in a polygon context for a textured polygon affected by
2282 modifier volumes.
2283 \ingroup pvr_ctx_init
2284
2285 This function fills in a pvr_poly_cxt_t with default parameters appropriate
2286 for rendering a textured polygon in the given list and being affected by
2287 modifier volumes.
2288
2289 \param dst Where to store the polygon context.
2290 \param list The primitive list to be used.
2291 \param textureformat The format of the texture used (outside).
2292 \param tw The width of the texture, in pixels (outside).
2293 \param th The height of the texture, in pixels (outside).
2294 \param textureaddr A pointer to the texture (outside).
2295 \param filtering The type of filtering to use (outside).
2296 \param textureformat2 The format of the texture used (inside).
2297 \param tw2 The width of the texture, in pixels (inside).
2298 \param th2 The height of the texture, in pixels (inside).
2299 \param textureaddr2 A pointer to the texture (inside).
2300 \param filtering2 The type of filtering to use (inside).
2301
2302 \see pvr_txr_fmts
2303 \see pvr_filter_modes
2304*/
2306 int textureformat, int tw, int th,
2307 pvr_ptr_t textureaddr, int filtering,
2308 int textureformat2, int tw2, int th2,
2309 pvr_ptr_t textureaddr2, int filtering2);
2310
2311/* Texture handling **************************************************/
2312/** \defgroup pvr_txr_mgmt Texturing
2313 \brief API for managing PowerVR textures
2314 \ingroup pvr
2315
2316 Helper functions for handling texture tasks of various kinds.
2317*/
2318
2319/** \brief Set the global stride width for non-power-of-two textures in PVR RAM.
2320 \ingroup pvr_txr_mgmt
2321
2322 This function configures the global texture stride register
2323 `PVR_TXR_STRIDE_MULT`, which defines the row width in VRAM for
2324 non-power-of-two textures. The setting applies to all textures
2325 rendered with the `PVR_TXRFMT_X32_STRIDE` flag in the same frame.
2326 Since `PVR_TXR_STRIDE_MULT` is a global register, all textures
2327 using this flag must share the same stride width in each frame.
2328
2329 The stride width configured here is **only supported for textures
2330 with widths that are multiples of 32 pixels** and up to a maximum
2331 of 992 pixels. Any texture width not meeting this requirement will
2332 not work with the `PVR_TXRFMT_X32_STRIDE` flag.
2333
2334 \warning
2335 - Textures that are palette-based cannot use the `PVR_TXRFMT_X32_STRIDE`
2336 flag so the stride set here will not apply to them.
2337
2338 \param texture_width The width of the texture in pixels. Must be a
2339 multiple of 32 and up to 992 pixels.
2340 \retval true On success.
2341 \retval false On failure.
2342
2343 \sa pvr_txr_get_stride()
2344*/
2345bool pvr_txr_set_stride(uint32_t texture_width);
2346
2347/** \brief Get the current texture stride width in pixels as set in the PVR.
2348 \ingroup pvr_txr_mgmt
2349
2350 This function reads the `PVR_TXR_STRIDE_MULT` register and calculates the
2351 texture stride width in pixels. The value returned is the width in pixels
2352 that has been configured for all textures using the `PVR_TXRFMT_X32_STRIDE`
2353 flag in the same frame.
2354
2355 The stride width is computed by taking the current multiplier in
2356 `PVR_TXR_STRIDE_MULT` (which stores the width divided by 32), and
2357 multiplying it back by 32 to return the full width in pixels.
2358
2359 \return The current texture stride width in pixels.
2360
2361 \sa pvr_txr_set_stride()
2362*/
2363uint32_t pvr_txr_get_stride(void);
2364
2365/** \brief Load raw texture data from an SH-4 buffer into PVR RAM.
2366 \ingroup pvr_txr_mgmt
2367
2368 This essentially just acts as a memcpy() from main RAM to PVR RAM, using
2369 the Store Queues and 64-bit TA bus.
2370
2371 \param src The location in main RAM holding the texture.
2372 \param dst The location in PVR RAM to copy to.
2373 \param count The size of the texture in bytes (must be a multiple
2374 of 32).
2375*/
2376void pvr_txr_load(const void *src, pvr_ptr_t dst, uint32_t count);
2377
2378/** \defgroup pvr_txrload_constants Flags
2379 \brief Texture loading constants
2380 \ingroup pvr_txr_mgmt
2381
2382 These are constants for the flags parameter to pvr_txr_load_ex() or
2383 pvr_txr_load_kimg().
2384
2385 @{
2386*/
2387#define PVR_TXRLOAD_4BPP 0x01 /**< \brief 4BPP format */
2388#define PVR_TXRLOAD_8BPP 0x02 /**< \brief 8BPP format */
2389#define PVR_TXRLOAD_16BPP 0x03 /**< \brief 16BPP format */
2390#define PVR_TXRLOAD_FMT_MASK 0x0f /**< \brief Bits used for basic formats */
2391
2392#define PVR_TXRLOAD_VQ_LOAD 0x10 /**< \brief Do VQ encoding (not supported yet, if ever) */
2393#define PVR_TXRLOAD_INVERT_Y 0x20 /**< \brief Invert the Y axis while loading */
2394#define PVR_TXRLOAD_FMT_VQ 0x40 /**< \brief Texture is already VQ encoded */
2395#define PVR_TXRLOAD_FMT_TWIDDLED 0x80 /**< \brief Texture is already twiddled */
2396#define PVR_TXRLOAD_FMT_NOTWIDDLE 0x80 /**< \brief Don't twiddle the texture while loading */
2397#define PVR_TXRLOAD_DMA 0x8000 /**< \brief Use DMA to load the texture */
2398#define PVR_TXRLOAD_NONBLOCK 0x4000 /**< \brief Use non-blocking loads (only for DMA) */
2399#define PVR_TXRLOAD_SQ 0x2000 /**< \brief Use Store Queues to load */
2400
2401/** @} */
2402
2403/** \brief Load texture data from an SH-4 buffer into PVR RAM, twiddling it in
2404 the process.
2405 \ingroup pvr_txr_mgmt
2406
2407 This function loads a texture to the PVR's RAM with the specified set of
2408 flags. It will currently always twiddle the data, whether you ask it to or
2409 not, and many of the parameters are just plain not supported at all...
2410 Pretty much the only supported flag, other than the format ones is the
2411 PVR_TXRLOAD_INVERT_Y one.
2412
2413 This will be slower than using pvr_txr_load() in pretty much all cases, so
2414 unless you need to twiddle your texture, just use that instead.
2415
2416 \param src The location to copy from.
2417 \param dst The location to copy to.
2418 \param w The width of the texture, in pixels.
2419 \param h The height of the texture, in pixels.
2420 \param flags Some set of flags, ORed together.
2421
2422 \see pvr_txrload_constants
2423*/
2424void pvr_txr_load_ex(const void *src, pvr_ptr_t dst,
2425 uint32_t w, uint32_t h, uint32_t flags);
2426
2427/** \brief Load a KOS Platform Independent Image (subject to constraint
2428 checking).
2429 \ingroup pvr_txr_mgmt
2430
2431 This function loads a KOS Platform Independent image to the PVR's RAM with
2432 the specified set of flags. This function, unlike pvr_txr_load_ex() supports
2433 everything in the flags available, other than what's explicitly marked as
2434 not supported.
2435
2436 \param img The image to load.
2437 \param dst The location to copy to.
2438 \param flags Some set of flags, ORed together.
2439
2440 \see pvr_txrload_constants
2441 \note Unless you explicitly tell this function to not
2442 twiddle the texture (by ORing
2443 \ref PVR_TXRLOAD_FMT_NOTWIDDLE or it's equivalent
2444 \ref PVR_TXRLOAD_FMT_TWIDDLED with flags), this
2445 function will twiddle the texture while loading.
2446 Keep that in mind when setting the texture format in
2447 polygon headers later.
2448 \note You cannot specify both
2449 \ref PVR_TXRLOAD_FMT_NOTWIDDLE (or equivalently
2450 \ref PVR_TXRLOAD_FMT_TWIDDLED) and
2451 \ref PVR_TXRLOAD_INVERT_Y in the flags.
2452 \note DMA and Store Queue based loading is not available
2453 from this function if it twiddles the texture while
2454 loading.
2455*/
2456void pvr_txr_load_kimg(const kos_img_t *img, pvr_ptr_t dst, uint32_t flags);
2457
2458
2459
2460__END_DECLS
2461
2462#endif
Cache management functionality.
void pvr_sprite_cxt_txr(pvr_sprite_cxt_t *dst, pvr_list_t list, int textureformat, int tw, int th, pvr_ptr_t textureaddr, int filtering)
Fill in a sprite context for a textured sprite.
void pvr_poly_cxt_col_mod(pvr_poly_cxt_t *dst, pvr_list_t list)
Fill in a polygon context for non-textured polygons affected by a modifier volume.
void pvr_poly_cxt_txr_mod(pvr_poly_cxt_t *dst, pvr_list_t list, int textureformat, int tw, int th, pvr_ptr_t textureaddr, int filtering, int textureformat2, int tw2, int th2, pvr_ptr_t textureaddr2, int filtering2)
Fill in a polygon context for a textured polygon affected by modifier volumes.
void pvr_poly_cxt_txr(pvr_poly_cxt_t *dst, pvr_list_t list, int textureformat, int tw, int th, pvr_ptr_t textureaddr, int filtering)
Fill in a polygon context for a textured polygon.
void pvr_poly_cxt_col(pvr_poly_cxt_t *dst, pvr_list_t list)
Fill in a polygon context for non-textured polygons.
void pvr_sprite_cxt_col(pvr_sprite_cxt_t *dst, pvr_list_t list)
Fill in a sprite context for non-textured sprites.
void pvr_send_to_ta(void *data)
Upload a 32-byte payload to the Tile Accelerator.
void pvr_dr_init(pvr_dr_state_t *vtx_buf_ptr)
Initialize a state variable for Direct Rendering.
uint32_t pvr_dr_state_t
Direct Rendering state variable type.
Definition pvr.h:2015
void pvr_dr_finish(void)
Finish work with Direct Rendering.
void pvr_fog_table_exp2(float density)
Initialize the fog table using an exp2 algorithm (like GL_EXP2).
void pvr_fog_table_linear(float start, float end)
Initialize the fog table using a linear algorithm (like GL_LINEAR).
void pvr_fog_table_custom(float tbl1[])
Set a custom fog table from float values.
void pvr_fog_table_color(float a, float r, float g, float b)
Set the table fog color.
void pvr_fog_far_depth(float d)
Set the fog far depth.
void pvr_fog_table_exp(float density)
Initialize the fog table using an exp algorithm (like GL_EXP).
void pvr_fog_vertex_color(float a, float r, float g, float b)
Set the vertex fog color.
void pvr_set_zclip(float zc)
Set Z clipping depth.
void pvr_set_bg_color(float r, float g, float b)
Set the background plane color.
void pvr_set_shadow_scale(int enable, float scale_value)
Set cheap shadow parameters.
int pvr_shutdown(void)
Shut down the PVR chip from ready status.
int pvr_init_defaults(void)
Simple PVR initialization.
int pvr_init(pvr_init_params_t *params)
Initialize the PVR chip to ready status.
int pvr_list_flush(pvr_list_t list)
Flush the buffered data of the given list type to the TA.
int pvr_list_prim(pvr_list_t list, void *data, int size)
Submit a primitive of the given list type.
void * pvr_set_vertbuf(pvr_list_t list, void *buffer, int len)
Setup a vertex buffer for one of the list types.
int pvr_list_finish(void)
End collecting data for the current list type.
int pvr_prim(void *data, int size)
Submit a primitive of the current list type.
int pvr_list_begin(pvr_list_t list)
Begin collecting data for the given list type.
uint32_t pvr_list_t
PVR list specification.
Definition pvr.h:83
void pvr_mem_reset(void)
Reset the PVR RAM pool.
void pvr_mem_free(pvr_ptr_t chunk)
Free a block of allocated memory in the PVR RAM pool.
void pvr_mem_stats(void)
Print statistics about the PVR RAM pool.
void pvr_mem_print_list(void)
Print the list of allocated blocks in the PVR RAM pool.
pvr_ptr_t pvr_mem_malloc(size_t size)
Allocate a chunk of memory from texture space.
uint32_t pvr_mem_available(void)
Return the number of bytes available still in the PVR RAM pool.
static void pvr_set_pal_entry(uint32_t idx, uint32_t value)
Set a palette value.
Definition pvr.h:1630
void pvr_set_pal_format(pvr_palfmt_t fmt)
Set the palette format.
pvr_palfmt_t
Definition pvr.h:1595
@ PVR_PAL_ARGB1555
16-bit ARGB1555 palette format
Definition pvr.h:1596
@ PVR_PAL_ARGB4444
16-bit ARGB4444 palette format
Definition pvr.h:1598
@ PVR_PAL_RGB565
16-bit RGB565 palette format
Definition pvr.h:1597
@ PVR_PAL_ARGB8888
32-bit ARGB8888 palette format
Definition pvr.h:1599
void pvr_mod_compile(pvr_mod_hdr_t *dst, pvr_list_t list, uint32_t mode, uint32_t cull)
Create a modifier volume header.
void pvr_poly_compile(pvr_poly_hdr_t *dst, const pvr_poly_cxt_t *src)
Compile a polygon context into a polygon header.
void pvr_poly_mod_compile(pvr_poly_mod_hdr_t *dst, const pvr_poly_cxt_t *src)
Compile a polygon context into a polygon header that is affected by modifier volumes.
void pvr_sprite_compile(pvr_sprite_hdr_t *dst, const pvr_sprite_cxt_t *src)
Compile a sprite context into a sprite header.
#define PVR_SET(REG, VALUE)
Set a PVR register value.
Definition pvr.h:1198
#define PVR_PALETTE_TABLE_BASE
Base of the palette table.
Definition pvr.h:1298
int pvr_scene_finish(void)
Call this after you have finished submitting all data for a frame.
void pvr_scene_begin_txr(pvr_ptr_t txr, uint32_t *rx, uint32_t *ry)
Begin collecting data for a frame of 3D output to the specified texture.
void pvr_scene_begin(void)
Begin collecting data for a frame of 3D output to the off-screen frame buffer.
void pvr_set_presort_mode(int presort)
Set the translucent polygon sort mode for the next frame.
int pvr_check_ready(void)
Check if the PVR system is ready for another frame to be submitted.
int pvr_wait_ready(void)
Block the caller until the PVR system is ready for another frame to be submitted.
int pvr_get_vbl_count(void)
Retrieve the current VBlank count.
int pvr_get_stats(pvr_stats_t *stat)
Get the current statistics from the PVR.
void pvr_txr_load(const void *src, pvr_ptr_t dst, uint32_t count)
Load raw texture data from an SH-4 buffer into PVR RAM.
void pvr_txr_load_kimg(const kos_img_t *img, pvr_ptr_t dst, uint32_t flags)
Load a KOS Platform Independent Image (subject to constraint checking).
bool pvr_txr_set_stride(uint32_t texture_width)
Set the global stride width for non-power-of-two textures in PVR RAM.
uint32_t pvr_txr_get_stride(void)
Get the current texture stride width in pixels as set in the PVR.
void pvr_txr_load_ex(const void *src, pvr_ptr_t dst, uint32_t w, uint32_t h, uint32_t flags)
Load texture data from an SH-4 buffer into PVR RAM, twiddling it in the process.
int pvr_vertex_dma_enabled(void)
Is vertex DMA enabled?
void pvr_vertbuf_written(pvr_list_t list, uint32_t amt)
Notify the PVR system that data have been written into the output buffer for the given list.
void * pvr_vertbuf_tail(pvr_list_t list)
Retrieve a pointer to the current output location in the DMA buffer for the requested list.
static uint32_t PVR_PACK_16BIT_UV(float u, float v)
Pack two floating point coordinates into one 32-bit value, truncating them to 16-bits each.
Definition pvr.h:1004
void * pvr_ptr_t
PVR texture memory pointer.
Definition pvr.h:68
Platform-independent image type.
Constants for areas of the system memory map.
PVR/TA DMA interface.
Macros to help dealing with register fields.
Functions to access the SH4 Store Queues.
Platform-indpendent image type.
Definition img.h:51
PVR initialization structure.
Definition pvr.h:1383
int fsaa_enabled
Enable horizontal scaling?
Definition pvr.h:1407
int dma_enabled
Enable vertex DMA?
Definition pvr.h:1400
int vertex_buf_size
Vertex buffer size (should be a nice round number)
Definition pvr.h:1392
int autosort_disabled
Disable translucent polygon autosort?
Definition pvr.h:1415
int opb_overflow_count
OPB Overflow Count.
Definition pvr.h:1426
Modifier volume header.
Definition pvr.h:810
uint32_t d4
Dummy value.
Definition pvr.h:817
uint32_t mode1
Parameter word 1.
Definition pvr.h:813
uint32_t d5
Dummy value.
Definition pvr.h:818
uint32_t d2
Dummy value.
Definition pvr.h:815
uint32_t d3
Dummy value.
Definition pvr.h:816
uint32_t d1
Dummy value.
Definition pvr.h:814
uint32_t d6
Dummy value.
Definition pvr.h:819
PVR vertex type: Modifier volume.
Definition pvr.h:961
uint32_t d1
Dummy value.
Definition pvr.h:973
uint32_t d4
Dummy value.
Definition pvr.h:976
float by
Second Y coordinate.
Definition pvr.h:968
float ay
First Y coordinate.
Definition pvr.h:965
float ax
First X coordinate.
Definition pvr.h:964
uint32_t d3
Dummy value.
Definition pvr.h:975
float cz
Third Z coordinate.
Definition pvr.h:972
float bz
Second Z coordinate.
Definition pvr.h:969
float cy
Third Y coordinate.
Definition pvr.h:971
uint32_t d6
Dummy value.
Definition pvr.h:978
uint32_t d2
Dummy value.
Definition pvr.h:974
uint32_t d5
Dummy value.
Definition pvr.h:977
float bx
Second X coordinate.
Definition pvr.h:967
float az
First Z coordinate.
Definition pvr.h:966
float cx
Third X coordinate.
Definition pvr.h:970
PVR polygon context.
Definition pvr.h:117
int clip_mode
Clipping mode.
Definition pvr.h:131
int modifier_mode
Modifier mode.
Definition pvr.h:133
int mipmap_bias
Mipmap bias.
Definition pvr.h:182
int src2
Source blending mode inside modifier.
Definition pvr.h:152
int write
Enable or disable depth writes.
Definition pvr.h:172
int dst_enable
Dest blending enable outside modifier.
Definition pvr.h:150
int dst
Dest blending mode outside modifier.
Definition pvr.h:146
int fog_type2
Fog type inside modifier.
Definition pvr.h:138
int src
Source blending mode outside modifier.
Definition pvr.h:144
int color_clamp2
Color clamp enable/disable inside modifier.
Definition pvr.h:140
int alpha2
Enable/disable alpha inside modifier.
Definition pvr.h:136
int env
Texture color contribution.
Definition pvr.h:190
pvr_ptr_t base
Texture pointer.
Definition pvr.h:196
int culling
Culling mode.
Definition pvr.h:127
int width
Texture width (requires a power of 2)
Definition pvr.h:192
int color
Color format in vertex.
Definition pvr.h:162
int specular
Offset color enable/disable outside modifier.
Definition pvr.h:134
int height
Texture height (requires a power of 2)
Definition pvr.h:193
int comparison
Depth comparison mode.
Definition pvr.h:170
int src_enable
Source blending enable outside modifier.
Definition pvr.h:148
int dst2
Dest blending mode inside modifier.
Definition pvr.h:154
int fog_type
Fog type outside modifier.
Definition pvr.h:125
int shading
Shading type.
Definition pvr.h:123
int modifier
Enable or disable modifier effect.
Definition pvr.h:166
int uv_flip
Enable/disable U/V flipping.
Definition pvr.h:184
int list_type
Primitive list.
Definition pvr.h:118
int mipmap
Enable/disable mipmaps.
Definition pvr.h:180
int dst_enable2
Dest blending mode inside modifier.
Definition pvr.h:158
int filter
Filtering mode.
Definition pvr.h:178
int src_enable2
Source blending mode inside modifier.
Definition pvr.h:156
int color_clamp
Color clamp enable/disable outside modifier.
Definition pvr.h:129
int uv_clamp
Enable/disable U/V clamping.
Definition pvr.h:186
int alpha
Enable or disable alpha outside modifier.
Definition pvr.h:121
int format
Texture format.
Definition pvr.h:194
int enable
Enable/disable texturing.
Definition pvr.h:176
int uv
U/V data format in vertex.
Definition pvr.h:164
PVR polygon header.
Definition pvr.h:735
uint32_t d1
Dummy value.
Definition pvr.h:741
uint32_t mode3
Parameter word 3.
Definition pvr.h:740
uint32_t mode1
Parameter word 1.
Definition pvr.h:738
uint32_t mode2
Parameter word 2.
Definition pvr.h:739
uint32_t d2
Dummy value.
Definition pvr.h:742
uint32_t d3
Dummy value.
Definition pvr.h:743
uint32_t d4
Dummy value.
Definition pvr.h:744
PVR polygon header with intensity color.
Definition pvr.h:753
float b
Face color blue component.
Definition pvr.h:762
uint32_t mode3
Parameter word 3.
Definition pvr.h:758
float r
Face color red component.
Definition pvr.h:760
uint32_t mode1
Parameter word 1.
Definition pvr.h:756
float a
Face color alpha component.
Definition pvr.h:759
uint32_t mode2
Parameter word 2.
Definition pvr.h:757
float g
Face color green component.
Definition pvr.h:761
PVR polygon header to be used with modifier volumes.
Definition pvr.h:772
uint32_t mode3_1
Parameter word 3 (inside volume)
Definition pvr.h:779
uint32_t d2
Dummy value.
Definition pvr.h:781
uint32_t mode2_0
Parameter word 2 (outside volume)
Definition pvr.h:776
uint32_t d1
Dummy value.
Definition pvr.h:780
uint32_t mode2_1
Parameter word 2 (inside volume)
Definition pvr.h:778
uint32_t mode1
Parameter word 1.
Definition pvr.h:775
uint32_t mode3_0
Parameter word 3 (outside volume)
Definition pvr.h:777
PVR vertex type: Untextured sprite.
Definition pvr.h:936
float bz
Second Z coordinate.
Definition pvr.h:944
float ay
First Y coordinate.
Definition pvr.h:940
uint32_t d3
Dummy value.
Definition pvr.h:952
float cz
Third Z coordinate.
Definition pvr.h:947
float bx
Second X coordinate.
Definition pvr.h:942
uint32_t d1
Dummy value.
Definition pvr.h:950
float cy
Third Y coordinate.
Definition pvr.h:946
float ax
First X coordinate.
Definition pvr.h:939
float by
Second Y coordinate.
Definition pvr.h:943
uint32_t d4
Dummy value.
Definition pvr.h:953
float dy
Fourth Y coordinate.
Definition pvr.h:949
uint32_t d2
Dummy value.
Definition pvr.h:951
float cx
Third X coordinate.
Definition pvr.h:945
float az
First Z coordinate.
Definition pvr.h:941
float dx
Fourth X coordinate.
Definition pvr.h:948
PVR sprite context.
Definition pvr.h:236
int color_clamp
Color clamp enable/disable.
Definition pvr.h:246
int write
Enable or disable depth writes.
Definition pvr.h:266
int env
Texture color contribution.
Definition pvr.h:284
int enable
Enable/disable texturing.
Definition pvr.h:270
int src_enable
Source blending enable.
Definition pvr.h:258
int dst
Dest blending mode.
Definition pvr.h:256
int clip_mode
Clipping mode.
Definition pvr.h:248
int list_type
Primitive list.
Definition pvr.h:237
int dst_enable
Dest blending enable.
Definition pvr.h:260
int specular
Offset color enable/disable.
Definition pvr.h:250
int src
Source blending mode.
Definition pvr.h:254
int alpha
Enable or disable alpha.
Definition pvr.h:240
int width
Texture width (requires a power of 2)
Definition pvr.h:286
int filter
Filtering mode.
Definition pvr.h:272
int comparison
Depth comparison mode.
Definition pvr.h:264
pvr_ptr_t base
Texture pointer.
Definition pvr.h:290
int mipmap
Enable/disable mipmaps.
Definition pvr.h:274
int mipmap_bias
Mipmap bias.
Definition pvr.h:276
int uv_flip
Enable/disable U/V flipping.
Definition pvr.h:278
int uv_clamp
Enable/disable U/V clamping.
Definition pvr.h:280
int fog_type
Fog type.
Definition pvr.h:242
int height
Texture height (requires a power of 2)
Definition pvr.h:287
int format
Texture format.
Definition pvr.h:288
int culling
Culling mode.
Definition pvr.h:244
PVR polygon header specifically for sprites.
Definition pvr.h:791
uint32_t oargb
Sprite offset color.
Definition pvr.h:798
uint32_t d2
Dummy value.
Definition pvr.h:800
uint32_t mode1
Parameter word 1.
Definition pvr.h:794
uint32_t mode2
Parameter word 2.
Definition pvr.h:795
uint32_t d1
Dummy value.
Definition pvr.h:799
uint32_t mode3
Parameter word 3.
Definition pvr.h:796
uint32_t argb
Sprite face color.
Definition pvr.h:797
PVR vertex type: Textured sprite.
Definition pvr.h:911
float bz
Second Z coordinate.
Definition pvr.h:919
float dx
Fourth X coordinate.
Definition pvr.h:923
float az
First Z coordinate.
Definition pvr.h:916
float ax
First X coordinate.
Definition pvr.h:914
uint32_t buv
Second U/V texture coordinates.
Definition pvr.h:927
float cz
Third Z coordinate.
Definition pvr.h:922
uint32_t dummy
Dummy value.
Definition pvr.h:925
float by
Second Y coordinate.
Definition pvr.h:918
uint32_t auv
First U/V texture coordinates.
Definition pvr.h:926
float dy
Fourth Y coordinate.
Definition pvr.h:924
float cx
Third X coordinate.
Definition pvr.h:920
uint32_t cuv
Third U/V texture coordinates.
Definition pvr.h:928
float bx
Second X coordinate.
Definition pvr.h:917
float cy
Third Y coordinate.
Definition pvr.h:921
float ay
First Y coordinate.
Definition pvr.h:915
PVR statistics structure.
Definition pvr.h:1544
size_t vtx_buffer_used
Number of bytes used in the vertex buffer for the last frame.
Definition pvr.h:1551
size_t vtx_buffer_used_max
Number of bytes used in the vertex buffer for the largest frame.
Definition pvr.h:1552
uint64_t buf_last_time
DMA buffer file time for the last frame in nanoseconds.
Definition pvr.h:1548
size_t frame_count
Total number of rendered/viewed frames.
Definition pvr.h:1549
uint64_t frame_last_time
Ready-to-Ready length for the last frame in nanoseconds.
Definition pvr.h:1545
float frame_rate
Current frame rate (per second)
Definition pvr.h:1553
uint32_t enabled_list_mask
Which lists are enabled?
Definition pvr.h:1554
size_t vbl_count
VBlank count.
Definition pvr.h:1550
uint64_t reg_last_time
Registration time for the last frame in nanoseconds.
Definition pvr.h:1546
uint64_t rnd_last_time
Rendering time for the last frame in nanoseconds.
Definition pvr.h:1547
PVR vertex type: Non-textured, packed color, affected by modifier volume.
Definition pvr.h:859
float z
Z coordinate.
Definition pvr.h:864
uint32_t d1
Dummy value.
Definition pvr.h:867
uint32_t argb0
Vertex color (outside volume)
Definition pvr.h:865
float x
X coordinate.
Definition pvr.h:862
float y
Y coordinate.
Definition pvr.h:863
uint32_t d2
Dummy value.
Definition pvr.h:868
uint32_t argb1
Vertex color (inside volume)
Definition pvr.h:866
Generic PVR vertex type.
Definition pvr.h:839
float z
Z coordinate.
Definition pvr.h:844
float y
Y coordinate.
Definition pvr.h:843
float u
Texture U coordinate.
Definition pvr.h:845
uint32_t oargb
Vertex offset color.
Definition pvr.h:848
float x
X coordinate.
Definition pvr.h:842
float v
Texture V coordinate.
Definition pvr.h:846
uint32_t argb
Vertex color.
Definition pvr.h:847
PVR vertex type: Textured, packed color, affected by modifier volume.
Definition pvr.h:879
float z
Z coordinate.
Definition pvr.h:884
uint32_t oargb1
Vertex offset color (inside)
Definition pvr.h:892
uint32_t oargb0
Vertex offset color (outside)
Definition pvr.h:888
float x
X coordinate.
Definition pvr.h:882
float u0
Texture U coordinate (outside)
Definition pvr.h:885
uint32_t d2
Dummy value.
Definition pvr.h:894
float v0
Texture V coordinate (outside)
Definition pvr.h:886
uint32_t d4
Dummy value.
Definition pvr.h:896
float u1
Texture U coordinate (inside)
Definition pvr.h:889
float y
Y coordinate.
Definition pvr.h:883
float v1
Texture V coordinate (inside)
Definition pvr.h:890
uint32_t argb0
Vertex color (outside)
Definition pvr.h:887
uint32_t argb1
Vertex color (inside)
Definition pvr.h:891
uint32_t d1
Dummy value.
Definition pvr.h:893
uint32_t d3
Dummy value.
Definition pvr.h:895
Common integer types.