Removed Vortice.Windows references and files
このコミットが含まれているのは:
1 親
b67af4aaa1
コミット
4811769ebc
46ファイル変更
+1124
-3358
検索条件に一致するファイルはありません
@@ -9,13 +9,13 @@ namespace ComputeSharp.Shaders.Translation.Models
|
||||
/// A <see langword="struct"/> that contains info on a cached shader.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of compute shader in use.</typeparam>
|
||||
internal readonly struct CachedShader2<T>
|
||||
internal readonly struct CachedShader<T>
|
||||
where T : struct, IComputeShader
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="ShaderLoader2{T}"/> instance with the shader metadata.
|
||||
/// The <see cref="ShaderLoader{T}"/> instance with the shader metadata.
|
||||
/// </summary>
|
||||
public readonly ShaderLoader2<T> Loader;
|
||||
public readonly ShaderLoader<T> Loader;
|
||||
|
||||
/// <summary>
|
||||
/// The compiled shader bytecode.
|
||||
@@ -25,14 +25,14 @@ namespace ComputeSharp.Shaders.Translation.Models
|
||||
/// <summary>
|
||||
/// The map of cached <see cref="PipelineData"/> instances for each GPU in use.
|
||||
/// </summary>
|
||||
public readonly ConditionalWeakTable<GraphicsDevice2, PipelineData> CachedPipelines;
|
||||
public readonly ConditionalWeakTable<GraphicsDevice, PipelineData> CachedPipelines;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="CachedShader{T}"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="loader">The <see cref="ShaderLoader{T}"/> instance with the shader metadata.</param>
|
||||
/// <param name="bytecode">The compiled shader bytecode.</param>
|
||||
public CachedShader2(ShaderLoader2<T> loader, IDxcBlobObject bytecode)
|
||||
public CachedShader(ShaderLoader<T> loader, IDxcBlobObject bytecode)
|
||||
{
|
||||
Loader = loader;
|
||||
Bytecode = bytecode;
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using ComputeSharp.Graphics;
|
||||
using ComputeSharp.Graphics.Commands;
|
||||
using Vortice.Direct3D12;
|
||||
|
||||
namespace ComputeSharp.Shaders.Translation.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that contains info on a cached shader
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of compute shader in use</typeparam>
|
||||
internal readonly struct CachedShader<T>
|
||||
where T : struct, IComputeShader
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="ShaderLoader{T}"/> instance with the shader metadata
|
||||
/// </summary>
|
||||
public readonly ShaderLoader<T> Loader;
|
||||
|
||||
/// <summary>
|
||||
/// The compiled shader bytecode
|
||||
/// </summary>
|
||||
public readonly ShaderBytecode Bytecode;
|
||||
|
||||
/// <summary>
|
||||
/// The map of cached <see cref="PipelineState"/> instances for each GPU in use.
|
||||
/// </summary>
|
||||
public readonly ConditionalWeakTable<GraphicsDevice, PipelineState> CachedPipelines;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="CachedShader{T}"/> instance with the specified parameters
|
||||
/// </summary>
|
||||
/// <param name="loader">The <see cref="ShaderLoader{T}"/> instance with the shader metadata</param>
|
||||
/// <param name="bytecode">The compiled shader bytecode</param>
|
||||
public CachedShader(ShaderLoader<T> loader, ShaderBytecode bytecode)
|
||||
{
|
||||
Loader = loader;
|
||||
Bytecode = bytecode;
|
||||
CachedPipelines = new ConditionalWeakTable<GraphicsDevice, PipelineState>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,80 +3,86 @@ using System.Buffers;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using ComputeSharp.Graphics.Buffers.Abstract;
|
||||
using TerraFX.Interop;
|
||||
|
||||
namespace ComputeSharp.Shaders.Translation.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that contains all the captured data to dispatch a shader
|
||||
/// A <see langword="struct"/> that contains all the captured data to dispatch a shader.
|
||||
/// </summary>
|
||||
internal readonly ref struct DispatchData
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="GraphicsResource"/> array with the captured buffers
|
||||
/// The <see cref="D3D12_GPU_DESCRIPTOR_HANDLE"/> array with the captured buffers.
|
||||
/// </summary>
|
||||
private readonly GraphicsResource[] ResourcesArray;
|
||||
private readonly D3D12_GPU_DESCRIPTOR_HANDLE[] resourcesArray;
|
||||
|
||||
/// <summary>
|
||||
/// The number of <see cref="GraphicsResource"/> instances in <see cref="ResourcesArray"/>
|
||||
/// The number of <see cref="GraphicsResource"/> instances in <see cref="resourcesArray"/>.
|
||||
/// </summary>
|
||||
private readonly int ResourcesCount;
|
||||
private readonly int resourcesCount;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="byte"/> array with all the captured variables, with proper padding
|
||||
/// The <see cref="byte"/> array with all the captured variables, with proper padding.
|
||||
/// </summary>
|
||||
private readonly byte[] VariablesArray;
|
||||
private readonly byte[] variablesArray;
|
||||
|
||||
/// <summary>
|
||||
/// The actual size in bytes to use from <see cref="VariablesArray"/>
|
||||
/// The actual size in bytes to use from <see cref="variablesArray"/>.
|
||||
/// </summary>
|
||||
private readonly int VariablesByteSize;
|
||||
private readonly int variablesByteSize;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="DispatchData"/> instance with the specified parameters
|
||||
/// Creates a new <see cref="DispatchData"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="resourcesArray">The <see cref="GraphicsResource"/> array with the captured buffers</param>
|
||||
/// <param name="resourcesCount">The number of <see cref="GraphicsResource"/> 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 DispatchData(GraphicsResource[] resourcesArray, int resourcesCount, byte[] variablesArray, int variablesByteSize)
|
||||
/// <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 DispatchData(D3D12_GPU_DESCRIPTOR_HANDLE[] resourcesArray, int resourcesCount, byte[] variablesArray, int variablesByteSize)
|
||||
{
|
||||
ResourcesArray = resourcesArray;
|
||||
VariablesArray = variablesArray;
|
||||
ResourcesCount = resourcesCount;
|
||||
VariablesByteSize = variablesByteSize;
|
||||
this.resourcesArray = resourcesArray;
|
||||
this.variablesArray = variablesArray;
|
||||
this.resourcesCount = resourcesCount;
|
||||
this.variablesByteSize = variablesByteSize;
|
||||
}
|
||||
|
||||
/// <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 Span<GraphicsResource> Resources
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => ResourcesArray.AsSpan(0, ResourcesCount);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Span{T}"/> with the padded data representing all the captured variables
|
||||
/// </summary>
|
||||
public Span<Int4> Variables
|
||||
public ReadOnlySpan<D3D12_GPU_DESCRIPTOR_HANDLE> Resources
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
ref Int4 r = ref Unsafe.As<byte, Int4>(ref VariablesArray[0]);
|
||||
bool mod = (VariablesByteSize & 15) > 0;
|
||||
int length = VariablesByteSize / 4 + Unsafe.As<bool, byte>(ref mod);
|
||||
return MemoryMarshal.CreateSpan(ref r, length);
|
||||
ref D3D12_GPU_DESCRIPTOR_HANDLE r0 = ref MemoryMarshal.GetArrayDataReference(this.resourcesArray);
|
||||
|
||||
return MemoryMarshal.CreateReadOnlySpan(ref r0, this.resourcesCount);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implements the <see cref="IDisposable.Dispose"/> method and returns the rented buffers
|
||||
/// Gets a <see cref="ReadOnlySpan{T}"/> with the padded data representing all the captured variables.
|
||||
/// </summary>
|
||||
public ReadOnlySpan<Int4> Variables
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
ref byte r0 = ref MemoryMarshal.GetArrayDataReference(this.variablesArray);
|
||||
ref Int4 r1 = ref Unsafe.As<byte, Int4>(ref r0);
|
||||
bool mod = (this.variablesByteSize & 15) > 0;
|
||||
int length = variablesByteSize / 4 + Unsafe.As<bool, byte>(ref mod);
|
||||
|
||||
return MemoryMarshal.CreateReadOnlySpan(ref r1, length);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IDisposable.Dispose"/>
|
||||
public void Dispose()
|
||||
{
|
||||
ArrayPool<GraphicsResource>.Shared.Return(ResourcesArray, true);
|
||||
ArrayPool<byte>.Shared.Return(VariablesArray);
|
||||
ArrayPool<D3D12_GPU_DESCRIPTOR_HANDLE>.Shared.Return(this.resourcesArray);
|
||||
ArrayPool<byte>.Shared.Return(this.variablesArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
using System;
|
||||
using System.Buffers;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using ComputeSharp.Graphics.Buffers.Abstract;
|
||||
using TerraFX.Interop;
|
||||
|
||||
namespace ComputeSharp.Shaders.Translation.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that contains all the captured data to dispatch a shader.
|
||||
/// </summary>
|
||||
internal readonly ref struct DispatchData2
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="D3D12_GPU_DESCRIPTOR_HANDLE"/> array with the captured buffers.
|
||||
/// </summary>
|
||||
private readonly D3D12_GPU_DESCRIPTOR_HANDLE[] resourcesArray;
|
||||
|
||||
/// <summary>
|
||||
/// The number of <see cref="GraphicsResource"/> instances in <see cref="resourcesArray"/>.
|
||||
/// </summary>
|
||||
private readonly int resourcesCount;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="byte"/> array with all the captured variables, with proper padding.
|
||||
/// </summary>
|
||||
private readonly byte[] variablesArray;
|
||||
|
||||
/// <summary>
|
||||
/// The actual size in bytes to use from <see cref="variablesArray"/>.
|
||||
/// </summary>
|
||||
private readonly int variablesByteSize;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="DispatchData"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <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(D3D12_GPU_DESCRIPTOR_HANDLE[] resourcesArray, int resourcesCount, byte[] variablesArray, int variablesByteSize)
|
||||
{
|
||||
this.resourcesArray = resourcesArray;
|
||||
this.variablesArray = variablesArray;
|
||||
this.resourcesCount = resourcesCount;
|
||||
this.variablesByteSize = variablesByteSize;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="ReadOnlySpan{T}"/> with all the captured buffers.
|
||||
/// </summary>
|
||||
public ReadOnlySpan<D3D12_GPU_DESCRIPTOR_HANDLE> Resources
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
ref D3D12_GPU_DESCRIPTOR_HANDLE r0 = ref MemoryMarshal.GetArrayDataReference(this.resourcesArray);
|
||||
|
||||
return MemoryMarshal.CreateReadOnlySpan(ref r0, this.resourcesCount);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="ReadOnlySpan{T}"/> with the padded data representing all the captured variables.
|
||||
/// </summary>
|
||||
public ReadOnlySpan<Int4> Variables
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
ref byte r0 = ref MemoryMarshal.GetArrayDataReference(this.variablesArray);
|
||||
ref Int4 r1 = ref Unsafe.As<byte, Int4>(ref r0);
|
||||
bool mod = (this.variablesByteSize & 15) > 0;
|
||||
int length = variablesByteSize / 4 + Unsafe.As<bool, byte>(ref mod);
|
||||
|
||||
return MemoryMarshal.CreateReadOnlySpan(ref r1, length);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IDisposable.Dispose"/>
|
||||
public void Dispose()
|
||||
{
|
||||
ArrayPool<D3D12_GPU_DESCRIPTOR_HANDLE>.Shared.Return(this.resourcesArray);
|
||||
ArrayPool<byte>.Shared.Return(this.variablesArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする