瀏覽代碼

added error when buffer found but type mismatch

Nicolas Cannasse 2 年之前
父節點
當前提交
3a5155c9bc
共有 1 個文件被更改,包括 8 次插入3 次删除
  1. 8 3
      hxd/BufferFormat.hx

+ 8 - 3
hxd/BufferFormat.hx

@@ -360,18 +360,23 @@ class MultiFormat {
 	function makeMapping( format : hxd.BufferFormat ) {
 	function makeMapping( format : hxd.BufferFormat ) {
 		var m = [];
 		var m = [];
 		for( input in format.getInputs() ) {
 		for( input in format.getInputs() ) {
-			var found = false;
+			var found = false, match = null;
 			for( idx => f in formats ) {
 			for( idx => f in formats ) {
 				var i = f.getInput(input.name);
 				var i = f.getInput(input.name);
-				if( i != null && i.type == input.type ) {
+				if( i != null ) {
+					match = i;
+					if( i.type != input.type ) continue;
 					var offset = f.calculateInputOffset(i.name);
 					var offset = f.calculateInputOffset(i.name);
 					m.push(new BufferMapping(idx,offset,i.precision));
 					m.push(new BufferMapping(idx,offset,i.precision));
 					found = true;
 					found = true;
 					break;
 					break;
 				}
 				}
 			}
 			}
-			if( !found )
+			if( !found ) {
+				if( match != null )
+					throw "Shader buffer "+input.name+" was requested with "+input.type+" but found with "+match.type;
 				throw "Missing shader buffer "+input.name;
 				throw "Missing shader buffer "+input.name;
+			}
 		}
 		}
 		mappings[format.uid] = m;
 		mappings[format.uid] = m;
 		return m;
 		return m;