From 4bdd37b57578fb0f80f7ae66037330755e4aff96 Mon Sep 17 00:00:00 2001 From: Georg Haaser Date: Sat, 8 Oct 2022 10:32:57 +0200 Subject: [PATCH 1/5] try/with for Expr.TryGetReflectedDefinition (seems to raise exceptions in some cases) --- RELEASE_NOTES.md | 3 +++ src/Libs/FShade.Core/Serializer.fs | 4 +++- src/Libs/FShade.Imperative/Utilities.fs | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index c268789..be6a22a 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,3 +1,6 @@ +### 5.2.10 +* try/with for Expr.TryGetReflectedDefinition (seems to raise exceptions in some cases) + ### 5.2.9 * Fixed issue with topological sort and raytracing data * Removed warnings in raytracing shaders diff --git a/src/Libs/FShade.Core/Serializer.fs b/src/Libs/FShade.Core/Serializer.fs index 9afa985..8f82cb2 100644 --- a/src/Libs/FShade.Core/Serializer.fs +++ b/src/Libs/FShade.Core/Serializer.fs @@ -823,7 +823,9 @@ module Serializer = let (|ReflectedCall|_|) (e : Expr) = match e with | Call(t,mi,args) -> - let isInline = mi.GetCustomAttributes() |> Seq.isEmpty |> not + let isInline = + try mi.GetCustomAttributes() |> Seq.isEmpty |> not + with _ -> false match ExprWorkardound.TryGetReflectedDefinition mi with | Some def -> let args = diff --git a/src/Libs/FShade.Imperative/Utilities.fs b/src/Libs/FShade.Imperative/Utilities.fs index 9b8bd4a..2077a3a 100644 --- a/src/Libs/FShade.Imperative/Utilities.fs +++ b/src/Libs/FShade.Imperative/Utilities.fs @@ -18,7 +18,8 @@ module ExprWorkardound = let TryGetReflectedDefinition (mb : MethodBase) = lock lockObj (fun _ -> - Expr.TryGetReflectedDefinition mb + try Expr.TryGetReflectedDefinition mb + with _ -> None ) module Peano = From 2699e04159605966ffacffbf8c5cbe9f96439a0a Mon Sep 17 00:00:00 2001 From: Georg Haaser Date: Sat, 8 Oct 2022 11:12:50 +0200 Subject: [PATCH 2/5] printing warnings when Expr.TryGetReflectedDefinition fails --- RELEASE_NOTES.md | 3 +++ src/Libs/FShade.Imperative/Utilities.fs | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index be6a22a..949a021 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,3 +1,6 @@ +### 5.2.11 +* printing warnings when Expr.TryGetReflectedDefinition fails + ### 5.2.10 * try/with for Expr.TryGetReflectedDefinition (seems to raise exceptions in some cases) diff --git a/src/Libs/FShade.Imperative/Utilities.fs b/src/Libs/FShade.Imperative/Utilities.fs index 2077a3a..e93aa95 100644 --- a/src/Libs/FShade.Imperative/Utilities.fs +++ b/src/Libs/FShade.Imperative/Utilities.fs @@ -19,7 +19,9 @@ module ExprWorkardound = let TryGetReflectedDefinition (mb : MethodBase) = lock lockObj (fun _ -> try Expr.TryGetReflectedDefinition mb - with _ -> None + with e -> + Aardvark.Base.Report.Warn(sprintf "Expr.TryGetReflectedDefinition failed on %0A %0A with:\r\n%0A" mb.DeclaringType mb e) + None ) module Peano = From cbac70489a9111d28bdb5017683e46cb91eb8e4b Mon Sep 17 00:00:00 2001 From: Georg Haaser Date: Sat, 8 Oct 2022 11:33:24 +0200 Subject: [PATCH 3/5] disabled warnings again --- RELEASE_NOTES.md | 3 +++ src/Libs/FShade.Imperative/Utilities.fs | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 949a021..293db75 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,3 +1,6 @@ +### 5.2.12 +* disabled warnings again + ### 5.2.11 * printing warnings when Expr.TryGetReflectedDefinition fails diff --git a/src/Libs/FShade.Imperative/Utilities.fs b/src/Libs/FShade.Imperative/Utilities.fs index e93aa95..aab1a94 100644 --- a/src/Libs/FShade.Imperative/Utilities.fs +++ b/src/Libs/FShade.Imperative/Utilities.fs @@ -19,9 +19,7 @@ module ExprWorkardound = let TryGetReflectedDefinition (mb : MethodBase) = lock lockObj (fun _ -> try Expr.TryGetReflectedDefinition mb - with e -> - Aardvark.Base.Report.Warn(sprintf "Expr.TryGetReflectedDefinition failed on %0A %0A with:\r\n%0A" mb.DeclaringType mb e) - None + with e -> None ) module Peano = From 3b7edb342ea896aee750370fb93ac10675dda154 Mon Sep 17 00:00:00 2001 From: Martin Date: Mon, 17 Oct 2022 11:41:02 +0200 Subject: [PATCH 4/5] Fix issue with constant swizzles Fixes: https://github.com/krauthaufen/FShade/issues/29 --- src/Libs/FShade.Core/Shader.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Libs/FShade.Core/Shader.fs b/src/Libs/FShade.Core/Shader.fs index 10d6b11..e9c0edf 100644 --- a/src/Libs/FShade.Core/Shader.fs +++ b/src/Libs/FShade.Core/Shader.fs @@ -946,7 +946,7 @@ module Preprocessor = | _ -> None let private zeroOneVecProperty = - System.Text.RegularExpressions.Regex @"([XYZW]*[ONIP])+" + System.Text.RegularExpressions.Regex @"^([XYZW]*[OINP]+[XYZW]*)+$" let rec preprocessNormalS (e : Expr) : Preprocess = state { From 45b5c153d24564330739feb0995c4503eb561c9c Mon Sep 17 00:00:00 2001 From: Martin Date: Mon, 17 Oct 2022 11:41:53 +0200 Subject: [PATCH 5/5] Update RELEASE_NOTES.md --- RELEASE_NOTES.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 293db75..ee1f46b 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,3 +1,6 @@ +### 5.2.13 +* Fixed issue with constant swizzles + ### 5.2.12 * disabled warnings again