Sfoglia il codice sorgente

add basic check for duplicates in ShaderList

trethaller 3 anni fa
parent
commit
b9e41d02b5
1 ha cambiato i file con 3 aggiunte e 0 eliminazioni
  1. 3 0
      hxsl/ShaderList.hx

+ 3 - 0
hxsl/ShaderList.hx

@@ -36,12 +36,15 @@ class ShaderList {
 	}
 
 	public static var MAX_LIST_SIZE = 0;
+	public static var ALLOW_DUPLICATES = true;
 	static function checkSize(list : ShaderList) {
 		if(MAX_LIST_SIZE <= 0)
 			return;
 		var hd = list;
 		var count = 0;
 		while(hd != null) {
+			if(!ALLOW_DUPLICATES && hd.next != null && hd.next.s == hd.s)
+				throw "Duplicate shader " + Std.string(hd.s);
 			++count;
 			hd = hd.next;
 		}