Skip to content

Add validation for CreateHandleFromBinding - #4

Closed
damyanp with Copilot wants to merge 17 commits into
mainfrom
copilot/fix-issue-7019-tests
Closed

damyanp with Copilot wants to merge 17 commits into
mainfrom
copilot/fix-issue-7019-tests

Conversation

Copilot AI commented Feb 21, 2026 •

Copy link
Copy Markdown
  • Restore the non-constant bind test that was dropped in the previous commit
  • Three test files: _passing, _failing, and _non_constant_bind
  • All 3 tests pass

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…osoft#7019)

Add validation in BuildResMap() to check that the index parameter of
createHandleFromBinding falls within the range [rangeLowerBound, rangeUpperBound]
from the ResBind parameter. This matches the existing validation done for
createHandle.

Add a LIT test that verifies the validator catches an out-of-range index
(index 0 with rangeLowerBound=1, rangeUpperBound=1).

Co-authored-by: damyanp <[email protected]>
Copilot AI changed the title [WIP] Fix issue 7019 in DirectXShaderCompiler Validate index range for CreateHandleFromBinding Feb 21, 2026
Copilot AI requested a review from damyanp February 21, 2026 01:01
…ation

Extend the test to cover both edge cases: index below rangeLowerBound (0 < 1)
and index above rangeUpperBound (4 > 3). Uses a range of [1,3] to ensure
both boundaries are tested independently.

Co-authored-by: damyanp <[email protected]>
@damyanp

damyanp commented Feb 23, 2026

Copy link
Copy Markdown
Owner

@copilot add a short, one-line, description of this change to ReleaseNotes.md

Copilot AI commented Feb 23, 2026

Copy link
Copy Markdown
Author

@copilot add a short, one-line, description of this change to ReleaseNotes.md

Done in 5dc365f. Added a one-liner under "Other Changes" in the Upcoming Release section.

Copilot AI requested a review from damyanp February 23, 2026 18:01
Comment thread docs/ReleaseNotes.md Resolved
Copilot AI requested a review from damyanp February 23, 2026 18:04
damyanp pushed a commit that referenced this pull request Feb 26, 2026
…edTexture2D` type. (microsoft#8096)

Part of microsoft#7979

Implement `Load()` methods for `vk::SampledTexture2D`:
```hlsl
ParamType Load(int3 location, [], [ParamType offset], [uint status]);
```
Please see the last commit.

Copilot AI commented Mar 12, 2026

Copy link
Copy Markdown
Author

@copilot merge against upstream main and make sure the tests all still pass etc.

Merged in 7dd68e5. Resolved a conflict in docs/ReleaseNotes.md (kept both our entry and the new upstream integer width validation entry). Built and ran all 42 LitDXILValidation tests — all pass.

Comment thread docs/ReleaseNotes.md Resolved
@damyanp

damyanp commented Mar 12, 2026

Copy link
Copy Markdown
Owner

@copilot address the unresolved comments on this review

Copilot AI changed the title Add comprehensive validation for CreateHandleFromBinding Add validation for CreateHandleFromBinding Mar 12, 2026
Copilot AI requested a review from damyanp March 12, 2026 02:27

@damyanp damyanp left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider restructuring the three new createHandleFromBinding test files into two - one for some valid, passing, cases, and another for error cases.

Consolidate the three separate createHandleFromBinding test files into two
following the existing _passing/_failing convention:

- createHandleFromBinding_passing.ll: valid indices at lower and upper bounds
- createHandleFromBinding_failing.ll: index below/above range + invalid class

Removed the non-constant bind test since it's a defensive check that can't
be triggered without also triggering unrelated validation errors.

Co-authored-by: damyanp <[email protected]>

Copilot AI commented Mar 12, 2026

Copy link
Copy Markdown
Author

Consider restructuring the three new createHandleFromBinding test files into two - one for some valid, passing, cases, and another for error cases.

Restructured in 99c3cc3. The three test files are now two, following the existing _passing/_failing convention:

  • createHandleFromBinding_passing.ll — valid calls with indices at the lower and upper bounds of the range
  • createHandleFromBinding_failing.ll — index below lower bound, index above upper bound, and invalid resource class

Dropped the non-constant bind test since it's a defensive check that can't be triggered without also triggering unrelated validation errors.

Re-add createHandleFromBinding_non_constant_bind.ll to maintain test
coverage for the bind parameter constness check.

Co-authored-by: damyanp <[email protected]>
Remove mention of "non-constant bind parameters" from the description
since that case is tested in the separate _non_constant_bind.ll file.

Co-authored-by: damyanp <[email protected]>
Copilot AI requested a review from damyanp March 13, 2026 00:46
damyanp and others added 3 commits March 13, 2026 13:01
When the binding range has size 1 (rangeLowerBound == rangeUpperBound),
the resource is non-array and the index must be a constant. This mirrors
the existing CreateHandle validation which rejects non-constant indices
on non-array resources.

Co-authored-by: Copilot <[email protected]>
The rangeLowerBound == rangeUpperBound check cannot distinguish
non-array resources from 1-element arrays, so revert the non-constant
index rejection for now. Keep the passing test case that verifies
non-constant indices on array resources are accepted.

Co-authored-by: Copilot <[email protected]>
Rename local variables to UpperCamelCase: hdl->Hdl, bind->Bind,
cIndex->CIndex, index->Index.

Co-authored-by: Copilot <[email protected]>
@damyanp damyanp closed this Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants