コピー実行前に計算フェンスへのGPU側待機を追加

このコミットが含まれているのは:
routersys committed 2026-07-17 10:44:17 +09:00
1 親 55575723a1
コミット 2d4bd9ae42
13ファイル変更
+185 -14

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

+11
ファイルの表示
@@ -33,6 +33,8 @@ internal unsafe struct CommandList : IDisposable
/// </summary>
private ComPtr<ID3D12CommandAllocator> d3D12CommandAllocator;
private ulong d3D12ComputeFenceWaitValue;
/// <summary>
/// Creates a new <see cref="CommandList"/> instance with the specified parameters.
/// </summary>
@@ -42,6 +44,7 @@ internal unsafe struct CommandList : IDisposable
{
this.device = device;
this.d3D12CommandListType = d3D12CommandListType;
this.d3D12ComputeFenceWaitValue = 0;
Unsafe.SkipInit(out this.d3D12GraphicsCommandList);
Unsafe.SkipInit(out this.d3D12CommandAllocator);
@@ -67,6 +70,7 @@ internal unsafe struct CommandList : IDisposable
{
this.device = device;
this.d3D12CommandListType = D3D12_COMMAND_LIST_TYPE_COMPUTE;
this.d3D12ComputeFenceWaitValue = 0;
Unsafe.SkipInit(out this.d3D12GraphicsCommandList);
Unsafe.SkipInit(out this.d3D12CommandAllocator);
@@ -95,6 +99,13 @@ internal unsafe struct CommandList : IDisposable
/// </summary>
public readonly D3D12_COMMAND_LIST_TYPE D3D12CommandListType => this.d3D12CommandListType;
public readonly ulong D3D12ComputeFenceWaitValue => this.d3D12ComputeFenceWaitValue;
public void AddComputeFenceWait(ulong d3D12FenceValue)
{
this.d3D12ComputeFenceWaitValue = Math.Max(this.d3D12ComputeFenceWaitValue, d3D12FenceValue);
}
/// <summary>
/// Gets the <see cref="ID3D12GraphicsCommandList"/> object in use by the current instance.
/// </summary>
+36 -4
ファイルの表示
@@ -49,12 +49,23 @@ unsafe partial class GraphicsDevice
default: default(ArgumentException).Throw(nameof(commandList)); return;
}
ID3D12Fence* d3D12WaitFence = null;
ulong d3D12WaitFenceValue = 0;
if (commandList.D3D12CommandListType == D3D12_COMMAND_LIST_TYPE_COPY && commandList.D3D12ComputeFenceWaitValue > 0)
{
d3D12WaitFence = this.d3D12ComputeFence.Get();
d3D12WaitFenceValue = commandList.D3D12ComputeFenceWaitValue;
}
ulong updatedFenceValue = ExecuteCommandListCore(
ref commandList,
d3D12CommandQueue,
d3D12Fence,
ref d3D12FenceValue,
d3D12CommandQueueLock);
d3D12CommandQueueLock,
d3D12WaitFence,
d3D12WaitFenceValue);
// If the fence value hasn't been reached, wait until the operation completes
if (updatedFenceValue > d3D12Fence->GetCompletedValue())
@@ -79,7 +90,9 @@ unsafe partial class GraphicsDevice
this.d3D12ComputeCommandQueue.Get(),
this.d3D12ComputeFence.Get(),
ref this.nextD3D12ComputeFenceValue,
this.d3D12ComputeCommandQueueLock);
this.d3D12ComputeCommandQueueLock,
d3D12WaitFence: null,
d3D12WaitFenceValue: 0);
// If the fence value has been reached, complete synchronously
if (updatedFenceValue <= this.d3D12ComputeFence.Get()->GetCompletedValue())
@@ -105,12 +118,16 @@ unsafe partial class GraphicsDevice
this.d3D12ComputeCommandQueue.Get(),
this.d3D12ComputeFence.Get(),
ref this.nextD3D12ComputeFenceValue,
this.d3D12ComputeCommandQueueLock);
this.d3D12ComputeCommandQueueLock,
d3D12WaitFence: null,
d3D12WaitFenceValue: 0);
GraphicsResourceLeaseSet? pendingResourceLeases = resourceLeases;
resourceLeases = null;
pendingResourceLeases?.MarkComputeFence(updatedFenceValue);
this.computeCommandListPool.ReturnWhenCompleted(
commandList.DetachD3D12CommandList(),
commandList.DetachD3D12CommandAllocator(),
@@ -118,15 +135,30 @@ unsafe partial class GraphicsDevice
pendingResourceLeases);
}
internal void WaitForComputeFence(ulong d3D12FenceValue)
{
if (d3D12FenceValue > this.d3D12ComputeFence.Get()->GetCompletedValue())
{
this.d3D12ComputeFence.Get()->SetEventOnCompletion(d3D12FenceValue, default).Assert();
}
}
private static ulong ExecuteCommandListCore(
ref CommandList commandList,
ID3D12CommandQueue* d3D12CommandQueue,
ID3D12Fence* d3D12Fence,
ref ulong d3D12FenceValue,
object d3D12CommandQueueLock)
object d3D12CommandQueueLock,
ID3D12Fence* d3D12WaitFence,
ulong d3D12WaitFenceValue)
{
lock (d3D12CommandQueueLock)
{
if (d3D12WaitFence is not null && d3D12WaitFenceValue > d3D12WaitFence->GetCompletedValue())
{
d3D12CommandQueue->Wait(d3D12WaitFence, d3D12WaitFenceValue).Assert();
}
fixed (ID3D12CommandList** d3D12CommandList = &commandList.GetD3D12CommandListPinnableAddressOf())
{
d3D12CommandQueue->ExecuteCommandLists(1, d3D12CommandList);
+11 -1
ファイルの表示
@@ -22,7 +22,7 @@ namespace ComputeSharp.Resources;
/// A <see langword="class"/> representing a typed buffer stored on GPU memory.
/// </summary>
/// <typeparam name="T">The type of items stored on the buffer.</typeparam>
public abstract unsafe partial class Buffer<T> : IReferenceTrackedObject, IGraphicsResource, ID3D12ReadOnlyResource
public abstract unsafe partial class Buffer<T> : IReferenceTrackedObject, IGraphicsResource, ID3D12ReadOnlyResource, ID3D12ComputeFenceTrackedResource
where T : unmanaged
{
/// <summary>
@@ -55,6 +55,8 @@ public abstract unsafe partial class Buffer<T> : IReferenceTrackedObject, IGraph
/// </summary>
protected readonly nint SizeInBytes;
private D3D12ComputeFenceTracker d3D12ComputeFenceTracker;
/// <summary>
/// Creates a new <see cref="Buffer{T}"/> instance with the specified parameters.
/// </summary>
@@ -154,6 +156,14 @@ public abstract unsafe partial class Buffer<T> : IReferenceTrackedObject, IGraph
/// </summary>
internal D3D12_GPU_DESCRIPTOR_HANDLE D3D12GpuDescriptorHandle => this.d3D12ResourceDescriptorHandles.D3D12GpuDescriptorHandle;
internal ulong D3D12ComputeFenceValue => this.d3D12ComputeFenceTracker.Value;
/// <inheritdoc/>
void ID3D12ComputeFenceTrackedResource.MarkComputeFence(ulong d3D12FenceValue)
{
this.d3D12ComputeFenceTracker.Mark(d3D12FenceValue);
}
/// <summary>
/// Reads the contents of the specified range from the current <see cref="Buffer{T}"/> instance and writes them into a target memory area.
/// </summary>
+19
ファイルの表示
@@ -46,6 +46,8 @@ public abstract class StructuredBuffer<T> : Buffer<T>
if (GraphicsDevice.IsCacheCoherentUMA)
{
GraphicsDevice.WaitForComputeFence(D3D12ComputeFenceValue);
using ID3D12ResourceMap resource = D3D12Resource->Map();
fixed (void* destinationPointer = &destination)
@@ -77,6 +79,8 @@ public abstract class StructuredBuffer<T> : Buffer<T>
using (CommandList copyCommandList = new(GraphicsDevice, D3D12_COMMAND_LIST_TYPE_COPY))
{
copyCommandList.AddComputeFenceWait(D3D12ComputeFenceValue);
copyCommandList.D3D12GraphicsCommandList->CopyBufferRegion(d3D12Resource.Get(), 0, D3D12Resource, (ulong)byteOffset, (ulong)byteLength);
copyCommandList.ExecuteAndWaitForCompletion();
}
@@ -124,6 +128,9 @@ public abstract class StructuredBuffer<T> : Buffer<T>
// Directly copy the input buffer
using CommandList copyCommandList = new(GraphicsDevice, D3D12_COMMAND_LIST_TYPE_COPY);
copyCommandList.AddComputeFenceWait(D3D12ComputeFenceValue);
copyCommandList.AddComputeFenceWait(destination.D3D12ComputeFenceValue);
copyCommandList.D3D12GraphicsCommandList->CopyBufferRegion(
destination.D3D12Resource,
(ulong)destinationByteOffset,
@@ -165,6 +172,8 @@ public abstract class StructuredBuffer<T> : Buffer<T>
if (GraphicsDevice.IsCacheCoherentUMA)
{
GraphicsDevice.WaitForComputeFence(D3D12ComputeFenceValue);
using ID3D12ResourceMap resource = D3D12Resource->Map();
MemoryHelper.Copy<T>(
@@ -184,6 +193,8 @@ public abstract class StructuredBuffer<T> : Buffer<T>
using CommandList copyCommandList = new(GraphicsDevice, D3D12_COMMAND_LIST_TYPE_COPY);
copyCommandList.AddComputeFenceWait(D3D12ComputeFenceValue);
copyCommandList.D3D12GraphicsCommandList->CopyBufferRegion(destination.D3D12Resource, byteDestinationOffset, D3D12Resource, byteOffset, byteLength);
copyCommandList.ExecuteAndWaitForCompletion();
}
@@ -203,6 +214,8 @@ public abstract class StructuredBuffer<T> : Buffer<T>
if (GraphicsDevice.IsCacheCoherentUMA)
{
GraphicsDevice.WaitForComputeFence(D3D12ComputeFenceValue);
using ID3D12ResourceMap resource = D3D12Resource->Map();
fixed (void* sourcePointer = &source)
@@ -249,6 +262,8 @@ public abstract class StructuredBuffer<T> : Buffer<T>
using CommandList copyCommandList = new(GraphicsDevice, D3D12_COMMAND_LIST_TYPE_COPY);
copyCommandList.AddComputeFenceWait(D3D12ComputeFenceValue);
copyCommandList.D3D12GraphicsCommandList->CopyBufferRegion(D3D12Resource, (ulong)byteOffset, d3D12Resource.Get(), 0, (ulong)byteLength);
copyCommandList.ExecuteAndWaitForCompletion();
}
@@ -280,6 +295,8 @@ public abstract class StructuredBuffer<T> : Buffer<T>
if (GraphicsDevice.IsCacheCoherentUMA)
{
GraphicsDevice.WaitForComputeFence(D3D12ComputeFenceValue);
using ID3D12ResourceMap resource = D3D12Resource->Map();
MemoryHelper.Copy<T>(
@@ -299,6 +316,8 @@ public abstract class StructuredBuffer<T> : Buffer<T>
using CommandList copyCommandList = new(GraphicsDevice, D3D12_COMMAND_LIST_TYPE_COPY);
copyCommandList.AddComputeFenceWait(D3D12ComputeFenceValue);
copyCommandList.D3D12GraphicsCommandList->CopyBufferRegion(D3D12Resource, byteOffset, source.D3D12Resource, byteSourceOffset, byteLength);
copyCommandList.ExecuteAndWaitForCompletion();
}
+22 -1
ファイルの表示
@@ -24,7 +24,7 @@ namespace ComputeSharp.Resources;
/// A <see langword="class"/> representing a typed 1D texture stored on GPU memory.
/// </summary>
/// <typeparam name="T">The type of items stored on the texture.</typeparam>
public abstract unsafe partial class Texture1D<T> : IReferenceTrackedObject, IGraphicsResource, ID3D12ReadWriteResource
public abstract unsafe partial class Texture1D<T> : IReferenceTrackedObject, IGraphicsResource, ID3D12ReadWriteResource, ID3D12ComputeFenceTrackedResource
where T : unmanaged
{
/// <summary>
@@ -62,6 +62,8 @@ public abstract unsafe partial class Texture1D<T> : IReferenceTrackedObject, IGr
/// </summary>
private D3D12_RESOURCE_STATES d3D12ResourceState;
private D3D12ComputeFenceTracker d3D12ComputeFenceTracker;
/// <summary>
/// Creates a new <see cref="Texture1D{T}"/> instance with the specified parameters.
/// </summary>
@@ -141,6 +143,14 @@ public abstract unsafe partial class Texture1D<T> : IReferenceTrackedObject, IGr
/// </summary>
internal D3D12_GPU_DESCRIPTOR_HANDLE D3D12GpuDescriptorHandle => this.d3D12ResourceDescriptorHandles.D3D12GpuDescriptorHandle;
internal ulong D3D12ComputeFenceValue => this.d3D12ComputeFenceTracker.Value;
/// <inheritdoc/>
void ID3D12ComputeFenceTrackedResource.MarkComputeFence(ulong d3D12FenceValue)
{
this.d3D12ComputeFenceTracker.Mark(d3D12FenceValue);
}
/// <summary>
/// Reads the contents of the specified range from the current <see cref="Texture1D{T}"/> instance and writes them into a target memory area.
/// </summary>
@@ -179,6 +189,8 @@ public abstract unsafe partial class Texture1D<T> : IReferenceTrackedObject, IGr
using (CommandList copyCommandList = new(GraphicsDevice, this.d3D12CommandListType))
{
copyCommandList.AddComputeFenceWait(D3D12ComputeFenceValue);
if (copyCommandList.D3D12CommandListType == D3D12_COMMAND_LIST_TYPE_COMPUTE)
{
copyCommandList.D3D12GraphicsCommandList->TransitionBarrier(D3D12Resource, this.d3D12ResourceState, D3D12_RESOURCE_STATE_COPY_SOURCE);
@@ -250,6 +262,9 @@ public abstract unsafe partial class Texture1D<T> : IReferenceTrackedObject, IGr
using CommandList copyCommandList = new(GraphicsDevice, d3D12CommandListType);
copyCommandList.AddComputeFenceWait(D3D12ComputeFenceValue);
copyCommandList.AddComputeFenceWait(destination.D3D12ComputeFenceValue);
if (copyCommandList.D3D12CommandListType == D3D12_COMMAND_LIST_TYPE_COMPUTE)
{
copyCommandList.D3D12GraphicsCommandList->TransitionBarrier(D3D12Resource, this.d3D12ResourceState, D3D12_RESOURCE_STATE_COPY_SOURCE);
@@ -304,6 +319,8 @@ public abstract unsafe partial class Texture1D<T> : IReferenceTrackedObject, IGr
using CommandList copyCommandList = new(GraphicsDevice, this.d3D12CommandListType);
copyCommandList.AddComputeFenceWait(D3D12ComputeFenceValue);
if (copyCommandList.D3D12CommandListType == D3D12_COMMAND_LIST_TYPE_COMPUTE)
{
copyCommandList.D3D12GraphicsCommandList->TransitionBarrier(D3D12Resource, this.d3D12ResourceState, D3D12_RESOURCE_STATE_COPY_SOURCE);
@@ -384,6 +401,8 @@ public abstract unsafe partial class Texture1D<T> : IReferenceTrackedObject, IGr
using CommandList copyCommandList = new(GraphicsDevice, this.d3D12CommandListType);
copyCommandList.AddComputeFenceWait(D3D12ComputeFenceValue);
if (copyCommandList.D3D12CommandListType == D3D12_COMMAND_LIST_TYPE_COMPUTE)
{
copyCommandList.D3D12GraphicsCommandList->TransitionBarrier(D3D12Resource, this.d3D12ResourceState, D3D12_RESOURCE_STATE_COPY_DEST);
@@ -437,6 +456,8 @@ public abstract unsafe partial class Texture1D<T> : IReferenceTrackedObject, IGr
using CommandList copyCommandList = new(GraphicsDevice, this.d3D12CommandListType);
copyCommandList.AddComputeFenceWait(D3D12ComputeFenceValue);
if (copyCommandList.D3D12CommandListType == D3D12_COMMAND_LIST_TYPE_COMPUTE)
{
copyCommandList.D3D12GraphicsCommandList->TransitionBarrier(D3D12Resource, this.d3D12ResourceState, D3D12_RESOURCE_STATE_COPY_DEST);
+22 -1
ファイルの表示
@@ -25,7 +25,7 @@ namespace ComputeSharp.Resources;
/// A <see langword="class"/> representing a typed 2D texture stored on GPU memory.
/// </summary>
/// <typeparam name="T">The type of items stored on the texture.</typeparam>
public abstract unsafe partial class Texture2D<T> : IReferenceTrackedObject, IGraphicsResource, ID3D12ReadWriteResource
public abstract unsafe partial class Texture2D<T> : IReferenceTrackedObject, IGraphicsResource, ID3D12ReadWriteResource, ID3D12ComputeFenceTrackedResource
where T : unmanaged
{
/// <summary>
@@ -63,6 +63,8 @@ public abstract unsafe partial class Texture2D<T> : IReferenceTrackedObject, IGr
/// </summary>
private D3D12_RESOURCE_STATES d3D12ResourceState;
private D3D12ComputeFenceTracker d3D12ComputeFenceTracker;
/// <summary>
/// Creates a new <see cref="Texture2D{T}"/> instance with the specified parameters.
/// </summary>
@@ -288,6 +290,14 @@ public abstract unsafe partial class Texture2D<T> : IReferenceTrackedObject, IGr
/// </summary>
internal D3D12_GPU_DESCRIPTOR_HANDLE D3D12GpuDescriptorHandle => this.d3D12ResourceDescriptorHandles.D3D12GpuDescriptorHandle;
internal ulong D3D12ComputeFenceValue => this.d3D12ComputeFenceTracker.Value;
/// <inheritdoc/>
void ID3D12ComputeFenceTrackedResource.MarkComputeFence(ulong d3D12FenceValue)
{
this.d3D12ComputeFenceTracker.Mark(d3D12FenceValue);
}
/// <summary>
/// Reads the contents of the specified range from the current <see cref="Texture2D{T}"/> instance and writes them into a target memory area.
/// </summary>
@@ -332,6 +342,8 @@ public abstract unsafe partial class Texture2D<T> : IReferenceTrackedObject, IGr
using (CommandList copyCommandList = new(GraphicsDevice, this.d3D12CommandListType))
{
copyCommandList.AddComputeFenceWait(D3D12ComputeFenceValue);
if (copyCommandList.D3D12CommandListType == D3D12_COMMAND_LIST_TYPE_COMPUTE)
{
copyCommandList.D3D12GraphicsCommandList->TransitionBarrier(D3D12Resource, this.d3D12ResourceState, D3D12_RESOURCE_STATE_COPY_SOURCE);
@@ -413,6 +425,9 @@ public abstract unsafe partial class Texture2D<T> : IReferenceTrackedObject, IGr
using CommandList copyCommandList = new(GraphicsDevice, d3D12CommandListType);
copyCommandList.AddComputeFenceWait(D3D12ComputeFenceValue);
copyCommandList.AddComputeFenceWait(destination.D3D12ComputeFenceValue);
if (copyCommandList.D3D12CommandListType == D3D12_COMMAND_LIST_TYPE_COMPUTE)
{
copyCommandList.D3D12GraphicsCommandList->TransitionBarrier(D3D12Resource, this.d3D12ResourceState, D3D12_RESOURCE_STATE_COPY_SOURCE);
@@ -476,6 +491,8 @@ public abstract unsafe partial class Texture2D<T> : IReferenceTrackedObject, IGr
using CommandList copyCommandList = new(GraphicsDevice, this.d3D12CommandListType);
copyCommandList.AddComputeFenceWait(D3D12ComputeFenceValue);
if (copyCommandList.D3D12CommandListType == D3D12_COMMAND_LIST_TYPE_COMPUTE)
{
copyCommandList.D3D12GraphicsCommandList->TransitionBarrier(D3D12Resource, this.d3D12ResourceState, D3D12_RESOURCE_STATE_COPY_SOURCE);
@@ -563,6 +580,8 @@ public abstract unsafe partial class Texture2D<T> : IReferenceTrackedObject, IGr
using CommandList copyCommandList = new(GraphicsDevice, this.d3D12CommandListType);
copyCommandList.AddComputeFenceWait(D3D12ComputeFenceValue);
if (copyCommandList.D3D12CommandListType == D3D12_COMMAND_LIST_TYPE_COMPUTE)
{
copyCommandList.D3D12GraphicsCommandList->TransitionBarrier(D3D12Resource, this.d3D12ResourceState, D3D12_RESOURCE_STATE_COPY_DEST);
@@ -625,6 +644,8 @@ public abstract unsafe partial class Texture2D<T> : IReferenceTrackedObject, IGr
using CommandList copyCommandList = new(GraphicsDevice, this.d3D12CommandListType);
copyCommandList.AddComputeFenceWait(D3D12ComputeFenceValue);
if (copyCommandList.D3D12CommandListType == D3D12_COMMAND_LIST_TYPE_COMPUTE)
{
copyCommandList.D3D12GraphicsCommandList->TransitionBarrier(D3D12Resource, this.d3D12ResourceState, D3D12_RESOURCE_STATE_COPY_DEST);
+22 -1
ファイルの表示
@@ -24,7 +24,7 @@ namespace ComputeSharp.Resources;
/// A <see langword="class"/> representing a typed 3D texture stored on GPU memory.
/// </summary>
/// <typeparam name="T">The type of items stored on the texture.</typeparam>
public abstract unsafe partial class Texture3D<T> : IReferenceTrackedObject, IGraphicsResource, ID3D12ReadWriteResource
public abstract unsafe partial class Texture3D<T> : IReferenceTrackedObject, IGraphicsResource, ID3D12ReadWriteResource, ID3D12ComputeFenceTrackedResource
where T : unmanaged
{
/// <summary>
@@ -62,6 +62,8 @@ public abstract unsafe partial class Texture3D<T> : IReferenceTrackedObject, IGr
/// </summary>
private D3D12_RESOURCE_STATES d3D12ResourceState;
private D3D12ComputeFenceTracker d3D12ComputeFenceTracker;
/// <summary>
/// Creates a new <see cref="Texture3D{T}"/> instance with the specified parameters.
/// </summary>
@@ -159,6 +161,14 @@ public abstract unsafe partial class Texture3D<T> : IReferenceTrackedObject, IGr
/// </summary>
internal D3D12_GPU_DESCRIPTOR_HANDLE D3D12GpuDescriptorHandle => this.d3D12ResourceDescriptorHandles.D3D12GpuDescriptorHandle;
internal ulong D3D12ComputeFenceValue => this.d3D12ComputeFenceTracker.Value;
/// <inheritdoc/>
void ID3D12ComputeFenceTrackedResource.MarkComputeFence(ulong d3D12FenceValue)
{
this.d3D12ComputeFenceTracker.Mark(d3D12FenceValue);
}
/// <summary>
/// Reads the contents of the specified range from the current <see cref="Texture3D{T}"/> instance and writes them into a target memory area.
/// </summary>
@@ -209,6 +219,8 @@ public abstract unsafe partial class Texture3D<T> : IReferenceTrackedObject, IGr
using (CommandList copyCommandList = new(GraphicsDevice, this.d3D12CommandListType))
{
copyCommandList.AddComputeFenceWait(D3D12ComputeFenceValue);
if (copyCommandList.D3D12CommandListType == D3D12_COMMAND_LIST_TYPE_COMPUTE)
{
copyCommandList.D3D12GraphicsCommandList->TransitionBarrier(D3D12Resource, this.d3D12ResourceState, D3D12_RESOURCE_STATE_COPY_SOURCE);
@@ -301,6 +313,9 @@ public abstract unsafe partial class Texture3D<T> : IReferenceTrackedObject, IGr
using CommandList copyCommandList = new(GraphicsDevice, d3D12CommandListType);
copyCommandList.AddComputeFenceWait(D3D12ComputeFenceValue);
copyCommandList.AddComputeFenceWait(destination.D3D12ComputeFenceValue);
if (copyCommandList.D3D12CommandListType == D3D12_COMMAND_LIST_TYPE_COMPUTE)
{
copyCommandList.D3D12GraphicsCommandList->TransitionBarrier(D3D12Resource, this.d3D12ResourceState, D3D12_RESOURCE_STATE_COPY_SOURCE);
@@ -373,6 +388,8 @@ public abstract unsafe partial class Texture3D<T> : IReferenceTrackedObject, IGr
using CommandList copyCommandList = new(GraphicsDevice, this.d3D12CommandListType);
copyCommandList.AddComputeFenceWait(D3D12ComputeFenceValue);
if (copyCommandList.D3D12CommandListType == D3D12_COMMAND_LIST_TYPE_COMPUTE)
{
copyCommandList.D3D12GraphicsCommandList->TransitionBarrier(D3D12Resource, this.d3D12ResourceState, D3D12_RESOURCE_STATE_COPY_SOURCE);
@@ -468,6 +485,8 @@ public abstract unsafe partial class Texture3D<T> : IReferenceTrackedObject, IGr
using CommandList copyCommandList = new(GraphicsDevice, this.d3D12CommandListType);
copyCommandList.AddComputeFenceWait(D3D12ComputeFenceValue);
if (copyCommandList.D3D12CommandListType == D3D12_COMMAND_LIST_TYPE_COMPUTE)
{
copyCommandList.D3D12GraphicsCommandList->TransitionBarrier(D3D12Resource, this.d3D12ResourceState, D3D12_RESOURCE_STATE_COPY_DEST);
@@ -539,6 +558,8 @@ public abstract unsafe partial class Texture3D<T> : IReferenceTrackedObject, IGr
using CommandList copyCommandList = new(GraphicsDevice, this.d3D12CommandListType);
copyCommandList.AddComputeFenceWait(D3D12ComputeFenceValue);
if (copyCommandList.D3D12CommandListType == D3D12_COMMAND_LIST_TYPE_COMPUTE)
{
copyCommandList.D3D12GraphicsCommandList->TransitionBarrier(D3D12Resource, this.d3D12ResourceState, D3D12_RESOURCE_STATE_COPY_DEST);
+7 -1
ファイルの表示
@@ -56,7 +56,7 @@ partial class ReadWriteTexture1D<T, TPixel>
/// <summary>
/// A wrapper for a <see cref="ReadWriteTexture1D{T, TPixel}"/> resource that has been temporarily transitioned to readonly.
/// </summary>
private sealed unsafe class ReadOnly : ReferenceTrackedObject, IReadOnlyNormalizedTexture1D<TPixel>, ID3D12ReadOnlyResource
private sealed unsafe class ReadOnly : ReferenceTrackedObject, IReadOnlyNormalizedTexture1D<TPixel>, ID3D12ReadOnlyResource, ID3D12ComputeFenceTrackedResource
{
/// <summary>
/// The owning <see cref="ReadWriteTexture1D{T, TPixel}"/> instance being wrapped.
@@ -120,6 +120,12 @@ partial class ReadWriteTexture1D<T, TPixel>
return this.owner.D3D12Resource;
}
/// <inheritdoc/>
void ID3D12ComputeFenceTrackedResource.MarkComputeFence(ulong d3D12FenceValue)
{
((ID3D12ComputeFenceTrackedResource)this.owner).MarkComputeFence(d3D12FenceValue);
}
/// <inheritdoc/>
protected override void DangerousOnDispose()
{
+7 -1
ファイルの表示
@@ -56,7 +56,7 @@ partial class ReadWriteTexture1D<T>
/// <summary>
/// A wrapper for a <see cref="ReadWriteTexture1D{T}"/> resource that has been temporarily transitioned to readonly.
/// </summary>
private sealed unsafe class ReadOnly : ReferenceTrackedObject, IReadOnlyTexture1D<T>, ID3D12ReadOnlyResource
private sealed unsafe class ReadOnly : ReferenceTrackedObject, IReadOnlyTexture1D<T>, ID3D12ReadOnlyResource, ID3D12ComputeFenceTrackedResource
{
/// <summary>
/// The owning <see cref="ReadWriteTexture1D{T}"/> instance being wrapped.
@@ -120,6 +120,12 @@ partial class ReadWriteTexture1D<T>
return this.owner.D3D12Resource;
}
/// <inheritdoc/>
void ID3D12ComputeFenceTrackedResource.MarkComputeFence(ulong d3D12FenceValue)
{
((ID3D12ComputeFenceTrackedResource)this.owner).MarkComputeFence(d3D12FenceValue);
}
/// <inheritdoc/>
protected override void DangerousOnDispose()
{
+7 -1
ファイルの表示
@@ -56,7 +56,7 @@ partial class ReadWriteTexture2D<T, TPixel>
/// <summary>
/// A wrapper for a <see cref="ReadWriteTexture2D{T, TPixel}"/> resource that has been temporarily transitioned to readonly.
/// </summary>
private sealed unsafe class ReadOnly : ReferenceTrackedObject, IReadOnlyNormalizedTexture2D<TPixel>, ID3D12ReadOnlyResource
private sealed unsafe class ReadOnly : ReferenceTrackedObject, IReadOnlyNormalizedTexture2D<TPixel>, ID3D12ReadOnlyResource, ID3D12ComputeFenceTrackedResource
{
/// <summary>
/// The owning <see cref="ReadWriteTexture2D{T, TPixel}"/> instance being wrapped.
@@ -132,6 +132,12 @@ partial class ReadWriteTexture2D<T, TPixel>
return this.owner.D3D12Resource;
}
/// <inheritdoc/>
void ID3D12ComputeFenceTrackedResource.MarkComputeFence(ulong d3D12FenceValue)
{
((ID3D12ComputeFenceTrackedResource)this.owner).MarkComputeFence(d3D12FenceValue);
}
/// <inheritdoc/>
protected override void DangerousOnDispose()
{
+7 -1
ファイルの表示
@@ -59,7 +59,7 @@ partial class ReadWriteTexture2D<T>
/// <summary>
/// A wrapper for a <see cref="ReadWriteTexture2D{T}"/> resource that has been temporarily transitioned to readonly.
/// </summary>
private sealed unsafe class ReadOnly : ReferenceTrackedObject, IReadOnlyTexture2D<T>, ID3D12ReadOnlyResource
private sealed unsafe class ReadOnly : ReferenceTrackedObject, IReadOnlyTexture2D<T>, ID3D12ReadOnlyResource, ID3D12ComputeFenceTrackedResource
{
/// <summary>
/// The owning <see cref="ReadWriteTexture2D{T}"/> instance being wrapped.
@@ -132,6 +132,12 @@ partial class ReadWriteTexture2D<T>
return this.owner.D3D12Resource;
}
/// <inheritdoc/>
void ID3D12ComputeFenceTrackedResource.MarkComputeFence(ulong d3D12FenceValue)
{
((ID3D12ComputeFenceTrackedResource)this.owner).MarkComputeFence(d3D12FenceValue);
}
/// <inheritdoc/>
protected override void DangerousOnDispose()
{
+7 -1
ファイルの表示
@@ -56,7 +56,7 @@ partial class ReadWriteTexture3D<T, TPixel>
/// <summary>
/// A wrapper for a <see cref="ReadWriteTexture3D{T, TPixel}"/> resource that has been temporarily transitioned to readonly.
/// </summary>
private sealed unsafe class ReadOnly : ReferenceTrackedObject, IReadOnlyNormalizedTexture3D<TPixel>, ID3D12ReadOnlyResource
private sealed unsafe class ReadOnly : ReferenceTrackedObject, IReadOnlyNormalizedTexture3D<TPixel>, ID3D12ReadOnlyResource, ID3D12ComputeFenceTrackedResource
{
/// <summary>
/// The owning <see cref="ReadWriteTexture3D{T, TPixel}"/> instance being wrapped.
@@ -132,6 +132,12 @@ partial class ReadWriteTexture3D<T, TPixel>
return this.owner.D3D12Resource;
}
/// <inheritdoc/>
void ID3D12ComputeFenceTrackedResource.MarkComputeFence(ulong d3D12FenceValue)
{
((ID3D12ComputeFenceTrackedResource)this.owner).MarkComputeFence(d3D12FenceValue);
}
/// <inheritdoc/>
protected override void DangerousOnDispose()
{
+7 -1
ファイルの表示
@@ -56,7 +56,7 @@ partial class ReadWriteTexture3D<T>
/// <summary>
/// A wrapper for a <see cref="ReadWriteTexture3D{T}"/> resource that has been temporarily transitioned to readonly.
/// </summary>
private sealed unsafe class ReadOnly : ReferenceTrackedObject, IReadOnlyTexture3D<T>, ID3D12ReadOnlyResource
private sealed unsafe class ReadOnly : ReferenceTrackedObject, IReadOnlyTexture3D<T>, ID3D12ReadOnlyResource, ID3D12ComputeFenceTrackedResource
{
/// <summary>
/// The owning <see cref="ReadWriteTexture3D{T}"/> instance being wrapped.
@@ -132,6 +132,12 @@ partial class ReadWriteTexture3D<T>
return this.owner.D3D12Resource;
}
/// <inheritdoc/>
void ID3D12ComputeFenceTrackedResource.MarkComputeFence(ulong d3D12FenceValue)
{
((ID3D12ComputeFenceTrackedResource)this.owner).MarkComputeFence(d3D12FenceValue);
}
/// <inheritdoc/>
protected override void DangerousOnDispose()
{