Changed DispatchDataLoader to load D3D12_GPU_DESCRIPTOR_HANDLEs
このコミットが含まれているのは:
1 親
3c050dbad4
コミット
c491d8c57c
2ファイル変更
+31
-17
検索条件に一致するファイルはありません
@@ -3,6 +3,7 @@ using System.Buffers;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using ComputeSharp.Graphics.Buffers.Abstract;
|
||||
using TerraFX.Interop;
|
||||
|
||||
namespace ComputeSharp.Shaders.Translation.Models
|
||||
{
|
||||
@@ -12,9 +13,9 @@ namespace ComputeSharp.Shaders.Translation.Models
|
||||
internal readonly ref struct DispatchData2
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="GraphicsResource2"/> array with the captured buffers.
|
||||
/// The <see cref="D3D12_GPU_DESCRIPTOR_HANDLE"/> array with the captured buffers.
|
||||
/// </summary>
|
||||
private readonly GraphicsResource2[] resourcesArray;
|
||||
private readonly D3D12_GPU_DESCRIPTOR_HANDLE[] resourcesArray;
|
||||
|
||||
/// <summary>
|
||||
/// The number of <see cref="GraphicsResource"/> instances in <see cref="resourcesArray"/>.
|
||||
@@ -34,11 +35,11 @@ namespace ComputeSharp.Shaders.Translation.Models
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="DispatchData"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="resourcesArray">The <see cref="GraphicsResource2"/> array with the captured buffers.</param>
|
||||
/// <param name="resourcesCount">The number of <see cref="GraphicsResource2"/> instances in <see cref="resourcesArray"/>.</param>
|
||||
/// <param name="resourcesArray">The <see cref="D3D12_GPU_DESCRIPTOR_HANDLE"/> array with the captured buffers.</param>
|
||||
/// <param name="resourcesCount">The number of <see cref="D3D12_GPU_DESCRIPTOR_HANDLE"/> instances in <see cref="resourcesArray"/>.</param>
|
||||
/// <param name="variablesArray">The <see cref="byte"/> array with all the captured variables, with proper padding.</param>
|
||||
/// <param name="variablesByteSize">The actual size in bytes to use from <see cref="variablesArray"/>.</param>
|
||||
public DispatchData2(GraphicsResource2[] resourcesArray, int resourcesCount, byte[] variablesArray, int variablesByteSize)
|
||||
public DispatchData2(D3D12_GPU_DESCRIPTOR_HANDLE[] resourcesArray, int resourcesCount, byte[] variablesArray, int variablesByteSize)
|
||||
{
|
||||
this.resourcesArray = resourcesArray;
|
||||
this.variablesArray = variablesArray;
|
||||
@@ -47,21 +48,21 @@ namespace ComputeSharp.Shaders.Translation.Models
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Span{T}"/> with all the captured buffers.
|
||||
/// Gets a <see cref="ReadOnlySpan{T}"/> with all the captured buffers.
|
||||
/// </summary>
|
||||
public ReadOnlySpan<GraphicsResource2> Resources
|
||||
public ReadOnlySpan<D3D12_GPU_DESCRIPTOR_HANDLE> Resources
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
ref GraphicsResource2 r0 = ref MemoryMarshal.GetArrayDataReference(this.resourcesArray);
|
||||
ref D3D12_GPU_DESCRIPTOR_HANDLE r0 = ref MemoryMarshal.GetArrayDataReference(this.resourcesArray);
|
||||
|
||||
return MemoryMarshal.CreateReadOnlySpan(ref r0, this.resourcesCount);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Span{T}"/> with the padded data representing all the captured variables.
|
||||
/// Gets a <see cref="ReadOnlySpan{T}"/> with the padded data representing all the captured variables.
|
||||
/// </summary>
|
||||
public ReadOnlySpan<Int4> Variables
|
||||
{
|
||||
@@ -80,7 +81,7 @@ namespace ComputeSharp.Shaders.Translation.Models
|
||||
/// <inheritdoc cref="IDisposable.Dispose"/>
|
||||
public void Dispose()
|
||||
{
|
||||
ArrayPool<GraphicsResource2>.Shared.Return(this.resourcesArray, true);
|
||||
ArrayPool<D3D12_GPU_DESCRIPTOR_HANDLE>.Shared.Return(this.resourcesArray);
|
||||
ArrayPool<byte>.Shared.Return(this.variablesArray);
|
||||
}
|
||||
}
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする