Added IShaderCompiler

This commit is contained in:
2025-11-16 19:50:24 +09:00
parent d91d6f6e57
commit 5c4e1a3350
15 changed files with 595 additions and 372 deletions

View File

@@ -1,5 +1,4 @@
using Ghost.Core;
using Ghost.Core.Graphics;
using Ghost.Graphics.RHI;
using Misaki.HighPerformance.LowLevel.Buffer;
using Misaki.HighPerformance.LowLevel.Collections;
@@ -123,7 +122,7 @@ public unsafe readonly ref struct RenderingContext
public void UploadTexture(Handle<Texture> texture, ReadOnlySpan<byte> data)
{
var desc = ResourceDatabase.GetResourceDescription(texture.AsResource());
desc.textureDescription.Format.GetSurfaceInfo((int)desc.textureDescription.Width, (int)desc.textureDescription.Height, out var rowPitch, out var slicePitch, out _);
desc.TextureDescription.Format.GetSurfaceInfo((int)desc.TextureDescription.Width, (int)desc.TextureDescription.Height, out var rowPitch, out var slicePitch, out _);
var subresourceData = new SubResourceData
{
@@ -159,12 +158,12 @@ public unsafe readonly ref struct RenderingContext
shader.TryGetPassKey(passName, out var passIndex, out var passKey);
var hash = new GraphicsPipelineHash
{
id = passKey,
rtvCount = 1,
dsvFormat = TextureFormat.Unknown,
Id = passKey,
RtvCount = 1,
DsvFormat = TextureFormat.Unknown,
};
hash.rtvFormats[0] = TextureFormat.B8G8R8A8_UNorm;
hash.RtvFormats[0] = TextureFormat.B8G8R8A8_UNorm;
var pipelineKey = hash.GetKey();
_directCmd.SetPipelineState(pipelineKey);

View File

@@ -0,0 +1,43 @@
namespace Ghost.Graphics.Core;
/// <summary>
/// The layout of the root signature is:
/// <list type="bullet">
/// <item>
/// Global buffer (b0)
/// </item>
/// <item>
/// Per-view buffer (b1)
/// </item>
/// <item>
/// Per-object buffer (b2)
/// </item>
/// <item>
/// Per-material buffer (b3)
/// </item>
/// <item>
/// Descriptor table for bindless textures (t0)
/// </item>
/// <item>
/// Descriptor table for bindless samplers (s0)
/// </item>
/// </list>
/// </summary>
public static class RootSignatureLayout
{
public const int GLOBAL_BUFFER_SLOT = 0;
public const int PER_VIEW_BUFFER_SLOT = 1;
public const int PER_OBJECT_BUFFER_SLOT = 2;
public const int PER_MATERIAL_BUFFER_SLOT = 3;
public const int TEXTURE_HEAP_SLOT = 0;
public const int SAMPLER_HEAP_SLOT = 0;
public const int ROOT_PARAMETER_COUNT =
#if USE_TRADITIONAL_BINDLESS
6
#else
4
#endif
;
}