From 2ce8fe8f5d601b227a8a48cb76991d26989c9704 Mon Sep 17 00:00:00 2001 From: Invertex Date: Sat, 17 Mar 2018 00:31:30 -0700 Subject: [PATCH 1/3] Added conversion for GLSL's dFdx/y to HLSL/CG's ddx/y --- Assets/Scripts/CodeGenerator.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/CodeGenerator.cs b/Assets/Scripts/CodeGenerator.cs index 26a34ec..0c1e161 100644 --- a/Assets/Scripts/CodeGenerator.cs +++ b/Assets/Scripts/CodeGenerator.cs @@ -115,7 +115,9 @@ public object Convert(string input) BaseReplace( "iGlobalTime", "_Time.y"); BaseReplace( "fragColor =", "return"); BaseReplace( "fract", "frac"); - BaseReplace( @"ifixed(\d)", "fixed$1");//ifixed to fixed + BaseReplace("dFdx", "ddx"); + BaseReplace("dFdy", "ddy"); + BaseReplace( @"ifixed(\d)", "fixed$1");//ifixed to fixed BaseReplace( "texture", "tex2D"); BaseReplace( "tex2DLod", "tex2Dlod"); BaseReplace( "refrac", "refract"); From c8ae24d6ef013c8ad2b0eca024ef19427d73283c Mon Sep 17 00:00:00 2001 From: Invertex Date: Sat, 17 Mar 2018 01:05:50 -0700 Subject: [PATCH 2/3] tex2DGrad > tex2Dgrad --- Assets/Scripts/CodeGenerator.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/CodeGenerator.cs b/Assets/Scripts/CodeGenerator.cs index 0c1e161..f3cd5a8 100644 --- a/Assets/Scripts/CodeGenerator.cs +++ b/Assets/Scripts/CodeGenerator.cs @@ -120,7 +120,8 @@ public object Convert(string input) BaseReplace( @"ifixed(\d)", "fixed$1");//ifixed to fixed BaseReplace( "texture", "tex2D"); BaseReplace( "tex2DLod", "tex2Dlod"); - BaseReplace( "refrac", "refract"); + BaseReplace( "tex2DGrad", "tex2Dgrad"); + BaseReplace( "refrac", "refract"); BaseReplace( "iChannel0", "_MainTex"); BaseReplace( "iChannel1", "_SecondTex"); BaseReplace( "iChannel2", "_ThirdTex"); From 7f911ba5dfd1faf1e795fc98881ceb1409cf8627 Mon Sep 17 00:00:00 2001 From: Invertex Date: Sat, 17 Mar 2018 01:17:25 -0700 Subject: [PATCH 3/3] textureGrad > tex2Dgrad --- Assets/Scripts/CodeGenerator.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Assets/Scripts/CodeGenerator.cs b/Assets/Scripts/CodeGenerator.cs index f3cd5a8..c92f237 100644 --- a/Assets/Scripts/CodeGenerator.cs +++ b/Assets/Scripts/CodeGenerator.cs @@ -121,6 +121,7 @@ public object Convert(string input) BaseReplace( "texture", "tex2D"); BaseReplace( "tex2DLod", "tex2Dlod"); BaseReplace( "tex2DGrad", "tex2Dgrad"); + BaseReplace( "textureGrad", "tex2Dgrad"); BaseReplace( "refrac", "refract"); BaseReplace( "iChannel0", "_MainTex"); BaseReplace( "iChannel1", "_SecondTex");