Jelajahi Sumber

check that we don't send more constants than we should

Nicolas Cannasse 11 tahun lalu
induk
melakukan
2588140bbf
1 mengubah file dengan 4 tambahan dan 0 penghapusan
  1. 4 0
      h3d/impl/Stage3dDriver.hx

+ 4 - 0
h3d/impl/Stage3dDriver.hx

@@ -363,6 +363,10 @@ class Stage3dDriver extends Driver {
 			case OTex(_, _, t): usedTextures[t.index] = true;
 			default:
 			}
+		var size = s.globalsSize+s.paramsSize;
+		var max = format.agal.Tools.getProps(RConst, !s.vertex, isStandardMode?2:1).count;
+		if( size > max )
+			throw (s.vertex?"Vertex ":"Fragment ") + " shader uses " + size+" constant registers while " + max + " is allowed";
 		var o = new haxe.io.BytesOutput();
 		new format.agal.Writer(o).write(agal);
 		return { agal : agal, bytes : o.getBytes() };