aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/driver__opengl__vertex__program_8cpp-source.html
blob: 8b484a809aa76bdb5a240ea756c07224a1a3a928 (plain)
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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
	<TITLE>nevrax.org : docs</TITLE>
	<LINK REL=stylesheet TYPE="text/css" HREF="/inc/css/nevrax.css">
	<link href="doxygen.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY MARGINHEIGHT="0" MARGINWIDTH="0">

<!-- uplinks -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0>
 <TR>
        <TD WIDTH=16><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD WIDTH=140 BGCOLOR=#dddddd><IMG  SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD WIDTH=16><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD><IMG width=6 height=14 SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF='/'><b>Home</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
        <TD><IMG  width=6 height=14  SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF='/'><b>nevrax.com</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
 </TR>
</TABLE> 

<!-- banner Nevrax -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0 WIDTH=100%>
 <TR><TD  BGCOLOR="#000000" BACKGROUND="/inc/img/black_banner.jpg"><A HREF=""><IMG  SRC="/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR>
</TABLE>

<!-- main table -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0 height=100%>
 <TR>
	<TD WIDTH=16><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
	<TD WIDTH=140   BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG  SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">

		<!------ Begin Box ------>
		<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0  cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black>
		<FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td  colspan=2 bgcolor=#FFFFFF>
		<TABLE cellspacing=0 cellpadding=1 border=0>
			<tr><td ALIGN=middle><a  class='linkbox' href="/news/" TITLE="Rubrique news"><img width=13 height=15  hspace=5 border=0 src=/inc/img/picto-news.gif ALT=#></A></td><td><a  class='linkbox' href="/news/" TITLE="News">News</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/mail/" TITLE="Rubrique mail"><img width=15 height=11  hspace=5 border=0 src=/inc/img/picto-mail.gif ALT=#></A></td><td><a  class='linkbox' href="/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/docs/" TITLE="Rubrique docs"><img width=14 height=16  hspace=5 border=0 src=/inc/img/picto-docs.gif ALT=#></A></td><td><a  class='linkbox' href="/docs/" TITLE="Documentation">Documentation</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/cvs/" TITLE="Rubrique cvs"><img width=13 height=17  hspace=5 border=0 src=/inc/img/picto-cvs.gif ALT=#></A></td><td><a  class='linkbox' href="/cvs/" TITLE="CVS Web">CVS</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/bugs/" TITLE="Rubrique bugs"><img width=20 height=16  hspace=5 border=0 src=/inc/img/picto-bugs.gif ALT=#></A></td><td><a  class='linkbox' href="/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/GPL.php3" TITLE="Rubrique license"><img  width=18 height=12   hspace=5 border=0 src=/inc/img/picto-gpl.gif ALT=#></A></td><td><a  class='linkbox' href="/GPL.php3" TITLE="License">License</a></td></tr>
		</TABLE>
		</TD></TR></TABLE></TD></TR></TABLE>
		<!------ End Box  ------>

	</TD>
	<TD WIDTH=15><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
	<TD ALIGN=left valign=top><IMG  SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">

<!-- title -->
<TABLE  background="/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0  BORDER=0 width=100%><tr><td>
<A HREF="/docs/"><img src="/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A>
</td><td><IMG  SRC="/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT="">
</td></tr></table>
&nbsp;

<!-- block -->
<TABLE  bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0  BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="/inc/img/reddots.gif"></TD>
	<TD><B>Documentation</B></TD>
	<TD ALIGN=RIGHT>&nbsp;</td>
</tr></table>
<!-- Generated by Doxygen 1.2.14 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; <a class="qindexRef" doxygen="_cgi:/cgi-bin/nel-search.cgi" href="/cgi-bin/nel-search.cgi">Search</a> &nbsp; </center>
<hr><h1>driver_opengl_vertex_program.cpp</h1><a href="driver__opengl__vertex__program_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 
00009 <font class="comment">/* Copyright, 2000 Nevrax Ltd.</font>
00010 <font class="comment"> *</font>
00011 <font class="comment"> * This file is part of NEVRAX NEL.</font>
00012 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font>
00013 <font class="comment"> * it under the terms of the GNU General Public License as published by</font>
00014 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font>
00015 <font class="comment"> * any later version.</font>
00016 <font class="comment"></font>
00017 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font>
00018 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font>
00019 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
00020 <font class="comment"> * General Public License for more details.</font>
00021 <font class="comment"></font>
00022 <font class="comment"> * You should have received a copy of the GNU General Public License</font>
00023 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font>
00024 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font>
00025 <font class="comment"> * MA 02111-1307, USA.</font>
00026 <font class="comment"> */</font>
00027 
00028 <font class="preprocessor">#include "<a class="code" href="stdopengl_8h.html">stdopengl.h</a>"</font>
00029 
00030 <font class="preprocessor">#include "<a class="code" href="3d_2primitive__block_8h.html">3d/primitive_block.h</a>"</font>
00031 <font class="preprocessor">#include "<a class="code" href="vertex__program_8h.html">3d/vertex_program.h</a>"</font>
00032 <font class="preprocessor">#include "<a class="code" href="vertex__program__parse_8h.html">3d/vertex_program_parse.h</a>"</font>
00033 <font class="preprocessor">#include &lt;algorithm&gt;</font>
00034 
00035 
00036 <font class="keyword">using</font> <font class="keyword">namespace </font>std;
00037 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC;
00038 
00039  
00040 <font class="keyword">namespace </font>NL3D
00041 {
00042 
00043 <font class="comment">// ***************************************************************************</font>
<a name="l00044"></a><a class="code" href="classNL3D_1_1CVertexProgamDrvInfosGL.html#a0">00044</a> CVertexProgamDrvInfosGL::CVertexProgamDrvInfosGL (CDriverGL *drv, <a class="code" href="namespaceNL3D.html#a297">ItVtxPrgDrvInfoPtrList</a> it) : IVertexProgramDrvInfos (drv, it) 
00045 {
00046         <font class="comment">// Extension must exist</font>
00047         <a class="code" href="debug_8h.html#a6">nlassert</a> (drv-&gt;_Extensions.NVVertexProgram
00048                       || drv-&gt;_Extensions.EXTVertexShader
00049                      );
00050 
00051         <font class="keywordflow">if</font> (drv-&gt;_Extensions.NVVertexProgram) <font class="comment">// nvidia implemntation</font>
00052         {       
00053                 <font class="comment">// Generate a program</font>
00054                 <a class="code" href="driver__opengl__extension_8h.html#a57">nglGenProgramsNV</a> (1, &amp;<a class="code" href="classNL3D_1_1CVertexProgamDrvInfosGL.html#m0">ID</a>);
00055         }
00056         <font class="keywordflow">else</font>
00057         {
00058                 <a class="code" href="classNL3D_1_1CVertexProgamDrvInfosGL.html#m0">ID</a> = <a class="code" href="driver__opengl__extension_8h.html#a119">nglGenVertexShadersEXT</a>(1);
00059         }
00060 }
00061 
00062 
00063 <font class="comment">// ***************************************************************************</font>
<a name="l00064"></a><a class="code" href="classNL3D_1_1CDriverGL.html#z413_0">00064</a> <font class="keywordtype">bool</font> CDriverGL::isVertexProgramSupported ()<font class="keyword"> const</font>
00065 <font class="keyword"></font>{       
00066         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.NVVertexProgram || <a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.EXTVertexShader;
00067 }
00068 
00069 <font class="comment">// ***************************************************************************</font>
<a name="l00070"></a><a class="code" href="classNL3D_1_1CDriverGL.html#z413_1">00070</a> <font class="keywordtype">bool</font> CDriverGL::isVertexProgramEmulated ()<font class="keyword"> const</font>
00071 <font class="keyword"></font>{
00072         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.NVVertexProgramEmulated;
00073 }
00074 
00075 
00076 
00077 <font class="comment">// ***************************************************************************</font>
<a name="l00078"></a><a class="code" href="classNL3D_1_1CDriverGL.html#z414_0">00078</a> <font class="keywordtype">bool</font> CDriverGL::activeNVVertexProgram (CVertexProgram *<a class="code" href="driver__opengl__extension__def_8h.html#a360">program</a>)
00079 {
00080         <font class="comment">// Setup or unsetup ?</font>
00081         <font class="keywordflow">if</font> (program)
00082         {
00083                 <font class="comment">// Enable vertex program</font>
00084                 glEnable (<a class="code" href="driver__opengl__extension__def_8h.html#a1">GL_VERTEX_PROGRAM_NV</a>);
00085                 <a class="code" href="classNL3D_1_1CDriverGL.html#o24">_VertexProgramEnabled</a>= <font class="keyword">true</font>;
00086 
00087 
00088                 <font class="comment">// Driver info</font>
00089                 <a class="code" href="classNL3D_1_1CDriverGL.html#l1">CVertexProgamDrvInfosGL</a> *drvInfo;
00090 
00091                 <font class="comment">// Program setuped ?</font>
00092                 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a360">program</a>-&gt;_DrvInfo==NULL)
00093                 {
00097                         <a class="code" href="classCVPParser.html">CVPParser</a> parser;
00098                         <a class="code" href="classCVPParser.html#s0">CVPParser::TProgram</a> parsedProgram;
00099                         std::string errorOutput;
00100                         <font class="keywordtype">bool</font> result = parser.<a class="code" href="classCVPParser.html#a0">parse</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a360">program</a>-&gt;getProgram().c_str(), parsedProgram, errorOutput);
00101                         <font class="keywordflow">if</font> (!result)
00102                         {
00103                                 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"Unable to parse a vertex program :"</font>);
00104                                 <a class="code" href="debug_8h.html#a2">nlwarning</a>(errorOutput.c_str());
00105 <font class="preprocessor">                                #ifdef NL_DEBUG</font>
00106 <font class="preprocessor"></font>                                        <a class="code" href="debug_8h.html#a6">nlassert</a>(0);
00107 <font class="preprocessor">                                #endif</font>
00108 <font class="preprocessor"></font>                                <font class="keywordflow">return</font> <font class="keyword">false</font>;
00109                         }
00110 
00111                         <font class="comment">// Insert into driver list. (so it is deleted when driver is deleted).</font>
00112                         <a class="code" href="namespaceNL3D.html#a297">ItVtxPrgDrvInfoPtrList</a>  it= <a class="code" href="classNL3D_1_1IDriver.html#n5">_VtxPrgDrvInfos</a>.insert(<a class="code" href="classNL3D_1_1IDriver.html#n5">_VtxPrgDrvInfos</a>.end());
00113 
00114                         <font class="comment">// Create a driver info</font>
00115                         *it = drvInfo = <font class="keyword">new</font> <a class="code" href="classNL3D_1_1CDriverGL.html#l1">CVertexProgamDrvInfosGL</a> (<font class="keyword">this</font>, it);
00116 
00117                         <font class="comment">// Set the pointer</font>
00118                         <a class="code" href="driver__opengl__extension__def_8h.html#a360">program</a>-&gt;_DrvInfo=drvInfo;                                              
00119 
00120                         <font class="comment">// Compile the program</font>
00121                         <a class="code" href="driver__opengl__extension_8h.html#a68">nglLoadProgramNV</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a1">GL_VERTEX_PROGRAM_NV</a>, drvInfo-&gt;ID, <a class="code" href="driver__opengl__extension__def_8h.html#a360">program</a>-&gt;getProgram().length(), (<font class="keyword">const</font> GLubyte*)<a class="code" href="driver__opengl__extension__def_8h.html#a360">program</a>-&gt;getProgram().c_str());
00122 
00123                         <font class="comment">// Get loading error code</font>
00124                         GLint errorOff;
00125                         glGetIntegerv (<a class="code" href="driver__opengl__extension__def_8h.html#a35">GL_PROGRAM_ERROR_POSITION_NV</a>, &amp;errorOff);
00126 
00127                         <font class="comment">// Compilation error ?</font>
00128                         <font class="keywordflow">if</font> (errorOff&gt;=0)
00129                         {
00130                                 <font class="comment">// String length</font>
00131                                 uint length = <a class="code" href="driver__opengl__extension__def_8h.html#a360">program</a>-&gt;getProgram ().length();
00132                                 <font class="keyword">const</font> <font class="keywordtype">char</font>* sString= <a class="code" href="driver__opengl__extension__def_8h.html#a360">program</a>-&gt;getProgram ().c_str();
00133 
00134                                 <font class="comment">// Line count and char count</font>
00135                                 uint line=1;
00136                                 uint charC=1;
00137 
00138                                 <font class="comment">// Find the line</font>
00139                                 uint <a class="code" href="driver__opengl__extension__def_8h.html#a378">offset</a>=0;
00140                                 <font class="keywordflow">while</font> ((<a class="code" href="driver__opengl__extension__def_8h.html#a378">offset</a>&lt;length)&amp;&amp;(<a class="code" href="driver__opengl__extension__def_8h.html#a378">offset</a>&lt;(uint)errorOff))
00141                                 {
00142                                         <font class="keywordflow">if</font> (sString[<a class="code" href="driver__opengl__extension__def_8h.html#a378">offset</a>]==<font class="charliteral">'\n'</font>)
00143                                         {
00144                                                 line++;
00145                                                 charC=1;
00146                                         }
00147                                         <font class="keywordflow">else</font>
00148                                                 charC++;
00149 
00150                                         <font class="comment">// Next character</font>
00151                                         <a class="code" href="driver__opengl__extension__def_8h.html#a378">offset</a>++;
00152                                 }
00153 
00154                                 <font class="comment">// Show the error</font>
00155                                 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"Vertex program syntax error line %d character %d\n"</font>, line, charC);
00156 
00157                                 <font class="comment">// Disable vertex program</font>
00158                                 glDisable (<a class="code" href="driver__opengl__extension__def_8h.html#a1">GL_VERTEX_PROGRAM_NV</a>);
00159                                 <a class="code" href="classNL3D_1_1CDriverGL.html#o24">_VertexProgramEnabled</a>= <font class="keyword">false</font>;
00160 
00161                                 <font class="comment">// Setup not ok</font>
00162                                 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00163                         }
00164 
00165                         <font class="comment">// Setup ok</font>
00166                         <font class="keywordflow">return</font> <font class="keyword">true</font>;
00167                 }
00168                 <font class="keywordflow">else</font>
00169                 {
00170                         <font class="comment">// Cast the driver info pointer</font>
00171                         drvInfo=safe_cast&lt;CVertexProgamDrvInfosGL*&gt;((<a class="code" href="classNL3D_1_1IDriver.html#l4">IVertexProgramDrvInfos</a>*)<a class="code" href="driver__opengl__extension__def_8h.html#a360">program</a>-&gt;_DrvInfo);
00172                 }
00173 
00174                 <font class="comment">// Setup this program</font>
00175                 <a class="code" href="driver__opengl__extension_8h.html#a54">nglBindProgramNV</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a1">GL_VERTEX_PROGRAM_NV</a>, drvInfo-&gt;ID);
00176                 <a class="code" href="classNL3D_1_1CDriverGL.html#o26">_LastSetuppedVP</a> = <a class="code" href="driver__opengl__extension__def_8h.html#a360">program</a>;
00177 
00178                 <font class="comment">// Ok</font>
00179                 <font class="keywordflow">return</font> <font class="keyword">true</font>;
00180         }
00181         <font class="keywordflow">else</font> <font class="comment">// Unsetup</font>
00182         {
00183                 <font class="comment">// Disable vertex program</font>
00184                 glDisable (<a class="code" href="driver__opengl__extension__def_8h.html#a1">GL_VERTEX_PROGRAM_NV</a>);
00185                 <a class="code" href="classNL3D_1_1CDriverGL.html#o24">_VertexProgramEnabled</a>= <font class="keyword">false</font>;
00186                 <font class="comment">// Ok</font>
00187                 <font class="keywordflow">return</font> <font class="keyword">true</font>;
00188         }
00189 }
00190 
00191 
00192 <font class="comment">// ***************************************************************************</font>
00193 <font class="keyword">static</font> 
00194 <font class="keyword">inline</font> GLenum <a class="code" href="namespaceNL3D.html#a355">convSwizzleToGLFormat</a>(<a class="code" href="structCVPSwizzle.html#s4">CVPSwizzle::EComp</a> comp, <font class="keywordtype">bool</font> negate)
00195 {
00196         <font class="keywordflow">if</font> (!negate)
00197         {
00198                 <font class="keywordflow">switch</font>(comp)
00199                 {
00200                         <font class="keywordflow">case</font> <a class="code" href="structCVPSwizzle.html#s4s0">CVPSwizzle::X</a>: <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a316">GL_X_EXT</a>;
00201                         <font class="keywordflow">case</font> <a class="code" href="structCVPSwizzle.html#s4s1">CVPSwizzle::Y</a>: <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a317">GL_Y_EXT</a>;
00202                         <font class="keywordflow">case</font> <a class="code" href="structCVPSwizzle.html#s4s2">CVPSwizzle::Z</a>: <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a318">GL_Z_EXT</a>;
00203                         <font class="keywordflow">case</font> <a class="code" href="structCVPSwizzle.html#s4s3">CVPSwizzle::W</a>: <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a319">GL_W_EXT</a>;
00204                         <font class="keywordflow">default</font>:
00205                                 <a class="code" href="debug_8h.html#a12">nlstop</a>;
00206                                 <font class="keywordflow">return</font> 0;
00207                         <font class="keywordflow">break</font>;
00208                 }
00209         }
00210         <font class="keywordflow">else</font>
00211         {
00212                 <font class="keywordflow">switch</font>(comp)
00213                 {
00214                         <font class="keywordflow">case</font> <a class="code" href="structCVPSwizzle.html#s4s0">CVPSwizzle::X</a>: <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a320">GL_NEGATIVE_X_EXT</a>;
00215                         <font class="keywordflow">case</font> <a class="code" href="structCVPSwizzle.html#s4s1">CVPSwizzle::Y</a>: <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a321">GL_NEGATIVE_Y_EXT</a>;
00216                         <font class="keywordflow">case</font> <a class="code" href="structCVPSwizzle.html#s4s2">CVPSwizzle::Z</a>: <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a322">GL_NEGATIVE_Z_EXT</a>;
00217                         <font class="keywordflow">case</font> <a class="code" href="structCVPSwizzle.html#s4s3">CVPSwizzle::W</a>: <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a323">GL_NEGATIVE_W_EXT</a>;
00218                         <font class="keywordflow">default</font>:
00219                                 <a class="code" href="debug_8h.html#a12">nlstop</a>;
00220                                 <font class="keywordflow">return</font> 0;
00221                         <font class="keywordflow">break</font>;
00222                 }
00223         }
00224 }
00225 
00226 <font class="comment">// ***************************************************************************</font>
00229 <font class="comment"></font><font class="keyword">static</font> <a class="code" href="driver__opengl__extension__def_8h.html#a423">GLuint</a> <a class="code" href="namespaceNL3D.html#a356">convOutputRegisterToEXTVertexShader</a>(<a class="code" href="structCVPOperand.html#s42">CVPOperand::EOutputRegister</a> <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>)
00230 {
00231         <font class="keywordflow">switch</font> (r)
00232         {
00233                 <font class="keywordflow">case</font>    <a class="code" href="structCVPOperand.html#s42s24">CVPOperand::OHPosition</a>:                 <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a256">GL_OUTPUT_VERTEX_EXT</a>;
00234                 <font class="keywordflow">case</font>    <a class="code" href="structCVPOperand.html#s42s25">CVPOperand::OPrimaryColor</a>:              <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a257">GL_OUTPUT_COLOR0_EXT</a>;
00235                 <font class="keywordflow">case</font>    <a class="code" href="structCVPOperand.html#s42s26">CVPOperand::OSecondaryColor</a>:    <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a258">GL_OUTPUT_COLOR1_EXT</a>;
00236                 <font class="keywordflow">case</font>    <a class="code" href="structCVPOperand.html#s42s27">CVPOperand::OBackFacePrimaryColor</a>:
00237                         <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"Backface color used in a vertex program is not supported by device, defaulting to front color"</font>);
00238                         <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a257">GL_OUTPUT_COLOR0_EXT</a>;
00239                 <font class="keywordflow">break</font>;
00240                 <font class="keywordflow">case</font>    <a class="code" href="structCVPOperand.html#s42s28">CVPOperand::OBackFaceSecondaryColor</a>:
00241                         <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"Backface color used in a vertex program is not supported by device, defaulting to front color"</font>);
00242                         <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a258">GL_OUTPUT_COLOR1_EXT</a>;
00243                 <font class="keywordflow">break</font>;
00244                 <font class="keywordflow">case</font>    <a class="code" href="structCVPOperand.html#s42s29">CVPOperand::OFogCoord</a>:                  <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a291">GL_OUTPUT_FOG_EXT</a>;
00245                 <font class="keywordflow">case</font>    <a class="code" href="structCVPOperand.html#s42s30">CVPOperand::OPointSize</a>:                 <a class="code" href="debug_8h.html#a12">nlstop</a>; <font class="keywordflow">return</font> 0; <font class="comment">// sorry, not supported</font>
00246                 <font class="keywordflow">case</font>    <a class="code" href="structCVPOperand.html#s42s31">CVPOperand::OTex0</a>:                              <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a259">GL_OUTPUT_TEXTURE_COORD0_EXT</a>;
00247                 <font class="keywordflow">case</font>    <a class="code" href="structCVPOperand.html#s42s32">CVPOperand::OTex1</a>:                              <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a260">GL_OUTPUT_TEXTURE_COORD1_EXT</a>;
00248                 <font class="keywordflow">case</font>    <a class="code" href="structCVPOperand.html#s42s33">CVPOperand::OTex2</a>:                              <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a261">GL_OUTPUT_TEXTURE_COORD2_EXT</a>;
00249                 <font class="keywordflow">case</font>    <a class="code" href="structCVPOperand.html#s42s34">CVPOperand::OTex3</a>:                              <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a262">GL_OUTPUT_TEXTURE_COORD3_EXT</a>;
00250                 <font class="keywordflow">case</font>    <a class="code" href="structCVPOperand.html#s42s35">CVPOperand::OTex4</a>:                              <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a263">GL_OUTPUT_TEXTURE_COORD4_EXT</a>;
00251                 <font class="keywordflow">case</font>    <a class="code" href="structCVPOperand.html#s42s36">CVPOperand::OTex5</a>:                              <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a264">GL_OUTPUT_TEXTURE_COORD5_EXT</a>;
00252                 <font class="keywordflow">case</font>    <a class="code" href="structCVPOperand.html#s42s37">CVPOperand::OTex6</a>:                              <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a265">GL_OUTPUT_TEXTURE_COORD6_EXT</a>;
00253                 <font class="keywordflow">case</font>    <a class="code" href="structCVPOperand.html#s42s38">CVPOperand::OTex7</a>:                              <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a266">GL_OUTPUT_TEXTURE_COORD7_EXT</a>;
00254                 <font class="keywordflow">default</font>:
00255                         <a class="code" href="debug_8h.html#a12">nlstop</a>;
00256                 <font class="keywordflow">break</font>;
00257         }
00258         <font class="keywordflow">return</font> 0;
00259 }
00260 
00261 <font class="comment">// ***************************************************************************</font>
00264 <font class="comment"></font><font class="keyword">static</font> uint <a class="code" href="namespaceNL3D.html#a357">convInputRegisterToVBFlag</a>(uint <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)
00265 {
00266         <font class="keywordflow">switch</font> (index)
00267         {       
00268                 <font class="keywordflow">case</font> <a class="code" href="structCVPOperand.html#s41s6">CVPOperand::IPosition</a>:                             <font class="keywordflow">return</font> CVertexBuffer::PositionFlag;
00269                 <font class="keywordflow">case</font> <a class="code" href="structCVPOperand.html#s41s7">CVPOperand::IWeight</a>:                               <font class="keywordflow">return</font> CVertexBuffer::WeightFlag;
00270                 <font class="keywordflow">case</font> <a class="code" href="structCVPOperand.html#s41s8">CVPOperand::INormal</a>:                               <font class="keywordflow">return</font> CVertexBuffer::NormalFlag;
00271                 <font class="keywordflow">case</font> <a class="code" href="structCVPOperand.html#s41s9">CVPOperand::IPrimaryColor</a>:                 <font class="keywordflow">return</font> CVertexBuffer::PrimaryColorFlag;
00272                 <font class="keywordflow">case</font> <a class="code" href="structCVPOperand.html#s41s10">CVPOperand::ISecondaryColor</a>:               <font class="keywordflow">return</font> CVertexBuffer::SecondaryColorFlag;
00273                 <font class="keywordflow">case</font> <a class="code" href="structCVPOperand.html#s41s11">CVPOperand::IFogCoord</a>:                             <font class="keywordflow">return</font> CVertexBuffer::FogFlag;
00274                 <font class="keywordflow">case</font> <a class="code" href="structCVPOperand.html#s41s12">CVPOperand::IPaletteSkin</a>:                  <font class="keywordflow">return</font> CVertexBuffer::PaletteSkinFlag;
00275                 <font class="keywordflow">case</font> <a class="code" href="structCVPOperand.html#s41s13">CVPOperand::IEmpty</a>: <a class="code" href="debug_8h.html#a6">nlassert</a>(0); <font class="keywordflow">break</font>;
00276                 <font class="keywordflow">case</font> <a class="code" href="structCVPOperand.html#s41s14">CVPOperand::ITex0</a>:
00277                 <font class="keywordflow">case</font> <a class="code" href="structCVPOperand.html#s41s15">CVPOperand::ITex1</a>: 
00278                 <font class="keywordflow">case</font> <a class="code" href="structCVPOperand.html#s41s16">CVPOperand::ITex2</a>:
00279                 <font class="keywordflow">case</font> <a class="code" href="structCVPOperand.html#s41s17">CVPOperand::ITex3</a>:
00280                 <font class="keywordflow">case</font> <a class="code" href="structCVPOperand.html#s41s18">CVPOperand::ITex4</a>:
00281                 <font class="keywordflow">case</font> <a class="code" href="structCVPOperand.html#s41s19">CVPOperand::ITex5</a>:
00282                 <font class="keywordflow">case</font> <a class="code" href="structCVPOperand.html#s41s20">CVPOperand::ITex6</a>:
00283                 <font class="keywordflow">case</font> <a class="code" href="structCVPOperand.html#s41s21">CVPOperand::ITex7</a>:
00284                 <font class="keywordflow">case</font> <a class="code" href="structCVPOperand.html#s41s22">CVPOperand::ITex8</a>:
00285                         <font class="keywordflow">return</font> CVertexBuffer::TexCoord0Flag &lt;&lt; (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> - <a class="code" href="structCVPOperand.html#s41s14">CVPOperand::ITex0</a>);
00286                 <font class="keywordflow">default</font>:
00287                         <a class="code" href="debug_8h.html#a6">nlassert</a>(0);
00288                 <font class="keywordflow">break</font>;
00289         }
00290         <font class="keywordflow">return</font> 0;
00291 }
00292 
00293 
00294 
00295 <font class="comment">// A macro to debug the generated instruction</font>
<a name="l00296"></a><a class="code" href="driver__opengl__vertex__program_8cpp.html#a0">00296</a> <font class="preprocessor">#define DEBUG_SETUP_EXT_VERTEX_SHADER</font>
00297 <font class="preprocessor"></font>
00298 <font class="preprocessor">#ifdef DEBUG_SETUP_EXT_VERTEX_SHADER</font>
<a name="l00299"></a><a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">00299</a> <font class="preprocessor"></font><font class="preprocessor">        #define EVS_INFO(what) nlinfo(what)</font>
00300 <font class="preprocessor"></font><font class="preprocessor">#else</font>
00301 <font class="preprocessor"></font><font class="preprocessor">        #define EVS_INFO(what)</font>
00302 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
00303 <font class="preprocessor"></font>
00304 
00305 <font class="comment">// For debugging with swizzling</font>
00306 <font class="keyword">static</font> <font class="keywordtype">void</font> <a class="code" href="namespaceNL3D.html#a358">doSwizzle</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a423">GLuint</a> <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a423">GLuint</a> <a class="code" href="driver__opengl__extension__def_8h.html#a404">in</a>, GLenum <a class="code" href="driver__opengl__extension__def_8h.html#a405">outX</a>, GLenum <a class="code" href="driver__opengl__extension__def_8h.html#a406">outY</a>, GLenum <a class="code" href="driver__opengl__extension__def_8h.html#a407">outZ</a>, GLenum <a class="code" href="driver__opengl__extension__def_8h.html#a408">outW</a>)
00307 {
00308         <a class="code" href="driver__opengl__extension_8h.html#a124">nglSwizzleEXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a404">in</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a405">outX</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a406">outY</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a407">outZ</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a408">outW</a>);
00309 <font class="preprocessor">#ifdef DEBUG_SETUP_EXT_VERTEX_SHADER</font>
00310 <font class="preprocessor"></font>        std::string swzStr = <font class="stringliteral">"Swizzle : "</font>;
00311         GLenum swz[] = { <a class="code" href="driver__opengl__extension__def_8h.html#a405">outX</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a406">outY</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a407">outZ</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a408">outW</a> };              
00312         <font class="keywordflow">for</font>(uint k = 0; k &lt; 4; ++k)
00313         {
00314                 <font class="keywordflow">switch</font>(swz[k])
00315                 {
00316                         <font class="keywordflow">case</font> <a class="code" href="driver__opengl__extension__def_8h.html#a316">GL_X_EXT</a>:
00317                                 swzStr +=<font class="stringliteral">" X"</font>;
00318                         <font class="keywordflow">break</font>;
00319                         <font class="keywordflow">case</font> <a class="code" href="driver__opengl__extension__def_8h.html#a320">GL_NEGATIVE_X_EXT</a>:
00320                                 swzStr +=<font class="stringliteral">" -X"</font>;
00321                         <font class="keywordflow">break</font>;
00322                         <font class="keywordflow">case</font> <a class="code" href="driver__opengl__extension__def_8h.html#a317">GL_Y_EXT</a>:
00323                                 swzStr +=<font class="stringliteral">" Y"</font>;
00324                         <font class="keywordflow">break</font>;
00325                         <font class="keywordflow">case</font> <a class="code" href="driver__opengl__extension__def_8h.html#a321">GL_NEGATIVE_Y_EXT</a>:
00326                                 swzStr +=<font class="stringliteral">" -Y"</font>;
00327                         <font class="keywordflow">break</font>;
00328                         <font class="keywordflow">break</font>;
00329                         <font class="keywordflow">case</font> <a class="code" href="driver__opengl__extension__def_8h.html#a318">GL_Z_EXT</a>:
00330                                 swzStr +=<font class="stringliteral">" Z"</font>;
00331                         <font class="keywordflow">break</font>;
00332                         <font class="keywordflow">case</font> <a class="code" href="driver__opengl__extension__def_8h.html#a322">GL_NEGATIVE_Z_EXT</a>:
00333                                 swzStr +=<font class="stringliteral">" -Z"</font>;
00334                         <font class="keywordflow">break</font>;
00335                         <font class="keywordflow">case</font> <a class="code" href="driver__opengl__extension__def_8h.html#a319">GL_W_EXT</a>:
00336                                 swzStr +=<font class="stringliteral">" W"</font>;
00337                         <font class="keywordflow">break</font>;
00338                         <font class="keywordflow">case</font> <a class="code" href="driver__opengl__extension__def_8h.html#a323">GL_NEGATIVE_W_EXT</a>:
00339                                 swzStr +=<font class="stringliteral">" -W"</font>;
00340                         <font class="keywordflow">break</font>;
00341                         <font class="keywordflow">case</font> <a class="code" href="driver__opengl__extension__def_8h.html#a324">GL_ZERO_EXT</a>:
00342                                 swzStr +=<font class="stringliteral">"0"</font>;
00343                         <font class="keywordflow">break</font>;
00344                         <font class="keywordflow">case</font> <a class="code" href="driver__opengl__extension__def_8h.html#a325">GL_ONE_EXT</a>:
00345                                 swzStr +=<font class="stringliteral">"1"</font>;
00346                         <font class="keywordflow">break</font>;
00347                 }
00348         }
00349         <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(swzStr.c_str());
00350 <font class="preprocessor">#endif</font>
00351 <font class="preprocessor"></font>
00352 }
00353 
00354 <font class="comment">// Perform write mask and output de bug informations</font>
00355 <font class="keyword">static</font> <font class="keywordtype">void</font> <a class="code" href="namespaceNL3D.html#a359">doWriteMask</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a423">GLuint</a> <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a423">GLuint</a> <a class="code" href="driver__opengl__extension__def_8h.html#a404">in</a>, GLenum <a class="code" href="driver__opengl__extension__def_8h.html#a405">outX</a>, GLenum <a class="code" href="driver__opengl__extension__def_8h.html#a406">outY</a>, GLenum <a class="code" href="driver__opengl__extension__def_8h.html#a407">outZ</a>, GLenum <a class="code" href="driver__opengl__extension__def_8h.html#a408">outW</a>)
00356 {
00357         <a class="code" href="driver__opengl__extension_8h.html#a125">nglWriteMaskEXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a404">in</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a405">outX</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a406">outY</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a407">outZ</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a408">outW</a>);
00358 <font class="preprocessor">        #ifdef DEBUG_SETUP_EXT_VERTEX_SHADER</font>
00359 <font class="preprocessor"></font>        <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"Write Mask : %c%c%c%c"</font>,
00360                    <a class="code" href="driver__opengl__extension__def_8h.html#a405">outX</a> ? <font class="charliteral">'x'</font> : <font class="charliteral">'-'</font>,
00361                    <a class="code" href="driver__opengl__extension__def_8h.html#a406">outY</a> ? <font class="charliteral">'y'</font> : <font class="charliteral">'-'</font>,
00362                    <a class="code" href="driver__opengl__extension__def_8h.html#a407">outZ</a> ? <font class="charliteral">'z'</font> : <font class="charliteral">'-'</font>,
00363                    <a class="code" href="driver__opengl__extension__def_8h.html#a408">outW</a> ? <font class="charliteral">'w'</font> : <font class="charliteral">'-'</font>                
00364                   );
00365 <font class="preprocessor">        #endif</font>
00366 <font class="preprocessor"></font>}
00367 
00368 <font class="comment">// ***************************************************************************</font>
<a name="l00371"></a><a class="code" href="classNL3D_1_1CDriverGL.html#z417_1">00371</a> <font class="comment"></font><font class="keywordtype">bool</font> CDriverGL::setupEXTVertexShader(<font class="keyword">const</font> <a class="code" href="classCVPParser.html#s0">CVPParser::TProgram</a> &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a360">program</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a423">GLuint</a> <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>, uint variants[EVSNumVariants], uint16 &amp;usedInputRegisters)
00372 {
00373         <font class="comment">// counter to see what is generated</font>
00374         uint numOp = 0;
00375         uint numOpIndex = 0;
00376         uint numSwizzle = 0;
00377         uint numEC = 0; <font class="comment">// extract component</font>
00378         uint numIC = 0; <font class="comment">// insert component</font>
00379         uint numWM = 0; <font class="comment">// write maks</font>
00380 
00381         
00382 <font class="preprocessor">        #ifdef DEBUG_SETUP_EXT_VERTEX_SHADER</font>
00383 <font class="preprocessor"></font>                <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"**********************************************************"</font>);
00384 <font class="preprocessor">        #endif</font>
00385 <font class="preprocessor"></font>
00386         <font class="comment">// clear last error</font>
00387         GLenum glError = glGetError();
00388 
00389         <font class="comment">// allocate the symbols</font>
00390         <a class="code" href="driver__opengl__extension_8h.html#a118">nglBindVertexShaderEXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>);
00391         <a class="code" href="driver__opengl__extension_8h.html#a116">nglBeginVertexShaderEXT</a>();
00392         {                               
00393                 <font class="comment">// Allocate register and variant</font>
00394                 <a class="code" href="driver__opengl__extension__def_8h.html#a423">GLuint</a> firstRegister = <a class="code" href="driver__opengl__extension_8h.html#a128">nglGenSymbolsEXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a293">GL_VECTOR_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a298">GL_LOCAL_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a328">GL_FULL_RANGE_EXT</a>, 12); <font class="comment">// 12 register</font>
00395                 <a class="code" href="driver__opengl__extension__def_8h.html#a423">GLuint</a> firstTempRegister = <a class="code" href="driver__opengl__extension_8h.html#a128">nglGenSymbolsEXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a293">GL_VECTOR_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a298">GL_LOCAL_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a328">GL_FULL_RANGE_EXT</a>, 4); <font class="comment">// 4  temp register used for swizzle &amp; indexing</font>
00396                 <a class="code" href="driver__opengl__extension__def_8h.html#a423">GLuint</a> firstTempScalar = <a class="code" href="driver__opengl__extension_8h.html#a128">nglGenSymbolsEXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a292">GL_SCALAR_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a298">GL_LOCAL_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a328">GL_FULL_RANGE_EXT</a>, 3); <font class="comment">// 3  temp scalars used for EXPP &amp; LOGG emulation</font>
00397                 <a class="code" href="driver__opengl__extension__def_8h.html#a423">GLuint</a> firstAddressRegister = <a class="code" href="driver__opengl__extension_8h.html#a128">nglGenSymbolsEXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a292">GL_SCALAR_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a298">GL_LOCAL_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a328">GL_FULL_RANGE_EXT</a>, 1);
00398 
00399                 <font class="comment">// allocate variants</font>
00400                 variants[<a class="code" href="classNL3D_1_1CDriverGL.html#z417_0s1">EVSSecondaryColorVariant</a>] = <a class="code" href="driver__opengl__extension_8h.html#a128">nglGenSymbolsEXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a293">GL_VECTOR_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a295">GL_VARIANT_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a327">GL_NORMALIZED_RANGE_EXT</a>, 1);
00401                 variants[<a class="code" href="classNL3D_1_1CDriverGL.html#z417_0s2">EVSFogCoordsVariant</a>] = <a class="code" href="driver__opengl__extension_8h.html#a128">nglGenSymbolsEXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a293">GL_VECTOR_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a295">GL_VARIANT_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a328">GL_FULL_RANGE_EXT</a>, 1);
00402                 variants[<a class="code" href="classNL3D_1_1CDriverGL.html#z417_0s3">EVSSkinWeightVariant</a>] = <a class="code" href="driver__opengl__extension_8h.html#a128">nglGenSymbolsEXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a293">GL_VECTOR_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a295">GL_VARIANT_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a327">GL_NORMALIZED_RANGE_EXT</a>, 1);
00403                 variants[<a class="code" href="classNL3D_1_1CDriverGL.html#z417_0s4">EVSPaletteSkinVariant</a>] = <a class="code" href="driver__opengl__extension_8h.html#a128">nglGenSymbolsEXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a293">GL_VECTOR_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a295">GL_VARIANT_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a328">GL_FULL_RANGE_EXT</a>, 1);
00404 
00405                 <font class="comment">// allocate one temporary register for fog before conversion</font>
00406                 <a class="code" href="driver__opengl__extension__def_8h.html#a423">GLuint</a> fogTemp = <a class="code" href="driver__opengl__extension_8h.html#a128">nglGenSymbolsEXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a293">GL_VECTOR_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a298">GL_LOCAL_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a328">GL_FULL_RANGE_EXT</a>, 1);
00407 
00408 
00409                 <font class="comment">// local constant : 0 and 1</font>
00410                 <a class="code" href="driver__opengl__extension__def_8h.html#a423">GLuint</a> cteOne = <a class="code" href="driver__opengl__extension_8h.html#a128">nglGenSymbolsEXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a292">GL_SCALAR_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a297">GL_LOCAL_CONSTANT_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a328">GL_FULL_RANGE_EXT</a>, 1);
00411                 <a class="code" href="driver__opengl__extension__def_8h.html#a423">GLuint</a> cteZero = <a class="code" href="driver__opengl__extension_8h.html#a128">nglGenSymbolsEXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a292">GL_SCALAR_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a297">GL_LOCAL_CONSTANT_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a328">GL_FULL_RANGE_EXT</a>, 1);
00412 
00413 
00414                 <font class="keywordtype">float</font> oneValue = 1.f;
00415                 <font class="keywordtype">float</font> zeroValue = 0.f;
00416 
00417                 <a class="code" href="driver__opengl__extension_8h.html#a130">nglSetLocalConstantEXT</a>( cteOne, GL_FLOAT, &amp;oneValue);
00418                 <a class="code" href="driver__opengl__extension_8h.html#a130">nglSetLocalConstantEXT</a>( cteZero, GL_FLOAT, &amp;zeroValue);
00419 
00420 
00421                 
00422                 <font class="keywordflow">if</font> (firstRegister == 0)
00423                 {
00424                         <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"Unable to allocate local registers for EXT_vertex_shader"</font>);
00425                         <font class="keywordflow">return</font> <font class="keyword">false</font>;
00426                 }
00427                 <font class="keywordflow">if</font> (firstTempRegister == 0)
00428                 {
00429                         <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"Unable to allocate local temp registers for EXT_vertex_shader"</font>);
00430                         <font class="keywordflow">return</font> <font class="keyword">false</font>;
00431                 }
00432                 <font class="keywordflow">if</font> (firstTempScalar == 0)
00433                 {
00434                         <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"Unable to allocate temp scalar registers for EXT_vertex_shader"</font>);
00435                         <font class="keywordflow">return</font> <font class="keyword">false</font>;
00436                 }
00437                 <font class="keywordflow">if</font> (firstAddressRegister == 0)
00438                 {
00439                         <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"Unable to allocate address register for EXT_vertex_shader"</font>);
00440                         <font class="keywordflow">return</font> <font class="keyword">false</font>;
00441                 }
00442 
00443                 uint k;
00444                 <font class="keywordflow">for</font>(k = 0; k &lt; <a class="code" href="classNL3D_1_1CDriverGL.html#z417_0s5">EVSNumVariants</a>; ++k)
00445                 {
00446                         <font class="keywordflow">if</font> (variants[k] == 0)
00447                         {
00448                                 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"Unable to allocate variants for EXT_vertex_shader"</font>);
00449                                 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00450                         }
00451                 }
00452 
00453                 <font class="comment">// Mask of output component that are being written</font>
00454                 uint componentWritten[16];
00455                 std::fill(componentWritten, componentWritten + 16, 0);
00456                 
00457                 <font class="comment">//</font>
00458                 <a class="code" href="driver__opengl__extension__def_8h.html#a423">GLuint</a> srcValue[3];
00459                 <font class="comment">//</font>
00460                 <a class="code" href="driver__opengl__extension__def_8h.html#a423">GLuint</a> destValue;
00461                 <a class="code" href="driver__opengl__extension__def_8h.html#a423">GLuint</a> maskedDestValue;
00462                 
00463 
00464                 uint <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>;
00465                 <font class="comment">// convert each instruction of the vertex program</font>
00466                 <font class="keywordflow">for</font>(k = 0; k &lt; <a class="code" href="driver__opengl__extension__def_8h.html#a360">program</a>.size(); ++k)
00467                 {
00468                         <font class="comment">// get src values, eventually applying swizzle, negate, and index on them</font>
00469                         uint numSrc = <a class="code" href="driver__opengl__extension__def_8h.html#a360">program</a>[k].getNumUsedSrc();
00470                         <font class="keywordflow">for</font>(<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> = 0; <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> &lt; numSrc; ++<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>)
00471                         {
00472                                 <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>((<font class="stringliteral">"Build source "</font> + toString(<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>)).c_str());
00473                                 <font class="keyword">const</font> <a class="code" href="structCVPOperand.html">CVPOperand</a> &amp;operand = <a class="code" href="driver__opengl__extension__def_8h.html#a360">program</a>[k].getSrc(<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>);
00474                                 <font class="keywordflow">switch</font> (operand.<a class="code" href="structCVPOperand.html#m0">Type</a>)
00475                                 {
00476                                         <font class="keywordflow">case</font> <a class="code" href="structCVPOperand.html#s40s2">CVPOperand::InputRegister</a>: 
00477                                         {
00478                                                 <font class="keywordflow">switch</font>(operand.<a class="code" href="structCVPOperand.html#m5">Value</a>.InputRegisterValue)
00479                                                 {
00480                                                         <font class="keywordflow">case</font>  0: srcValue[<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>] = <a class="code" href="classNL3D_1_1CDriverGL.html#z417_2">_EVSPositionHandle</a>; <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"Src = position"</font>); <font class="keywordflow">break</font>;
00481                                                         <font class="keywordflow">case</font>  1: srcValue[<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>] = variants[<a class="code" href="classNL3D_1_1CDriverGL.html#z417_0s3">EVSSkinWeightVariant</a>]; <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"Src = skin weight"</font>); <font class="keywordflow">break</font>;
00482                                                         <font class="keywordflow">case</font>  2: srcValue[<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>] = <a class="code" href="classNL3D_1_1CDriverGL.html#z417_3">_EVSNormalHandle</a>; <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"Src = normal"</font>); <font class="keywordflow">break</font>;
00483                                                         <font class="keywordflow">case</font>  3: srcValue[<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>] = <a class="code" href="classNL3D_1_1CDriverGL.html#z417_4">_EVSColorHandle</a>; <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"Src = color 0"</font>); <font class="keywordflow">break</font>;
00484                                                         <font class="keywordflow">case</font>  4: srcValue[<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>] = variants[<a class="code" href="classNL3D_1_1CDriverGL.html#z417_0s1">EVSSecondaryColorVariant</a>]; <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"Src = color 1"</font>); <font class="keywordflow">break</font>;
00485                                                         <font class="keywordflow">case</font>  5: srcValue[<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>] = variants[<a class="code" href="classNL3D_1_1CDriverGL.html#z417_0s2">EVSFogCoordsVariant</a>]; <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"Src = fog coord"</font>); <font class="keywordflow">break</font>;
00486                                                         <font class="keywordflow">case</font>  6: srcValue[<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>] = variants[<a class="code" href="classNL3D_1_1CDriverGL.html#z417_0s4">EVSPaletteSkinVariant</a>]; <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"Src = palette skin"</font>); <font class="keywordflow">break</font>;
00487                                                         <font class="keywordflow">case</font>  7: <a class="code" href="debug_8h.html#a12">nlstop</a>; <font class="comment">// not supported</font>
00488                                                         <font class="keywordflow">case</font>  8:
00489                                                         <font class="keywordflow">case</font>  9:
00490                                                         <font class="keywordflow">case</font>  10:
00491                                                         <font class="keywordflow">case</font>  11:
00492                                                         <font class="keywordflow">case</font>  12:
00493                                                         <font class="keywordflow">case</font>  13:
00494                                                         <font class="keywordflow">case</font>  14:
00495                                                         <font class="keywordflow">case</font>  15:
00496                                                         {                                                               
00497                                                                 <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>((<font class="stringliteral">"Src = Tex"</font> + toString(operand.<a class="code" href="structCVPOperand.html#m5">Value</a>.InputRegisterValue - 8)).c_str());
00498                                                                 srcValue[<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>] = <a class="code" href="classNL3D_1_1CDriverGL.html#z417_5">_EVSTexHandle</a>[operand.<a class="code" href="structCVPOperand.html#m5">Value</a>.InputRegisterValue - 8];
00499                                                                 <font class="keywordflow">if</font> (srcValue[<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>] == 0)
00500                                                                 {                                                               
00501                                                                         <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"Trying to read an unaccessible texture coords for the device when using EXT_vertex_shader, shader loading failed"</font>);
00502                                                                         <font class="keywordflow">return</font> <font class="keyword">false</font>;
00503                                                                 }
00504                                                         }
00505                                                         <font class="keywordflow">break</font>;
00506                                                         <font class="keywordflow">default</font>:
00507                                                                 <a class="code" href="debug_8h.html#a12">nlstop</a>; <font class="comment">// invalid value</font>
00508                                                         <font class="keywordflow">break</font>;
00509                                                 }
00510                                         }
00511                                         <font class="keywordflow">break</font>;
00512                                         <font class="keywordflow">case</font> <a class="code" href="structCVPOperand.html#s40s1">CVPOperand::Constant</a>: 
00513                                                 srcValue[<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>] = <a class="code" href="classNL3D_1_1CDriverGL.html#z417_6">_EVSConstantHandle</a> + operand.<a class="code" href="structCVPOperand.html#m5">Value</a>.ConstantValue; 
00514                                                 <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>((<font class="stringliteral">"Src = constant"</font> + toString(operand.<a class="code" href="structCVPOperand.html#m5">Value</a>.ConstantValue)).c_str());
00515                                         <font class="keywordflow">break</font>;
00516                                         <font class="keywordflow">case</font> <a class="code" href="structCVPOperand.html#s40s0">CVPOperand::Variable</a>: 
00517                                                 srcValue[<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>] = firstRegister + operand.<a class="code" href="structCVPOperand.html#m5">Value</a>.VariableValue;
00518                                                 <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>((<font class="stringliteral">"Src = variable register"</font> + toString(operand.<a class="code" href="structCVPOperand.html#m5">Value</a>.VariableValue)).c_str());
00519                                         <font class="keywordflow">break</font>;
00520                                         <font class="keywordflow">default</font>:
00521                                                 <a class="code" href="debug_8h.html#a6">nlassert</a>(0);
00522                                         <font class="keywordflow">break</font>;
00523                                 }
00524                                 <font class="comment">// test if indexed access is used (can be used on one register only)</font>
00525                                 <font class="keywordflow">if</font> (operand.<a class="code" href="structCVPOperand.html#m0">Type</a> == <a class="code" href="structCVPOperand.html#s40s1">CVPOperand::Constant</a> &amp;&amp; operand.<a class="code" href="structCVPOperand.html#m6">Indexed</a>)
00526                                 {
00527                                         <a class="code" href="driver__opengl__extension_8h.html#a122">nglShaderOp2EXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a232">GL_OP_INDEX_EXT</a>, firstTempRegister + 3, firstAddressRegister, srcValue[<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>]);
00528                                         <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"GL_OP_INDEX_EXT"</font>);
00529                                         ++ numOpIndex;
00530                                         srcValue[<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>] = firstTempRegister + 3;
00531                                         glError = glGetError();
00532                                         <a class="code" href="debug_8h.html#a6">nlassert</a>(glError == GL_NO_ERROR)
00533                                 }
00534 
00535                                 <font class="comment">// test if swizzle or negate is used</font>
00536                                 <font class="keywordflow">if</font> (!operand.<a class="code" href="structCVPOperand.html#m9">Swizzle</a>.<a class="code" href="structCVPSwizzle.html#a1">isIdentity</a>() || operand.<a class="code" href="structCVPOperand.html#m8">Negate</a>)
00537                                 {
00538                                         <font class="comment">// if the instruction reads a scalar, no need for swizzle (except if negate is used)</font>
00539                                         <font class="keywordflow">if</font> (!                                           
00540                                                 (
00541                                                  (program[k].Opcode == <a class="code" href="structCVPInstruction.html#s18s5">CVPInstruction::RSQ</a>
00542                                                   || program[k].Opcode == <a class="code" href="structCVPInstruction.html#s18s16">CVPInstruction::RCP</a>
00543                                                   || program[k].Opcode == <a class="code" href="structCVPInstruction.html#s18s15">CVPInstruction::LOG</a>
00544                                                   || program[k].Opcode == <a class="code" href="structCVPInstruction.html#s18s14">CVPInstruction::EXPP</a>
00545                                              ) 
00546                                                  &amp;&amp; 
00547                                                  !operand.<a class="code" href="structCVPOperand.html#m8">Negate</a>
00548                                                 )
00549                                         )
00550                                         {                                       
00551                                                 <font class="comment">// need a temp register for swizzle and/or negate</font>
00552                                                 <a class="code" href="namespaceNL3D.html#a358">doSwizzle</a>(firstTempRegister + <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>, srcValue[<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>],
00553                                                                           <a class="code" href="namespaceNL3D.html#a355">convSwizzleToGLFormat</a>(operand.<a class="code" href="structCVPOperand.html#m9">Swizzle</a>.<a class="code" href="structCVPSwizzle.html#m0">Comp</a>[0], operand.<a class="code" href="structCVPOperand.html#m8">Negate</a>),
00554                                                                           <a class="code" href="namespaceNL3D.html#a355">convSwizzleToGLFormat</a>(operand.<a class="code" href="structCVPOperand.html#m9">Swizzle</a>.<a class="code" href="structCVPSwizzle.html#m0">Comp</a>[1], operand.<a class="code" href="structCVPOperand.html#m8">Negate</a>),
00555                                                                           <a class="code" href="namespaceNL3D.html#a355">convSwizzleToGLFormat</a>(operand.<a class="code" href="structCVPOperand.html#m9">Swizzle</a>.<a class="code" href="structCVPSwizzle.html#m0">Comp</a>[2], operand.<a class="code" href="structCVPOperand.html#m8">Negate</a>),
00556                                                                           <a class="code" href="namespaceNL3D.html#a355">convSwizzleToGLFormat</a>(operand.<a class="code" href="structCVPOperand.html#m9">Swizzle</a>.<a class="code" href="structCVPSwizzle.html#m0">Comp</a>[3], operand.<a class="code" href="structCVPOperand.html#m8">Negate</a>));                                              
00557                                                 ++numSwizzle;
00558                                                 srcValue[<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>] = firstTempRegister + <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>;
00559                                                 glError = glGetError();
00560                                                 <a class="code" href="debug_8h.html#a6">nlassert</a>(glError == GL_NO_ERROR)
00561                                         }
00562                                 }
00563                         }
00564 
00565                         <font class="comment">// get dest value</font>
00566                         <font class="keyword">const</font> <a class="code" href="structCVPOperand.html">CVPOperand</a> &amp;destOperand = <a class="code" href="driver__opengl__extension__def_8h.html#a360">program</a>[k].Dest;
00567                         <font class="keywordflow">switch</font>(destOperand.<a class="code" href="structCVPOperand.html#m0">Type</a>)
00568                         {
00569                                 <font class="keywordflow">case</font> <a class="code" href="structCVPOperand.html#s40s0">CVPOperand::Variable</a>: 
00570                                         destValue = firstRegister + destOperand.<a class="code" href="structCVPOperand.html#m5">Value</a>.VariableValue; 
00571                                 <font class="keywordflow">break</font>;
00572                                 <font class="keywordflow">case</font> <a class="code" href="structCVPOperand.html#s40s3">CVPOperand::OutputRegister</a>:
00573                                         <font class="keywordflow">if</font> (destOperand.<a class="code" href="structCVPOperand.html#m5">Value</a>.OutputRegisterValue != <a class="code" href="structCVPOperand.html#s42s29">CVPOperand::OFogCoord</a>)
00574                                         {                                       
00575                                                 destValue = <a class="code" href="namespaceNL3D.html#a356">convOutputRegisterToEXTVertexShader</a>(destOperand.<a class="code" href="structCVPOperand.html#m5">Value</a>.OutputRegisterValue);
00576                                         }
00577                                         <font class="keywordflow">else</font>
00578                                         {
00579                                                 destValue = fogTemp;
00580                                         }
00581                                 <font class="keywordflow">break</font>;
00582                                 <font class="keywordflow">case</font> <a class="code" href="structCVPOperand.html#s40s4">CVPOperand::AddressRegister</a>:
00583                                         destValue = firstAddressRegister;
00584                                 <font class="keywordflow">break</font>;
00585                                 <font class="keywordflow">default</font>:
00586                                         <a class="code" href="debug_8h.html#a6">nlassert</a>(0);
00587                                 <font class="keywordflow">break</font>;
00588                         }
00589 
00590                         uint writeMask = program[k].Dest.<a class="code" href="structCVPOperand.html#m7">WriteMask</a>;
00591                         <a class="code" href="structCVPInstruction.html#s18">CVPInstruction::EOpcode</a> opcode = program[k].Opcode;
00592                         uint outputRegisterIndex = destOperand.<a class="code" href="structCVPOperand.html#m5">Value</a>.OutputRegisterValue;
00593                         <a class="code" href="debug_8h.html#a6">nlassert</a>(outputRegisterIndex &lt; 16);
00594 
00595                         <font class="comment">// Tells wether the output has already been written before the final write mask. This happens with instructions LOG, EXPP, LIT, RSQ and RCP,</font>
00596                         <font class="comment">// because they write their output component by components</font>
00597                         <font class="keywordtype">bool</font> outputWritten = <font class="keyword">false</font>;
00598 
00599                         <font class="comment">// test for write mask                                          </font>
00600                         <font class="keywordflow">if</font> (writeMask != 0x0f) 
00601                         {                                       
00605                                 <font class="keywordflow">if</font> (!(destOperand.<a class="code" href="structCVPOperand.html#m0">Type</a> == <a class="code" href="structCVPOperand.html#s40s3">CVPOperand::OutputRegister</a> &amp;&amp; destValue == fogTemp))
00606                                 {
00607                                         <font class="comment">// For instructions that write their output components by components, we don't need an intermediary register</font>
00608                                         <font class="keywordflow">if</font> (opcode == <a class="code" href="structCVPInstruction.html#s18s15">CVPInstruction::LOG</a>
00609                                                 || opcode == <a class="code" href="structCVPInstruction.html#s18s14">CVPInstruction::EXPP</a>
00610                                                 || opcode == <a class="code" href="structCVPInstruction.html#s18s9">CVPInstruction::LIT</a>
00611                                                 || opcode == <a class="code" href="structCVPInstruction.html#s18s5">CVPInstruction::RSQ</a>
00612                                                 || opcode == <a class="code" href="structCVPInstruction.html#s18s16">CVPInstruction::RCP</a>
00613                                            )
00614                                         {
00615                                                 outputWritten = <font class="keyword">true</font>;   
00616                                         }
00617                                         <font class="keywordflow">else</font>
00618                                         {                                       
00619                                                 maskedDestValue = destValue;
00620                                                 <font class="comment">// use a temp register before masking</font>
00621                                                 destValue = firstTempRegister;
00622                                         }
00623                                 }
00624                                 <font class="keywordflow">else</font>
00625                                 {
00626                                         componentWritten[outputRegisterIndex] = 0xf;
00627                                 }
00628                         }
00629                         <font class="keywordflow">else</font>
00630                         {
00631                                 <font class="keywordflow">if</font> (destOperand.<a class="code" href="structCVPOperand.html#m0">Type</a> == <a class="code" href="structCVPOperand.html#s40s3">CVPOperand::OutputRegister</a>)
00632                                 {
00633                                         componentWritten[outputRegisterIndex] = 0xf; <font class="comment">// say all components have been written for that output                            </font>
00634                                 }
00635                         }                       
00636                         
00637                         <font class="comment">// generate opcode</font>
00638                         <font class="keywordflow">switch</font> (opcode)
00639                         {
00640                                 <font class="keywordflow">case</font>  <a class="code" href="structCVPInstruction.html#s18s1">CVPInstruction::ARL</a>:
00641                                 {                                       
00642                                         <a class="code" href="debug_8h.html#a6">nlassert</a>(program[k].Src1.<a class="code" href="structCVPOperand.html#m9">Swizzle</a>.<a class="code" href="structCVPSwizzle.html#a0">isScalar</a>());
00643                                         <a class="code" href="driver__opengl__extension__def_8h.html#a423">GLuint</a> <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> = program[k].Src1.<a class="code" href="structCVPOperand.html#m9">Swizzle</a>.<a class="code" href="structCVPSwizzle.html#m0">Comp</a>[0];
00644                                         <a class="code" href="driver__opengl__extension_8h.html#a127">nglExtractComponentEXT</a>(firstAddressRegister, srcValue[0],  <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
00645                                         <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"Extract component"</font>);
00646                                         ++numEC;
00647                                 }
00648                                 <font class="keywordflow">break</font>;
00649                                 <font class="keywordflow">case</font>  <a class="code" href="structCVPInstruction.html#s18s0">CVPInstruction::MOV</a>:
00650                                 {                                                                                       
00651                                         <a class="code" href="driver__opengl__extension_8h.html#a121">nglShaderOp1EXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a255">GL_OP_MOV_EXT</a>, destValue, srcValue[0]);
00652                                         <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"GL_OP_MOV_EXT"</font>);
00653                                         ++numOp;                                        
00654                                 }
00655                                 <font class="keywordflow">break</font>;
00656                                 <font class="keywordflow">case</font>  <a class="code" href="structCVPInstruction.html#s18s2">CVPInstruction::MUL</a>: 
00657                                         <a class="code" href="driver__opengl__extension_8h.html#a122">nglShaderOp2EXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a236">GL_OP_MUL_EXT</a>, destValue, srcValue[0], srcValue[1]); 
00658                                         <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"GL_OP_MUL_EXT"</font>);
00659                                         ++numOp;
00660                                 <font class="keywordflow">break</font>;
00661                                 <font class="keywordflow">case</font>  <a class="code" href="structCVPInstruction.html#s18s3">CVPInstruction::ADD</a>: 
00662                                         <a class="code" href="driver__opengl__extension_8h.html#a122">nglShaderOp2EXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a237">GL_OP_ADD_EXT</a>, destValue, srcValue[0], srcValue[1]); 
00663                                         <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"GL_OP_ADD_EXT"</font>);
00664                                         ++numOp;
00665                                 <font class="keywordflow">break</font>;
00666                                 <font class="keywordflow">case</font>  <a class="code" href="structCVPInstruction.html#s18s4">CVPInstruction::MAD</a>: 
00667                                         <a class="code" href="driver__opengl__extension_8h.html#a123">nglShaderOp3EXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a238">GL_OP_MADD_EXT</a>, destValue, srcValue[0], srcValue[1], srcValue[2]); 
00668                                         <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"GL_OP_MADD_EXT"</font>);
00669                                         ++numOp;
00670                                 <font class="keywordflow">break</font>;
00671                                 <font class="keywordflow">case</font>  <a class="code" href="structCVPInstruction.html#s18s5">CVPInstruction::RSQ</a>:
00672                                 {
00673                                         <a class="code" href="debug_8h.html#a6">nlassert</a>(program[k].Src1.<a class="code" href="structCVPOperand.html#m9">Swizzle</a>.<a class="code" href="structCVPSwizzle.html#a0">isScalar</a>());
00674                                         <font class="comment">// extract the component we need</font>
00675                                         <a class="code" href="driver__opengl__extension__def_8h.html#a423">GLuint</a> <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> = program[k].Src1.<a class="code" href="structCVPOperand.html#m9">Swizzle</a>.<a class="code" href="structCVPSwizzle.html#m0">Comp</a>[0];
00676                                         <a class="code" href="driver__opengl__extension_8h.html#a127">nglExtractComponentEXT</a>(firstTempScalar, srcValue[0],  <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
00677                                         <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"Extract component"</font>);
00678                                         ++numEC;
00679                                         <a class="code" href="driver__opengl__extension_8h.html#a121">nglShaderOp1EXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a251">GL_OP_RECIP_SQRT_EXT</a>, firstTempScalar + 1, firstTempScalar);
00680                                         <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"GL_OP_RECIP_SQRT_EXT"</font>);
00681                                         ++numOp;
00682                                         <font class="comment">// duplicate result in destination</font>
00683                                         <font class="keywordflow">for</font>(uint <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> = 0; <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> &lt; 4; ++<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>)
00684                                         {
00685                                                 <font class="keywordflow">if</font> (writeMask &amp; (1 &lt;&lt; <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>))
00686                                                 {                                               
00687                                                         <a class="code" href="driver__opengl__extension_8h.html#a126">nglInsertComponentEXT</a>(destValue, firstTempScalar + 1, <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>);
00688                                                         <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"Insert component"</font>);
00689                                                         <a class="code" href="debug_8h.html#a6">nlassert</a>(glGetError() == GL_NO_ERROR);
00690                                                 }
00691                                         }
00692                                 }
00693                                 <font class="keywordflow">break</font>;
00694                                 <font class="keywordflow">case</font>  <a class="code" href="structCVPInstruction.html#s18s6">CVPInstruction::DP3</a>: 
00695                                         <a class="code" href="driver__opengl__extension_8h.html#a122">nglShaderOp2EXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a234">GL_OP_DOT3_EXT</a>, destValue, srcValue[0], srcValue[1]);
00696                                         <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"GL_OP_DOT3_EXT"</font>);
00697                                         ++numOp;
00698                                 <font class="keywordflow">break</font>;
00699                                 <font class="keywordflow">case</font>  <a class="code" href="structCVPInstruction.html#s18s7">CVPInstruction::DP4</a>: 
00700                                         <a class="code" href="driver__opengl__extension_8h.html#a122">nglShaderOp2EXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a235">GL_OP_DOT4_EXT</a>, destValue, srcValue[0], srcValue[1]); 
00701                                         <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"GL_OP_DOT4_EXT"</font>);
00702                                         ++numOp;
00703                                 <font class="keywordflow">break</font>;
00704                                 <font class="keywordflow">case</font>  <a class="code" href="structCVPInstruction.html#s18s8">CVPInstruction::DST</a>: 
00705                                         <a class="code" href="namespaceNL3D.html#a358">doSwizzle</a>(firstTempRegister, srcValue[0], <a class="code" href="driver__opengl__extension__def_8h.html#a325">GL_ONE_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a317">GL_Y_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a318">GL_Z_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a325">GL_ONE_EXT</a>);
00706                                         <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"GL_OP_DOT4_EXT"</font>);
00707                                         ++numOp;
00708                                         <a class="code" href="namespaceNL3D.html#a358">doSwizzle</a>(firstTempRegister + 1, srcValue[1], <a class="code" href="driver__opengl__extension__def_8h.html#a325">GL_ONE_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a317">GL_Y_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a325">GL_ONE_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a319">GL_W_EXT</a>);                                      
00709                                         ++numSwizzle;
00710                                         <a class="code" href="driver__opengl__extension_8h.html#a122">nglShaderOp2EXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a236">GL_OP_MUL_EXT</a>, destValue, firstTempRegister, firstTempRegister + 1);
00711                                         <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"GL_OP_MUL_EXT"</font>);
00712                                         ++numOp;
00713                                 <font class="keywordflow">break</font>;                                  
00714                                 <font class="keywordflow">case</font>  <a class="code" href="structCVPInstruction.html#s18s9">CVPInstruction::LIT</a>:
00715                                 {
00716                                         uint writeMask = program[k].Dest.<a class="code" href="structCVPOperand.html#m7">WriteMask</a>;                                     
00717                                         <a class="code" href="driver__opengl__extension_8h.html#a127">nglExtractComponentEXT</a>(firstTempScalar, srcValue[0], 0); <font class="comment">// extract X from the source</font>
00718                                         <font class="keywordflow">if</font> (writeMask &amp; 4)
00719                                         {                                       
00720                                                 <a class="code" href="driver__opengl__extension_8h.html#a127">nglExtractComponentEXT</a>(firstTempScalar + 1, srcValue[0], 1); <font class="comment">// extract Y from the source</font>
00721                                                 <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"Extract component"</font>);
00722                                                 ++numEC;
00723                                                 <a class="code" href="driver__opengl__extension_8h.html#a127">nglExtractComponentEXT</a>(firstTempScalar + 2, srcValue[0], 3); <font class="comment">// extract W from the source</font>
00724                                                 <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"Extract component"</font>);
00725                                                 ++numEC;
00726                                                 <font class="comment">// result = X &gt; 0 ? Y^W : 0                                     </font>
00727                                                 <a class="code" href="driver__opengl__extension_8h.html#a122">nglShaderOp2EXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a249">GL_OP_POWER_EXT</a>, firstTempScalar + 2, firstTempScalar + 1, firstTempScalar + 2);
00728                                                 <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"GL_OP_POWER_EXT"</font>);
00729                                                 ++numOp;
00730                                                 <a class="code" href="driver__opengl__extension_8h.html#a122">nglShaderOp2EXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a242">GL_OP_SET_GE_EXT</a>, firstTempScalar + 1, firstTempScalar, cteZero);
00731                                                 <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"GL_OP_SET_GE_EXT"</font>);
00732                                                 ++numOp;
00733                                                 <a class="code" href="driver__opengl__extension_8h.html#a122">nglShaderOp2EXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a236">GL_OP_MUL_EXT</a>, firstTempScalar + 2, firstTempScalar + 2, firstTempScalar + 1);
00734                                                 <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"GL_OP_MUL_EXT"</font>);
00735                                                 ++numOp;
00736                                                 <font class="comment">// store result</font>
00737                                                 <a class="code" href="driver__opengl__extension_8h.html#a126">nglInsertComponentEXT</a>(destValue, firstTempScalar + 2, 2);
00738                                                 <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"Insert component"</font>);
00739                                                 ++numIC;
00740                                         }
00741                                         <font class="keywordflow">if</font> (writeMask &amp; 2) 
00742                                         {
00743                                                 <font class="comment">// clamp N.L to [0, 1]</font>
00744                                                 <a class="code" href="driver__opengl__extension_8h.html#a123">nglShaderOp3EXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a244">GL_OP_CLAMP_EXT</a>, firstTempScalar, firstTempScalar, cteZero, cteOne);
00745                                                 <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"GL_OP_CLAMP_EXT"</font>);
00746                                                 ++numOp;
00747                                                 <a class="code" href="driver__opengl__extension_8h.html#a126">nglInsertComponentEXT</a>(destValue, firstTempScalar, 1);
00748                                                 <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"Insert component"</font>);
00749                                                 ++numIC;
00750                                         }
00751                                         <font class="comment">// set x and w to 1 if they are not masked</font>
00752                                         <font class="keywordflow">if</font> (writeMask &amp; (1 + 8)) 
00753                                         {                                       
00754                                                 <a class="code" href="namespaceNL3D.html#a358">doSwizzle</a>(destValue, destValue, 
00755                                                                           (writeMask &amp; 1) ? <a class="code" href="driver__opengl__extension__def_8h.html#a325">GL_ONE_EXT</a> : <a class="code" href="driver__opengl__extension__def_8h.html#a316">GL_X_EXT</a>,
00756                                                                           <a class="code" href="driver__opengl__extension__def_8h.html#a317">GL_Y_EXT</a>,
00757                                                                           <a class="code" href="driver__opengl__extension__def_8h.html#a318">GL_Z_EXT</a>,
00758                                                                           (writeMask &amp; 8) ? <a class="code" href="driver__opengl__extension__def_8h.html#a325">GL_ONE_EXT</a> : <a class="code" href="driver__opengl__extension__def_8h.html#a319">GL_W_EXT</a>);                                             
00759                                                 ++numSwizzle;
00760                                         }                                       
00761                                                  
00762                                 }
00763                                 <font class="keywordflow">break</font>;
00764                                 <font class="keywordflow">case</font>  <a class="code" href="structCVPInstruction.html#s18s10">CVPInstruction::MIN</a>: 
00765                                         <a class="code" href="driver__opengl__extension_8h.html#a122">nglShaderOp2EXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a241">GL_OP_MIN_EXT</a>, destValue, srcValue[0], srcValue[1]);
00766                                         <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"GL_OP_MIN_EXT"</font>);
00767                                         ++numOp;
00768                                 <font class="keywordflow">break</font>;
00769                                 <font class="keywordflow">case</font>  <a class="code" href="structCVPInstruction.html#s18s11">CVPInstruction::MAX</a>: 
00770                                         <a class="code" href="driver__opengl__extension_8h.html#a122">nglShaderOp2EXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a240">GL_OP_MAX_EXT</a>, destValue, srcValue[0], srcValue[1]);
00771                                         <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"GL_OP_MAX_EXT"</font>);
00772                                         ++numOp;
00773                                 <font class="keywordflow">break</font>;
00774                                 <font class="keywordflow">case</font>  <a class="code" href="structCVPInstruction.html#s18s12">CVPInstruction::SLT</a>: 
00775                                         <a class="code" href="driver__opengl__extension_8h.html#a122">nglShaderOp2EXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a243">GL_OP_SET_LT_EXT</a>, destValue, srcValue[0], srcValue[1]);
00776                                         <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"GL_OP_SET_LT_EXT"</font>);
00777                                         ++numOp;
00778                                 <font class="keywordflow">break</font>;
00779                                 <font class="keywordflow">case</font>  <a class="code" href="structCVPInstruction.html#s18s13">CVPInstruction::SGE</a>: 
00780                                         <a class="code" href="driver__opengl__extension_8h.html#a122">nglShaderOp2EXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a242">GL_OP_SET_GE_EXT</a>, destValue, srcValue[0], srcValue[1]);
00781                                         <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"GL_OP_SET_GE_EXT"</font>);
00782                                         ++numOp;
00783                                 <font class="keywordflow">break</font>;
00784                                 <font class="keywordflow">case</font>  <a class="code" href="structCVPInstruction.html#s18s14">CVPInstruction::EXPP</a>:
00785                                 {                       
00786                                         uint writeMask = program[k].Dest.<a class="code" href="structCVPOperand.html#m7">WriteMask</a>;
00787                                         <a class="code" href="debug_8h.html#a6">nlassert</a>(program[k].Src1.<a class="code" href="structCVPOperand.html#m9">Swizzle</a>.<a class="code" href="structCVPSwizzle.html#a0">isScalar</a>());
00788                                         <a class="code" href="driver__opengl__extension__def_8h.html#a423">GLuint</a> compIndex = program[k].Src1.<a class="code" href="structCVPOperand.html#m9">Swizzle</a>.<a class="code" href="structCVPSwizzle.html#m0">Comp</a>[0];
00789                                         <a class="code" href="driver__opengl__extension_8h.html#a127">nglExtractComponentEXT</a>(firstTempScalar + 2, srcValue[0], compIndex); <font class="comment">// extract W from the source</font>
00790                                         <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"Extract component"</font>);
00791                                         ++numEC;
00792                                         <font class="keywordflow">if</font> (writeMask &amp; 1)
00793                                         {                                       
00794                                                 <a class="code" href="driver__opengl__extension_8h.html#a121">nglShaderOp1EXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a245">GL_OP_FLOOR_EXT</a>, firstTempScalar, firstTempScalar + 2); <font class="comment">// (int) W</font>
00795                                                 <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"GL_OP_FLOOR_EXT"</font>);
00796                                                 ++numOp;
00797                                                 <a class="code" href="driver__opengl__extension_8h.html#a121">nglShaderOp1EXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a247">GL_OP_EXP_BASE_2_EXT</a>, firstTempScalar, firstTempScalar); <font class="comment">// 2 ^ (int) W         </font>
00798                                                 <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"GL_OP_EXP_BASE_2_EXT"</font>);
00799                                                 ++numOp;
00800                                         }
00801                                         <font class="keywordflow">if</font> (writeMask &amp; 2) 
00802                                         {                                       
00803                                                 <a class="code" href="driver__opengl__extension_8h.html#a121">nglShaderOp1EXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a239">GL_OP_FRAC_EXT</a>, firstTempScalar + 1, firstTempScalar + 2); <font class="comment">// frac(W)</font>
00804                                                 <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"GL_OP_FRAC_EXT"</font>);
00805                                                 ++numOp;
00806                                         }
00807                                         <font class="keywordflow">if</font> (writeMask &amp; 4) <a class="code" href="driver__opengl__extension_8h.html#a121">nglShaderOp1EXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a247">GL_OP_EXP_BASE_2_EXT</a>, firstTempScalar + 2, firstTempScalar + 2); <font class="comment">// 2 ^W</font>
00808                                         <font class="comment">// store the results</font>
00809                                         <font class="keywordflow">if</font> (writeMask &amp; 1) { <a class="code" href="driver__opengl__extension_8h.html#a126">nglInsertComponentEXT</a>(destValue, firstTempScalar, 0); <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"Insert component"</font>); ++numIC;  }
00810                                         <font class="keywordflow">if</font> (writeMask &amp; 2) { <a class="code" href="driver__opengl__extension_8h.html#a126">nglInsertComponentEXT</a>(destValue, firstTempScalar + 1, 1); <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"Insert component"</font>); ++numIC; }
00811                                         <font class="keywordflow">if</font> (writeMask &amp; 4) { <a class="code" href="driver__opengl__extension_8h.html#a126">nglInsertComponentEXT</a>(destValue, firstTempScalar + 2, 2); <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"Insert component"</font>); ++numIC; }
00812                                         <font class="comment">// set W to 1 and leave other values unchanged</font>
00813                                         <font class="keywordflow">if</font> (writeMask &amp; 8) { <a class="code" href="namespaceNL3D.html#a358">doSwizzle</a>(destValue, destValue, <a class="code" href="driver__opengl__extension__def_8h.html#a316">GL_X_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a317">GL_Y_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a318">GL_Z_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a325">GL_ONE_EXT</a>); ++numSwizzle; }
00814                                 }
00815                                 <font class="keywordflow">break</font>;
00816                                 <font class="keywordflow">case</font>  <a class="code" href="structCVPInstruction.html#s18s15">CVPInstruction::LOG</a>:
00817                                 {                                       
00818                                         uint writeMask = program[k].Dest.<a class="code" href="structCVPOperand.html#m7">WriteMask</a>;
00819                                         <a class="code" href="debug_8h.html#a6">nlassert</a>(program[k].Src1.<a class="code" href="structCVPOperand.html#m9">Swizzle</a>.<a class="code" href="structCVPSwizzle.html#a0">isScalar</a>());
00820                                         <font class="comment">// extract the component we need</font>
00821                                         <a class="code" href="driver__opengl__extension_8h.html#a127">nglExtractComponentEXT</a>(firstTempScalar, srcValue[0], (<a class="code" href="driver__opengl__extension__def_8h.html#a423">GLuint</a>) program[k].Src1.<a class="code" href="structCVPOperand.html#m9">Swizzle</a>.<a class="code" href="structCVPSwizzle.html#m0">Comp</a>[0]);
00822                                         <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"Extract component"</font>);
00823                                         ++numEC;
00824                                         <font class="comment">// get abs(src) : abs(src) = max(src, -src)</font>
00825                                         <a class="code" href="driver__opengl__extension_8h.html#a121">nglShaderOp1EXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a233">GL_OP_NEGATE_EXT</a>, firstTempScalar + 1, firstTempScalar);
00826                                         <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"GL_OP_NEGATE_EXT"</font>);
00827                                         ++numOp;
00828                                         <a class="code" href="driver__opengl__extension_8h.html#a122">nglShaderOp2EXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a240">GL_OP_MAX_EXT</a>, firstTempScalar, firstTempScalar, firstTempScalar + 1);
00829                                         <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"GL_OP_MAX_EXT"</font>);
00830                                         ++numOp;
00831                                         <a class="code" href="driver__opengl__extension_8h.html#a121">nglShaderOp1EXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a248">GL_OP_LOG_BASE_2_EXT</a>, firstTempScalar, firstTempScalar); <font class="comment">// (int) W</font>
00832                                         <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"GL_OP_LOG_BASE_2_EXT"</font>);
00833                                         ++numOp;
00834                                         <font class="comment">// store the results</font>
00835                                         <font class="keywordflow">for</font>(uint <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> = 0; <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> &lt; 4; ++<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>)
00836                                         {
00837                                                 <font class="keywordflow">if</font> (writeMask &amp; (1 &lt;&lt; <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>))
00838                                                 {                                               
00839                                                         <a class="code" href="driver__opengl__extension_8h.html#a126">nglInsertComponentEXT</a>(destValue, firstTempScalar, <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>);
00840                                                         <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"Insert component"</font>);
00841                                                         <a class="code" href="debug_8h.html#a6">nlassert</a>(glGetError() == GL_NO_ERROR);
00842                                                 }
00843                                         }                                       
00844                                 }
00845                                 <font class="keywordflow">break</font>;
00846                                 <font class="keywordflow">case</font>  <a class="code" href="structCVPInstruction.html#s18s16">CVPInstruction::RCP</a>:
00847                                 {
00848                                         uint writeMask = program[k].Dest.<a class="code" href="structCVPOperand.html#m7">WriteMask</a>;
00849                                         <a class="code" href="debug_8h.html#a6">nlassert</a>(program[k].Src1.<a class="code" href="structCVPOperand.html#m9">Swizzle</a>.<a class="code" href="structCVPSwizzle.html#a0">isScalar</a>());
00850                                         <font class="comment">// extract the component we need</font>
00851                                         <a class="code" href="driver__opengl__extension_8h.html#a127">nglExtractComponentEXT</a>(firstTempScalar, srcValue[0], (<a class="code" href="driver__opengl__extension__def_8h.html#a423">GLuint</a>) program[k].Src1.<a class="code" href="structCVPOperand.html#m9">Swizzle</a>.<a class="code" href="structCVPSwizzle.html#m0">Comp</a>[0]);
00852                                         <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"Extract component"</font>);
00853                                         ++numEC;
00854                                         <a class="code" href="driver__opengl__extension_8h.html#a121">nglShaderOp1EXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a250">GL_OP_RECIP_EXT</a>, firstTempScalar + 1, firstTempScalar);
00855                                         <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"GL_OP_RECIP_EXT"</font>);
00856                                         ++numOp;
00857                                         <font class="comment">// duplicate result in destination</font>
00858                                         <font class="keywordflow">for</font>(uint <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> = 0; <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> &lt; 4; ++<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>)
00859                                         {
00860                                                 <font class="keywordflow">if</font> (writeMask &amp; (1 &lt;&lt; <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>))
00861                                                 {                                               
00862                                                         <a class="code" href="driver__opengl__extension_8h.html#a126">nglInsertComponentEXT</a>(destValue, firstTempScalar + 1, <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>);
00863                                                         <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"insert component"</font>);
00864                                                         ++numIC;
00865                                                 }
00866                                         }
00867                                 }                                       
00868                                 <font class="keywordflow">break</font>;
00869                         }
00870 
00871                         glError = glGetError();
00872                         <a class="code" href="debug_8h.html#a6">nlassert</a>(glError == GL_NO_ERROR)
00873 
00874                                 
00875                         <font class="comment">// apply write mask if any</font>
00876                         <font class="keywordflow">if</font> (writeMask != 0x0f)
00877                         {                                                                       
00878                                 <font class="keywordflow">if</font> (destOperand.<a class="code" href="structCVPOperand.html#m0">Type</a> == <a class="code" href="structCVPOperand.html#s40s3">CVPOperand::OutputRegister</a> &amp;&amp; destValue != fogTemp)
00879                                 {
00880                                         uint &amp;outputMask = componentWritten[outputRegisterIndex];
00881                                         <font class="comment">// is a texture coordinate or a color being written ?</font>
00882                                         <font class="keywordflow">if</font> ((maskedDestValue &gt;= <a class="code" href="driver__opengl__extension__def_8h.html#a259">GL_OUTPUT_TEXTURE_COORD0_EXT</a> &amp;&amp; maskedDestValue &lt;= <a class="code" href="driver__opengl__extension__def_8h.html#a266">GL_OUTPUT_TEXTURE_COORD7_EXT</a>)
00883                                                 || maskedDestValue == <a class="code" href="driver__opengl__extension__def_8h.html#a257">GL_OUTPUT_COLOR0_EXT</a>
00884                                                 || maskedDestValue == <a class="code" href="driver__opengl__extension__def_8h.html#a258">GL_OUTPUT_COLOR1_EXT</a>
00885                                            )
00886                                         {                                       
00887                                                 <font class="comment">// test if this is the last time this output will be written</font>
00888                                                 <font class="keywordtype">bool</font> found = <font class="keyword">false</font>;
00889                                                 <font class="comment">// if this was the last write for this output, must set unfilled component</font>
00890                                                 <font class="comment">// NB : this loop could be optimized, but vertex program are rather short for now ..</font>
00891                                                 <font class="keywordflow">for</font>(uint m = k + 1; m &lt; program.size(); ++m)
00892                                                 {
00893                                                         <font class="keywordflow">if</font> (program[m].Dest.<a class="code" href="structCVPOperand.html#m0">Type</a> == <a class="code" href="structCVPOperand.html#s40s3">CVPOperand::OutputRegister</a>) <font class="comment">// another output to this texture ?</font>
00894                                                         {
00895                                                                 <font class="keywordflow">if</font> (program[m].Dest.<a class="code" href="structCVPOperand.html#m5">Value</a>.OutputRegisterValue == program[k].Dest.<a class="code" href="structCVPOperand.html#m5">Value</a>.OutputRegisterValue)
00896                                                                 {
00897                                                                         found = <font class="keyword">true</font>;
00898                                                                         <font class="keywordflow">break</font>;
00899                                                                 }
00900                                                         }
00901                                                 }
00902 
00903                                                 <font class="keywordflow">if</font> (found)
00904                                                 {
00905                                                         <font class="keywordflow">if</font> (!outputWritten)
00906                                                         {                                                       
00907                                                                 <font class="comment">// write values</font>
00908                                                                 <a class="code" href="namespaceNL3D.html#a359">doWriteMask</a>(maskedDestValue, destValue,
00909                                                                                                 writeMask &amp; 1 ? GL_TRUE : GL_FALSE,
00910                                                                                                 writeMask &amp; 2 ? GL_TRUE : GL_FALSE,
00911                                                                                                 writeMask &amp; 4 ? GL_TRUE : GL_FALSE,
00912                                                                                                 writeMask &amp; 8 ? GL_TRUE : GL_FALSE);
00913                                                                 ++numWM;
00914                                                         }
00915                                                 }
00916                                                 <font class="keywordflow">else</font> <font class="comment">// this is the last write, check if the mask is complete</font>
00917                                                 {
00918                                                         <font class="keywordflow">if</font> ((outputMask | writeMask) == 0xf)
00919                                                         {
00920                                                                 <font class="keywordflow">if</font> (!outputWritten)
00921                                                                 {
00922                                                                         <font class="comment">// ok, after this call everything has been written</font>
00923                                                                         <font class="comment">// write values</font>
00924                                                                             <a class="code" href="namespaceNL3D.html#a359">doWriteMask</a>(maskedDestValue, destValue,
00925                                                                                                         writeMask &amp; 1 ? GL_TRUE : GL_FALSE,
00926                                                                                                         writeMask &amp; 2 ? GL_TRUE : GL_FALSE,
00927                                                                                                         writeMask &amp; 4 ? GL_TRUE : GL_FALSE,
00928                                                                                                         writeMask &amp; 8 ? GL_TRUE : GL_FALSE);
00929                                                                         ++numWM;
00930                                                                 }
00931                                                         }
00932                                                         <font class="keywordflow">else</font>
00933                                                         {
00934                                                                 uint prevMask = outputMask;
00935                                                                 uint newMask  = writeMask | outputMask;
00936                                                                 
00937                                                                 <font class="comment">// complete unused entries</font>
00938 
00939                                                                 <font class="comment">// if primary color is output, then the default color is white</font>
00940                                                                 <font class="keywordflow">if</font> (maskedDestValue == <a class="code" href="driver__opengl__extension__def_8h.html#a257">GL_OUTPUT_COLOR0_EXT</a>)
00941                                                                 {
00942                                                                         <a class="code" href="namespaceNL3D.html#a358">doSwizzle</a>(firstTempRegister, destValue,
00943                                                                                                   newMask &amp; 1 ? <a class="code" href="driver__opengl__extension__def_8h.html#a316">GL_X_EXT</a> : <a class="code" href="driver__opengl__extension__def_8h.html#a325">GL_ONE_EXT</a>,
00944                                                                                                   newMask &amp; 2 ? <a class="code" href="driver__opengl__extension__def_8h.html#a317">GL_Y_EXT</a> : <a class="code" href="driver__opengl__extension__def_8h.html#a325">GL_ONE_EXT</a>,
00945                                                                                                   newMask &amp; 4 ? <a class="code" href="driver__opengl__extension__def_8h.html#a318">GL_Z_EXT</a> : <a class="code" href="driver__opengl__extension__def_8h.html#a325">GL_ONE_EXT</a>,
00946                                                                                                   newMask &amp; 8 ? <a class="code" href="driver__opengl__extension__def_8h.html#a319">GL_W_EXT</a> : <a class="code" href="driver__opengl__extension__def_8h.html#a325">GL_ONE_EXT</a>);
00947                                                                 }
00948                                                                 <font class="keywordflow">else</font>
00949                                                                 {                                                               
00950                                                                         <a class="code" href="namespaceNL3D.html#a358">doSwizzle</a>(firstTempRegister, destValue,
00951                                                                                                   newMask &amp; 1 ? <a class="code" href="driver__opengl__extension__def_8h.html#a316">GL_X_EXT</a> : <a class="code" href="driver__opengl__extension__def_8h.html#a324">GL_ZERO_EXT</a>,
00952                                                                                                   newMask &amp; 2 ? <a class="code" href="driver__opengl__extension__def_8h.html#a317">GL_Y_EXT</a> : <a class="code" href="driver__opengl__extension__def_8h.html#a324">GL_ZERO_EXT</a>,
00953                                                                                                   newMask &amp; 4 ? <a class="code" href="driver__opengl__extension__def_8h.html#a318">GL_Z_EXT</a> : <a class="code" href="driver__opengl__extension__def_8h.html#a324">GL_ZERO_EXT</a>,
00954                                                                                                   newMask &amp; 8 ? <a class="code" href="driver__opengl__extension__def_8h.html#a319">GL_W_EXT</a> : <a class="code" href="driver__opengl__extension__def_8h.html#a325">GL_ONE_EXT</a>);
00955                                                                 }
00956                                                                 <font class="keywordflow">if</font> (!outputWritten)
00957                                                                 {                                                       
00958                                                                         ++numWM;
00959                                                                             <a class="code" href="namespaceNL3D.html#a359">doWriteMask</a>(maskedDestValue, firstTempRegister,
00960                                                                                                         prevMask &amp; 1 ? GL_FALSE : GL_TRUE,
00961                                                                                                         prevMask &amp; 2 ? GL_FALSE : GL_TRUE,
00962                                                                                                         prevMask &amp; 4 ? GL_FALSE : GL_TRUE,
00963                                                                                                         prevMask &amp; 8 ? GL_FALSE : GL_TRUE
00964                                                                                                   );                                                                    
00965                                                                         ++numWM;
00966                                                                 }
00967                                                                 outputMask = 0xf;
00968                                                         }
00969                                                 }                                                                               
00970                                         }
00971                                         <font class="keywordflow">else</font>
00972                                         {
00973                                                 <font class="keywordflow">if</font> (!outputWritten)
00974                                                 {
00975                                                             <a class="code" href="namespaceNL3D.html#a359">doWriteMask</a>(maskedDestValue, destValue,
00976                                                                                         writeMask &amp; 1 ? GL_TRUE : GL_FALSE,
00977                                                                                         writeMask &amp; 2 ? GL_TRUE : GL_FALSE,
00978                                                                                         writeMask &amp; 4 ? GL_TRUE : GL_FALSE,
00979                                                                                         writeMask &amp; 8 ? GL_TRUE : GL_FALSE);
00980                                                         ++numWM;
00981                                                 }
00982                                         }
00983                                         <font class="comment">// complete the mask </font>
00984                                         outputMask |= writeMask;
00985                                 }
00986                                 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (destOperand.<a class="code" href="structCVPOperand.html#m0">Type</a> != <a class="code" href="structCVPOperand.html#s40s3">CVPOperand::OutputRegister</a>)
00987                                 {
00988                                         <font class="keywordflow">if</font> (!outputWritten)
00989                                         {
00990                                                     <a class="code" href="namespaceNL3D.html#a359">doWriteMask</a>(maskedDestValue, destValue,
00991                                                                                 writeMask &amp; 1 ? GL_TRUE : GL_FALSE,
00992                                                                                 writeMask &amp; 2 ? GL_TRUE : GL_FALSE,
00993                                                                                 writeMask &amp; 4 ? GL_TRUE : GL_FALSE,
00994                                                                                 writeMask &amp; 8 ? GL_TRUE : GL_FALSE);
00995                                                 ++numWM;
00996                                         }
00997                                 }                               
00998                         }
00999 
01000                         glError = glGetError();
01001                         <a class="code" href="debug_8h.html#a6">nlassert</a>(glError == GL_NO_ERROR)
01002                 }
01003 
01004                 
01005 
01006                 <font class="comment">// if color have not been written, write with default values</font>
01007                 <font class="keywordflow">if</font> (componentWritten[<a class="code" href="structCVPOperand.html#s42s25">CVPOperand::OPrimaryColor</a>] == 0)
01008                 {
01009                         <font class="comment">// we specify vertex coord has input for swizzle, but we don't read any component.. </font>
01010                         <a class="code" href="namespaceNL3D.html#a358">doSwizzle</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a257">GL_OUTPUT_COLOR0_EXT</a>, <a class="code" href="classNL3D_1_1CDriverGL.html#z417_2">_EVSPositionHandle</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a325">GL_ONE_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a325">GL_ONE_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a325">GL_ONE_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a325">GL_ONE_EXT</a>);
01011                         <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"Swizzle (Complete primary color)"</font>);
01012                         ++numSwizzle;
01013                 }
01014                 <font class="keywordflow">else</font>
01015                 {
01016                         <a class="code" href="debug_8h.html#a6">nlassert</a>(componentWritten[<a class="code" href="structCVPOperand.html#s42s25">CVPOperand::OPrimaryColor</a>] == 0xf)
01017                 }
01018                 <font class="keywordflow">if</font> (componentWritten[<a class="code" href="structCVPOperand.html#s42s26">CVPOperand::OSecondaryColor</a>] == 0)
01019                 {
01020                         <font class="comment">// we specify vertex coord has input for swizzle, but we don't read any component..</font>
01021                         <a class="code" href="namespaceNL3D.html#a358">doSwizzle</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a258">GL_OUTPUT_COLOR1_EXT</a>, <a class="code" href="classNL3D_1_1CDriverGL.html#z417_2">_EVSPositionHandle</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a324">GL_ZERO_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a324">GL_ZERO_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a324">GL_ZERO_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a325">GL_ONE_EXT</a>);
01022                         <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"Swizzle (Complete secondary color)"</font>);
01023                         ++numSwizzle;
01024                 }
01025                 <font class="keywordflow">else</font>
01026                 {
01027                         <a class="code" href="debug_8h.html#a6">nlassert</a>(componentWritten[<a class="code" href="structCVPOperand.html#s42s26">CVPOperand::OSecondaryColor</a>] == 0xf)
01028                 }
01029                 <a class="code" href="debug_8h.html#a6">nlassert</a>(componentWritten[<a class="code" href="structCVPOperand.html#s42s24">CVPOperand::OHPosition</a>] == 0xf); <font class="comment">// should have written all component of position     </font>
01030 
01031                 glError = glGetError();
01032                 <a class="code" href="debug_8h.html#a6">nlassert</a>(glError == GL_NO_ERROR);
01033 
01034                 <font class="comment">// if fog has been written, perform conversion</font>
01035                 <font class="keywordflow">if</font> (componentWritten[<a class="code" href="structCVPOperand.html#s42s29">CVPOperand::OFogCoord</a>] == 0xf)
01036                 {
01037                         <font class="comment">// Well this could be avoided, but we should make 2 cases for each vertex program.. :(</font>
01038                         <a class="code" href="namespaceNL3D.html#a358">doSwizzle</a>(firstTempRegister, <a class="code" href="classNL3D_1_1CDriverGL.html#z417_6">_EVSConstantHandle</a> + 96, <a class="code" href="driver__opengl__extension__def_8h.html#a316">GL_X_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a316">GL_X_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a316">GL_X_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a316">GL_X_EXT</a>);
01039                         <a class="code" href="namespaceNL3D.html#a358">doSwizzle</a>(firstTempRegister + 1, <a class="code" href="classNL3D_1_1CDriverGL.html#z417_6">_EVSConstantHandle</a> + 96, <a class="code" href="driver__opengl__extension__def_8h.html#a317">GL_Y_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a317">GL_Y_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a317">GL_Y_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a317">GL_Y_EXT</a>);                      
01040                         <a class="code" href="driver__opengl__extension_8h.html#a123">nglShaderOp3EXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a238">GL_OP_MADD_EXT</a>, firstTempRegister + 2, fogTemp, firstTempRegister, firstTempRegister + 1);
01041                         <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"Use MAD for fog conversion"</font>);
01042                         <a class="code" href="driver__opengl__extension_8h.html#a127">nglExtractComponentEXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a291">GL_OUTPUT_FOG_EXT</a>, firstTempRegister + 2, 0);
01043                         <a class="code" href="driver__opengl__vertex__program_8cpp.html#a1">EVS_INFO</a>(<font class="stringliteral">"Extract component to fog"</font>);
01044                 }
01045 
01046                 glError = glGetError();
01047                 <a class="code" href="debug_8h.html#a6">nlassert</a>(glError == GL_NO_ERROR);
01048         }
01049         <a class="code" href="driver__opengl__extension_8h.html#a117">nglEndVertexShaderEXT</a>();
01050 
01051         glError = glGetError();
01052         <a class="code" href="debug_8h.html#a6">nlassert</a>(glError == GL_NO_ERROR);
01053 
01054         <a class="code" href="driver__opengl__extension__def_8h.html#a421">GLboolean</a> optimizedShader;
01055         glGetBooleanv(<a class="code" href="driver__opengl__extension__def_8h.html#a315">GL_VERTEX_SHADER_OPTIMIZED_EXT</a>, &amp;optimizedShader);
01056         <font class="keywordflow">if</font> (!optimizedShader)
01057         {
01058                 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"Failed to optimize a vertex program with the EXT_vertex_shader extension, this shader will be disabled"</font>);
01059                 <font class="keywordflow">return</font> <font class="keyword">false</font>;
01060         }       
01061 
01062         <font class="comment">// see which input registers are used</font>
01063         usedInputRegisters = 0;
01064         
01065         uint k, <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>;
01066         <font class="comment">// convert each instruction of the vertex program</font>
01067         <font class="keywordflow">for</font>(k = 0; k &lt; <a class="code" href="driver__opengl__extension__def_8h.html#a360">program</a>.size(); ++k)
01068         {
01069                 uint numSrc = <a class="code" href="driver__opengl__extension__def_8h.html#a360">program</a>[k].getNumUsedSrc();
01070                 <font class="keywordflow">for</font>(<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> = 0; <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> &lt; numSrc; ++<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>)
01071                 {
01072                         <font class="keyword">const</font> <a class="code" href="structCVPOperand.html">CVPOperand</a> &amp;op = <a class="code" href="driver__opengl__extension__def_8h.html#a360">program</a>[k].getSrc(<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>);
01073                         <font class="keywordflow">if</font> (op.<a class="code" href="structCVPOperand.html#m0">Type</a> == <a class="code" href="structCVPOperand.html#s40s2">CVPOperand::InputRegister</a>)
01074                         {
01075                                 usedInputRegisters |= <a class="code" href="namespaceNL3D.html#a357">convInputRegisterToVBFlag</a>(op.<a class="code" href="structCVPOperand.html#m5">Value</a>.InputRegisterValue);
01076                         }
01077                 }               
01078         }
01079 
01080 <font class="preprocessor">#ifdef DEBUG_SETUP_EXT_VERTEX_SHADER</font>
01081 <font class="preprocessor"></font>        <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"========================"</font>);
01082         <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"num Opcode  = %d"</font>, numOp);
01083         <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"num Indexing = %d"</font>, numOpIndex);
01084         <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"num Swizzle = %d"</font>, numSwizzle);
01085         <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"num extract component = %d"</font>, numEC);
01086         <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"num insert component = %d"</font>, numIC);     
01087         <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"num write mask = %d"</font>, numWM);
01088 <font class="preprocessor">#endif</font>
01089 <font class="preprocessor"></font>
01090         <font class="keywordflow">return</font> <font class="keyword">true</font>;
01091                         
01092 }
01093 
01094 <font class="comment">// ***************************************************************************</font>
<a name="l01095"></a><a class="code" href="classNL3D_1_1CDriverGL.html#z414_1">01095</a> <font class="keywordtype">bool</font> CDriverGL::activeEXTVertexShader (CVertexProgram *<a class="code" href="driver__opengl__extension__def_8h.html#a360">program</a>)
01096 {
01097         <font class="comment">// Setup or unsetup ?</font>
01098         <font class="keywordflow">if</font> (program)
01099         {               
01100                 <font class="comment">// Driver info</font>
01101                 <a class="code" href="classNL3D_1_1CDriverGL.html#l1">CVertexProgamDrvInfosGL</a> *drvInfo;
01102 
01103                 <font class="comment">// Program setuped ?</font>
01104                 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a360">program</a>-&gt;_DrvInfo==NULL)
01105                 {
01106                         <font class="comment">// try to parse the program</font>
01107                         <a class="code" href="classCVPParser.html">CVPParser</a> parser;
01108                         <a class="code" href="classCVPParser.html#s0">CVPParser::TProgram</a> parsedProgram;
01109                         std::string errorOutput;
01110                         <font class="keywordtype">bool</font> result = parser.<a class="code" href="classCVPParser.html#a0">parse</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a360">program</a>-&gt;getProgram().c_str(), parsedProgram, errorOutput);
01111                         <font class="keywordflow">if</font> (!result)
01112                         {
01113                                 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"Unable to parse a vertex program."</font>);
01114 <font class="preprocessor">                                #ifdef NL_DEBUG</font>
01115 <font class="preprocessor"></font>                                        <a class="code" href="debug_8h.html#a3">nlerror</a>(errorOutput.c_str());
01116 <font class="preprocessor">                                #endif</font>
01117 <font class="preprocessor"></font>                                <font class="keywordflow">return</font> <font class="keyword">false</font>;
01118                         }
01119 
01120                         <font class="comment">/* </font>
01121 <font class="comment">                        FILE *f = fopen("c:\\test.txt", "wb");</font>
01122 <font class="comment">                        if (f)</font>
01123 <font class="comment">                        {</font>
01124 <font class="comment">                                std::string vpText;</font>
01125 <font class="comment">                                CVPParser::dump(parsedProgram, vpText);</font>
01126 <font class="comment">                                fwrite(vpText.c_str(), vpText.size(), 1, f);</font>
01127 <font class="comment">                                fclose(f);</font>
01128 <font class="comment">                        }</font>
01129 <font class="comment">                        */</font>
01130 
01131                         <font class="comment">// Insert into driver list. (so it is deleted when driver is deleted).</font>
01132                         <a class="code" href="namespaceNL3D.html#a297">ItVtxPrgDrvInfoPtrList</a>  it= <a class="code" href="classNL3D_1_1IDriver.html#n5">_VtxPrgDrvInfos</a>.insert(<a class="code" href="classNL3D_1_1IDriver.html#n5">_VtxPrgDrvInfos</a>.end());
01133 
01134                         <font class="comment">// Create a driver info</font>
01135                         *it = drvInfo = <font class="keyword">new</font> <a class="code" href="classNL3D_1_1CDriverGL.html#l1">CVertexProgamDrvInfosGL</a> (<font class="keyword">this</font>, it);
01136                         <font class="comment">// Set the pointer</font>
01137                         <a class="code" href="driver__opengl__extension__def_8h.html#a360">program</a>-&gt;_DrvInfo=drvInfo;
01138 
01139                         <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CDriverGL.html#z417_1">setupEXTVertexShader</a>(parsedProgram, drvInfo-&gt;ID, drvInfo-&gt;Variants, drvInfo-&gt;UsedVertexComponents))
01140                         {
01141                                 <font class="keyword">delete</font> drvInfo;
01142                                 <a class="code" href="driver__opengl__extension__def_8h.html#a360">program</a>-&gt;_DrvInfo = NULL;
01143                                 <a class="code" href="classNL3D_1_1IDriver.html#n5">_VtxPrgDrvInfos</a>.erase(it);
01144                                 <font class="keywordflow">return</font> <font class="keyword">false</font>;
01145                         }
01146                 }
01147                 <font class="keywordflow">else</font>
01148                 {
01149                         <font class="comment">// Cast the driver info pointer</font>
01150                         drvInfo=safe_cast&lt;CVertexProgamDrvInfosGL*&gt;((<a class="code" href="classNL3D_1_1IDriver.html#l4">IVertexProgramDrvInfos</a>*)<a class="code" href="driver__opengl__extension__def_8h.html#a360">program</a>-&gt;_DrvInfo);
01151                 }
01152 
01153                 glEnable( <a class="code" href="driver__opengl__extension__def_8h.html#a221">GL_VERTEX_SHADER_EXT</a>);
01154                 <a class="code" href="classNL3D_1_1CDriverGL.html#o24">_VertexProgramEnabled</a> = <font class="keyword">true</font>;
01155                 <a class="code" href="driver__opengl__extension_8h.html#a118">nglBindVertexShaderEXT</a>( drvInfo-&gt;ID );
01156                 <a class="code" href="classNL3D_1_1CDriverGL.html#o26">_LastSetuppedVP</a> = <a class="code" href="driver__opengl__extension__def_8h.html#a360">program</a>;
01157         }
01158         <font class="keywordflow">else</font>
01159         {
01160                 glDisable( <a class="code" href="driver__opengl__extension__def_8h.html#a221">GL_VERTEX_SHADER_EXT</a> );
01161                 <a class="code" href="classNL3D_1_1CDriverGL.html#o24">_VertexProgramEnabled</a> = <font class="keyword">false</font>;
01162         }
01163         <font class="keywordflow">return</font> <font class="keyword">true</font>;    
01164 }
01165 
01166 <font class="comment">// ***************************************************************************</font>
<a name="l01167"></a><a class="code" href="classNL3D_1_1CDriverGL.html#z413_2">01167</a> <font class="keywordtype">bool</font> CDriverGL::activeVertexProgram (CVertexProgram *<a class="code" href="driver__opengl__extension__def_8h.html#a360">program</a>)
01168 {
01169         <font class="comment">// Extension here ?</font>
01170         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.NVVertexProgram)
01171         {
01172                 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CDriverGL.html#z414_0">activeNVVertexProgram</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a360">program</a>);
01173         }
01174         <font class="keywordflow">else</font> <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.EXTVertexShader)
01175         {
01176                 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CDriverGL.html#z414_1">activeEXTVertexShader</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a360">program</a>);          
01177         }
01178 
01179         <font class="comment">// Can't do anything</font>
01180         <font class="keywordflow">return</font> <font class="keyword">false</font>;
01181 }
01182 
01183 
01184 <font class="comment">// ***************************************************************************</font>
01185 
<a name="l01186"></a><a class="code" href="classNL3D_1_1CDriverGL.html#z413_3">01186</a> <font class="keywordtype">void</font> CDriverGL::setConstant (uint <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, <font class="keywordtype">float</font> f0, <font class="keywordtype">float</font> f1, <font class="keywordtype">float</font> f2, <font class="keywordtype">float</font> f3)
01187 {
01188         <font class="comment">// Vertex program exist ?</font>
01189         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.NVVertexProgram)
01190         {
01191                 <font class="comment">// Setup constant</font>
01192                 <a class="code" href="driver__opengl__extension_8h.html#a71">nglProgramParameter4fNV</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a1">GL_VERTEX_PROGRAM_NV</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, f0, f1, f2, f3);
01193         }
01194         <font class="keywordflow">else</font> <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.EXTVertexShader)
01195         {
01196                 <font class="keywordtype">float</font> datas[] = { f0, f1, f2, f3 };
01197                 <a class="code" href="driver__opengl__extension_8h.html#a129">nglSetInvariantEXT</a>(<a class="code" href="classNL3D_1_1CDriverGL.html#z417_6">_EVSConstantHandle</a> + <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, GL_FLOAT, datas);
01198         }                
01199 }
01200 
01201 
01202 <font class="comment">// ***************************************************************************</font>
01203 
<a name="l01204"></a><a class="code" href="classNL3D_1_1CDriverGL.html#z413_4">01204</a> <font class="keywordtype">void</font> CDriverGL::setConstant (uint <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, <font class="keywordtype">double</font> d0, <font class="keywordtype">double</font> d1, <font class="keywordtype">double</font> d2, <font class="keywordtype">double</font> d3)
01205 {
01206         <font class="comment">// Vertex program exist ?</font>
01207         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.NVVertexProgram)
01208         {
01209                 <font class="comment">// Setup constant</font>
01210                 <a class="code" href="driver__opengl__extension_8h.html#a69">nglProgramParameter4dNV</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a1">GL_VERTEX_PROGRAM_NV</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, d0, d1, d2, d3);
01211         }
01212         <font class="keywordflow">else</font> <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.EXTVertexShader)
01213         {
01214                 <font class="keywordtype">double</font> datas[] = { d0, d1, d2, d3 };
01215                 <a class="code" href="driver__opengl__extension_8h.html#a129">nglSetInvariantEXT</a>(<a class="code" href="classNL3D_1_1CDriverGL.html#z417_6">_EVSConstantHandle</a> + <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, GL_DOUBLE, datas);
01216         }
01217 }
01218 
01219 
01220 <font class="comment">// ***************************************************************************</font>
01221 
<a name="l01222"></a><a class="code" href="classNL3D_1_1CDriverGL.html#z413_5">01222</a> <font class="keywordtype">void</font> CDriverGL::setConstant (uint <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>&amp; <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>)
01223 {
01224         <font class="comment">// Vertex program exist ?</font>
01225         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.NVVertexProgram)
01226         {
01227                 <font class="comment">// Setup constant</font>
01228                 <a class="code" href="driver__opengl__extension_8h.html#a71">nglProgramParameter4fNV</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a1">GL_VERTEX_PROGRAM_NV</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, value.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a>, value.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>, value.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a>, 0);    
01229         }
01230         <font class="keywordflow">else</font> <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.EXTVertexShader)
01231         {
01232                 <font class="keywordtype">float</font> datas[] = { value.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a>, value.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>, value.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a>, 0 };
01233                 <a class="code" href="driver__opengl__extension_8h.html#a129">nglSetInvariantEXT</a>(<a class="code" href="classNL3D_1_1CDriverGL.html#z417_6">_EVSConstantHandle</a> + <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, GL_FLOAT, datas);
01234         }
01235 }
01236 
01237 
01238 <font class="comment">// ***************************************************************************</font>
01239 
<a name="l01240"></a><a class="code" href="classNL3D_1_1CDriverGL.html#z413_6">01240</a> <font class="keywordtype">void</font> CDriverGL::setConstant (uint <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVectorD.html">NLMISC::CVectorD</a>&amp; <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>)
01241 {
01242         <font class="comment">// Vertex program exist ?</font>
01243         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.NVVertexProgram)
01244         {
01245                 <font class="comment">// Setup constant</font>
01246                 <a class="code" href="driver__opengl__extension_8h.html#a69">nglProgramParameter4dNV</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a1">GL_VERTEX_PROGRAM_NV</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, value.<a class="code" href="classNLMISC_1_1CVectorD.html#m0">x</a>, value.<a class="code" href="classNLMISC_1_1CVectorD.html#m1">y</a>, value.<a class="code" href="classNLMISC_1_1CVectorD.html#m2">z</a>, 0);
01247         }
01248         <font class="keywordflow">else</font> <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.EXTVertexShader)
01249         {
01250                 <font class="keywordtype">double</font> datas[] = { value.<a class="code" href="classNLMISC_1_1CVectorD.html#m0">x</a>, value.<a class="code" href="classNLMISC_1_1CVectorD.html#m1">y</a>, value.<a class="code" href="classNLMISC_1_1CVectorD.html#m2">z</a>, 0 };
01251                 <a class="code" href="driver__opengl__extension_8h.html#a129">nglSetInvariantEXT</a>(<a class="code" href="classNL3D_1_1CDriverGL.html#z417_6">_EVSConstantHandle</a> + <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, GL_DOUBLE, datas);
01252         }
01253 }
01254 
01255 
01256 <font class="comment">// ***************************************************************************</font>
<a name="l01257"></a><a class="code" href="classNL3D_1_1CDriverGL.html#z413_7">01257</a> <font class="keywordtype">void</font>    CDriverGL::setConstant (uint <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, uint <a class="code" href="driver__opengl__extension__def_8h.html#a410">num</a>, <font class="keyword">const</font> <font class="keywordtype">float</font> *<a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a>)
01258 {
01259         <font class="comment">// Vertex program exist ?</font>
01260         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.NVVertexProgram)
01261         {
01262                 <a class="code" href="driver__opengl__extension_8h.html#a74">nglProgramParameters4fvNV</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a1">GL_VERTEX_PROGRAM_NV</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a410">num</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a>);
01263         }       
01264         <font class="keywordflow">else</font> <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.EXTVertexShader)
01265         {
01266                 <font class="keywordflow">for</font>(uint k = 0; k &lt; <a class="code" href="driver__opengl__extension__def_8h.html#a410">num</a>; ++k)
01267                 {                                       
01268                         <a class="code" href="driver__opengl__extension_8h.html#a129">nglSetInvariantEXT</a>(<a class="code" href="classNL3D_1_1CDriverGL.html#z417_6">_EVSConstantHandle</a> + <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> + k, GL_FLOAT, (<font class="keywordtype">void</font> *) (<a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a> + 4 * k));
01269                 }
01270         }       
01271 }
01272 
01273 <font class="comment">// ***************************************************************************</font>
<a name="l01274"></a><a class="code" href="classNL3D_1_1CDriverGL.html#z413_8">01274</a> <font class="keywordtype">void</font>    CDriverGL::setConstant (uint <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, uint <a class="code" href="driver__opengl__extension__def_8h.html#a410">num</a>, <font class="keyword">const</font> <font class="keywordtype">double</font> *<a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a>)
01275 {
01276         <font class="comment">// Vertex program exist ?</font>
01277         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.NVVertexProgram)
01278         {
01279                 <a class="code" href="driver__opengl__extension_8h.html#a73">nglProgramParameters4dvNV</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a1">GL_VERTEX_PROGRAM_NV</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a410">num</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a>);
01280         }
01281         <font class="keywordflow">else</font> <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.EXTVertexShader)
01282         {
01283                 <font class="keywordflow">for</font>(uint k = 0; k &lt; <a class="code" href="driver__opengl__extension__def_8h.html#a410">num</a>; ++k)
01284                 {                                       
01285                         <a class="code" href="driver__opengl__extension_8h.html#a129">nglSetInvariantEXT</a>(<a class="code" href="classNL3D_1_1CDriverGL.html#z417_6">_EVSConstantHandle</a> + <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> + k, GL_DOUBLE, (<font class="keywordtype">void</font> *) (<a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a> + 4 * k));
01286                 }
01287         }
01288 }
01289 
01290 <font class="comment">// ***************************************************************************</font>
01291 
<a name="l01292"></a><a class="code" href="classNL3D_1_1CDriverGL.html#r4">01292</a> <font class="keyword">const</font> uint CDriverGL::GLMatrix[IDriver::NumMatrix]=
01293 {
01294         GL_MODELVIEW,
01295         GL_PROJECTION,
01296         <a class="code" href="driver__opengl__extension__def_8h.html#a9">GL_MODELVIEW_PROJECTION_NV</a>
01297 };
01298 
01299 
01300 <font class="comment">// ***************************************************************************</font>
01301 
<a name="l01302"></a><a class="code" href="classNL3D_1_1CDriverGL.html#r5">01302</a> <font class="keyword">const</font> uint CDriverGL::GLTransform[IDriver::NumTransform]=
01303 {
01304         <a class="code" href="driver__opengl__extension__def_8h.html#a10">GL_IDENTITY_NV</a>,
01305         <a class="code" href="driver__opengl__extension__def_8h.html#a11">GL_INVERSE_NV</a>,
01306         <a class="code" href="driver__opengl__extension__def_8h.html#a12">GL_TRANSPOSE_NV</a>,
01307         <a class="code" href="driver__opengl__extension__def_8h.html#a13">GL_INVERSE_TRANSPOSE_NV</a>
01308 };
01309 
01310 
01311 <font class="comment">// ***************************************************************************</font>
01312 
<a name="l01313"></a><a class="code" href="classNL3D_1_1CDriverGL.html#z413_9">01313</a> <font class="keywordtype">void</font> CDriverGL::setConstantMatrix (uint <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, IDriver::TMatrix <a class="code" href="driver__opengl__extension__def_8h.html#a370">matrix</a>, IDriver::TTransform <a class="code" href="driver__opengl__extension__def_8h.html#a371">transform</a>)
01314 {
01315         <font class="comment">// Vertex program exist ?</font>
01316         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.NVVertexProgram)
01317         {
01318                 <font class="comment">// First, ensure that the render setup is correclty setuped.</font>
01319                 <a class="code" href="classNL3D_1_1CDriverGL.html#c25">refreshRenderSetup</a>();
01320 
01321                 <font class="comment">// Track the matrix</font>
01322                 <a class="code" href="driver__opengl__extension_8h.html#a76">nglTrackMatrixNV</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a1">GL_VERTEX_PROGRAM_NV</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, <a class="code" href="classNL3D_1_1CDriverGL.html#r4">GLMatrix</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a370">matrix</a>], <a class="code" href="classNL3D_1_1CDriverGL.html#r5">GLTransform</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a371">transform</a>]);
01323                 <font class="comment">// Release Track =&gt; matrix data is copied.</font>
01324                 <a class="code" href="driver__opengl__extension_8h.html#a76">nglTrackMatrixNV</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a1">GL_VERTEX_PROGRAM_NV</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, GL_NONE, <a class="code" href="driver__opengl__extension__def_8h.html#a10">GL_IDENTITY_NV</a>);
01325         }
01326         <font class="keywordflow">else</font> <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.EXTVertexShader)
01327         {
01328                 <font class="comment">// First, ensure that the render setup is correctly setuped.</font>
01329                 <a class="code" href="classNL3D_1_1CDriverGL.html#c25">refreshRenderSetup</a>();           
01330                 CMatrix mat;            
01331                 <font class="keywordflow">switch</font> (matrix)
01332                 {
01333                         <font class="keywordflow">case</font> IDriver::ModelView:
01334                                 mat = <a class="code" href="classNL3D_1_1CDriverGL.html#o15">_ModelViewMatrix</a>;
01335                         <font class="keywordflow">break</font>;
01336                         <font class="keywordflow">case</font> IDriver::Projection:
01337                         {
01338                                 <a class="code" href="classNL3D_1_1CDriverGL.html#c0">refreshProjMatrixFromGL</a>();
01339                                 mat = <a class="code" href="classNL3D_1_1CDriverGL.html#o8">_GLProjMat</a>;
01340                         }
01341                         <font class="keywordflow">break</font>;
01342                         <font class="keywordflow">case</font> IDriver::ModelViewProjection:
01343                                 <a class="code" href="classNL3D_1_1CDriverGL.html#c0">refreshProjMatrixFromGL</a>();                              
01344                                 mat = <a class="code" href="classNL3D_1_1CDriverGL.html#o8">_GLProjMat</a> * <a class="code" href="classNL3D_1_1CDriverGL.html#o15">_ModelViewMatrix</a>;
01345                         <font class="keywordflow">break</font>;
01346                 }
01347 
01348                 <font class="keywordflow">switch</font>(transform)
01349                 {
01350                         <font class="keywordflow">case</font> IDriver::Identity: <font class="keywordflow">break</font>;
01351                         <font class="keywordflow">case</font> IDriver::Inverse:
01352                                 mat.invert();
01353                         <font class="keywordflow">break</font>;          
01354                         <font class="keywordflow">case</font> IDriver::Transpose:
01355                                 mat.transpose();                                                                
01356                         <font class="keywordflow">break</font>;
01357                         <font class="keywordflow">case</font> IDriver::InverseTranspose:
01358                                 mat.invert();
01359                                 mat.transpose();                                
01360                         <font class="keywordflow">break</font>;
01361                 }
01362                 mat.transpose();
01363                 <font class="keywordtype">float</font> matDatas[16];
01364                 mat.get(matDatas);
01365                 <a class="code" href="driver__opengl__extension_8h.html#a129">nglSetInvariantEXT</a>(<a class="code" href="classNL3D_1_1CDriverGL.html#z417_6">_EVSConstantHandle</a> + <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, GL_FLOAT, matDatas);
01366                 <a class="code" href="driver__opengl__extension_8h.html#a129">nglSetInvariantEXT</a>(<a class="code" href="classNL3D_1_1CDriverGL.html#z417_6">_EVSConstantHandle</a> + <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> + 1, GL_FLOAT, matDatas + 4);
01367                 <a class="code" href="driver__opengl__extension_8h.html#a129">nglSetInvariantEXT</a>(<a class="code" href="classNL3D_1_1CDriverGL.html#z417_6">_EVSConstantHandle</a> + <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> + 2, GL_FLOAT, matDatas + 8);
01368                 <a class="code" href="driver__opengl__extension_8h.html#a129">nglSetInvariantEXT</a>(<a class="code" href="classNL3D_1_1CDriverGL.html#z417_6">_EVSConstantHandle</a> + <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> + 3, GL_FLOAT, matDatas + 12);
01369         }                
01370 }
01371 
01372 <font class="comment">// ***************************************************************************</font>
01373 
<a name="l01374"></a><a class="code" href="classNL3D_1_1CDriverGL.html#z413_10">01374</a> <font class="keywordtype">void</font> CDriverGL::enableVertexProgramDoubleSidedColor(<font class="keywordtype">bool</font> doubleSided)
01375 {
01376         <font class="comment">// Vertex program exist ?</font>
01377         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.NVVertexProgram)
01378         {
01379                 <font class="comment">// change mode (not cached because supposed to be rare)</font>
01380                 <font class="keywordflow">if</font>(doubleSided)
01381                         glEnable (<a class="code" href="driver__opengl__extension__def_8h.html#a27">GL_VERTEX_PROGRAM_TWO_SIDE_NV</a>);
01382                 <font class="keywordflow">else</font>
01383                         glDisable (<a class="code" href="driver__opengl__extension__def_8h.html#a27">GL_VERTEX_PROGRAM_TWO_SIDE_NV</a>);
01384         }       
01385 }
01386 
01387 
01388 <font class="comment">// ***************************************************************************</font>
<a name="l01389"></a><a class="code" href="classNL3D_1_1CDriverGL.html#z413_11">01389</a> <font class="keywordtype">bool</font> CDriverGL::supportVertexProgramDoubleSidedColor()<font class="keyword"> const</font>
01390 <font class="keyword"></font>{
01391         <font class="comment">// currenlty only supported by NV_VERTEX_PROGRAM</font>
01392         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.NVVertexProgram;
01393 }
01394 
01395 
01396 } <font class="comment">// NL3D</font>
</pre></div>

<!-- footer -->
<BR><FONT Size=+5>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </FONT>
</TD>
<TD WIDTH=15><IMG  SRC=/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
</TR>
</TABLE>
</BODY>
</HTML>