Minor code tweaks
このコミットが含まれているのは:
1 親
941265a416
コミット
d7cd682936
2ファイル変更
+13
-8
検索条件に一致するファイルはありません
@@ -14,15 +14,15 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
|
||||
/// <summary>
|
||||
/// The <see cref="ID3D12Resource"/> instance currently mapped.
|
||||
/// </summary>
|
||||
protected internal readonly ID3D12Resource* D3D12Resource;
|
||||
private ComPtr<ID3D12Resource> d3D12Resource;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="GraphicsResource"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="device">The <see cref="GraphicsDevice"/> associated with the current instance.</param>
|
||||
protected GraphicsResource(GraphicsDevice device, ID3D12Resource* d3d12resource)
|
||||
protected GraphicsResource(GraphicsDevice device, ComPtr<ID3D12Resource> d3d12resource)
|
||||
{
|
||||
D3D12Resource = d3d12resource;
|
||||
this.d3D12Resource = d3d12resource;
|
||||
|
||||
GraphicsDevice = device;
|
||||
}
|
||||
@@ -32,6 +32,11 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
|
||||
/// </summary>
|
||||
public GraphicsDevice GraphicsDevice { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="ID3D12Resource"/> instance currently mapped.
|
||||
/// </summary>
|
||||
internal ID3D12Resource* D3D12Resource => this.d3D12Resource;
|
||||
|
||||
/// <summary>
|
||||
/// Maps the current resource to a specified subresource.
|
||||
/// </summary>
|
||||
@@ -39,13 +44,13 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal MappedResource MapResource()
|
||||
{
|
||||
return new MappedResource(D3D12Resource);
|
||||
return new MappedResource(d3D12Resource);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void OnDispose()
|
||||
{
|
||||
D3D12Resource->Release();
|
||||
d3D12Resource.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -70,7 +75,7 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public MappedResource(ID3D12Resource* d3d12resource)
|
||||
{
|
||||
d3D12Resource = d3d12resource;
|
||||
this.d3D12Resource = d3d12resource;
|
||||
|
||||
Pointer = d3d12resource->Map();
|
||||
}
|
||||
@@ -79,7 +84,7 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Dispose()
|
||||
{
|
||||
d3D12Resource->Unmap();
|
||||
this.d3D12Resource->Unmap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace ComputeSharp.Graphics.Buffers
|
||||
/// <param name="bufferType">The buffer type currently in use.</param>
|
||||
/// <param name="sizeInBytes">The size in bytes of the current buffer.</param>
|
||||
/// <returns>An <see cref="ID3D12Resource"/> reference for the current buffer.</returns>
|
||||
private static ID3D12Resource* CreateCommittedResource(ID3D12Device* d3D12Device, BufferType bufferType, int sizeInBytes)
|
||||
private static ComPtr<ID3D12Resource> CreateCommittedResource(ID3D12Device* d3D12Device, BufferType bufferType, int sizeInBytes)
|
||||
{
|
||||
(D3D12_HEAP_TYPE d3D12HeapType,
|
||||
D3D12_RESOURCE_FLAGS d3D12ResourceFlags,
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする