Files
GhostEngine/Ghost.Graphics/Data/Vertex.cs
Misaki 1284bb17de Refactor graphics architecture and resource management
Added DescriptorAllocator.cs to manage descriptor allocations for Direct3D 12.
Added Texture2D.cs to handle 2D textures and GPU resource creation.
Added DescriptorAllocatorExample.cs to demonstrate the new descriptor allocator interface.

Changed project files to reference Misaki.HighPerformance.LowLevel instead of Misaki.HighPerformance.Unsafe.
Changed _renderView type from IRenderer? to Renderer? in ScenePage.xaml.cs.
Changed EngineCore.cs to remove explicit graphics API specification during initialization.
Changed Logger.cs to enhance the Assert method with a DoesNotReturnIf attribute.
Changed resource types in Mesh.cs from IResource to GraphicsResource.

Removed multiple interfaces including ICommandBuffer, IDebugLayer, IGraphicsDevice, IPipelineResource, IRenderPass, IRenderer, IResource, and IResourceAllocator to simplify the graphics architecture.
Removed D3D12DebugLayer class from DebugLayer.cs to streamline the debug layer implementation.

Updated CommandList.cs and D3D12CommandBuffer.cs to implement a new command list structure for Direct3D 12.
Updated Material.cs to improve handling of constant buffers and textures.
Updated Shader.cs to include new structures for texture and property information.
Updated GraphicsPipeline.cs to support the new graphics device and resource management system.
Updated UnitTestAppWindow.xaml.cs to reflect changes in the renderer type and ensure proper resource management.
Updated BindlessMeshRenderPass.cs and MeshRenderPass.cs to implement modern rendering techniques, including bindless textures and improved shader management.
Updated CBufferCache.cs to align with the new resource management system and improve memory handling.
2025-07-12 14:25:20 +09:00

58 lines
1.7 KiB
C#

using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using Win32.Graphics.Dxgi.Common;
namespace Ghost.Graphics.Data;
[StructLayout(LayoutKind.Sequential)]
public struct Vertex(Vector4 position, Vector4 normal, Vector4 tangent, Color128 color, Vector4 uv)
{
public unsafe struct Semantic
{
public const Format ALIGNED_FORMAT = Format.R32G32B32A32Float;
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* PositionName => (byte*)Unsafe.AsPointer(ref s_positionBytes[0]);
public static byte* NormalName => (byte*)Unsafe.AsPointer(ref s_normalBytes[0]);
public static byte* TangentName => (byte*)Unsafe.AsPointer(ref s_tangentBytes[0]);
public static byte* ColorName => (byte*)Unsafe.AsPointer(ref s_colorBytes[0]);
public static byte* UVName => (byte*)Unsafe.AsPointer(ref s_uvBytes[0]);
}
public Vector4 Position
{
get;
set;
} = position;
public Vector4 Normal
{
get;
set;
} = normal;
public Vector4 Tangent
{
get;
set;
} = tangent;
public Color128 Color
{
get;
set;
} = color;
public Vector4 UV
{
get;
set;
} = uv;
}