Selaa lähdekoodia

Fix hxsl checker bug where const can't have the same name with import with another shader.
The fix consist in reorder the check of double declaration with the skip of params.

borisrp 8 kuukautta sitten
vanhempi
commit
39fc038939
1 muutettua tiedostoa jossa 4 lisäystä ja 3 poistoa
  1. 4 3
      hxsl/Checker.hx

+ 4 - 3
hxsl/Checker.hx

@@ -799,12 +799,13 @@ class Checker {
 					checkConst(e);
 					checkConst(e);
 					einit = e;
 					einit = e;
 				}
 				}
-				if( v.type == null ) error("Type required for variable declaration", e.pos);
-				if( vars.exists(v.name) ) error("Duplicate var decl '" + v.name + "'", e.pos);
-				var v = makeVar(v, e.pos);
+				if( v.type == null ) error("Type required for variable declaration", e.pos);				
 				if( isImport && v.kind == Param )
 				if( isImport && v.kind == Param )
 					continue;
 					continue;
 
 
+				if( vars.exists(v.name) ) error("Duplicate var decl '" + v.name + "'", e.pos);
+				var v = makeVar(v, e.pos);
+
 				switch( v.type ) {
 				switch( v.type ) {
 				case TSampler(T3D, true), TRWTexture(T3D, true, _), TRWTexture(_,_,3):
 				case TSampler(T3D, true), TRWTexture(T3D, true, _), TRWTexture(_,_,3):
 					error("Unsupported texture type", e.pos);
 					error("Unsupported texture type", e.pos);