Sfoglia il codice sorgente

Added explicit throw if using zero or negative work groups count when dispatching a compute shader.

TothBenoit 9 mesi fa
parent
commit
9a4920cefe
1 ha cambiato i file con 4 aggiunte e 1 eliminazioni
  1. 4 1
      h3d/scene/RenderContext.hx

+ 4 - 1
h3d/scene/RenderContext.hx

@@ -167,6 +167,9 @@ class RenderContext extends h3d.impl.RenderContext {
 	}
 
 	public function computeDispatch( ?shader : hxsl.Shader, x = 1, y = 1, z = 1 ) {
+		if ( x <= 0 || y <= 0 || z <= 0 )
+			throw "Can't use zero or negative work groups count";
+
 		var prev = h3d.impl.RenderContext.get();
 		if( prev != this )
 			start();
@@ -268,7 +271,7 @@ class RenderContext extends h3d.impl.RenderContext {
 		lights = null;
 
 		cameraFrustumUploaded = false;
-		
+
 		cameraPreviousViewProj.load(cameraViewProj);
 		computeVelocity = false;