1 |
21 |
diegovalve |
|
2 |
|
|
|
3 |
|
|
`define ONE (32'h1 << `SCALE)
|
4 |
|
|
|
5 |
|
|
`timescale 1ns / 1ps
|
6 |
|
|
`include "aDefinitions.v"
|
7 |
|
|
/**********************************************************************************
|
8 |
|
|
Theia, Ray Cast Programable graphic Processing Unit.
|
9 |
|
|
Copyright (C) 2010 Diego Valverde (diego.valverde.g@gmail.com)
|
10 |
|
|
|
11 |
|
|
This program is free software; you can redistribute it and/or
|
12 |
|
|
modify it under the terms of the GNU General Public License
|
13 |
|
|
as published by the Free Software Foundation; either version 2
|
14 |
|
|
of the License, or (at your option) any later version.
|
15 |
|
|
|
16 |
|
|
This program is distributed in the hope that it will be useful,
|
17 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19 |
|
|
GNU General Public License for more details.
|
20 |
|
|
|
21 |
|
|
You should have received a copy of the GNU General Public License
|
22 |
|
|
along with this program; if not, write to the Free Software
|
23 |
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
24 |
|
|
|
25 |
|
|
***********************************************************************************/
|
26 |
|
|
|
27 |
60 |
diegovalve |
/*
|
28 |
|
|
I can't synthesize roms, the rom needs to be adapted depending on the
|
29 |
|
|
final target silicon.
|
30 |
|
|
*/
|
31 |
21 |
diegovalve |
|
32 |
|
|
|
33 |
|
|
//--------------------------------------------------------
|
34 |
|
|
module ROM
|
35 |
|
|
(
|
36 |
105 |
diegovalve |
input wire[`ROM_ADDRESS_WIDTH-1:0] Address,
|
37 |
|
|
`ifdef DEBUG
|
38 |
|
|
input wire [`MAX_CORES-1:0] iDebug_CoreID,
|
39 |
|
|
`endif
|
40 |
21 |
diegovalve |
output reg [`INSTRUCTION_WIDTH-1:0] I
|
41 |
|
|
);
|
42 |
|
|
|
43 |
|
|
|
44 |
|
|
always @( Address )
|
45 |
|
|
begin
|
46 |
|
|
case (Address)
|
47 |
|
|
|
48 |
|
|
//Hardcoded stuff :(
|
49 |
|
|
`define RAY_INSIDE_BOX `R3
|
50 |
|
|
`define CURRENT_LIGHT_POS `CREG_FIRST_LIGTH //TODO: CAHNEG T
|
51 |
|
|
`define CURRENT_LIGHT_DIFFUSE 16'h6
|
52 |
|
|
|
53 |
|
|
//-----------------------------------------------------------------
|
54 |
76 |
diegovalve |
`define TAG_PSU_UCODE_ADRESS2 16'd232
|
55 |
|
|
`define TAG_PSU_UCODE_ADRESS 16'd216
|
56 |
|
|
`define LABEL_TCC_EXIT 16'd215
|
57 |
|
|
`define TAG_TCC_UCODE_ADDRESS 16'd174
|
58 |
|
|
`define LABEL_BIU4 16'd173
|
59 |
|
|
`define LABEL_BIU3 16'd163
|
60 |
|
|
`define LABEL_BIU2 16'd160
|
61 |
|
|
`define LABEL_BIU1 16'd158
|
62 |
|
|
`define TAG_BIU_UCODE_ADDRESS 16'd141
|
63 |
|
|
`define LABEL_HIT 16'd139
|
64 |
|
|
`define LABEL15 16'd137
|
65 |
|
|
`define LABEL14 16'd135
|
66 |
|
|
`define LABEL13 16'd133
|
67 |
|
|
`define LABEL_TEST_XY_PLANE 16'd128
|
68 |
|
|
`define LABEL12 16'd126
|
69 |
|
|
`define LABEL11 16'd124
|
70 |
|
|
`define LABEL10 16'd122
|
71 |
|
|
`define LABEL_TEST_XZ_PLANE 16'd116
|
72 |
|
|
`define LABEL9 16'd114
|
73 |
|
|
`define LABEL8 16'd112
|
74 |
|
|
`define LABEL7 16'd110
|
75 |
|
|
`define LABEL_TEST_YZ_PLANE 16'd104
|
76 |
|
|
`define LABEL_RAY_INSIDE_BOX 16'd101
|
77 |
|
|
`define LABEL_ELSEZ 16'd100
|
78 |
|
|
`define LABEL6 16'd97
|
79 |
|
|
`define LABEL_ELESE_IFZ 16'd93
|
80 |
|
|
`define LABEL5 16'd90
|
81 |
|
|
`define LABEL_TEST_RAY_Z_ORIGEN 16'd86
|
82 |
|
|
`define LABEL_ELSEY 16'd85
|
83 |
|
|
`define LABEL4 16'd82
|
84 |
|
|
`define LABEL_ELESE_IFY 16'd78
|
85 |
|
|
`define LABEL3 16'd75
|
86 |
|
|
`define LABEL_TEST_RAY_Y_ORIGEN 16'd71
|
87 |
|
|
`define LABEL_ELSEX 16'd70
|
88 |
|
|
`define LABEL2 16'd67
|
89 |
|
|
`define LABEL_ELSE_IFX 16'd63
|
90 |
|
|
`define LABEL1 16'd60
|
91 |
|
|
`define LABEL_TEST_RAY_X_ORIGEN 16'd56
|
92 |
|
|
`define TAG_AABBIU_UCODE_ADDRESS 16'd53
|
93 |
|
|
`define LABEL_ALLDONE 16'd51
|
94 |
|
|
`define LABEL_NPG_NEXT_ROW 16'd47
|
95 |
|
|
`define TAG_NPG_UCODE_ADDRESS 16'd39
|
96 |
|
|
`define TAG_RGU_UCODE_ADDRESS 16'd32
|
97 |
|
|
`define TAG_CPPU_UCODE_ADDRESS 16'd29
|
98 |
21 |
diegovalve |
|
99 |
76 |
diegovalve |
|
100 |
21 |
diegovalve |
//-------------------------------------------------------------------------
|
101 |
|
|
//Default values for some registers after reset
|
102 |
76 |
diegovalve |
//-------------------------------------------------------------------------
|
103 |
|
|
//This is the first code that gets executed after the machine is
|
104 |
|
|
//externally configured, ie after the MST_I goes from 1 to zero.
|
105 |
|
|
//It sets initial values for some of the internal registers
|
106 |
21 |
diegovalve |
|
107 |
76 |
diegovalve |
0: I = { `ZERO ,`CREG_LAST_t ,`VOID ,`VOID };
|
108 |
|
|
//Set the last 't' to very positive value(500)
|
109 |
|
|
1: I = { `SETX ,`CREG_LAST_t ,32'h1F40000 };
|
110 |
|
|
2: I = { `ZERO ,`OREG_PIXEL_COLOR ,`VOID ,`VOID };
|
111 |
|
|
3: I = { `COPY ,`CREG_PIXEL_2D_POSITION ,`CREG_PIXEL_2D_INITIAL_POSITION ,`VOID };
|
112 |
21 |
diegovalve |
|
113 |
|
|
|
114 |
76 |
diegovalve |
//Calculate the initial linear address for ADR_O
|
115 |
|
|
//this is: (X_initial + RESOLUTION_Y*Y_intial) * 3.
|
116 |
|
|
//Notice, that we need to use 'unscaled' ie. integer
|
117 |
|
|
//values because the resuts of the multiplication by
|
118 |
|
|
//the resoluction is to large to fit a fixed point
|
119 |
|
|
//representation.
|
120 |
21 |
diegovalve |
|
121 |
76 |
diegovalve |
4: I = { `COPY ,`R1 ,`CREG_RESOLUTION ,`VOID };
|
122 |
|
|
5: I = { `UNSCALE ,`R1 ,`R1 ,`VOID };
|
123 |
|
|
6: I = { `SETX ,`R1 ,32'h1 };
|
124 |
|
|
7: I = { `SETZ ,`R1 ,32'h0 };
|
125 |
|
|
8: I = { `COPY ,`R2 ,`CREG_PIXEL_2D_INITIAL_POSITION ,`VOID };
|
126 |
|
|
9: I = { `UNSCALE ,`R2 ,`R2 ,`VOID };
|
127 |
21 |
diegovalve |
|
128 |
76 |
diegovalve |
//Ok lets start by calculating RESOLUTION_Y*Y_intial
|
129 |
|
|
10: I = { `IMUL ,`R1 ,`R1 ,`R2 };
|
130 |
|
|
11: I = { `COPY ,`R2 ,`R1 ,`VOID };
|
131 |
|
|
12: I = { `SWIZZLE3D ,`R2 ,`SWIZZLE_YYY };
|
132 |
|
|
|
133 |
|
|
//now X_initial + RESOLUTION_Y*Y_intial
|
134 |
|
|
13: I = { `ADD ,`R3 ,`R1 ,`R2 };
|
135 |
|
|
14: I = { `COPY ,`R2 ,`R1 ,`VOID };
|
136 |
|
|
15: I = { `SWIZZLE3D ,`R2 ,`SWIZZLE_ZZZ };
|
137 |
|
|
16: I = { `ADD ,`R3 ,`R3 ,`R2 };
|
138 |
|
|
17: I = { `SWIZZLE3D ,`R3 ,`SWIZZLE_XXX };
|
139 |
|
|
|
140 |
|
|
//finally multiply by 3 to get:
|
141 |
|
|
//(X_initial + RESOLUTION_Y*Y_intial) * 3, voila!
|
142 |
|
|
18: I = { `SETX ,`R2 ,32'h3 };
|
143 |
|
|
19: I = { `SWIZZLE3D ,`R2 ,`SWIZZLE_XXX };
|
144 |
105 |
diegovalve |
20:// I = { `ZERO ,`CREG_PIXEL_PITCH ,`VOID ,`VOID };
|
145 |
|
|
I = { `IMUL ,`CREG_PIXEL_PITCH ,`R3 ,`R2 };
|
146 |
76 |
diegovalve |
//By this point you should be wondering why not
|
147 |
|
|
//just do DOT R1 [1 Resolution_Y 0] [X_intial Y_intial 0 ]?
|
148 |
|
|
//well because DOT uses fixed point and the result may not
|
149 |
|
|
//fit :(
|
150 |
|
|
|
151 |
|
|
//Transform from fixed point to integer
|
152 |
|
|
//UNSCALE CREG_PIXEL_PITCH CREG_PIXEL_PITCH VOID
|
153 |
|
|
21: I = { `COPY ,`OREG_ADDR_O ,`CREG_PIXEL_PITCH ,`VOID };
|
154 |
|
|
|
155 |
|
|
|
156 |
|
|
22: I = { `ZERO ,`R1 ,`VOID ,`VOID };
|
157 |
|
|
23: I = { `ZERO ,`R2 ,`VOID ,`VOID };
|
158 |
|
|
24: I = { `ZERO ,`R3 ,`VOID ,`VOID };
|
159 |
|
|
25: I = { `ZERO ,`R4 ,`VOID ,`VOID };
|
160 |
|
|
26: I = { `ZERO ,`R5 ,`VOID ,`VOID };
|
161 |
|
|
27: I = { `NOP ,`RT_FALSE };
|
162 |
|
|
28: I = { `RETURN ,`RT_TRUE };
|
163 |
|
|
|
164 |
|
|
|
165 |
|
|
|
166 |
21 |
diegovalve |
//----------------------------------------------------------------------
|
167 |
|
|
//Micro code for CPPU
|
168 |
76 |
diegovalve |
//TAG_CPPU_UCODE_ADDRESS:
|
169 |
21 |
diegovalve |
|
170 |
|
|
|
171 |
76 |
diegovalve |
29: I = { `SUB ,`R1 ,`CREG_PROJECTION_WINDOW_MAX ,`CREG_PROJECTION_WINDOW_MIN };
|
172 |
|
|
30: I = { `DIV ,`CREG_PROJECTION_WINDOW_SCALE ,`R1 ,`CREG_RESOLUTION };
|
173 |
|
|
31: I = { `RETURN ,`RT_FALSE };
|
174 |
21 |
diegovalve |
|
175 |
|
|
//----------------------------------------------------------------------
|
176 |
|
|
//Micro code for RGU
|
177 |
76 |
diegovalve |
//TAG_RGU_UCODE_ADDRESS:
|
178 |
21 |
diegovalve |
|
179 |
|
|
|
180 |
76 |
diegovalve |
32: I = { `MUL ,`R1 ,`CREG_PIXEL_2D_POSITION ,`CREG_PROJECTION_WINDOW_SCALE };
|
181 |
|
|
33: I = { `ADD ,`R1 ,`R1 ,`CREG_PROJECTION_WINDOW_MIN };
|
182 |
|
|
34: I = { `SUB ,`CREG_UNORMALIZED_DIRECTION ,`R1 ,`CREG_CAMERA_POSITION };
|
183 |
|
|
35: I = { `MAG ,`R2 ,`CREG_UNORMALIZED_DIRECTION ,`VOID };
|
184 |
|
|
36: I = { `DIV ,`CREG_RAY_DIRECTION ,`CREG_UNORMALIZED_DIRECTION ,`R2 };
|
185 |
|
|
37: I = { `DEC,`CREG_LAST_COL,`CREG_PIXEL_2D_FINAL_POSITION ,`VOID };
|
186 |
|
|
// NOP RT_FALSE
|
187 |
|
|
38: I = { `RETURN ,`RT_FALSE };
|
188 |
21 |
diegovalve |
//----------------------------------------------------------------------
|
189 |
|
|
//Next Pixel generation Code (NPG)
|
190 |
76 |
diegovalve |
//TAG_NPG_UCODE_ADDRESS:
|
191 |
21 |
diegovalve |
|
192 |
76 |
diegovalve |
|
193 |
|
|
39: I = { `SETX ,`R1 ,32'h00003 };
|
194 |
|
|
40: I = { `SETY ,`R1 ,32'h00003 };
|
195 |
|
|
41: I = { `SETZ ,`R1 ,32'h00003 };
|
196 |
21 |
diegovalve |
|
197 |
76 |
diegovalve |
42: I = { `ADD ,`CREG_PIXEL_PITCH ,`CREG_PIXEL_PITCH ,`R1 };
|
198 |
|
|
43: I = { `COPY ,`OREG_ADDR_O ,`CREG_PIXEL_PITCH ,`VOID };
|
199 |
|
|
44: I = { `JGEX ,`LABEL_NPG_NEXT_ROW ,`CREG_PIXEL_2D_POSITION ,`CREG_LAST_COL };
|
200 |
|
|
45: I = { `INCX ,`CREG_PIXEL_2D_POSITION ,`CREG_PIXEL_2D_POSITION ,`VOID };
|
201 |
|
|
46: I = { `RETURN ,`RT_TRUE };
|
202 |
21 |
diegovalve |
|
203 |
76 |
diegovalve |
//LABEL_NPG_NEXT_ROW:
|
204 |
|
|
47: I = { `SETX ,`CREG_PIXEL_2D_POSITION ,32'h0 };
|
205 |
|
|
48: I = { `INCY ,`CREG_PIXEL_2D_POSITION ,`CREG_PIXEL_2D_POSITION ,`VOID };
|
206 |
|
|
49: I = { `JGEY ,`LABEL_ALLDONE ,`CREG_PIXEL_2D_POSITION ,`CREG_PIXEL_2D_FINAL_POSITION };
|
207 |
|
|
50: I = { `RETURN ,`RT_TRUE };
|
208 |
|
|
|
209 |
|
|
//LABEL_ALLDONE:
|
210 |
|
|
51: I = { `NOP ,`VOID ,`VOID };
|
211 |
|
|
52: I = { `RETURN ,`RT_FALSE };
|
212 |
|
|
|
213 |
21 |
diegovalve |
//----------------------------------------------------------------------
|
214 |
|
|
//Micro code for AABBIU
|
215 |
76 |
diegovalve |
//TAG_AABBIU_UCODE_ADDRESS:
|
216 |
21 |
diegovalve |
|
217 |
76 |
diegovalve |
53: I = { `ZERO ,`R3 ,`VOID ,`VOID };
|
218 |
|
|
54: I = { `SETX ,`CREG_LAST_t ,32'h1F40000 };
|
219 |
|
|
55: I = { `RETURN ,`RT_TRUE };
|
220 |
21 |
diegovalve |
|
221 |
76 |
diegovalve |
//LABEL_TEST_RAY_X_ORIGEN:
|
222 |
|
|
56: I = { `JGEX ,`LABEL_ELSE_IFX ,`CREG_CAMERA_POSITION ,`CREG_AABBMIN };
|
223 |
|
|
57: I = { `SUB ,`R1 ,`CREG_AABBMIN ,`CREG_CAMERA_POSITION };
|
224 |
|
|
58: I = { `JLEX ,`LABEL1 ,`R1 ,`CREG_UNORMALIZED_DIRECTION };
|
225 |
|
|
59: I = { `RETURN ,`RT_FALSE };
|
226 |
21 |
diegovalve |
|
227 |
76 |
diegovalve |
//LABEL1:
|
228 |
|
|
60: I = { `SETX ,`RAY_INSIDE_BOX ,32'd0 };
|
229 |
|
|
61: I = { `DIV ,`R6 ,`R1 ,`CREG_UNORMALIZED_DIRECTION };
|
230 |
|
|
62: I = { `JMP ,`LABEL_TEST_RAY_Y_ORIGEN ,`VOID ,`VOID };
|
231 |
21 |
diegovalve |
|
232 |
76 |
diegovalve |
//LABEL_ELSE_IFX:
|
233 |
|
|
63: I = { `JLEX ,`LABEL_ELSEX ,`CREG_CAMERA_POSITION ,`CREG_AABBMAX };
|
234 |
|
|
64: I = { `SUB ,`R1 ,`CREG_AABBMAX ,`CREG_CAMERA_POSITION };
|
235 |
|
|
65: I = { `JGEX ,`LABEL2 ,`R1 ,`CREG_UNORMALIZED_DIRECTION };
|
236 |
|
|
66: I = { `RETURN ,`RT_FALSE };
|
237 |
21 |
diegovalve |
|
238 |
76 |
diegovalve |
//LABEL2:
|
239 |
|
|
67: I = { `SETX ,`RAY_INSIDE_BOX ,32'd0 };
|
240 |
|
|
68: I = { `DIV ,`R6 ,`R1 ,`CREG_UNORMALIZED_DIRECTION };
|
241 |
|
|
69: I = { `JMP ,`LABEL_TEST_RAY_Y_ORIGEN ,`VOID ,`VOID };
|
242 |
|
|
//LABEL_ELSEX:
|
243 |
|
|
70: I = { `SETX ,`R5 ,32'b1 };
|
244 |
21 |
diegovalve |
|
245 |
76 |
diegovalve |
//LABEL_TEST_RAY_Y_ORIGEN:
|
246 |
|
|
71: I = { `JGEY ,`LABEL_ELESE_IFY ,`CREG_CAMERA_POSITION ,`CREG_AABBMIN };
|
247 |
|
|
72: I = { `SUB ,`R1 ,`CREG_AABBMIN ,`CREG_CAMERA_POSITION };
|
248 |
|
|
73: I = { `JLEY ,`LABEL3 ,`R1 ,`CREG_UNORMALIZED_DIRECTION };
|
249 |
|
|
74: I = { `RETURN ,`RT_FALSE };
|
250 |
21 |
diegovalve |
|
251 |
76 |
diegovalve |
//LABEL3:
|
252 |
|
|
75: I = { `SETX ,`RAY_INSIDE_BOX ,32'd0 };
|
253 |
|
|
76: I = { `DIV ,`R6 ,`R1 ,`CREG_UNORMALIZED_DIRECTION };
|
254 |
|
|
77: I = { `JMP ,`LABEL_TEST_RAY_Z_ORIGEN ,`VOID ,`VOID };
|
255 |
21 |
diegovalve |
|
256 |
76 |
diegovalve |
//LABEL_ELESE_IFY:
|
257 |
|
|
78: I = { `JLEY ,`LABEL_ELSEY ,`CREG_CAMERA_POSITION ,`CREG_AABBMAX };
|
258 |
|
|
79: I = { `SUB ,`R1 ,`CREG_AABBMAX ,`CREG_CAMERA_POSITION };
|
259 |
|
|
80: I = { `JGEY ,`LABEL4 ,`R1 ,`CREG_UNORMALIZED_DIRECTION };
|
260 |
|
|
81: I = { `RETURN ,`RT_FALSE };
|
261 |
21 |
diegovalve |
|
262 |
76 |
diegovalve |
//LABEL4:
|
263 |
|
|
82: I = { `SETX ,`RAY_INSIDE_BOX ,32'd0 };
|
264 |
|
|
83: I = { `DIV ,`R6 ,`R1 ,`CREG_UNORMALIZED_DIRECTION };
|
265 |
|
|
84: I = { `JMP ,`LABEL_TEST_RAY_Z_ORIGEN ,`VOID ,`VOID };
|
266 |
21 |
diegovalve |
|
267 |
76 |
diegovalve |
//LABEL_ELSEY:
|
268 |
|
|
85: I = { `SETY ,`R5 ,32'b1 };
|
269 |
21 |
diegovalve |
|
270 |
76 |
diegovalve |
//LABEL_TEST_RAY_Z_ORIGEN:
|
271 |
|
|
86: I = { `JGEZ ,`LABEL_ELESE_IFZ ,`CREG_CAMERA_POSITION ,`CREG_AABBMIN };
|
272 |
|
|
87: I = { `SUB ,`R1 ,`CREG_AABBMIN ,`CREG_CAMERA_POSITION };
|
273 |
|
|
88: I = { `JLEZ ,`LABEL5 ,`R1 ,`CREG_UNORMALIZED_DIRECTION };
|
274 |
|
|
89: I = { `RETURN ,`RT_FALSE };
|
275 |
21 |
diegovalve |
|
276 |
76 |
diegovalve |
//LABEL5:
|
277 |
|
|
90: I = { `SETX ,`RAY_INSIDE_BOX ,32'd0 };
|
278 |
|
|
91: I = { `DIV ,`R6 ,`R1 ,`CREG_UNORMALIZED_DIRECTION };
|
279 |
|
|
92: I = { `JMP ,`LABEL_RAY_INSIDE_BOX ,`VOID ,`VOID };
|
280 |
21 |
diegovalve |
|
281 |
76 |
diegovalve |
//LABEL_ELESE_IFZ:
|
282 |
|
|
93: I = { `JLEZ ,`LABEL_ELSEZ ,`CREG_CAMERA_POSITION ,`CREG_AABBMAX };
|
283 |
|
|
94: I = { `SUB ,`R1 ,`CREG_AABBMAX ,`CREG_CAMERA_POSITION };
|
284 |
|
|
95: I = { `JGEZ ,`LABEL6 ,`R1 ,`CREG_UNORMALIZED_DIRECTION };
|
285 |
|
|
96: I = { `RETURN ,`RT_FALSE };
|
286 |
21 |
diegovalve |
|
287 |
76 |
diegovalve |
//LABEL6:
|
288 |
|
|
97: I = { `SETX ,`RAY_INSIDE_BOX ,32'd0 };
|
289 |
|
|
98: I = { `DIV ,`R6 ,`R1 ,`CREG_UNORMALIZED_DIRECTION };
|
290 |
|
|
99: I = { `JMP ,`LABEL_RAY_INSIDE_BOX ,`VOID ,`VOID };
|
291 |
21 |
diegovalve |
|
292 |
76 |
diegovalve |
//LABEL_ELSEZ:
|
293 |
|
|
100: I = { `SETZ ,`R5 ,32'b1 };
|
294 |
21 |
diegovalve |
|
295 |
76 |
diegovalve |
//LABEL_RAY_INSIDE_BOX:
|
296 |
|
|
101: I = { `ZERO ,`R1 ,`VOID ,`VOID };
|
297 |
|
|
102: I = { `JEQX ,`LABEL_TEST_YZ_PLANE ,`R1 ,`RAY_INSIDE_BOX };
|
298 |
|
|
//BUG need a NOP here else pipeline gets confused
|
299 |
|
|
103: I = { `RETURN ,`RT_TRUE };
|
300 |
21 |
diegovalve |
|
301 |
76 |
diegovalve |
//LABEL_TEST_YZ_PLANE:
|
302 |
|
|
104: I = { `JNEX ,`LABEL_TEST_XZ_PLANE ,`R5 ,`R1 };
|
303 |
|
|
105: I = { `SWIZZLE3D ,`R6 ,`SWIZZLE_XXX };
|
304 |
|
|
106: I = { `MUL ,`R2 ,`CREG_UNORMALIZED_DIRECTION ,`R6 };
|
305 |
|
|
107: I = { `ADD ,`R2 ,`R2 ,`CREG_CAMERA_POSITION };
|
306 |
|
|
108: I = { `JGEY ,`LABEL7 ,`R2 ,`CREG_AABBMIN };
|
307 |
|
|
109: I = { `RETURN ,`RT_FALSE };
|
308 |
21 |
diegovalve |
|
309 |
76 |
diegovalve |
//LABEL7:
|
310 |
|
|
110: I = { `JLEY ,`LABEL8 ,`R2 ,`CREG_AABBMAX };
|
311 |
|
|
111: I = { `RETURN ,`RT_FALSE };
|
312 |
21 |
diegovalve |
|
313 |
76 |
diegovalve |
//LABEL8:
|
314 |
|
|
112: I = { `JGEZ ,`LABEL9 ,`R2 ,`CREG_AABBMIN };
|
315 |
|
|
113: I = { `RETURN ,`RT_FALSE };
|
316 |
21 |
diegovalve |
|
317 |
76 |
diegovalve |
//LABEL9:
|
318 |
|
|
114: I = { `JLEZ ,`LABEL_TEST_XZ_PLANE ,`R2 ,`CREG_AABBMAX };
|
319 |
|
|
115: I = { `RETURN ,`RT_FALSE };
|
320 |
21 |
diegovalve |
|
321 |
76 |
diegovalve |
//LABEL_TEST_XZ_PLANE:
|
322 |
|
|
116: I = { `JNEY ,`LABEL_TEST_XY_PLANE ,`R5 ,`R1 };
|
323 |
|
|
117: I = { `SWIZZLE3D ,`R6 ,`SWIZZLE_YYY };
|
324 |
|
|
118: I = { `MUL ,`R2 ,`CREG_UNORMALIZED_DIRECTION ,`R6 };
|
325 |
|
|
119: I = { `ADD ,`R2 ,`R2 ,`CREG_CAMERA_POSITION };
|
326 |
|
|
120: I = { `JGEX ,`LABEL10 ,`R2 ,`CREG_AABBMIN };
|
327 |
|
|
121: I = { `RETURN ,`RT_FALSE };
|
328 |
21 |
diegovalve |
|
329 |
76 |
diegovalve |
//LABEL10:
|
330 |
|
|
122: I = { `JLEX ,`LABEL11 ,`R2 ,`CREG_AABBMAX };
|
331 |
|
|
123: I = { `RETURN ,`RT_FALSE };
|
332 |
21 |
diegovalve |
|
333 |
76 |
diegovalve |
//LABEL11:
|
334 |
|
|
124: I = { `JGEZ ,`LABEL12 ,`R2 ,`CREG_AABBMIN };
|
335 |
|
|
125: I = { `RETURN ,`RT_FALSE };
|
336 |
21 |
diegovalve |
|
337 |
76 |
diegovalve |
//LABEL12:
|
338 |
|
|
126: I = { `JLEZ ,`LABEL_TEST_XY_PLANE ,`R2 ,`CREG_AABBMAX };
|
339 |
|
|
127: I = { `RETURN ,`RT_FALSE };
|
340 |
21 |
diegovalve |
|
341 |
76 |
diegovalve |
//LABEL_TEST_XY_PLANE:
|
342 |
|
|
128: I = { `SWIZZLE3D ,`R6 ,`SWIZZLE_ZZZ };
|
343 |
|
|
129: I = { `MUL ,`R2 ,`CREG_UNORMALIZED_DIRECTION ,`R6 };
|
344 |
|
|
130: I = { `ADD ,`R2 ,`R2 ,`CREG_CAMERA_POSITION };
|
345 |
|
|
131: I = { `JGEX ,`LABEL13 ,`R2 ,`CREG_AABBMIN };
|
346 |
|
|
132: I = { `RETURN ,`RT_FALSE };
|
347 |
21 |
diegovalve |
|
348 |
76 |
diegovalve |
//LABEL13:
|
349 |
|
|
133: I = { `JLEX ,`LABEL14 ,`R2 ,`CREG_AABBMAX };
|
350 |
|
|
134: I = { `RETURN ,`RT_FALSE };
|
351 |
21 |
diegovalve |
|
352 |
76 |
diegovalve |
//LABEL14:
|
353 |
|
|
135: I = { `JGEY ,`LABEL15 ,`R2 ,`CREG_AABBMIN };
|
354 |
|
|
136: I = { `RETURN ,`RT_FALSE };
|
355 |
21 |
diegovalve |
|
356 |
76 |
diegovalve |
//LABEL15:
|
357 |
|
|
137: I = { `JLEY ,`LABEL_HIT ,`R2 ,`CREG_AABBMAX };
|
358 |
|
|
138: I = { `RETURN ,`RT_FALSE };
|
359 |
21 |
diegovalve |
|
360 |
76 |
diegovalve |
//LABEL_HIT:
|
361 |
|
|
139: I = { `SETX ,`CREG_LAST_t ,32'h1F40000 };
|
362 |
|
|
140: I = { `RETURN ,`RT_TRUE };
|
363 |
21 |
diegovalve |
|
364 |
|
|
//------------------------------------------------------------------------
|
365 |
|
|
//BIU Micro code
|
366 |
76 |
diegovalve |
//TAG_BIU_UCODE_ADDRESS:
|
367 |
21 |
diegovalve |
|
368 |
76 |
diegovalve |
141: I = { `ZERO ,`OREG_PIXEL_COLOR ,`VOID ,`VOID };
|
369 |
|
|
142: I = { `SETX ,`R3 ,`ONE };
|
370 |
|
|
143: I = { `SETX ,`R1 ,32'h00000 };
|
371 |
|
|
144: I = { `SUB ,`CREG_E1 ,`CREG_V1 ,`CREG_V0 };
|
372 |
|
|
145: I = { `SUB ,`CREG_E2 ,`CREG_V2 ,`CREG_V0 };
|
373 |
|
|
146: I = { `SUB ,`CREG_T ,`CREG_CAMERA_POSITION ,`CREG_V0 };
|
374 |
|
|
147: I = { `CROSS ,`CREG_P ,`CREG_RAY_DIRECTION ,`CREG_E2 };
|
375 |
|
|
148: I = { `CROSS ,`CREG_Q ,`CREG_T ,`CREG_E1 };
|
376 |
|
|
149: I = { `DOT ,`CREG_H1 ,`CREG_Q ,`CREG_E2 };
|
377 |
|
|
150: I = { `DOT ,`CREG_H2 ,`CREG_P ,`CREG_T };
|
378 |
|
|
151: I = { `DOT ,`CREG_H3 ,`CREG_Q ,`CREG_RAY_DIRECTION };
|
379 |
|
|
152: I = { `DOT ,`CREG_DELTA ,`CREG_P ,`CREG_E1 };
|
380 |
|
|
153: I = { `DIV ,`CREG_t ,`CREG_H1 ,`CREG_DELTA };
|
381 |
|
|
154: I = { `DIV ,`CREG_u ,`CREG_H2 ,`CREG_DELTA };
|
382 |
|
|
155: I = { `DIV ,`CREG_v ,`CREG_H3 ,`CREG_DELTA };
|
383 |
|
|
156: I = { `JGEX ,`LABEL_BIU1 ,`CREG_u ,`R1 };
|
384 |
105 |
diegovalve |
157: I = { `RET ,`R99, `FALSE }; //157: I = { `RETURN ,`RT_FALSE };
|
385 |
21 |
diegovalve |
|
386 |
76 |
diegovalve |
//LABEL_BIU1:
|
387 |
|
|
158: I = { `JGEX ,`LABEL_BIU2 ,`CREG_v ,`R1 };
|
388 |
105 |
diegovalve |
159: I = { `RET ,`R99, `FALSE }; //159: I = { `RETURN ,`RT_FALSE };
|
389 |
21 |
diegovalve |
|
390 |
76 |
diegovalve |
//LABEL_BIU2:
|
391 |
|
|
160: I = { `ADD ,`R2 ,`CREG_u ,`CREG_v };
|
392 |
|
|
161: I = { `JLEX ,`LABEL_BIU3 ,`R2 ,`R3 };
|
393 |
105 |
diegovalve |
162: I = { `RET ,`R99, `FALSE }; //162: I = { `RETURN ,`RT_FALSE };
|
394 |
21 |
diegovalve |
|
395 |
76 |
diegovalve |
//LABEL_BIU3:
|
396 |
|
|
163: I = { `JGEX ,`LABEL_BIU4 ,`CREG_t ,`CREG_LAST_t };
|
397 |
|
|
164: I = { `COPY ,`CREG_LAST_t ,`CREG_t ,`VOID };
|
398 |
|
|
165: I = { `COPY ,`CREG_LAST_u ,`CREG_u ,`VOID };
|
399 |
|
|
166: I = { `COPY ,`CREG_LAST_v ,`CREG_v ,`VOID };
|
400 |
|
|
167: I = { `COPY ,`CREG_E1_LAST ,`CREG_E1 ,`VOID };
|
401 |
|
|
168: I = { `COPY ,`CREG_E2_LAST ,`CREG_E2 ,`VOID };
|
402 |
|
|
169: I = { `COPY ,`CREG_UV0_LAST ,`CREG_UV0 ,`VOID };
|
403 |
|
|
170: I = { `COPY ,`CREG_UV1_LAST ,`CREG_UV1 ,`VOID };
|
404 |
|
|
171: I = { `COPY ,`CREG_UV2_LAST ,`CREG_UV2 ,`VOID };
|
405 |
|
|
172: I = { `COPY ,`CREG_TRI_DIFFUSE_LAST ,`CREG_TRI_DIFFUSE ,`VOID };
|
406 |
|
|
//LABEL_BIU4:
|
407 |
105 |
diegovalve |
173: I = { `RET ,`R99, `TRUE }; //173: I = { `RETURN ,`RT_TRUE };
|
408 |
21 |
diegovalve |
|
409 |
|
|
|
410 |
|
|
//-------------------------------------------------------------------------
|
411 |
|
|
//Calculate the adress of the texure coordiantes.
|
412 |
|
|
|
413 |
76 |
diegovalve |
//TAG_TCC_UCODE_ADDRESS:
|
414 |
21 |
diegovalve |
//Do this calculation only if this triangle is the one closest to the camera
|
415 |
76 |
diegovalve |
174: I = { `JGX ,`LABEL_TCC_EXIT ,`CREG_t ,`CREG_LAST_t };
|
416 |
21 |
diegovalve |
|
417 |
|
|
//First get the UV coodrinates and store in R1
|
418 |
76 |
diegovalve |
//R1x: u_coordinate = U0 + last_u * (U1 - U0) + last_v * (U2 - U0)
|
419 |
|
|
//R1y: v_coordinate = V0 + last_u * (V1 - V0) + last_v * (V2 - V0)
|
420 |
21 |
diegovalve |
//R1z: 0
|
421 |
|
|
|
422 |
76 |
diegovalve |
175: I = { `SUB ,`R1 ,`CREG_UV1_LAST ,`CREG_UV0_LAST };
|
423 |
|
|
176: I = { `SUB ,`R2 ,`CREG_UV2_LAST ,`CREG_UV0_LAST };
|
424 |
|
|
177: I = { `MUL ,`R1 ,`CREG_LAST_u ,`R1 };
|
425 |
|
|
178: I = { `MUL ,`R2 ,`CREG_LAST_v ,`R2 };
|
426 |
|
|
179: I = { `ADD ,`R1 ,`R1 ,`R2 };
|
427 |
|
|
180: I = { `ADD ,`R1 ,`R1 ,`CREG_UV0_LAST };
|
428 |
21 |
diegovalve |
|
429 |
76 |
diegovalve |
//R7x : fu = (u_coordinate) * gTexture.mWidth
|
430 |
|
|
//R7y : fv = (v_coordinate) * gTexture.mWidth
|
431 |
21 |
diegovalve |
//R7z : 0
|
432 |
76 |
diegovalve |
181: I = { `MUL ,`R7 ,`R1 ,`CREG_TEXTURE_SIZE };
|
433 |
21 |
diegovalve |
|
434 |
76 |
diegovalve |
//R1x: u1 = ((int)fu) % gTexture.mWidth
|
435 |
|
|
//R1y: v1 = ((int)fv) % gTexture.mHeight
|
436 |
21 |
diegovalve |
//R1z: 0
|
437 |
76 |
diegovalve |
//R2x: u2 = (u1 + 1 ) % gTexture.mWidth
|
438 |
|
|
//R2y: v2 = (v2 + 1 ) % gTexture.mHeight
|
439 |
21 |
diegovalve |
//R2z: 0
|
440 |
|
|
// Notice MOD2 only operates over
|
441 |
76 |
diegovalve |
// numbers that are power of 2 also notice that the
|
442 |
21 |
diegovalve |
// textures are assumed to be squares!
|
443 |
|
|
//x % 2^n == x & (2^n - 1).
|
444 |
|
|
|
445 |
76 |
diegovalve |
182: I = { `MOD ,`R1 ,`R7 ,`CREG_TEXTURE_SIZE };
|
446 |
|
|
183: I = { `INC ,`R2 ,`R1 ,`VOID };
|
447 |
|
|
184: I = { `MOD ,`R2 ,`R2 ,`CREG_TEXTURE_SIZE };
|
448 |
21 |
diegovalve |
|
449 |
76 |
diegovalve |
//Cool now we should store the values in the appropiate registers
|
450 |
21 |
diegovalve |
//OREG_TEX_COORD1.x = u1 + v1 * gTexture.mWidth
|
451 |
|
|
//OREG_TEX_COORD1.y = u2 + v1 * gTexture.mWidth
|
452 |
|
|
//OREG_TEX_COORD1.z = 0
|
453 |
|
|
//OREG_TEX_COORD2.x = u1 + v2 * gTexture.mWidth
|
454 |
|
|
//OREG_TEX_COORD2.y = u2 + v2 * gTexture.mWidth
|
455 |
|
|
//OREG_TEX_COORD1.z = 0
|
456 |
|
|
|
457 |
76 |
diegovalve |
//R1= [u1 v1 0]
|
458 |
|
|
//R2= [u2 v2 0]
|
459 |
21 |
diegovalve |
|
460 |
76 |
diegovalve |
//R2 = [v2 u2 0]
|
461 |
|
|
185: I = { `SWIZZLE3D ,`R2 ,`SWIZZLE_YXZ };
|
462 |
21 |
diegovalve |
|
463 |
|
|
//R3 = [v2 v1 0]
|
464 |
76 |
diegovalve |
186: I = { `XCHANGEX ,`R3 ,`R1 ,`R2 };
|
465 |
21 |
diegovalve |
|
466 |
|
|
|
467 |
76 |
diegovalve |
//R4 = [u1 u2 0]
|
468 |
|
|
187: I = { `XCHANGEX ,`R4 ,`R2 ,`R1 };
|
469 |
21 |
diegovalve |
|
470 |
76 |
diegovalve |
//R2 = [v2*H v1*H 0]
|
471 |
|
|
188: I = { `UNSCALE ,`R9 ,`R3 ,`VOID };
|
472 |
|
|
189: I = { `UNSCALE ,`R8 ,`CREG_TEXTURE_SIZE ,`VOID };
|
473 |
|
|
190: I = { `IMUL ,`R2 ,`R9 ,`R8 };
|
474 |
21 |
diegovalve |
|
475 |
76 |
diegovalve |
//OREG_TEX_COORD1 = [u1 + v2*H u2 + v1*H 0]
|
476 |
21 |
diegovalve |
//R4 = FixedToIinteger(R4)
|
477 |
76 |
diegovalve |
191: I = { `UNSCALE ,`R4 ,`R4 ,`VOID };
|
478 |
|
|
192: I = { `ADD ,`R12 ,`R2 ,`R4 };
|
479 |
|
|
193: I = { `SETX ,`R5 ,32'h3 };
|
480 |
|
|
194: I = { `SETY ,`R5 ,32'h3 };
|
481 |
|
|
195: I = { `SETZ ,`R5 ,32'h3 };
|
482 |
21 |
diegovalve |
//Multiply by 3 (the pitch)
|
483 |
105 |
diegovalve |
//196: I = { `IMUL ,`OREG_TEX_COORD1 ,`R12 ,`R5 };
|
484 |
|
|
196: I = { `IMUL ,`CREG_TEX_COORD1 ,`R12 ,`R5 };
|
485 |
21 |
diegovalve |
|
486 |
|
|
//R4 = [u2 u1 0]
|
487 |
76 |
diegovalve |
197: I = { `SWIZZLE3D ,`R4 ,`SWIZZLE_YXZ };
|
488 |
21 |
diegovalve |
|
489 |
|
|
|
490 |
76 |
diegovalve |
//OREG_TEX_COORD2 [u2 + v2*H u1 + v1*H 0]
|
491 |
|
|
198: I = { `ADD ,`R12 ,`R2 ,`R4 };
|
492 |
21 |
diegovalve |
//Multiply by 3 (the pitch)
|
493 |
105 |
diegovalve |
//199: I = { `IMUL ,`OREG_TEX_COORD2 ,`R12 ,`R5 };
|
494 |
|
|
199: I = { `IMUL ,`CREG_TEX_COORD2 ,`R12 ,`R5 };
|
495 |
21 |
diegovalve |
|
496 |
|
|
|
497 |
|
|
//Cool now get the weights
|
498 |
|
|
|
499 |
76 |
diegovalve |
//w1 = (1 - fracu) * (1 - fracv)
|
500 |
|
|
//w2 = fracu * (1 - fracv)
|
501 |
|
|
//w3 = (1 - fracu) * fracv
|
502 |
|
|
//w4 = fracu * fracv
|
503 |
21 |
diegovalve |
|
504 |
|
|
//R4x: fracu
|
505 |
|
|
//R4y: fracv
|
506 |
|
|
//R4z: 0
|
507 |
76 |
diegovalve |
200: I = { `FRAC ,`R4 ,`R7 ,`VOID };
|
508 |
21 |
diegovalve |
|
509 |
|
|
//R5x: fracv
|
510 |
|
|
//R5y: fracu
|
511 |
|
|
//R5z: 0
|
512 |
76 |
diegovalve |
201: I = { `COPY ,`R5 ,`R4 ,`VOID };
|
513 |
|
|
202: I = { `SWIZZLE3D ,`R5 ,`SWIZZLE_YXZ };
|
514 |
21 |
diegovalve |
|
515 |
|
|
|
516 |
|
|
//R5x: 1 - fracv
|
517 |
|
|
//R5y: 1 - fracu
|
518 |
|
|
//R5y: 1
|
519 |
76 |
diegovalve |
203: I = { `NEG ,`R5 ,`R5 ,`VOID };
|
520 |
|
|
204: I = { `INC ,`R5 ,`R5 ,`VOID };
|
521 |
21 |
diegovalve |
|
522 |
|
|
//R5x: 1 - fracv
|
523 |
|
|
//R5y: 1 - fracu
|
524 |
|
|
//R5y: (1 - fracv)(1 - fracu)
|
525 |
76 |
diegovalve |
205: I = { `MULP ,`CREG_TEXWEIGHT1 ,`R5 ,`VOID };
|
526 |
21 |
diegovalve |
|
527 |
74 |
diegovalve |
//CREG_TEXWEIGHT1.x = (1 - fracv)(1 - fracu)
|
528 |
|
|
//CREG_TEXWEIGHT1.y = (1 - fracv)(1 - fracu)
|
529 |
|
|
//CREG_TEXWEIGHT1.z = (1 - fracv)(1 - fracu)
|
530 |
76 |
diegovalve |
206: I = { `SWIZZLE3D ,`CREG_TEXWEIGHT1 ,`SWIZZLE_ZZZ };
|
531 |
21 |
diegovalve |
|
532 |
|
|
|
533 |
|
|
//R6x: w2: fracu * (1 - fracv )
|
534 |
|
|
//R6y: w3: fracv * (1 - fracu )
|
535 |
|
|
//R6z: 0
|
536 |
76 |
diegovalve |
207: I = { `MUL ,`R6 ,`R4 ,`R5 };
|
537 |
21 |
diegovalve |
|
538 |
74 |
diegovalve |
//CREG_TEXWEIGHT2.x = fracu * (1 - fracv )
|
539 |
|
|
//CREG_TEXWEIGHT2.y = fracu * (1 - fracv )
|
540 |
|
|
//CREG_TEXWEIGHT2.z = fracu * (1 - fracv )
|
541 |
76 |
diegovalve |
208: I = { `COPY ,`CREG_TEXWEIGHT2 ,`R6 ,`VOID };
|
542 |
|
|
209: I = { `SWIZZLE3D ,`CREG_TEXWEIGHT2 ,`SWIZZLE_XXX };
|
543 |
21 |
diegovalve |
|
544 |
74 |
diegovalve |
//CREG_TEXWEIGHT3.x = fracv * (1 - fracu )
|
545 |
|
|
//CREG_TEXWEIGHT3.y = fracv * (1 - fracu )
|
546 |
|
|
//CREG_TEXWEIGHT3.z = fracv * (1 - fracu )
|
547 |
76 |
diegovalve |
210: I = { `COPY ,`CREG_TEXWEIGHT3 ,`R6 ,`VOID };
|
548 |
|
|
211: I = { `SWIZZLE3D ,`CREG_TEXWEIGHT3 ,`SWIZZLE_YYY };
|
549 |
21 |
diegovalve |
|
550 |
|
|
|
551 |
|
|
//R4x: fracu
|
552 |
|
|
//R4y: fracv
|
553 |
|
|
//R4z: fracu * fracv
|
554 |
76 |
diegovalve |
212: I = { `MULP ,`R4 ,`R4 ,`VOID };
|
555 |
21 |
diegovalve |
|
556 |
74 |
diegovalve |
//CREG_TEXWEIGHT4.x = fracv * fracu
|
557 |
|
|
//CREG_TEXWEIGHT4.y = fracv * fracu
|
558 |
|
|
//CREG_TEXWEIGHT4.z = fracv * fracu
|
559 |
76 |
diegovalve |
213: I = { `COPY ,`CREG_TEXWEIGHT4 ,`R4 ,`VOID };
|
560 |
|
|
214: I = { `SWIZZLE3D ,`CREG_TEXWEIGHT4 ,`SWIZZLE_ZZZ };
|
561 |
21 |
diegovalve |
|
562 |
|
|
|
563 |
76 |
diegovalve |
//LABEL_TCC_EXIT:
|
564 |
105 |
diegovalve |
215: I = { `RET ,`R99, 32'h0 };//215: I = { `RETURN ,`RT_TRUE };
|
565 |
21 |
diegovalve |
|
566 |
|
|
|
567 |
|
|
//-------------------------------------------------------------------------
|
568 |
76 |
diegovalve |
//TAG_PSU_UCODE_ADRESS:
|
569 |
21 |
diegovalve |
//Pixel Shader #1
|
570 |
|
|
//This pixel shader has diffuse light but no textures
|
571 |
|
|
|
572 |
|
|
|
573 |
76 |
diegovalve |
216: I = { `CROSS ,`R1 ,`CREG_E1_LAST ,`CREG_E2_LAST };
|
574 |
|
|
217: I = { `MAG ,`R2 ,`R1 ,`VOID };
|
575 |
|
|
218: I = { `DIV ,`R1 ,`R1 ,`R2 };
|
576 |
|
|
219: I = { `MUL ,`R2 ,`CREG_RAY_DIRECTION ,`CREG_LAST_t };
|
577 |
|
|
220: I = { `ADD ,`R2 ,`R2 ,`CREG_CAMERA_POSITION };
|
578 |
|
|
221: I = { `SUB ,`R2 ,`CURRENT_LIGHT_POS ,`R2 };
|
579 |
|
|
222: I = { `MAG ,`R3 ,`R2 ,`VOID };
|
580 |
|
|
223: I = { `DIV ,`R2 ,`R2 ,`R3 };
|
581 |
|
|
224: I = { `DOT ,`R3 ,`R2 ,`R1 };
|
582 |
|
|
225: I = { `MUL ,`CREG_COLOR_ACC ,`CREG_TRI_DIFFUSE_LAST ,`CURRENT_LIGHT_DIFFUSE };
|
583 |
|
|
226: I = { `MUL ,`CREG_COLOR_ACC ,`CREG_COLOR_ACC ,`R3 };
|
584 |
|
|
227: I = { `COPY ,`CREG_TEXTURE_COLOR ,`CREG_COLOR_ACC ,`VOID };
|
585 |
|
|
228: I = { `NOP ,`RT_FALSE }; //I = { `JLEX ,`LABEL_DEBUG_PRINT_REGS ,`CREG_COLOR_ACC ,`R3 };
|
586 |
|
|
229: I = { `NOP ,`RT_FALSE }; //I = { `JMP ,`LABEL_DEBUG_PRINT_REGS ,`VOID ,`VOID };
|
587 |
|
|
230: I = { `NOP ,`RT_FALSE };
|
588 |
|
|
231: I = { `RETURN ,`RT_TRUE };
|
589 |
21 |
diegovalve |
|
590 |
|
|
//-------------------------------------------------------------------------
|
591 |
|
|
//Pixel Shader #2
|
592 |
76 |
diegovalve |
//TAG_PSU_UCODE_ADRESS2:
|
593 |
21 |
diegovalve |
|
594 |
|
|
|
595 |
|
|
//This Pixel Shader has no light but it does texturinng
|
596 |
|
|
//with bi-linear interpolation
|
597 |
|
|
|
598 |
76 |
diegovalve |
//CColor TextureColor
|
599 |
|
|
//TextureColor.R = c1.R * w1 + c2.R * w2 + c3.R * w3 + c4.R * w4
|
600 |
|
|
//TextureColor.G = c1.G * w1 + c2.G * w2 + c3.G * w3 + c4.G * w4
|
601 |
|
|
//TextureColor.B = c1.B * w1 + c2.B * w2 + c3.B * w3 + c4.B * w4
|
602 |
21 |
diegovalve |
|
603 |
76 |
diegovalve |
232: I = { `MUL ,`R1 ,`CREG_TEX_COLOR5 ,`CREG_TEXWEIGHT1 };
|
604 |
|
|
233: I = { `MUL ,`R2 ,`CREG_TEX_COLOR2 ,`CREG_TEXWEIGHT2 };
|
605 |
|
|
234: I = { `MUL ,`R3 ,`CREG_TEX_COLOR1 ,`CREG_TEXWEIGHT3 };
|
606 |
|
|
235: I = { `MUL ,`R4 ,`CREG_TEX_COLOR4 ,`CREG_TEXWEIGHT4 };
|
607 |
|
|
236: I = { `ADD ,`CREG_TEXTURE_COLOR ,`R1 ,`R2 };
|
608 |
|
|
237: I = { `ADD ,`CREG_TEXTURE_COLOR ,`CREG_TEXTURE_COLOR ,`R3 };
|
609 |
|
|
238: I = { `ADD ,`CREG_TEXTURE_COLOR ,`CREG_TEXTURE_COLOR ,`R4 };
|
610 |
|
|
239: I = { `RETURN ,`RT_TRUE };
|
611 |
21 |
diegovalve |
|
612 |
|
|
|
613 |
76 |
diegovalve |
240: I = { `RETURN ,`RT_TRUE };
|
614 |
|
|
|
615 |
|
|
//-------------------------------------------------------------------------
|
616 |
|
|
//Default User constants
|
617 |
|
|
//TAG_USERCONSTANTS:
|
618 |
|
|
|
619 |
|
|
241: I = { `NOP ,`RT_FALSE };
|
620 |
|
|
242: I = { `RETURN ,`RT_TRUE };
|
621 |
|
|
|
622 |
|
|
//TAG_PIXELSHADER:
|
623 |
|
|
//Default Pixel Shader (just outputs texture)
|
624 |
|
|
243: I = { `COPY ,`OREG_PIXEL_COLOR,`CREG_TEXTURE_COLOR,`VOID };
|
625 |
|
|
244: I = { `RETURN ,`RT_TRUE };
|
626 |
21 |
diegovalve |
|
627 |
|
|
//-------------------------------------------------------------------------
|
628 |
|
|
|
629 |
|
|
|
630 |
|
|
default:
|
631 |
|
|
begin
|
632 |
|
|
|
633 |
|
|
`ifdef DEBUG
|
634 |
105 |
diegovalve |
$display("%dns CORE %d Error: Reached undefined address in instruction Memory: %d!!!!",$time,iDebug_CoreID,Address);
|
635 |
60 |
diegovalve |
// $stop();
|
636 |
21 |
diegovalve |
`endif
|
637 |
60 |
diegovalve |
I = {`INSTRUCTION_OP_LENGTH'hFF,16'hFFFF,32'hFFFFFFFF};
|
638 |
21 |
diegovalve |
end
|
639 |
|
|
endcase
|
640 |
|
|
end
|
641 |
|
|
endmodule
|
642 |
|
|
//--------------------------------------------------------
|