Generate input types as ReadOnlyMemory<T>

このコミットが含まれているのは:
Sergio Pedri committed 2023-09-27 20:54:11 +02:00
1 親 077504566e
コミット a6b87b551c
8ファイル変更
+268 -51

検索条件に一致するファイルはありません

+5 -9
ファイルの表示
@@ -259,20 +259,16 @@ public static class D2D1PixelShader
}
/// <summary>
/// Gets the type of a given input for a D2D1 pixel shader.
/// Gets the input types for a D2D1 pixel shader.
/// </summary>
/// <typeparam name="T">The type of D2D1 pixel shader to get the input type for.</typeparam>
/// <param name="index">The index of the input to get the type for.</param>
/// <returns>The type of the input of the target D2D1 pixel shader at the specified index.</returns>
/// <exception cref="ArgumentOutOfRangeException">Thrown if <paramref name="index"/> is not in range for the available inputs for the shader type.</exception>
public static D2D1PixelShaderInputType GetInputType<T>(int index)
/// <typeparam name="T">The type of D2D1 pixel shader to get the input types for.</typeparam>
/// <returns>The input types of the target D2D1 pixel shader.</returns>
public static ReadOnlyMemory<D2D1PixelShaderInputType> GetInputTypes<T>()
where T : unmanaged, ID2D1PixelShader
{
Unsafe.SkipInit(out T shader);
default(ArgumentOutOfRangeException).ThrowIfNotInRange(index, 0, (int)shader.GetInputCount());
return (D2D1PixelShaderInputType)shader.GetInputType((uint)index);
return shader.InputTypes;
}
/// <summary>
+1 -4
ファイルの表示
@@ -175,10 +175,7 @@ internal unsafe partial struct PixelShaderEffect
int inputCount = D2D1PixelShader.GetInputCount<T>();
D2D1PixelShaderInputType* inputTypes = (D2D1PixelShaderInputType*)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(For<T>), sizeof(D2D1PixelShaderInputType) * inputCount);
for (int i = 0; i < inputCount; i++)
{
inputTypes[i] = D2D1PixelShader.GetInputType<T>(i);
}
D2D1PixelShader.GetInputTypes<T>().Span.CopyTo(new Span<D2D1PixelShaderInputType>(inputTypes, inputCount));
// Prepare the input descriptions
ReadOnlyMemory<D2D1InputDescription> inputDescriptionsInfo = D2D1PixelShader.GetInputDescriptions<T>();