forked from Misaki/GhostEngine
Removed references to `Misaki.HighPerformance.Unsafe` and replaced them with `Misaki.HighPerformance.LowLevel` in multiple files. Removed calls to `AllocationManager.Initialize()` and `AllocationManager.Dispose()` in `EngineCore.cs`. Added new methods to the `ICommandBuffer` interface for enhanced rendering capabilities. Updated the `D3D12CommandBuffer` class to implement new graphics command handling methods. Added the `Material` class to manage shader properties and caching for improved performance. Encapsulated shader compilation and reflection processes within the `Shader` class for better organization. Added the `CBufferCache` struct to optimize GPU resource management for constant buffer data. Updated the `MeshRenderPass` class to utilize the new `Material` class for dynamic mesh rendering. Updated various project files to reflect the restructuring of dependencies. Modified XAML files and code-behind for improved readability and maintainability.
48 lines
1.0 KiB
C#
48 lines
1.0 KiB
C#
using Misaki.HighPerformance.LowLevel.Buffer;
|
|
using Misaki.HighPerformance.LowLevel.Collections;
|
|
using Misaki.HighPerformance.LowLevel.Helpers;
|
|
|
|
namespace Ghost.Graphics.Shading;
|
|
|
|
public enum ShaderPropertyType
|
|
{
|
|
Float,
|
|
Float2,
|
|
Float3,
|
|
Float4,
|
|
Color,
|
|
Matrix,
|
|
Texture2D,
|
|
Texture3D
|
|
}
|
|
|
|
public struct ShaderProperty : IDisposable
|
|
{
|
|
private UnsafeArray<byte> _value;
|
|
private FixedString128 _name;
|
|
private readonly uint _valueOffset;
|
|
|
|
internal readonly uint Offset => _valueOffset;
|
|
|
|
public readonly string Name => _name.Value;
|
|
public readonly ReadOnlySpan<byte> Value => _value.AsSpan();
|
|
|
|
public ShaderPropertyType PropertyType
|
|
{
|
|
get;
|
|
}
|
|
|
|
public ShaderProperty(Span<byte> value, uint offset, string name, ShaderPropertyType type)
|
|
{
|
|
_value = new(value.Length, Allocator.Persistent);
|
|
_valueOffset = offset;
|
|
_name = new(name);
|
|
PropertyType = type;
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
_value.Dispose();
|
|
_name.Dispose();
|
|
}
|
|
} |