Enable ID2D1TransformMapperManager within built-in effect
このコミットが含まれているのは:
1 親
e92b01a4ea
コミット
8ab0f88d16
3ファイル変更
+70
-7
検索条件に一致するファイルはありません
+54
-3
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using ComputeSharp.D2D1.Extensions;
|
||||
using ComputeSharp.D2D1.Shaders.Interop.Effects.TransformMapperManagers;
|
||||
using TerraFX.Interop.DirectX;
|
||||
using TerraFX.Interop.Windows;
|
||||
#if !NET6_0_OR_GREATER
|
||||
@@ -127,7 +128,17 @@ partial struct PixelShaderEffect
|
||||
return E.E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (@this->d2D1TransformMapperHandle.Target is D2D1TransformMapper d2D1TransformMapper)
|
||||
if (@this->d2D1TransformMapperManager is not null)
|
||||
{
|
||||
// Forward to the current ID2D1TransformMapperManager instance
|
||||
HRESULT hresult = @this->d2D1TransformMapperManager->MapOutputRectToInputRects(outputRect, inputRects, inputRectsCount);
|
||||
|
||||
if (!Windows.SUCCEEDED(hresult))
|
||||
{
|
||||
return hresult;
|
||||
}
|
||||
}
|
||||
else if (@this->d2D1TransformMapperHandle.Target is D2D1TransformMapper d2D1TransformMapper)
|
||||
{
|
||||
Rectangle output = outputRect->ToRectangle();
|
||||
Span<Rectangle> inputs = stackalloc Rectangle[8].Slice(0, (int)inputRectsCount);
|
||||
@@ -189,7 +200,37 @@ partial struct PixelShaderEffect
|
||||
return E.E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (@this->d2D1TransformMapperHandle.Target is D2D1TransformMapper d2D1TransformMapper)
|
||||
if (@this->d2D1TransformMapperManager is not null)
|
||||
{
|
||||
using ComPtr<D2D1DrawInfoUpdateContextImpl> d2D1DrawInfoUpdateContext = default;
|
||||
|
||||
// Create an ID2D1DrawInfoUpdateContext instance
|
||||
HRESULT hresult = D2D1DrawInfoUpdateContextImpl.Factory(
|
||||
drawInfoUpdateContext: d2D1DrawInfoUpdateContext.GetAddressOf(),
|
||||
constantBuffer: @this->constantBuffer,
|
||||
constantBufferSize: @this->constantBufferSize,
|
||||
d2D1DrawInfo: @this->d2D1DrawInfo);
|
||||
|
||||
if (!Windows.SUCCEEDED(hresult))
|
||||
{
|
||||
return hresult;
|
||||
}
|
||||
|
||||
// Forward the call to the input ID2D1TransformMapperManager instance
|
||||
hresult = @this->d2D1TransformMapperManager->MapInputRectsToOutputRect(
|
||||
updateContext: (ID2D1DrawInfoUpdateContex*)d2D1DrawInfoUpdateContext.Get(),
|
||||
inputRects: inputRects,
|
||||
inputOpaqueSubRects: inputOpaqueSubRects,
|
||||
inputRectCount: inputRectCount,
|
||||
outputRect: outputRect,
|
||||
outputOpaqueSubRect: outputOpaqueSubRect);
|
||||
|
||||
if (!Windows.SUCCEEDED(hresult))
|
||||
{
|
||||
return hresult;
|
||||
}
|
||||
}
|
||||
else if (@this->d2D1TransformMapperHandle.Target is D2D1TransformMapper d2D1TransformMapper)
|
||||
{
|
||||
Span<Rectangle> inputs = stackalloc Rectangle[8].Slice(0, (int)inputRectCount);
|
||||
Span<Rectangle> opaqueInputs = stackalloc Rectangle[8].Slice(0, (int)inputRectCount);
|
||||
@@ -278,7 +319,17 @@ partial struct PixelShaderEffect
|
||||
return E.E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (@this->d2D1TransformMapperHandle.Target is D2D1TransformMapper d2D1TransformMapper)
|
||||
if (@this->d2D1TransformMapperManager is not null)
|
||||
{
|
||||
// Forward to the current ID2D1TransformMapperManager instance
|
||||
HRESULT hresult = @this->d2D1TransformMapperManager->MapInvalidRect(inputIndex, invalidInputRect, invalidOutputRect);
|
||||
|
||||
if (!Windows.SUCCEEDED(hresult))
|
||||
{
|
||||
return hresult;
|
||||
}
|
||||
}
|
||||
else if (@this->d2D1TransformMapperHandle.Target is D2D1TransformMapper d2D1TransformMapper)
|
||||
{
|
||||
Rectangle invalidInput = invalidInputRect.ToRectangle();
|
||||
Rectangle invalidOutput;
|
||||
|
||||
+15
-3
@@ -119,15 +119,25 @@ internal unsafe partial struct D2D1DrawInfoUpdateContextImpl
|
||||
/// <param name="constantBuffer">The constant buffer data, if set.</param>
|
||||
/// <param name="constantBufferSize">The size of <paramref name="constantBuffer"/>.</param>
|
||||
/// <param name="d2D1DrawInfo">The <see cref="ID2D1DrawInfo"/> instance currently in use.</param>
|
||||
public static void Factory(
|
||||
/// <returns>This always returns <c>0</c>.</returns>
|
||||
public static HRESULT Factory(
|
||||
D2D1DrawInfoUpdateContextImpl** drawInfoUpdateContext,
|
||||
byte* constantBuffer,
|
||||
int constantBufferSize,
|
||||
ID2D1DrawInfo* d2D1DrawInfo)
|
||||
{
|
||||
D2D1DrawInfoUpdateContextImpl* @this = (D2D1DrawInfoUpdateContextImpl*)NativeMemory.Alloc((nuint)sizeof(D2D1DrawInfoUpdateContextImpl));
|
||||
D2D1DrawInfoUpdateContextImpl* @this;
|
||||
|
||||
*@this = default;
|
||||
try
|
||||
{
|
||||
@this = (D2D1DrawInfoUpdateContextImpl*)NativeMemory.Alloc((nuint)sizeof(D2D1DrawInfoUpdateContextImpl));
|
||||
}
|
||||
catch (OutOfMemoryException)
|
||||
{
|
||||
*drawInfoUpdateContext = null;
|
||||
|
||||
return E.E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
@this->lpVtblForID2D1DrawInfoUpdateContex = VtblForID2D1DrawInfoUpdateContex;
|
||||
@this->lpVtblForID2D1DrawInfoUpdateContexInternal = VtblForID2D1DrawInfoUpdateContexInternal;
|
||||
@@ -137,6 +147,8 @@ internal unsafe partial struct D2D1DrawInfoUpdateContextImpl
|
||||
@this->d2D1DrawInfo = d2D1DrawInfo;
|
||||
|
||||
*drawInfoUpdateContext = @this;
|
||||
|
||||
return S.S_OK;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IUnknown.QueryInterface"/>
|
||||
|
||||
+1
-1
@@ -99,7 +99,7 @@ internal unsafe struct ID2D1TransformMapperManager
|
||||
/// <param name="invalidOutputRect">The output rectangle to which the input rectangle must be mapped.</param>
|
||||
/// <returns>An <see cref="HRESULT"/> for the operation.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public HRESULT MapInputRectsToOutputRect(
|
||||
public HRESULT MapInvalidRect(
|
||||
uint inputIndex,
|
||||
RECT invalidInputRect,
|
||||
RECT* invalidOutputRect)
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする