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/* OR one of these into your texture format if you need it. Note that
642 these coincide with the twiddled/stride bits, so you can't have a
643 non-twiddled/strided texture that's paletted! */
644
645/** \brief 8BPP palette selector
646
647 \param x The palette index */
648#define PVR_TXRFMT_8BPP_PAL(x) ((x) << 25)
649
650/** \brief 4BPP palette selector
651
652 \param x The palette index */
653#define PVR_TXRFMT_4BPP_PAL(x) ((x) << 21)
654/** @} */
655
656/** \defgroup pvr_color_fmts Vertex Formats
657 \brief Color formats for PowerVR vertices
658 \ingroup pvr_ctx_color
659
660 These control how colors are represented in polygon data.
661
662 @{
663*/
664#define PVR_CLRFMT_ARGBPACKED 0 /**< \brief 32-bit integer ARGB */
665#define PVR_CLRFMT_4FLOATS 1 /**< \brief 4 floating point values */
666#define PVR_CLRFMT_INTENSITY 2 /**< \brief Intensity color */
667#define PVR_CLRFMT_INTENSITY_PREV 3 /**< \brief Use last intensity */
668/** @} */
669
670/** \defgroup pvr_uv_fmts U/V Data Format
671 \brief U/V data format for PVR textures
672 \ingroup pvr_ctx_texture
673 @{
674*/
675#define PVR_UVFMT_32BIT 0 /**< \brief 32-bit floating point U/V */
676#define PVR_UVFMT_16BIT 1 /**< \brief 16-bit floating point U/V */
677/** @} */
678
679/** \defgroup pvr_ctx_modvol Modifier Volumes
680 \brief PowerVR modifier volume polygon context attributes
681 \ingroup pvr_ctx_attrib
682*/
683
684/** \defgroup pvr_mod_switch Toggle
685 \brief Enable or Disable Modifier Effects
686 \ingroup pvr_ctx_modvol
687 @{
688*/
689#define PVR_MODIFIER_DISABLE 0 /**< \brief Disable modifier effects */
690#define PVR_MODIFIER_ENABLE 1 /**< \brief Enable modifier effects */
691/** @} */
692
693/** \defgroup pvr_mod_types Types
694 \brief Modifier volume types for PowerVR primitive contexts
695 \ingroup pvr_ctx_modvol
696 @{
697*/
698#define PVR_MODIFIER_CHEAP_SHADOW 0
699#define PVR_MODIFIER_NORMAL 1
700/** @} */
701
702/** \defgroup pvr_mod_modes Modes
703 \brief Modifier volume modes for PowerVR primitive contexts
704 \ingroup pvr_ctx_modvol
705
706 All triangles in a single modifier volume should be of the other poly type,
707 except for the last one. That should be either of the other two types,
708 depending on whether you want an inclusion or exclusion volume.
709
710 @{
711*/
712#define PVR_MODIFIER_OTHER_POLY 0 /**< \brief Not the last polygon in the volume */
713#define PVR_MODIFIER_INCLUDE_LAST_POLY 1 /**< \brief Last polygon, inclusion volume */
714#define PVR_MODIFIER_EXCLUDE_LAST_POLY 2 /**< \brief Last polygon, exclusion volume */
715/** @} */
716
717/** \defgroup pvr_primitives_headers Headers
718 \brief Compiled headers for polygons and sprites
719 \ingroup pvr_primitives
720
721 @{
722*/
723
724/** \brief PVR polygon header.
725
726 This is the hardware equivalent of a rendering context; you'll create one of
727 these from your pvr_poly_cxt_t and use it for submission to the hardware.
728
729 \headerfile dc/pvr.h
730*/
731typedef struct pvr_poly_hdr {
732 alignas(32)
733 uint32_t cmd; /**< \brief TA command */
734 uint32_t mode1; /**< \brief Parameter word 1 */
735 uint32_t mode2; /**< \brief Parameter word 2 */
736 uint32_t mode3; /**< \brief Parameter word 3 */
737 uint32_t d1; /**< \brief Dummy value */
738 uint32_t d2; /**< \brief Dummy value */
739 uint32_t d3; /**< \brief Dummy value */
740 uint32_t d4; /**< \brief Dummy value */
742
743/** \brief PVR polygon header with intensity color.
744
745 This is the equivalent of pvr_poly_hdr_t, but for use with intensity color.
746
747 \headerfile dc/pvr.h
748*/
749typedef struct pvr_poly_ic_hdr {
750 alignas(32)
751 uint32_t cmd; /**< \brief TA command */
752 uint32_t mode1; /**< \brief Parameter word 1 */
753 uint32_t mode2; /**< \brief Parameter word 2 */
754 uint32_t mode3; /**< \brief Parameter word 3 */
755 float a; /**< \brief Face color alpha component */
756 float r; /**< \brief Face color red component */
757 float g; /**< \brief Face color green component */
758 float b; /**< \brief Face color blue component */
760
761/** \brief PVR polygon header to be used with modifier volumes.
762
763 This is the equivalent of a pvr_poly_hdr_t for use when a polygon is to be
764 used with modifier volumes.
765
766 \headerfile dc/pvr.h
767*/
768typedef struct pvr_poly_mod_hdr {
769 alignas(32)
770 uint32_t cmd; /**< \brief TA command */
771 uint32_t mode1; /**< \brief Parameter word 1 */
772 uint32_t mode2_0; /**< \brief Parameter word 2 (outside volume) */
773 uint32_t mode3_0; /**< \brief Parameter word 3 (outside volume) */
774 uint32_t mode2_1; /**< \brief Parameter word 2 (inside volume) */
775 uint32_t mode3_1; /**< \brief Parameter word 3 (inside volume) */
776 uint32_t d1; /**< \brief Dummy value */
777 uint32_t d2; /**< \brief Dummy value */
779
780/** \brief PVR polygon header specifically for sprites.
781
782 This is the equivalent of a pvr_poly_hdr_t for use when a quad/sprite is to
783 be rendered. Note that the color data is here, not in the vertices.
784
785 \headerfile dc/pvr.h
786*/
787typedef struct pvr_sprite_hdr {
788 alignas(32)
789 uint32_t cmd; /**< \brief TA command */
790 uint32_t mode1; /**< \brief Parameter word 1 */
791 uint32_t mode2; /**< \brief Parameter word 2 */
792 uint32_t mode3; /**< \brief Parameter word 3 */
793 uint32_t argb; /**< \brief Sprite face color */
794 uint32_t oargb; /**< \brief Sprite offset color */
795 uint32_t d1; /**< \brief Dummy value */
796 uint32_t d2; /**< \brief Dummy value */
798
799/** \brief Modifier volume header.
800
801 This is the header that should be submitted when dealing with setting a
802 modifier volume.
803
804 \headerfile dc/pvr.h
805*/
806typedef struct pvr_mod_hdr {
807 alignas(32)
808 uint32_t cmd; /**< \brief TA command */
809 uint32_t mode1; /**< \brief Parameter word 1 */
810 uint32_t d1; /**< \brief Dummy value */
811 uint32_t d2; /**< \brief Dummy value */
812 uint32_t d3; /**< \brief Dummy value */
813 uint32_t d4; /**< \brief Dummy value */
814 uint32_t d5; /**< \brief Dummy value */
815 uint32_t d6; /**< \brief Dummy value */
817
818/** @} */
819
820/** \defgroup pvr_vertex_types Vertices
821 \brief PowerVR vertex types
822 \ingroup pvr_geometry
823
824 @{
825*/
826
827/** \brief Generic PVR vertex type.
828
829 The PVR chip itself supports many more vertex types, but this is the main
830 one that can be used with both textured and non-textured polygons, and is
831 fairly fast.
832
833 \headerfile dc/pvr.h
834*/
835typedef struct pvr_vertex {
836 alignas(32)
837 uint32_t flags; /**< \brief TA command (vertex flags) */
838 float x; /**< \brief X coordinate */
839 float y; /**< \brief Y coordinate */
840 float z; /**< \brief Z coordinate */
841 float u; /**< \brief Texture U coordinate */
842 float v; /**< \brief Texture V coordinate */
843 uint32_t argb; /**< \brief Vertex color */
844 uint32_t oargb; /**< \brief Vertex offset color */
846
847/** \brief PVR vertex type: Non-textured, packed color, affected by modifier
848 volume.
849
850 This vertex type has two copies of colors. The second color is used when
851 enclosed within a modifier volume.
852
853 \headerfile dc/pvr.h
854*/
855typedef struct pvr_vertex_pcm {
856 alignas(32)
857 uint32_t flags; /**< \brief TA command (vertex flags) */
858 float x; /**< \brief X coordinate */
859 float y; /**< \brief Y coordinate */
860 float z; /**< \brief Z coordinate */
861 uint32_t argb0; /**< \brief Vertex color (outside volume) */
862 uint32_t argb1; /**< \brief Vertex color (inside volume) */
863 uint32_t d1; /**< \brief Dummy value */
864 uint32_t d2; /**< \brief Dummy value */
866
867/** \brief PVR vertex type: Textured, packed color, affected by modifier volume.
868
869 Note that this vertex type has two copies of colors, offset colors, and
870 texture coords. The second set of texture coords, colors, and offset colors
871 are used when enclosed within a modifier volume.
872
873 \headerfile dc/pvr.h
874*/
875typedef struct pvr_vertex_tpcm {
876 alignas(32)
877 uint32_t flags; /**< \brief TA command (vertex flags) */
878 float x; /**< \brief X coordinate */
879 float y; /**< \brief Y coordinate */
880 float z; /**< \brief Z coordinate */
881 float u0; /**< \brief Texture U coordinate (outside) */
882 float v0; /**< \brief Texture V coordinate (outside) */
883 uint32_t argb0; /**< \brief Vertex color (outside) */
884 uint32_t oargb0; /**< \brief Vertex offset color (outside) */
885 float u1; /**< \brief Texture U coordinate (inside) */
886 float v1; /**< \brief Texture V coordinate (inside) */
887 uint32_t argb1; /**< \brief Vertex color (inside) */
888 uint32_t oargb1; /**< \brief Vertex offset color (inside) */
889 uint32_t d1; /**< \brief Dummy value */
890 uint32_t d2; /**< \brief Dummy value */
891 uint32_t d3; /**< \brief Dummy value */
892 uint32_t d4; /**< \brief Dummy value */
894
895/** \brief PVR vertex type: Textured sprite.
896
897 This vertex type is to be used with the sprite polygon header and the sprite
898 related commands to draw textured sprites. Note that there is no fourth Z
899 coordinate. I suppose it just gets interpolated?
900
901 The U/V coordinates in here are in the 16-bit per coordinate form. Also,
902 like the fourth Z value, there is no fourth U or V, so it must get
903 interpolated from the others.
904
905 \headerfile dc/pvr.h
906*/
907typedef struct pvr_sprite_txr {
908 alignas(32)
909 uint32_t flags; /**< \brief TA command (vertex flags) */
910 float ax; /**< \brief First X coordinate */
911 float ay; /**< \brief First Y coordinate */
912 float az; /**< \brief First Z coordinate */
913 float bx; /**< \brief Second X coordinate */
914 float by; /**< \brief Second Y coordinate */
915 float bz; /**< \brief Second Z coordinate */
916 float cx; /**< \brief Third X coordinate */
917 float cy; /**< \brief Third Y coordinate */
918 float cz; /**< \brief Third Z coordinate */
919 float dx; /**< \brief Fourth X coordinate */
920 float dy; /**< \brief Fourth Y coordinate */
921 uint32_t dummy; /**< \brief Dummy value */
922 uint32_t auv; /**< \brief First U/V texture coordinates */
923 uint32_t buv; /**< \brief Second U/V texture coordinates */
924 uint32_t cuv; /**< \brief Third U/V texture coordinates */
926
927/** \brief PVR vertex type: Untextured sprite.
928
929 This vertex type is to be used with the sprite polygon header and the sprite
930 related commands to draw untextured sprites (aka, quads).
931*/
932typedef struct pvr_sprite_col {
933 alignas(32)
934 uint32_t flags; /**< \brief TA command (vertex flags) */
935 float ax; /**< \brief First X coordinate */
936 float ay; /**< \brief First Y coordinate */
937 float az; /**< \brief First Z coordinate */
938 float bx; /**< \brief Second X coordinate */
939 float by; /**< \brief Second Y coordinate */
940 float bz; /**< \brief Second Z coordinate */
941 float cx; /**< \brief Third X coordinate */
942 float cy; /**< \brief Third Y coordinate */
943 float cz; /**< \brief Third Z coordinate */
944 float dx; /**< \brief Fourth X coordinate */
945 float dy; /**< \brief Fourth Y coordinate */
946 uint32_t d1; /**< \brief Dummy value */
947 uint32_t d2; /**< \brief Dummy value */
948 uint32_t d3; /**< \brief Dummy value */
949 uint32_t d4; /**< \brief Dummy value */
951
952/** \brief PVR vertex type: Modifier volume.
953
954 This vertex type is to be used with the modifier volume header to specify
955 triangular modifier areas.
956*/
957typedef struct pvr_modifier_vol {
958 alignas(32)
959 uint32_t flags; /**< \brief TA command (vertex flags) */
960 float ax; /**< \brief First X coordinate */
961 float ay; /**< \brief First Y coordinate */
962 float az; /**< \brief First Z coordinate */
963 float bx; /**< \brief Second X coordinate */
964 float by; /**< \brief Second Y coordinate */
965 float bz; /**< \brief Second Z coordinate */
966 float cx; /**< \brief Third X coordinate */
967 float cy; /**< \brief Third Y coordinate */
968 float cz; /**< \brief Third Z coordinate */
969 uint32_t d1; /**< \brief Dummy value */
970 uint32_t d2; /**< \brief Dummy value */
971 uint32_t d3; /**< \brief Dummy value */
972 uint32_t d4; /**< \brief Dummy value */
973 uint32_t d5; /**< \brief Dummy value */
974 uint32_t d6; /**< \brief Dummy value */
976
977/** \brief Pack four floating point color values into a 32-bit integer form.
978
979 All of the color values should be between 0 and 1.
980
981 \param a Alpha value
982 \param r Red value
983 \param g Green value
984 \param b Blue value
985 \return The packed color value
986*/
987#define PVR_PACK_COLOR(a, r, g, b) ( \
988 ( ((uint8_t)( (a) * 255 ) ) << 24 ) | \
989 ( ((uint8_t)( (r) * 255 ) ) << 16 ) | \
990 ( ((uint8_t)( (g) * 255 ) ) << 8 ) | \
991 ( ((uint8_t)( (b) * 255 ) ) << 0 ) )
992
993/** \brief Pack two floating point coordinates into one 32-bit value,
994 truncating them to 16-bits each.
995
996 \param u First coordinate to pack
997 \param v Second coordinate to pack
998 \return The packed coordinates
999*/
1000static inline uint32_t PVR_PACK_16BIT_UV(float u, float v) {
1001 union {
1002 float f;
1003 uint32_t i;
1004 } u2, v2;
1005
1006 u2.f = u;
1007 v2.f = v;
1008
1009 return (u2.i & 0xFFFF0000) | (v2.i >> 16);
1010}
1011
1012/** @} */
1013
1014/** \defgroup pvr_commands TA Command Values
1015 \brief Command values for submitting data to the TA
1016 \ingroup pvr_primitives_headers
1017
1018 These are are appropriate values for TA commands. Use whatever goes with the
1019 primitive type you're using.
1020
1021 @{
1022*/
1023#define PVR_CMD_POLYHDR 0x80840000 /**< \brief PVR polygon header.
1024Striplength set to 2 */
1025#define PVR_CMD_VERTEX 0xe0000000 /**< \brief PVR vertex data */
1026#define PVR_CMD_VERTEX_EOL 0xf0000000 /**< \brief PVR vertex, end of strip */
1027#define PVR_CMD_USERCLIP 0x20000000 /**< \brief PVR user clipping area */
1028#define PVR_CMD_MODIFIER 0x80000000 /**< \brief PVR modifier volume */
1029#define PVR_CMD_SPRITE 0xA0000000 /**< \brief PVR sprite header */
1030/** @} */
1031
1032/** \cond
1033 Deprecated macros, replaced by the pvr_bitmasks macros below.
1034 */
1035#define PVR_TA_CMD_TYPE_SHIFT 24
1036#define PVR_TA_CMD_TYPE_MASK (7 << PVR_TA_CMD_TYPE_SHIFT)
1037
1038#define PVR_TA_CMD_USERCLIP_SHIFT 16
1039#define PVR_TA_CMD_USERCLIP_MASK (3 << PVR_TA_CMD_USERCLIP_SHIFT)
1040
1041#define PVR_TA_CMD_CLRFMT_SHIFT 4
1042#define PVR_TA_CMD_CLRFMT_MASK (7 << PVR_TA_CMD_CLRFMT_SHIFT)
1043
1044#define PVR_TA_CMD_SPECULAR_SHIFT 2
1045#define PVR_TA_CMD_SPECULAR_MASK (1 << PVR_TA_CMD_SPECULAR_SHIFT)
1046
1047#define PVR_TA_CMD_SHADE_SHIFT 1
1048#define PVR_TA_CMD_SHADE_MASK (1 << PVR_TA_CMD_SHADE_SHIFT)
1049
1050#define PVR_TA_CMD_UVFMT_SHIFT 0
1051#define PVR_TA_CMD_UVFMT_MASK (1 << PVR_TA_CMD_UVFMT_SHIFT)
1052
1053#define PVR_TA_CMD_MODIFIER_SHIFT 7
1054#define PVR_TA_CMD_MODIFIER_MASK (1 << PVR_TA_CMD_MODIFIER_SHIFT)
1055
1056#define PVR_TA_CMD_MODIFIERMODE_SHIFT 6
1057#define PVR_TA_CMD_MODIFIERMODE_MASK (1 << PVR_TA_CMD_MODIFIERMODE_SHIFT)
1058
1059#define PVR_TA_PM1_DEPTHCMP_SHIFT 29
1060#define PVR_TA_PM1_DEPTHCMP_MASK (7 << PVR_TA_PM1_DEPTHCMP_SHIFT)
1061
1062#define PVR_TA_PM1_CULLING_SHIFT 27
1063#define PVR_TA_PM1_CULLING_MASK (3 << PVR_TA_PM1_CULLING_SHIFT)
1064
1065#define PVR_TA_PM1_DEPTHWRITE_SHIFT 26
1066#define PVR_TA_PM1_DEPTHWRITE_MASK (1 << PVR_TA_PM1_DEPTHWRITE_SHIFT)
1067
1068#define PVR_TA_PM1_TXRENABLE_SHIFT 25
1069#define PVR_TA_PM1_TXRENABLE_MASK (1 << PVR_TA_PM1_TXRENABLE_SHIFT)
1070
1071#define PVR_TA_PM1_MODIFIERINST_SHIFT 29
1072#define PVR_TA_PM1_MODIFIERINST_MASK (3 << PVR_TA_PM1_MODIFIERINST_SHIFT)
1073
1074#define PVR_TA_PM2_SRCBLEND_SHIFT 29
1075#define PVR_TA_PM2_SRCBLEND_MASK (7 << PVR_TA_PM2_SRCBLEND_SHIFT)
1076
1077#define PVR_TA_PM2_DSTBLEND_SHIFT 26
1078#define PVR_TA_PM2_DSTBLEND_MASK (7 << PVR_TA_PM2_DSTBLEND_SHIFT)
1079
1080#define PVR_TA_PM2_SRCENABLE_SHIFT 25
1081#define PVR_TA_PM2_SRCENABLE_MASK (1 << PVR_TA_PM2_SRCENABLE_SHIFT)
1082
1083#define PVR_TA_PM2_DSTENABLE_SHIFT 24
1084#define PVR_TA_PM2_DSTENABLE_MASK (1 << PVR_TA_PM2_DSTENABLE_SHIFT)
1085
1086#define PVR_TA_PM2_FOG_SHIFT 22
1087#define PVR_TA_PM2_FOG_MASK (3 << PVR_TA_PM2_FOG_SHIFT)
1088
1089#define PVR_TA_PM2_CLAMP_SHIFT 21
1090#define PVR_TA_PM2_CLAMP_MASK (1 << PVR_TA_PM2_CLAMP_SHIFT)
1091
1092#define PVR_TA_PM2_ALPHA_SHIFT 20
1093#define PVR_TA_PM2_ALPHA_MASK (1 << PVR_TA_PM2_ALPHA_SHIFT)
1094
1095#define PVR_TA_PM2_TXRALPHA_SHIFT 19
1096#define PVR_TA_PM2_TXRALPHA_MASK (1 << PVR_TA_PM2_TXRALPHA_SHIFT)
1097
1098#define PVR_TA_PM2_UVFLIP_SHIFT 17
1099#define PVR_TA_PM2_UVFLIP_MASK (3 << PVR_TA_PM2_UVFLIP_SHIFT)
1100
1101#define PVR_TA_PM2_UVCLAMP_SHIFT 15
1102#define PVR_TA_PM2_UVCLAMP_MASK (3 << PVR_TA_PM2_UVCLAMP_SHIFT)
1103
1104#define PVR_TA_PM2_FILTER_SHIFT 12
1105#define PVR_TA_PM2_FILTER_MASK (7 << PVR_TA_PM2_FILTER_SHIFT)
1106
1107#define PVR_TA_PM2_MIPBIAS_SHIFT 8
1108#define PVR_TA_PM2_MIPBIAS_MASK (15 << PVR_TA_PM2_MIPBIAS_SHIFT)
1109
1110#define PVR_TA_PM2_TXRENV_SHIFT 6
1111#define PVR_TA_PM2_TXRENV_MASK (3 << PVR_TA_PM2_TXRENV_SHIFT)
1112
1113#define PVR_TA_PM2_USIZE_SHIFT 3
1114#define PVR_TA_PM2_USIZE_MASK (7 << PVR_TA_PM2_USIZE_SHIFT)
1115
1116#define PVR_TA_PM2_VSIZE_SHIFT 0
1117#define PVR_TA_PM2_VSIZE_MASK (7 << PVR_TA_PM2_VSIZE_SHIFT)
1118
1119#define PVR_TA_PM3_MIPMAP_SHIFT 31
1120#define PVR_TA_PM3_MIPMAP_MASK (1 << PVR_TA_PM3_MIPMAP_SHIFT)
1121
1122#define PVR_TA_PM3_TXRFMT_SHIFT 0
1123#define PVR_TA_PM3_TXRFMT_MASK 0xffffffff
1124/** \endcond */
1125
1126/** \defgroup pvr_bitmasks Constants and Masks
1127 \brief Polygon header constants and masks
1128 \ingroup pvr_primitives_headers
1129
1130 Note that thanks to the arrangement of constants, this is mainly a matter of
1131 bit shifting to compile headers...
1132
1133 @{
1134*/
1135#define PVR_TA_CMD_TYPE GENMASK(26, 24)
1136#define PVR_TA_CMD_USERCLIP GENMASK(17, 16)
1137#define PVR_TA_CMD_MODIFIER BIT(7)
1138#define PVR_TA_CMD_MODIFIERMODE BIT(6)
1139#define PVR_TA_CMD_CLRFMT GENMASK(5, 4)
1140#define PVR_TA_CMD_TXRENABLE BIT(3)
1141#define PVR_TA_CMD_SPECULAR BIT(2)
1142#define PVR_TA_CMD_SHADE BIT(1)
1143#define PVR_TA_CMD_UVFMT BIT(0)
1144#define PVR_TA_PM1_DEPTHCMP GENMASK(31, 29)
1145#define PVR_TA_PM1_CULLING GENMASK(28, 27)
1146#define PVR_TA_PM1_DEPTHWRITE BIT(26)
1147#define PVR_TA_PM1_TXRENABLE BIT(25)
1148#define PVR_TA_PM1_MODIFIERINST GENMASK(30, 29)
1149#define PVR_TA_PM2_SRCBLEND GENMASK(31, 29)
1150#define PVR_TA_PM2_DSTBLEND GENMASK(28, 26)
1151#define PVR_TA_PM2_SRCENABLE BIT(25)
1152#define PVR_TA_PM2_DSTENABLE BIT(24)
1153#define PVR_TA_PM2_FOG GENMASK(23, 22)
1154#define PVR_TA_PM2_CLAMP BIT(21)
1155#define PVR_TA_PM2_ALPHA BIT(20)
1156#define PVR_TA_PM2_TXRALPHA BIT(19)
1157#define PVR_TA_PM2_UVFLIP GENMASK(18, 17)
1158#define PVR_TA_PM2_UVCLAMP GENMASK(16, 15)
1159#define PVR_TA_PM2_FILTER GENMASK(14, 12)
1160#define PVR_TA_PM2_MIPBIAS GENMASK(11, 8)
1161#define PVR_TA_PM2_TXRENV GENMASK(7, 6)
1162#define PVR_TA_PM2_USIZE GENMASK(5, 3)
1163#define PVR_TA_PM2_VSIZE GENMASK(2, 0)
1164#define PVR_TA_PM3_MIPMAP BIT(31)
1165#define PVR_TA_PM3_TXRFMT GENMASK(30, 21)
1166/** @} */
1167
1168/**** Register macros ***************************************************/
1169
1170/** \defgroup pvr_registers Registers
1171 \brief Direct PVR register and memory access
1172 \ingroup pvr
1173 @{
1174*/
1175
1176/* We use these macros to do all PVR register access, so that it's
1177 simple later on to hook them for debugging or whatnot. */
1178
1179#define PVR_REGISTERS_BASE 0xa05f8000 /**< \brief PVR Register Base */
1180
1181/** \brief Retrieve a PVR register value
1182
1183 \param REG The register to fetch. See \ref pvr_regs.
1184
1185 \return The value of that register (32-bits)
1186*/
1187#define PVR_GET(REG) (* ( (vuint32*)( PVR_REGISTERS_BASE + (REG) ) ) )
1188
1189/** \brief Set a PVR register value
1190
1191 \param REG The register to set. See \ref pvr_regs.
1192 \param VALUE The value to set in the register (32-bits)
1193*/
1194#define PVR_SET(REG, VALUE) PVR_GET(REG) = (VALUE)
1195
1196/** @} */
1197
1198/** \defgroup pvr_regs Offsets
1199 \brief PowerVR register offsets
1200 \ingroup pvr_registers
1201
1202 The registers themselves; these are from Maiwe's powervr-reg.txt.
1203
1204 \note
1205 2D specific registers have been excluded for now (like
1206 vsync, hsync, v/h size, etc)
1207
1208 @{
1209*/
1210
1211#define PVR_ID 0x0000 /**< \brief Chip ID */
1212#define PVR_REVISION 0x0004 /**< \brief Chip revision */
1213#define PVR_RESET 0x0008 /**< \brief Reset pins */
1214
1215#define PVR_ISP_START 0x0014 /**< \brief Start the ISP/TSP */
1216#define PVR_UNK_0018 0x0018 /**< \brief ?? */
1217
1218#define PVR_ISP_VERTBUF_ADDR 0x0020 /**< \brief Vertex buffer address for scene rendering */
1219
1220#define PVR_ISP_TILEMAT_ADDR 0x002c /**< \brief Tile matrix address for scene rendering */
1221#define PVR_SPANSORT_CFG 0x0030 /**< \brief ?? -- write 0x101 for now */
1222
1223#define PVR_BORDER_COLOR 0x0040 /**< \brief Border Color in RGB888 */
1224#define PVR_FB_CFG_1 0x0044 /**< \brief Framebuffer config 1 */
1225#define PVR_FB_CFG_2 0x0048 /**< \brief Framebuffer config 2 */
1226#define PVR_RENDER_MODULO 0x004c /**< \brief Render modulo */
1227#define PVR_FB_ADDR 0x0050 /**< \brief Framebuffer start address */
1228#define PVR_FB_IL_ADDR 0x0054 /**< \brief Framebuffer odd-field start address for interlace */
1229
1230#define PVR_FB_SIZE 0x005c /**< \brief Framebuffer display size */
1231#define PVR_RENDER_ADDR 0x0060 /**< \brief Render output address */
1232#define PVR_RENDER_ADDR_2 0x0064 /**< \brief Output for strip-buffering */
1233#define PVR_PCLIP_X 0x0068 /**< \brief Horizontal clipping area */
1234#define PVR_PCLIP_Y 0x006c /**< \brief Vertical clipping area */
1235
1236#define PVR_CHEAP_SHADOW 0x0074 /**< \brief Cheap shadow control */
1237#define PVR_OBJECT_CLIP 0x0078 /**< \brief Distance for polygon culling */
1238#define PVR_UNK_007C 0x007c /**< \brief ?? -- write 0x0027df77 for now */
1239#define PVR_UNK_0080 0x0080 /**< \brief ?? -- write 7 for now */
1240#define PVR_TEXTURE_CLIP 0x0084 /**< \brief Distance for texture clipping */
1241#define PVR_BGPLANE_Z 0x0088 /**< \brief Distance for background plane */
1242#define PVR_BGPLANE_CFG 0x008c /**< \brief Background plane config */
1243
1244#define PVR_UNK_0098 0x0098 /**< \brief ?? -- write 0x00800408 for now */
1245
1246#define PVR_UNK_00A0 0x00a0 /**< \brief ?? -- write 0x20 for now */
1247
1248#define PVR_UNK_00A8 0x00a8 /**< \brief ?? -- write 0x15d1c951 for now */
1249
1250#define PVR_FOG_TABLE_COLOR 0x00b0 /**< \brief Table fog color */
1251#define PVR_FOG_VERTEX_COLOR 0x00b4 /**< \brief Vertex fog color */
1252#define PVR_FOG_DENSITY 0x00b8 /**< \brief Fog density coefficient */
1253#define PVR_COLOR_CLAMP_MAX 0x00bc /**< \brief RGB Color clamp max */
1254#define PVR_COLOR_CLAMP_MIN 0x00c0 /**< \brief RGB Color clamp min */
1255#define PVR_GUN_POS 0x00c4 /**< \brief Light gun position */
1256#define PVR_HPOS_IRQ 0x00c8 /**< \brief Horizontal position IRQ */
1257#define PVR_VPOS_IRQ 0x00cc /**< \brief Vertical position IRQ */
1258#define PVR_IL_CFG 0x00d0 /**< \brief Interlacing config */
1259#define PVR_BORDER_X 0x00d4 /**< \brief Window border X position */
1260#define PVR_SCAN_CLK 0x00d8 /**< \brief Clock and scanline values */
1261#define PVR_BORDER_Y 0x00dc /**< \brief Window border Y position */
1262
1263#define PVR_TXR_STRIDE_MULT 0x00e4 /**< \brief Multiplier for stride width in increments of 32 */
1264#define PVR_VIDEO_CFG 0x00e8 /**< \brief Misc video config */
1265#define PVR_BITMAP_X 0x00ec /**< \brief Bitmap window X position */
1266#define PVR_BITMAP_Y 0x00f0 /**< \brief Bitmap window Y position */
1267#define PVR_SCALER_CFG 0x00f4 /**< \brief Smoothing scaler */
1268
1269#define PVR_PALETTE_CFG 0x0108 /**< \brief Palette format */
1270#define PVR_SYNC_STATUS 0x010c /**< \brief V/H blank status */
1271#define PVR_UNK_0110 0x0110 /**< \brief ?? -- write 0x93f39 for now */
1272#define PVR_UNK_0114 0x0114 /**< \brief ?? -- write 0x200000 for now */
1273#define PVR_UNK_0118 0x0118 /**< \brief ?? -- write 0x8040 for now */
1274
1275#define PVR_TA_OPB_START 0x0124 /**< \brief Object Pointer Buffer start for TA usage */
1276#define PVR_TA_VERTBUF_START 0x0128 /**< \brief Vertex buffer start for TA usage */
1277#define PVR_TA_OPB_END 0x012c /**< \brief OPB end for TA usage */
1278#define PVR_TA_VERTBUF_END 0x0130 /**< \brief Vertex buffer end for TA usage */
1279#define PVR_TA_OPB_POS 0x0134 /**< \brief Top used memory location in OPB for TA usage */
1280#define PVR_TA_VERTBUF_POS 0x0138 /**< \brief Top used memory location in vertbuf for TA usage */
1281#define PVR_TILEMAT_CFG 0x013c /**< \brief Tile matrix size config */
1282#define PVR_OPB_CFG 0x0140 /**< \brief Active lists / list size */
1283#define PVR_TA_INIT 0x0144 /**< \brief Initialize vertex reg. params */
1284#define PVR_YUV_ADDR 0x0148 /**< \brief YUV conversion destination */
1285#define PVR_YUV_CFG 0x014c /**< \brief YUV configuration */
1286#define PVR_YUV_STAT 0x0150 /**< \brief The number of YUV macroblocks converted */
1287
1288#define PVR_UNK_0160 0x0160 /**< \brief ?? */
1289#define PVR_TA_OPB_INIT 0x0164 /**< \brief Object pointer buffer position init */
1290
1291#define PVR_FOG_TABLE_BASE 0x0200 /**< \brief Base of the fog table */
1292
1293#define PVR_PALETTE_TABLE_BASE 0x1000 /**< \brief Base of the palette table */
1294/** @} */
1295
1296/** \defgroup pvr_addresses Addresses and Constants
1297 \brief Miscellaneous Addresses and Constants
1298 \ingroup pvr_registers
1299
1300 Useful PVR memory locations and values.
1301
1302 @{
1303*/
1304#define PVR_TA_INPUT 0x10000000 /**< \brief TA command input (64-bit, TA) */
1305#define PVR_TA_YUV_CONV 0x10800000 /**< \brief YUV converter (64-bit, TA) */
1306#define PVR_TA_TEX_MEM 0x11000000 /**< \brief VRAM 64-bit, TA=>VRAM */
1307#define PVR_TA_TEX_MEM_32 0x13000000 /**< \brief VRAM 32-bit, TA->VRAM */
1308#define PVR_RAM_BASE_32_P0 0x05000000 /**< \brief VRAM 32-bit, P0 area, PVR->VRAM */
1309#define PVR_RAM_BASE_64_P0 0x04000000 /**< \brief VRAM 64-bit, P0 area, PVR->VRAM */
1310#define PVR_RAM_BASE 0xa5000000 /**< \brief VRAM 32-bit, P2 area, PVR->VRAM */
1311#define PVR_RAM_INT_BASE 0xa4000000 /**< \brief VRAM 64-bit, P2 area, PVR->VRAM */
1312
1313#define PVR_RAM_SIZE (8*1024*1024) /**< \brief RAM size in bytes */
1314
1315#define PVR_RAM_TOP (PVR_RAM_BASE + PVR_RAM_SIZE) /**< \brief Top of raw PVR RAM */
1316#define PVR_RAM_INT_TOP (PVR_RAM_INT_BASE + PVR_RAM_SIZE) /**< \brief Top of int PVR RAM */
1317/** @} */
1318
1319/* Register content defines, as needed; these will be filled in over time
1320 as the implementation requires them. There's too many to do otherwise. */
1321
1322/** \defgroup pvr_reset_vals Reset Values
1323 \brief Values used to reset parts of the PVR
1324 \ingroup pvr_registers
1325
1326 These values are written to the PVR_RESET register in order to reset the
1327 system or to take it out of reset.
1328
1329 @{
1330*/
1331#define PVR_RESET_ALL 0xffffffff /**< \brief Reset the whole PVR */
1332#define PVR_RESET_NONE 0x00000000 /**< \brief Cancel reset state */
1333#define PVR_RESET_TA 0x00000001 /**< \brief Reset only the TA */
1334#define PVR_RESET_ISPTSP 0x00000002 /**< \brief Reset only the ISP/TSP */
1335/** @} */
1336
1337/** \defgroup pvr_go Init/Start Values
1338 \brief Values to be written to registers to conform or start operations.
1339 \ingroup pvr_registers
1340 @{
1341*/
1342#define PVR_ISP_START_GO 0xffffffff /**< \brief Write to the PVR_ISP_START register to start rendering */
1343
1344#define PVR_TA_INIT_GO 0x80000000 /**< \brief Write to the PVR_TA_INIT register to confirm settings */
1345/** @} */
1346
1347/* Initialization ****************************************************/
1348/** \defgroup pvr_init Initialization
1349 \brief Driver initialization and shutdown
1350 \ingroup pvr
1351
1352 Initialization and shutdown: stuff you should only ever have to do
1353 once in your program.
1354*/
1355
1356/** \defgroup pvr_binsizes Primitive Bin Sizes
1357 \brief Available sizes for primitive bins
1358 \ingroup pvr_init
1359 @{
1360*/
1361#define PVR_BINSIZE_0 0 /**< \brief 0-length (disables the list) */
1362#define PVR_BINSIZE_8 8 /**< \brief 8-word (32-byte) length */
1363#define PVR_BINSIZE_16 16 /**< \brief 16-word (64-byte) length */
1364#define PVR_BINSIZE_32 32 /**< \brief 32-word (128-byte) length */
1365/** @} */
1366
1367/** \brief PVR initialization structure
1368 \ingroup pvr_init
1369
1370 This structure defines how the PVR initializes various parts of the system,
1371 including the primitive bin sizes, the vertex buffer size, and whether
1372 vertex DMA will be enabled.
1373
1374 You essentially fill one of these in, and pass it to pvr_init().
1375
1376 \headerfile dc/pvr.h
1377*/
1378typedef struct {
1379 /** \brief Bin sizes.
1380
1381 The bins go in the following order: opaque polygons, opaque modifiers,
1382 translucent polygons, translucent modifiers, punch-thrus
1383 */
1384 int opb_sizes[5];
1385
1386 /** \brief Vertex buffer size (should be a nice round number) */
1388
1389 /** \brief Enable vertex DMA?
1390
1391 Set to non-zero if we want to enable vertex DMA mode. Note that if this
1392 is set, then _all_ enabled lists need to have a vertex buffer assigned,
1393 even if you never use that list for anything.
1394 */
1396
1397 /** \brief Enable horizontal scaling?
1398
1399 Set to non-zero if horizontal scaling is to be enabled. By enabling this
1400 setting and stretching your image to double the native screen width, you
1401 can get horizontal full-screen anti-aliasing. */
1403
1404 /** \brief Disable translucent polygon autosort?
1405
1406 Set to non-zero to disable translucent polygon autosorting. By enabling
1407 this setting, the PVR acts more like a traditional Z-buffered system
1408 when rendering translucent polygons, meaning you must pre-sort them
1409 yourself if you want them to appear in the right order. */
1411
1412
1413 /** \brief OPB Overflow Count.
1414
1415 Preallocates this many extra OPBs (sets of tile bins), allowing the PVR
1416 to use the extra space when there's too much geometry in the first OPB.
1417
1418 Increasing this value can eliminate artifacts where pieces of geometry
1419 flicker in and out of existence along the tile boundaries. */
1420
1422
1424
1425/** \brief Initialize the PVR chip to ready status.
1426 \ingroup pvr_init
1427
1428 This function enables the specified lists and uses the specified parameters.
1429 Note that bins and vertex buffers come from the texture memory pool, so only
1430 allocate what you actually need. Expects that a 2D mode was initialized
1431 already using the vid_* API.
1432
1433 \param params The set of parameters to initialize with
1434 \retval 0 On success
1435 \retval -1 If the PVR has already been initialized or the video
1436 mode active is not suitable for 3D
1437*/
1439
1440/** \brief Simple PVR initialization.
1441 \ingroup pvr_init
1442
1443 This simpler function initializes the PVR using 16/16 for the opaque
1444 and translucent lists' bin sizes, and 0's for everything else. It sets 512KB
1445 of vertex buffer. This is equivalent to the old ta_init_defaults() for now.
1446
1447 \retval 0 On success
1448 \retval -1 If the PVR has already been initialized or the video
1449 mode active is not suitable for 3D
1450*/
1452
1453/** \brief Shut down the PVR chip from ready status.
1454 \ingroup pvr_init
1455
1456 This essentially leaves the video system in 2D mode as it was before the
1457 init.
1458
1459 \retval 0 On success
1460 \retval -1 If the PVR has not been initialized
1461*/
1463
1464
1465/* Misc parameters ***************************************************/
1466
1467/** \defgroup pvr_global Global State
1468 \brief PowerVR functionality which is managed globally
1469 \ingroup pvr
1470
1471 These are miscellaneous parameters you can set which affect the
1472 rendering process.
1473*/
1474
1475/** \brief Set the background plane color.
1476 \ingroup pvr_global
1477
1478 This function sets the color of the area of the screen not covered by any
1479 other polygons.
1480
1481 \param r Red component of the color to set
1482 \param g Green component of the color to set
1483 \param b Blue component of the color to set
1484*/
1485void pvr_set_bg_color(float r, float g, float b);
1486
1487/** \brief Set cheap shadow parameters.
1488 \ingroup pvr_global
1489
1490 This function sets up the PVR cheap shadow parameters for use. You can only
1491 specify one scale value per frame, so the effect that you can get from this
1492 is somewhat limited, but if you want simple shadows, this is the easiest way
1493 to do it.
1494
1495 Polygons affected by a shadow modifier volume will effectively multiply
1496 their final color by the scale value set here when shadows are enabled and
1497 the polygon is inside the modifier (or outside for exclusion volumes).
1498
1499 \param enable Set to non-zero to enable cheap shadow mode.
1500 \param scale_value Floating point value (between 0 and 1) representing
1501 how colors of polygons affected by and inside the
1502 volume will be modified by the shadow volume.
1503*/
1504void pvr_set_shadow_scale(int enable, float scale_value);
1505
1506/** \brief Set Z clipping depth.
1507 \ingroup pvr_global
1508
1509 This function sets the Z clipping depth. The default value for this is
1510 0.0001.
1511
1512 \param zc The new value to set the z clip parameter to.
1513*/
1514void pvr_set_zclip(float zc);
1515
1516/** \brief Retrieve the current VBlank count.
1517 \ingroup pvr_stats
1518
1519 This function retrieves the number of VBlank interrupts that have occurred
1520 since the PVR was initialized.
1521
1522 \return The number of VBlanks since init
1523*/
1525
1526/** \defgroup pvr_stats Profiling
1527 \brief Rendering stats and metrics for profiling
1528 \ingroup pvr
1529*/
1530
1531/** \brief PVR statistics structure.
1532 \ingroup pvr_stats
1533
1534 This structure is used to hold various statistics about the operation of the
1535 PVR since initialization.
1536
1537 \headerfile dc/pvr.h
1538*/
1539typedef struct pvr_stats {
1540 uint64_t frame_last_time; /**< \brief Ready-to-Ready length for the last frame in nanoseconds */
1541 uint64_t reg_last_time; /**< \brief Registration time for the last frame in nanoseconds */
1542 uint64_t rnd_last_time; /**< \brief Rendering time for the last frame in nanoseconds */
1543 uint64_t buf_last_time; /**< \brief DMA buffer file time for the last frame in nanoseconds */
1544 size_t frame_count; /**< \brief Total number of rendered/viewed frames */
1545 size_t vbl_count; /**< \brief VBlank count */
1546 size_t vtx_buffer_used; /**< \brief Number of bytes used in the vertex buffer for the last frame */
1547 size_t vtx_buffer_used_max; /**< \brief Number of bytes used in the vertex buffer for the largest frame */
1548 float frame_rate; /**< \brief Current frame rate (per second) */
1549 uint32_t enabled_list_mask; /**< \brief Which lists are enabled? */
1550 /* ... more later as it's implemented ... */
1551} pvr_stats_t;
1552
1553/** \brief Get the current statistics from the PVR.
1554 \ingroup pvr_stats
1555
1556 This function fills in the pvr_stats_t structure passed in with the current
1557 statistics of the system.
1558
1559 \param stat The statistics structure to fill in. Must not be
1560 NULL
1561 \retval 0 On success
1562 \retval -1 If the PVR is not initialized
1563*/
1565
1566
1567/* Palette management ************************************************/
1568/** \defgroup pvr_pal_mgmt Palettes
1569 \brief Color palette management API of the PowerVR
1570 \ingroup pvr_global
1571
1572 In addition to its 16-bit truecolor modes, the PVR also supports some
1573 nice paletted modes.
1574
1575 \remark
1576 These aren't useful for super high quality images most of the time,
1577 but they can be useful for doing some interesting special effects,
1578 like the old cheap "worm hole".
1579*/
1580
1581/** \defgroup pvr_palfmt Formats
1582 \brief Color palette formats of the PowerVR
1583 \ingroup pvr_pal_mgmt
1584
1585 Entries in the PVR's palettes can be of any of these formats. Note that you
1586 can only have one format active at a time.
1587
1588 @{
1589*/
1590typedef enum pvr_palfmt {
1591 PVR_PAL_ARGB1555, /**< \brief 16-bit ARGB1555 palette format */
1592 PVR_PAL_RGB565, /**< \brief 16-bit RGB565 palette format */
1593 PVR_PAL_ARGB4444, /**< \brief 16-bit ARGB4444 palette format */
1594 PVR_PAL_ARGB8888, /**< \brief 32-bit ARGB8888 palette format */
1595} pvr_palfmt_t;
1596/** @} */
1597
1598/** \brief Set the palette format.
1599 \ingroup pvr_pal_mgmt
1600
1601 This function sets the currently active palette format on the PVR. Each
1602 entry in the palette table is 32-bits in length, regardless of what color
1603 format is in use.
1604
1605 Be sure to use care when using the PVR_PAL_ARGB8888 format. Rendering speed
1606 is greatly affected (cut about in half) if you use any filtering with
1607 paletted textures with ARGB8888 entries in the palette.
1608
1609 \param fmt The format to use
1610 \see pvr_palfmt_t
1611*/
1613
1614/** \brief Set a palette value.
1615 \ingroup pvr_pal_mgmt
1616
1617 Note that while the color format is variable, each entry is still 32-bits in
1618 length regardless (and you only get a total of 1024 of them). If using one
1619 of the 16-bit palette formats, only the low-order 16-bits of the entry are
1620 valid, and the high bits should be filled in with 0.
1621
1622 \param idx The index to set to (0-1023)
1623 \param value The color value to set in that palette entry
1624*/
1625static inline void pvr_set_pal_entry(uint32_t idx, uint32_t value) {
1626 PVR_SET(PVR_PALETTE_TABLE_BASE + 4 * idx, value);
1627}
1628
1629
1630/* Hardware Fog parameters *******************************************/
1631/** \defgroup pvr_fog Fog
1632 \brief Hardware Fog API for the PowerVR
1633 \ingroup pvr_global
1634
1635 \note
1636 Thanks to Paul Boese for figuring this stuff out
1637*/
1638
1639/** \brief Set the table fog color.
1640 \ingroup pvr_fog
1641
1642 This function sets the color of fog for table fog. 0-1 range for all colors.
1643
1644 \param a Alpha value of the fog
1645 \param r Red value of the fog
1646 \param g Green value of the fog
1647 \param b Blue value of the fog
1648*/
1649void pvr_fog_table_color(float a, float r, float g, float b);
1650
1651/** \brief Set the vertex fog color.
1652 \ingroup pvr_fog
1653
1654 This function sets the fog color for vertex fog. 0-1 range for all colors.
1655 This function is currently not implemented, as vertex fog is not supported
1656 by KOS. Calling this function will cause an assertion failure.
1657
1658 \param a Alpha value of the fog
1659 \param r Red value of the fog
1660 \param g Green value of the fog
1661 \param b Blue value of the fog
1662*/
1663void pvr_fog_vertex_color(float a, float r, float g, float b);
1664
1665/** \brief Set the fog far depth.
1666 \ingroup pvr_fog
1667
1668 This function sets the PVR_FOG_DENSITY register appropriately for the
1669 specified value.
1670
1671 \param d The depth to set
1672*/
1673void pvr_fog_far_depth(float d);
1674
1675/** \brief Initialize the fog table using an exp2 algorithm (like GL_EXP2).
1676 \ingroup pvr_fog
1677
1678 This function will automatically set the PVR_FOG_DENSITY register to
1679 259.999999 as a part of its processing, then set up the fog table.
1680
1681 \param density Fog density value
1682*/
1683void pvr_fog_table_exp2(float density);
1684
1685/** \brief Initialize the fog table using an exp algorithm (like GL_EXP).
1686 \ingroup pvr_fog
1687
1688 This function will automatically set the PVR_FOG_DENSITY register to
1689 259.999999 as a part of its processing, then set up the fog table.
1690
1691 \param density Fog density value
1692*/
1693void pvr_fog_table_exp(float density);
1694
1695/** \brief Initialize the fog table using a linear algorithm (like GL_LINEAR).
1696 \ingroup pvr_fog
1697
1698 This function will set the PVR_FOG_DENSITY register to the as appropriate
1699 for the end value, and initialize the fog table for perspectively correct
1700 linear fog.
1701
1702 \param start Fog start point
1703 \param end Fog end point
1704*/
1705void pvr_fog_table_linear(float start, float end);
1706
1707/** \brief Set a custom fog table from float values
1708 \ingroup pvr_fog
1709
1710 This function allows you to specify whatever values you need to for your fog
1711 parameters. All values should be clamped between 0 and 1, and its your
1712 responsibility to set up the PVR_FOG_DENSITY register by calling
1713 pvr_fog_far_depth() with an appropriate value. The table passed in should
1714 have 129 entries, where the 0th entry is farthest from the eye and the last
1715 entry is nearest. Higher values = heavier fog.
1716
1717 \param tbl1 The table of fog values to set
1718*/
1719void pvr_fog_table_custom(float tbl1[]);
1720
1721
1722/* Memory management *************************************************/
1723
1724/** \defgroup pvr_vram VRAM
1725 \brief Video memory access and management
1726 \ingroup pvr
1727*/
1728
1729/** \defgroup pvr_mem_mgmt Allocator
1730 \brief Memory management API for VRAM
1731 \ingroup pvr_vram
1732
1733 PVR memory management in KOS uses a modified dlmalloc; see the
1734 source file pvr_mem_core.c for more info.
1735*/
1736
1737/** \brief Allocate a chunk of memory from texture space.
1738 \ingroup pvr_mem_mgmt
1739
1740 This function acts as the memory allocator for the PVR texture RAM pool. It
1741 acts exactly as one would expect a malloc() function to act, returning a
1742 normal pointer that can be directly written to if one desires to do so. All
1743 allocations will be aligned to a 32-byte boundary.
1744
1745 \param size The amount of memory to allocate
1746
1747 \return A pointer to the memory on success, NULL on error
1748*/
1750
1751/** \brief Free a block of allocated memory in the PVR RAM pool.
1752 \ingroup pvr_mem_mgmt
1753
1754 This function frees memory previously allocated with pvr_mem_malloc().
1755
1756 \param chunk The location of the start of the block to free
1757*/
1759
1760/** \brief Return the number of bytes available still in the PVR RAM pool.
1761 \ingroup pvr_mem_mgmt
1762
1763 \return The number of bytes available
1764*/
1765uint32_t pvr_mem_available(void);
1766
1767/** \brief Reset the PVR RAM pool.
1768 \ingroup pvr_mem_mgmt
1769
1770 This will essentially free any blocks allocated within the pool. There's
1771 generally not many good reasons for doing this.
1772*/
1773void pvr_mem_reset(void);
1774
1775/** \brief Print the list of allocated blocks in the PVR RAM pool.
1776 \ingroup pvr_mem_mgmt
1777
1778 This function only works if you've enabled KM_DBG in pvr_mem.c.
1779*/
1781
1782/** \brief Print statistics about the PVR RAM pool.
1783 \ingroup pvr_mem_mgmt
1784
1785 This prints out statistics like what malloc_stats() provides. Also, if
1786 KM_DBG is enabled in pvr_mem.c, it prints the list of allocated blocks.
1787*/
1788void pvr_mem_stats(void);
1789
1790/* Scene rendering ***************************************************/
1791/** \defgroup pvr_scene_mgmt Scene Submission
1792 \brief PowerVR API for submitting scene geometry
1793 \ingroup pvr
1794
1795 This API is used to submit triangle strips to the PVR via the TA
1796 interface in the chip.
1797
1798 An important side note about the PVR is that all primitive types
1799 must be submitted grouped together. If you have 10 polygons for each
1800 list type, then the PVR must receive them via the TA by list type,
1801 with a list delimiter in between.
1802
1803 So there are two modes you can use here. The first mode allows you to
1804 submit data directly to the TA. Your data will be forwarded to the
1805 chip for processing as it is fed to the PVR module. If your data
1806 is easily sorted into the primitive types, then this is the fastest
1807 mode for submitting data.
1808
1809 The second mode allows you to submit data via main-RAM vertex buffers,
1810 which will be queued until the proper primitive type is active. In this
1811 case, each piece of data is copied into the vertex buffer while the
1812 wrong list is activated, and when the proper list becomes activated,
1813 the data is all sent at once. Ideally this would be via DMA, right
1814 now it is by store queues. This has the advantage of allowing you to
1815 send data in any order and have the PVR functions resolve how it should
1816 get sent to the hardware, but it is slower.
1817
1818 The nice thing is that any combination of these modes can be used. You
1819 can assign a vertex buffer for any list, and it will be used to hold the
1820 incoming vertex data until the proper list has come up. Or if the proper
1821 list is already up, the data will be submitted directly. So if most of
1822 your polygons are opaque, and you only have a couple of translucents,
1823 you can set a small buffer to gather translucent data and then it will
1824 get sent when you do a pvr_end_scene().
1825
1826 Thanks to Mikael Kalms for the idea for this API.
1827
1828 \note
1829 Another somewhat subtle point that bears mentioning is that in the normal
1830 case (interrupts enabled) an interrupt handler will automatically take
1831 care of starting a frame rendering (after scene_finish()) and also
1832 flipping pages when appropriate.
1833*/
1834
1835/** \defgroup pvr_vertex_dma Vertex DMA
1836 \brief Use the DMA to transfer inactive lists to the PVR
1837 \ingroup pvr_scene_mgmt
1838*/
1839
1840/** \brief Is vertex DMA enabled?
1841 \ingroup pvr_vertex_dma
1842
1843 \return Non-zero if vertex DMA was enabled at init time
1844*/
1846
1847/** \brief Setup a vertex buffer for one of the list types.
1848 \ingroup pvr_list_mgmt
1849
1850 If the specified list type already has a vertex buffer, it will be replaced
1851 by the new one.
1852
1853 \note
1854 Each buffer should actually be twice as long as what you will need to hold
1855 two frames worth of data).
1856
1857 \warning
1858 You should generally not try to do this at any time besides before a frame
1859 is begun, or Bad Things May Happen.
1860
1861 \param list The primitive list to set the buffer for.
1862 \param buffer The location of the buffer in main RAM. This must be
1863 aligned to a 32-byte boundary.
1864 \param len The length of the buffer. This must be a multiple of
1865 64, and must be at least 128 (even if you're not
1866 using the list).
1867
1868 \return The old buffer location (if any)
1869*/
1870void *pvr_set_vertbuf(pvr_list_t list, void *buffer, int len);
1871
1872/** \brief Retrieve a pointer to the current output location in the DMA buffer
1873 for the requested list.
1874 \ingroup pvr_vertex_dma
1875
1876 Vertex DMA must globally be enabled for this to work. Data may be added to
1877 this buffer by the user program directly; however, make sure to call
1878 pvr_vertbuf_written() to notify the system of any such changes.
1879
1880 \param list The primitive list to get the buffer for.
1881
1882 \return The tail of that list's buffer.
1883*/
1885
1886/** \brief Notify the PVR system that data have been written into the output
1887 buffer for the given list.
1888 \ingroup pvr_vertex_dma
1889
1890 This should always be done after writing data directly to these buffers or
1891 it will get overwritten by other data.
1892
1893 \param list The primitive list that was modified.
1894 \param amt Number of bytes written. Must be a multiple of 32.
1895*/
1896void pvr_vertbuf_written(pvr_list_t list, uint32_t amt);
1897
1898/** \brief Set the translucent polygon sort mode for the next frame.
1899 \ingroup pvr_scene_mgmt
1900
1901 This function sets the translucent polygon sort mode for the next frame of
1902 output, potentially switching between autosort and presort mode.
1903
1904 For most programs, you'll probably want to set this at initialization time
1905 (with the autosort_disabled field in the pvr_init_params_t structure) and
1906 not mess with it per-frame. It is recommended that if you do use this
1907 function to change the mode that you should set it each frame to ensure that
1908 the mode is set properly.
1909
1910 \param presort Set to 1 to set the presort mode for translucent
1911 polygons, set to 0 to use autosort mode.
1912*/
1913void pvr_set_presort_mode(int presort);
1914
1915/** \brief Begin collecting data for a frame of 3D output to the off-screen
1916 frame buffer.
1917 \ingroup pvr_scene_mgmt
1918
1919 You must call this function (or pvr_scene_begin_txr()) for ever frame of
1920 output.
1921*/
1923
1924/** \brief Begin collecting data for a frame of 3D output to the specified
1925 texture.
1926 \ingroup pvr_scene_mgmt
1927
1928 This function currently only supports outputting at the same size as the
1929 actual screen. Thus, make sure rx and ry are at least large enough for that.
1930 For a 640x480 output, rx will generally be 1024 on input and ry 512, as
1931 these are the smallest values that are powers of two and will hold the full
1932 screen sized output.
1933
1934 \param txr The texture to render to.
1935 \param rx Width of the texture buffer (in pixels).
1936 \param ry Height of the texture buffer (in pixels).
1937*/
1938void pvr_scene_begin_txr(pvr_ptr_t txr, uint32_t *rx, uint32_t *ry);
1939
1940
1941/** \defgroup pvr_list_mgmt Polygon Lists
1942 \brief PVR API for managing list submission
1943 \ingroup pvr_scene_mgmt
1944*/
1945
1946/** \brief Begin collecting data for the given list type.
1947 \ingroup pvr_list_mgmt
1948
1949 Lists do not have to be submitted in any particular order, but all types of
1950 a list must be submitted at once (unless vertex DMA mode is enabled).
1951
1952 Note that there is no need to call this function in DMA mode unless you want
1953 to make use of pvr_prim() for compatibility. This function will
1954 automatically call pvr_list_finish() if a list is already opened before
1955 opening the new list.
1956
1957 \param list The list to open.
1958 \retval 0 On success.
1959 \retval -1 If the specified list has already been closed.
1960*/
1962
1963/** \brief End collecting data for the current list type.
1964 \ingroup pvr_list_mgmt
1965
1966 Lists can never be opened again within a single frame once they have been
1967 closed. Thus submitting a primitive that belongs in a closed list is
1968 considered an error. Closing a list that is already closed is also an error.
1969
1970 Note that if you open a list but do not submit any primitives, a blank one
1971 will be submitted to satisfy the hardware. If vertex DMA mode is enabled,
1972 then this simply sets the current list pointer to no list, and none of the
1973 above restrictions apply.
1974
1975 \retval 0 On success.
1976 \retval -1 On error.
1977*/
1979
1980/** \brief Submit a primitive of the current list type.
1981 \ingroup pvr_list_mgmt
1982
1983 Note that any values submitted in this fashion will go directly to the
1984 hardware without any sort of buffering, and submitting a primitive of the
1985 wrong type will quite likely ruin your scene. Note that this also will not
1986 work if you haven't begun any list types (i.e., all data is queued). If DMA
1987 is enabled, the primitive will be appended to the end of the currently
1988 selected list's buffer.
1989
1990 \warning
1991 \p data must be 32-byte aligned!
1992
1993 \param data The primitive to submit.
1994 \param size The length of the primitive, in bytes. Must be a
1995 multiple of 32.
1996
1997 \retval 0 On success.
1998 \retval -1 On error.
1999*/
2000int pvr_prim(void *data, int size);
2001
2002/** \defgroup pvr_direct Direct Rendering
2003 \brief API for using direct rendering with the PVR
2004 \ingroup pvr_scene_mgmt
2005
2006 @{
2007*/
2008
2009/** \brief Direct Rendering state variable type. */
2010typedef uint32_t pvr_dr_state_t;
2011
2012/** \brief Initialize a state variable for Direct Rendering.
2013
2014 Store Queues are used.
2015
2016 \param vtx_buf_ptr A variable of type pvr_dr_state_t to init.
2017*/
2018void pvr_dr_init(pvr_dr_state_t *vtx_buf_ptr);
2019
2020/** \brief Obtain the target address for Direct Rendering.
2021
2022 \param vtx_buf_ptr State variable for Direct Rendering. Should be of
2023 type pvr_dr_state_t, and must have been initialized
2024 previously in the scene with pvr_dr_init().
2025
2026 \return A write-only destination address where a primitive
2027 should be written to get ready to submit it to the
2028 TA in DR mode.
2029*/
2030#define pvr_dr_target(vtx_buf_ptr) \
2031 ({ (vtx_buf_ptr) ^= 32; \
2032 (pvr_vertex_t *)(MEM_AREA_SQ_BASE | (vtx_buf_ptr)); \
2033 })
2034
2035/** \brief Commit a primitive written into the Direct Rendering target address.
2036
2037 \param addr The address returned by pvr_dr_target(), after you
2038 have written the primitive to it.
2039*/
2040#define pvr_dr_commit(addr) sq_flush(addr)
2041
2042/** \brief Finish work with Direct Rendering.
2043
2044 Called atomatically in pvr_scene_finish().
2045 Use it manually if you want to release Store Queues earlier.
2046
2047*/
2048void pvr_dr_finish(void);
2049
2050/** \brief Upload a 32-byte payload to the Tile Accelerator
2051
2052 Upload the given payload to the Tile Accelerator. The difference with the
2053 Direct Rendering approach above is that the Store Queues are not used, and
2054 therefore can be used for anything else.
2055
2056 \param data A pointer to the 32-byte payload.
2057 The pointer must be aligned to 8 bytes.
2058*/
2059void pvr_send_to_ta(void *data);
2060
2061/** @} */
2062
2063/** \brief Submit a primitive of the given list type.
2064 \ingroup pvr_list_mgmt
2065
2066 Data will be queued in a vertex buffer, thus one must be available for the
2067 list specified (will be asserted by the code).
2068
2069 \param list The list to submit to.
2070 \param data The primitive to submit.
2071 \param size The size of the primitive in bytes. This must be a
2072 multiple of 32.
2073
2074 \retval 0 On success.
2075 \retval -1 On error.
2076*/
2077int pvr_list_prim(pvr_list_t list, void *data, int size);
2078
2079/** \brief Flush the buffered data of the given list type to the TA.
2080 \ingroup pvr_list_mgmt
2081
2082 This function is currently not implemented, and calling it will result in an
2083 assertion failure. It is intended to be used later in a "hybrid" mode where
2084 both direct and DMA TA submission is possible.
2085
2086 \param list The list to flush.
2087
2088 \retval -1 On error (it is not possible to succeed).
2089*/
2091
2092/** \brief Call this after you have finished submitting all data for a frame.
2093 \ingroup pvr_scene_mgmt
2094
2095 Once this has been called, you can not submit any more data until one of the
2096 pvr_scene_begin() or pvr_scene_begin_txr() functions is called again.
2097
2098 \retval 0 On success.
2099 \retval -1 On error (no scene started).
2100*/
2102
2103/** \brief Block the caller until the PVR system is ready for another frame to
2104 be submitted.
2105 \ingroup pvr_scene_mgmt
2106
2107 The PVR system allocates enough space for two frames: one in data collection
2108 mode, and another in rendering mode. If a frame is currently rendering, and
2109 another frame has already been closed, then the caller cannot do anything
2110 else until the rendering frame completes. Note also that the new frame
2111 cannot be activated except during a vertical blanking period, so this
2112 essentially waits until a rendered frame is complete and a vertical blank
2113 happens.
2114
2115 \retval 0 On success. A new scene can be started now.
2116 \retval -1 On error. Something is probably very wrong...
2117*/
2119
2120/** \brief Check if the PVR system is ready for another frame to be submitted.
2121 \ingroup pvr_scene_mgmt
2122
2123 \retval 0 If the PVR is ready for a new scene. You must call
2124 pvr_wait_ready() afterwards, before starting a new
2125 scene.
2126 \retval -1 If the PVR is not ready for a new scene yet.
2127*/
2129
2130
2131/* Primitive handling ************************************************/
2132
2133/** \defgroup pvr_primitives_compilation Compilation
2134 \brief API for compiling primitive contexts
2135 into headers
2136 \ingroup pvr_ctx
2137*/
2138
2139/** \brief Compile a polygon context into a polygon header.
2140 \ingroup pvr_primitives_compilation
2141
2142 This function compiles a pvr_poly_cxt_t into the form needed by the hardware
2143 for rendering. This is for use with normal polygon headers.
2144
2145 \param dst Where to store the compiled header.
2146 \param src The context to compile.
2147*/
2149
2150/** \defgroup pvr_ctx_init Initialization
2151 \brief Functions for initializing PVR polygon contexts
2152 \ingroup pvr_ctx
2153*/
2154
2155/** \brief Fill in a polygon context for non-textured polygons.
2156 \ingroup pvr_ctx_init
2157
2158 This function fills in a pvr_poly_cxt_t with default parameters appropriate
2159 for rendering a non-textured polygon in the given list.
2160
2161 \param dst Where to store the polygon context.
2162 \param list The primitive list to be used.
2163*/
2165
2166/** \brief Fill in a polygon context for a textured polygon.
2167 \ingroup pvr_ctx_init
2168
2169 This function fills in a pvr_poly_cxt_t with default parameters appropriate
2170 for rendering a textured polygon in the given list.
2171
2172 \param dst Where to store the polygon context.
2173 \param list The primitive list to be used.
2174 \param textureformat The format of the texture used.
2175 \param tw The width of the texture, in pixels.
2176 \param th The height of the texture, in pixels.
2177 \param textureaddr A pointer to the texture.
2178 \param filtering The type of filtering to use.
2179
2180 \see pvr_txr_fmts
2181 \see pvr_filter_modes
2182*/
2184 int textureformat, int tw, int th, pvr_ptr_t textureaddr,
2185 int filtering);
2186
2187/** \brief Compile a sprite context into a sprite header.
2188 \ingroup pvr_primitives_compilation
2189
2190 This function compiles a pvr_sprite_cxt_t into the form needed by the
2191 hardware for rendering. This is for use with sprite headers.
2192
2193 \param dst Where to store the compiled header.
2194 \param src The context to compile.
2195*/
2197 const pvr_sprite_cxt_t *src);
2198
2199/** \brief Fill in a sprite context for non-textured sprites.
2200 \ingroup pvr_ctx_init
2201
2202 This function fills in a pvr_sprite_cxt_t with default parameters
2203 appropriate for rendering a non-textured sprite in the given list.
2204
2205 \param dst Where to store the sprite context.
2206 \param list The primitive list to be used.
2207*/
2209
2210/** \brief Fill in a sprite context for a textured sprite.
2211 \ingroup pvr_ctx_init
2212
2213 This function fills in a pvr_sprite_cxt_t with default parameters
2214 appropriate for rendering a textured sprite in the given list.
2215
2216 \param dst Where to store the sprite context.
2217 \param list The primitive list to be used.
2218 \param textureformat The format of the texture used.
2219 \param tw The width of the texture, in pixels.
2220 \param th The height of the texture, in pixels.
2221 \param textureaddr A pointer to the texture.
2222 \param filtering The type of filtering to use.
2223
2224 \see pvr_txr_fmts
2225 \see pvr_filter_modes
2226*/
2228 int textureformat, int tw, int th, pvr_ptr_t textureaddr,
2229 int filtering);
2230
2231/** \brief Create a modifier volume header.
2232 \ingroup pvr_primitives_compilation
2233
2234 This function fills in a modifier volume header with the parameters
2235 specified. Note that unlike for polygons and sprites, there is no context
2236 step for modifiers.
2237
2238 \param dst Where to store the modifier header.
2239 \param list The primitive list to be used.
2240 \param mode The mode for this modifier.
2241 \param cull The culling mode to use.
2242
2243 \see pvr_mod_modes
2244 \see pvr_cull_modes
2245*/
2246void pvr_mod_compile(pvr_mod_hdr_t *dst, pvr_list_t list, uint32_t mode,
2247 uint32_t cull);
2248
2249/** \brief Compile a polygon context into a polygon header that is affected by
2250 modifier volumes.
2251 \ingroup pvr_primitives_compilation
2252
2253 This function works pretty similarly to pvr_poly_compile(), but compiles
2254 into the header type that is affected by a modifier volume. The context
2255 should have been created with either pvr_poly_cxt_col_mod() or
2256 pvr_poly_cxt_txr_mod().
2257
2258 \param dst Where to store the compiled header.
2259 \param src The context to compile.
2260*/
2262
2263/** \brief Fill in a polygon context for non-textured polygons affected by a
2264 modifier volume.
2265 \ingroup pvr_ctx_init
2266
2267 This function fills in a pvr_poly_cxt_t with default parameters appropriate
2268 for rendering a non-textured polygon in the given list that will be affected
2269 by modifier volumes.
2270
2271 \param dst Where to store the polygon context.
2272 \param list The primitive list to be used.
2273*/
2275
2276/** \brief Fill in a polygon context for a textured polygon affected by
2277 modifier volumes.
2278 \ingroup pvr_ctx_init
2279
2280 This function fills in a pvr_poly_cxt_t with default parameters appropriate
2281 for rendering a textured polygon in the given list and being affected by
2282 modifier volumes.
2283
2284 \param dst Where to store the polygon context.
2285 \param list The primitive list to be used.
2286 \param textureformat The format of the texture used (outside).
2287 \param tw The width of the texture, in pixels (outside).
2288 \param th The height of the texture, in pixels (outside).
2289 \param textureaddr A pointer to the texture (outside).
2290 \param filtering The type of filtering to use (outside).
2291 \param textureformat2 The format of the texture used (inside).
2292 \param tw2 The width of the texture, in pixels (inside).
2293 \param th2 The height of the texture, in pixels (inside).
2294 \param textureaddr2 A pointer to the texture (inside).
2295 \param filtering2 The type of filtering to use (inside).
2296
2297 \see pvr_txr_fmts
2298 \see pvr_filter_modes
2299*/
2301 int textureformat, int tw, int th,
2302 pvr_ptr_t textureaddr, int filtering,
2303 int textureformat2, int tw2, int th2,
2304 pvr_ptr_t textureaddr2, int filtering2);
2305
2306/* Texture handling **************************************************/
2307/** \defgroup pvr_txr_mgmt Texturing
2308 \brief API for managing PowerVR textures
2309 \ingroup pvr
2310
2311 Helper functions for handling texture tasks of various kinds.
2312*/
2313
2314/** \brief Set the global stride width for non-power-of-two textures in PVR RAM.
2315 \ingroup pvr_txr_mgmt
2316
2317 This function configures the global texture stride register
2318 `PVR_TXR_STRIDE_MULT`, which defines the row width in VRAM for
2319 non-power-of-two textures. The setting applies to all textures
2320 rendered with the `PVR_TXRFMT_X32_STRIDE` flag in the same frame.
2321 Since `PVR_TXR_STRIDE_MULT` is a global register, all textures
2322 using this flag must share the same stride width in each frame.
2323
2324 The stride width configured here is **only supported for textures
2325 with widths that are multiples of 32 pixels** and up to a maximum
2326 of 992 pixels. Any texture width not meeting this requirement will
2327 not work with the `PVR_TXRFMT_X32_STRIDE` flag.
2328
2329 \warning
2330 - Textures that are palette-based cannot use the `PVR_TXRFMT_X32_STRIDE`
2331 flag so the stride set here will not apply to them.
2332
2333 \param texture_width The width of the texture in pixels. Must be a
2334 multiple of 32 and up to 992 pixels.
2335 \retval true On success.
2336 \retval false On failure.
2337
2338 \sa pvr_txr_get_stride()
2339*/
2340bool pvr_txr_set_stride(uint32_t texture_width);
2341
2342/** \brief Get the current texture stride width in pixels as set in the PVR.
2343 \ingroup pvr_txr_mgmt
2344
2345 This function reads the `PVR_TXR_STRIDE_MULT` register and calculates the
2346 texture stride width in pixels. The value returned is the width in pixels
2347 that has been configured for all textures using the `PVR_TXRFMT_X32_STRIDE`
2348 flag in the same frame.
2349
2350 The stride width is computed by taking the current multiplier in
2351 `PVR_TXR_STRIDE_MULT` (which stores the width divided by 32), and
2352 multiplying it back by 32 to return the full width in pixels.
2353
2354 \return The current texture stride width in pixels.
2355
2356 \sa pvr_txr_set_stride()
2357*/
2358uint32_t pvr_txr_get_stride(void);
2359
2360/** \brief Load raw texture data from an SH-4 buffer into PVR RAM.
2361 \ingroup pvr_txr_mgmt
2362
2363 This essentially just acts as a memcpy() from main RAM to PVR RAM, using
2364 the Store Queues and 64-bit TA bus.
2365
2366 \param src The location in main RAM holding the texture.
2367 \param dst The location in PVR RAM to copy to.
2368 \param count The size of the texture in bytes (must be a multiple
2369 of 32).
2370*/
2371void pvr_txr_load(const void *src, pvr_ptr_t dst, uint32_t count);
2372
2373/** \defgroup pvr_txrload_constants Flags
2374 \brief Texture loading constants
2375 \ingroup pvr_txr_mgmt
2376
2377 These are constants for the flags parameter to pvr_txr_load_ex() or
2378 pvr_txr_load_kimg().
2379
2380 @{
2381*/
2382#define PVR_TXRLOAD_4BPP 0x01 /**< \brief 4BPP format */
2383#define PVR_TXRLOAD_8BPP 0x02 /**< \brief 8BPP format */
2384#define PVR_TXRLOAD_16BPP 0x03 /**< \brief 16BPP format */
2385#define PVR_TXRLOAD_FMT_MASK 0x0f /**< \brief Bits used for basic formats */
2386
2387#define PVR_TXRLOAD_VQ_LOAD 0x10 /**< \brief Do VQ encoding (not supported yet, if ever) */
2388#define PVR_TXRLOAD_INVERT_Y 0x20 /**< \brief Invert the Y axis while loading */
2389#define PVR_TXRLOAD_FMT_VQ 0x40 /**< \brief Texture is already VQ encoded */
2390#define PVR_TXRLOAD_FMT_TWIDDLED 0x80 /**< \brief Texture is already twiddled */
2391#define PVR_TXRLOAD_FMT_NOTWIDDLE 0x80 /**< \brief Don't twiddle the texture while loading */
2392#define PVR_TXRLOAD_DMA 0x8000 /**< \brief Use DMA to load the texture */
2393#define PVR_TXRLOAD_NONBLOCK 0x4000 /**< \brief Use non-blocking loads (only for DMA) */
2394#define PVR_TXRLOAD_SQ 0x2000 /**< \brief Use Store Queues to load */
2395
2396/** @} */
2397
2398/** \brief Load texture data from an SH-4 buffer into PVR RAM, twiddling it in
2399 the process.
2400 \ingroup pvr_txr_mgmt
2401
2402 This function loads a texture to the PVR's RAM with the specified set of
2403 flags. It will currently always twiddle the data, whether you ask it to or
2404 not, and many of the parameters are just plain not supported at all...
2405 Pretty much the only supported flag, other than the format ones is the
2406 PVR_TXRLOAD_INVERT_Y one.
2407
2408 This will be slower than using pvr_txr_load() in pretty much all cases, so
2409 unless you need to twiddle your texture, just use that instead.
2410
2411 \param src The location to copy from.
2412 \param dst The location to copy to.
2413 \param w The width of the texture, in pixels.
2414 \param h The height of the texture, in pixels.
2415 \param flags Some set of flags, ORed together.
2416
2417 \see pvr_txrload_constants
2418*/
2419void pvr_txr_load_ex(const void *src, pvr_ptr_t dst,
2420 uint32_t w, uint32_t h, uint32_t flags);
2421
2422/** \brief Load a KOS Platform Independent Image (subject to constraint
2423 checking).
2424 \ingroup pvr_txr_mgmt
2425
2426 This function loads a KOS Platform Independent image to the PVR's RAM with
2427 the specified set of flags. This function, unlike pvr_txr_load_ex() supports
2428 everything in the flags available, other than what's explicitly marked as
2429 not supported.
2430
2431 \param img The image to load.
2432 \param dst The location to copy to.
2433 \param flags Some set of flags, ORed together.
2434
2435 \see pvr_txrload_constants
2436 \note Unless you explicitly tell this function to not
2437 twiddle the texture (by ORing
2438 \ref PVR_TXRLOAD_FMT_NOTWIDDLE or it's equivalent
2439 \ref PVR_TXRLOAD_FMT_TWIDDLED with flags), this
2440 function will twiddle the texture while loading.
2441 Keep that in mind when setting the texture format in
2442 polygon headers later.
2443 \note You cannot specify both
2444 \ref PVR_TXRLOAD_FMT_NOTWIDDLE (or equivalently
2445 \ref PVR_TXRLOAD_FMT_TWIDDLED) and
2446 \ref PVR_TXRLOAD_INVERT_Y in the flags.
2447 \note DMA and Store Queue based loading is not available
2448 from this function if it twiddles the texture while
2449 loading.
2450*/
2451void pvr_txr_load_kimg(const kos_img_t *img, pvr_ptr_t dst, uint32_t flags);
2452
2453
2454
2455__END_DECLS
2456
2457#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:2010
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:1625
void pvr_set_pal_format(pvr_palfmt_t fmt)
Set the palette format.
pvr_palfmt_t
Definition pvr.h:1590
@ PVR_PAL_ARGB1555
16-bit ARGB1555 palette format
Definition pvr.h:1591
@ PVR_PAL_ARGB4444
16-bit ARGB4444 palette format
Definition pvr.h:1593
@ PVR_PAL_RGB565
16-bit RGB565 palette format
Definition pvr.h:1592
@ PVR_PAL_ARGB8888
32-bit ARGB8888 palette format
Definition pvr.h:1594
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:1194
#define PVR_PALETTE_TABLE_BASE
Base of the palette table.
Definition pvr.h:1293
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:1000
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:1378
int fsaa_enabled
Enable horizontal scaling?
Definition pvr.h:1402
int dma_enabled
Enable vertex DMA?
Definition pvr.h:1395
int vertex_buf_size
Vertex buffer size (should be a nice round number)
Definition pvr.h:1387
int autosort_disabled
Disable translucent polygon autosort?
Definition pvr.h:1410
int opb_overflow_count
OPB Overflow Count.
Definition pvr.h:1421
Modifier volume header.
Definition pvr.h:806
uint32_t d4
Dummy value.
Definition pvr.h:813
uint32_t mode1
Parameter word 1.
Definition pvr.h:809
uint32_t d5
Dummy value.
Definition pvr.h:814
uint32_t d2
Dummy value.
Definition pvr.h:811
uint32_t d3
Dummy value.
Definition pvr.h:812
uint32_t d1
Dummy value.
Definition pvr.h:810
uint32_t d6
Dummy value.
Definition pvr.h:815
PVR vertex type: Modifier volume.
Definition pvr.h:957
uint32_t d1
Dummy value.
Definition pvr.h:969
uint32_t d4
Dummy value.
Definition pvr.h:972
float by
Second Y coordinate.
Definition pvr.h:964
float ay
First Y coordinate.
Definition pvr.h:961
float ax
First X coordinate.
Definition pvr.h:960
uint32_t d3
Dummy value.
Definition pvr.h:971
float cz
Third Z coordinate.
Definition pvr.h:968
float bz
Second Z coordinate.
Definition pvr.h:965
float cy
Third Y coordinate.
Definition pvr.h:967
uint32_t d6
Dummy value.
Definition pvr.h:974
uint32_t d2
Dummy value.
Definition pvr.h:970
uint32_t d5
Dummy value.
Definition pvr.h:973
float bx
Second X coordinate.
Definition pvr.h:963
float az
First Z coordinate.
Definition pvr.h:962
float cx
Third X coordinate.
Definition pvr.h:966
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:731
uint32_t d1
Dummy value.
Definition pvr.h:737
uint32_t mode3
Parameter word 3.
Definition pvr.h:736
uint32_t mode1
Parameter word 1.
Definition pvr.h:734
uint32_t mode2
Parameter word 2.
Definition pvr.h:735
uint32_t d2
Dummy value.
Definition pvr.h:738
uint32_t d3
Dummy value.
Definition pvr.h:739
uint32_t d4
Dummy value.
Definition pvr.h:740
PVR polygon header with intensity color.
Definition pvr.h:749
float b
Face color blue component.
Definition pvr.h:758
uint32_t mode3
Parameter word 3.
Definition pvr.h:754
float r
Face color red component.
Definition pvr.h:756
uint32_t mode1
Parameter word 1.
Definition pvr.h:752
float a
Face color alpha component.
Definition pvr.h:755
uint32_t mode2
Parameter word 2.
Definition pvr.h:753
float g
Face color green component.
Definition pvr.h:757
PVR polygon header to be used with modifier volumes.
Definition pvr.h:768
uint32_t mode3_1
Parameter word 3 (inside volume)
Definition pvr.h:775
uint32_t d2
Dummy value.
Definition pvr.h:777
uint32_t mode2_0
Parameter word 2 (outside volume)
Definition pvr.h:772
uint32_t d1
Dummy value.
Definition pvr.h:776
uint32_t mode2_1
Parameter word 2 (inside volume)
Definition pvr.h:774
uint32_t mode1
Parameter word 1.
Definition pvr.h:771
uint32_t mode3_0
Parameter word 3 (outside volume)
Definition pvr.h:773
PVR vertex type: Untextured sprite.
Definition pvr.h:932
float bz
Second Z coordinate.
Definition pvr.h:940
float ay
First Y coordinate.
Definition pvr.h:936
uint32_t d3
Dummy value.
Definition pvr.h:948
float cz
Third Z coordinate.
Definition pvr.h:943
float bx
Second X coordinate.
Definition pvr.h:938
uint32_t d1
Dummy value.
Definition pvr.h:946
float cy
Third Y coordinate.
Definition pvr.h:942
float ax
First X coordinate.
Definition pvr.h:935
float by
Second Y coordinate.
Definition pvr.h:939
uint32_t d4
Dummy value.
Definition pvr.h:949
float dy
Fourth Y coordinate.
Definition pvr.h:945
uint32_t d2
Dummy value.
Definition pvr.h:947
float cx
Third X coordinate.
Definition pvr.h:941
float az
First Z coordinate.
Definition pvr.h:937
float dx
Fourth X coordinate.
Definition pvr.h:944
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:787
uint32_t oargb
Sprite offset color.
Definition pvr.h:794
uint32_t d2
Dummy value.
Definition pvr.h:796
uint32_t mode1
Parameter word 1.
Definition pvr.h:790
uint32_t mode2
Parameter word 2.
Definition pvr.h:791
uint32_t d1
Dummy value.
Definition pvr.h:795
uint32_t mode3
Parameter word 3.
Definition pvr.h:792
uint32_t argb
Sprite face color.
Definition pvr.h:793
PVR vertex type: Textured sprite.
Definition pvr.h:907
float bz
Second Z coordinate.
Definition pvr.h:915
float dx
Fourth X coordinate.
Definition pvr.h:919
float az
First Z coordinate.
Definition pvr.h:912
float ax
First X coordinate.
Definition pvr.h:910
uint32_t buv
Second U/V texture coordinates.
Definition pvr.h:923
float cz
Third Z coordinate.
Definition pvr.h:918
uint32_t dummy
Dummy value.
Definition pvr.h:921
float by
Second Y coordinate.
Definition pvr.h:914
uint32_t auv
First U/V texture coordinates.
Definition pvr.h:922
float dy
Fourth Y coordinate.
Definition pvr.h:920
float cx
Third X coordinate.
Definition pvr.h:916
uint32_t cuv
Third U/V texture coordinates.
Definition pvr.h:924
float bx
Second X coordinate.
Definition pvr.h:913
float cy
Third Y coordinate.
Definition pvr.h:917
float ay
First Y coordinate.
Definition pvr.h:911
PVR statistics structure.
Definition pvr.h:1539
size_t vtx_buffer_used
Number of bytes used in the vertex buffer for the last frame.
Definition pvr.h:1546
size_t vtx_buffer_used_max
Number of bytes used in the vertex buffer for the largest frame.
Definition pvr.h:1547
uint64_t buf_last_time
DMA buffer file time for the last frame in nanoseconds.
Definition pvr.h:1543
size_t frame_count
Total number of rendered/viewed frames.
Definition pvr.h:1544
uint64_t frame_last_time
Ready-to-Ready length for the last frame in nanoseconds.
Definition pvr.h:1540
float frame_rate
Current frame rate (per second)
Definition pvr.h:1548
uint32_t enabled_list_mask
Which lists are enabled?
Definition pvr.h:1549
size_t vbl_count
VBlank count.
Definition pvr.h:1545
uint64_t reg_last_time
Registration time for the last frame in nanoseconds.
Definition pvr.h:1541
uint64_t rnd_last_time
Rendering time for the last frame in nanoseconds.
Definition pvr.h:1542
PVR vertex type: Non-textured, packed color, affected by modifier volume.
Definition pvr.h:855
float z
Z coordinate.
Definition pvr.h:860
uint32_t d1
Dummy value.
Definition pvr.h:863
uint32_t argb0
Vertex color (outside volume)
Definition pvr.h:861
float x
X coordinate.
Definition pvr.h:858
float y
Y coordinate.
Definition pvr.h:859
uint32_t d2
Dummy value.
Definition pvr.h:864
uint32_t argb1
Vertex color (inside volume)
Definition pvr.h:862
Generic PVR vertex type.
Definition pvr.h:835
float z
Z coordinate.
Definition pvr.h:840
float y
Y coordinate.
Definition pvr.h:839
float u
Texture U coordinate.
Definition pvr.h:841
uint32_t oargb
Vertex offset color.
Definition pvr.h:844
float x
X coordinate.
Definition pvr.h:838
float v
Texture V coordinate.
Definition pvr.h:842
uint32_t argb
Vertex color.
Definition pvr.h:843
PVR vertex type: Textured, packed color, affected by modifier volume.
Definition pvr.h:875
float z
Z coordinate.
Definition pvr.h:880
uint32_t oargb1
Vertex offset color (inside)
Definition pvr.h:888
uint32_t oargb0
Vertex offset color (outside)
Definition pvr.h:884
float x
X coordinate.
Definition pvr.h:878
float u0
Texture U coordinate (outside)
Definition pvr.h:881
uint32_t d2
Dummy value.
Definition pvr.h:890
float v0
Texture V coordinate (outside)
Definition pvr.h:882
uint32_t d4
Dummy value.
Definition pvr.h:892
float u1
Texture U coordinate (inside)
Definition pvr.h:885
float y
Y coordinate.
Definition pvr.h:879
float v1
Texture V coordinate (inside)
Definition pvr.h:886
uint32_t argb0
Vertex color (outside)
Definition pvr.h:883
uint32_t argb1
Vertex color (inside)
Definition pvr.h:887
uint32_t d1
Dummy value.
Definition pvr.h:889
uint32_t d3
Dummy value.
Definition pvr.h:891
Common integer types.