From ac6ec255cc713bebd108019914cae7d0f26a93d9 Mon Sep 17 00:00:00 2001 From: qian-o <1324771795@qq.com> Date: Tue, 31 Mar 2026 17:41:32 +0800 Subject: [PATCH 01/14] Bump package version to 0.0.7 Updated the Version field in NuGet.Packaging.props from 0.0.6 to 0.0.7 to prepare for the next release. No other changes were made. --- sources/NuGet.Packaging.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/NuGet.Packaging.props b/sources/NuGet.Packaging.props index 4b517e21..cf795345 100644 --- a/sources/NuGet.Packaging.props +++ b/sources/NuGet.Packaging.props @@ -7,7 +7,7 @@ $(MSBuildThisFileDirectory)..\.nuget - 0.0.6 + 0.0.7 qian-o Copyright (c) 2026 qian-o Zenith.NET is a modern, cross-platform graphics and compute library for .NET. It provides a unified GPU programming interface supporting DirectX12, Metal, and Vulkan backends. From 010c649e704cc8aba42787fac2e9a9171bef73c7 Mon Sep 17 00:00:00 2001 From: qian-o <1324771795@qq.com> Date: Tue, 31 Mar 2026 17:54:32 +0800 Subject: [PATCH 02/14] fix(docs): update README to remove work in progress status for Metal backend --- README.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/README.md b/README.md index c66724d6..600884b4 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,6 @@ License

-

- Status: Work in Progress -

- --- ## πŸ“– Overview @@ -43,11 +39,9 @@ Visit the [documentation site](https://qian-o.github.io/Zenith.NET/) for tutoria | :-------: | :--------: | :-----: | :--------: | | Windows | βœ… | | βœ… | | Linux | | | βœ… | -| Apple | | 🚧 | βœ… | +| Apple | | βœ… | βœ… | | Android | | | βœ… | -> 🚧 Metal backend is under development. - --- ## πŸ“¦ NuGet Packages From b7f176c522b726be5c1b8036b8d785a35c543da2 Mon Sep 17 00:00:00 2001 From: qian-o <1324771795@qq.com> Date: Tue, 31 Mar 2026 18:55:00 +0800 Subject: [PATCH 03/14] fix(docs): update docfx.json and main.js for improved documentation structure --- documents/docfx.json | 9 +++++++-- documents/templates/public/main.js | 1 - 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/documents/docfx.json b/documents/docfx.json index c4efb083..dc96a069 100644 --- a/documents/docfx.json +++ b/documents/docfx.json @@ -13,7 +13,8 @@ ] } ], - "output": "api" + "output": "api", + "enumSortOrder": "declaringOrder" } ], "build": { @@ -35,7 +36,6 @@ ] } ], - "output": "_site", "template": [ "default", "modern", @@ -45,10 +45,15 @@ "_appTitle": "Zenith.NET", "_appLogoPath": "images/Zenith.NET-Logo.svg", "_appFaviconPath": "images/Zenith.NET.png", + "_enableSearch": true, "_gitContribute": { "repo": "https://github.com/qian-o/Zenith.NET", "branch": "master" } + }, + "output": "_site", + "sitemap": { + "baseUrl": "https://qian-o.github.io/Zenith.NET/" } } } \ No newline at end of file diff --git a/documents/templates/public/main.js b/documents/templates/public/main.js index c080a739..4eabff8e 100644 --- a/documents/templates/public/main.js +++ b/documents/templates/public/main.js @@ -27,7 +27,6 @@ while (el) { toHide.push(el); if (el.tagName === 'H3') { - // Also grab the preceding overload anchor const prev = el.previousElementSibling; if (prev && prev.tagName === 'A' && prev.dataset.uid) { toHide.push(prev); From 10ed83837abd2b888b9fd55914f29fe26a746825 Mon Sep 17 00:00:00 2001 From: qian-o <1324771795@qq.com> Date: Tue, 31 Mar 2026 18:56:28 +0800 Subject: [PATCH 04/14] fix(docs): correct order of properties in docfx.json --- documents/docfx.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/documents/docfx.json b/documents/docfx.json index dc96a069..78fe27e1 100644 --- a/documents/docfx.json +++ b/documents/docfx.json @@ -13,8 +13,8 @@ ] } ], - "output": "api", - "enumSortOrder": "declaringOrder" + "enumSortOrder": "declaringOrder", + "output": "api" } ], "build": { From 702b5e724c64a1dbe56f00f55795e32f3a83a40c Mon Sep 17 00:00:00 2001 From: qian-o <1324771795@qq.com> Date: Tue, 31 Mar 2026 18:57:28 +0800 Subject: [PATCH 05/14] fix(docs): correct order of properties in docfx.json --- documents/docfx.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/documents/docfx.json b/documents/docfx.json index 78fe27e1..dc96a069 100644 --- a/documents/docfx.json +++ b/documents/docfx.json @@ -13,8 +13,8 @@ ] } ], - "enumSortOrder": "declaringOrder", - "output": "api" + "output": "api", + "enumSortOrder": "declaringOrder" } ], "build": { From c32a4f80a8624209a35031662e630b71f7e6f242 Mon Sep 17 00:00:00 2001 From: qian-o <1324771795@qq.com> Date: Tue, 31 Mar 2026 19:27:19 +0800 Subject: [PATCH 06/14] feat(search): enhance search results navigation with back button support --- documents/templates/public/main.css | 88 ++++++++++++++++++++++++++++- documents/templates/public/main.js | 21 +++++++ 2 files changed, 108 insertions(+), 1 deletion(-) diff --git a/documents/templates/public/main.css b/documents/templates/public/main.css index e992ff7f..ba7edc8e 100644 --- a/documents/templates/public/main.css +++ b/documents/templates/public/main.css @@ -217,6 +217,24 @@ header.bg-body, font-size: 1.05rem; } + /* Theme switcher dropdown β€” match icon button size */ + .navbar .icons .dropdown > a.btn { + width: auto !important; + height: 34px !important; + padding: 6px 10px !important; + } + +/* Search box β€” smaller width and spacing from theme switcher */ +.navbar #navbar form.search { + margin-left: 8px !important; +} + + .navbar #navbar form.search > input { + max-width: 180px !important; + height: 34px !important; + font-size: 0.85rem !important; + } + #logo { height: 50px; } @@ -1795,7 +1813,75 @@ a[href^="https"]::after { } /* ========================================================================== - 21. Responsive Design + 21. Search Results + ========================================================================== */ + +body[data-search] > .search-results { + max-width: 820px; + margin: 0 auto; + padding: 2rem 1.5rem 3rem; +} + +#search-results { + line-height: 1.7; +} + + #search-results > .search-list { + font-size: 0.9rem; + color: var(--text-secondary); + margin-bottom: 1.5rem; + padding-bottom: 1rem; + border-bottom: 1px solid var(--border); + } + + #search-results > .sr-items { + display: flex; + flex-direction: column; + gap: 0.75rem; + } + + #search-results > .sr-items > .sr-item { + background: var(--surface); + border: 1px solid var(--border); + border-radius: var(--radius-md); + padding: 1.25rem 1.5rem; + margin-bottom: 0; + transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease); + } + + #search-results > .sr-items > .sr-item:hover { + border-color: var(--accent); + box-shadow: var(--shadow-sm); + } + + #search-results > .sr-items > .sr-item > .item-title { + font-size: 1.125rem; + font-weight: 600; + color: var(--accent); + text-decoration: none; + display: block; + margin-bottom: 0.35rem; + } + + #search-results > .sr-items > .sr-item > .item-title:hover { + color: var(--accent-hover); + } + + #search-results > .sr-items > .sr-item > .item-href { + font-size: 0.8rem; + color: var(--text-tertiary); + margin-bottom: 0.5rem; + word-break: break-all; + } + + #search-results > .sr-items > .sr-item > .item-brief { + font-size: 0.875rem; + color: var(--text-secondary); + line-height: 1.6; + } + +/* ========================================================================== + 22. Responsive Design ========================================================================== */ @media (max-width: 768px) { diff --git a/documents/templates/public/main.js b/documents/templates/public/main.js index 4eabff8e..52af81b7 100644 --- a/documents/templates/public/main.js +++ b/documents/templates/public/main.js @@ -62,5 +62,26 @@ h2.style.display = 'none'; } } + + // Search results: navigate in same tab with back button support + document.addEventListener('click', (e) => { + const link = e.target.closest('#search-results .sr-item a'); + if (!link) return; + + e.preventDefault(); + const query = document.getElementById('search-query')?.value || ''; + history.pushState({ search: true, query }, ''); + window.location.href = link.href; + }); + + window.addEventListener('popstate', (e) => { + if (e.state?.search) { + const input = document.getElementById('search-query'); + if (input) { + input.value = e.state.query; + input.dispatchEvent(new Event('input', { bubbles: true })); + } + } + }); } } \ No newline at end of file From 02c4965221656ec9253647151d5038e369323136 Mon Sep 17 00:00:00 2001 From: qian-o <1324771795@qq.com> Date: Tue, 31 Mar 2026 20:28:15 +0800 Subject: [PATCH 07/14] Update docs and samples for Metal 4 & Vulkan 1.4 support Clarify API versions (DirectX 12, Metal 4, Vulkan 1.4) throughout docs, tables, and code comments. Refactor backend selection logic for correct platform mapping. Update resource binding helper and ray tracing samples for accuracy. Improve table formatting and header link visibility in CSS. Expand design philosophy to explain backend version choices. --- README.md | 6 +-- documents/api/index.md | 4 +- documents/docs/concepts/graphics-context.md | 2 +- documents/docs/index.md | 16 ++++++- documents/index.md | 8 ++-- documents/templates/public/main.css | 23 ++++++--- documents/templates/public/main.js | 7 +++ documents/tutorials/advanced/ray-tracing.md | 8 ++++ .../getting-started/prerequisites.md | 47 +++++++++---------- 9 files changed, 79 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 600884b4..9fdcd852 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@

