2
0
Эх сурвалжийг харах

Added array access operator to Vec in hxsl

TothBenoit 1 жил өмнө
parent
commit
9b96e0dc00
2 өөрчлөгдсөн 5 нэмэгдсэн , 1 устгасан
  1. 4 0
      hxsl/Checker.hx
  2. 1 1
      hxsl/Flatten.hx

+ 4 - 0
hxsl/Checker.hx

@@ -722,6 +722,10 @@ class Checker {
 				type = vec3;
 			case TMat4, TMat3x4:
 				type = vec4;
+			case TVec(_, VFloat):
+				type = TFloat;
+			case TVec(_, VInt):
+				type = TInt;
 			default:
 				error("Cannot index " + e1.t.toString() + " : should be an array", e.pos);
 			}

+ 1 - 1
hxsl/Flatten.hx

@@ -148,7 +148,7 @@ class Flatten {
 				case TArray(t, _) if( t.isTexture() ):
 					eindex = toInt(mapExpr(eindex));
 					access(a, t, vp, AOffset(a,1,eindex));
-				case TBuffer(TInt|TFloat,_):
+				case TBuffer(TInt|TFloat,_), TVec(_, VFloat|VInt):
 					e.map(mapExpr);
 				case TArray(t, _), TBuffer(t, _):
 					var stride = varSize(t, a.t);