瀏覽代碼

Add @unroll for pbr/DefaultForward.hx
Fix typo

ShiroSmith 4 年之前
父節點
當前提交
61992e2111
共有 1 個文件被更改,包括 7 次插入7 次删除
  1. 7 7
      h3d/shader/pbr/DefaultForward.hx

+ 7 - 7
h3d/shader/pbr/DefaultFoward.hx → h3d/shader/pbr/DefaultForward.hx

@@ -1,6 +1,6 @@
 package h3d.shader.pbr;
 
-class DefaultFoward extends hxsl.Shader {
+class DefaultForward extends hxsl.Shader {
 
 	static var SRC = {
 
@@ -14,9 +14,9 @@ class DefaultFoward extends hxsl.Shader {
 		@param var lightInfos : Buffer<Vec4, BUFFER_SIZE>;
 
 		// Buffer Info
-		@param var dirLightCount : Int;
-		@param var pointLightCount : Int;
-		@param var spotLightCount : Int;
+		@const(8) var dirLightCount : Int;
+		@const(8) var pointLightCount : Int;
+		@const(8) var spotLightCount : Int;
 		@const(8) var dirLightStride : Int;
 		@const(8) var pointLightStride : Int;
 
@@ -185,15 +185,15 @@ class DefaultFoward extends hxsl.Shader {
 			F0 = mix(pbrSpecularColor, albedo, metalness);
 
 			// Dir Light
-			for( l in 0 ... dirLightCount )
+			@unroll for( l in 0 ... dirLightCount )
 				lightAccumulation += evaluateDirLight(l);
 
 			// Point Light
-			for( l in 0 ... pointLightCount )
+			@unroll for( l in 0 ... pointLightCount )
 				lightAccumulation += evaluatePointLight(l);
 
 			// Spot Light
-			for( l in 0 ... spotLightCount )
+			@unroll for( l in 0 ... spotLightCount )
 				lightAccumulation += evaluateSpotLight(l);
 
 			// Indirect only support the main env from the scene at the moment