A modern, cross-platform graphics and compute library for .NET.
- One API for DirectX 12, Metal, and Vulkan. + One API for DirectX 12, Metal 4, and Vulkan 1.4.

@@ -18,13 +18,13 @@ ## πŸ“– Overview -Zenith.NET is a GPU abstraction layer that unifies DirectX 12, Metal, and Vulkan under a single .NET API. It enables developers to build high-performance rendering and compute applications without writing backend-specific code. The library supports modern GPU features including ray tracing and mesh shading, and integrates seamlessly with popular .NET UI frameworks. +Zenith.NET is a GPU abstraction layer that unifies DirectX 12, Metal 4, and Vulkan 1.4 under a single .NET API. It enables developers to build high-performance rendering and compute applications without writing backend-specific code. The library supports modern GPU features including ray tracing and mesh shading, and integrates seamlessly with popular .NET UI frameworks. Visit the [documentation site](https://qian-o.github.io/Zenith.NET/) for tutorials and API reference. ## ✨ Features -- 🎯 **Unified API** β€” Write once, run on DirectX 12, Metal, and Vulkan +- 🎯 **Unified API** β€” Write once, run on DirectX 12, Metal 4, and Vulkan 1.4 - 🎨 **Graphics** β€” Vertex and pixel shaders - ⚑ **Compute** β€” General-purpose GPU computing - πŸ’‘ **Ray Tracing** β€” Hardware-accelerated BLAS/TLAS with RayQuery in any shader stage diff --git a/documents/api/index.md b/documents/api/index.md index 1eaf01ce..2e464262 100644 --- a/documents/api/index.md +++ b/documents/api/index.md @@ -8,8 +8,8 @@ Welcome to the Zenith.NET API Reference. This documentation is automatically gen |-----------|-------------| | Zenith.NET | Core graphics abstractions and resource types | | Zenith.NET.DirectX12 | DirectX 12 backend implementation for Windows | -| Zenith.NET.Metal | Metal backend implementation for Apple platforms | -| Zenith.NET.Vulkan | Vulkan backend implementation for cross-platform support | +| Zenith.NET.Metal | Metal 4 backend implementation for Apple platforms | +| Zenith.NET.Vulkan | Vulkan 1.4 backend implementation for cross-platform support | ## Key Types diff --git a/documents/docs/concepts/graphics-context.md b/documents/docs/concepts/graphics-context.md index 005d502f..d68b3b89 100644 --- a/documents/docs/concepts/graphics-context.md +++ b/documents/docs/concepts/graphics-context.md @@ -6,6 +6,6 @@ This topic covers: - GraphicsContext creation methods for each backend -- Three backend options: DirectX12, Metal, Vulkan +- Three backend options: DirectX 12, Metal 4, Vulkan 1.4 - Querying device capabilities via `Capabilities` - Handling validation messages via `ValidationMessage` event diff --git a/documents/docs/index.md b/documents/docs/index.md index a2bdc8f4..dea9a6d6 100644 --- a/documents/docs/index.md +++ b/documents/docs/index.md @@ -5,6 +5,20 @@ This section provides conceptual documentation to help you understand Zenith.NET > [!NOTE] > Looking for step-by-step coding guides? Check out the [Tutorials](../tutorials/index.md) section. +## Design Philosophy + +Zenith.NET abstracts DirectX 12, Metal 4, and Vulkan 1.4 under a unified API. The design follows a clear principle: **adopt the latest API versions and expose only the capabilities shared across all three backends**. This means platform-specific features are intentionally excluded to maintain a consistent cross-platform experience. + +Each backend targets real-world device coverage: + +| Backend | Strategy | +|---------|----------| +| **DirectX 12** | Targets mainstream Windows 10 and above, covering the vast majority of Windows devices | +| **Metal 4** | Supports Apple Silicon (M-series) Macs and compatible iPhone/iPad models. Intel-based Macs are not supported | +| **Vulkan 1.4** | Serves as the cross-platform fallback. While Vulkan has evolved rapidly with many extensions, mobile and Linux driver support remains uneven β€” so adaptation is driven by actual device capabilities rather than spec version alone | + +For detailed backend selection guidance, see [Backend Selection](platform/backend-selection.md). + ## Core Concepts ### Graphics Context @@ -51,7 +65,7 @@ Pipelines reference a single `ResourceLayout`, and you bind a corresponding `Res ## Platform Support -| Platform | DirectX 12 | Metal | Vulkan | +| Platform | DirectX 12 | Metal 4 | Vulkan 1.4 | |----------|:----------:|:-----:|:------:| | Windows | Yes | No | Yes | | Linux | No | No | Yes | diff --git a/documents/index.md b/documents/index.md index f9cbd8ee..e8af7a14 100644 --- a/documents/index.md +++ b/documents/index.md @@ -8,7 +8,7 @@ _layout: landing

