12 Commits

Author SHA1 Message Date
joaosaffran
e28a559696
[DirectX] Validating Root flags are denying shader stage (#160919)
Root Signature Flags, allow flags to block compilation of certain shader
stages. This PR implements a validation and notify the user if they
compile a root signature that is denying such shader stage.
Closes: https://github.com/llvm/llvm-project/issues/153062
Previously approved: https://github.com/llvm/llvm-project/pull/153287

---------

Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
Co-authored-by: Joao Saffran <{ID}+{username}@users.noreply.github.com>
Co-authored-by: Joao Saffran <jderezende@microsoft.com>
2025-09-26 13:43:58 -04:00
joaosaffran
d88c89f860
[DirectX] Removing dxbc StaticSampler from mcbxdc (#154631)
MC Static Samplers Representation currently depends on Object
structures. This PR removes that dependency and in order to facilitate
removing to_underlying usage in follow-up PRs.
2025-09-11 18:47:09 -04:00
joaosaffran
9179d3f19e
[DirectX] Validate if Textures/TypedBuffers are being bound in Root Signatures (#147573)
DXC doesn't allow Textures/TypedBuffers to bind with root signature
descriptors, this implements the same check.

Closes: #126647

---------

Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
Co-authored-by: Joao Saffran <{ID}+{username}@users.noreply.github.com>
Co-authored-by: Joao Saffran <jderezende@microsoft.com>
2025-09-10 19:49:34 -04:00
joaosaffran
9e778f6cd1
[DirectX] Removing dxbc DescriptorRange from mcbxdc (#154629)
MC Descriptor Range Representation currently depend on Object
structures. This PR removes that dependency and in order to facilitate
removing to_underlying usage in follow-up PRs.
2025-09-10 14:49:01 -04:00
joaosaffran
dfc376a9bf
[DirectX] Removing dxbc RootSignature and RootDescriptor from mcbxdc (#154585) 2025-08-29 12:42:34 -07:00
joaosaffran
36ebd17972
[DirectX] Validate registers are bound to root signature (#146785)
DXC checks if registers are correctly bound to root signature
descriptors. This implements the same check.
closes: #[126645](https://github.com/llvm/llvm-project/issues/126645)

---------

Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
Co-authored-by: Joao Saffran <jderezende@microsoft.com>
2025-08-28 17:10:10 -04:00
Rahul Joshi
eb88c049f5
[NFC][DirectX] Fix variable set but not used warning (#155445) 2025-08-26 10:25:06 -07:00
joaosaffran
c6dfbc5cc7
[DirectX] Refactor RootSignature Backend to remove to_underlying from Root Parameter Header (#154249)
This patch is refactoring Root Parameter Header in DX Container backend
to remove the usage of `to_underlying`. This requires some changes:
first, MC Root Signature should not depend on Object/DXContainer.h;
Second, we need to assume data to be valid in scenarios where it was
originally not expected, this made some tests be removed.
2025-08-25 16:28:07 -04:00
joaosaffran
d56fa96524
[DirectX] Add Range Overlap validation (#152229)
As part of the Root Signature Spec, we need to validate if Root
Signatures are not defining overlapping ranges.
Closes: https://github.com/llvm/llvm-project/issues/126645

---------

Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
Co-authored-by: Joao Saffran <{ID}+{username}@users.noreply.github.com>
Co-authored-by: Joao Saffran <jderezende@microsoft.com>
2025-08-14 18:40:11 -04:00
Helena Kotas
fb1035cfb4
[DirectX] Fix resource binding analysis incorrectly removing duplicates (#152253)
The resource binding analysis was incorrectly reducing the size of the
`Bindings` vector by one element after sorting and de-duplication. This
led to an inaccurate setting of the `HasOverlappingBinding` flag in the
`DXILResourceBindingInfo` analysis, as the truncated vector no longer
reflected the true binding state.

This update corrects the shrink logic and introduces an `assert` in the
`DXILPostOptimizationValidation` pass. The assertion will trigger if
`HasOverlappingBinding` is set but no corresponding error is detected,
helping catch future inconsistencies.

The bug surfaced when the `srv_metadata.hlsl` and `uav_metadata.hlsl`
tests were updated to include unbounded resource arrays as part of
https://github.com/llvm/llvm-project/issues/145422. These updated test
files are included in this PR, as they would cause the new assertion to
fire if the original issue remained unresolved.

Depends on #152250
2025-08-11 10:53:00 -07:00
Helena Kotas
8eadbea8e3
[HLSL] Diagnose overlapping resource bindings (#140982)
Adds reporting of overlapping binding errors to `DXILPostOptimizationValidation` pass. Only runs when `DXILResourceBindingAnalysis` detects that there is a resource binding that overlaps while it is building up a map of available register spaces.

Fixes #110723
2025-05-30 13:22:25 -07:00
Ashley Coleman
793bee4f7b
[HLSL] Raise Diag for Invalid CounterDirection (#137697)
Fixes #135672

Raise a diagnostic in the post optimization validation pass as defined
in
https://github.com/llvm/wg-hlsl/blob/main/proposals/0022-resource-instance-analysis.md
2025-05-09 15:14:26 -06:00