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 <kos/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 <kos/img.h>
50#include <kos/regfield.h>
51
52/* Note: This file also #includes headers from dc/pvr/. They are mostly
53 at the bottom of the file to be able to use types defined throughout. */
54
55#include "pvr/pvr_mem.h"
56#include "pvr/pvr_header.h"
57
58/** \defgroup pvr PowerVR API
59 \brief Low-level PowerVR GPU Driver.
60 \ingroup video
61*/
62
63/* Data types ********************************************************/
64
65/** \defgroup pvr_lists Polygon Lists
66 \brief Types pertaining to PVR list types: opaque, pt, tr, etc
67 \ingroup pvr
68*/
69
70/** \brief PVR list specification.
71 \ingroup pvr_lists
72
73 Each primitive in the PVR is submitted to one of the hardware primitive
74 lists. This type is an identifier for a list.
75
76 \see pvr_lists
77*/
79
80/** \defgroup pvr_geometry Geometry
81 \brief PVR API for managing scene geometry
82 \ingroup pvr
83*/
84
85/** \defgroup pvr_primitives Primitives
86 \brief Polygon and sprite management
87 \ingroup pvr_geometry
88*/
89
90/** \defgroup pvr_ctx Contexts
91 \brief User-friendly intermittent primitive representation
92 \ingroup pvr_primitives
93*/
94
95/** \brief PVR polygon context.
96 \ingroup pvr_ctx
97
98 You should use this more human readable format for specifying your polygon
99 contexts, and then compile them into polygon headers when you are ready to
100 start using them.
101
102 This has embedded structures in it for two reasons; the first reason is to
103 make it easier for me to add new stuff later without breaking existing code.
104 The second reason is to make it more readable and usable.
105
106 Unfortunately, it seems that Doxygen chokes up a little bit on this
107 structure, and others like it. The documentation should still be mostly
108 understandable though...
109
110 \headerfile dc/pvr.h
111*/
112typedef struct {
113 int list_type; /**< \brief Primitive list
114 \see pvr_lists */
115 struct {
116 int alpha; /**< \brief Enable or disable alpha outside modifier
117 \see pvr_alpha_switch */
118 int shading; /**< \brief Shading type
119 \see pvr_shading_types */
120 int fog_type; /**< \brief Fog type outside modifier
121 \see pvr_fog_types */
122 int culling; /**< \brief Culling mode
123 \see pvr_cull_modes */
124 int color_clamp; /**< \brief Color clamp enable/disable outside modifier
125 \see pvr_colclamp_switch */
126 int clip_mode; /**< \brief Clipping mode
127 \see pvr_clip_modes */
128 int modifier_mode; /**< \brief Modifier mode */
129 int specular; /**< \brief Offset color enable/disable outside modifier
130 \see pvr_offset_switch */
131 int alpha2; /**< \brief Enable/disable alpha inside modifier
132 \see pvr_alpha_switch */
133 int fog_type2; /**< \brief Fog type inside modifier
134 \see pvr_fog_types */
135 int color_clamp2; /**< \brief Color clamp enable/disable inside modifier
136 \see pvr_colclamp_switch */
137 } gen; /**< \brief General parameters */
138 struct {
139 int src; /**< \brief Source blending mode outside modifier
140 \see pvr_blend_modes */
141 int dst; /**< \brief Dest blending mode outside modifier
142 \see pvr_blend_modes */
143 int src_enable; /**< \brief Source blending enable outside modifier
144 \see pvr_blend_switch */
145 int dst_enable; /**< \brief Dest blending enable outside modifier
146 \see pvr_blend_switch */
147 int src2; /**< \brief Source blending mode inside modifier
148 \see pvr_blend_modes */
149 int dst2; /**< \brief Dest blending mode inside modifier
150 \see pvr_blend_modes */
151 int src_enable2; /**< \brief Source blending mode inside modifier
152 \see pvr_blend_switch */
153 int dst_enable2; /**< \brief Dest blending mode inside modifier
154 \see pvr_blend_switch */
155 } blend; /**< \brief Blending parameters */
156 struct {
157 int color; /**< \brief Color format in vertex
158 \see pvr_color_fmts */
159 int uv; /**< \brief U/V data format in vertex
160 \see pvr_uv_fmts */
161 int modifier; /**< \brief Enable or disable modifier effect
162 \see pvr_mod_switch */
163 } fmt; /**< \brief Format control */
164 struct {
165 int comparison; /**< \brief Depth comparison mode
166 \see pvr_depth_modes */
167 int write; /**< \brief Enable or disable depth writes
168 \see pvr_depth_switch */
169 } depth; /**< \brief Depth comparison/write modes */
170 struct {
171 int enable; /**< \brief Enable/disable texturing
172 \see pvr_txr_switch */
173 int filter; /**< \brief Filtering mode
174 \see pvr_filter_modes */
175 int mipmap; /**< \brief Enable/disable mipmaps
176 \see pvr_mip_switch */
177 int mipmap_bias; /**< \brief Mipmap bias
178 \see pvr_mip_bias */
179 int uv_flip; /**< \brief Enable/disable U/V flipping
180 \see pvr_uv_flip */
181 int uv_clamp; /**< \brief Enable/disable U/V clamping
182 \see pvr_uv_clamp */
183 int alpha; /**< \brief Enable/disable texture alpha
184 \see pvr_txralpha_switch */
185 int env; /**< \brief Texture color contribution
186 \see pvr_txrenv_modes */
187 int width; /**< \brief Texture width (requires a power of 2) */
188 int height; /**< \brief Texture height (requires a power of 2) */
189 int format; /**< \brief Texture format
190 \see pvr_txr_fmts */
191 pvr_ptr_t base; /**< \brief Texture pointer */
192 } txr; /**< \brief Texturing params outside modifier */
193 struct {
194 int enable; /**< \brief Enable/disable texturing
195 \see pvr_txr_switch */
196 int filter; /**< \brief Filtering mode
197 \see pvr_filter_modes */
198 int mipmap; /**< \brief Enable/disable mipmaps
199 \see pvr_mip_switch */
200 int mipmap_bias; /**< \brief Mipmap bias
201 \see pvr_mip_bias */
202 int uv_flip; /**< \brief Enable/disable U/V flipping
203 \see pvr_uv_flip */
204 int uv_clamp; /**< \brief Enable/disable U/V clamping
205 \see pvr_uv_clamp */
206 int alpha; /**< \brief Enable/disable texture alpha
207 \see pvr_txralpha_switch */
208 int env; /**< \brief Texture color contribution
209 \see pvr_txrenv_modes */
210 int width; /**< \brief Texture width (requires a power of 2) */
211 int height; /**< \brief Texture height (requires a power of 2) */
212 int format; /**< \brief Texture format
213 \see pvr_txr_fmts */
214 pvr_ptr_t base; /**< \brief Texture pointer */
215 } txr2; /**< \brief Texturing params inside modifier */
217
218/** \brief PVR sprite context.
219 \ingroup pvr_ctx
220
221 You should use this more human readable format for specifying your sprite
222 contexts, and then compile them into sprite headers when you are ready to
223 start using them.
224
225 Unfortunately, it seems that Doxygen chokes up a little bit on this
226 structure, and others like it. The documentation should still be mostly
227 understandable though...
228
229 \headerfile dc/pvr.h
230*/
231typedef struct {
232 int list_type; /**< \brief Primitive list
233 \see pvr_lists */
234 struct {
235 int alpha; /**< \brief Enable or disable alpha
236 \see pvr_alpha_switch */
237 int fog_type; /**< \brief Fog type
238 \see pvr_fog_types */
239 int culling; /**< \brief Culling mode
240 \see pvr_cull_modes */
241 int color_clamp; /**< \brief Color clamp enable/disable
242 \see pvr_colclamp_switch */
243 int clip_mode; /**< \brief Clipping mode
244 \see pvr_clip_modes */
245 int specular; /**< \brief Offset color enable/disable
246 \see pvr_offset_switch */
247 } gen; /**< \brief General parameters */
248 struct {
249 int src; /**< \brief Source blending mode
250 \see pvr_blend_modes */
251 int dst; /**< \brief Dest blending mode
252 \see pvr_blend_modes */
253 int src_enable; /**< \brief Source blending enable
254 \see pvr_blend_switch */
255 int dst_enable; /**< \brief Dest blending enable
256 \see pvr_blend_switch */
257 } blend;
258 struct {
259 int comparison; /**< \brief Depth comparison mode
260 \see pvr_depth_modes */
261 int write; /**< \brief Enable or disable depth writes
262 \see pvr_depth_switch */
263 } depth; /**< \brief Depth comparison/write modes */
264 struct {
265 int enable; /**< \brief Enable/disable texturing
266 \see pvr_txr_switch */
267 int filter; /**< \brief Filtering mode
268 \see pvr_filter_modes */
269 int mipmap; /**< \brief Enable/disable mipmaps
270 \see pvr_mip_switch */
271 int mipmap_bias; /**< \brief Mipmap bias
272 \see pvr_mip_bias */
273 int uv_flip; /**< \brief Enable/disable U/V flipping
274 \see pvr_uv_flip */
275 int uv_clamp; /**< \brief Enable/disable U/V clamping
276 \see pvr_uv_clamp */
277 int alpha; /**< \brief Enable/disable texture alpha
278 \see pvr_txralpha_switch */
279 int env; /**< \brief Texture color contribution
280 \see pvr_txrenv_modes */
281 int width; /**< \brief Texture width (requires a power of 2) */
282 int height; /**< \brief Texture height (requires a power of 2) */
283 int format; /**< \brief Texture format
284 \see pvr_txr_fmts */
285 pvr_ptr_t base; /**< \brief Texture pointer */
286 } txr; /**< \brief Texturing params */
288
289/* Constants for the above structure; thanks to Benoit Miller for these */
290
291/** \defgroup pvr_ctx_attrib Attributes
292 \brief PVR primitive context attributes
293 \ingroup pvr_ctx
294*/
295
296/** \defgroup pvr_shading_types Shading Modes
297 \brief PowerVR primitive context shading modes
298 \ingroup pvr_ctx_attrib
299
300 Each polygon can define how it wants to be shaded, be it with flat or
301 Gouraud shading using these constants in the appropriate place in its
302 pvr_poly_cxt_t.
303
304 @{
305*/
306#define PVR_SHADE_FLAT 0 /**< \brief Use flat shading */
307#define PVR_SHADE_GOURAUD 1 /**< \brief Use Gouraud shading */
308/** @} */
309
310/** \defgroup pvr_ctx_depth Depth
311 \brief Depth attributes for PVR polygon contexts
312 \ingroup pvr_ctx_attrib
313*/
314
315/** \defgroup pvr_depth_switch Write Toggle
316 \brief Enable or Disable Depth Writes.
317 \ingroup pvr_ctx_depth
318 @{
319*/
320#define PVR_DEPTHWRITE_ENABLE 0 /**< \brief Update the Z value */
321#define PVR_DEPTHWRITE_DISABLE 1 /**< \brief Do not update the Z value */
322/** @} */
323
324/** \defgroup pvr_ctx_texture Texture
325 \brief Texture attributes for PVR polygon contexts
326 \ingroup pvr_ctx_attrib
327*/
328
329/** \defgroup pvr_txr_switch Toggle
330 \brief Enable or Disable Texturing on Polygons.
331 \ingroup pvr_ctx_texture
332
333 @{
334*/
335#define PVR_TEXTURE_DISABLE 0 /**< \brief Disable texturing */
336#define PVR_TEXTURE_ENABLE 1 /**< \brief Enable texturing */
337/** @} */
338
339/** \defgroup pvr_blend Blending
340 \brief Blending attributes for PVR primitive contexts
341 \ingroup pvr_ctx_attrib
342*/
343
344/** \defgroup pvr_blend_switch Blending Toggle
345 \brief Enable or Disable Blending.
346 \ingroup pvr_blend
347
348 @{
349*/
350#define PVR_BLEND_DISABLE 0 /**< \brief Disable blending */
351#define PVR_BLEND_ENABLE 1 /**< \brief Enable blending */
352/** @} */
353
354/** \defgroup pvr_ctx_color Color
355 \brief Color attributes for PowerVR primitive contexts
356 \ingroup pvr_ctx_attrib
357*/
358
359/** \defgroup pvr_colclamp_switch Clamping Toggle
360 \brief Enable or Disable Color Clamping
361 \ingroup pvr_ctx_color
362
363 Enabling color clamping will clamp colors between the minimum and maximum
364 values before any sort of fog processing.
365
366 @{
367*/
368#define PVR_CLRCLAMP_DISABLE 0 /**< \brief Disable color clamping */
369#define PVR_CLRCLAMP_ENABLE 1 /**< \brief Enable color clamping */
370/** @} */
371
372/** \defgroup pvr_offset_switch Offset Toggle
373 \brief Enable or Disable Offset Color
374 \ingroup pvr_ctx_color
375
376 Enabling offset color calculation allows for "specular" like effects on a
377 per-vertex basis, by providing an additive color in the calculation of the
378 final pixel colors. In vertex types with a "oargb" parameter, that's what it
379 is for.
380
381 \note
382 This must be enabled for bumpmap polygons in order to allow you to
383 specify the parameters in the oargb field of the vertices.
384
385 @{
386*/
387#define PVR_SPECULAR_DISABLE 0 /**< \brief Disable offset colors */
388#define PVR_SPECULAR_ENABLE 1 /**< \brief Enable offset colors */
389/** @} */
390
391/** \defgroup pvr_alpha_switch Alpha Toggle
392 \brief Enable or Disable Alpha Blending
393 \ingroup pvr_blend
394
395 This causes the alpha value in the vertex color to be paid attention to. It
396 really only makes sense to enable this for translucent or punch-thru polys.
397
398 @{
399*/
400#define PVR_ALPHA_DISABLE 0 /**< \brief Disable alpha blending */
401#define PVR_ALPHA_ENABLE 1 /**< \brief Enable alpha blending */
402/** @} */
403
404/** \defgroup pvr_txralpha_switch Alpha Toggle
405 \brief Enable or Disable Texture Alpha Blending
406 \ingroup pvr_ctx_texture
407
408 This causes the alpha value in the texel color to be paid attention to. It
409 really only makes sense to enable this for translucent or punch-thru polys.
410
411 @{
412*/
413#define PVR_TXRALPHA_ENABLE 0 /**< \brief Enable alpha blending */
414#define PVR_TXRALPHA_DISABLE 1 /**< \brief Disable alpha blending */
415/** @} */
416
417/** \defgroup pvr_uv_flip U/V Flip Mode
418 \brief Enable or disable U/V flipping on the PVR
419 \ingroup pvr_ctx_texture
420
421 These flags determine what happens when U/V coordinate values exceed 1.0.
422 In any of the flipped cases, the specified coordinate value will flip around
423 after 1.0, essentially mirroring the image. So, if you displayed an image
424 with a U coordinate of 0.0 on the left hand side and 2.0 on the right hand
425 side with U flipping turned on, you'd have an image that was displayed twice
426 as if mirrored across the middle. This mirroring behavior happens at every
427 unit boundary (so at 2.0 it returns to normal, at 3.0 it flips, etc).
428
429 The default case is to disable mirroring. In addition, clamping of the U/V
430 coordinates by PVR_UVCLAMP_U, PVR_UVCLAMP_V, or PVR_UVCLAMP_UV will disable
431 the mirroring behavior.
432 @{
433*/
434#define PVR_UVFLIP_NONE 0 /**< \brief No flipped coordinates */
435#define PVR_UVFLIP_V 1 /**< \brief Flip V only */
436#define PVR_UVFLIP_U 2 /**< \brief Flip U only */
437#define PVR_UVFLIP_UV 3 /**< \brief Flip U and V */
438/** @} */
439
440/** \defgroup pvr_uv_clamp U/V Clamp Mode
441 \brief Enable or disable clamping of U/V on the PVR
442 \ingroup pvr_ctx_texture
443
444 These flags determine whether clamping will be applied to U/V coordinate
445 values that exceed 1.0. If enabled, these modes will explicitly override the
446 flip/mirroring modes (PVR_UVFLIP_U, PVR_UVFLIP_V, and PVR_UVFLIP_UV), and
447 will instead ensure that the coordinate(s) in question never exceed 1.0.
448 @{
449*/
450#define PVR_UVCLAMP_NONE 0 /**< \brief Disable clamping */
451#define PVR_UVCLAMP_V 1 /**< \brief Clamp V only */
452#define PVR_UVCLAMP_U 2 /**< \brief Clamp U only */
453#define PVR_UVCLAMP_UV 3 /**< \brief Clamp U and V */
454/** @} */
455
456/** \defgroup pvr_mip_bias Mipmap Bias Modes
457 \brief Mipmap bias modes for PowerVR primitive contexts
458 \ingroup pvr_ctx_texture
459
460 @{
461*/
462#define PVR_MIPBIAS_NORMAL PVR_MIPBIAS_1_00 /* txr_mipmap_bias */
463#define PVR_MIPBIAS_0_25 1
464#define PVR_MIPBIAS_0_50 2
465#define PVR_MIPBIAS_0_75 3
466#define PVR_MIPBIAS_1_00 4
467#define PVR_MIPBIAS_1_25 5
468#define PVR_MIPBIAS_1_50 6
469#define PVR_MIPBIAS_1_75 7
470#define PVR_MIPBIAS_2_00 8
471#define PVR_MIPBIAS_2_25 9
472#define PVR_MIPBIAS_2_50 10
473#define PVR_MIPBIAS_2_75 11
474#define PVR_MIPBIAS_3_00 12
475#define PVR_MIPBIAS_3_25 13
476#define PVR_MIPBIAS_3_50 14
477#define PVR_MIPBIAS_3_75 15
478/** @} */
479
480/** \defgroup pvr_mip_switch Mipmap Toggle
481 \brief Enable or Disable Mipmap Processing
482 \ingroup pvr_ctx_texture
483
484 @{
485*/
486#define PVR_MIPMAP_DISABLE 0 /**< \brief Disable mipmap processing */
487#define PVR_MIPMAP_ENABLE 1 /**< \brief Enable mipmap processing */
488/** @} */
489
490/** \defgroup pvr_txr_fmts Formats
491 \brief PowerVR texture formats
492 \ingroup pvr_txr_mgmt
493
494 These are the texture formats that the PVR supports. Note that some of
495 these, you can OR together with other values.
496
497 @{
498*/
499#define PVR_TXRFMT_NONE 0 /**< \brief No texture */
500#define PVR_TXRFMT_VQ_DISABLE (0 << 30) /**< \brief Not VQ encoded */
501#define PVR_TXRFMT_VQ_ENABLE (1 << 30) /**< \brief VQ encoded */
502#define PVR_TXRFMT_ARGB1555 (0 << 27) /**< \brief 16-bit ARGB1555 */
503#define PVR_TXRFMT_RGB565 (1 << 27) /**< \brief 16-bit RGB565 */
504#define PVR_TXRFMT_ARGB4444 (2 << 27) /**< \brief 16-bit ARGB4444 */
505#define PVR_TXRFMT_YUV422 (3 << 27) /**< \brief YUV422 format */
506#define PVR_TXRFMT_BUMP (4 << 27) /**< \brief Bumpmap format */
507#define PVR_TXRFMT_PAL4BPP (5 << 27) /**< \brief 4BPP paletted format */
508#define PVR_TXRFMT_PAL8BPP (6 << 27) /**< \brief 8BPP paletted format */
509#define PVR_TXRFMT_TWIDDLED (0 << 26) /**< \brief Texture is twiddled */
510#define PVR_TXRFMT_NONTWIDDLED (1 << 26) /**< \brief Texture is not twiddled */
511#define PVR_TXRFMT_POW2_STRIDE (0 << 25) /**< \brief Stride is a power-of-two */
512#define PVR_TXRFMT_X32_STRIDE (1 << 25) /**< \brief Stride is multiple of 32 */
513
514/* Compat. */
515static const uint32_t PVR_TXRFMT_NOSTRIDE __depr("Please use PVR_TXRFMT_POW2_STRIDE.") = PVR_TXRFMT_POW2_STRIDE;
516static const uint32_t PVR_TXRFMT_STRIDE __depr("Please use PVR_TXRFMT_X32_STRIDE. Note this may cause breakage as PVR_TXRFMT_STRIDE was never working correctly." ) = PVR_TXRFMT_X32_STRIDE;
517
518/* OR one of these into your texture format if you need it. Note that
519 these coincide with the twiddled/stride bits, so you can't have a
520 non-twiddled/strided texture that's paletted! */
521
522/** \brief 8BPP palette selector
523
524 \param x The palette index */
525#define PVR_TXRFMT_8BPP_PAL(x) ((x) << 25)
526
527/** \brief 4BPP palette selector
528
529 \param x The palette index */
530#define PVR_TXRFMT_4BPP_PAL(x) ((x) << 21)
531/** @} */
532
533/** \defgroup pvr_color_fmts Vertex Formats
534 \brief Color formats for PowerVR vertices
535 \ingroup pvr_ctx_color
536
537 These control how colors are represented in polygon data.
538
539 @{
540*/
541#define PVR_CLRFMT_ARGBPACKED 0 /**< \brief 32-bit integer ARGB */
542#define PVR_CLRFMT_4FLOATS 1 /**< \brief 4 floating point values */
543#define PVR_CLRFMT_INTENSITY 2 /**< \brief Intensity color */
544#define PVR_CLRFMT_INTENSITY_PREV 3 /**< \brief Use last intensity */
545/** @} */
546
547/** \defgroup pvr_uv_fmts U/V Data Format
548 \brief U/V data format for PVR textures
549 \ingroup pvr_ctx_texture
550 @{
551*/
552#define PVR_UVFMT_32BIT 0 /**< \brief 32-bit floating point U/V */
553#define PVR_UVFMT_16BIT 1 /**< \brief 16-bit floating point U/V */
554/** @} */
555
556/** \defgroup pvr_ctx_modvol Modifier Volumes
557 \brief PowerVR modifier volume polygon context attributes
558 \ingroup pvr_ctx_attrib
559*/
560
561/** \defgroup pvr_mod_switch Toggle
562 \brief Enable or Disable Modifier Effects
563 \ingroup pvr_ctx_modvol
564 @{
565*/
566#define PVR_MODIFIER_DISABLE 0 /**< \brief Disable modifier effects */
567#define PVR_MODIFIER_ENABLE 1 /**< \brief Enable modifier effects */
568/** @} */
569
570/** \defgroup pvr_mod_types Types
571 \brief Modifier volume types for PowerVR primitive contexts
572 \ingroup pvr_ctx_modvol
573 @{
574*/
575#define PVR_MODIFIER_CHEAP_SHADOW 0
576#define PVR_MODIFIER_NORMAL 1
577/** @} */
578
579/** \defgroup pvr_mod_modes Modes
580 \brief Modifier volume modes for PowerVR primitive contexts
581 \ingroup pvr_ctx_modvol
582
583 All triangles in a single modifier volume should be of the other poly type,
584 except for the last one. That should be either of the other two types,
585 depending on whether you want an inclusion or exclusion volume.
586
587 @{
588*/
589#define PVR_MODIFIER_OTHER_POLY 0 /**< \brief Not the last polygon in the volume */
590#define PVR_MODIFIER_INCLUDE_LAST_POLY 1 /**< \brief Last polygon, inclusion volume */
591#define PVR_MODIFIER_EXCLUDE_LAST_POLY 2 /**< \brief Last polygon, exclusion volume */
592/** @} */
593
594/** \defgroup pvr_primitives_headers Headers
595 \brief Compiled headers for polygons and sprites
596 \ingroup pvr_primitives
597
598 @{
599*/
600
601/** \brief PVR polygon header with intensity color.
602
603 This is the equivalent of pvr_poly_hdr_t, but for use with intensity color.
604
605 \headerfile dc/pvr.h
606*/
607#define pvr_poly_ic_hdr pvr_poly_hdr
609
610/** \brief PVR polygon header to be used with modifier volumes.
611
612 This is the equivalent of a pvr_poly_hdr_t for use when a polygon is to be
613 used with modifier volumes.
614
615 \headerfile dc/pvr.h
616*/
617#define pvr_poly_mod_hdr pvr_poly_hdr
619
620/** \brief PVR polygon header specifically for sprites.
621
622 This is the equivalent of a pvr_poly_hdr_t for use when a quad/sprite is to
623 be rendered. Note that the color data is here, not in the vertices.
624
625 \headerfile dc/pvr.h
626*/
627#define pvr_sprite_hdr pvr_poly_hdr
629
630/** \brief Modifier volume header.
631
632 This is the header that should be submitted when dealing with setting a
633 modifier volume.
634
635 \headerfile dc/pvr.h
636*/
637#define pvr_mod_hdr pvr_poly_hdr
639/** @} */
640
641/** \defgroup pvr_vertex_types Vertices
642 \brief PowerVR vertex types
643 \ingroup pvr_geometry
644
645 @{
646*/
647
648/** \brief Generic PVR vertex type.
649
650 The PVR chip itself supports many more vertex types, but this is the main
651 one that can be used with both textured and non-textured polygons, and is
652 fairly fast.
653
654 \headerfile dc/pvr.h
655*/
656typedef struct pvr_vertex {
657 alignas(32)
658 uint32_t flags; /**< \brief TA command (vertex flags) */
659 float x; /**< \brief X coordinate */
660 float y; /**< \brief Y coordinate */
661 float z; /**< \brief Z coordinate */
662 union {
663 struct {
664 float u; /**< \brief Texture U coordinate */
665 float v; /**< \brief Texture V coordinate */
666 };
667 struct {
668 uint32_t argb0; /**< \brief Vertex color when modified, outside area */
669 uint32_t argb1; /**< \brief Vertex color when modified, inside area */
670 };
671 };
672 uint32_t argb; /**< \brief Vertex color */
673 uint32_t oargb; /**< \brief Vertex offset color */
675
676/** \brief PVR vertex type: Non-textured, packed color, affected by modifier
677 volume.
678
679 This vertex type has two copies of colors. The second color is used when
680 enclosed within a modifier volume.
681
682 \headerfile dc/pvr.h
683*/
684typedef struct pvr_vertex_pcm {
685 alignas(32)
686 uint32_t flags; /**< \brief TA command (vertex flags) */
687 float x; /**< \brief X coordinate */
688 float y; /**< \brief Y coordinate */
689 float z; /**< \brief Z coordinate */
690 uint32_t argb0; /**< \brief Vertex color (outside volume) */
691 uint32_t argb1; /**< \brief Vertex color (inside volume) */
692 uint32_t d1; /**< \brief Dummy value */
693 uint32_t d2; /**< \brief Dummy value */
695
696/** \brief PVR vertex type: Textured, packed color, affected by modifier volume.
697
698 Note that this vertex type has two copies of colors, offset colors, and
699 texture coords. The second set of texture coords, colors, and offset colors
700 are used when enclosed within a modifier volume.
701
702 \headerfile dc/pvr.h
703*/
704typedef struct pvr_vertex_tpcm {
705 alignas(32)
706 uint32_t flags; /**< \brief TA command (vertex flags) */
707 float x; /**< \brief X coordinate */
708 float y; /**< \brief Y coordinate */
709 float z; /**< \brief Z coordinate */
710 float u0; /**< \brief Texture U coordinate (outside) */
711 float v0; /**< \brief Texture V coordinate (outside) */
712 uint32_t argb0; /**< \brief Vertex color (outside) */
713 uint32_t oargb0; /**< \brief Vertex offset color (outside) */
714 float u1; /**< \brief Texture U coordinate (inside) */
715 float v1; /**< \brief Texture V coordinate (inside) */
716 uint32_t argb1; /**< \brief Vertex color (inside) */
717 uint32_t oargb1; /**< \brief Vertex offset color (inside) */
718 uint32_t d1; /**< \brief Dummy value */
719 uint32_t d2; /**< \brief Dummy value */
720 uint32_t d3; /**< \brief Dummy value */
721 uint32_t d4; /**< \brief Dummy value */
723
724/** \brief PVR vertex type: Textured sprite.
725
726 This vertex type is to be used with the sprite polygon header and the sprite
727 related commands to draw textured sprites. Note that there is no fourth Z
728 coordinate. I suppose it just gets interpolated?
729
730 The U/V coordinates in here are in the 16-bit per coordinate form. Also,
731 like the fourth Z value, there is no fourth U or V, so it must get
732 interpolated from the others.
733
734 \headerfile dc/pvr.h
735*/
736typedef struct pvr_sprite_txr {
737 alignas(32)
738 uint32_t flags; /**< \brief TA command (vertex flags) */
739 float ax; /**< \brief First X coordinate */
740 float ay; /**< \brief First Y coordinate */
741 float az; /**< \brief First Z coordinate */
742 float bx; /**< \brief Second X coordinate */
743 float by; /**< \brief Second Y coordinate */
744 float bz; /**< \brief Second Z coordinate */
745 float cx; /**< \brief Third X coordinate */
746 float cy; /**< \brief Third Y coordinate */
747 float cz; /**< \brief Third Z coordinate */
748 float dx; /**< \brief Fourth X coordinate */
749 float dy; /**< \brief Fourth Y coordinate */
750 uint32_t dummy; /**< \brief Dummy value */
751 uint32_t auv; /**< \brief First U/V texture coordinates */
752 uint32_t buv; /**< \brief Second U/V texture coordinates */
753 uint32_t cuv; /**< \brief Third U/V texture coordinates */
755
756/** \brief PVR vertex type: Untextured sprite.
757
758 This vertex type is to be used with the sprite polygon header and the sprite
759 related commands to draw untextured sprites (aka, quads).
760*/
761typedef struct pvr_sprite_col {
762 alignas(32)
763 uint32_t flags; /**< \brief TA command (vertex flags) */
764 float ax; /**< \brief First X coordinate */
765 float ay; /**< \brief First Y coordinate */
766 float az; /**< \brief First Z coordinate */
767 float bx; /**< \brief Second X coordinate */
768 float by; /**< \brief Second Y coordinate */
769 float bz; /**< \brief Second Z coordinate */
770 float cx; /**< \brief Third X coordinate */
771 float cy; /**< \brief Third Y coordinate */
772 float cz; /**< \brief Third Z coordinate */
773 float dx; /**< \brief Fourth X coordinate */
774 float dy; /**< \brief Fourth Y coordinate */
775 uint32_t d1; /**< \brief Dummy value */
776 uint32_t d2; /**< \brief Dummy value */
777 uint32_t d3; /**< \brief Dummy value */
778 uint32_t d4; /**< \brief Dummy value */
780
781/** \brief PVR vertex type: Modifier volume.
782
783 This vertex type is to be used with the modifier volume header to specify
784 triangular modifier areas.
785*/
786typedef struct pvr_modifier_vol {
787 alignas(32)
788 uint32_t flags; /**< \brief TA command (vertex flags) */
789 float ax; /**< \brief First X coordinate */
790 float ay; /**< \brief First Y coordinate */
791 float az; /**< \brief First Z coordinate */
792 float bx; /**< \brief Second X coordinate */
793 float by; /**< \brief Second Y coordinate */
794 float bz; /**< \brief Second Z coordinate */
795 float cx; /**< \brief Third X coordinate */
796 float cy; /**< \brief Third Y coordinate */
797 float cz; /**< \brief Third Z coordinate */
798 uint32_t d1; /**< \brief Dummy value */
799 uint32_t d2; /**< \brief Dummy value */
800 uint32_t d3; /**< \brief Dummy value */
801 uint32_t d4; /**< \brief Dummy value */
802 uint32_t d5; /**< \brief Dummy value */
803 uint32_t d6; /**< \brief Dummy value */
805
806/** @} */
807
808/** \defgroup pvr_commands TA Command Values
809 \brief Command values for submitting data to the TA
810 \ingroup pvr_primitives_headers
811
812 These are are appropriate values for TA commands. Use whatever goes with the
813 primitive type you're using.
814
815 @{
816*/
817#define PVR_CMD_POLYHDR 0x80840000 /**< \brief PVR polygon header.
818Striplength set to 2 */
819#define PVR_CMD_VERTEX 0xe0000000 /**< \brief PVR vertex data */
820#define PVR_CMD_VERTEX_EOL 0xf0000000 /**< \brief PVR vertex, end of strip */
821#define PVR_CMD_USERCLIP 0x20000000 /**< \brief PVR user clipping area */
822#define PVR_CMD_MODIFIER 0x80000000 /**< \brief PVR modifier volume */
823#define PVR_CMD_SPRITE 0xA0000000 /**< \brief PVR sprite header */
824/** @} */
825
826/** \cond
827 Deprecated macros, replaced by the pvr_bitmasks macros below.
828 */
829#define PVR_TA_CMD_TYPE_SHIFT 24
830#define PVR_TA_CMD_TYPE_MASK (7 << PVR_TA_CMD_TYPE_SHIFT)
831
832#define PVR_TA_CMD_USERCLIP_SHIFT 16
833#define PVR_TA_CMD_USERCLIP_MASK (3 << PVR_TA_CMD_USERCLIP_SHIFT)
834
835#define PVR_TA_CMD_CLRFMT_SHIFT 4
836#define PVR_TA_CMD_CLRFMT_MASK (7 << PVR_TA_CMD_CLRFMT_SHIFT)
837
838#define PVR_TA_CMD_SPECULAR_SHIFT 2
839#define PVR_TA_CMD_SPECULAR_MASK (1 << PVR_TA_CMD_SPECULAR_SHIFT)
840
841#define PVR_TA_CMD_SHADE_SHIFT 1
842#define PVR_TA_CMD_SHADE_MASK (1 << PVR_TA_CMD_SHADE_SHIFT)
843
844#define PVR_TA_CMD_UVFMT_SHIFT 0
845#define PVR_TA_CMD_UVFMT_MASK (1 << PVR_TA_CMD_UVFMT_SHIFT)
846
847#define PVR_TA_CMD_MODIFIER_SHIFT 7
848#define PVR_TA_CMD_MODIFIER_MASK (1 << PVR_TA_CMD_MODIFIER_SHIFT)
849
850#define PVR_TA_CMD_MODIFIERMODE_SHIFT 6
851#define PVR_TA_CMD_MODIFIERMODE_MASK (1 << PVR_TA_CMD_MODIFIERMODE_SHIFT)
852
853#define PVR_TA_PM1_DEPTHCMP_SHIFT 29
854#define PVR_TA_PM1_DEPTHCMP_MASK (7 << PVR_TA_PM1_DEPTHCMP_SHIFT)
855
856#define PVR_TA_PM1_CULLING_SHIFT 27
857#define PVR_TA_PM1_CULLING_MASK (3 << PVR_TA_PM1_CULLING_SHIFT)
858
859#define PVR_TA_PM1_DEPTHWRITE_SHIFT 26
860#define PVR_TA_PM1_DEPTHWRITE_MASK (1 << PVR_TA_PM1_DEPTHWRITE_SHIFT)
861
862#define PVR_TA_PM1_TXRENABLE_SHIFT 25
863#define PVR_TA_PM1_TXRENABLE_MASK (1 << PVR_TA_PM1_TXRENABLE_SHIFT)
864
865#define PVR_TA_PM1_MODIFIERINST_SHIFT 29
866#define PVR_TA_PM1_MODIFIERINST_MASK (3 << PVR_TA_PM1_MODIFIERINST_SHIFT)
867
868#define PVR_TA_PM2_SRCBLEND_SHIFT 29
869#define PVR_TA_PM2_SRCBLEND_MASK (7 << PVR_TA_PM2_SRCBLEND_SHIFT)
870
871#define PVR_TA_PM2_DSTBLEND_SHIFT 26
872#define PVR_TA_PM2_DSTBLEND_MASK (7 << PVR_TA_PM2_DSTBLEND_SHIFT)
873
874#define PVR_TA_PM2_SRCENABLE_SHIFT 25
875#define PVR_TA_PM2_SRCENABLE_MASK (1 << PVR_TA_PM2_SRCENABLE_SHIFT)
876
877#define PVR_TA_PM2_DSTENABLE_SHIFT 24
878#define PVR_TA_PM2_DSTENABLE_MASK (1 << PVR_TA_PM2_DSTENABLE_SHIFT)
879
880#define PVR_TA_PM2_FOG_SHIFT 22
881#define PVR_TA_PM2_FOG_MASK (3 << PVR_TA_PM2_FOG_SHIFT)
882
883#define PVR_TA_PM2_CLAMP_SHIFT 21
884#define PVR_TA_PM2_CLAMP_MASK (1 << PVR_TA_PM2_CLAMP_SHIFT)
885
886#define PVR_TA_PM2_ALPHA_SHIFT 20
887#define PVR_TA_PM2_ALPHA_MASK (1 << PVR_TA_PM2_ALPHA_SHIFT)
888
889#define PVR_TA_PM2_TXRALPHA_SHIFT 19
890#define PVR_TA_PM2_TXRALPHA_MASK (1 << PVR_TA_PM2_TXRALPHA_SHIFT)
891
892#define PVR_TA_PM2_UVFLIP_SHIFT 17
893#define PVR_TA_PM2_UVFLIP_MASK (3 << PVR_TA_PM2_UVFLIP_SHIFT)
894
895#define PVR_TA_PM2_UVCLAMP_SHIFT 15
896#define PVR_TA_PM2_UVCLAMP_MASK (3 << PVR_TA_PM2_UVCLAMP_SHIFT)
897
898#define PVR_TA_PM2_FILTER_SHIFT 12
899#define PVR_TA_PM2_FILTER_MASK (7 << PVR_TA_PM2_FILTER_SHIFT)
900
901#define PVR_TA_PM2_MIPBIAS_SHIFT 8
902#define PVR_TA_PM2_MIPBIAS_MASK (15 << PVR_TA_PM2_MIPBIAS_SHIFT)
903
904#define PVR_TA_PM2_TXRENV_SHIFT 6
905#define PVR_TA_PM2_TXRENV_MASK (3 << PVR_TA_PM2_TXRENV_SHIFT)
906
907#define PVR_TA_PM2_USIZE_SHIFT 3
908#define PVR_TA_PM2_USIZE_MASK (7 << PVR_TA_PM2_USIZE_SHIFT)
909
910#define PVR_TA_PM2_VSIZE_SHIFT 0
911#define PVR_TA_PM2_VSIZE_MASK (7 << PVR_TA_PM2_VSIZE_SHIFT)
912
913#define PVR_TA_PM3_MIPMAP_SHIFT 31
914#define PVR_TA_PM3_MIPMAP_MASK (1 << PVR_TA_PM3_MIPMAP_SHIFT)
915
916#define PVR_TA_PM3_TXRFMT_SHIFT 0
917#define PVR_TA_PM3_TXRFMT_MASK 0xffffffff
918/** \endcond */
919
920/** \defgroup pvr_bitmasks Constants and Masks
921 \brief Polygon header constants and masks
922 \ingroup pvr_primitives_headers
923
924 Note that thanks to the arrangement of constants, this is mainly a matter of
925 bit shifting to compile headers...
926
927 @{
928*/
929#define PVR_TA_CMD_TYPE GENMASK(26, 24)
930#define PVR_TA_CMD_USERCLIP GENMASK(17, 16)
931#define PVR_TA_CMD_MODIFIER BIT(7)
932#define PVR_TA_CMD_MODIFIERMODE BIT(6)
933#define PVR_TA_CMD_CLRFMT GENMASK(5, 4)
934#define PVR_TA_CMD_TXRENABLE BIT(3)
935#define PVR_TA_CMD_SPECULAR BIT(2)
936#define PVR_TA_CMD_SHADE BIT(1)
937#define PVR_TA_CMD_UVFMT BIT(0)
938#define PVR_TA_PM1_DEPTHCMP GENMASK(31, 29)
939#define PVR_TA_PM1_CULLING GENMASK(28, 27)
940#define PVR_TA_PM1_DEPTHWRITE BIT(26)
941#define PVR_TA_PM1_TXRENABLE BIT(25)
942#define PVR_TA_PM1_MODIFIERINST GENMASK(30, 29)
943#define PVR_TA_PM2_SRCBLEND GENMASK(31, 29)
944#define PVR_TA_PM2_DSTBLEND GENMASK(28, 26)
945#define PVR_TA_PM2_SRCENABLE BIT(25)
946#define PVR_TA_PM2_DSTENABLE BIT(24)
947#define PVR_TA_PM2_FOG GENMASK(23, 22)
948#define PVR_TA_PM2_CLAMP BIT(21)
949#define PVR_TA_PM2_ALPHA BIT(20)
950#define PVR_TA_PM2_TXRALPHA BIT(19)
951#define PVR_TA_PM2_UVFLIP GENMASK(18, 17)
952#define PVR_TA_PM2_UVCLAMP GENMASK(16, 15)
953#define PVR_TA_PM2_FILTER GENMASK(14, 13)
954#define PVR_TA_PM2_MIPBIAS GENMASK(11, 8)
955#define PVR_TA_PM2_TXRENV GENMASK(7, 6)
956#define PVR_TA_PM2_USIZE GENMASK(5, 3)
957#define PVR_TA_PM2_VSIZE GENMASK(2, 0)
958#define PVR_TA_PM3_MIPMAP BIT(31)
959#define PVR_TA_PM3_TXRFMT GENMASK(30, 21)
960/** @} */
961
962/* Initialization ****************************************************/
963/** \defgroup pvr_init Initialization
964 \brief Driver initialization and shutdown
965 \ingroup pvr
966
967 Initialization and shutdown: stuff you should only ever have to do
968 once in your program.
969*/
970
971/** \defgroup pvr_binsizes Primitive Bin Sizes
972 \brief Available sizes for primitive bins
973 \ingroup pvr_init
974 @{
975*/
976#define PVR_BINSIZE_0 0 /**< \brief 0-length (disables the list) */
977#define PVR_BINSIZE_8 8 /**< \brief 8-word (32-byte) length */
978#define PVR_BINSIZE_16 16 /**< \brief 16-word (64-byte) length */
979#define PVR_BINSIZE_32 32 /**< \brief 32-word (128-byte) length */
980/** @} */
981
982/** \brief PVR initialization structure
983 \ingroup pvr_init
984
985 This structure defines how the PVR initializes various parts of the system,
986 including the primitive bin sizes, the vertex buffer size, and whether
987 vertex DMA will be enabled.
988
989 You essentially fill one of these in, and pass it to pvr_init().
990
991 \headerfile dc/pvr.h
992*/
993typedef struct {
994 /** \brief Bin sizes.
995
996 The bins go in the following order: opaque polygons, opaque modifiers,
997 translucent polygons, translucent modifiers, punch-thrus
998 */
999 int opb_sizes[5];
1000
1001 /** \brief Vertex buffer size (should be a nice round number) */
1003
1004 /** \brief Enable vertex DMA?
1005
1006 Set to non-zero if we want to enable vertex DMA mode. Note that if this
1007 is set, then _all_ enabled lists need to have a vertex buffer assigned,
1008 even if you never use that list for anything.
1009 */
1011
1012 /** \brief Enable horizontal scaling?
1013
1014 Set to non-zero if horizontal scaling is to be enabled. By enabling this
1015 setting and stretching your image to double the native screen width, you
1016 can get horizontal full-screen anti-aliasing. */
1018
1019 /** \brief Disable translucent polygon autosort?
1020
1021 Set to non-zero to disable translucent polygon autosorting. By enabling
1022 this setting, the PVR acts more like a traditional Z-buffered system
1023 when rendering translucent polygons, meaning you must pre-sort them
1024 yourself if you want them to appear in the right order. */
1026
1027
1028 /** \brief OPB Overflow Count.
1029
1030 Preallocates this many extra OPBs (sets of tile bins), allowing the PVR
1031 to use the extra space when there's too much geometry in the first OPB.
1032
1033 Increasing this value can eliminate artifacts where pieces of geometry
1034 flicker in and out of existence along the tile boundaries. */
1035
1037
1038 /** \brief Disable vertex buffer double-buffering.
1039
1040 Use only one single vertex buffer. This means that the PVR must finish
1041 rendering before the Tile Accelerator is used to prepare a new frame;
1042 but it allows using much smaller vertex buffers. */
1044
1046
1047/** \brief Initialize the PVR chip to ready status.
1048 \ingroup pvr_init
1049
1050 This function enables the specified lists and uses the specified parameters.
1051 Note that bins and vertex buffers come from the texture memory pool, so only
1052 allocate what you actually need. Expects that a 2D mode was initialized
1053 already using the vid_* API.
1054
1055 \param params The set of parameters to initialize with
1056 \retval 0 On success
1057 \retval -1 If the PVR has already been initialized or the video
1058 mode active is not suitable for 3D
1059*/
1060int pvr_init(const pvr_init_params_t *params);
1061
1062/** \brief Simple PVR initialization.
1063 \ingroup pvr_init
1064
1065 This simpler function initializes the PVR using 16/16 for the opaque
1066 and translucent lists' bin sizes, and 0's for everything else. It sets 512KB
1067 of vertex buffer. This is equivalent to the old ta_init_defaults() for now.
1068
1069 \retval 0 On success
1070 \retval -1 If the PVR has already been initialized or the video
1071 mode active is not suitable for 3D
1072*/
1074
1075/** \brief Shut down the PVR chip from ready status.
1076 \ingroup pvr_init
1077
1078 This essentially leaves the video system in 2D mode as it was before the
1079 init.
1080
1081 \retval 0 On success
1082 \retval -1 If the PVR has not been initialized
1083*/
1085
1086
1087/* Scene rendering ***************************************************/
1088/** \defgroup pvr_scene_mgmt Scene Submission
1089 \brief PowerVR API for submitting scene geometry
1090 \ingroup pvr
1091
1092 This API is used to submit triangle strips to the PVR via the TA
1093 interface in the chip.
1094
1095 An important side note about the PVR is that all primitive types
1096 must be submitted grouped together. If you have 10 polygons for each
1097 list type, then the PVR must receive them via the TA by list type,
1098 with a list delimiter in between.
1099
1100 So there are two modes you can use here. The first mode allows you to
1101 submit data directly to the TA. Your data will be forwarded to the
1102 chip for processing as it is fed to the PVR module. If your data
1103 is easily sorted into the primitive types, then this is the fastest
1104 mode for submitting data.
1105
1106 The second mode allows you to submit data via main-RAM vertex buffers,
1107 which will be queued until the proper primitive type is active. In this
1108 case, each piece of data is copied into the vertex buffer while the
1109 wrong list is activated, and when the proper list becomes activated,
1110 the data is all sent at once. Ideally this would be via DMA, right
1111 now it is by store queues. This has the advantage of allowing you to
1112 send data in any order and have the PVR functions resolve how it should
1113 get sent to the hardware, but it is slower.
1114
1115 The nice thing is that any combination of these modes can be used. You
1116 can assign a vertex buffer for any list, and it will be used to hold the
1117 incoming vertex data until the proper list has come up. Or if the proper
1118 list is already up, the data will be submitted directly. So if most of
1119 your polygons are opaque, and you only have a couple of translucents,
1120 you can set a small buffer to gather translucent data and then it will
1121 get sent when you do a pvr_end_scene().
1122
1123 Thanks to Mikael Kalms for the idea for this API.
1124
1125 \note
1126 Another somewhat subtle point that bears mentioning is that in the normal
1127 case (interrupts enabled) an interrupt handler will automatically take
1128 care of starting a frame rendering (after scene_finish()) and also
1129 flipping pages when appropriate.
1130*/
1131
1132/** \defgroup pvr_vertex_dma Vertex DMA
1133 \brief Use the DMA to transfer inactive lists to the PVR
1134 \ingroup pvr_scene_mgmt
1135*/
1136
1137/** \brief Is vertex DMA enabled?
1138 \ingroup pvr_vertex_dma
1139
1140 \return Non-zero if vertex DMA was enabled at init time
1141*/
1143
1144/** \brief Setup a vertex buffer for one of the list types.
1145 \ingroup pvr_list_mgmt
1146
1147 If the specified list type already has a vertex buffer, it will be replaced
1148 by the new one.
1149
1150 \note
1151 Each buffer should actually be twice as long as what you will need to hold
1152 two frames worth of data).
1153
1154 \warning
1155 You should generally not try to do this at any time besides before a frame
1156 is begun, or Bad Things May Happen.
1157
1158 \param list The primitive list to set the buffer for.
1159 \param buffer The location of the buffer in main RAM. This must be
1160 aligned to a 32-byte boundary.
1161 \param len The length of the buffer. This must be a multiple of
1162 64, and must be at least 128 (even if you're not
1163 using the list).
1164
1165 \return The old buffer location (if any)
1166*/
1167void *pvr_set_vertbuf(pvr_list_t list, void *buffer, size_t len);
1168
1169/** \brief Retrieve a pointer to the current output location in the DMA buffer
1170 for the requested list.
1171 \ingroup pvr_vertex_dma
1172
1173 Vertex DMA must globally be enabled for this to work. Data may be added to
1174 this buffer by the user program directly; however, make sure to call
1175 pvr_vertbuf_written() to notify the system of any such changes.
1176
1177 \param list The primitive list to get the buffer for.
1178
1179 \return The tail of that list's buffer.
1180*/
1182
1183/** \brief Notify the PVR system that data have been written into the output
1184 buffer for the given list.
1185 \ingroup pvr_vertex_dma
1186
1187 This should always be done after writing data directly to these buffers or
1188 it will get overwritten by other data.
1189
1190 \param list The primitive list that was modified.
1191 \param amt Number of bytes written. Must be a multiple of 32.
1192*/
1193void pvr_vertbuf_written(pvr_list_t list, size_t amt);
1194
1195/** \brief Begin collecting data for a frame of 3D output to the off-screen
1196 frame buffer.
1197 \ingroup pvr_scene_mgmt
1198
1199 You must call this function (or pvr_scene_begin_txr()) for ever frame of
1200 output.
1201*/
1203
1204/** \brief Begin collecting data for a frame of 3D output to the specified
1205 texture.
1206 \ingroup pvr_scene_mgmt
1207
1208 This function currently only supports outputting at the same size as the
1209 actual screen. Thus, make sure rx and ry are at least large enough for that.
1210 For a 640x480 output, rx will generally be 1024 on input and ry 512, as
1211 these are the smallest values that are powers of two and will hold the full
1212 screen sized output.
1213
1214 \param txr The texture to render to.
1215 \param rx Width of the texture buffer (in pixels).
1216 \param ry Height of the texture buffer (in pixels).
1217*/
1219
1220
1221/** \defgroup pvr_list_mgmt Polygon Lists
1222 \brief PVR API for managing list submission
1223 \ingroup pvr_scene_mgmt
1224*/
1225
1226/** \brief Begin collecting data for the given list type.
1227 \ingroup pvr_list_mgmt
1228
1229 Lists do not have to be submitted in any particular order, but all types of
1230 a list must be submitted at once (unless vertex DMA mode is enabled).
1231
1232 Note that there is no need to call this function in DMA mode unless you want
1233 to make use of pvr_prim() for compatibility. This function will
1234 automatically call pvr_list_finish() if a list is already opened before
1235 opening the new list.
1236
1237 \param list The list to open.
1238 \retval 0 On success.
1239 \retval -1 If the specified list has already been closed.
1240*/
1242
1243/** \brief End collecting data for the current list type.
1244 \ingroup pvr_list_mgmt
1245
1246 Lists can never be opened again within a single frame once they have been
1247 closed. Thus submitting a primitive that belongs in a closed list is
1248 considered an error. Closing a list that is already closed is also an error.
1249
1250 Note that if you open a list but do not submit any primitives, a blank one
1251 will be submitted to satisfy the hardware. If vertex DMA mode is enabled,
1252 then this simply sets the current list pointer to no list, and none of the
1253 above restrictions apply.
1254
1255 \retval 0 On success.
1256 \retval -1 On error.
1257*/
1259
1260/** \brief Submit a primitive of the current list type.
1261 \ingroup pvr_list_mgmt
1262
1263 Note that any values submitted in this fashion will go directly to the
1264 hardware without any sort of buffering, and submitting a primitive of the
1265 wrong type will quite likely ruin your scene. Note that this also will not
1266 work if you haven't begun any list types (i.e., all data is queued). If DMA
1267 is enabled, the primitive will be appended to the end of the currently
1268 selected list's buffer.
1269
1270 \warning
1271 \p data must be 32-byte aligned!
1272
1273 \param data The primitive to submit.
1274 \param size The length of the primitive, in bytes. Must be a
1275 multiple of 32.
1276
1277 \retval 0 On success.
1278 \retval -1 On error.
1279*/
1280int pvr_prim(const void *data, size_t size);
1281
1282/** \defgroup pvr_direct Direct Rendering
1283 \brief API for using direct rendering with the PVR
1284 \ingroup pvr_scene_mgmt
1285
1286 @{
1287*/
1288
1289/** \brief Direct Rendering state variable type. */
1291
1292/** \brief Initialize a state variable for Direct Rendering.
1293
1294 Store Queues are used.
1295
1296 \param vtx_buf_ptr A variable of type pvr_dr_state_t to init.
1297*/
1298void pvr_dr_init(pvr_dr_state_t *vtx_buf_ptr);
1299
1300/** \brief Obtain the target address for Direct Rendering.
1301
1302 \param vtx_buf_ptr State variable for Direct Rendering. Should be of
1303 type pvr_dr_state_t, and must have been initialized
1304 previously in the scene with pvr_dr_init().
1305
1306 \return A write-only destination address where a primitive
1307 should be written to get ready to submit it to the
1308 TA in DR mode.
1309*/
1310#define pvr_dr_target(vtx_buf_ptr) \
1311 ({ (vtx_buf_ptr) ^= 32; \
1312 (pvr_vertex_t *)(MEM_AREA_SQ_BASE | (vtx_buf_ptr)); \
1313 })
1314
1315/** \brief Commit a primitive written into the Direct Rendering target address.
1316
1317 \param addr The address returned by pvr_dr_target(), after you
1318 have written the primitive to it.
1319*/
1320#define pvr_dr_commit(addr) sq_flush(addr)
1321
1322/** \brief Finish work with Direct Rendering.
1323
1324 Called atomatically in pvr_scene_finish().
1325 Use it manually if you want to release Store Queues earlier.
1326
1327*/
1328void pvr_dr_finish(void);
1329
1330/** \brief Upload a 32-byte payload to the Tile Accelerator
1331
1332 Upload the given payload to the Tile Accelerator. The difference with the
1333 Direct Rendering approach above is that the Store Queues are not used, and
1334 therefore can be used for anything else.
1335
1336 \param data A pointer to the 32-byte payload.
1337 The pointer must be aligned to 8 bytes.
1338*/
1339void pvr_send_to_ta(void *data);
1340
1341/** @} */
1342
1343/** \brief Submit a primitive of the given list type.
1344 \ingroup pvr_list_mgmt
1345
1346 Data will be queued in a vertex buffer, thus one must be available for the
1347 list specified (will be asserted by the code).
1348
1349 \param list The list to submit to.
1350 \param data The primitive to submit.
1351 \param size The size of the primitive in bytes. This must be a
1352 multiple of 32.
1353
1354 \retval 0 On success.
1355 \retval -1 On error.
1356*/
1357int pvr_list_prim(pvr_list_t list, const void *data, size_t size);
1358
1359/** \brief Flush the buffered data of the given list type to the TA.
1360 \ingroup pvr_list_mgmt
1361
1362 This function is currently not implemented, and calling it will result in an
1363 assertion failure. It is intended to be used later in a "hybrid" mode where
1364 both direct and DMA TA submission is possible.
1365
1366 \param list The list to flush.
1367
1368 \retval -1 On error (it is not possible to succeed).
1369*/
1371
1372/** \brief Call this after you have finished submitting all data for a frame.
1373 \ingroup pvr_scene_mgmt
1374
1375 Once this has been called, you can not submit any more data until one of the
1376 pvr_scene_begin() or pvr_scene_begin_txr() functions is called again.
1377
1378 \retval 0 On success.
1379 \retval -1 On error (no scene started).
1380*/
1382
1383/** \brief Block the caller until the PVR system is ready for another frame to
1384 be submitted.
1385 \ingroup pvr_scene_mgmt
1386
1387 The PVR system allocates enough space for two frames: one in data collection
1388 mode, and another in rendering mode. If a frame is currently rendering, and
1389 another frame has already been closed, then the caller cannot do anything
1390 else until the rendering frame completes. Note also that the new frame
1391 cannot be activated except during a vertical blanking period, so this
1392 essentially waits until a rendered frame is complete and a vertical blank
1393 happens.
1394
1395 \retval 0 On success. A new scene can be started now.
1396 \retval -1 On error. Something is probably very wrong...
1397*/
1399
1400/** \brief Check if the PVR system is ready for another frame to be submitted.
1401 \ingroup pvr_scene_mgmt
1402
1403 \retval 0 If the PVR is ready for a new scene. You must call
1404 pvr_wait_ready() afterwards, before starting a new
1405 scene.
1406 \retval -1 If the PVR is not ready for a new scene yet.
1407*/
1409
1410/** \brief Block the caller until the PVR has finished rendering the previous
1411 frame.
1412 \ingroup pvr_scene_mgmt
1413
1414 This function can be used to wait until the PVR is done rendering a previous
1415 scene. This can be useful for instance to make sure that the PVR is done
1416 using textures that have to be updated, before updating those.
1417
1418 \retval 0 On success.
1419 \retval -1 On error. Something is probably very wrong...
1420*/
1422
1423
1424/* Primitive handling ************************************************/
1425
1426/** \defgroup pvr_primitives_compilation Compilation
1427 \brief API for compiling primitive contexts
1428 into headers
1429 \ingroup pvr_ctx
1430*/
1431
1432/** \brief Compile a polygon context into a polygon header.
1433 \ingroup pvr_primitives_compilation
1434
1435 This function compiles a pvr_poly_cxt_t into the form needed by the hardware
1436 for rendering. This is for use with normal polygon headers.
1437
1438 \param dst Where to store the compiled header.
1439 \param src The context to compile.
1440*/
1442
1443/** \defgroup pvr_ctx_init Initialization
1444 \brief Functions for initializing PVR polygon contexts
1445 \ingroup pvr_ctx
1446*/
1447
1448/** \brief Fill in a polygon context for non-textured polygons.
1449 \ingroup pvr_ctx_init
1450
1451 This function fills in a pvr_poly_cxt_t with default parameters appropriate
1452 for rendering a non-textured polygon in the given list.
1453
1454 \param dst Where to store the polygon context.
1455 \param list The primitive list to be used.
1456*/
1458
1459/** \brief Fill in a polygon context for a textured polygon.
1460 \ingroup pvr_ctx_init
1461
1462 This function fills in a pvr_poly_cxt_t with default parameters appropriate
1463 for rendering a textured polygon in the given list.
1464
1465 \param dst Where to store the polygon context.
1466 \param list The primitive list to be used.
1467 \param textureformat The format of the texture used.
1468 \param tw The width of the texture, in pixels.
1469 \param th The height of the texture, in pixels.
1470 \param textureaddr A pointer to the texture.
1471 \param filtering The type of filtering to use.
1472
1473 \see pvr_txr_fmts
1474 \see pvr_filter_modes
1475*/
1477 int textureformat, int tw, int th, pvr_ptr_t textureaddr,
1478 int filtering);
1479
1480/** \brief Compile a sprite context into a sprite header.
1481 \ingroup pvr_primitives_compilation
1482
1483 This function compiles a pvr_sprite_cxt_t into the form needed by the
1484 hardware for rendering. This is for use with sprite headers.
1485
1486 \param dst Where to store the compiled header.
1487 \param src The context to compile.
1488*/
1490 const pvr_sprite_cxt_t *src);
1491
1492/** \brief Fill in a sprite context for non-textured sprites.
1493 \ingroup pvr_ctx_init
1494
1495 This function fills in a pvr_sprite_cxt_t with default parameters
1496 appropriate for rendering a non-textured sprite in the given list.
1497
1498 \param dst Where to store the sprite context.
1499 \param list The primitive list to be used.
1500*/
1502
1503/** \brief Fill in a sprite context for a textured sprite.
1504 \ingroup pvr_ctx_init
1505
1506 This function fills in a pvr_sprite_cxt_t with default parameters
1507 appropriate for rendering a textured sprite in the given list.
1508
1509 \param dst Where to store the sprite context.
1510 \param list The primitive list to be used.
1511 \param textureformat The format of the texture used.
1512 \param tw The width of the texture, in pixels.
1513 \param th The height of the texture, in pixels.
1514 \param textureaddr A pointer to the texture.
1515 \param filtering The type of filtering to use.
1516
1517 \see pvr_txr_fmts
1518 \see pvr_filter_modes
1519*/
1521 int textureformat, int tw, int th, pvr_ptr_t textureaddr,
1522 int filtering);
1523
1524/** \brief Create a modifier volume header.
1525 \ingroup pvr_primitives_compilation
1526
1527 This function fills in a modifier volume header with the parameters
1528 specified. Note that unlike for polygons and sprites, there is no context
1529 step for modifiers.
1530
1531 \param dst Where to store the modifier header.
1532 \param list The primitive list to be used.
1533 \param mode The mode for this modifier.
1534 \param cull The culling mode to use.
1535
1536 \see pvr_mod_modes
1537 \see pvr_cull_modes
1538*/
1540 uint32_t cull);
1541
1542/** \brief Compile a polygon context into a polygon header that is affected by
1543 modifier volumes.
1544 \ingroup pvr_primitives_compilation
1545
1546 This function works pretty similarly to pvr_poly_compile(), but compiles
1547 into the header type that is affected by a modifier volume. The context
1548 should have been created with either pvr_poly_cxt_col_mod() or
1549 pvr_poly_cxt_txr_mod().
1550
1551 \param dst Where to store the compiled header.
1552 \param src The context to compile.
1553*/
1555
1556/** \brief Fill in a polygon context for non-textured polygons affected by a
1557 modifier volume.
1558 \ingroup pvr_ctx_init
1559
1560 This function fills in a pvr_poly_cxt_t with default parameters appropriate
1561 for rendering a non-textured polygon in the given list that will be affected
1562 by modifier volumes.
1563
1564 \param dst Where to store the polygon context.
1565 \param list The primitive list to be used.
1566*/
1568
1569/** \brief Fill in a polygon context for a textured polygon affected by
1570 modifier volumes.
1571 \ingroup pvr_ctx_init
1572
1573 This function fills in a pvr_poly_cxt_t with default parameters appropriate
1574 for rendering a textured polygon in the given list and being affected by
1575 modifier volumes.
1576
1577 \param dst Where to store the polygon context.
1578 \param list The primitive list to be used.
1579 \param textureformat The format of the texture used (outside).
1580 \param tw The width of the texture, in pixels (outside).
1581 \param th The height of the texture, in pixels (outside).
1582 \param textureaddr A pointer to the texture (outside).
1583 \param filtering The type of filtering to use (outside).
1584 \param textureformat2 The format of the texture used (inside).
1585 \param tw2 The width of the texture, in pixels (inside).
1586 \param th2 The height of the texture, in pixels (inside).
1587 \param textureaddr2 A pointer to the texture (inside).
1588 \param filtering2 The type of filtering to use (inside).
1589
1590 \see pvr_txr_fmts
1591 \see pvr_filter_modes
1592*/
1594 int textureformat, int tw, int th,
1595 pvr_ptr_t textureaddr, int filtering,
1596 int textureformat2, int tw2, int th2,
1597 pvr_ptr_t textureaddr2, int filtering2);
1598
1599/** \brief Get a pointer to the front buffer.
1600 \ingroup pvr_txr_mgmt
1601
1602 This function can be used to retrieve a pointer to the front buffer, aka.
1603 the last fully rendered buffer that is either being displayed right now,
1604 or is queued to be displayed.
1605
1606 Note that the frame buffers lie in 32-bit memory, while textures lie in
1607 64-bit memory. The address returned will point to 64-bit memory, but the
1608 front buffer cannot be used directly as a regular texture.
1609
1610 \return A pointer to the front buffer.
1611*/
1613
1614/** \brief Get a pointer to the back buffer.
1615 \ingroup pvr_txr_mgmt
1616
1617 This function can be used to retrieve a pointer to the back buffer, aka.
1618 the frame buffer that will be rendered to.
1619
1620 Note that the frame buffers lie in 32-bit memory, while textures lie in
1621 64-bit memory. The address returned will point to 64-bit memory, but the
1622 back buffer cannot be used directly as a regular texture.
1623
1624 \return A pointer to the back buffer.
1625*/
1627
1628/*********************************************************************/
1629
1630#include "pvr/pvr_regs.h"
1631#include "pvr/pvr_misc.h"
1632#include "pvr/pvr_dma.h"
1633#include "pvr/pvr_fog.h"
1634#include "pvr/pvr_pal.h"
1635#include "pvr/pvr_txr.h"
1636
1637__END_DECLS
1638
1639#endif
Cache management functionality.
Various common macros used throughout the codebase.
static uint32_t("Please see purupuru_effect_t for modern equivalent.") PURUPURU_EFFECT2_UINTENSITY(uint8_t x)
Definition purupuru.h:96
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:1290
void pvr_dr_finish(void)
Finish work with Direct Rendering.
int pvr_shutdown(void)
Shut down the PVR chip from ready status.
int pvr_init_defaults(void)
Simple PVR initialization.
int pvr_init(const pvr_init_params_t *params)
Initialize the PVR chip to ready status.
void * pvr_set_vertbuf(pvr_list_t list, void *buffer, size_t len)
Setup a vertex buffer for one of the list types.
int pvr_list_flush(pvr_list_t list)
Flush the buffered data of the given list type to the TA.
int pvr_prim(const void *data, size_t size)
Submit a primitive of the current list type.
int pvr_list_finish(void)
End collecting data for the current list type.
int pvr_list_prim(pvr_list_t list, const void *data, size_t size)
Submit a primitive of the given 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:78
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.
pvr_poly_hdr_t pvr_poly_mod_hdr_t
Definition pvr.h:618
pvr_poly_hdr_t pvr_poly_ic_hdr_t
Definition pvr.h:608
pvr_poly_hdr_t pvr_sprite_hdr_t
Definition pvr.h:628
pvr_poly_hdr_t pvr_mod_hdr_t
Definition pvr.h:638
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.
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_wait_render_done(void)
Block the caller until the PVR has finished rendering the previous frame.
#define PVR_TXRFMT_POW2_STRIDE
Stride is a power-of-two.
Definition pvr.h:511
static const uint32_t PVR_TXRFMT_STRIDE("Please use PVR_TXRFMT_X32_STRIDE. Note this may cause breakage as PVR_TXRFMT_STRIDE was never working correctly.")
static const uint32_t PVR_TXRFMT_NOSTRIDE("Please use PVR_TXRFMT_POW2_STRIDE.")
#define PVR_TXRFMT_X32_STRIDE
Stride is multiple of 32.
Definition pvr.h:512
pvr_ptr_t pvr_get_back_buffer(void)
Get a pointer to the back buffer.
pvr_ptr_t pvr_get_front_buffer(void)
Get a pointer to the front buffer.
void pvr_vertbuf_written(pvr_list_t list, size_t amt)
Notify the PVR system that data have been written into the output buffer for the given list.
int pvr_vertex_dma_enabled(void)
Is vertex DMA enabled?
void * pvr_vertbuf_tail(pvr_list_t list)
Retrieve a pointer to the current output location in the DMA buffer for the requested list.
void * pvr_ptr_t
PVR texture memory pointer.
Definition pvr_mem.h:45
Platform-independent image type.
Constants for areas of the system memory map.
API for utilizing the DMA with the PVR for rendering.
Public API for the PVR's hardware fog.
Polygon/Sprite header definitions.
VRAM Management and Access.
Miscellaneous utilities for the PVR API.
Palette API for the PowerVR.
PVR Driver Registers.
Texture management with the PVR 3D API.
Macros to help dealing with register fields.
Functions to access the SH4 Store Queues.
PVR initialization structure.
Definition pvr.h:993
int fsaa_enabled
Enable horizontal scaling?
Definition pvr.h:1017
int vbuf_doublebuf_disabled
Disable vertex buffer double-buffering.
Definition pvr.h:1043
int dma_enabled
Enable vertex DMA?
Definition pvr.h:1010
int vertex_buf_size
Vertex buffer size (should be a nice round number)
Definition pvr.h:1002
int autosort_disabled
Disable translucent polygon autosort?
Definition pvr.h:1025
int opb_overflow_count
OPB Overflow Count.
Definition pvr.h:1036
PVR vertex type: Modifier volume.
Definition pvr.h:786
uint32_t d1
Dummy value.
Definition pvr.h:798
uint32_t d4
Dummy value.
Definition pvr.h:801
float by
Second Y coordinate.
Definition pvr.h:793
float ay
First Y coordinate.
Definition pvr.h:790
float ax
First X coordinate.
Definition pvr.h:789
uint32_t d3
Dummy value.
Definition pvr.h:800
float cz
Third Z coordinate.
Definition pvr.h:797
float bz
Second Z coordinate.
Definition pvr.h:794
float cy
Third Y coordinate.
Definition pvr.h:796
uint32_t d6
Dummy value.
Definition pvr.h:803
uint32_t d2
Dummy value.
Definition pvr.h:799
uint32_t d5
Dummy value.
Definition pvr.h:802
float bx
Second X coordinate.
Definition pvr.h:792
float az
First Z coordinate.
Definition pvr.h:791
float cx
Third X coordinate.
Definition pvr.h:795
PVR polygon context.
Definition pvr.h:112
int clip_mode
Clipping mode.
Definition pvr.h:126
int modifier_mode
Modifier mode.
Definition pvr.h:128
int mipmap_bias
Mipmap bias.
Definition pvr.h:177
int src2
Source blending mode inside modifier.
Definition pvr.h:147
int write
Enable or disable depth writes.
Definition pvr.h:167
int dst_enable
Dest blending enable outside modifier.
Definition pvr.h:145
int dst
Dest blending mode outside modifier.
Definition pvr.h:141
int fog_type2
Fog type inside modifier.
Definition pvr.h:133
int src
Source blending mode outside modifier.
Definition pvr.h:139
int color_clamp2
Color clamp enable/disable inside modifier.
Definition pvr.h:135
int alpha2
Enable/disable alpha inside modifier.
Definition pvr.h:131
int env
Texture color contribution.
Definition pvr.h:185
pvr_ptr_t base
Texture pointer.
Definition pvr.h:191
int culling
Culling mode.
Definition pvr.h:122
int width
Texture width (requires a power of 2)
Definition pvr.h:187
int color
Color format in vertex.
Definition pvr.h:157
int specular
Offset color enable/disable outside modifier.
Definition pvr.h:129
int height
Texture height (requires a power of 2)
Definition pvr.h:188
int comparison
Depth comparison mode.
Definition pvr.h:165
int src_enable
Source blending enable outside modifier.
Definition pvr.h:143
int dst2
Dest blending mode inside modifier.
Definition pvr.h:149
int fog_type
Fog type outside modifier.
Definition pvr.h:120
int shading
Shading type.
Definition pvr.h:118
int modifier
Enable or disable modifier effect.
Definition pvr.h:161
int uv_flip
Enable/disable U/V flipping.
Definition pvr.h:179
int list_type
Primitive list.
Definition pvr.h:113
int mipmap
Enable/disable mipmaps.
Definition pvr.h:175
int dst_enable2
Dest blending mode inside modifier.
Definition pvr.h:153
int filter
Filtering mode.
Definition pvr.h:173
int src_enable2
Source blending mode inside modifier.
Definition pvr.h:151
int color_clamp
Color clamp enable/disable outside modifier.
Definition pvr.h:124
int uv_clamp
Enable/disable U/V clamping.
Definition pvr.h:181
int alpha
Enable or disable alpha outside modifier.
Definition pvr.h:116
int format
Texture format.
Definition pvr.h:189
int enable
Enable/disable texturing.
Definition pvr.h:171
int uv
U/V data format in vertex.
Definition pvr.h:159
PVR polygon header.
Definition pvr_header.h:309
PVR vertex type: Untextured sprite.
Definition pvr.h:761
float bz
Second Z coordinate.
Definition pvr.h:769
float ay
First Y coordinate.
Definition pvr.h:765
uint32_t d3
Dummy value.
Definition pvr.h:777
float cz
Third Z coordinate.
Definition pvr.h:772
float bx
Second X coordinate.
Definition pvr.h:767
uint32_t d1
Dummy value.
Definition pvr.h:775
float cy
Third Y coordinate.
Definition pvr.h:771
float ax
First X coordinate.
Definition pvr.h:764
float by
Second Y coordinate.
Definition pvr.h:768
uint32_t d4
Dummy value.
Definition pvr.h:778
float dy
Fourth Y coordinate.
Definition pvr.h:774
uint32_t d2
Dummy value.
Definition pvr.h:776
float cx
Third X coordinate.
Definition pvr.h:770
float az
First Z coordinate.
Definition pvr.h:766
float dx
Fourth X coordinate.
Definition pvr.h:773
PVR sprite context.
Definition pvr.h:231
int color_clamp
Color clamp enable/disable.
Definition pvr.h:241
int write
Enable or disable depth writes.
Definition pvr.h:261
int env
Texture color contribution.
Definition pvr.h:279
int enable
Enable/disable texturing.
Definition pvr.h:265
int src_enable
Source blending enable.
Definition pvr.h:253
int dst
Dest blending mode.
Definition pvr.h:251
int clip_mode
Clipping mode.
Definition pvr.h:243
int list_type
Primitive list.
Definition pvr.h:232
int dst_enable
Dest blending enable.
Definition pvr.h:255
int specular
Offset color enable/disable.
Definition pvr.h:245
int src
Source blending mode.
Definition pvr.h:249
int alpha
Enable or disable alpha.
Definition pvr.h:235
int width
Texture width (requires a power of 2)
Definition pvr.h:281
int filter
Filtering mode.
Definition pvr.h:267
int comparison
Depth comparison mode.
Definition pvr.h:259
pvr_ptr_t base
Texture pointer.
Definition pvr.h:285
int mipmap
Enable/disable mipmaps.
Definition pvr.h:269
int mipmap_bias
Mipmap bias.
Definition pvr.h:271
int uv_flip
Enable/disable U/V flipping.
Definition pvr.h:273
int uv_clamp
Enable/disable U/V clamping.
Definition pvr.h:275
int fog_type
Fog type.
Definition pvr.h:237
int height
Texture height (requires a power of 2)
Definition pvr.h:282
int format
Texture format.
Definition pvr.h:283
int culling
Culling mode.
Definition pvr.h:239
PVR vertex type: Textured sprite.
Definition pvr.h:736
float bz
Second Z coordinate.
Definition pvr.h:744
float dx
Fourth X coordinate.
Definition pvr.h:748
float az
First Z coordinate.
Definition pvr.h:741
float ax
First X coordinate.
Definition pvr.h:739
uint32_t buv
Second U/V texture coordinates.
Definition pvr.h:752
float cz
Third Z coordinate.
Definition pvr.h:747
uint32_t dummy
Dummy value.
Definition pvr.h:750
float by
Second Y coordinate.
Definition pvr.h:743
uint32_t auv
First U/V texture coordinates.
Definition pvr.h:751
float dy
Fourth Y coordinate.
Definition pvr.h:749
float cx
Third X coordinate.
Definition pvr.h:745
uint32_t cuv
Third U/V texture coordinates.
Definition pvr.h:753
float bx
Second X coordinate.
Definition pvr.h:742
float cy
Third Y coordinate.
Definition pvr.h:746
float ay
First Y coordinate.
Definition pvr.h:740
PVR vertex type: Non-textured, packed color, affected by modifier volume.
Definition pvr.h:684
float z
Z coordinate.
Definition pvr.h:689
uint32_t d1
Dummy value.
Definition pvr.h:692
uint32_t argb0
Vertex color (outside volume)
Definition pvr.h:690
float x
X coordinate.
Definition pvr.h:687
float y
Y coordinate.
Definition pvr.h:688
uint32_t d2
Dummy value.
Definition pvr.h:693
uint32_t argb1
Vertex color (inside volume)
Definition pvr.h:691
Generic PVR vertex type.
Definition pvr.h:656
float z
Z coordinate.
Definition pvr.h:661
float y
Y coordinate.
Definition pvr.h:660
float u
Texture U coordinate.
Definition pvr.h:664
uint32_t oargb
Vertex offset color.
Definition pvr.h:673
uint32_t argb1
Vertex color when modified, inside area.
Definition pvr.h:669
float x
X coordinate.
Definition pvr.h:659
float v
Texture V coordinate.
Definition pvr.h:665
uint32_t argb
Vertex color.
Definition pvr.h:672
uint32_t argb0
Vertex color when modified, outside area.
Definition pvr.h:668
PVR vertex type: Textured, packed color, affected by modifier volume.
Definition pvr.h:704
float z
Z coordinate.
Definition pvr.h:709
uint32_t oargb1
Vertex offset color (inside)
Definition pvr.h:717
uint32_t oargb0
Vertex offset color (outside)
Definition pvr.h:713
float x
X coordinate.
Definition pvr.h:707
float u0
Texture U coordinate (outside)
Definition pvr.h:710
uint32_t d2
Dummy value.
Definition pvr.h:719
float v0
Texture V coordinate (outside)
Definition pvr.h:711
uint32_t d4
Dummy value.
Definition pvr.h:721
float u1
Texture U coordinate (inside)
Definition pvr.h:714
float y
Y coordinate.
Definition pvr.h:708
float v1
Texture V coordinate (inside)
Definition pvr.h:715
uint32_t argb0
Vertex color (outside)
Definition pvr.h:712
uint32_t argb1
Vertex color (inside)
Definition pvr.h:716
uint32_t d1
Dummy value.
Definition pvr.h:718
uint32_t d3
Dummy value.
Definition pvr.h:720
Common integer types.