copy_texrect.c
3.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/**************************************************************************
* *
* Copyright (C) 1996, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
*************************************************************************/
/*
* The RDP vector suite expects static display list and textures. It does not
* have any provisions to capture CPU generated DL and textures for test
* vectors.
*
* The texture rectangle in COPY mode with WRAP and MIRROR test requires a
* algorithmically generated DL and textures. So the output of this program
* needs to be edited into tm_static.c and tm.c
*/
#include <stdio.h>
#define XORIG_S 50
#define YORIG_S 50
#define XORIG_T 50
#define YORIG_T 100
main(argc, argv)
{
int i;
int mask, pixel, xoff, yoff;
/* 4KB of linear 16 bit ramp */
printf("u16 LinearRamp16[] = {\n");
for (i=0; i<2048; i+=8)
printf("\t0x%04x, 0x%04x, 0x%04x, 0x%04x, 0x%04x, 0x%04x, 0x%04x, 0x%04x,\n", i, i+1, i+2, i+3, i+4, i+5, i+6, i+7);
printf("};\n\n\n\n\n");
/*
* For each mask, do 8 4pixel texture rectangles. 4 for wrap, 4 for
* mirror. Each of the 4 for wrap and mirror forces different pixels
* in the 4 pixel block to wrap and mirror. This is because in copy
* mode, texture rectangles have 4 sets of wrap and mirror logic to
* do 4 pixels / clock.
*/
xoff=XORIG_S;
printf("\tgsDPSetTileSize(G_TX_RENDERTILE, 0, 0, 1023, 0),\n\n");
for (mask=2; mask<=10; mask++) {
/* mirror test */
printf("\tgsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 512, 0, G_TX_RENDERTILE, 0, G_TX_CLAMP, G_TX_NOMASK, 0, G_TX_MIRROR, %d, 0),\n", mask);
for (pixel=0; pixel<4; pixel++) {
printf("\tgsSPTextureRectangle(%d<<2, %d<<2, %d<<2, %d<<2, G_TX_RENDERTILE, %d, %d, 4<<10, 1<<10),\n", xoff+pixel*4, YORIG_S, xoff+pixel*4+3, YORIG_S, ((1<<mask)-pixel)<<5, 0<<5);
}
printf("\tgsDPPipeSync(),\n\n");
/* wrap test */
printf("\tgsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 512, 0, G_TX_RENDERTILE, 0, G_TX_CLAMP, G_TX_NOMASK, 0, G_TX_WRAP, %d, 0),\n", mask);
for (pixel=0; pixel<4; pixel++) {
printf("\tgsSPTextureRectangle(%d<<2, (%d+4)<<2, %d<<2, (%d+4)<<2, G_TX_RENDERTILE, %d, %d, 4<<10, 1<<10),\n", xoff+pixel*4, YORIG_S, xoff+pixel*4+3, YORIG_S, ((1<<mask)-pixel)<<5, 0<<5);
}
printf("\tgsDPPipeSync(),\n\n");
xoff+=16; /* 4 sets of 4 pixels */
}
/*
* For each mask, do 2 4pixel texture rectangles. 1 for wrap, 1 for
* mirror. In copy texture rectangle mode, only a single T is processed
* because all 4 pixels have the same T address.
*/
printf("\tgsDPSetTileSize(G_TX_RENDERTILE, 0, 0, 3, 511),\n\n");
yoff=YORIG_T;
for (mask=1; mask<=7; mask++) {
/* mirror test */
printf("\tgsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, 0, G_TX_RENDERTILE, 0, G_TX_MIRROR, %d, 0, G_TX_CLAMP, G_TX_NOMASK, 0),\n", mask);
printf("\tgsSPTextureRectangle(%d<<2, %d<<2, %d<<2, %d<<2, G_TX_RENDERTILE, %d, %d, 4<<10, 1<<10),\n", XORIG_T, yoff, XORIG_T+3, yoff, 0, (1<<mask)<<5);
printf("\tgsDPPipeSync(),\n\n");
/* wrap test */
printf("\tgsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, 0, G_TX_RENDERTILE, 0, G_TX_WRAP, %d, 0, G_TX_CLAMP, G_TX_NOMASK, 0),\n", mask);
printf("\tgsSPTextureRectangle(%d<<2, %d<<2, %d<<2, %d<<2, G_TX_RENDERTILE, %d, %d, 4<<10, 1<<10),\n", XORIG_T+8, yoff, XORIG_T+8+3, yoff, 0, (1<<mask)<<5);
printf("\tgsDPPipeSync(),\n\n");
yoff++;
}
}