瀏覽代碼

fix for derivatives in webgl2

Nicolas Cannasse 3 年之前
父節點
當前提交
d62abb2759
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      hxsl/GlslOut.hx

+ 3 - 1
hxsl/GlslOut.hx

@@ -242,7 +242,9 @@ class GlslOut {
 				return "mat_to_34";
 			}
 		case DFdx, DFdy, Fwidth:
-			decl("#extension GL_OES_standard_derivatives:enable");
+			if( isVertex ) throw "Can't use "+g+" in vertex shader";
+			if( version < 300 )
+				decl("#extension GL_OES_standard_derivatives:enable");
 		case Pack:
 			decl("vec4 pack( float v ) { vec4 color = fract(v * vec4(1, 255, 255.*255., 255.*255.*255.)); return color - color.yzww * vec4(1. / 255., 1. / 255., 1. / 255., 0.); }");
 		case Unpack: