34 OS <<
" (element " << ElementIndex <<
")";
41 "stacked packing is only valid for a vertex shader input signature");
44 for (
auto &&[Index, Element] :
enumerate(Elements)) {
47 assert(Element.Rows > 0 &&
"signature element must have at least one row");
49 "signature element must have between 1 and 4 columns");
59 "unexpected semantic interpretation for stacked packing, should "
60 "have been diagnosed by Sema");
65 static_cast<unsigned>(Index));
67 Element.StartRow = NextRow;
69 NextRow += Element.Rows;
79 "indexed packing is only valid for a pixel shader output signature");
81 static_assert(MaxSignatureRows <= std::numeric_limits<uint32_t>::digits,
82 "row allocation mask is too small");
83 [[maybe_unused]]
uint32_t AllocatedRows = 0;
85 for (
auto &&[Index, Element] :
enumerate(Elements)) {
88 assert(Element.Rows > 0 &&
"signature element must have at least one row");
90 "signature element must have between 1 and 4 columns");
98 "unexpected semantic interpretation for indexed packing, should "
99 "have been diagnosed by Sema");
100 assert(Element.Rows == 1 && Element.SemanticIndices.size() == 1 &&
101 "target elements must occupy one semantic row");
103 const uint32_t Row = Element.SemanticIndices.front();
107 static_cast<unsigned>(Index));
110 assert(!(AllocatedRows & RowMask) &&
111 "target semantic indices must be unique, verified in SemaHLSL");
112 AllocatedRows |= RowMask;
114 Element.StartRow = Row;
115 Element.StartCol = 0;
116 NumRows = std::max(NumRows, Row + 1);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Tagged union holding either a T or a Error.
Represent a mutable reference to an array (0 or more elements consecutively in memory),...
@ SemanticIndexOutOfRange
void log(raw_ostream &OS) const override
Print an error message to an output stream.
This class implements an extremely fast bulk output stream that can only output to a stream.
static constexpr uint32_t UnallocatedRow
LLVM_ABI Expected< unsigned > packSignatureStacked(MutableArrayRef< SemanticSignatureElement > Elements, Triple::EnvironmentType ShaderStage, IOType IOTy)
Packs eligible signature elements into consecutive rows.
LLVM_ABI SemanticInterpretation getInterpretationKind(dxbc::PSV::SemanticKind SemanticKind, Triple::EnvironmentType ShaderStage, IOType IOTy)
LLVM_ABI Expected< unsigned > packSignatureIndexed(MutableArrayRef< SemanticSignatureElement > Elements, Triple::EnvironmentType ShaderStage, IOType IOTy)
Packs eligible signature elements at rows selected by semantic index.
static constexpr unsigned MaxSignatureRows
static constexpr uint8_t UnallocatedCol
static constexpr unsigned MaxSignatureCols
This is an optimization pass for GlobalISel generic memory operations.
auto enumerate(FirstRange &&First, RestRanges &&...Rest)
Given two or more input ranges, returns a new range whose values are tuples (A, B,...
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.