[llvm-branch-commits] [llvm] [HLSLSemanticSignatures] Implement the optimal packing of elements (PR #218064)
Deric C. via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Aug 25 16:50:09 PDT 2026
================
@@ -105,6 +105,42 @@ static uint8_t getStartColumn(uint8_t ColumnMask) {
return countr_zero(ColumnMask);
}
+// Returns a lower value for groups that must be packed earlier.
+static unsigned
+getOptimizedPackingPriority(const SemanticSignatureElement &Element,
+ Triple::EnvironmentType ShaderStage, IOType IOTy) {
+ const SemanticInterpretation Interpretation =
+ getInterpretationKind(Element.SemanticKind, ShaderStage, IOTy);
+ assert((Interpretation != SemanticInterpretation::Invalid &&
+ Interpretation != SemanticInterpretation::Target) &&
+ "unexpected semantic interpretation for optimized packing");
+
+ if (Element.Cols == MaxSignatureCols &&
+ (Interpretation == SemanticInterpretation::Arbitrary ||
+ Interpretation == SemanticInterpretation::SV))
+ return 0;
----------------
Icohedron wrote:
[SUGGESTION] Create an enum to name each of these constants?
```cpp
// Groups are packed in increasing order.
enum PackingGroup : unsigned {
FourColumn,
IndexedTessFactor,
Arbitrary,
SystemValue,
ClipCull,
SystemGenerated,
NotAllocated,
};
```
https://github.com/llvm/llvm-project/pull/218064
More information about the llvm-branch-commits
mailing list