Zenith.NET

Unified Cross-Platform GPU Programming for .NET

-

A modern graphics and compute library that provides a single API for DirectX 12, Metal, and Vulkan. Build high-performance rendering and GPU compute applications with ease.

+

A modern graphics and compute library that provides a single API for DirectX 12, Metal 4, and Vulkan 1.4. Build high-performance rendering and GPU compute applications with ease.

Get Started API Reference @@ -26,7 +26,7 @@ _layout: landing
Graphics APIs - DirectX 12 Β· Metal Β· Vulkan + DirectX 12 Β· Metal 4 Β· Vulkan 1.4
@@ -43,7 +43,7 @@ _layout: landing
🎯
- Unified API β€” Write once, run everywhere. A single API abstracts DirectX 12, Metal, and Vulkan. + Unified API β€” Write once, run everywhere. A single API abstracts DirectX 12, Metal 4, and Vulkan 1.4.
@@ -98,7 +98,7 @@ _layout: landing
1

Initialize

-

Create a graphics context with your preferred backend (DirectX 12, Metal, or Vulkan).

+

Create a graphics context with your preferred backend (DirectX 12, Metal 4, or Vulkan 1.4).

diff --git a/documents/templates/public/main.css b/documents/templates/public/main.css index ba7edc8e..7fdbe873 100644 --- a/documents/templates/public/main.css +++ b/documents/templates/public/main.css @@ -106,6 +106,14 @@ body { color: var(--text-primary); } +/* Full-width layout */ +main.container-xxl, +header .container-xxl { + max-width: 100% !important; + padding-left: 2rem !important; + padding-right: 2rem !important; +} + /* ========================================================================== 3. Navbar ========================================================================== */ @@ -1127,6 +1135,8 @@ article th { color: var(--text-tertiary) !important; background: transparent !important; border: none !important; + white-space: nowrap !important; + vertical-align: middle !important; } article thead tr th:first-child { @@ -1152,6 +1162,7 @@ article td { background: transparent !important; border: none !important; border-top: 1px solid var(--border) !important; + vertical-align: middle !important; } article tbody tr:first-child td { @@ -1801,12 +1812,12 @@ article td a { 20. Hide UI Elements ========================================================================== */ -article h1 > a, -article h2 > a, -article h3 > a, -article h4 > a, -article h5 > a, -article h6 > a, +article h1 > a:not(.header-action), +article h2 > a:not(.header-action), +article h3 > a:not(.header-action), +article h4 > a:not(.header-action), +article h5 > a:not(.header-action), +article h6 > a:not(.header-action), a[href^="http"]::after, a[href^="https"]::after { display: none !important; diff --git a/documents/templates/public/main.js b/documents/templates/public/main.js index 52af81b7..f61c827e 100644 --- a/documents/templates/public/main.js +++ b/documents/templates/public/main.js @@ -7,6 +7,13 @@ } ], start: () => { + // Prevent short table cells from wrapping (e.g. "DirectX 12", "Vulkan 1.4") + for (const td of document.querySelectorAll('article td')) { + if (td.textContent.trim().length <= 20) { + td.style.whiteSpace = 'nowrap'; + } + } + // Hide inherited type info sections (inheritance, implements, inheritedMembers, derivedClasses) for (const dl of document.querySelectorAll('dl.typelist.inheritance, dl.typelist.implements, dl.typelist.inheritedMembers, dl.typelist.derivedClasses')) { dl.style.display = 'none'; diff --git a/documents/tutorials/advanced/ray-tracing.md b/documents/tutorials/advanced/ray-tracing.md index cb0ca2f8..3095dcb6 100644 --- a/documents/tutorials/advanced/ray-tracing.md +++ b/documents/tutorials/advanced/ray-tracing.md @@ -684,10 +684,15 @@ while (query.Proceed()) uint sphereIndex = query.CandidatePrimitiveIndex(); Sphere sphere = spheres[sphereIndex]; + float3 ro = query.CandidateObjectRayOrigin(); + float3 rd = query.CandidateObjectRayDirection(); + float t = IntersectSphere(ro, rd, sphere); if (t >= query.RayTMin() && t <= query.CommittedRayT()) { + float3 hitPoint = ro + rd * t; + sphereHitNormal = normalize(hitPoint - sphere.Center); sphereHitColor = sphere.Color; @@ -742,6 +747,9 @@ bool TraceShadowRay(float3 origin, float3 direction) uint sphereIndex = shadowQuery.CandidatePrimitiveIndex(); Sphere sphere = spheres[sphereIndex]; + float3 ro = shadowQuery.CandidateObjectRayOrigin(); + float3 rd = shadowQuery.CandidateObjectRayDirection(); + float t = IntersectSphere(ro, rd, sphere); if (t >= shadowQuery.RayTMin() && t <= shadowQuery.CommittedRayT()) diff --git a/documents/tutorials/getting-started/prerequisites.md b/documents/tutorials/getting-started/prerequisites.md index de49e106..b042b190 100644 --- a/documents/tutorials/getting-started/prerequisites.md +++ b/documents/tutorials/getting-started/prerequisites.md @@ -137,11 +137,8 @@ Different graphics backends use different indexing schemes for resource bindings | Backend | Index Scheme | |---------|--------------| | DirectX 12 | Per-type: CBV, SRV, UAV, Sampler each start at 0 | -| Vulkan | Global: All resources share index space (0, 1, 2, ...) | -| Metal | Per-category: Buffer, Texture, Sampler each start at 0 | - -Create `BindingHelper.cs` to handle these differences automatically: - +| Metal 4 | Per-category: Buffer, Texture, Sampler each start at 0 | +| Vulkan 1.4 | Global: All resources share index space (0, 1, 2, ...) | ```csharp namespace ZenithTutorials; @@ -184,17 +181,6 @@ internal static class BindingHelper } break; - case Backend.Vulkan: - { - for (int i = 0; i < bindings.Length; i++) - { - ref ResourceBinding binding = ref bindings[i]; - - binding = binding with { Index = (uint)i }; - } - } - break; - case Backend.Metal: { uint bufferIndex = 0; @@ -224,6 +210,17 @@ internal static class BindingHelper } } break; + + case Backend.Vulkan: + { + for (int i = 0; i < bindings.Length; i++) + { + ref ResourceBinding binding = ref bindings[i]; + + binding = binding with { Index = (uint)i }; + } + } + break; } return bindings; @@ -294,7 +291,7 @@ internal static partial class CocoaHelper } ``` -The `CAMetalLayer` can be used with both Metal and Vulkan backends on macOS. +The `CAMetalLayer` can be used with both Metal 4 and Vulkan 1.4 backends on macOS. ## Application Framework @@ -319,9 +316,9 @@ internal static class App static App() { // Ensure platform is supported - if (!OperatingSystem.IsWindows() && !OperatingSystem.IsLinux() && !OperatingSystem.IsMacOS()) + if (!OperatingSystem.IsWindows() && !OperatingSystem.IsMacOS() && !OperatingSystem.IsLinux()) { - throw new PlatformNotSupportedException("This tutorial only supports Windows, Linux, and macOS."); + throw new PlatformNotSupportedException("This tutorial only supports Windows, macOS, and Linux."); } // Create window with no graphics API (we manage rendering ourselves) @@ -342,17 +339,17 @@ internal static class App surface = Surface.Win32(window.Native!.Win32!.Value.Hwnd, Width, Height); } - else if (OperatingSystem.IsLinux()) + else if (OperatingSystem.IsMacOS()) { - Context = GraphicsContext.CreateVulkan(useValidationLayer: true); + Context = GraphicsContext.CreateMetal(useValidationLayer: true); - surface = Surface.Xlib(window.Native!.X11!.Value.Display, (nint)window.Native.X11.Value.Window, Width, Height); + surface = Surface.Apple(CocoaHelper.CreateLayer(window.Native!.Cocoa!.Value), Width, Height); } else { - Context = GraphicsContext.CreateMetal(useValidationLayer: true); + Context = GraphicsContext.CreateVulkan(useValidationLayer: true); - surface = Surface.Apple(CocoaHelper.CreateLayer(window.Native!.Cocoa!.Value), Width, Height); + surface = Surface.Xlib(window.Native!.X11!.Value.Display, (nint)window.Native.X11.Value.Window, Width, Height); } // Log validation messages for debugging @@ -440,7 +437,7 @@ This framework provides: - **Platform validation** - Ensures only supported platforms (Windows, Linux, macOS) are used - **Window creation** with Silk.NET (1280Γ—720 default size) -- **Cross-platform backend selection** (DirectX 12 on Windows, Vulkan on Linux, Metal on macOS) +- **Cross-platform backend selection** (DirectX 12 on Windows, Metal 4 on macOS, Vulkan 1.4 on Linux) - **SwapChain management** for presenting frames - **Resize handling** for responsive rendering - **Generic renderer pattern** using `App.Run()` for easy tutorial switching From 4e983ee33dd594329c328c884f5a6864f30d40f4 Mon Sep 17 00:00:00 2001 From: qian-o <1324771795@qq.com> Date: Tue, 31 Mar 2026 20:34:15 +0800 Subject: [PATCH 08/14] fix(docs): update CornellBox conventions for accuracy in DirectX and Vulkan versions --- sources/Experiments/CornellBox/CONVENTIONS.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sources/Experiments/CornellBox/CONVENTIONS.md b/sources/Experiments/CornellBox/CONVENTIONS.md index 455deeea..6b57de1c 100644 --- a/sources/Experiments/CornellBox/CONVENTIONS.md +++ b/sources/Experiments/CornellBox/CONVENTIONS.md @@ -2,7 +2,7 @@ ## Overview -A dual-mode Cornell Box renderer built on the Zenith.NET multi-backend GPU framework (DirectX12 / Vulkan / Metal). +A dual-mode Cornell Box renderer built on the Zenith.NET multi-backend GPU framework (DirectX 12 / Metal 4 / Vulkan 1.4). Two rendering modes switchable via ImGui radio buttons at runtime: - **Path Tracing** (mode 0): `ComputePipeline` + inline `RayQuery<>`, progressive accumulation with NEE (Next Event Estimation), Cook-Torrance PBR BRDF (GGX + Schlick Fresnel + Smith G), GGX importance sampling for specular, cosine-weighted hemisphere for diffuse, Russian roulette, environment sky light on ray miss. Only available when `Context.Capabilities.RayTracingSupported` is true. @@ -11,7 +11,7 @@ Two rendering modes switchable via ImGui radio buttons at runtime: ## Current State (2026-03-30) - All files implemented and compiling successfully -- DX12 validation layer clean +- DirectX 12 validation layer clean - Camera initial position: (278, 273, -800), Speed=240, FarPlane=2000, looks into the box - Swap chain format: B8G8R8A8UNorm color + D32FloatS8UInt depth/stencil - `Renderer` abstract base class unifies both renderers (`Update` / `Render` / `Resize` + `IDisposable`) @@ -775,10 +775,10 @@ base (FrameBuffer + DepthStencil + Color) β†’ constantBuffer β†’ materialBuffer β†’ indexBuffer β†’ vertexBuffer ``` -## DX12 Specific Notes +## DirectX 12 Specific Notes -- `BindingHelper` assigns DX12 register indices by type: CBV(b), SRV(t), UAV(u), Sampler(s) independently numbered -- Vulkan numbers all bindings sequentially; Metal uses argument buffer index +- `BindingHelper` assigns DirectX 12 register indices by type: CBV(b), SRV(t), UAV(u), Sampler(s) independently numbered +- Vulkan 1.4 numbers all bindings sequentially; Metal 4 uses argument buffer index ## C# Code Style From f2f6c69e3cd7b4b6aaf4f3f119c2c8f9ea535e8d Mon Sep 17 00:00:00 2001 From: qian-o <1324771795@qq.com> Date: Tue, 31 Mar 2026 20:44:49 +0800 Subject: [PATCH 09/14] Update templates and metadata for API version clarity - Streamlined bug report template by merging sections and clarifying environment details; updated placeholders to specify API versions (DirectX 12, Metal 4, Vulkan 1.4). - Removed general issue template (custom.yaml) and "Feature Discussions" contact link, directing general queries to Discussions. - Updated NuGet package description and tags to reflect precise supported API versions. --- .github/ISSUE_TEMPLATE/bug_report.yaml | 31 +++++++++----------------- .github/ISSUE_TEMPLATE/config.yml | 5 +---- .github/ISSUE_TEMPLATE/custom.yaml | 24 -------------------- sources/NuGet.Packaging.props | 4 ++-- 4 files changed, 13 insertions(+), 51 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/custom.yaml diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index 1ac4d77c..e0dc220f 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -13,37 +13,26 @@ body: required: true attributes: label: Describe the bug - description: A clear and concise description of what the bug is. - placeholder: E.g. When initializing a DirectX12 context, an exception is thrown on integrated graphics. - - - type: textarea - validations: - required: true - attributes: - label: Steps to reproduce - description: Steps to reproduce the behavior. Include a minimal code example if possible. + description: A clear and concise description of what the bug is, including steps to reproduce and expected behavior. placeholder: | - 1. Create a GraphicsContext with DirectX12 + What happened: + E.g. When initializing a DirectX 12 context, an exception is thrown on integrated graphics. + + Steps to reproduce: + 1. Create a GraphicsContext with DirectX 12 2. Call CreateSwapChain() 3. See exception - - type: textarea - validations: - required: true - attributes: - label: Expected behavior - description: What you expected to happen. - placeholder: DirectX12 context should initialize successfully. + Expected behavior: + DirectX 12 context should initialize successfully. - type: textarea - validations: - required: true attributes: label: Environment - description: Please provide your environment details. + description: Please provide your environment details (if applicable). placeholder: | - OS: Windows 11 / macOS 15 / Ubuntu 24.04 / etc. - - Graphics API: DirectX12 / Metal / Vulkan + - Graphics API: DirectX 12 / Metal 4 / Vulkan 1.4 - Zenith.NET Version: 1.0.0 - GPU: NVIDIA RTX 4090 / Apple M3 / etc. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index e44e9ffc..8f99e94d 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -5,7 +5,4 @@ contact_links: about: I have a question about how to use Zenith.NET or need help with graphics programming. - name: Documentation url: https://qian-o.github.io/Zenith.NET/ - about: Check out the documentation and tutorials for Zenith.NET. - - name: Feature Discussions - url: https://github.com/qian-o/Zenith.NET/discussions/categories/ideas - about: Discuss new ideas and features for Zenith.NET with the community. \ No newline at end of file + about: Check out the documentation and tutorials for Zenith.NET. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/custom.yaml b/.github/ISSUE_TEMPLATE/custom.yaml deleted file mode 100644 index 40d48e05..00000000 --- a/.github/ISSUE_TEMPLATE/custom.yaml +++ /dev/null @@ -1,24 +0,0 @@ -ο»Ώname: General Issue -description: For issues that do not fit other templates -title: "Issue: " -labels: ["needs-triage"] -body: - - type: markdown - attributes: - value: | - This template is for issues that don't fit into Bug Report or Feature Request. - For questions or discussions, please use the [Discussions](https://github.com/qian-o/Zenith.NET/discussions) section. - - - type: textarea - validations: - required: true - attributes: - label: Description - description: Describe your issue or question in detail. - placeholder: Please provide a clear description... - - - type: textarea - attributes: - label: Additional context - description: Add any relevant information, environment details, code snippets, or screenshots. - placeholder: Any additional information that might help. \ No newline at end of file diff --git a/sources/NuGet.Packaging.props b/sources/NuGet.Packaging.props index cf795345..6325bbfe 100644 --- a/sources/NuGet.Packaging.props +++ b/sources/NuGet.Packaging.props @@ -10,7 +10,7 @@ 0.0.7 qian-o Copyright (c) 2026 qian-o - Zenith.NET is a modern, cross-platform graphics and compute library for .NET. It provides a unified GPU programming interface supporting DirectX12, Metal, and Vulkan backends. + Zenith.NET is a modern, cross-platform graphics and compute library for .NET. It provides a unified GPU programming interface supporting DirectX 12, Metal 4, and Vulkan 1.4 backends. Git @@ -20,7 +20,7 @@ Zenith.NET.png LICENSE README.md - DirectX12;Metal;Vulkan;ImageSharp;ImGui;Skia;Slang;Avalonia;Maui;Uno;WinForms;WinUI;WPF;GPU;Native + DirectX12;Metal4;Vulkan1.4;ImageSharp;ImGui;Skia;Slang;Avalonia;Maui;Uno;WinForms;WinUI;WPF;GPU;Native https://qian-o.github.io/Zenith.NET From 481f5c6f2faf3cb158e68a56e91c408f67354430 Mon Sep 17 00:00:00 2001 From: qian-o <1324771795@qq.com> Date: Tue, 31 Mar 2026 21:15:30 +0800 Subject: [PATCH 10/14] Update platform order to Windows, macOS, Linux throughout Reorder platform checks in App.cs for backend/surface selection. Standardize documentation and UI to use "Windows, macOS, Linux". Fix minor typos and clarify backend binding notes in docs. No functional changes; improves clarity and consistency. --- README.md | 2 +- documents/docs/index.md | 2 +- documents/index.md | 2 +- documents/tutorials/getting-started/prerequisites.md | 6 +++--- documents/tutorials/index.md | 2 +- sources/Experiments/CornellBox/App.cs | 12 ++++++------ sources/Experiments/CornellBox/CONVENTIONS.md | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 9fdcd852..bd640b50 100644 --- a/README.md +++ b/README.md @@ -38,9 +38,9 @@ Visit the [documentation site](https://qian-o.github.io/Zenith.NET/) for tutoria | | DirectX 12 | Metal 4 | Vulkan 1.4 | | :-------: | :--------: | :-----: | :--------: | | Windows | βœ… | | βœ… | -| Linux | | | βœ… | | Apple | | βœ… | βœ… | | Android | | | βœ… | +| Linux | | | βœ… | --- diff --git a/documents/docs/index.md b/documents/docs/index.md index dea9a6d6..bb3c67bc 100644 --- a/documents/docs/index.md +++ b/documents/docs/index.md @@ -68,9 +68,9 @@ Pipelines reference a single `ResourceLayout`, and you bind a corresponding `Res | Platform | DirectX 12 | Metal 4 | Vulkan 1.4 | |----------|:----------:|:-----:|:------:| | Windows | Yes | No | Yes | -| Linux | No | No | Yes | | Apple | No | Yes | Yes | | Android | No | No | Yes | +| Linux | No | No | Yes | ## Best Practices diff --git a/documents/index.md b/documents/index.md index e8af7a14..1ee6696f 100644 --- a/documents/index.md +++ b/documents/index.md @@ -31,7 +31,7 @@ _layout: landing
Platforms - Windows Β· Linux Β· Apple Β· Android + Windows Β· Apple Β· Android Β· Linux
diff --git a/documents/tutorials/getting-started/prerequisites.md b/documents/tutorials/getting-started/prerequisites.md index b042b190..6bf89a7e 100644 --- a/documents/tutorials/getting-started/prerequisites.md +++ b/documents/tutorials/getting-started/prerequisites.md @@ -11,12 +11,12 @@ Zenith.NET supports multiple graphics backends across platforms: | Platform | DirectX 12 | Metal 4 | Vulkan 1.4 | |----------|:----------:|:-------:|:----------:| | Windows | Yes | No | Yes | -| Linux | No | No | Yes | | Apple | No | Yes | Yes | | Android | No | No | Yes | +| Linux | No | No | Yes | > [!NOTE] -> These tutorials are designed for desktop platforms (Windows, Linux, and macOS). +> These tutorials are designed for desktop platforms (Windows, macOS, and Linux). ### Software @@ -435,7 +435,7 @@ App.Cleanup(); This framework provides: -- **Platform validation** - Ensures only supported platforms (Windows, Linux, macOS) are used +- **Platform validation** - Ensures only supported platforms (Windows, macOS, Linux) are used - **Window creation** with Silk.NET (1280Γ—720 default size) - **Cross-platform backend selection** (DirectX 12 on Windows, Metal 4 on macOS, Vulkan 1.4 on Linux) - **SwapChain management** for presenting frames diff --git a/documents/tutorials/index.md b/documents/tutorials/index.md index f8d26ee2..74d10369 100644 --- a/documents/tutorials/index.md +++ b/documents/tutorials/index.md @@ -66,7 +66,7 @@ Before starting, ensure you have: - Visual Studio 2026, VS Code, or JetBrains Rider > [!NOTE] -> These tutorials are designed for desktop platforms (Windows, Linux, and macOS). +> These tutorials are designed for desktop platforms (Windows, macOS, and Linux). > See [Prerequisites](getting-started/prerequisites.md) for detailed platform support and setup instructions. ## Source Code diff --git a/sources/Experiments/CornellBox/App.cs b/sources/Experiments/CornellBox/App.cs index d0c30ef2..c6c1ddf1 100644 --- a/sources/Experiments/CornellBox/App.cs +++ b/sources/Experiments/CornellBox/App.cs @@ -31,13 +31,13 @@ static App() { Context = GraphicsContext.CreateDirectX12(useValidationLayer: true); } - else if (OperatingSystem.IsLinux()) + else if (OperatingSystem.IsMacOS()) { - Context = GraphicsContext.CreateVulkan(useValidationLayer: true); + Context = GraphicsContext.CreateMetal(useValidationLayer: true); } else { - Context = GraphicsContext.CreateMetal(useValidationLayer: true); + Context = GraphicsContext.CreateVulkan(useValidationLayer: true); } Context.ValidationMessage += static (sender, args) => Console.WriteLine($"[{args.Source} - {args.Severity}] {args.Message}"); @@ -54,13 +54,13 @@ static App() { surface = Surface.Win32(window.Native!.Win32!.Value.Hwnd, Width, Height); } - else if (OperatingSystem.IsLinux()) + else if (OperatingSystem.IsMacOS()) { - surface = Surface.Xlib(window.Native!.X11!.Value.Display, (nint)window.Native.X11.Value.Window, Width, Height); + surface = Surface.Apple(CocoaHelper.CreateLayer(window.Native!.Cocoa!.Value), Width, Height); } else { - surface = Surface.Apple(CocoaHelper.CreateLayer(window.Native!.Cocoa!.Value), Width, Height); + surface = Surface.Xlib(window.Native!.X11!.Value.Display, (nint)window.Native.X11.Value.Window, Width, Height); } swapChain = Context.CreateSwapChain(new() { Surface = surface, ColorTargetFormat = PixelFormat.B8G8R8A8UNorm, DepthStencilTargetFormat = PixelFormat.D32FloatS8UInt }); diff --git a/sources/Experiments/CornellBox/CONVENTIONS.md b/sources/Experiments/CornellBox/CONVENTIONS.md index 6b57de1c..e3ee79f6 100644 --- a/sources/Experiments/CornellBox/CONVENTIONS.md +++ b/sources/Experiments/CornellBox/CONVENTIONS.md @@ -778,7 +778,7 @@ base (FrameBuffer + DepthStencil + Color) ## DirectX 12 Specific Notes - `BindingHelper` assigns DirectX 12 register indices by type: CBV(b), SRV(t), UAV(u), Sampler(s) independently numbered -- Vulkan 1.4 numbers all bindings sequentially; Metal 4 uses argument buffer index +- Metal 4 uses argument buffer index; Vulkan 1.4 numbers all bindings sequentially ## C# Code Style From b3b4795883278690f0cf607a3c6c1537313c26ec Mon Sep 17 00:00:00 2001 From: qian-o <1324771795@qq.com> Date: Tue, 31 Mar 2026 21:26:57 +0800 Subject: [PATCH 11/14] Update package tag from Metal4 to Metal in NuGet props Broadened the entry in NuGet.Packaging.props by replacing "Metal4" with "Metal" to refer to all versions of Metal, not just version 4. This improves discoverability and accuracy of the package metadata. --- sources/NuGet.Packaging.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/NuGet.Packaging.props b/sources/NuGet.Packaging.props index 6325bbfe..6de9ee3e 100644 --- a/sources/NuGet.Packaging.props +++ b/sources/NuGet.Packaging.props @@ -20,7 +20,7 @@ Zenith.NET.png LICENSE README.md - DirectX12;Metal4;Vulkan1.4;ImageSharp;ImGui;Skia;Slang;Avalonia;Maui;Uno;WinForms;WinUI;WPF;GPU;Native + DirectX12;Metal;Vulkan;ImageSharp;ImGui;Skia;Slang;Avalonia;Maui;Uno;WinForms;WinUI;WPF;GPU;Native https://qian-o.github.io/Zenith.NET From 93201bb09b0421555f72463c2191738119e68958 Mon Sep 17 00:00:00 2001 From: qian-o <1324771795@qq.com> Date: Tue, 31 Mar 2026 21:36:48 +0800 Subject: [PATCH 12/14] fix(docs): standardize graphics API naming conventions in documentation --- .github/ISSUE_TEMPLATE/bug_report.yaml | 8 ++++---- documents/tutorials/getting-started/prerequisites.md | 10 +++++----- sources/Experiments/CornellBox/CONVENTIONS.md | 10 +++++----- sources/NuGet.Packaging.props | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index e0dc220f..abc19fb9 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -16,15 +16,15 @@ body: description: A clear and concise description of what the bug is, including steps to reproduce and expected behavior. placeholder: | What happened: - E.g. When initializing a DirectX 12 context, an exception is thrown on integrated graphics. + E.g. When initializing a DirectX12 context, an exception is thrown on integrated graphics. Steps to reproduce: - 1. Create a GraphicsContext with DirectX 12 + 1. Create a GraphicsContext with DirectX12 2. Call CreateSwapChain() 3. See exception Expected behavior: - DirectX 12 context should initialize successfully. + DirectX12 context should initialize successfully. - type: textarea attributes: @@ -32,7 +32,7 @@ body: description: Please provide your environment details (if applicable). placeholder: | - OS: Windows 11 / macOS 15 / Ubuntu 24.04 / etc. - - Graphics API: DirectX 12 / Metal 4 / Vulkan 1.4 + - Graphics API: DirectX12 / Metal / Vulkan - Zenith.NET Version: 1.0.0 - GPU: NVIDIA RTX 4090 / Apple M3 / etc. diff --git a/documents/tutorials/getting-started/prerequisites.md b/documents/tutorials/getting-started/prerequisites.md index 6bf89a7e..bc61952b 100644 --- a/documents/tutorials/getting-started/prerequisites.md +++ b/documents/tutorials/getting-started/prerequisites.md @@ -136,9 +136,9 @@ Different graphics backends use different indexing schemes for resource bindings | Backend | Index Scheme | |---------|--------------| -| DirectX 12 | Per-type: CBV, SRV, UAV, Sampler each start at 0 | -| Metal 4 | Per-category: Buffer, Texture, Sampler each start at 0 | -| Vulkan 1.4 | Global: All resources share index space (0, 1, 2, ...) | +| DirectX12 | Per-type: CBV, SRV, UAV, Sampler each start at 0 | +| Metal | Per-category: Buffer, Texture, Sampler each start at 0 | +| Vulkan | Global: All resources share index space (0, 1, 2, ...) | ```csharp namespace ZenithTutorials; @@ -291,7 +291,7 @@ internal static partial class CocoaHelper } ``` -The `CAMetalLayer` can be used with both Metal 4 and Vulkan 1.4 backends on macOS. +The `CAMetalLayer` can be used with both Metal and Vulkan backends on macOS. ## Application Framework @@ -437,7 +437,7 @@ This framework provides: - **Platform validation** - Ensures only supported platforms (Windows, macOS, Linux) are used - **Window creation** with Silk.NET (1280Γ—720 default size) -- **Cross-platform backend selection** (DirectX 12 on Windows, Metal 4 on macOS, Vulkan 1.4 on Linux) +- **Cross-platform backend selection** (DirectX12 on Windows, Metal on macOS, Vulkan on Linux) - **SwapChain management** for presenting frames - **Resize handling** for responsive rendering - **Generic renderer pattern** using `App.Run()` for easy tutorial switching diff --git a/sources/Experiments/CornellBox/CONVENTIONS.md b/sources/Experiments/CornellBox/CONVENTIONS.md index e3ee79f6..95ecf1ee 100644 --- a/sources/Experiments/CornellBox/CONVENTIONS.md +++ b/sources/Experiments/CornellBox/CONVENTIONS.md @@ -2,7 +2,7 @@ ## Overview -A dual-mode Cornell Box renderer built on the Zenith.NET multi-backend GPU framework (DirectX 12 / Metal 4 / Vulkan 1.4). +A dual-mode Cornell Box renderer built on the Zenith.NET multi-backend GPU framework (DirectX12 / Metal / Vulkan). Two rendering modes switchable via ImGui radio buttons at runtime: - **Path Tracing** (mode 0): `ComputePipeline` + inline `RayQuery<>`, progressive accumulation with NEE (Next Event Estimation), Cook-Torrance PBR BRDF (GGX + Schlick Fresnel + Smith G), GGX importance sampling for specular, cosine-weighted hemisphere for diffuse, Russian roulette, environment sky light on ray miss. Only available when `Context.Capabilities.RayTracingSupported` is true. @@ -11,7 +11,7 @@ Two rendering modes switchable via ImGui radio buttons at runtime: ## Current State (2026-03-30) - All files implemented and compiling successfully -- DirectX 12 validation layer clean +- DirectX12 validation layer clean - Camera initial position: (278, 273, -800), Speed=240, FarPlane=2000, looks into the box - Swap chain format: B8G8R8A8UNorm color + D32FloatS8UInt depth/stencil - `Renderer` abstract base class unifies both renderers (`Update` / `Render` / `Resize` + `IDisposable`) @@ -775,10 +775,10 @@ base (FrameBuffer + DepthStencil + Color) β†’ constantBuffer β†’ materialBuffer β†’ indexBuffer β†’ vertexBuffer ``` -## DirectX 12 Specific Notes +## DirectX12 Specific Notes -- `BindingHelper` assigns DirectX 12 register indices by type: CBV(b), SRV(t), UAV(u), Sampler(s) independently numbered -- Metal 4 uses argument buffer index; Vulkan 1.4 numbers all bindings sequentially +- `BindingHelper` assigns DirectX12 register indices by type: CBV(b), SRV(t), UAV(u), Sampler(s) independently numbered +- Metal uses argument buffer index; Vulkan numbers all bindings sequentially ## C# Code Style diff --git a/sources/NuGet.Packaging.props b/sources/NuGet.Packaging.props index 6de9ee3e..cf795345 100644 --- a/sources/NuGet.Packaging.props +++ b/sources/NuGet.Packaging.props @@ -10,7 +10,7 @@ 0.0.7 qian-o Copyright (c) 2026 qian-o - Zenith.NET is a modern, cross-platform graphics and compute library for .NET. It provides a unified GPU programming interface supporting DirectX 12, Metal 4, and Vulkan 1.4 backends. + Zenith.NET is a modern, cross-platform graphics and compute library for .NET. It provides a unified GPU programming interface supporting DirectX12, Metal, and Vulkan backends. Git From 9b268d51ac342df033a0ebd0de6da003cde02f22 Mon Sep 17 00:00:00 2001 From: qian-o <1324771795@qq.com> Date: Wed, 1 Apr 2026 09:24:43 +0800 Subject: [PATCH 13/14] Add Silk.NET.MoltenVK.Native for MoltenVK support Added Silk.NET.MoltenVK.Native (v2.23.0) to enable MoltenVK, improving Vulkan compatibility on macOS. Updated both Directory.Packages.props and Zenith.NET.Vulkan.csproj to include the new package dependency. --- sources/Directory.Packages.props | 1 + sources/Zenith.NET.Vulkan/Zenith.NET.Vulkan.csproj | 1 + 2 files changed, 2 insertions(+) diff --git a/sources/Directory.Packages.props b/sources/Directory.Packages.props index 5929646b..8a77753e 100644 --- a/sources/Directory.Packages.props +++ b/sources/Directory.Packages.props @@ -14,6 +14,7 @@ + diff --git a/sources/Zenith.NET.Vulkan/Zenith.NET.Vulkan.csproj b/sources/Zenith.NET.Vulkan/Zenith.NET.Vulkan.csproj index 56ad22a6..39132514 100644 --- a/sources/Zenith.NET.Vulkan/Zenith.NET.Vulkan.csproj +++ b/sources/Zenith.NET.Vulkan/Zenith.NET.Vulkan.csproj @@ -9,6 +9,7 @@ + From 7c3790e1695133c359e19757e27a141ab76ab920 Mon Sep 17 00:00:00 2001 From: qian-o <1324771795@qq.com> Date: Wed, 1 Apr 2026 10:06:23 +0800 Subject: [PATCH 14/14] fix: use history.replaceState for search navigation --- documents/templates/public/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documents/templates/public/main.js b/documents/templates/public/main.js index f61c827e..fbf12aad 100644 --- a/documents/templates/public/main.js +++ b/documents/templates/public/main.js @@ -77,7 +77,7 @@ e.preventDefault(); const query = document.getElementById('search-query')?.value || ''; - history.pushState({ search: true, query }, ''); + history.replaceState({ search: true, query }, ''); window.location.href = link.href; });