@@ -3,6 +3,7 @@ package hrt.shgraph;
using hxsl.Ast;
using Lambda;
using hrt.shgraph.Utils;
+using hrt.tools.MapUtils;
import hrt.shgraph.AstTools.*;
import hrt.shgraph.ShaderGraph;
import hrt.shgraph.ShaderNode;
@@ -3,6 +3,8 @@ package hrt.shgraph;
import hxsl.Ast.TExpr;
+
typedef CacheEntry = {expr: TExpr, inputs: Array<ShaderNode.InputInfo>, outputs: Array<ShaderNode.OutputInfo>, idInputOrder: Map<Int, Int>, idOutputOrder: Map<Int,Int>};
@@ -1,16 +1,5 @@
package hrt.shgraph;
-class MapUtils {
- public static inline function getOrPut<K,V>(map: Map<K,V>, key: K, def: V) : V {
- var v = map.get(key);
- if (v == null) {
- v = def;
- map.set(key,v);
- }
- return v;
-}
-
class ArrayUtils {
public static inline function getOrPut<V>(array: Array<V>, pos: Int, def: V) : V {
var v = array[pos];
@@ -0,0 +1,12 @@
+package hrt.tools;
+class MapUtils {
+ public static inline function getOrPut<K,V>(map: Map<K,V>, key: K, def: V) : V {
+ var v = map.get(key);
+ if (v == null) {
+ v = def;
+ map.set(key,v);
+ }
+ return v;
+}