-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathOGLTextureTables.cpp
239 lines (233 loc) · 14.4 KB
/
OGLTextureTables.cpp
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
#include "OGLTables.h"
OGLAspect texAspects[ 7 ] =
{
{ D8OVER256, D1OVER256 }, // GR_ASPECT_8x1
{ D4OVER256, D1OVER256 }, // GR_ASPECT_4x1
{ D2OVER256, D1OVER256 }, // GR_ASPECT_2x1
{ D1OVER256, D1OVER256 }, // GR_ASPECT_1x1
{ D1OVER256, D2OVER256 }, // GR_ASPECT_1x2
{ D1OVER256, D4OVER256 }, // GR_ASPECT_1x4
{ D1OVER256, D8OVER256 } // GR_ASPECT_1x8
};
OGLTexInfo texInfo[ 7 ][ 9 ] =
{
{ // GR_ASPECT_8x1
{ 256, 32, 8192 }, { 128, 16, 2048 }, { 64, 8, 512 },
{ 32, 4, 128 }, { 16, 2, 32 }, { 8, 1, 8 },
{ 4, 1, 4 }, { 2, 1, 2 }, { 1, 1, 1 }
},
{ // GR_ASPECT_4x1
{ 256, 64, 16384 }, { 128, 32, 4096 }, { 64, 16, 1024 },
{ 32, 8, 256 }, { 16, 4, 64 }, { 8, 2, 16 },
{ 4, 1, 4 }, { 2, 1, 2 }, { 1, 1, 1 }
},
{ // GR_ASPECT_2x1
{ 256, 128, 32768 }, { 128, 64, 8192 }, { 64, 32, 2048 },
{ 32, 16, 512 }, { 16, 8, 128 }, { 8, 4, 32 },
{ 4, 2, 8 }, { 2, 1, 2 }, { 1, 1, 1 }
},
{ // GR_ASPECT_1x1
{ 256, 256, 65536 }, { 128, 128, 16384 }, { 64, 64, 4096 },
{ 32, 32, 1024 }, { 16, 16, 256 }, { 8, 8, 64 },
{ 4, 4, 16 }, { 2, 2, 4 }, { 1, 1, 1 }
},
{ // GR_ASPECT_1x2
{ 128, 256, 32768 }, { 64, 128, 8192 }, { 32, 64, 2048 },
{ 16, 32, 512 }, { 8, 16, 128 }, { 4, 8, 32 },
{ 2, 4, 8 }, { 1, 2, 2 }, { 1, 1, 1 }
},
{ // GR_ASPECT_1x4
{ 64, 256, 16384 }, { 32, 128, 4096 }, { 16, 64, 1024 },
{ 8, 32, 256 }, { 4, 16, 64 }, { 2, 8, 16 },
{ 1, 4, 4 }, { 1, 2, 2 }, { 1, 1, 1 }
},
{ // GR_ASPECT_1x8
{ 32, 256, 8192 }, { 16, 128, 2048 }, { 8, 64, 512 },
{ 4, 32, 128 }, { 2, 16, 32 }, { 1, 8, 8 },
{ 1, 4, 4 }, { 1, 2, 2 }, { 1, 1, 1 }
}
};
FxU32 nSquareLod[ 2 ][ 7 ][ 9 ] =
{
{
{ 8192, 2048, 512, 128, 32, 8, 2, 1, 1 },
{ 16384, 4096, 1024, 256, 64, 16, 4, 1, 1 },
{ 32768, 8192, 2048, 512, 128, 32, 8, 2, 1 },
{ 65536, 16384, 4096, 1024, 256, 64, 16, 4, 1 },
{ 32768, 8192, 2048, 512, 128, 32, 8, 2, 1 },
{ 16384, 4096, 1024, 256, 64, 16, 4, 1, 1 },
{ 8192, 2048, 512, 128, 32, 8, 2, 1, 1 }
},
{
{ 16384, 4096, 1024, 256, 64, 16, 4, 1, 1 },
{ 32768, 8192, 2048, 512, 128, 32, 8, 2, 1 },
{ 65536, 16384, 4096, 1024, 256, 64, 16, 4, 1 },
{ 131072, 32768, 8192, 2048, 512, 128, 32, 8, 2 },
{ 65536, 16384, 4096, 1024, 256, 64, 16, 4, 1 },
{ 32768, 8192, 2048, 512, 128, 32, 8, 2, 1 },
{ 16384, 4096, 1024, 256, 64, 16, 4, 1, 1 }
}
};
// Necessary memory for textures
// Big table to minimize calculation
FxU32 nSquareTexLod[ 2 ][ 7 ][ 9 ][ 9 ] = // Tex type, aspect, largelod, smalllod
{
{ // Dual byte Textures
{ // GR_ASPECT_8x1
{ 16384, 20480, 21504, 21760, 21824, 21840, 21848, 21848, 21848 },
{ 0, 4096, 5120, 5376, 5440, 5456, 5464, 5464, 5464 },
{ 0, 0, 1024, 1280, 1344, 1360, 1368, 1368, 1368 },
{ 0, 0, 0, 256, 320, 336, 344, 344, 344 },
{ 0, 0, 0, 0, 64, 80, 88, 88, 88 },
{ 0, 0, 0, 0, 0, 16, 24, 24, 24 },
{ 0, 0, 0, 0, 0, 0, 8, 8, 8 },
{ 0, 0, 0, 0, 0, 0, 0, 8, 8 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 8 },
},
{ // GR_ASPECT_4x1
{ 32768, 40960, 43008, 43520, 43648, 43680, 43688, 43696, 43696 },
{ 0, 8192, 10240, 10752, 10880, 10912, 10920, 10928, 10928 },
{ 0, 0, 2048, 2560, 2688, 2720, 2728, 2736, 2736 },
{ 0, 0, 0, 512, 640, 672, 680, 688, 688 },
{ 0, 0, 0, 0, 128, 160, 168, 176, 176 },
{ 0, 0, 0, 0, 0, 32, 40, 48, 48 },
{ 0, 0, 0, 0, 0, 0, 8, 16, 16 },
{ 0, 0, 0, 0, 0, 0, 0, 8, 8 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 8 },
},
{ // GR_ASPECT_2x1
{ 65536, 81920, 86016, 87040, 87296, 87360, 87376, 87384, 87384 },
{ 0, 16384, 20480, 21504, 21760, 21824, 21840, 21848, 21848 },
{ 0, 0, 4096, 5120, 5376, 5440, 5456, 5464, 5464 },
{ 0, 0, 0, 1024, 1280, 1344, 1360, 1368, 1368 },
{ 0, 0, 0, 0, 256, 320, 336, 344, 344 },
{ 0, 0, 0, 0, 0, 64, 80, 88, 88 },
{ 0, 0, 0, 0, 0, 0, 16, 24, 24 },
{ 0, 0, 0, 0, 0, 0, 0, 8, 8 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 8 },
},
{ // GR_ASPECT_1x1
{ 131072, 163840, 172032, 174080, 174592, 174720, 174752, 174760, 174768 },
{ 0, 32768, 40960, 43008, 43520, 43648, 43680, 43688, 43696 },
{ 0, 0, 8192, 10240, 10752, 10880, 10912, 10920, 10928 },
{ 0, 0, 0, 2048, 2560, 2688, 2720, 2728, 2736 },
{ 0, 0, 0, 0, 512, 640, 672, 680, 688 },
{ 0, 0, 0, 0, 0, 128, 160, 168, 176 },
{ 0, 0, 0, 0, 0, 0, 32, 40, 48 },
{ 0, 0, 0, 0, 0, 0, 0, 8, 16 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 8 },
},
{ // GR_ASPECT_1x2
{ 65536, 81920, 86016, 87040, 87296, 87360, 87376, 87384, 87384 },
{ 0, 16384, 20480, 21504, 21760, 21824, 21840, 21848, 21848 },
{ 0, 0, 4096, 5120, 5376, 5440, 5456, 5464, 5464 },
{ 0, 0, 0, 1024, 1280, 1344, 1360, 1368, 1368 },
{ 0, 0, 0, 0, 256, 320, 336, 344, 344 },
{ 0, 0, 0, 0, 0, 64, 80, 88, 88 },
{ 0, 0, 0, 0, 0, 0, 16, 24, 24 },
{ 0, 0, 0, 0, 0, 0, 0, 8, 8 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 8 },
},
{ // GR_ASPECT_1x4
{ 32768, 40960, 43008, 43520, 43648, 43680, 43688, 43696, 43696 },
{ 0, 8192, 10240, 10752, 10880, 10912, 10920, 10928, 10928 },
{ 0, 0, 2048, 2560, 2688, 2720, 2728, 2736, 2736 },
{ 0, 0, 0, 512, 640, 672, 680, 688, 688 },
{ 0, 0, 0, 0, 128, 160, 168, 176, 176 },
{ 0, 0, 0, 0, 0, 32, 40, 48, 48 },
{ 0, 0, 0, 0, 0, 0, 8, 16, 16 },
{ 0, 0, 0, 0, 0, 0, 0, 8, 8 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 8 },
},
{ // GR_ASPECT_1x8
{ 16384, 20480, 21504, 21760, 21824, 21840, 21848, 21848, 21848 },
{ 0, 4096, 5120, 5376, 5440, 5456, 5464, 5464, 5464 },
{ 0, 0, 1024, 1280, 1344, 1360, 1368, 1368, 1368 },
{ 0, 0, 0, 256, 320, 336, 344, 344, 344 },
{ 0, 0, 0, 0, 64, 80, 88, 88, 88 },
{ 0, 0, 0, 0, 0, 16, 24, 24, 24 },
{ 0, 0, 0, 0, 0, 0, 8, 8, 8 },
{ 0, 0, 0, 0, 0, 0, 0, 8, 8 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 8 },
}
},
{ // Single byte Textures
{ // GR_ASPECT_8x1
{ 8192, 10240, 10752, 10880, 10912, 10920, 10928, 10928, 10928 },
{ 0, 2048, 2560, 2688, 2720, 2728, 2736, 2736, 2736 },
{ 0, 0, 512, 640, 672, 680, 688, 688, 688 },
{ 0, 0, 0, 128, 160, 168, 176, 176, 176 },
{ 0, 0, 0, 0, 32, 40, 48, 48, 48 },
{ 0, 0, 0, 0, 0, 8, 16, 16, 16 },
{ 0, 0, 0, 0, 0, 0, 8, 8, 8 },
{ 0, 0, 0, 0, 0, 0, 0, 8, 8 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 8 },
},
{ // GR_ASPECT_4x1
{ 16384, 20480, 21504, 21760, 21824, 21840, 21848, 21848, 21848 },
{ 0, 4096, 5120, 5376, 5440, 5456, 5464, 5464, 5464 },
{ 0, 0, 1024, 1280, 1344, 1360, 1368, 1368, 1368 },
{ 0, 0, 0, 256, 320, 336, 344, 344, 344 },
{ 0, 0, 0, 0, 64, 80, 88, 88, 88 },
{ 0, 0, 0, 0, 0, 16, 24, 24, 24 },
{ 0, 0, 0, 0, 0, 0, 8, 8, 8 },
{ 0, 0, 0, 0, 0, 0, 0, 8, 8 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 8 },
},
{ // GR_ASPECT_2x1
{ 32768, 40960, 43008, 43520, 43648, 43680, 43688, 43696, 43696 },
{ 0, 8192, 10240, 10752, 10880, 10912, 10920, 10928, 10928 },
{ 0, 0, 2048, 2560, 2688, 2720, 2728, 2736, 2736 },
{ 0, 0, 0, 512, 640, 672, 680, 688, 688 },
{ 0, 0, 0, 0, 128, 160, 168, 176, 176 },
{ 0, 0, 0, 0, 0, 32, 40, 48, 48 },
{ 0, 0, 0, 0, 0, 0, 8, 16, 16 },
{ 0, 0, 0, 0, 0, 0, 0, 8, 8 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 8 },
},
{ // GR_ASPECT_1x1
{ 65536, 81920, 86016, 87040, 87296, 87360, 87376, 87384, 87384 },
{ 0, 16384, 20480, 21504, 21760, 21824, 21840, 21848, 21848 },
{ 0, 0, 4096, 5120, 5376, 5440, 5456, 5464, 5464 },
{ 0, 0, 0, 1024, 1280, 1344, 1360, 1368, 1368 },
{ 0, 0, 0, 0, 256, 320, 336, 344, 344 },
{ 0, 0, 0, 0, 0, 64, 80, 88, 88 },
{ 0, 0, 0, 0, 0, 0, 16, 24, 24 },
{ 0, 0, 0, 0, 0, 0, 0, 8, 8 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 8 },
},
{ // GR_ASPECT_1x2
{ 32768, 40960, 43008, 43520, 43648, 43680, 43688, 43696, 43696 },
{ 0, 8192, 10240, 10752, 10880, 10912, 10920, 10928, 10928 },
{ 0, 0, 2048, 2560, 2688, 2720, 2728, 2736, 2736 },
{ 0, 0, 0, 512, 640, 672, 680, 688, 688 },
{ 0, 0, 0, 0, 128, 160, 168, 176, 176 },
{ 0, 0, 0, 0, 0, 32, 40, 48, 48 },
{ 0, 0, 0, 0, 0, 0, 8, 16, 16 },
{ 0, 0, 0, 0, 0, 0, 0, 8, 8 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 8 },
},
{ // GR_ASPECT_1x4
{ 16384, 20480, 21504, 21760, 21824, 21840, 21848, 21848, 21848 },
{ 0, 4096, 5120, 5376, 5440, 5456, 5464, 5464, 5464 },
{ 0, 0, 1024, 1280, 1344, 1360, 1368, 1368, 1368 },
{ 0, 0, 0, 256, 320, 336, 344, 344, 344 },
{ 0, 0, 0, 0, 64, 80, 88, 88, 88 },
{ 0, 0, 0, 0, 0, 16, 24, 24, 24 },
{ 0, 0, 0, 0, 0, 0, 8, 8, 8 },
{ 0, 0, 0, 0, 0, 0, 0, 8, 8 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 8 },
},
{ // GR_ASPECT_1x8
{ 8192, 10240, 10752, 10880, 10912, 10920, 10928, 10928, 10928 },
{ 0, 2048, 2560, 2688, 2720, 2728, 2736, 2736, 2736 },
{ 0, 0, 512, 640, 672, 680, 688, 688, 688 },
{ 0, 0, 0, 128, 160, 168, 176, 176, 176 },
{ 0, 0, 0, 0, 32, 40, 48, 48, 48 },
{ 0, 0, 0, 0, 0, 8, 16, 16, 16 },
{ 0, 0, 0, 0, 0, 0, 8, 8, 8 },
{ 0, 0, 0, 0, 0, 0, 0, 8, 8 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 8 },
}
}
};