From d70f861c5a86dc5656651237939c9c1da71d3a53 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Fri, 7 Jun 2024 18:58:01 -0700 Subject: [PATCH] Rework 'D2D1CompileOptions' presets --- .../Attributes/Enums/D2D1CompileOptions.cs | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/ComputeSharp.D2D1/Attributes/Enums/D2D1CompileOptions.cs b/src/ComputeSharp.D2D1/Attributes/Enums/D2D1CompileOptions.cs index 62d901171..6d8186af1 100644 --- a/src/ComputeSharp.D2D1/Attributes/Enums/D2D1CompileOptions.cs +++ b/src/ComputeSharp.D2D1/Attributes/Enums/D2D1CompileOptions.cs @@ -176,14 +176,28 @@ public enum D2D1CompileOptions EnableLinking = 1 << 31, /// - /// The default options for shaders compiled by ComputeSharp.D2D1. Specifically, this combination - /// of options is the one used by precompiled shaders (ie. when using ), - /// and when using or any of the overloads. + /// The default options for shaders compiled by ComputeSharp.D2D1. Specifically, this combination of options + /// is the one used by precompiled shaders (ie. when using ), and when + /// using or any of the overloads, if not manually set. /// /// - /// This option does not include , which is instead automatically enabled by shaders - /// compiled using any of the APIs mentioned above. When manually compiling shaders from source using the APIs - /// from instance, should be manually used when needed. + /// + /// This combination is also meant to provide the maximum speed possible without potentially introducing visual artifacts or altering + /// the shader outputs in any way. For instance, is not included, because it might affect all computations + /// inside the shader on some GPU devices, making issues hard to investigate. As such, it can be considered equivalent to "OptimizeForSpeed", + /// which is not available on specifically because it would be identical to this. + /// + /// + /// In order to ensure the best performance possible, this combination also includes . This will include + /// an export function for all shaders, to allow D2D to opportunistically link them for better performance whenever possible. Doing + /// so incurs a small binary size cost, as this option will also enable linking for shaders that D2D might never actually link. + /// For normal scenarios, this cost is minimal and not noticeable. If size is critical, consider using . + /// /// - Default = OptimizationLevel3 | WarningsAreErrors | PackMatrixRowMajor + Default = OptimizationLevel3 | WarningsAreErrors | PackMatrixRowMajor | EnableLinking, + + /// + /// A combination of options to optimize for minimum size. + /// + OptimizeForSize = OptimizationLevel3 | WarningsAreErrors | PackMatrixRowMajor | StripReflectionData } \ No newline at end of file