File indexing completed on 2026-05-10 08:44:12
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef LLVM_MC_DXCONTAINERPSVINFO_H
0010 #define LLVM_MC_DXCONTAINERPSVINFO_H
0011
0012 #include "llvm/ADT/ArrayRef.h"
0013 #include "llvm/ADT/SmallVector.h"
0014 #include "llvm/ADT/StringRef.h"
0015 #include "llvm/BinaryFormat/DXContainer.h"
0016 #include "llvm/MC/StringTableBuilder.h"
0017 #include "llvm/TargetParser/Triple.h"
0018
0019 #include <array>
0020 #include <numeric>
0021 #include <stdint.h>
0022
0023 namespace llvm {
0024
0025 class raw_ostream;
0026
0027 namespace mcdxbc {
0028
0029 struct PSVSignatureElement {
0030 StringRef Name;
0031 SmallVector<uint32_t> Indices;
0032 uint8_t StartRow;
0033 uint8_t Cols;
0034 uint8_t StartCol;
0035 bool Allocated;
0036 dxbc::PSV::SemanticKind Kind;
0037 dxbc::PSV::ComponentType Type;
0038 dxbc::PSV::InterpolationMode Mode;
0039 uint8_t DynamicMask;
0040 uint8_t Stream;
0041 };
0042
0043
0044
0045
0046
0047
0048
0049 struct PSVRuntimeInfo {
0050 PSVRuntimeInfo() : DXConStrTabBuilder(StringTableBuilder::DXContainer) {
0051 memset((void *)&BaseData, 0, sizeof(dxbc::PSV::v3::RuntimeInfo));
0052 }
0053 bool IsFinalized = false;
0054 dxbc::PSV::v3::RuntimeInfo BaseData;
0055 SmallVector<dxbc::PSV::v2::ResourceBindInfo> Resources;
0056 SmallVector<PSVSignatureElement> InputElements;
0057 SmallVector<PSVSignatureElement> OutputElements;
0058 SmallVector<PSVSignatureElement> PatchOrPrimElements;
0059
0060
0061
0062
0063
0064
0065
0066
0067 std::array<SmallVector<uint32_t>, 4> OutputVectorMasks;
0068 SmallVector<uint32_t> PatchOrPrimMasks;
0069 std::array<SmallVector<uint32_t>, 4> InputOutputMap;
0070 SmallVector<uint32_t> InputPatchMap;
0071 SmallVector<uint32_t> PatchOutputMap;
0072 llvm::StringRef EntryName;
0073
0074
0075
0076
0077 void write(raw_ostream &OS,
0078 uint32_t Version = std::numeric_limits<uint32_t>::max()) const;
0079
0080 void finalize(Triple::EnvironmentType Stage);
0081
0082 private:
0083 SmallVector<uint32_t, 64> IndexBuffer;
0084 SmallVector<llvm::dxbc::PSV::v0::SignatureElement, 32> SignatureElements;
0085 StringTableBuilder DXConStrTabBuilder;
0086 };
0087
0088 class Signature {
0089 struct Parameter {
0090 uint32_t Stream;
0091 StringRef Name;
0092 uint32_t Index;
0093 dxbc::D3DSystemValue SystemValue;
0094 dxbc::SigComponentType CompType;
0095 uint32_t Register;
0096 uint8_t Mask;
0097 uint8_t ExclusiveMask;
0098 dxbc::SigMinPrecision MinPrecision;
0099 };
0100
0101 SmallVector<Parameter> Params;
0102
0103 public:
0104 void addParam(uint32_t Stream, StringRef Name, uint32_t Index,
0105 dxbc::D3DSystemValue SystemValue,
0106 dxbc::SigComponentType CompType, uint32_t Register,
0107 uint8_t Mask, uint8_t ExclusiveMask,
0108 dxbc::SigMinPrecision MinPrecision) {
0109 Params.push_back(Parameter{Stream, Name, Index, SystemValue, CompType,
0110 Register, Mask, ExclusiveMask, MinPrecision});
0111 }
0112
0113 void write(raw_ostream &OS);
0114 };
0115
0116 }
0117 }
0118
0119 #endif