Refactor descriptor handling and shader compilation
Refactored descriptor allocation and release logic by introducing `IDescriptorAllocator` and replacing `DescriptorHeapAllocator` with `D3D12DescriptorHeap`. Updated descriptor structs to include validation properties and improved memory management with `ReadOnlySpan`. Enhanced shader compilation by introducing `ShaderStage` and `CompilerVersion` enums, enabling more flexible and maintainable shader handling. Refactored `Mesh` to use `IBuffer` for vertex and index buffers, added bindless descriptor support, and improved resource cleanup. Updated `RenderSystem` and other components for better initialization, error handling, and disposal logic. General improvements to code readability and maintainability.
This commit is contained in:
@@ -165,7 +165,16 @@ public struct RenderTargetDesc
|
||||
usage |= TextureUsage.UnorderedAccess;
|
||||
}
|
||||
|
||||
return new TextureDesc(desc.Width, desc.Height, desc.Slice, desc.Format, desc.Dimension, desc.MipLevels, usage);
|
||||
return new TextureDesc
|
||||
{
|
||||
Width = desc.Width,
|
||||
Height = desc.Height,
|
||||
Slice = desc.Slice,
|
||||
Format = desc.Format,
|
||||
Dimension = desc.Dimension,
|
||||
MipLevels = desc.MipLevels,
|
||||
Usage = usage
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,19 +245,6 @@ public struct TextureDesc
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public TextureDesc(uint width, uint height, uint slice = 1,
|
||||
TextureFormat format = TextureFormat.R8G8B8A8_UNorm, TextureDimension dimension = TextureDimension.Texture2D,
|
||||
uint mipLevels = 0u, TextureUsage usage = TextureUsage.ShaderResource)
|
||||
{
|
||||
Width = width;
|
||||
Height = height;
|
||||
Slice = slice;
|
||||
Format = format;
|
||||
Dimension = dimension;
|
||||
MipLevels = mipLevels;
|
||||
Usage = usage;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -265,6 +261,12 @@ public struct BufferDesc
|
||||
set;
|
||||
}
|
||||
|
||||
public uint Stride
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Buffer usage flags
|
||||
/// </summary>
|
||||
@@ -274,6 +276,12 @@ public struct BufferDesc
|
||||
set;
|
||||
}
|
||||
|
||||
public BufferCreationFlags CreationFlags
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Memory type for the buffer
|
||||
/// </summary>
|
||||
@@ -282,13 +290,6 @@ public struct BufferDesc
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public BufferDesc(ulong size, BufferUsage usage, MemoryType memoryType = MemoryType.Default)
|
||||
{
|
||||
Size = size;
|
||||
Usage = usage;
|
||||
MemoryType = memoryType;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user