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 <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*/
78typedef uint32_t pvr_list_t;
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/* Backward compatibility */
515#define PVR_TXRFMT_NOSTRIDE PVR_TXRFMT_POW2_STRIDE
516#define PVR_TXRFMT_STRIDE 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 float u; /**< \brief Texture U coordinate */
663 float v; /**< \brief Texture V coordinate */
664 uint32_t argb; /**< \brief Vertex color */
665 uint32_t oargb; /**< \brief Vertex offset color */
667
668/** \brief PVR vertex type: Non-textured, packed color, affected by modifier
669 volume.
670
671 This vertex type has two copies of colors. The second color is used when
672 enclosed within a modifier volume.
673
674 \headerfile dc/pvr.h
675*/
676typedef struct pvr_vertex_pcm {
677 alignas(32)
678 uint32_t flags; /**< \brief TA command (vertex flags) */
679 float x; /**< \brief X coordinate */
680 float y; /**< \brief Y coordinate */
681 float z; /**< \brief Z coordinate */
682 uint32_t argb0; /**< \brief Vertex color (outside volume) */
683 uint32_t argb1; /**< \brief Vertex color (inside volume) */
684 uint32_t d1; /**< \brief Dummy value */
685 uint32_t d2; /**< \brief Dummy value */
687
688/** \brief PVR vertex type: Textured, packed color, affected by modifier volume.
689
690 Note that this vertex type has two copies of colors, offset colors, and
691 texture coords. The second set of texture coords, colors, and offset colors
692 are used when enclosed within a modifier volume.
693
694 \headerfile dc/pvr.h
695*/
696typedef struct pvr_vertex_tpcm {
697 alignas(32)
698 uint32_t flags; /**< \brief TA command (vertex flags) */
699 float x; /**< \brief X coordinate */
700 float y; /**< \brief Y coordinate */
701 float z; /**< \brief Z coordinate */
702 float u0; /**< \brief Texture U coordinate (outside) */
703 float v0; /**< \brief Texture V coordinate (outside) */
704 uint32_t argb0; /**< \brief Vertex color (outside) */
705 uint32_t oargb0; /**< \brief Vertex offset color (outside) */
706 float u1; /**< \brief Texture U coordinate (inside) */
707 float v1; /**< \brief Texture V coordinate (inside) */
708 uint32_t argb1; /**< \brief Vertex color (inside) */
709 uint32_t oargb1; /**< \brief Vertex offset color (inside) */
710 uint32_t d1; /**< \brief Dummy value */
711 uint32_t d2; /**< \brief Dummy value */
712 uint32_t d3; /**< \brief Dummy value */
713 uint32_t d4; /**< \brief Dummy value */
715
716/** \brief PVR vertex type: Textured sprite.
717
718 This vertex type is to be used with the sprite polygon header and the sprite
719 related commands to draw textured sprites. Note that there is no fourth Z
720 coordinate. I suppose it just gets interpolated?
721
722 The U/V coordinates in here are in the 16-bit per coordinate form. Also,
723 like the fourth Z value, there is no fourth U or V, so it must get
724 interpolated from the others.
725
726 \headerfile dc/pvr.h
727*/
728typedef struct pvr_sprite_txr {
729 alignas(32)
730 uint32_t flags; /**< \brief TA command (vertex flags) */
731 float ax; /**< \brief First X coordinate */
732 float ay; /**< \brief First Y coordinate */
733 float az; /**< \brief First Z coordinate */
734 float bx; /**< \brief Second X coordinate */
735 float by; /**< \brief Second Y coordinate */
736 float bz; /**< \brief Second Z coordinate */
737 float cx; /**< \brief Third X coordinate */
738 float cy; /**< \brief Third Y coordinate */
739 float cz; /**< \brief Third Z coordinate */
740 float dx; /**< \brief Fourth X coordinate */
741 float dy; /**< \brief Fourth Y coordinate */
742 uint32_t dummy; /**< \brief Dummy value */
743 uint32_t auv; /**< \brief First U/V texture coordinates */
744 uint32_t buv; /**< \brief Second U/V texture coordinates */
745 uint32_t cuv; /**< \brief Third U/V texture coordinates */
747
748/** \brief PVR vertex type: Untextured sprite.
749
750 This vertex type is to be used with the sprite polygon header and the sprite
751 related commands to draw untextured sprites (aka, quads).
752*/
753typedef struct pvr_sprite_col {
754 alignas(32)
755 uint32_t flags; /**< \brief TA command (vertex flags) */
756 float ax; /**< \brief First X coordinate */
757 float ay; /**< \brief First Y coordinate */
758 float az; /**< \brief First Z coordinate */
759 float bx; /**< \brief Second X coordinate */
760 float by; /**< \brief Second Y coordinate */
761 float bz; /**< \brief Second Z coordinate */
762 float cx; /**< \brief Third X coordinate */
763 float cy; /**< \brief Third Y coordinate */
764 float cz; /**< \brief Third Z coordinate */
765 float dx; /**< \brief Fourth X coordinate */
766 float dy; /**< \brief Fourth Y coordinate */
767 uint32_t d1; /**< \brief Dummy value */
768 uint32_t d2; /**< \brief Dummy value */
769 uint32_t d3; /**< \brief Dummy value */
770 uint32_t d4; /**< \brief Dummy value */
772
773/** \brief PVR vertex type: Modifier volume.
774
775 This vertex type is to be used with the modifier volume header to specify
776 triangular modifier areas.
777*/
778typedef struct pvr_modifier_vol {
779 alignas(32)
780 uint32_t flags; /**< \brief TA command (vertex flags) */
781 float ax; /**< \brief First X coordinate */
782 float ay; /**< \brief First Y coordinate */
783 float az; /**< \brief First Z coordinate */
784 float bx; /**< \brief Second X coordinate */
785 float by; /**< \brief Second Y coordinate */
786 float bz; /**< \brief Second Z coordinate */
787 float cx; /**< \brief Third X coordinate */
788 float cy; /**< \brief Third Y coordinate */
789 float cz; /**< \brief Third Z coordinate */
790 uint32_t d1; /**< \brief Dummy value */
791 uint32_t d2; /**< \brief Dummy value */
792 uint32_t d3; /**< \brief Dummy value */
793 uint32_t d4; /**< \brief Dummy value */
794 uint32_t d5; /**< \brief Dummy value */
795 uint32_t d6; /**< \brief Dummy value */
797
798/** @} */
799
800/** \defgroup pvr_commands TA Command Values
801 \brief Command values for submitting data to the TA
802 \ingroup pvr_primitives_headers
803
804 These are are appropriate values for TA commands. Use whatever goes with the
805 primitive type you're using.
806
807 @{
808*/
809#define PVR_CMD_POLYHDR 0x80840000 /**< \brief PVR polygon header.
810Striplength set to 2 */
811#define PVR_CMD_VERTEX 0xe0000000 /**< \brief PVR vertex data */
812#define PVR_CMD_VERTEX_EOL 0xf0000000 /**< \brief PVR vertex, end of strip */
813#define PVR_CMD_USERCLIP 0x20000000 /**< \brief PVR user clipping area */
814#define PVR_CMD_MODIFIER 0x80000000 /**< \brief PVR modifier volume */
815#define PVR_CMD_SPRITE 0xA0000000 /**< \brief PVR sprite header */
816/** @} */
817
818/** \cond
819 Deprecated macros, replaced by the pvr_bitmasks macros below.
820 */
821#define PVR_TA_CMD_TYPE_SHIFT 24
822#define PVR_TA_CMD_TYPE_MASK (7 << PVR_TA_CMD_TYPE_SHIFT)
823
824#define PVR_TA_CMD_USERCLIP_SHIFT 16
825#define PVR_TA_CMD_USERCLIP_MASK (3 << PVR_TA_CMD_USERCLIP_SHIFT)
826
827#define PVR_TA_CMD_CLRFMT_SHIFT 4
828#define PVR_TA_CMD_CLRFMT_MASK (7 << PVR_TA_CMD_CLRFMT_SHIFT)
829
830#define PVR_TA_CMD_SPECULAR_SHIFT 2
831#define PVR_TA_CMD_SPECULAR_MASK (1 << PVR_TA_CMD_SPECULAR_SHIFT)
832
833#define PVR_TA_CMD_SHADE_SHIFT 1
834#define PVR_TA_CMD_SHADE_MASK (1 << PVR_TA_CMD_SHADE_SHIFT)
835
836#define PVR_TA_CMD_UVFMT_SHIFT 0
837#define PVR_TA_CMD_UVFMT_MASK (1 << PVR_TA_CMD_UVFMT_SHIFT)
838
839#define PVR_TA_CMD_MODIFIER_SHIFT 7
840#define PVR_TA_CMD_MODIFIER_MASK (1 << PVR_TA_CMD_MODIFIER_SHIFT)
841
842#define PVR_TA_CMD_MODIFIERMODE_SHIFT 6
843#define PVR_TA_CMD_MODIFIERMODE_MASK (1 << PVR_TA_CMD_MODIFIERMODE_SHIFT)
844
845#define PVR_TA_PM1_DEPTHCMP_SHIFT 29
846#define PVR_TA_PM1_DEPTHCMP_MASK (7 << PVR_TA_PM1_DEPTHCMP_SHIFT)
847
848#define PVR_TA_PM1_CULLING_SHIFT 27
849#define PVR_TA_PM1_CULLING_MASK (3 << PVR_TA_PM1_CULLING_SHIFT)
850
851#define PVR_TA_PM1_DEPTHWRITE_SHIFT 26
852#define PVR_TA_PM1_DEPTHWRITE_MASK (1 << PVR_TA_PM1_DEPTHWRITE_SHIFT)
853
854#define PVR_TA_PM1_TXRENABLE_SHIFT 25
855#define PVR_TA_PM1_TXRENABLE_MASK (1 << PVR_TA_PM1_TXRENABLE_SHIFT)
856
857#define PVR_TA_PM1_MODIFIERINST_SHIFT 29
858#define PVR_TA_PM1_MODIFIERINST_MASK (3 << PVR_TA_PM1_MODIFIERINST_SHIFT)
859
860#define PVR_TA_PM2_SRCBLEND_SHIFT 29
861#define PVR_TA_PM2_SRCBLEND_MASK (7 << PVR_TA_PM2_SRCBLEND_SHIFT)
862
863#define PVR_TA_PM2_DSTBLEND_SHIFT 26
864#define PVR_TA_PM2_DSTBLEND_MASK (7 << PVR_TA_PM2_DSTBLEND_SHIFT)
865
866#define PVR_TA_PM2_SRCENABLE_SHIFT 25
867#define PVR_TA_PM2_SRCENABLE_MASK (1 << PVR_TA_PM2_SRCENABLE_SHIFT)
868
869#define PVR_TA_PM2_DSTENABLE_SHIFT 24
870#define PVR_TA_PM2_DSTENABLE_MASK (1 << PVR_TA_PM2_DSTENABLE_SHIFT)
871
872#define PVR_TA_PM2_FOG_SHIFT 22
873#define PVR_TA_PM2_FOG_MASK (3 << PVR_TA_PM2_FOG_SHIFT)
874
875#define PVR_TA_PM2_CLAMP_SHIFT 21
876#define PVR_TA_PM2_CLAMP_MASK (1 << PVR_TA_PM2_CLAMP_SHIFT)
877
878#define PVR_TA_PM2_ALPHA_SHIFT 20
879#define PVR_TA_PM2_ALPHA_MASK (1 << PVR_TA_PM2_ALPHA_SHIFT)
880
881#define PVR_TA_PM2_TXRALPHA_SHIFT 19
882#define PVR_TA_PM2_TXRALPHA_MASK (1 << PVR_TA_PM2_TXRALPHA_SHIFT)
883
884#define PVR_TA_PM2_UVFLIP_SHIFT 17
885#define PVR_TA_PM2_UVFLIP_MASK (3 << PVR_TA_PM2_UVFLIP_SHIFT)
886
887#define PVR_TA_PM2_UVCLAMP_SHIFT 15
888#define PVR_TA_PM2_UVCLAMP_MASK (3 << PVR_TA_PM2_UVCLAMP_SHIFT)
889
890#define PVR_TA_PM2_FILTER_SHIFT 12
891#define PVR_TA_PM2_FILTER_MASK (7 << PVR_TA_PM2_FILTER_SHIFT)
892
893#define PVR_TA_PM2_MIPBIAS_SHIFT 8
894#define PVR_TA_PM2_MIPBIAS_MASK (15 << PVR_TA_PM2_MIPBIAS_SHIFT)
895
896#define PVR_TA_PM2_TXRENV_SHIFT 6
897#define PVR_TA_PM2_TXRENV_MASK (3 << PVR_TA_PM2_TXRENV_SHIFT)
898
899#define PVR_TA_PM2_USIZE_SHIFT 3
900#define PVR_TA_PM2_USIZE_MASK (7 << PVR_TA_PM2_USIZE_SHIFT)
901
902#define PVR_TA_PM2_VSIZE_SHIFT 0
903#define PVR_TA_PM2_VSIZE_MASK (7 << PVR_TA_PM2_VSIZE_SHIFT)
904
905#define PVR_TA_PM3_MIPMAP_SHIFT 31
906#define PVR_TA_PM3_MIPMAP_MASK (1 << PVR_TA_PM3_MIPMAP_SHIFT)
907
908#define PVR_TA_PM3_TXRFMT_SHIFT 0
909#define PVR_TA_PM3_TXRFMT_MASK 0xffffffff
910/** \endcond */
911
912/** \defgroup pvr_bitmasks Constants and Masks
913 \brief Polygon header constants and masks
914 \ingroup pvr_primitives_headers
915
916 Note that thanks to the arrangement of constants, this is mainly a matter of
917 bit shifting to compile headers...
918
919 @{
920*/
921#define PVR_TA_CMD_TYPE GENMASK(26, 24)
922#define PVR_TA_CMD_USERCLIP GENMASK(17, 16)
923#define PVR_TA_CMD_MODIFIER BIT(7)
924#define PVR_TA_CMD_MODIFIERMODE BIT(6)
925#define PVR_TA_CMD_CLRFMT GENMASK(5, 4)
926#define PVR_TA_CMD_TXRENABLE BIT(3)
927#define PVR_TA_CMD_SPECULAR BIT(2)
928#define PVR_TA_CMD_SHADE BIT(1)
929#define PVR_TA_CMD_UVFMT BIT(0)
930#define PVR_TA_PM1_DEPTHCMP GENMASK(31, 29)
931#define PVR_TA_PM1_CULLING GENMASK(28, 27)
932#define PVR_TA_PM1_DEPTHWRITE BIT(26)
933#define PVR_TA_PM1_TXRENABLE BIT(25)
934#define PVR_TA_PM1_MODIFIERINST GENMASK(30, 29)
935#define PVR_TA_PM2_SRCBLEND GENMASK(31, 29)
936#define PVR_TA_PM2_DSTBLEND GENMASK(28, 26)
937#define PVR_TA_PM2_SRCENABLE BIT(25)
938#define PVR_TA_PM2_DSTENABLE BIT(24)
939#define PVR_TA_PM2_FOG GENMASK(23, 22)
940#define PVR_TA_PM2_CLAMP BIT(21)
941#define PVR_TA_PM2_ALPHA BIT(20)
942#define PVR_TA_PM2_TXRALPHA BIT(19)
943#define PVR_TA_PM2_UVFLIP GENMASK(18, 17)
944#define PVR_TA_PM2_UVCLAMP GENMASK(16, 15)
945#define PVR_TA_PM2_FILTER GENMASK(14, 13)
946#define PVR_TA_PM2_MIPBIAS GENMASK(11, 8)
947#define PVR_TA_PM2_TXRENV GENMASK(7, 6)
948#define PVR_TA_PM2_USIZE GENMASK(5, 3)
949#define PVR_TA_PM2_VSIZE GENMASK(2, 0)
950#define PVR_TA_PM3_MIPMAP BIT(31)
951#define PVR_TA_PM3_TXRFMT GENMASK(30, 21)
952/** @} */
953
954/* Initialization ****************************************************/
955/** \defgroup pvr_init Initialization
956 \brief Driver initialization and shutdown
957 \ingroup pvr
958
959 Initialization and shutdown: stuff you should only ever have to do
960 once in your program.
961*/
962
963/** \defgroup pvr_binsizes Primitive Bin Sizes
964 \brief Available sizes for primitive bins
965 \ingroup pvr_init
966 @{
967*/
968#define PVR_BINSIZE_0 0 /**< \brief 0-length (disables the list) */
969#define PVR_BINSIZE_8 8 /**< \brief 8-word (32-byte) length */
970#define PVR_BINSIZE_16 16 /**< \brief 16-word (64-byte) length */
971#define PVR_BINSIZE_32 32 /**< \brief 32-word (128-byte) length */
972/** @} */
973
974/** \brief PVR initialization structure
975 \ingroup pvr_init
976
977 This structure defines how the PVR initializes various parts of the system,
978 including the primitive bin sizes, the vertex buffer size, and whether
979 vertex DMA will be enabled.
980
981 You essentially fill one of these in, and pass it to pvr_init().
982
983 \headerfile dc/pvr.h
984*/
985typedef struct {
986 /** \brief Bin sizes.
987
988 The bins go in the following order: opaque polygons, opaque modifiers,
989 translucent polygons, translucent modifiers, punch-thrus
990 */
991 int opb_sizes[5];
992
993 /** \brief Vertex buffer size (should be a nice round number) */
995
996 /** \brief Enable vertex DMA?
997
998 Set to non-zero if we want to enable vertex DMA mode. Note that if this
999 is set, then _all_ enabled lists need to have a vertex buffer assigned,
1000 even if you never use that list for anything.
1001 */
1003
1004 /** \brief Enable horizontal scaling?
1005
1006 Set to non-zero if horizontal scaling is to be enabled. By enabling this
1007 setting and stretching your image to double the native screen width, you
1008 can get horizontal full-screen anti-aliasing. */
1010
1011 /** \brief Disable translucent polygon autosort?
1012
1013 Set to non-zero to disable translucent polygon autosorting. By enabling
1014 this setting, the PVR acts more like a traditional Z-buffered system
1015 when rendering translucent polygons, meaning you must pre-sort them
1016 yourself if you want them to appear in the right order. */
1018
1019
1020 /** \brief OPB Overflow Count.
1021
1022 Preallocates this many extra OPBs (sets of tile bins), allowing the PVR
1023 to use the extra space when there's too much geometry in the first OPB.
1024
1025 Increasing this value can eliminate artifacts where pieces of geometry
1026 flicker in and out of existence along the tile boundaries. */
1027
1029
1030 /** \brief Disable vertex buffer double-buffering.
1031
1032 Use only one single vertex buffer. This means that the PVR must finish
1033 rendering before the Tile Accelerator is used to prepare a new frame;
1034 but it allows using much smaller vertex buffers. */
1036
1038
1039/** \brief Initialize the PVR chip to ready status.
1040 \ingroup pvr_init
1041
1042 This function enables the specified lists and uses the specified parameters.
1043 Note that bins and vertex buffers come from the texture memory pool, so only
1044 allocate what you actually need. Expects that a 2D mode was initialized
1045 already using the vid_* API.
1046
1047 \param params The set of parameters to initialize with
1048 \retval 0 On success
1049 \retval -1 If the PVR has already been initialized or the video
1050 mode active is not suitable for 3D
1051*/
1052int pvr_init(const pvr_init_params_t *params);
1053
1054/** \brief Simple PVR initialization.
1055 \ingroup pvr_init
1056
1057 This simpler function initializes the PVR using 16/16 for the opaque
1058 and translucent lists' bin sizes, and 0's for everything else. It sets 512KB
1059 of vertex buffer. This is equivalent to the old ta_init_defaults() for now.
1060
1061 \retval 0 On success
1062 \retval -1 If the PVR has already been initialized or the video
1063 mode active is not suitable for 3D
1064*/
1066
1067/** \brief Shut down the PVR chip from ready status.
1068 \ingroup pvr_init
1069
1070 This essentially leaves the video system in 2D mode as it was before the
1071 init.
1072
1073 \retval 0 On success
1074 \retval -1 If the PVR has not been initialized
1075*/
1077
1078
1079/* Scene rendering ***************************************************/
1080/** \defgroup pvr_scene_mgmt Scene Submission
1081 \brief PowerVR API for submitting scene geometry
1082 \ingroup pvr
1083
1084 This API is used to submit triangle strips to the PVR via the TA
1085 interface in the chip.
1086
1087 An important side note about the PVR is that all primitive types
1088 must be submitted grouped together. If you have 10 polygons for each
1089 list type, then the PVR must receive them via the TA by list type,
1090 with a list delimiter in between.
1091
1092 So there are two modes you can use here. The first mode allows you to
1093 submit data directly to the TA. Your data will be forwarded to the
1094 chip for processing as it is fed to the PVR module. If your data
1095 is easily sorted into the primitive types, then this is the fastest
1096 mode for submitting data.
1097
1098 The second mode allows you to submit data via main-RAM vertex buffers,
1099 which will be queued until the proper primitive type is active. In this
1100 case, each piece of data is copied into the vertex buffer while the
1101 wrong list is activated, and when the proper list becomes activated,
1102 the data is all sent at once. Ideally this would be via DMA, right
1103 now it is by store queues. This has the advantage of allowing you to
1104 send data in any order and have the PVR functions resolve how it should
1105 get sent to the hardware, but it is slower.
1106
1107 The nice thing is that any combination of these modes can be used. You
1108 can assign a vertex buffer for any list, and it will be used to hold the
1109 incoming vertex data until the proper list has come up. Or if the proper
1110 list is already up, the data will be submitted directly. So if most of
1111 your polygons are opaque, and you only have a couple of translucents,
1112 you can set a small buffer to gather translucent data and then it will
1113 get sent when you do a pvr_end_scene().
1114
1115 Thanks to Mikael Kalms for the idea for this API.
1116
1117 \note
1118 Another somewhat subtle point that bears mentioning is that in the normal
1119 case (interrupts enabled) an interrupt handler will automatically take
1120 care of starting a frame rendering (after scene_finish()) and also
1121 flipping pages when appropriate.
1122*/
1123
1124/** \defgroup pvr_vertex_dma Vertex DMA
1125 \brief Use the DMA to transfer inactive lists to the PVR
1126 \ingroup pvr_scene_mgmt
1127*/
1128
1129/** \brief Is vertex DMA enabled?
1130 \ingroup pvr_vertex_dma
1131
1132 \return Non-zero if vertex DMA was enabled at init time
1133*/
1135
1136/** \brief Setup a vertex buffer for one of the list types.
1137 \ingroup pvr_list_mgmt
1138
1139 If the specified list type already has a vertex buffer, it will be replaced
1140 by the new one.
1141
1142 \note
1143 Each buffer should actually be twice as long as what you will need to hold
1144 two frames worth of data).
1145
1146 \warning
1147 You should generally not try to do this at any time besides before a frame
1148 is begun, or Bad Things May Happen.
1149
1150 \param list The primitive list to set the buffer for.
1151 \param buffer The location of the buffer in main RAM. This must be
1152 aligned to a 32-byte boundary.
1153 \param len The length of the buffer. This must be a multiple of
1154 64, and must be at least 128 (even if you're not
1155 using the list).
1156
1157 \return The old buffer location (if any)
1158*/
1159void *pvr_set_vertbuf(pvr_list_t list, void *buffer, size_t len);
1160
1161/** \brief Retrieve a pointer to the current output location in the DMA buffer
1162 for the requested list.
1163 \ingroup pvr_vertex_dma
1164
1165 Vertex DMA must globally be enabled for this to work. Data may be added to
1166 this buffer by the user program directly; however, make sure to call
1167 pvr_vertbuf_written() to notify the system of any such changes.
1168
1169 \param list The primitive list to get the buffer for.
1170
1171 \return The tail of that list's buffer.
1172*/
1174
1175/** \brief Notify the PVR system that data have been written into the output
1176 buffer for the given list.
1177 \ingroup pvr_vertex_dma
1178
1179 This should always be done after writing data directly to these buffers or
1180 it will get overwritten by other data.
1181
1182 \param list The primitive list that was modified.
1183 \param amt Number of bytes written. Must be a multiple of 32.
1184*/
1185void pvr_vertbuf_written(pvr_list_t list, size_t amt);
1186
1187/** \brief Begin collecting data for a frame of 3D output to the off-screen
1188 frame buffer.
1189 \ingroup pvr_scene_mgmt
1190
1191 You must call this function (or pvr_scene_begin_txr()) for ever frame of
1192 output.
1193*/
1195
1196/** \brief Begin collecting data for a frame of 3D output to the specified
1197 texture.
1198 \ingroup pvr_scene_mgmt
1199
1200 This function currently only supports outputting at the same size as the
1201 actual screen. Thus, make sure rx and ry are at least large enough for that.
1202 For a 640x480 output, rx will generally be 1024 on input and ry 512, as
1203 these are the smallest values that are powers of two and will hold the full
1204 screen sized output.
1205
1206 \param txr The texture to render to.
1207 \param rx Width of the texture buffer (in pixels).
1208 \param ry Height of the texture buffer (in pixels).
1209*/
1210void pvr_scene_begin_txr(pvr_ptr_t txr, uint32_t *rx, uint32_t *ry);
1211
1212
1213/** \defgroup pvr_list_mgmt Polygon Lists
1214 \brief PVR API for managing list submission
1215 \ingroup pvr_scene_mgmt
1216*/
1217
1218/** \brief Begin collecting data for the given list type.
1219 \ingroup pvr_list_mgmt
1220
1221 Lists do not have to be submitted in any particular order, but all types of
1222 a list must be submitted at once (unless vertex DMA mode is enabled).
1223
1224 Note that there is no need to call this function in DMA mode unless you want
1225 to make use of pvr_prim() for compatibility. This function will
1226 automatically call pvr_list_finish() if a list is already opened before
1227 opening the new list.
1228
1229 \param list The list to open.
1230 \retval 0 On success.
1231 \retval -1 If the specified list has already been closed.
1232*/
1234
1235/** \brief End collecting data for the current list type.
1236 \ingroup pvr_list_mgmt
1237
1238 Lists can never be opened again within a single frame once they have been
1239 closed. Thus submitting a primitive that belongs in a closed list is
1240 considered an error. Closing a list that is already closed is also an error.
1241
1242 Note that if you open a list but do not submit any primitives, a blank one
1243 will be submitted to satisfy the hardware. If vertex DMA mode is enabled,
1244 then this simply sets the current list pointer to no list, and none of the
1245 above restrictions apply.
1246
1247 \retval 0 On success.
1248 \retval -1 On error.
1249*/
1251
1252/** \brief Submit a primitive of the current list type.
1253 \ingroup pvr_list_mgmt
1254
1255 Note that any values submitted in this fashion will go directly to the
1256 hardware without any sort of buffering, and submitting a primitive of the
1257 wrong type will quite likely ruin your scene. Note that this also will not
1258 work if you haven't begun any list types (i.e., all data is queued). If DMA
1259 is enabled, the primitive will be appended to the end of the currently
1260 selected list's buffer.
1261
1262 \warning
1263 \p data must be 32-byte aligned!
1264
1265 \param data The primitive to submit.
1266 \param size The length of the primitive, in bytes. Must be a
1267 multiple of 32.
1268
1269 \retval 0 On success.
1270 \retval -1 On error.
1271*/
1272int pvr_prim(const void *data, size_t size);
1273
1274/** \defgroup pvr_direct Direct Rendering
1275 \brief API for using direct rendering with the PVR
1276 \ingroup pvr_scene_mgmt
1277
1278 @{
1279*/
1280
1281/** \brief Direct Rendering state variable type. */
1282typedef uint32_t pvr_dr_state_t;
1283
1284/** \brief Initialize a state variable for Direct Rendering.
1285
1286 Store Queues are used.
1287
1288 \param vtx_buf_ptr A variable of type pvr_dr_state_t to init.
1289*/
1290void pvr_dr_init(pvr_dr_state_t *vtx_buf_ptr);
1291
1292/** \brief Obtain the target address for Direct Rendering.
1293
1294 \param vtx_buf_ptr State variable for Direct Rendering. Should be of
1295 type pvr_dr_state_t, and must have been initialized
1296 previously in the scene with pvr_dr_init().
1297
1298 \return A write-only destination address where a primitive
1299 should be written to get ready to submit it to the
1300 TA in DR mode.
1301*/
1302#define pvr_dr_target(vtx_buf_ptr) \
1303 ({ (vtx_buf_ptr) ^= 32; \
1304 (pvr_vertex_t *)(MEM_AREA_SQ_BASE | (vtx_buf_ptr)); \
1305 })
1306
1307/** \brief Commit a primitive written into the Direct Rendering target address.
1308
1309 \param addr The address returned by pvr_dr_target(), after you
1310 have written the primitive to it.
1311*/
1312#define pvr_dr_commit(addr) sq_flush(addr)
1313
1314/** \brief Finish work with Direct Rendering.
1315
1316 Called atomatically in pvr_scene_finish().
1317 Use it manually if you want to release Store Queues earlier.
1318
1319*/
1320void pvr_dr_finish(void);
1321
1322/** \brief Upload a 32-byte payload to the Tile Accelerator
1323
1324 Upload the given payload to the Tile Accelerator. The difference with the
1325 Direct Rendering approach above is that the Store Queues are not used, and
1326 therefore can be used for anything else.
1327
1328 \param data A pointer to the 32-byte payload.
1329 The pointer must be aligned to 8 bytes.
1330*/
1331void pvr_send_to_ta(void *data);
1332
1333/** @} */
1334
1335/** \brief Submit a primitive of the given list type.
1336 \ingroup pvr_list_mgmt
1337
1338 Data will be queued in a vertex buffer, thus one must be available for the
1339 list specified (will be asserted by the code).
1340
1341 \param list The list to submit to.
1342 \param data The primitive to submit.
1343 \param size The size of the primitive in bytes. This must be a
1344 multiple of 32.
1345
1346 \retval 0 On success.
1347 \retval -1 On error.
1348*/
1349int pvr_list_prim(pvr_list_t list, const void *data, size_t size);
1350
1351/** \brief Flush the buffered data of the given list type to the TA.
1352 \ingroup pvr_list_mgmt
1353
1354 This function is currently not implemented, and calling it will result in an
1355 assertion failure. It is intended to be used later in a "hybrid" mode where
1356 both direct and DMA TA submission is possible.
1357
1358 \param list The list to flush.
1359
1360 \retval -1 On error (it is not possible to succeed).
1361*/
1363
1364/** \brief Call this after you have finished submitting all data for a frame.
1365 \ingroup pvr_scene_mgmt
1366
1367 Once this has been called, you can not submit any more data until one of the
1368 pvr_scene_begin() or pvr_scene_begin_txr() functions is called again.
1369
1370 \retval 0 On success.
1371 \retval -1 On error (no scene started).
1372*/
1374
1375/** \brief Block the caller until the PVR system is ready for another frame to
1376 be submitted.
1377 \ingroup pvr_scene_mgmt
1378
1379 The PVR system allocates enough space for two frames: one in data collection
1380 mode, and another in rendering mode. If a frame is currently rendering, and
1381 another frame has already been closed, then the caller cannot do anything
1382 else until the rendering frame completes. Note also that the new frame
1383 cannot be activated except during a vertical blanking period, so this
1384 essentially waits until a rendered frame is complete and a vertical blank
1385 happens.
1386
1387 \retval 0 On success. A new scene can be started now.
1388 \retval -1 On error. Something is probably very wrong...
1389*/
1391
1392/** \brief Check if the PVR system is ready for another frame to be submitted.
1393 \ingroup pvr_scene_mgmt
1394
1395 \retval 0 If the PVR is ready for a new scene. You must call
1396 pvr_wait_ready() afterwards, before starting a new
1397 scene.
1398 \retval -1 If the PVR is not ready for a new scene yet.
1399*/
1401
1402/** \brief Block the caller until the PVR has finished rendering the previous
1403 frame.
1404 \ingroup pvr_scene_mgmt
1405
1406 This function can be used to wait until the PVR is done rendering a previous
1407 scene. This can be useful for instance to make sure that the PVR is done
1408 using textures that have to be updated, before updating those.
1409
1410 \retval 0 On success.
1411 \retval -1 On error. Something is probably very wrong...
1412*/
1414
1415
1416/* Primitive handling ************************************************/
1417
1418/** \defgroup pvr_primitives_compilation Compilation
1419 \brief API for compiling primitive contexts
1420 into headers
1421 \ingroup pvr_ctx
1422*/
1423
1424/** \brief Compile a polygon context into a polygon header.
1425 \ingroup pvr_primitives_compilation
1426
1427 This function compiles a pvr_poly_cxt_t into the form needed by the hardware
1428 for rendering. This is for use with normal polygon headers.
1429
1430 \param dst Where to store the compiled header.
1431 \param src The context to compile.
1432*/
1434
1435/** \defgroup pvr_ctx_init Initialization
1436 \brief Functions for initializing PVR polygon contexts
1437 \ingroup pvr_ctx
1438*/
1439
1440/** \brief Fill in a polygon context for non-textured polygons.
1441 \ingroup pvr_ctx_init
1442
1443 This function fills in a pvr_poly_cxt_t with default parameters appropriate
1444 for rendering a non-textured polygon in the given list.
1445
1446 \param dst Where to store the polygon context.
1447 \param list The primitive list to be used.
1448*/
1450
1451/** \brief Fill in a polygon context for a textured polygon.
1452 \ingroup pvr_ctx_init
1453
1454 This function fills in a pvr_poly_cxt_t with default parameters appropriate
1455 for rendering a textured polygon in the given list.
1456
1457 \param dst Where to store the polygon context.
1458 \param list The primitive list to be used.
1459 \param textureformat The format of the texture used.
1460 \param tw The width of the texture, in pixels.
1461 \param th The height of the texture, in pixels.
1462 \param textureaddr A pointer to the texture.
1463 \param filtering The type of filtering to use.
1464
1465 \see pvr_txr_fmts
1466 \see pvr_filter_modes
1467*/
1469 int textureformat, int tw, int th, pvr_ptr_t textureaddr,
1470 int filtering);
1471
1472/** \brief Compile a sprite context into a sprite header.
1473 \ingroup pvr_primitives_compilation
1474
1475 This function compiles a pvr_sprite_cxt_t into the form needed by the
1476 hardware for rendering. This is for use with sprite headers.
1477
1478 \param dst Where to store the compiled header.
1479 \param src The context to compile.
1480*/
1482 const pvr_sprite_cxt_t *src);
1483
1484/** \brief Fill in a sprite context for non-textured sprites.
1485 \ingroup pvr_ctx_init
1486
1487 This function fills in a pvr_sprite_cxt_t with default parameters
1488 appropriate for rendering a non-textured sprite in the given list.
1489
1490 \param dst Where to store the sprite context.
1491 \param list The primitive list to be used.
1492*/
1494
1495/** \brief Fill in a sprite context for a textured sprite.
1496 \ingroup pvr_ctx_init
1497
1498 This function fills in a pvr_sprite_cxt_t with default parameters
1499 appropriate for rendering a textured sprite in the given list.
1500
1501 \param dst Where to store the sprite context.
1502 \param list The primitive list to be used.
1503 \param textureformat The format of the texture used.
1504 \param tw The width of the texture, in pixels.
1505 \param th The height of the texture, in pixels.
1506 \param textureaddr A pointer to the texture.
1507 \param filtering The type of filtering to use.
1508
1509 \see pvr_txr_fmts
1510 \see pvr_filter_modes
1511*/
1513 int textureformat, int tw, int th, pvr_ptr_t textureaddr,
1514 int filtering);
1515
1516/** \brief Create a modifier volume header.
1517 \ingroup pvr_primitives_compilation
1518
1519 This function fills in a modifier volume header with the parameters
1520 specified. Note that unlike for polygons and sprites, there is no context
1521 step for modifiers.
1522
1523 \param dst Where to store the modifier header.
1524 \param list The primitive list to be used.
1525 \param mode The mode for this modifier.
1526 \param cull The culling mode to use.
1527
1528 \see pvr_mod_modes
1529 \see pvr_cull_modes
1530*/
1531void pvr_mod_compile(pvr_mod_hdr_t *dst, pvr_list_t list, uint32_t mode,
1532 uint32_t cull);
1533
1534/** \brief Compile a polygon context into a polygon header that is affected by
1535 modifier volumes.
1536 \ingroup pvr_primitives_compilation
1537
1538 This function works pretty similarly to pvr_poly_compile(), but compiles
1539 into the header type that is affected by a modifier volume. The context
1540 should have been created with either pvr_poly_cxt_col_mod() or
1541 pvr_poly_cxt_txr_mod().
1542
1543 \param dst Where to store the compiled header.
1544 \param src The context to compile.
1545*/
1547
1548/** \brief Fill in a polygon context for non-textured polygons affected by a
1549 modifier volume.
1550 \ingroup pvr_ctx_init
1551
1552 This function fills in a pvr_poly_cxt_t with default parameters appropriate
1553 for rendering a non-textured polygon in the given list that will be affected
1554 by modifier volumes.
1555
1556 \param dst Where to store the polygon context.
1557 \param list The primitive list to be used.
1558*/
1560
1561/** \brief Fill in a polygon context for a textured polygon affected by
1562 modifier volumes.
1563 \ingroup pvr_ctx_init
1564
1565 This function fills in a pvr_poly_cxt_t with default parameters appropriate
1566 for rendering a textured polygon in the given list and being affected by
1567 modifier volumes.
1568
1569 \param dst Where to store the polygon context.
1570 \param list The primitive list to be used.
1571 \param textureformat The format of the texture used (outside).
1572 \param tw The width of the texture, in pixels (outside).
1573 \param th The height of the texture, in pixels (outside).
1574 \param textureaddr A pointer to the texture (outside).
1575 \param filtering The type of filtering to use (outside).
1576 \param textureformat2 The format of the texture used (inside).
1577 \param tw2 The width of the texture, in pixels (inside).
1578 \param th2 The height of the texture, in pixels (inside).
1579 \param textureaddr2 A pointer to the texture (inside).
1580 \param filtering2 The type of filtering to use (inside).
1581
1582 \see pvr_txr_fmts
1583 \see pvr_filter_modes
1584*/
1586 int textureformat, int tw, int th,
1587 pvr_ptr_t textureaddr, int filtering,
1588 int textureformat2, int tw2, int th2,
1589 pvr_ptr_t textureaddr2, int filtering2);
1590
1591/** \brief Get a pointer to the front buffer.
1592 \ingroup pvr_txr_mgmt
1593
1594 This function can be used to retrieve a pointer to the front buffer, aka.
1595 the last fully rendered buffer that is either being displayed right now,
1596 or is queued to be displayed.
1597
1598 Note that the frame buffers lie in 32-bit memory, while textures lie in
1599 64-bit memory. The address returned will point to 64-bit memory, but the
1600 front buffer cannot be used directly as a regular texture.
1601
1602 \return A pointer to the front buffer.
1603*/
1605
1606/*********************************************************************/
1607
1608#include "pvr/pvr_regs.h"
1609#include "pvr/pvr_misc.h"
1610#include "pvr/pvr_dma.h"
1611#include "pvr/pvr_fog.h"
1612#include "pvr/pvr_pal.h"
1613#include "pvr/pvr_txr.h"
1614
1615__END_DECLS
1616
1617#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:1282
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.
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:985
int fsaa_enabled
Enable horizontal scaling?
Definition pvr.h:1009
int vbuf_doublebuf_disabled
Disable vertex buffer double-buffering.
Definition pvr.h:1035
int dma_enabled
Enable vertex DMA?
Definition pvr.h:1002
int vertex_buf_size
Vertex buffer size (should be a nice round number)
Definition pvr.h:994
int autosort_disabled
Disable translucent polygon autosort?
Definition pvr.h:1017
int opb_overflow_count
OPB Overflow Count.
Definition pvr.h:1028
PVR vertex type: Modifier volume.
Definition pvr.h:778
uint32_t d1
Dummy value.
Definition pvr.h:790
uint32_t d4
Dummy value.
Definition pvr.h:793
float by
Second Y coordinate.
Definition pvr.h:785
float ay
First Y coordinate.
Definition pvr.h:782
float ax
First X coordinate.
Definition pvr.h:781
uint32_t d3
Dummy value.
Definition pvr.h:792
float cz
Third Z coordinate.
Definition pvr.h:789
float bz
Second Z coordinate.
Definition pvr.h:786
float cy
Third Y coordinate.
Definition pvr.h:788
uint32_t d6
Dummy value.
Definition pvr.h:795
uint32_t d2
Dummy value.
Definition pvr.h:791
uint32_t d5
Dummy value.
Definition pvr.h:794
float bx
Second X coordinate.
Definition pvr.h:784
float az
First Z coordinate.
Definition pvr.h:783
float cx
Third X coordinate.
Definition pvr.h:787
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:302
PVR vertex type: Untextured sprite.
Definition pvr.h:753
float bz
Second Z coordinate.
Definition pvr.h:761
float ay
First Y coordinate.
Definition pvr.h:757
uint32_t d3
Dummy value.
Definition pvr.h:769
float cz
Third Z coordinate.
Definition pvr.h:764
float bx
Second X coordinate.
Definition pvr.h:759
uint32_t d1
Dummy value.
Definition pvr.h:767
float cy
Third Y coordinate.
Definition pvr.h:763
float ax
First X coordinate.
Definition pvr.h:756
float by
Second Y coordinate.
Definition pvr.h:760
uint32_t d4
Dummy value.
Definition pvr.h:770
float dy
Fourth Y coordinate.
Definition pvr.h:766
uint32_t d2
Dummy value.
Definition pvr.h:768
float cx
Third X coordinate.
Definition pvr.h:762
float az
First Z coordinate.
Definition pvr.h:758
float dx
Fourth X coordinate.
Definition pvr.h:765
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:728
float bz
Second Z coordinate.
Definition pvr.h:736
float dx
Fourth X coordinate.
Definition pvr.h:740
float az
First Z coordinate.
Definition pvr.h:733
float ax
First X coordinate.
Definition pvr.h:731
uint32_t buv
Second U/V texture coordinates.
Definition pvr.h:744
float cz
Third Z coordinate.
Definition pvr.h:739
uint32_t dummy
Dummy value.
Definition pvr.h:742
float by
Second Y coordinate.
Definition pvr.h:735
uint32_t auv
First U/V texture coordinates.
Definition pvr.h:743
float dy
Fourth Y coordinate.
Definition pvr.h:741
float cx
Third X coordinate.
Definition pvr.h:737
uint32_t cuv
Third U/V texture coordinates.
Definition pvr.h:745
float bx
Second X coordinate.
Definition pvr.h:734
float cy
Third Y coordinate.
Definition pvr.h:738
float ay
First Y coordinate.
Definition pvr.h:732
PVR vertex type: Non-textured, packed color, affected by modifier volume.
Definition pvr.h:676
float z
Z coordinate.
Definition pvr.h:681
uint32_t d1
Dummy value.
Definition pvr.h:684
uint32_t argb0
Vertex color (outside volume)
Definition pvr.h:682
float x
X coordinate.
Definition pvr.h:679
float y
Y coordinate.
Definition pvr.h:680
uint32_t d2
Dummy value.
Definition pvr.h:685
uint32_t argb1
Vertex color (inside volume)
Definition pvr.h:683
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:662
uint32_t oargb
Vertex offset color.
Definition pvr.h:665
float x
X coordinate.
Definition pvr.h:659
float v
Texture V coordinate.
Definition pvr.h:663
uint32_t argb
Vertex color.
Definition pvr.h:664
PVR vertex type: Textured, packed color, affected by modifier volume.
Definition pvr.h:696
float z
Z coordinate.
Definition pvr.h:701
uint32_t oargb1
Vertex offset color (inside)
Definition pvr.h:709
uint32_t oargb0
Vertex offset color (outside)
Definition pvr.h:705
float x
X coordinate.
Definition pvr.h:699
float u0
Texture U coordinate (outside)
Definition pvr.h:702
uint32_t d2
Dummy value.
Definition pvr.h:711
float v0
Texture V coordinate (outside)
Definition pvr.h:703
uint32_t d4
Dummy value.
Definition pvr.h:713
float u1
Texture U coordinate (inside)
Definition pvr.h:706
float y
Y coordinate.
Definition pvr.h:700
float v1
Texture V coordinate (inside)
Definition pvr.h:707
uint32_t argb0
Vertex color (outside)
Definition pvr.h:704
uint32_t argb1
Vertex color (inside)
Definition pvr.h:708
uint32_t d1
Dummy value.
Definition pvr.h:710
uint32_t d3
Dummy value.
Definition pvr.h:712
Common integer types.