-
Notifications
You must be signed in to change notification settings - Fork 138
build(cmake): restore copy_shaders fast deployment #1756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
doodlum
merged 1 commit into
community-shaders:dev
from
alandtse:feature/fast-shader-iteration
Jan 24, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # Development Documentation | ||
|
|
||
| ## Getting Started | ||
|
|
||
| - **[VSCode Setup](./vscode-setup.md)** - IDE configuration, extensions, and auto-deploy | ||
| - **[Shader Workflow](./shader-workflow.md)** - Fast shader iteration and deployment | ||
|
|
||
| ## Quick Links | ||
|
|
||
| ### Common Tasks | ||
|
|
||
| - **Fast shader deployment:** `cmake --build build/ALL-WITH-AUTO-DEPLOYMENT --target COPY_SHADERS` | ||
| - **Full build with deployment:** `.\BuildRelease.bat ALL-WITH-AUTO-DEPLOYMENT` | ||
| - **Run tests:** `cmake --build build/ALL --target run_shader_tests` | ||
|
|
||
| ### Build Presets | ||
|
|
||
| - `ALL` - Standard build (no auto-deployment) | ||
| - `ALL-WITH-AUTO-DEPLOYMENT` - Build + deploy to game directory | ||
| - `Dev` - Fast iteration preset (recommended for development) | ||
|
|
||
| See `CMakePresets.json` for all available presets. | ||
|
|
||
| ## Build Targets | ||
|
|
||
| | Target | Builds DLL | Runs Tests | Copies Shaders | Use Case | | ||
| | ------------------ | ---------- | ---------- | -------------- | ---------------------- | | ||
| | `COPY_SHADERS` | ❌ | ❌ | ✅ | Fast shader iteration | | ||
| | `DEPLOY_ALL` | ✅ | ✅ | ✅ | Full deployment (auto) | | ||
| | `prepare_shaders` | ❌ | ✅ | ✅ (AIO only) | CI shader validation | | ||
| | `run_shader_tests` | ❌ | ✅ | ❌ | Test shaders only | | ||
|
|
||
| ## Contributing | ||
|
|
||
| When adding new features or documentation, please keep development docs organized under `docs/development/`. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| # Shader Development Workflow | ||
|
|
||
| ## Quick Reference | ||
|
|
||
| ```bash | ||
| # Fast shader-only deployment (recommended for dev iteration) | ||
| cmake --build build/ALL-WITH-AUTO-DEPLOYMENT --target COPY_SHADERS | ||
|
|
||
| # Full deployment (DLL + tests + shaders) | ||
| cmake --build build/ALL-WITH-AUTO-DEPLOYMENT --target DEPLOY_ALL | ||
| ``` | ||
|
|
||
| ## Overview | ||
|
|
||
| Two deployment targets for different workflows: | ||
|
|
||
| - **`COPY_SHADERS`** - Fast shader-only deployment (seconds) | ||
| - **`DEPLOY_ALL`** - Full build + tests + deployment (minutes) | ||
|
|
||
| ### Requirements | ||
|
|
||
| - Must have `AUTO_PLUGIN_DEPLOYMENT=ON` in your CMake preset | ||
| - Must have `CommunityShadersOutputDir` environment variable set to your Skyrim directory | ||
|
|
||
| ### Usage | ||
|
|
||
| #### Manual | ||
|
|
||
| ```bash | ||
| # Fast iteration: Only copy changed shaders to game directory | ||
| cmake --build build/ALL-WITH-AUTO-DEPLOYMENT --target COPY_SHADERS | ||
|
|
||
| # Or in Visual Studio: Right-click "COPY_SHADERS" target -> Build | ||
|
|
||
| # Full deployment (same as running cmake --build with no target): | ||
| cmake --build build/ALL-WITH-AUTO-DEPLOYMENT --target DEPLOY_ALL | ||
| ``` | ||
|
|
||
| #### Automatic (VSCode) | ||
|
|
||
| You can configure VSCode to automatically deploy shaders when you save `.hlsl` or `.hlsli` files using the [RunOnSave](https://marketplace.visualstudio.com/items?itemName=emeraldwalk.RunOnSave) extension. | ||
|
|
||
| **See [VSCode Setup](../development/vscode-setup.md) for complete configuration instructions.** | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| 1. Run `cmake --preset ALL-WITH-AUTO-DEPLOYMENT` at least once to create build directory | ||
| 2. Set `CommunityShadersOutputDir` environment variable to your Skyrim `Data` directory | ||
| 3. Ensure `AUTO_PLUGIN_DEPLOYMENT=ON` in your CMake preset | ||
|
|
||
| ### What COPY_SHADERS does now | ||
|
|
||
| 1. ✅ Transforms shaders from source layout → game layout (via AIO staging) | ||
| 2. ✅ Copies only changed shader files (incremental robocopy) | ||
| 3. ✅ Deploys to `$CommunityShadersOutputDir/Shaders` | ||
| 4. ❌ Does NOT build the DLL | ||
| 5. ❌ Does NOT run shader tests | ||
| 6. ❌ Does NOT deploy non-shader files | ||
|
|
||
| ### Target Comparison | ||
|
|
||
| | Target | Builds DLL | Runs Tests | Copies Shaders | Use Case | | ||
| | ----------------- | ---------- | ---------- | -------------- | --------------------- | | ||
| | `COPY_SHADERS` | ❌ | ❌ | ✅ | Fast shader iteration | | ||
| | `DEPLOY_ALL` | ✅ | ✅ | ✅ | Full deployment | | ||
| | `prepare_shaders` | ❌ | ✅ | ✅ (AIO only) | CI validation | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| # VSCode Development Setup | ||
|
|
||
| ## Quick Start | ||
|
|
||
| 1. Install recommended extensions | ||
| 2. Configure auto-deploy (optional) | ||
|
|
||
| ## Recommended Extensions | ||
|
|
||
| ### Required for Shader Development | ||
|
|
||
| - **HLSL Tools** (`TimGJones.hlsltools`) | ||
| - Syntax highlighting and IntelliSense for HLSL | ||
| - **CMake Tools** (`ms-vscode.cmake-tools`) | ||
| - Build system integration | ||
|
|
||
| ### Optional for Productivity | ||
|
|
||
| - **Run On Save** (`emeraldwalk.RunOnSave`) | ||
| - Auto-deploy shaders when saving files | ||
| - See configuration below | ||
|
|
||
| ## Auto-Deploy on Save (Optional) | ||
|
|
||
| Automatically deploy shaders when you save `.hlsl` or `.hlsli` files. | ||
|
|
||
| **Setup:** | ||
|
|
||
| 1. Install extension: `ext install emeraldwalk.RunOnSave` | ||
| 2. Create `.vscode/settings.json` in the repository root (if it doesn't exist) | ||
| 3. **Add the following** to your `.vscode/settings.json`: | ||
| ```json | ||
| { | ||
| "emeraldwalk.runonsave": { | ||
| "commands": [ | ||
| { | ||
| "match": "\\.(hlsl|hlsli)$", | ||
| "notMatch": "[\\\\\\/](build|extern|dist|Tests)[\\\\\\/]", | ||
| "isAsync": true, | ||
| "cmd": "cmake --build ${workspaceFolder}/build/ALL-WITH-AUTO-DEPLOYMENT --target COPY_SHADERS", | ||
| "runIn": "terminal", | ||
| "runningStatusMessage": "Deploying shaders...", | ||
| "finishStatusMessage": "Shaders deployed!" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| ``` | ||
| 4. Run `cmake --preset ALL-WITH-AUTO-DEPLOYMENT` once to create the build directory | ||
| 5. Save any shader → Auto-deploys in seconds! | ||
|
|
||
| **Note:** If the build directory doesn't exist, you'll see an error in the terminal. Just run the preset command and try again. | ||
|
|
||
| **How it works:** | ||
|
|
||
| - Triggers `COPY_SHADERS` target on shader file saves | ||
| - Only copies shaders (no DLL build, no tests) | ||
| - Excludes build artifacts and test files | ||
| - Shows status messages in VSCode | ||
|
|
||
| **Interaction with built-in filewatcher:** | ||
|
|
||
| Community Shaders has a built-in filewatcher (**Settings → Advanced → Shader Compilation → Enable File Watcher**) that hot-reloads shaders when files change in the game's `Data/Shaders/` directory. The workflow is: | ||
|
|
||
| 1. Edit shader in VSCode | ||
| 2. Save → RunOnSave deploys to `Data/Shaders/` | ||
| 3. Built-in filewatcher detects change → Recompiles shader in-game | ||
| 4. See results immediately without restarting Skyrim! | ||
|
|
||
| This provides near-instant iteration: edit → save → see changes in seconds. | ||
|
|
||
| **To disable auto-deploy:** Remove or comment out the `emeraldwalk.runonsave` section in your local `.vscode/settings.json` | ||
|
|
||
| ## Customization | ||
|
|
||
| Your `.vscode/settings.json` is gitignored, so you can customize it without affecting other developers: | ||
|
|
||
| - Adjust auto-deploy behavior | ||
| - Add your own file associations | ||
| - Configure workspace-specific settings | ||
|
|
||
| ## See Also | ||
|
|
||
| - [Shader Development Workflow](./shader-workflow.md) - Manual and automated shader deployment |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This "Build Presets" section calls out an
ALL-WITH-AUTO-DEPLOYMENTpreset and then says to "SeeCMakePresets.jsonfor all available presets", but that file does not define anALL-WITH-AUTO-DEPLOYMENTbuild preset (the only reference is a configure preset inCMakeUserPresets.json.template). To avoid confusing new contributors, it would be better to either (a) explicitly mention thatALL-WITH-AUTO-DEPLOYMENTcomes from a user CMakeUserPresets file, or (b) adjust the wording so this section and the file reference accurately reflect where each preset is defined.