|
1 | | -/* Copyright (C) 2000,2001,2002 Sony Computer Entertainment America |
2 | | - |
3 | | - This file is subject to the terms and conditions of the GNU Lesser |
4 | | - General Public License Version 2.1. See the file "COPYING" in the |
5 | | - main directory of this archive for more details. */ |
6 | | - |
7 | | - #include "vu1_mem_linear.h" |
8 | | - |
9 | | - .include "db_in_db_out.i" |
10 | | - .include "math.i" |
11 | | - .include "lighting.i" |
12 | | - .include "clip_cull.i" |
13 | | - .include "geometry.i" |
14 | | - .include "io.i" |
15 | | - |
16 | | -kInputQPerV .equ 3 |
17 | | -kOutputQPerV .equ 3 |
18 | | - |
19 | | - .init_vf_all |
20 | | - .init_vi_all |
21 | | - |
22 | | - .name vsmFast |
23 | | - |
24 | | - --enter |
25 | | - --endenter |
26 | | - |
27 | | - ; ------------------------ initialization --------------------------------- |
28 | | - |
29 | | - ; there should be from 0 to 3 directional lights, no other types |
30 | | - |
31 | | - load_vert_xfrm vert_xform |
32 | | - |
33 | | - ; build a 3x3 matrix with light directions as the rows and a 3x3 matrix with |
34 | | - ; the 3 cols the light diffuse colors |
35 | | - ; find the constant color terms (sum of emissive and ambient terms) |
36 | | - |
37 | | - load_mat_emm constant_color |
38 | | - |
39 | | - ; initialize the direction and diffuse color matrices |
40 | | - move.xyz light_dirs[0], vf00 |
41 | | - move.xyz light_dirs[1], vf00 |
42 | | - move.xyz light_dirs[2], vf00 |
43 | | - move.xyz light_colors[0], vf00 |
44 | | - move.xyz light_colors[1], vf00 |
45 | | - move.xyz light_colors[2], vf00 |
46 | | - |
47 | | - init_dlt_loop |
48 | | - load_mat_amb material_amb |
49 | | - ibeq num_dir_lights, vi00, finish_init_lid |
50 | | - |
51 | | - load_mat_diff material_diff |
52 | | - load_o2wt obj_to_world_transpose |
53 | | - |
54 | | - load_lt_pos light_dirs[0] |
55 | | - mul_vec_mat_33 light_dirs[0], obj_to_world_transpose, light_dirs[0] |
56 | | - load_lt_diff light_colors[0] |
57 | | - mul.xyz light_colors[0], light_colors[0], material_diff |
58 | | - load_lt_amb light_amb |
59 | | - mul.xyz local_amb, material_amb, light_amb |
60 | | - add.xyz constant_color, constant_color, local_amb |
61 | | - |
62 | | - isubiu num_dir_lights, num_dir_lights, 1 |
63 | | - ibeq num_dir_lights, vi00, finish_init_lid |
64 | | - next_dir_light |
65 | | - load_lt_pos light_dirs[1] |
66 | | - mul_vec_mat_33 light_dirs[1], obj_to_world_transpose, light_dirs[1] |
67 | | - load_lt_diff light_colors[1] |
68 | | - mul.xyz light_colors[1], light_colors[1], material_diff |
69 | | - load_lt_amb light_amb |
70 | | - mul.xyz local_amb, material_amb, light_amb |
71 | | - add.xyz constant_color, constant_color, local_amb |
72 | | - |
73 | | - isubiu num_dir_lights, num_dir_lights, 1 |
74 | | - ibeq num_dir_lights, vi00, finish_init_lid |
75 | | - next_dir_light |
76 | | - load_lt_pos light_dirs[2] |
77 | | - mul_vec_mat_33 light_dirs[2], obj_to_world_transpose, light_dirs[2] |
78 | | - load_lt_diff light_colors[2] |
79 | | - mul.xyz light_colors[2], light_colors[2], material_diff |
80 | | - load_lt_amb light_amb |
81 | | - mul.xyz local_amb, material_amb, light_amb |
82 | | - add.xyz constant_color, constant_color, local_amb |
| 1 | +/* Copyright (C) 2000,2001,2002 Sony Computer Entertainment America |
| 2 | +
|
| 3 | + This file is subject to the terms and conditions of the GNU Lesser |
| 4 | + General Public License Version 2.1. See the file "COPYING" in the |
| 5 | + main directory of this archive for more details. */ |
| 6 | + |
| 7 | + #include "vu1_mem_linear.h" |
| 8 | + |
| 9 | + .include "db_in_db_out.i" |
| 10 | + .include "math.i" |
| 11 | + .include "lighting.i" |
| 12 | + .include "clip_cull.i" |
| 13 | + .include "geometry.i" |
| 14 | + .include "io.i" |
| 15 | + |
| 16 | +kInputQPerV .equ 3 |
| 17 | +kOutputQPerV .equ 3 |
| 18 | + |
| 19 | + .init_vf_all |
| 20 | + .init_vi_all |
| 21 | + |
| 22 | + .name vsmFast |
| 23 | + |
| 24 | + --enter |
| 25 | + --endenter |
| 26 | + |
| 27 | + ; ------------------------ initialization --------------------------------- |
| 28 | + |
| 29 | + ; there should be from 0 to 3 directional lights, no other types |
| 30 | + |
| 31 | + load_vert_xfrm vert_xform |
| 32 | + |
| 33 | + ; build a 3x3 matrix with light directions as the rows and a 3x3 matrix with |
| 34 | + ; the 3 cols the light diffuse colors |
| 35 | + ; find the constant color terms (sum of emissive and ambient terms) |
| 36 | + |
| 37 | + load_mat_emm constant_color |
| 38 | + |
| 39 | + ; initialize the direction and diffuse color matrices |
| 40 | + move.xyz light_dirs[0], vf00 |
| 41 | + move.xyz light_dirs[1], vf00 |
| 42 | + move.xyz light_dirs[2], vf00 |
| 43 | + move.xyz light_colors[0], vf00 |
| 44 | + move.xyz light_colors[1], vf00 |
| 45 | + move.xyz light_colors[2], vf00 |
| 46 | + |
| 47 | + init_dlt_loop |
| 48 | + load_mat_amb material_amb |
| 49 | + ibeq num_dir_lights, vi00, finish_init_lid |
| 50 | + |
| 51 | + load_mat_diff material_diff |
| 52 | + load_o2wt obj_to_world_transpose |
| 53 | + |
| 54 | + load_lt_pos light_dirs[0] |
| 55 | + mul_vec_mat_33 light_dirs[0], obj_to_world_transpose, light_dirs[0] |
| 56 | + load_lt_diff light_colors[0] |
| 57 | + mul.xyz light_colors[0], light_colors[0], material_diff |
| 58 | + load_lt_amb light_amb |
| 59 | + mul.xyz local_amb, material_amb, light_amb |
| 60 | + add.xyz constant_color, constant_color, local_amb |
| 61 | + |
| 62 | + isubiu num_dir_lights, num_dir_lights, 1 |
| 63 | + ibeq num_dir_lights, vi00, finish_init_lid |
| 64 | + next_dir_light |
| 65 | + load_lt_pos light_dirs[1] |
| 66 | + mul_vec_mat_33 light_dirs[1], obj_to_world_transpose, light_dirs[1] |
| 67 | + load_lt_diff light_colors[1] |
| 68 | + mul.xyz light_colors[1], light_colors[1], material_diff |
| 69 | + load_lt_amb light_amb |
| 70 | + mul.xyz local_amb, material_amb, light_amb |
| 71 | + add.xyz constant_color, constant_color, local_amb |
| 72 | + |
| 73 | + isubiu num_dir_lights, num_dir_lights, 1 |
| 74 | + ibeq num_dir_lights, vi00, finish_init_lid |
| 75 | + next_dir_light |
| 76 | + load_lt_pos light_dirs[2] |
| 77 | + mul_vec_mat_33 light_dirs[2], obj_to_world_transpose, light_dirs[2] |
| 78 | + load_lt_diff light_colors[2] |
| 79 | + mul.xyz light_colors[2], light_colors[2], material_diff |
| 80 | + load_lt_amb light_amb |
| 81 | + mul.xyz local_amb, material_amb, light_amb |
| 82 | + add.xyz constant_color, constant_color, local_amb |
83 | 83 |
|
84 | 84 | finish_init_lid: |
85 | 85 |
|
86 | | - load_glob_amb global_amb |
87 | | - mul.xyz local_amb, material_amb, global_amb |
88 | | - add.xyz constant_color, constant_color, local_amb |
| 86 | + load_glob_amb global_amb |
| 87 | + mul.xyz local_amb, material_amb, global_amb |
| 88 | + add.xyz constant_color, constant_color, local_amb |
89 | 89 |
|
90 | | - transpose_33ip light_dirs |
| 90 | + transpose_33ip light_dirs |
91 | 91 |
|
92 | | - ; the alpha of a vert is the material diffuse alpha |
93 | | - load_mat_diff material_diff, w |
94 | | - loi 128.0 |
95 | | - muli.w color, material_diff, i |
96 | | - loi 255.0 |
97 | | - minii.w color, color, i |
| 92 | + ; the alpha of a vert is the material diffuse alpha |
| 93 | + load_mat_diff material_diff, w |
| 94 | + loi 128.0 |
| 95 | + muli.w color, material_diff, i |
| 96 | + loi 255.0 |
| 97 | + minii.w color, color, i |
98 | 98 |
|
99 | | - ; use constant_color add to do an ftoi0 on the color |
100 | | - loi 12582912.0 |
101 | | - addi.xyz constant_color, constant_color, i |
| 99 | + ; use constant_color add to do an ftoi0 on the color |
| 100 | + loi 12582912.0 |
| 101 | + addi.xyz constant_color, constant_color, i |
102 | 102 |
|
103 | | - ; convert alpha to 0-bit fixed point |
104 | | - addi.w color, color, i |
| 103 | + ; convert alpha to 0-bit fixed point |
| 104 | + addi.w color, color, i |
105 | 105 |
|
106 | | - init_constants |
107 | | - init_clip_cnst |
| 106 | + init_constants |
| 107 | + init_clip_cnst |
108 | 108 |
|
109 | | - ; make translation matrix |
110 | | - sub trans[0], vf00, vf00 |
111 | | - sub trans[1], vf00, vf00 |
112 | | - sub trans[2], vf00, vf00 |
113 | | - maxw.x trans[0], trans[0], vf00 |
114 | | - maxw.y trans[1], trans[1], vf00 |
115 | | - maxw.z trans[2], trans[2], vf00 |
116 | | - move.xyz trans[3], gs_offsets |
117 | | - move.w trans[3], vf00 |
| 109 | + ; make translation matrix |
| 110 | + sub trans[0], vf00, vf00 |
| 111 | + sub trans[1], vf00, vf00 |
| 112 | + sub trans[2], vf00, vf00 |
| 113 | + maxw.x trans[0], trans[0], vf00 |
| 114 | + maxw.y trans[1], trans[1], vf00 |
| 115 | + maxw.z trans[2], trans[2], vf00 |
| 116 | + move.xyz trans[3], gs_offsets |
| 117 | + move.w trans[3], vf00 |
118 | 118 |
|
119 | | - ; new xform |
| 119 | + ; new xform |
120 | 120 |
|
121 | | - mul_vec_mat_44 new_xform[0], trans, vert_xform[0] |
122 | | - mul_vec_mat_44 new_xform[1], trans, vert_xform[1] |
123 | | - mul_vec_mat_44 new_xform[2], trans, vert_xform[2] |
124 | | - mul_vec_mat_44 new_xform[3], trans, vert_xform[3] |
| 121 | + mul_vec_mat_44 new_xform[0], trans, vert_xform[0] |
| 122 | + mul_vec_mat_44 new_xform[1], trans, vert_xform[1] |
| 123 | + mul_vec_mat_44 new_xform[2], trans, vert_xform[2] |
| 124 | + mul_vec_mat_44 new_xform[3], trans, vert_xform[3] |
125 | 125 |
|
126 | | - --cont |
| 126 | + --cont |
127 | 127 |
|
128 | | - ; -------------------- transform & texture loop --------------------------- |
| 128 | + ; -------------------- transform & texture loop --------------------------- |
129 | 129 |
|
130 | | -main_loop_lid: |
| 130 | +main_loop_lid: |
131 | 131 |
|
132 | | - init_io_loop |
133 | | - init_out_buf |
| 132 | + init_io_loop |
| 133 | + init_out_buf |
134 | 134 |
|
135 | | - set_strip_adcs |
| 135 | + set_strip_adcs |
136 | 136 |
|
137 | 137 | xform_loop_lid: |
138 | | - --LoopCS 1,3 |
| 138 | + --LoopCS 1,3 |
139 | 139 |
|
140 | | - ; xform/clip vertex |
| 140 | + ; xform/clip vertex |
141 | 141 |
|
142 | | - load_vert vert |
| 142 | + load_vert vert |
143 | 143 |
|
144 | | - xform_vert xformed_vert, new_xform, vert |
145 | | - ftoi4.xyz gs_vert, xformed_vert |
| 144 | + xform_vert xformed_vert, new_xform, vert |
| 145 | + ftoi4.xyz gs_vert, xformed_vert |
146 | 146 |
|
147 | | - load_strip_adc strip_adc |
148 | | - set_adc_s gs_vert, strip_adc |
| 147 | + load_strip_adc strip_adc |
| 148 | + set_adc_s gs_vert, strip_adc |
149 | 149 |
|
150 | | - store_xyzf gs_vert |
| 150 | + store_xyzf gs_vert |
151 | 151 |
|
152 | | - ; lighting |
| 152 | + ; lighting |
153 | 153 |
|
154 | | - load_normal normal |
155 | | - mul_vec_mat_33 cosines, light_dirs, normal |
156 | | - max.xyz cosines, cosines, vf00 |
157 | | - mul_vec_mat_33 color, light_colors, cosines |
158 | | - add.xyz color, color, constant_color |
159 | | - miniw.xyz color, color, gs_offsets[w] |
160 | | - store_rgba color |
| 154 | + load_normal normal |
| 155 | + mul_vec_mat_33 cosines, light_dirs, normal |
| 156 | + max.xyz cosines, cosines, vf00 |
| 157 | + mul_vec_mat_33 color, light_colors, cosines |
| 158 | + add.xyz color, color, constant_color |
| 159 | + miniw.xyz color, color, gs_offsets[w] |
| 160 | + store_rgba color |
161 | 161 |
|
162 | | - ; texture coords |
| 162 | + ; texture coords |
163 | 163 |
|
164 | | - load_stq tex_stq |
165 | | - xform_tex_stq tex_stq, tex_stq, q ; q is from normalize_3 |
166 | | - store_stq tex_stq |
| 164 | + load_stq tex_stq |
| 165 | + xform_tex_stq tex_stq, tex_stq, q ; q is from normalize_3 |
| 166 | + store_stq tex_stq |
167 | 167 |
|
168 | | - next_io |
169 | | - loop_io xform_loop_lid |
| 168 | + next_io |
| 169 | + loop_io xform_loop_lid |
170 | 170 |
|
171 | | - ; -------------------- done! ------------------------------- |
| 171 | + ; -------------------- done! ------------------------------- |
172 | 172 |
|
173 | | -done_lid: |
| 173 | +done_lid: |
174 | 174 |
|
175 | | - ; ---------------- kick packet to GS ----------------------- |
| 175 | + ; ---------------- kick packet to GS ----------------------- |
176 | 176 |
|
177 | | - kick_to_gs |
| 177 | + kick_to_gs |
178 | 178 |
|
179 | | - --cont |
180 | | - |
181 | | - b main_loop_lid |
| 179 | + --cont |
182 | 180 |
|
183 | | -.END ; for gasp |
| 181 | + b main_loop_lid |
| 182 | + |
| 183 | +.END ; for gasp |
0 commit comments