Minor code refactoring
このコミットが含まれているのは:
1 親
4e370a17a6
コミット
42049c7a62
2ファイル変更
+10
-4
検索条件に一致するファイルはありません
@@ -12,6 +12,8 @@ using Microsoft.Toolkit.Diagnostics;
|
||||
using TerraFX.Interop;
|
||||
using static TerraFX.Interop.D3D12_COMMAND_LIST_TYPE;
|
||||
using static TerraFX.Interop.D3D12_RESOURCE_STATES;
|
||||
using static TerraFX.Interop.D3D12_SRV_DIMENSION;
|
||||
using static TerraFX.Interop.D3D12_UAV_DIMENSION;
|
||||
using FX = TerraFX.Interop.Windows;
|
||||
|
||||
namespace ComputeSharp.Graphics.Buffers.Abstract
|
||||
@@ -69,10 +71,10 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
|
||||
switch (resourceType)
|
||||
{
|
||||
case ResourceType.ReadOnly:
|
||||
device.D3D12Device->CreateShaderResourceView(this.d3D12Resource, DXGIFormatHelper.GetForType<T>(), d3D12CpuDescriptorHandle);
|
||||
device.D3D12Device->CreateShaderResourceView(this.d3D12Resource, DXGIFormatHelper.GetForType<T>(), D3D12_SRV_DIMENSION_TEXTURE2D, d3D12CpuDescriptorHandle);
|
||||
break;
|
||||
case ResourceType.ReadWrite:
|
||||
device.D3D12Device->CreateUnorderedAccessView(this.d3D12Resource, DXGIFormatHelper.GetForType<T>(), d3D12CpuDescriptorHandle);
|
||||
device.D3D12Device->CreateUnorderedAccessView(this.d3D12Resource, DXGIFormatHelper.GetForType<T>(), D3D12_UAV_DIMENSION_TEXTURE2D, d3D12CpuDescriptorHandle);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,15 +242,17 @@ namespace ComputeSharp.Graphics.Extensions
|
||||
/// <param name="d3D12Device">The target <see cref="ID3D12Device"/> instance in use.</param>
|
||||
/// <param name="d3D12Resource">The <see cref="ID3D12Resource"/> to create a view for.</param>
|
||||
/// <param name="dxgiFormat">The <see cref="DXGI_FORMAT"/> value to use.</param>
|
||||
/// <param name="d3D12SrvDimension">The <see cref="D3D12_SRV_DIMENSION"/> value for the view to create.</param>
|
||||
/// <param name="d3D12CpuDescriptorHandle">The <see cref="D3D12_CPU_DESCRIPTOR_HANDLE"/> instance for the current resource.</param>
|
||||
public static void CreateShaderResourceView(
|
||||
this ref ID3D12Device d3D12Device,
|
||||
ID3D12Resource* d3D12Resource,
|
||||
DXGI_FORMAT dxgiFormat,
|
||||
D3D12_SRV_DIMENSION d3D12SrvDimension,
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE d3D12CpuDescriptorHandle)
|
||||
{
|
||||
D3D12_SHADER_RESOURCE_VIEW_DESC d3D12ShaderResourceViewDescription = default;
|
||||
d3D12ShaderResourceViewDescription.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
|
||||
d3D12ShaderResourceViewDescription.ViewDimension = d3D12SrvDimension;
|
||||
d3D12ShaderResourceViewDescription.Format = dxgiFormat;
|
||||
d3D12ShaderResourceViewDescription.Shader4ComponentMapping = FX.D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
|
||||
d3D12ShaderResourceViewDescription.Texture2D.MipLevels = uint.MaxValue;
|
||||
@@ -287,15 +289,17 @@ namespace ComputeSharp.Graphics.Extensions
|
||||
/// <param name="d3D12Device">The target <see cref="ID3D12Device"/> instance in use.</param>
|
||||
/// <param name="d3D12Resource">The <see cref="ID3D12Resource"/> to create a view for.</param>
|
||||
/// <param name="dxgiFormat">The <see cref="DXGI_FORMAT"/> value to use.</param>
|
||||
/// <param name="d3D12UavDimension">The <see cref="D3D12_UAV_DIMENSION"/> value for the view to create.</param>
|
||||
/// <param name="d3D12CpuDescriptorHandle">The <see cref="D3D12_CPU_DESCRIPTOR_HANDLE"/> instance for the current resource.</param>
|
||||
public static void CreateUnorderedAccessView(
|
||||
this ref ID3D12Device d3D12Device,
|
||||
ID3D12Resource* d3D12Resource,
|
||||
DXGI_FORMAT dxgiFormat,
|
||||
D3D12_UAV_DIMENSION d3D12UavDimension,
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE d3D12CpuDescriptorHandle)
|
||||
{
|
||||
D3D12_UNORDERED_ACCESS_VIEW_DESC d3D12UnorderedAccessViewDescription = default;
|
||||
d3D12UnorderedAccessViewDescription.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE2D;
|
||||
d3D12UnorderedAccessViewDescription.ViewDimension = d3D12UavDimension;
|
||||
d3D12UnorderedAccessViewDescription.Format = dxgiFormat;
|
||||
|
||||
d3D12Device.CreateUnorderedAccessView(d3D12Resource, null, &d3D12UnorderedAccessViewDescription, d3D12CpuDescriptorHandle);
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする