@@ -5,25 +5,6 @@ test("Tests from previous Lux bugs", function() {
55 { "type" : "constant" , "guid" :9997 , "parents" : [ ] , "values" : [ 0 ] } ,
66 { "type" : "constant" , "guid" :9996 , "parents" : [ ] , "values" : [ 1 ] } ] } ;
77
8- // var condition = {"type":"gt","guid":245,"parents":[
9- // {"type":"swizzle{z}","guid":243,"parents":[
10- // {"type":"cross","guid":242,"parents":[
11- // {"type":"normalize","guid":238,"parents":[
12- // {"type":"cross","guid":237,"parents":[
13- // {"type":"dFdx","guid":235,"parents":[
14- // {"type":"div","guid":234,"parents":[
15- // {"type":"swizzle{xyz}","guid":232,"parents":[{"type":"reference","guid":227}] },
16- // {"type":"swizzle{w}","guid":233,"parents":[{"type":"reference","guid":227}] }] }] },
17- // {"type":"dFdy","guid":236,"parents":[{"type":"reference","guid":234}] }] }] },
18- // {"type":"vec","guid":241,"parents":[
19- // {"type":"constant","guid":239,"parents":[],"values":[0]},
20- // {"type":"constant","guid":240,"parents":[],"values":[0]},
21- // {"type":"ifelse","guid":231,"parents":[
22- // {"type":"constant","guid":228,"parents":[],"values":[true]},
23- // {"type":"constant","guid":229,"parents":[],"values":[1]},
24- // {"type":"constant","guid":230,"parents":[],"values":[-1]}] }] }] }] },
25- // {"type":"constant","guid":244,"parents":[],"values":[0]}] };
26-
278 var condition = { "type" :"gt" , "guid" :245 , "parents" :[
289 { "type" :"swizzle{z}" , "guid" :243 , "parents" :[
2910 { "type" :"dFdx" , "guid" :235 , "parents" :[
@@ -33,11 +14,32 @@ test("Tests from previous Lux bugs", function() {
3314 { "type" :"constant" , "guid" :244 , "parents" :[ ] , "values" :[ 0 ] } ] } ;
3415
3516 var node = { "type" :"discard_if" , "guid" :246 , "parents" :[ exp , condition ] } ;
36-
3717 var node_exp = Shade . Debug . from_json ( node ) ;
3818 var prog = { position : node_exp ,
3919 color : Shade . vec ( 0 , 0 , 0 , 1 ) } ;
4020
41- debugger ;
21+ ok ( Shade . program ( prog ) , "backface culling should not crash optimizer" ) ;
22+
23+ var condition2 = { "type" :"gt" , "guid" :245 , "parents" :[
24+ { "type" :"swizzle{z}" , "guid" :243 , "parents" :[
25+ { "type" :"cross" , "guid" :242 , "parents" :[
26+ { "type" :"normalize" , "guid" :238 , "parents" :[
27+ { "type" :"cross" , "guid" :237 , "parents" :[
28+ { "type" :"dFdx" , "guid" :235 , "parents" :[
29+ { "type" :"div" , "guid" :234 , "parents" :[
30+ { "type" :"swizzle{xyz}" , "guid" :232 , "parents" :[ { "type" :"reference" , "guid" :227 } ] } ,
31+ { "type" :"swizzle{w}" , "guid" :233 , "parents" :[ { "type" :"reference" , "guid" :227 } ] } ] } ] } ,
32+ { "type" :"dFdy" , "guid" :236 , "parents" :[ { "type" :"reference" , "guid" :234 } ] } ] } ] } ,
33+ { "type" :"vec" , "guid" :241 , "parents" :[
34+ { "type" :"constant" , "guid" :239 , "parents" :[ ] , "values" :[ 0 ] } ,
35+ { "type" :"constant" , "guid" :240 , "parents" :[ ] , "values" :[ 0 ] } ,
36+ { "type" :"ifelse" , "guid" :231 , "parents" :[
37+ { "type" :"constant" , "guid" :228 , "parents" :[ ] , "values" :[ true ] } ,
38+ { "type" :"constant" , "guid" :229 , "parents" :[ ] , "values" :[ 1 ] } ,
39+ { "type" :"constant" , "guid" :230 , "parents" :[ ] , "values" :[ - 1 ] } ] } ] } ] } ] } ,
40+ { "type" :"constant" , "guid" :244 , "parents" :[ ] , "values" :[ 0 ] } ] } ;
41+ var prog2 = { position : Shade . Debug . from_json ( { "type" :"discard_if" , "guid" :246 , "parents" :[ exp , condition2 ] } ) ,
42+ color : Shade . vec ( 0 , 0 , 0 , 1 ) } ;
43+
4244 ok ( Shade . program ( prog ) , "backface culling should not crash optimizer" ) ;
4345} ) ;
0 commit comments