Minor code tweaks, rearranged height/width
このコミットが含まれているのは:
1 親
4c8fadac6f
コミット
705b47c0ee
2ファイル変更
+23
-11
検索条件に一致するファイルはありません
@@ -27,22 +27,24 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
|
||||
internal readonly D3D12_GPU_DESCRIPTOR_HANDLE D3D12GpuDescriptorHandle;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Buffer{T}"/> instance with the specified parameters.
|
||||
/// Creates a new <see cref="Texture2D{T}"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="device">The <see cref="GraphicsDevice"/> associated with the current instance.</param>
|
||||
/// <param name="length">The number of items to store in the current buffer.</param>
|
||||
/// <param name="elementSizeInBytes">The size in bytes of each buffer item (including padding, if any).</param>
|
||||
/// <param name="bufferType">The buffer type for the current buffer.</param>
|
||||
private protected Texture2D(GraphicsDevice device, int height, int width, TextureType textureType)
|
||||
/// <param name="device">The <see cref="Graphics.GraphicsDevice"/> associated with the current instance.</param>
|
||||
/// <param name="height">The height of the texture.</param>
|
||||
/// <param name="width">The width of the texture.</param>
|
||||
/// <param name="textureType">The texture type for the current texture.</param>
|
||||
private protected Texture2D(GraphicsDevice device, int width, int height, TextureType textureType)
|
||||
{
|
||||
device.ThrowIfDisposed();
|
||||
|
||||
Guard.IsGreaterThanOrEqualTo(height, 0, nameof(height));
|
||||
Guard.IsGreaterThanOrEqualTo(width, 0, nameof(width));
|
||||
Guard.IsGreaterThanOrEqualTo(height, 0, nameof(height));
|
||||
|
||||
GraphicsDevice = device;
|
||||
Width = width;
|
||||
Height = height;
|
||||
|
||||
this.d3D12Resource = device.D3D12Device->CreateCommittedResource(textureType, DXGIFormatHelper.GetForType<T>(), (uint)height, (uint)width);
|
||||
this.d3D12Resource = device.D3D12Device->CreateCommittedResource(textureType, DXGIFormatHelper.GetForType<T>(), (uint)width, (uint)height);
|
||||
|
||||
device.AllocateShaderResourceViewDescriptorHandles(out D3D12_CPU_DESCRIPTOR_HANDLE d3D12CpuDescriptorHandle, out D3D12GpuDescriptorHandle);
|
||||
|
||||
@@ -62,6 +64,16 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
|
||||
/// </summary>
|
||||
public GraphicsDevice GraphicsDevice { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the width of the current texture.
|
||||
/// </summary>
|
||||
public int Width { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the height of the current texture.
|
||||
/// </summary>
|
||||
public int Height { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="ID3D12Resource"/> instance currently mapped.
|
||||
/// </summary>
|
||||
|
||||
@@ -147,15 +147,15 @@ namespace ComputeSharp.Graphics.Extensions
|
||||
/// <param name="d3D12Device">The <see cref="ID3D12Device"/> instance in use.</param>
|
||||
/// <param name="textureType">The texture type currently in use.</param>
|
||||
/// <param name="dxgiFormat">The <see cref="DXGI_FORMAT"/> value to use.</param>
|
||||
/// <param name="height">The height of the texture resource.</param>
|
||||
/// <param name="width">The width of the texture resource.</param>
|
||||
/// <param name="height">The height of the texture resource.</param>
|
||||
/// <returns>An <see cref="ID3D12Resource"/> reference for the current texture.</returns>
|
||||
public static ComPtr<ID3D12Resource> CreateCommittedResource(
|
||||
this ref ID3D12Device d3D12Device,
|
||||
TextureType textureType,
|
||||
DXGI_FORMAT dxgiFormat,
|
||||
uint height,
|
||||
uint width)
|
||||
uint width,
|
||||
uint height)
|
||||
{
|
||||
D3D12_RESOURCE_FLAGS d3D12ResourceFlags = textureType switch
|
||||
{
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする