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