[PIX] Record only real resource accesses, including samplers - #8847
Open
Damyan Pepper (damyanp) wants to merge 1 commit into
Open
[PIX] Record only real resource accesses, including samplers#8847Damyan Pepper (damyanp) wants to merge 1 commit into
Damyan Pepper (damyanp) wants to merge 1 commit into
Conversation
The shader access tracking pass records an access for each DXIL operation that takes a resource handle. Two of these operations are not accesses. annotateHandle attaches type information to a handle. barrierByMemoryHandle puts accesses in order. The pass therefore reports a read or a write at a point where the shader touches no memory. The pass also matches a library handle against the UAVs, the SRVs, and the constant buffers, but not against the samplers. A sampler access in a library shader gets no record, so the sampler binding looks unused. An access that consumes an annotated handle keeps its record. The pass still looks through the annotation to reach the resource. PIX receives fewer incorrect records and more sampler records. A tool that counts records will see different totals. Assisted-by: Copilot Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 40dc9de3-617e-4caf-ab0d-fba0a033ed93
Damyan Pepper (damyanp)
requested a review
from Austin Kinross (austinkinross)
August 27, 2026 23:37
Damyan Pepper (damyanp)
marked this pull request as ready for review
August 27, 2026 23:38
Austin Kinross (austinkinross)
approved these changes
Aug 27, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Corrects PIX shader access tracking to record genuine resource accesses, including library samplers, while excluding annotations and barriers.
Changes:
- Adds sampler matching for library handles.
- Excludes
AnnotateHandleand resource barriers from access records. - Adds FileCheck and validation coverage.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
lib/DxilPIXPasses/DxilShaderAccessTracking.cpp |
Updates resource matching and non-access exclusions. |
tools/clang/unittests/HLSL/PixTest.cpp |
Extends pass configuration and validation tests. |
tools/clang/test/HLSLFileCheck/pix/AccessTrackingLibAnnotateHandleIsNotAnAccess.hlsl |
Tests annotation exclusion. |
tools/clang/test/HLSLFileCheck/pix/AccessTrackingLibAnnotatedHandleReadStillRecorded.hlsl |
Tests accesses through annotated handles. |
tools/clang/test/HLSLFileCheck/pix/AccessTrackingBarrierIsNotAnAccess.hlsl |
Tests barrier exclusion. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+1299
to
+1305
| std::string needle = "i32 " + std::to_string(byteOffset); | ||
| for (auto const &line : lines) { | ||
| if (line.find("dx.op.bufferStore") != std::string::npos && | ||
| line.find(needle) != std::string::npos) { | ||
| return true; | ||
| } | ||
| } |
Comment on lines
+1327
to
+1330
| auto compiled = Compile(m_dllSupport, hlsl, L"lib_6_6", {L"-Od"}); | ||
| auto output = RunShaderAccessTrackingPass( | ||
| compiled, L"S0:0:4i0;M0:20:4i0;U0:40:4i0;.0;0;0."); | ||
| auto lines = Split(Disassemble(output.blob), '\n'); |
| })x"; | ||
|
|
||
| auto compiled = Compile(m_dllSupport, source, L"ps_6_0", {L"-Od"}); | ||
| auto output = RunShaderAccessTrackingPass(compiled); |
| return textures[index].Sample(samp, pos.xy); | ||
| })x"; | ||
|
|
||
| auto compiled = Compile(m_dllSupport, source, L"ps_6_0", {L"-Od"}); |
| if (global == Sampler->GetGlobalSymbol()) { | ||
| binding = | ||
| hlsl::resource_helper::loadBindingFromResourceBase(Sampler.get()); | ||
| ret.registerType = RegisterType::Sampler; |
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.
The shader access tracking pass records an access for each DXIL operation that takes a resource handle. Two of these operations are not accesses. annotateHandle attaches type information to a handle. barrierByMemoryHandle puts accesses in order. The pass therefore reports a read or a write at a point where the shader touches no memory.
The pass also matches a library handle against the UAVs, the SRVs, and the constant buffers, but not against the samplers. A sampler access in a library shader gets no record, so the sampler binding looks unused.
An access that consumes an annotated handle keeps its record. The pass still looks through the annotation to reach the resource.
PIX receives fewer incorrect records and more sampler records. A tool that counts records will see different totals.
Assisted-by: Copilot
Stack created with GitHub Stacks CLI • Give Feedback 💬