forked from Misaki/GhostEngine
Refactor GPU resource management and rendering pipeline
- Introduced `Handle<T>` and `Identifier<T>` for lightweight, strongly-typed resource identifiers. - Replaced `BitSet` with `UnsafeBitSet` for improved performance and memory safety. - Refactored `Mesh` and `Material` into `MeshClass` and `MaterialClass` for better GPU resource handling. - Added `D3D12ResourceDatabase` to centralize GPU resource tracking and lifecycle management. - Updated `D3D12ShaderCompiler` to load shaders from disk and dynamically populate constant buffers and textures. - Enhanced `ICommandBuffer` with new upload operations for buffers and textures. - Refactored `Vertex` struct for simplified memory layout and better performance. - Updated `MeshBuilder` and rendering logic to align with new resource and shader structures. - Added `BindlessDescriptor` support to `TextureHandle` and `BufferHandle`. - Removed unused classes and performed general cleanup. - Updated unit tests and demos to reflect the new architecture.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using Misaki.HighPerformance.Mathematics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Misaki.HighPerformance.LowLevel.Collections;
|
||||
using Misaki.HighPerformance.Mathematics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using Win32.Graphics.Dxgi.Common;
|
||||
|
||||
namespace Ghost.Graphics.Data;
|
||||
@@ -9,59 +8,21 @@ namespace Ghost.Graphics.Data;
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Vertex
|
||||
{
|
||||
public unsafe struct Semantic
|
||||
public unsafe static class Semantic
|
||||
{
|
||||
public const Format ALIGNED_FORMAT = Format.R32G32B32A32Float;
|
||||
public const int COUNT = 5;
|
||||
|
||||
private static readonly byte[] s_positionBytes = Encoding.UTF8.GetBytes("POSITION");
|
||||
private static readonly byte[] s_normalBytes = Encoding.UTF8.GetBytes("NORMAL");
|
||||
private static readonly byte[] s_tangentBytes = Encoding.UTF8.GetBytes("TANGENT");
|
||||
private static readonly byte[] s_colorBytes = Encoding.UTF8.GetBytes("COLOR");
|
||||
private static readonly byte[] s_uvBytes = Encoding.UTF8.GetBytes("TEXCOORD");
|
||||
|
||||
public static byte* pPositionName => (byte*)Unsafe.AsPointer(ref s_positionBytes[0]);
|
||||
public static byte* pNormalName => (byte*)Unsafe.AsPointer(ref s_normalBytes[0]);
|
||||
public static byte* pTangentName => (byte*)Unsafe.AsPointer(ref s_tangentBytes[0]);
|
||||
public static byte* pColorName => (byte*)Unsafe.AsPointer(ref s_colorBytes[0]);
|
||||
public static byte* pUVName => (byte*)Unsafe.AsPointer(ref s_uvBytes[0]);
|
||||
public static readonly FixedString32 position = new("POSITION");
|
||||
public static readonly FixedString32 normal = new("NORMAL");
|
||||
public static readonly FixedString32 tangent = new("TANGENT");
|
||||
public static readonly FixedString32 uv = new("TEXCOORD");
|
||||
public static readonly FixedString32 color = new("COLOR");
|
||||
}
|
||||
|
||||
public float4 Position
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public float4 Normal
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public float4 Tangent
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public Color16 Color
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public float4 UV
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public Vertex(float4 position, float4 normal, float4 tangent, Color16 color, float4 uv)
|
||||
{
|
||||
Position = position;
|
||||
Normal = normal;
|
||||
Tangent = tangent;
|
||||
Color = color;
|
||||
UV = uv;
|
||||
}
|
||||
public float4 position;
|
||||
public float4 normal;
|
||||
public float4 tangent;
|
||||
public float4 uv;
|
||||
public Color128 color;
|
||||
}
|
||||
Reference in New Issue
Block a user