Skip to content

[HLSL] Correct ShaderOp SRV resource states - #8665

Closed
JoeCitizen wants to merge 1 commit into
microsoft:mainfrom
JoeCitizen:linalg-hlk-srv-buffer-flags
Closed

[HLSL] Correct ShaderOp SRV resource states#8665
JoeCitizen wants to merge 1 commit into
microsoft:mainfrom
JoeCitizen:linalg-hlk-srv-buffer-flags

Conversation

@JoeCitizen

@JoeCitizen JoeCitizen commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • create ShaderOp SRV buffers without the unordered-access resource flag
  • add PIXEL_SHADER_RESOURCE to their transition state
  • initialize resources on a DIRECT command list, so that state is legal

Why

The framework follow-up @tex3d asked for when approving #8366, tracked by #8378:

We'll probably want to avoid setting the UAV flag from Res.Desc.Flags in addSRVBuffer, and OR in the D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE flag to Res.TransitionTo, but since that one requires a ShaderOpTest.cpp infrastructure update, we can punt these to a follow-up.

addSRVBuffer creates read-only buffers, so the UAV flag over-declares them and costs the debug layer its ability to catch a genuine SRV/UAV mismatch. The helper has no knowledge of the consuming stage, so it should advertise the full shader-resource read state.

That widening is what pulls in the infrastructure change: PIXEL_SHADER_RESOURCE is not legal on a COMPUTE list, and CreateResources was the only one of four CreateForDevice call sites not deriving its list type from the ShaderOp. Test dispatch and draw are unaffected.

Validation

Local Release ExecHLSLTests on WARP, version-matched D3D12Core and d3d12SDKLayers, ExperimentalShaders=*, debug layer enabled. Differential against unmodified main on identical binaries and runtime, compared per test rather than by totals:

Selection This PR main
LinAlg::DxilConf_SM610_LinAlg::* 22 total, 17 passed, 4 failed, 1 skipped identical
*BasicTriangleOpTest* 2 total, 2 passed identical

No individual result differs. The four failures and one skip are pre-existing runtime gaps that reproduce unchanged on main. BasicTriangleOpTest exercises the DIRECT-list change on a graphics ShaderOp. No debug layer errors were emitted, and no physical GPU or HLK lab execution is claimed.

Refs #7841
Refs #8378
Closes #8684

Assisted-by: GitHub Copilot

Create SRV buffers without UAV flags and transition them for both pixel and non-pixel shader access. Use a direct resource-initialization list so the graphics-only pixel state is legal.

Assisted-by: GitHub Copilot

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 83725f5d-8e98-4c1d-91ee-ad47629e007b
@JoeCitizen
JoeCitizen force-pushed the linalg-hlk-srv-buffer-flags branch from 2991228 to 31ab0dc Compare July 30, 2026 00:25
@JoeCitizen

Copy link
Copy Markdown
Collaborator Author

Closing for now to avoid running CI on a long series of draft PRs while #8666 is under review. The branch linalg-hlk-srv-buffer-flags is retained and unchanged; this will be reopened once the base of the stack has landed.

@JoeCitizen JoeCitizen closed this Jul 31, 2026
@github-project-automation github-project-automation Bot moved this from New to Done in HLSL Roadmap Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

LinAlg HLK: Correct ShaderOp SRV resource states

1 participant