Skip to content

Commit 536da88

Browse files
Spruill-1Copilot
andcommitted
v1.7.2: drop unused Win2D dependency
The Win2D NuGet package (Microsoft.Graphics.Win2D 1.3.0) and all related pch.h includes have been dragged along since Day 1 but no source file in the repo actually uses any Microsoft::Graphics::Canvas symbol. Every effect is implemented directly against D2D/D3D11 for the contract control the custom-effect path needs. Stripping it: pch.h Removes four Win2D headers (Canvas.h, Canvas.Effects.h, Canvas.UI.Xaml.h, Microsoft.Graphics.Canvas.native.h). packages.config Removes the Microsoft.Graphics.Win2D 1.3.0 entry. ShaderLab.vcxproj Removes the Win2D .props/.targets imports + the existence-check error target. README.md Drops "Direct2D and Win2D shader effects" -> "Direct2D shader effects" in the tagline. Drops "Win2D 1.3.0" from the prereq list. .github/copilot-instructions.md Drops Win2D from the pch.h aggregate description + the required- SDKs list. docs/development/project-structure.md Drops Win2D from the pch.h header comment. docs/history/decision-log.md Annotates decision #7 ("Win2D interop via native headers") as reversed Day 13 with a brief rationale. Verified: clean rebuild, RunHeadlessSmoke.ps1 passes (ratio 2.500), ShaderLabTests 183/183 pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 14b182b commit 536da88

10 files changed

Lines changed: 16 additions & 19 deletions

File tree

.github/copilot-instructions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ ShaderLab is a WinUI 3 desktop application (C++/WinRT) for developing, testing,
88

99
- **C++/WinRT only** — never generate C# code. Direct COM access to `ID2D1EffectImpl`, `ID2D1DrawTransform`, `ID2D1ComputeTransform` is the reason this project exists.
1010
- **`docs/` is the living architecture documentation tree.** Update the relevant file under `docs/architecture/`, `docs/effects/`, etc. when a significant architectural change lands. Append a new entry to [`docs/history/decision-log.md`](../docs/history/decision-log.md) with a Mermaid diagram for any choice that future contributors will need to understand the *why* of. The repo-root `README.md` is intentionally slim — install + build + a pointer to `docs/` — and should not be expanded with technical detail.
11-
- **All new `.cpp` files must `#include "pch.h"` as the first include** — precompiled header is mandatory (`pch.h` aggregates WinRT, D2D, D3D, Win2D, DXGI, WIC, and STL headers).
11+
- **All new `.cpp` files must `#include "pch.h"` as the first include** — precompiled header is mandatory (`pch.h` aggregates WinRT, D2D, D3D, DXGI, WIC, and STL headers).
1212

1313
## Build
1414

1515
- Open `ShaderLab.slnx` in Visual Studio 2022 17.8+
1616
- NuGet packages restore automatically (packages.config style, not PackageReference)
1717
- Build target: **Debug | x64** (also supports ARM64, Release)
1818
- No command-line build scripts exist; use MSBuild via VS or `msbuild ShaderLab.vcxproj /p:Configuration=Debug /p:Platform=x64`
19-
- Required: Windows App SDK 1.8, Windows 10 SDK 10.0.26100+, Win2D 1.3.0
19+
- Required: Windows App SDK 1.8, Windows 10 SDK 10.0.26100+
2020
- Linked native libs: `d3d11.lib`, `d2d1.lib`, `dxgi.lib`, `d3dcompiler.lib`, `dxguid.lib`, `windowscodecs.lib`
2121
- `/bigobj` is enabled; language standard is C++20 (VS 18+) or C++17 (VS 17)
2222

