浏览代码

fix when drawing with same shader when changing flags

ncannasse 8 年之前
父节点
当前提交
4d643626f0
共有 1 个文件被更改,包括 5 次插入6 次删除
  1. 5 6
      h2d/RenderContext.hx

+ 5 - 6
h2d/RenderContext.hx

@@ -355,13 +355,12 @@ class RenderContext extends h3d.impl.RenderContext {
 			var t = curShaders.s;
 			objShaders = objShaders.next;
 			curShaders = curShaders.next;
-			if( s == t ) continue;
-			paramsChanged = true;
+			var prevInst = @:privateAccess t.instance;
+			if( s != t )
+				paramsChanged = true;
 			s.updateConstants(manager.globals);
-			@:privateAccess {
-				if( s.instance != t.instance )
-					shaderChanged = true;
-			}
+			if( @:privateAccess s.instance != prevInst )
+				shaderChanged = true;
 		}
 		if( objShaders != null || curShaders != null || baseShader.isRelative != isRelative || baseShader.hasUVPos != hasUVPos || baseShader.killAlpha != killAlpha )
 			shaderChanged = true;