فهرست منبع

HXSL : - Added support for unbound buffer for RWBuffer and RWPartialBuffer.

TothBenoit 1 سال پیش
والد
کامیت
407bd4a5dd
3فایلهای تغییر یافته به همراه15 افزوده شده و 8 حذف شده
  1. 2 0
      hxsl/GlslOut.hx
  2. 2 8
      hxsl/HlslOut.hx
  3. 11 0
      hxsl/MacroParser.hx

+ 2 - 0
hxsl/GlslOut.hx

@@ -196,6 +196,7 @@ class GlslOut {
 			switch( size ) {
 			switch( size ) {
 			case SVar(v):
 			case SVar(v):
 				ident(v);
 				ident(v);
+			case SConst(0):
 			case SConst(1) if( intelDriverFix ):
 			case SConst(1) if( intelDriverFix ):
 				add(2);
 				add(2);
 			case SConst(v):
 			case SConst(v):
@@ -219,6 +220,7 @@ class GlslOut {
 			add("[");
 			add("[");
 			switch( size ) {
 			switch( size ) {
 			case SVar(v): ident(v);
 			case SVar(v): ident(v);
+			case SConst(0):
 			case SConst(1) if( intelDriverFix ): add(2);
 			case SConst(1) if( intelDriverFix ): add(2);
 			case SConst(n): add(n);
 			case SConst(n): add(n);
 			}
 			}

+ 2 - 8
hxsl/HlslOut.hx

@@ -187,14 +187,7 @@ class HlslOut {
 			add("function");
 			add("function");
 		case TArray(t, size), TBuffer(t,size,_):
 		case TArray(t, size), TBuffer(t,size,_):
 			addType(t);
 			addType(t);
-			add("[");
-			switch( size ) {
-			case SVar(v):
-				ident(v);
-			case SConst(v):
-				add(v);
-			}
-			add("]");
+			addArraySize(size);
 		case TChannel(n):
 		case TChannel(n):
 			add("channel" + n);
 			add("channel" + n);
 		}
 		}
@@ -204,6 +197,7 @@ class HlslOut {
 		add("[");
 		add("[");
 		switch( size ) {
 		switch( size ) {
 		case SVar(v): ident(v);
 		case SVar(v): ident(v);
+		case SConst(0):
 		case SConst(n): add(n);
 		case SConst(n): add(n);
 		}
 		}
 		add("]");
 		add("]");

+ 11 - 0
hxsl/MacroParser.hx

@@ -147,6 +147,17 @@ class MacroParser {
 			var t = getTexDim(name.substr(9), (dim,arr) -> TRWTexture(dim,arr,chans));
 			var t = getTexDim(name.substr(9), (dim,arr) -> TRWTexture(dim,arr,chans));
 			if( t != null )
 			if( t != null )
 				return t;
 				return t;
+		case TPath( { pack : [], name : name = ("RWBuffer"|"RWPartialBuffer"), sub : null, params : [t] } ):
+			var t = switch( t ) {
+				case TPType(t): parseType(t, pos);
+				default: null;
+				}
+			if( t != null )
+				return switch( name ) {
+				case "RWBuffer": TBuffer(t,SConst(0),RW);
+				case "RWPartialBuffer": TBuffer(t,SConst(0),RWPartial);
+				default: throw "assert";
+				}
 		case TPath( { pack : [], name : name = ("Array"|"Buffer"|"RWBuffer"|"PartialBuffer"|"RWPartialBuffer"), sub : null, params : [t, size] } ):
 		case TPath( { pack : [], name : name = ("Array"|"Buffer"|"RWBuffer"|"PartialBuffer"|"RWPartialBuffer"), sub : null, params : [t, size] } ):
 			var t = switch( t ) {
 			var t = switch( t ) {
 			case TPType(t): parseType(t, pos);
 			case TPType(t): parseType(t, pos);