diff --git a/src/ComputeSharp.D2D1/Extensions/RECTExtensions.cs b/src/ComputeSharp.D2D1/Extensions/RECTExtensions.cs index df8d053a..792b7374 100644 --- a/src/ComputeSharp.D2D1/Extensions/RECTExtensions.cs +++ b/src/ComputeSharp.D2D1/Extensions/RECTExtensions.cs @@ -14,6 +14,19 @@ namespace ComputeSharp.D2D1.Extensions; /// internal static class RECTExtensions { + /// + /// Modifies a target instance to be a D2D1 infinite rectangle. + /// + /// The target instance to modify. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void MakeD2D1Infinite(this ref RECT rect) + { + rect.left = int.MinValue; + rect.top = int.MinValue; + rect.right = int.MaxValue; + rect.bottom = int.MaxValue; + } + /// /// Creates a from a value. /// diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1DrawTransformMethods.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1DrawTransformMethods.cs index a40b0bc6..d9833da2 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1DrawTransformMethods.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1DrawTransformMethods.cs @@ -208,8 +208,10 @@ partial struct PixelShaderEffect } else if (inputRectCount == 0) { - // If there are no inputs, just ignore (users will need a custom mapping) - *outputRect = default; + // If there are no inputs, make the output rectangle infinite. This is useful + // to make output-only effects work fine by default, without needing a custom + // transform. In this case, the target area will be the output node anyway. + outputRect->MakeD2D1Infinite(); @this->inputRect = default;