Skip to content

Commit f6f303f

Browse files
pcercueiQuzarDC
authored andcommitted
pvr: Get rid of dummy fields in prim headers
Those dummy fields were added to the various primitive headers to make sure that they had the correct size. Now that all primitive headers use the same pvr_poly_hdr_t type, which has the correct size even with the dummy fields removed, all the dummy fields can be removed. Note that the driver code was setting them either to 0 or 0xffff'ffff, for some reason. Given that this was written almost 25 years ago and everything seems to work just fine without writing those fields, it seems safe to drop them. Dropping them also fixes KallistiOS#1034, which happened since the switch to the common pvr_poly_hdr_t type, and was caused by the dummy fields moving around (as prior to that, the d1/d2 fields in a pvr_poly_mod_hdr were at different offsets than the d1/d2 fields in a pvr_poly_hdr, for instance). Signed-off-by: Paul Cercueil <paul@crapouillou.net>
1 parent f643745 commit f6f303f

3 files changed

Lines changed: 2 additions & 26 deletions

File tree

kernel/arch/dreamcast/hardware/pvr/pvr_misc.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,6 @@ void pvr_blank_polyhdr_buf(int type, pvr_poly_hdr_t * poly) {
264264

265265
/* Put in the list type */
266266
poly->cmd = FIELD_PREP(PVR_TA_CMD_TYPE, type) | 0x80840012;
267-
268-
/* Fill in dummy values */
269-
poly->d1 = poly->d2 = poly->d3 = poly->d4 = 0xffffffff;
270-
271267
}
272268

273269
pvr_ptr_t pvr_get_front_buffer(void) {

kernel/arch/dreamcast/hardware/pvr/pvr_prim.c

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,9 @@ void pvr_poly_compile(pvr_poly_hdr_t *dst, const pvr_poly_cxt_t *src) {
9696
if(src->fmt.modifier && src->gen.modifier_mode) {
9797
/* If we're affected by a modifier volume, silently promote the header
9898
to the one that is affected by a modifier volume. */
99-
dst->d1 = mode2;
100-
dst->d2 = mode3;
99+
dst->mode2_1 = mode2;
100+
dst->mode3_1 = mode3;
101101
}
102-
else {
103-
dst->d1 = 0xffffffff;
104-
dst->d2 = 0xffffffff;
105-
}
106-
107-
dst->d3 = 0xffffffff;
108-
dst->d4 = 0xffffffff;
109102
}
110103

111104
/* Create a colored polygon context with parameters similar to
@@ -353,8 +346,6 @@ void pvr_mod_compile(pvr_mod_hdr_t *dst, pvr_list_t list, uint32 mode,
353346

354347
dst->mode1 = FIELD_PREP(PVR_TA_PM1_MODIFIERINST, mode)
355348
| FIELD_PREP(PVR_TA_PM1_CULLING, cull);
356-
357-
dst->d1 = dst->d2 = dst->d3 = dst->d4 = dst->d5 = dst->d6 = 0;
358349
}
359350

360351
/* Compile a polygon context into a polygon header that is affected by
@@ -467,9 +458,6 @@ void pvr_poly_mod_compile(pvr_poly_mod_hdr_t *dst, const pvr_poly_cxt_t *src) {
467458

468459
dst->mode2_1 = mode2;
469460
dst->mode3_1 = mode3;
470-
471-
dst->d1 = 0xffffffff;
472-
dst->d2 = 0xffffffff;
473461
}
474462

475463
/* Create a colored polygon context for polygons affected by modifier volumes */

kernel/arch/dreamcast/include/dc/pvr/pvr_header.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -311,22 +311,14 @@ typedef __attribute__((aligned(32))) struct pvr_poly_hdr {
311311
union {
312312
uint32_t mode2; /**< Raw access to mode2 param */
313313
uint32_t mode2_0; /**< Legacy name */
314-
uint32_t d5; /**< Dummy value 5 */
315314
struct pvr_poly_hdr_mode2 m2; /**< mode2 parameters (modifiers: outside volume) */
316315
};
317316
union {
318317
uint32_t mode3; /**< Raw access to mode3 param */
319318
uint32_t mode3_0; /**< Legacy name */
320-
uint32_t d6; /**< Dummy value 6 */
321319
struct pvr_poly_hdr_mode3 m3; /**< mode3 parameters (modifiers: outside volume) */
322320
};
323321
union {
324-
struct {
325-
uint32_t d1; /**< Dummy value 1 */
326-
uint32_t d2; /**< Dummy value 2 */
327-
uint32_t d3; /**< Dummy value 3 */
328-
uint32_t d4; /**< Dummy value 4 */
329-
};
330322
struct {
331323
/* Intensity color */
332324
float a; /**< Intensity color alpha */

0 commit comments

Comments
 (0)