Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions DXSharp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CharacterLab.Wpf", "samples
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DXSharp.Framework.Wpf", "src\DXSharp.Framework.Wpf\DXSharp.Framework.Wpf.csproj", "{CA095DE4-9BC3-49E4-A764-D4406AA4D795}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DXSharp.Framework.WinUI", "src\DXSharp.Framework.WinUI\DXSharp.Framework.WinUI.csproj", "{A466B395-6AE2-4EA8-8AE7-576F60182FC0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CharacterLab.WinUI", "samples\CharacterLab.WinUI\CharacterLab.WinUI.csproj", "{0BE7F2F5-66C9-4F48-B0EA-412BC17FC649}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -510,6 +514,30 @@ Global
{CA095DE4-9BC3-49E4-A764-D4406AA4D795}.Release|x64.Build.0 = Release|x64
{CA095DE4-9BC3-49E4-A764-D4406AA4D795}.Release|x86.ActiveCfg = Release|x86
{CA095DE4-9BC3-49E4-A764-D4406AA4D795}.Release|x86.Build.0 = Release|x86
{A466B395-6AE2-4EA8-8AE7-576F60182FC0}.Debug|Any CPU.ActiveCfg = Debug|x64
{A466B395-6AE2-4EA8-8AE7-576F60182FC0}.Debug|Any CPU.Build.0 = Debug|x64
{A466B395-6AE2-4EA8-8AE7-576F60182FC0}.Debug|x64.ActiveCfg = Debug|x64
{A466B395-6AE2-4EA8-8AE7-576F60182FC0}.Debug|x64.Build.0 = Debug|x64
{A466B395-6AE2-4EA8-8AE7-576F60182FC0}.Debug|x86.ActiveCfg = Debug|x64
{A466B395-6AE2-4EA8-8AE7-576F60182FC0}.Debug|x86.Build.0 = Debug|x64
{A466B395-6AE2-4EA8-8AE7-576F60182FC0}.Release|Any CPU.ActiveCfg = Release|x64
{A466B395-6AE2-4EA8-8AE7-576F60182FC0}.Release|Any CPU.Build.0 = Release|x64
{A466B395-6AE2-4EA8-8AE7-576F60182FC0}.Release|x64.ActiveCfg = Release|x64
{A466B395-6AE2-4EA8-8AE7-576F60182FC0}.Release|x64.Build.0 = Release|x64
{A466B395-6AE2-4EA8-8AE7-576F60182FC0}.Release|x86.ActiveCfg = Release|x64
{A466B395-6AE2-4EA8-8AE7-576F60182FC0}.Release|x86.Build.0 = Release|x64
{0BE7F2F5-66C9-4F48-B0EA-412BC17FC649}.Debug|Any CPU.ActiveCfg = Debug|x64
{0BE7F2F5-66C9-4F48-B0EA-412BC17FC649}.Debug|Any CPU.Build.0 = Debug|x64
{0BE7F2F5-66C9-4F48-B0EA-412BC17FC649}.Debug|x64.ActiveCfg = Debug|x64
{0BE7F2F5-66C9-4F48-B0EA-412BC17FC649}.Debug|x64.Build.0 = Debug|x64
{0BE7F2F5-66C9-4F48-B0EA-412BC17FC649}.Debug|x86.ActiveCfg = Debug|x64
{0BE7F2F5-66C9-4F48-B0EA-412BC17FC649}.Debug|x86.Build.0 = Debug|x64
{0BE7F2F5-66C9-4F48-B0EA-412BC17FC649}.Release|Any CPU.ActiveCfg = Release|x64
{0BE7F2F5-66C9-4F48-B0EA-412BC17FC649}.Release|Any CPU.Build.0 = Release|x64
{0BE7F2F5-66C9-4F48-B0EA-412BC17FC649}.Release|x64.ActiveCfg = Release|x64
{0BE7F2F5-66C9-4F48-B0EA-412BC17FC649}.Release|x64.Build.0 = Release|x64
{0BE7F2F5-66C9-4F48-B0EA-412BC17FC649}.Release|x86.ActiveCfg = Release|x64
{0BE7F2F5-66C9-4F48-B0EA-412BC17FC649}.Release|x86.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -556,6 +584,8 @@ Global
{F2B18F42-2A58-413A-921F-71648DB0C250} = {AEE84FD5-7441-42CF-AA6C-5805B759E1F8}
{AEDF6FCA-CFF8-47EB-9DF1-D62C776BE151} = {AEE84FD5-7441-42CF-AA6C-5805B759E1F8}
{CA095DE4-9BC3-49E4-A764-D4406AA4D795} = {29411031-4490-4542-B2D1-02D223BFD605}
{A466B395-6AE2-4EA8-8AE7-576F60182FC0} = {29411031-4490-4542-B2D1-02D223BFD605}
{0BE7F2F5-66C9-4F48-B0EA-412BC17FC649} = {AEE84FD5-7441-42CF-AA6C-5805B759E1F8}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7C4990EC-248E-49D5-A254-EA8AD214C338}
Expand Down
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
<PackageVersion Include="NUnit.Analyzers" Version="3.9.0" />
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
<PackageVersion Include="Microsoft.Build.Utilities.Core" Version="17.14.28" />
<PackageVersion Include="Microsoft.WindowsAppSDK.WinUI" Version="[2.7.0]" />
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ The first command presents four frames and exits. The second verifies GPU comput
| `DXSharp.Assets` | Static glTF/GLB models, materials, transforms, and decoded textures |
| `DXSharp.Core` | D3D12, DXGI, DXC, and generated COM interop |
| `DXSharp.Framework.Desktop` | WinForms presentation loop, swap-chain resize, and frame-slot retirement |
| `DXSharp.Framework.WinUI` | Optional WinUI 3 composition viewport and XAML overlays; [hosting contract](doc/WinUI-Hosting.md) |
| `DXSharp.Framework.Wpf` | Optional WPF child-HWND viewport using the shared frame renderer; [hosting contract](doc/Wpf-Hosting.md) |
| `DXSharp.DirectML` | Device and operator ownership, tensor binding, and DirectML execution |
| `DXSharp`, `DXSharp.Framework`, `DXSharp.Dxc` | Compatibility packages for the original RCW-based SDK |
Expand Down
7 changes: 5 additions & 2 deletions build/VerifyPackages.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@ try {
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($version)) {
throw 'Unable to evaluate the package version.'
}
foreach ($name in @('DXSharp', 'DXSharp.Dxc', 'DXSharp.Framework', 'DXSharp.Framework.Desktop', 'DXSharp.Framework.Wpf', 'DXSharp.Native', 'DXSharp.Assets', 'DXSharp.Core', 'DXSharp.DirectML')) {
foreach ($name in @('DXSharp', 'DXSharp.Dxc', 'DXSharp.Framework', 'DXSharp.Framework.Desktop', 'DXSharp.Framework.Wpf', 'DXSharp.Framework.WinUI', 'DXSharp.Native', 'DXSharp.Assets', 'DXSharp.Core', 'DXSharp.DirectML')) {
$path = Join-Path $packageDirectory "$name.$version.nupkg"
if (-not (Test-Path $path)) { throw "Missing package: $path" }
$archive = [System.IO.Compression.ZipFile]::OpenRead($path)
try {
$reader = [System.IO.StreamReader]::new($archive.GetEntry("$name.nuspec").Open())
try { [xml] $metadata = $reader.ReadToEnd() } finally { $reader.Dispose() }
$frameworkReferences = @($metadata.SelectNodes("//*[local-name()='frameworkReference']") | ForEach-Object { $_.GetAttribute('name') })
$winuiDependencies = @($metadata.SelectNodes("//*[local-name()='dependency']") | Where-Object { $_.GetAttribute('id') -like 'Microsoft.WindowsAppSDK*' })
if ($name -ne 'DXSharp.Framework.WinUI' -and $winuiDependencies.Count -gt 0) { throw "Optional WinUI dependency leaked into $name." }
if ($name -eq 'DXSharp.Framework.WinUI' -and $winuiDependencies.Count -eq 0) { throw 'The WinUI adapter lost its pinned Windows App SDK dependency.' }
if ($name -eq 'DXSharp.Framework.Wpf' -and
('Microsoft.WindowsDesktop.App.WPF' -notin $frameworkReferences -or 'Microsoft.WindowsDesktop.App.WindowsForms' -in $frameworkReferences)) {
throw 'The WPF package must declare WPF without acquiring Windows Forms.'
Expand All @@ -35,7 +38,7 @@ try {
}
$assemblies = @($archive.Entries | Where-Object FullName -CLike "lib/*/$name.dll")
if ($assemblies.Count -eq 0) { throw "No library assembly found in $path" }
if ($name -in @('DXSharp.Native', 'DXSharp.Core', 'DXSharp.DirectML', 'DXSharp.Framework.Desktop', 'DXSharp.Framework.Wpf', 'DXSharp.Assets', 'DXSharp.Framework')) {
if ($name -in @('DXSharp.Native', 'DXSharp.Core', 'DXSharp.DirectML', 'DXSharp.Framework.Desktop', 'DXSharp.Framework.Wpf', 'DXSharp.Framework.WinUI', 'DXSharp.Assets', 'DXSharp.Framework')) {
foreach ($major in '10', '11') {
# NuGet normalizes the trailing zero of the Windows platform version.
$framework = if ($name -eq 'DXSharp.Assets') { "net$major.0" } else { "net$major.0-windows10.0.26100" }
Expand Down
2 changes: 2 additions & 0 deletions build/VerifySamples.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ try {
Invoke-Sample 'CharacterLab-native' @('run', '--project', 'samples/CharacterLab.Native', '-c', 'Debug', '--', '--warp', '--frames=9', '--resize-test')
Invoke-Sample 'CharacterLab-wpf' @('run', '--project', 'samples/CharacterLab.Wpf', '-c', 'Debug', '--', '--warp', '--frames=9')
Invoke-Sample 'CharacterLab-wpf-host' @('run', '--project', 'samples/CharacterLab.Wpf', '-c', 'Debug', '--', '--warp', '--host-test')
Invoke-Sample 'CharacterLab-winui' @('run', '--project', 'samples/CharacterLab.WinUI', '-c', 'Debug', '--', '--warp', '--frames=9')
Invoke-Sample 'CharacterLab-winui-host' @('run', '--project', 'samples/CharacterLab.WinUI', '-c', 'Debug', '--', '--warp', '--host-test')
Invoke-Sample 'DepthStencil' @('run', '--project', 'samples/DepthStencil', '-c', 'Debug', '--', '--warp')

Invoke-Sample 'ModernTriangle' @('run', '--project', 'samples/ModernTriangle', '-c', 'Debug', '--',
Expand Down
2 changes: 1 addition & 1 deletion build/release_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import xml.etree.ElementTree as ET
from zipfile import ZipFile

PACKAGE_IDS = ("DXSharp.Native", "DXSharp.Assets", "DXSharp.Core", "DXSharp.DirectML", "DXSharp.Framework", "DXSharp.Framework.Desktop", "DXSharp.Framework.Wpf", "DXSharp.Tools.Builds")
PACKAGE_IDS = ("DXSharp.Native", "DXSharp.Assets", "DXSharp.Core", "DXSharp.DirectML", "DXSharp.Framework", "DXSharp.Framework.Desktop", "DXSharp.Framework.Wpf", "DXSharp.Framework.WinUI", "DXSharp.Tools.Builds")
PREVIEW = re.compile(r"(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)-(?:net10-)?preview\.[1-9][0-9]*")


Expand Down
23 changes: 17 additions & 6 deletions build/verify_sample_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@
import tempfile
import xml.etree.ElementTree as ET

SDK_PACKAGES = ("DXSharp.Native", "DXSharp.Core", "DXSharp.DirectML", "DXSharp.Framework.Desktop", "DXSharp.Framework.Wpf", "DXSharp.Assets", "DXSharp.Framework")
SDK_PACKAGES = ("DXSharp.Native", "DXSharp.Core", "DXSharp.DirectML", "DXSharp.Framework.Desktop", "DXSharp.Framework.Wpf", "DXSharp.Framework.WinUI", "DXSharp.Assets", "DXSharp.Framework")
EXCLUDED = {"bin", "obj", "artifacts", ".vs"}


def run(arguments, directory, log):
def run(arguments, directory, log, executable=False):
# Isolated package caches must not remain loaded in reusable MSBuild nodes.
environment = {**os.environ, "MSBUILDDISABLENODEREUSE": "1", "DOTNET_CLI_USE_MSBUILD_SERVER": "0"}
with log.open("w", encoding="utf-8") as output:
process = subprocess.Popen(["dotnet", *arguments], cwd=directory, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, text=True, encoding="utf-8", errors="replace")
process = subprocess.Popen(arguments if executable else ["dotnet", *arguments], cwd=directory, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, text=True, encoding="utf-8", errors="replace", env=environment)
for line in process.stdout:
print(line, end="", flush=True)
output.write(line)
Expand Down Expand Up @@ -99,8 +101,8 @@ def qualify(configuration, runtime_major):
for key, pattern in (("local", "DXSharp.*"), ("nuget.org", "*")):
ET.SubElement(ET.SubElement(mapping, "packageSource", key=key), "package", pattern=pattern)
ET.ElementTree(config).write(consumer / "NuGet.Config", encoding="utf-8", xml_declaration=True)
run(["restore", "Samples.slnx", "--packages", str(consumer / "packages"), "-m:1", "-p:Platform=Any CPU"], consumer, evidence / "restore.log")
run(["build", "Samples.slnx", "-c", configuration, "--no-restore", "-m:1", "-p:Platform=Any CPU"], consumer, evidence / "build.log")
run(["restore", "Samples.slnx", "--packages", str(consumer / "packages"), "-m:1", "-nr:false", "-p:Platform=Any CPU"], consumer, evidence / "restore.log")
run(["build", "Samples.slnx", "-c", configuration, "--no-restore", "-m:1", "-nr:false", "-p:UseSharedCompilation=false", "-p:Platform=Any CPU"], consumer, evidence / "build.log")
if os.name == "nt":
# The developer shell's Platform variable must not change the built output path.
fleet = consumer / "samples/FleetBattler/bin" / configuration / framework / "FleetBattler.dll"
Expand All @@ -123,6 +125,15 @@ def qualify(configuration, runtime_major):
raise RuntimeError(f'WPF precompiled consumer deployed {name}')
run([str(wpf), "--warp", "--frames=9"], consumer, evidence / "character-wpf-runtime.log")
run([str(wpf), "--warp", "--host-test"], consumer, evidence / "character-wpf-host.log")
winui_project = consumer / 'samples/CharacterLab.WinUI/CharacterLab.WinUI.csproj'
winui = Path(subprocess.check_output(['dotnet', 'msbuild', str(winui_project), f'-p:Configuration={configuration}', '-p:Platform=Any CPU', '-getProperty:TargetPath', '-nologo'], cwd=consumer, text=True).strip()).with_suffix('.exe')
if not winui.is_file():
raise RuntimeError(f'Missing WinUI apphost: {winui}')
for name in ('dxcompiler.dll', 'dxil.dll'):
if (winui.parent / name).exists():
raise RuntimeError(f'WinUI precompiled consumer deployed {name}')
run([str(winui), '--warp', '--frames=9'], consumer, evidence / 'character-winui-runtime.log', executable=True)
run([str(winui), '--warp', '--host-test'], consumer, evidence / 'character-winui-host.log', executable=True)
(evidence / "samples.json").write_text(json.dumps(manifest, indent=2) + "\n", encoding="utf-8")
print(f"PASS: all {len(manifest)} runnable samples consume packaged SDK {version} outside the checkout.")

Expand Down
2 changes: 1 addition & 1 deletion doc/Framework-Vision.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ Acceptance remains workload-based: CPU/GPU deformation agreement; clear allocati

The shader/host slice adds precompiled Framework shader resources, typed runtime compiler options and a packaged incremental DXC task. FrameRenderer separates frame slots/presentation from UI scheduling; DesktopGame keeps its API and NativeGame supplies an independent Win32 host. CharacterLab.Native shares the existing scene and has no WinForms reference. See [the shader/host contract](Shader-Build-and-Hosting.md) for packaging, cross-compilation limits and qualification.

The optional `DXSharp.Framework.Wpf` adapter now hosts the shared CharacterLab scene with dispatcher scheduling, physical-pixel resize and explicit stop/drain ownership. See [WPF hosting](Wpf-Hosting.md). WinUI composition and the full Game/Application lifecycle remain continuation work; WPF/BAML NativeAOT is not inferred from the separate native interop gates.
The optional `DXSharp.Framework.Wpf` adapter now hosts the shared CharacterLab scene with dispatcher scheduling, physical-pixel resize and explicit stop/drain ownership. See [WPF hosting](Wpf-Hosting.md). The optional `DXSharp.Framework.WinUI` adapter adds a composition viewport with ordinary XAML overlays ([contract](WinUI-Hosting.md)). The full Game/Application lifecycle remains continuation work; WPF/BAML NativeAOT is not inferred from the separate native interop gates.
2 changes: 1 addition & 1 deletion doc/Publishing-Previews.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Publishing DXSharp previews

Preview 3 shipped five modern package IDs. Preview 4 development adds Framework, the DXC build tool and the optional WPF host. The candidate set is defined in `build/release_packages.py`: `DXSharp.Native`, `DXSharp.Assets`, `DXSharp.Core`, `DXSharp.DirectML`, `DXSharp.Framework.Desktop`, `DXSharp.Framework`, `DXSharp.Framework.Wpf` and `DXSharp.Tools.Builds`. Library assets target .NET 10/11 for Windows x64 (Assets is portable; the build tool targets netstandard2.0). Legacy compatibility projects remain independently buildable CI artifacts. Published versions remain immutable.
Preview 3 shipped five modern package IDs. Preview 4 development adds Framework, the DXC build tool and the optional WPF and WinUI hosts. The candidate set is defined in `build/release_packages.py`: `DXSharp.Native`, `DXSharp.Assets`, `DXSharp.Core`, `DXSharp.DirectML`, `DXSharp.Framework.Desktop`, `DXSharp.Framework`, `DXSharp.Framework.Wpf`, `DXSharp.Framework.WinUI` and `DXSharp.Tools.Builds`. Library assets target .NET 10/11 for Windows x64 (Assets is portable; the build tool targets netstandard2.0). Legacy compatibility projects remain independently buildable CI artifacts. Published versions remain immutable.

## One-time configuration

Expand Down
3 changes: 2 additions & 1 deletion doc/SDK-Architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ flowchart TD
| `DXSharp.Core` | Device and queue ownership, buffers and resource states, descriptors, pipelines, HWND swap chains, DXC, and a bounded DXR surface |
| `DXSharp.DirectML` | Same-device tensor binding and synchronous compiled Add and GEMM execution with optional fused ReLU |
| `DXSharp.Framework.Desktop` | A WinForms-owned STA loop, one or two fenced frame slots, resize, depth target, and presentation |
| `DXSharp.Framework.WinUI` | Optional WinUI 3 SwapChainPanel composition over the shared frame renderer |
| `DXSharp.Framework.Wpf` | Optional WPF dispatcher scheduling and a child-HWND viewport over the shared frame renderer |
| `DXSharp`, `DXSharp.Dxc`, `DXSharp.Framework` | Compatibility types, RCWs, older wrappers and framework. The compatibility tests still exercise this path. BasicSample uses the current desktop host. |

Expand Down Expand Up @@ -89,7 +90,7 @@ Split frame-slot management and presentation from the WinForms message loop. Def
| Avalonia | A Windows sample using `NativeControlHost` and a child HWND |
| Headless | The same renderer into offscreen targets with readback and no UI dispatcher |

Qualify resize, DPI changes, host teardown, and device removal in each adapter. Embedded WinUI composition is a separate surface kind from the HWND swap chain available today. [WinUI SwapChainPanel](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.controls.swapchainpanel) · [WPF HWND hosting](https://learn.microsoft.com/dotnet/desktop/wpf/advanced/hosting-win32-content-in-wpf) · [Avalonia native Windows controls](https://docs.avaloniaui.net/docs/platform-specific-guides/windows)
Qualify resize, DPI changes, host teardown, and device removal in each adapter. The optional WinUI adapter uses the shared composition surface; the WPF adapter uses the HWND surface. See the [WinUI contract](WinUI-Hosting.md) and [WPF contract](Wpf-Hosting.md). [WinUI SwapChainPanel](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.controls.swapchainpanel) · [WPF HWND hosting](https://learn.microsoft.com/dotnet/desktop/wpf/advanced/hosting-win32-content-in-wpf) · [Avalonia native Windows controls](https://docs.avaloniaui.net/docs/platform-specific-guides/windows)

### NoesisGUI adapter

Expand Down
Loading
Loading