Make HLSL_COPY_GENERATED_SOURCES copy DxilCounters.cpp#8296
Merged
damyanp merged 3 commits intomicrosoft:mainfrom Mar 28, 2026
Merged
Make HLSL_COPY_GENERATED_SOURCES copy DxilCounters.cpp#8296damyanp merged 3 commits intomicrosoft:mainfrom
damyanp merged 3 commits intomicrosoft:mainfrom
Conversation
- Add TARGET_NAME optional parameter to add_hlsl_hctgen() in HCT.cmake to allow different CMake target name and hctgen mode (needed since DxilCounters is already used as the target name for DxilCounters.h) - Add add_hlsl_hctgen(DxilCounters OUTPUT DxilCounters.cpp CODE_TAG ...) to lib/DXIL/CMakeLists.txt so DxilCounters.cpp participates in source regeneration when HLSL_COPY_GENERATED_SOURCES is set - Regenerate DxilCounters.cpp: adds BarrierByMemoryType/Handle/Node, FDot, VectorReduceAnd/Or, SampleCmpGrad/Bias, RawBufferVectorLoad/Store Co-authored-by: damyanp <8118402+damyanp@users.noreply.github.com> Agent-Logs-Url: https://github.com/damyanp/DirectXShaderCompiler/sessions/12071741-931b-464e-90a5-ce03c9b6e9c3
Instead of a special-purpose TARGET_NAME parameter, the CMake target name
is now automatically derived as "${mode}_${extension}" (e.g. DxilCounters_h,
DxilCounters_cpp). This resolves the DxilCounters name conflict between the
.h and .cpp targets without any caller-visible special-casing.
Update the one external reference (DxilIntrinsicTables →
DxilIntrinsicTables_h) in tools/clang/lib/Sema/CMakeLists.txt.
Co-authored-by: damyanp <8118402+damyanp@users.noreply.github.com>
Agent-Logs-Url: https://github.com/damyanp/DirectXShaderCompiler/sessions/9de1b168-12bd-407d-b2e7-e83f2480dc9d
V-FEXrt
approved these changes
Mar 26, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the HCT-generated source workflow so DxilCounters.cpp is treated as a generated CODE_TAG source and gets updated/copied when HLSL_COPY_GENERATED_SOURCES is enabled, and adjusts HCT target naming to support generating multiple outputs for the same mode (e.g., both .h and .cpp).
Changes:
- Add
DxilCounters.cppto theadd_hlsl_hctgenCODE_TAG generation list forlib/DXIL. - Change
add_hlsl_hctgento create per-output targets named by file extension (e.g.,DxilIntrinsicTables_h) to avoid target-name collisions. - Update the checked-in generated
DxilCounters.cppopcode-counter predicates to match the latest generated output.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tools/clang/lib/Sema/CMakeLists.txt | Updates the dependency target name to match new HCT per-extension target naming (DxilIntrinsicTables_h). |
| lib/DXIL/DxilCounters.cpp | Brings the checked-in generated counters in sync with updated opcode classifications. |
| lib/DXIL/CMakeLists.txt | Adds HCT generation/copy support for DxilCounters.cpp as a CODE_TAG output. |
| cmake/modules/HCT.cmake | Changes HCT custom target naming to include the output extension, enabling multiple outputs per mode. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
DxilCounters.cpp wasn't getting updated when HLSL_COPY_GENERATED_SOURCES was set. This change fixes that, and includes the updated DxilCounters.cpp.
add_hlsl_hctgen now adds the file extension to the target it creates, which allows us to generate both DxilCounters.h and DxilCounters.cpp.