@@ -134,7 +134,7 @@ Active development centers on **tone-mapping and color-correction effects author
134134
- **Effect registry**: Singleton with 40+ built-in D2D effects across 9 categories. Case-insensitive name lookup.
135135
- **ShaderLab effects library**: 33 built-in effects in `Effects/ShaderLabEffects.h/.cpp` across categories: Analysis (Heatmaps + Scopes + Statistics + Tone-Mapping), Color Processing (Gamut Map + ICtCp Gamut Map + Scale), Source / Generator, Composition (Split Comparison), and the data-only Parameter / Clock / Numeric Expression / Random / Working Space nodes. Embedded HLSL with shared color math from `Effects/ColorMath.cpp`. Auto-compiled at first use; bytecode cached on disk under `%LOCALAPPDATA%\ShaderLab\bytecode\` (decision #58 catalog → see [builtin-catalog.md](../docs/effects/builtin-catalog.md) for the full per-effect type table).
136136
- **MCP server**: JSON-RPC 2.0 server on port 47808 (47809 for headless to avoid shared-machine conflicts). The server itself + 20 engine-pure routes live in `Engine/Mcp/{McpHttpServer,EngineMcpRoutes}.{h,cpp}`; 16 UI-coupled / host-specific routes stay in `MainWindow.McpRoutes.cpp`. Both hosts register the same engine-side route set through the same `IEngineCommandSink` interface (decision #58). Engine-side routes are uniform: pure mutation closures dispatched via `sink.Dispatch`, with 8 event hooks (`OnNodeAdded`, `OnNodeRemoved`, `OnNodeChanged`, `OnGraphCleared`, `OnGraphLoaded`, `OnGraphStructureChanged`, `OnCustomEffectRecompiled`, `OnDisplayProfileChanged`) the GUI overrides to keep its UI in sync.
137-
- **Versioning**: `Version.h` defines app version (currently **1.7.1**) and graph format version (2). Both are stored in saved graphs. Forward compatibility check on load. `EngineExport.h::SHADERLAB_ENGINE_ABI_VERSION` is independent — bumped manually on engine ABI breaks; mismatch between header and DLL aborts startup with a friendly message-box.
137+
- **Versioning**: `Version.h` defines app version (currently **1.7.2**) and graph format version (2). Both are stored in saved graphs. Forward compatibility check on load. `EngineExport.h::SHADERLAB_ENGINE_ABI_VERSION` is independent — bumped manually on engine ABI breaks; mismatch between header and DLL aborts startup with a friendly message-box.
138138
- **Refresh-rate-driven render loop on the worker thread**: the render worker `std::jthread` runs the graph evaluate at the active monitor's refresh rate (clamped to 60–240 Hz). Dirty-gated: skips evaluate when no nodes changed, no output window is open, and `m_forceRender` is false. The UI thread runs a `DispatcherQueueTimer` at the same rate, but its body is just "drain dispatcher + blit offscreen + Present1" — sub-ms cost. The interval is re-applied on every display change so dragging the window across monitors picks up the new rate.
139139
- **`ProcessDeferredCompute` requires an active D2D draw session**: it calls `dc->DrawImage` internally to pre-render the upstream chain into an FP32 bitmap, and outside `BeginDraw`/`EndDraw` that DrawImage silently no-ops. The GUI's `RenderFrame`, the headless host's `runEval` / `RunRender`, and the test bench all wrap accordingly.
140140
- **Ctrl+Enter** compiles shader from the editor TextBox.

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ Format follows [Keep a Changelog](https://keepachangelog.com/).
55

66
## [Unreleased]
77

8+
## [1.7.2] - 2026-05-10
9+
10+
### Removed
11+
12+
- **Win2D dependency dropped.** The `Microsoft.Graphics.Win2D` 1.3.0 NuGet package, the four `pch.h` includes (`winrt/Microsoft.Graphics.Canvas.h`, `.Effects.h`, `.UI.Xaml.h`, `Microsoft.Graphics.Canvas.native.h`), and the vcxproj `.props`/`.targets` imports are all removed. No source file in the repo had used a `Microsoft::Graphics::Canvas::*` symbol — every effect is implemented directly against D2D/D3D11 for the contract control the custom-effect path needs. Decision #7 from Day 1 ("Win2D interop via native headers") is marked reversed in the decision log. README + copilot-instructions + project-structure docs updated to drop the Win2D mention.
13+
814
## [1.7.1] - 2026-05-10
915

1016
### Fixed

Package.appxmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<Identity
1010
Name="ShaderLab"
1111
Publisher="CN=ShaderLab"
12-
Version="1.7.1.0" />
12+
Version="1.7.2.0" />
1313

1414
<mp:PhoneIdentity PhoneProductId="a1b2c3d4-e5f6-7890-abcd-ef1234567890" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
1515

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
**HDR / WCG / SDR shader effect development & debugging tool**
44

5-
A WinUI 3 desktop application (C++/WinRT) for developing, testing, and debugging Direct2D and Win2D shader effects with full HDR and wide color gamut support.
5+
A WinUI 3 desktop application (C++/WinRT) for developing, testing, and debugging Direct2D shader effects with full HDR and wide color gamut support.
66

77
---
88

@@ -76,7 +76,7 @@ Core capabilities:
7676
- **HDR / WCG aware** — DXGI adapter-change tracking, ICC profile parsing, monitor primaries piped into Custom-gamut analysis effects via the Working Space node.
7777
- **MCP server** + **headless host** for AI-agent and CI integration; the MCP route layer lives in `ShaderLabEngine.dll` so headless and GUI hosts share the route implementations.
7878

79-
Build: Visual Studio 2022 17.8+, Windows 10 SDK 10.0.26100+, Win2D 1.3.0, C++/WinRT only (no C#).
79+
Build: Visual Studio 2022 17.8+, Windows 10 SDK 10.0.26100+, C++/WinRT only (no C#).
8080

8181
---
8282

ShaderLab.vcxproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,6 @@
319319
<Import Project="packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets')" />
320320
<Import Project="packages\Microsoft.Windows.SDK.BuildTools.10.0.26100.7705\build\Microsoft.Windows.SDK.BuildTools.targets" Condition="Exists('packages\Microsoft.Windows.SDK.BuildTools.10.0.26100.7705\build\Microsoft.Windows.SDK.BuildTools.targets')" />
321321
<Import Project="packages\Microsoft.Windows.ImplementationLibrary.1.0.260126.7\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('packages\Microsoft.Windows.ImplementationLibrary.1.0.260126.7\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
322-
<Import Project="packages\Microsoft.Graphics.Win2D.1.3.0\build\native\Microsoft.Graphics.Win2D.targets" Condition="Exists('packages\Microsoft.Graphics.Win2D.1.3.0\build\native\Microsoft.Graphics.Win2D.targets')" />
323322
</ImportGroup>
324323
<!--
325324
Copy ShaderLabEngine.dll into the app output and include it in the MSIX package payload.
@@ -369,7 +368,6 @@
369368
<Error Condition="!Exists('packages\Microsoft.Windows.SDK.BuildTools.10.0.26100.7705\build\Microsoft.Windows.SDK.BuildTools.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Windows.SDK.BuildTools.10.0.26100.7705\build\Microsoft.Windows.SDK.BuildTools.props'))" />
370369
<Error Condition="!Exists('packages\Microsoft.Windows.SDK.BuildTools.10.0.26100.7705\build\Microsoft.Windows.SDK.BuildTools.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Windows.SDK.BuildTools.10.0.26100.7705\build\Microsoft.Windows.SDK.BuildTools.targets'))" />
371370
<Error Condition="!Exists('packages\Microsoft.Windows.ImplementationLibrary.1.0.260126.7\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Windows.ImplementationLibrary.1.0.260126.7\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
372-
<Error Condition="!Exists('packages\Microsoft.Graphics.Win2D.1.3.0\build\native\Microsoft.Graphics.Win2D.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Graphics.Win2D.1.3.0\build\native\Microsoft.Graphics.Win2D.targets'))" />
373371
</Target>
374372
<!--
375373
Auto-generates a local self-signed code-signing certificate so a fresh `git clone` can F5 immediately.

Version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ namespace ShaderLab
1414
{
1515
constexpr uint32_t VersionMajor = 1;
1616
constexpr uint32_t VersionMinor = 7;
17-
constexpr uint32_t VersionPatch = 1;
17+
constexpr uint32_t VersionPatch = 2;
1818

1919
// Human-readable version string.
20-
constexpr const wchar_t* VersionString = L"1.7.1";
20+
constexpr const wchar_t* VersionString = L"1.7.2";
2121

2222
// Graph format version. Increment when serialization format changes.
2323
// Graphs saved with a higher format version cannot be loaded by older apps.

docs/development/project-structure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ShaderLab/
1717
├── CHANGELOG.md # Version history
1818
├── Bootstrap.ps1 # One-command fresh-clone setup (cert + ExprTk + restore)
1919
20-
├── pch.h / pch.cpp # App PCH (WinRT, WinUI, D2D, D3D, Win2D, STL)
20+
├── pch.h / pch.cpp # App PCH (WinRT, WinUI, D2D, D3D, STL)
2121
├── pch_engine.h / pch_engine.cpp # Engine/Test/Headless PCH (WinRT base, D2D, D3D, MF, STL)
2222
├── App.xaml / .h / .cpp # Application entry point
2323
├── MainWindow.xaml / .h / .cpp # Main window layout + initialization (~4700 lines)

docs/history/decision-log.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
| 4 | Configurable PipelineFormat (not hardwired) | Users need sRGB for SDR debugging, HDR10 for PQ content, FP32 for precision work. Format affects swap chain, RTs, tone mapper, inspector. | Day 1 |
99
| 5 | Node-based DAG graph editor as primary UI | Visual effect chaining matches D2D effect graph model naturally. Enables per-node preview and pixel inspection. | Day 1 |
1010
| 6 | Live HLSL editing with D3DCompile hot-reload | Core value prop: edit shader code, see results immediately. D3DReflect discovers constant buffers for auto-generated UI. | Day 1 |
11-
| 7 | Win2D interop via native headers | Use Win2D's built-in effect wrappers where convenient, fall back to raw D2D for custom effects. Native interop via GetWrappedResource/CreateDrawingSession. | Day 1 |
11+
| 7 | Win2D interop via native headers | Use Win2D's built-in effect wrappers where convenient, fall back to raw D2D for custom effects. Native interop via GetWrappedResource/CreateDrawingSession. **Reversed (Day 13):** the Win2D wrappers were never adopted in practice — every effect ended up implemented directly against D2D for the precise contract control the custom-effect work demands. Win2D NuGet + pch.h includes + `Microsoft.Graphics.Canvas.native.h` interop header all dropped in v1.7.2; no source file used a `Microsoft::Graphics::Canvas::` symbol at the time. | Day 1 (reversed Day 13) |
1212
| 8 | MSIX packaged desktop app | Required for WinUI 3 full functionality, AppContainer=false for full trust (DirectX device access). | Day 1 |
1313
| 9 | Clean project at E:\source\ShaderLab | Avoid MSIX/manifest conflicts from nesting inside existing workspace. Fresh project with all NuGet wiring from scratch. | Day 1 |
1414
| 10 | Kahn's algorithm for topological sort | Linear-time O(V+E), naturally detects cycles (sorted count ≠ node count), simple queue-based — no recursion. | Day 2 |

packages.config

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Microsoft.Graphics.Win2D" version="1.3.0" targetFramework="native" />
43
<package id="Microsoft.Web.WebView2" version="1.0.3179.45" targetFramework="native" />
54
<package id="Microsoft.Windows.CppWinRT" version="2.0.250303.1" targetFramework="native" />
65
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.260126.7" targetFramework="native" />

pch.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@
4444
#include <winrt/Windows.System.h>
4545
#include <winrt/Windows.UI.Text.h>
4646

47-
// Win2D
48-
#include <winrt/Microsoft.Graphics.Canvas.h>
49-
#include <winrt/Microsoft.Graphics.Canvas.Effects.h>
50-
#include <winrt/Microsoft.Graphics.Canvas.UI.Xaml.h>
51-
5247
// Direct3D / Direct2D / DXGI
5348
#include <d3d11_4.h>
5449
#include <d2d1_3.h>
@@ -74,7 +69,6 @@
7469

7570
// Interop helpers
7671
#include <microsoft.ui.xaml.window.h>
77-
#include <Microsoft.Graphics.Canvas.native.h>
7872
#include <Shobjidl.h>
7973

8074
// STL

0 commit comments

Comments
 (0)