Browse Source

Sort textures format during flatten.

clementlandrin 1 year ago
parent
commit
03cbe4a163
1 changed files with 7 additions and 0 deletions
  1. 7 0
      hxsl/Flatten.hx

+ 7 - 0
hxsl/Flatten.hx

@@ -50,6 +50,13 @@ class Flatten {
 		pack(prefix + "Globals", Global, globals, VFloat);
 		pack(prefix + "Params", Param, params, VFloat);
 		var allVars = globals.concat(params);
+		textureFormats.sort(function(t1,t2) {
+			if ( t1.rw != t2.rw )
+				return t1.rw - t2.rw;
+			if ( t1.arr != t2.arr )
+				return t1.arr ? 1 : -1;
+			return t1.dim.getIndex() - t2.dim.getIndex();
+		});
 		for( t in textureFormats ) {
 			var name = t.dim == T2D ? "" : t.dim.getName().substr(1);
 			if( t.rw > 0 ) name = "RW"+name+t.rw;