Minor tweaks to ComPtr<T> ownership
このコミットが含まれているのは:
1 親
9188404345
コミット
adad3cccd9
6ファイル変更
+17
-17
検索条件に一致するファイルはありません
@@ -23,10 +23,10 @@ namespace ComputeSharp.Graphics.Commands
|
||||
/// </summary>
|
||||
/// <param name="d3D12RootSignature">The <see cref="ID3D12RootSignature"/> value for the current shader.</param>
|
||||
/// <param name="d3D12PipelineState">The compiled pipeline state to reuse for the current shader.</param>
|
||||
public PipelineData(ComPtr<ID3D12RootSignature> d3D12RootSignature, ComPtr<ID3D12PipelineState> d3D12PipelineState)
|
||||
public PipelineData(ID3D12RootSignature* d3D12RootSignature, ID3D12PipelineState* d3D12PipelineState)
|
||||
{
|
||||
this.d3D12RootSignature = d3D12RootSignature;
|
||||
this.d3D12PipelineState = d3D12PipelineState;
|
||||
this.d3D12RootSignature = new ComPtr<ID3D12RootSignature>(d3D12RootSignature);
|
||||
this.d3D12PipelineState = new ComPtr<ID3D12PipelineState>(d3D12PipelineState);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -83,13 +83,13 @@ namespace ComputeSharp
|
||||
/// <param name="d3D12Device">The <see cref="ID3D12Device"/> to use for the new <see cref="GraphicsDevice"/> instance.</param>
|
||||
/// <param name="dxgiAdapter">The <see cref="IDXGIAdapter"/> that <paramref name="d3D12Device"/> was created from.</param>
|
||||
/// <param name="dxgiDescription1">The available info for the new <see cref="GraphicsDevice"/> instance.</param>
|
||||
internal GraphicsDevice(ComPtr<ID3D12Device> d3D12Device, IDXGIAdapter* dxgiAdapter, DXGI_ADAPTER_DESC1* dxgiDescription1)
|
||||
internal GraphicsDevice(ID3D12Device* d3D12Device, IDXGIAdapter* dxgiAdapter, DXGI_ADAPTER_DESC1* dxgiDescription1)
|
||||
{
|
||||
this.d3D12Device = d3D12Device;
|
||||
this.d3D12ComputeCommandQueue = d3D12Device.Get()->CreateCommandQueue(D3D12_COMMAND_LIST_TYPE_COMPUTE);
|
||||
this.d3D12CopyCommandQueue = d3D12Device.Get()->CreateCommandQueue(D3D12_COMMAND_LIST_TYPE_COPY);
|
||||
this.d3D12ComputeFence = d3D12Device.Get()->CreateFence();
|
||||
this.d3D12CopyFence = d3D12Device.Get()->CreateFence();
|
||||
this.d3D12Device = new ComPtr<ID3D12Device>(d3D12Device);
|
||||
this.d3D12ComputeCommandQueue = d3D12Device->CreateCommandQueue(D3D12_COMMAND_LIST_TYPE_COMPUTE);
|
||||
this.d3D12CopyCommandQueue = d3D12Device->CreateCommandQueue(D3D12_COMMAND_LIST_TYPE_COPY);
|
||||
this.d3D12ComputeFence = d3D12Device->CreateFence();
|
||||
this.d3D12CopyFence = d3D12Device->CreateFence();
|
||||
|
||||
this.computeCommandAllocatorPool = new ID3D12CommandAllocatorPool(D3D12_COMMAND_LIST_TYPE_COMPUTE);
|
||||
this.copyCommandAllocatorPool = new ID3D12CommandAllocatorPool(D3D12_COMMAND_LIST_TYPE_COPY);
|
||||
@@ -101,17 +101,17 @@ namespace ComputeSharp
|
||||
SharedMemorySize = dxgiDescription1->SharedSystemMemory;
|
||||
IsHardwareAccelerated = (dxgiDescription1->Flags & (uint)DXGI_ADAPTER_FLAG_SOFTWARE) == 0;
|
||||
|
||||
var d3D12Options1Data = d3D12Device.Get()->CheckFeatureSupport<D3D12_FEATURE_DATA_D3D12_OPTIONS1>(D3D12_FEATURE_D3D12_OPTIONS1);
|
||||
var d3D12Options1Data = d3D12Device->CheckFeatureSupport<D3D12_FEATURE_DATA_D3D12_OPTIONS1>(D3D12_FEATURE_D3D12_OPTIONS1);
|
||||
|
||||
ComputeUnits = d3D12Options1Data.TotalLaneCount;
|
||||
WavefrontSize = d3D12Options1Data.WaveLaneCountMin;
|
||||
|
||||
var d3D12Architecture1Data = d3D12Device.Get()->CheckFeatureSupport<D3D12_FEATURE_DATA_ARCHITECTURE1>(D3D12_FEATURE_ARCHITECTURE1);
|
||||
var d3D12Architecture1Data = d3D12Device->CheckFeatureSupport<D3D12_FEATURE_DATA_ARCHITECTURE1>(D3D12_FEATURE_ARCHITECTURE1);
|
||||
|
||||
IsCacheCoherentUMA = d3D12Architecture1Data.CacheCoherentUMA != 0;
|
||||
|
||||
ALLOCATOR_DESC allocatorDesc = default;
|
||||
allocatorDesc.pDevice = d3D12Device.Get();
|
||||
allocatorDesc.pDevice = d3D12Device;
|
||||
allocatorDesc.pAdapter = dxgiAdapter;
|
||||
|
||||
fixed (Allocator** allocator = &this.allocator)
|
||||
|
||||
@@ -141,7 +141,7 @@ namespace ComputeSharp.Graphics.Helpers
|
||||
FX.__uuidof<ID3D12Device>(),
|
||||
d3D12Device.GetVoidAddressOf()).Assert();
|
||||
|
||||
this.graphicsDevice = GetOrCreateDevice(d3D12Device.Move(), (IDXGIAdapter*)dxgiAdapter1.Get(), &dxgiDescription1);
|
||||
this.graphicsDevice = GetOrCreateDevice(d3D12Device.Get(), (IDXGIAdapter*)dxgiAdapter1.Get(), &dxgiDescription1);
|
||||
this.isCompleted = true;
|
||||
|
||||
return true;
|
||||
@@ -182,7 +182,7 @@ namespace ComputeSharp.Graphics.Helpers
|
||||
FX.__uuidof<ID3D12Device>(),
|
||||
d3D12Device.GetVoidAddressOf()).Assert();
|
||||
|
||||
this.graphicsDevice = GetOrCreateDevice(d3D12Device.Move(), (IDXGIAdapter*)dxgiAdapter1.Get(), &dxgiDescription1);
|
||||
this.graphicsDevice = GetOrCreateDevice(d3D12Device.Get(), (IDXGIAdapter*)dxgiAdapter1.Get(), &dxgiDescription1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace ComputeSharp.Graphics.Helpers
|
||||
/// <param name="dxgiAdapter">The <see cref="IDXGIAdapter"/> that <paramref name="d3D12Device"/> was created from.</param>
|
||||
/// <param name="dxgiDescription1">The available info for the <see cref="GraphicsDevice"/> instance.</param>
|
||||
/// <returns>A <see cref="GraphicsDevice"/> instance for the input device.</returns>
|
||||
private static unsafe GraphicsDevice GetOrCreateDevice(ComPtr<ID3D12Device> d3D12Device, IDXGIAdapter* dxgiAdapter, DXGI_ADAPTER_DESC1* dxgiDescription1)
|
||||
private static unsafe GraphicsDevice GetOrCreateDevice(ID3D12Device* d3D12Device, IDXGIAdapter* dxgiAdapter, DXGI_ADAPTER_DESC1* dxgiDescription1)
|
||||
{
|
||||
lock (DevicesCache)
|
||||
{
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace ComputeSharp.Graphics.Helpers
|
||||
if (TryGetDefaultDevice(d3D12Device.GetAddressOf(), dxgiAdapter.GetAddressOf(), &dxgiDescription1) ||
|
||||
TryGetWarpDevice(d3D12Device.GetAddressOf(), dxgiAdapter.GetAddressOf(), &dxgiDescription1))
|
||||
{
|
||||
return GetOrCreateDevice(d3D12Device.Move(), dxgiAdapter.Get(), &dxgiDescription1);
|
||||
return GetOrCreateDevice(d3D12Device.Get(), dxgiAdapter.Get(), &dxgiDescription1);
|
||||
}
|
||||
|
||||
return ThrowHelper.ThrowNotSupportedException<GraphicsDevice>("There isn't a supported GPU device on the current machine");
|
||||
|
||||
@@ -212,7 +212,7 @@ namespace ComputeSharp.Shaders
|
||||
using ComPtr<ID3D12RootSignature> d3D12RootSignature = device.D3D12Device->CreateRootSignature(shaderData.Loader.D3D12Root32BitConstantsCount, shaderData.Loader.D3D12DescriptorRanges1);
|
||||
using ComPtr<ID3D12PipelineState> d3D12PipelineState = device.D3D12Device->CreateComputePipelineState(d3D12RootSignature.Get(), shaderData.Bytecode.D3D12ShaderBytecode);
|
||||
|
||||
pipelineData = new PipelineData(d3D12RootSignature.Move(), d3D12PipelineState.Move());
|
||||
pipelineData = new PipelineData(d3D12RootSignature.Get(), d3D12PipelineState.Get());
|
||||
|
||||
shaderData.CachedPipelines.Add(device, pipelineData);
|
||||
}
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする