13
13
#define __DXIL_PIPELINE_STATE_VALIDATION__H__
14
14
15
15
#include " dxc/WinAdapter.h"
16
+ #include < assert.h>
16
17
#include < cstring>
17
18
#include < stdint.h>
18
19
20
+ namespace llvm {
21
+ class raw_ostream ;
22
+ }
23
+
19
24
// Don't include assert.h here.
20
25
// Since this header is included from multiple environments,
21
26
// it is necessary to define assert before this header is included.
@@ -229,11 +234,13 @@ struct PSVResourceBindInfo0 {
229
234
uint32_t Space;
230
235
uint32_t LowerBound;
231
236
uint32_t UpperBound;
237
+ void Print (llvm::raw_ostream &O) const ;
232
238
};
233
239
234
240
struct PSVResourceBindInfo1 : public PSVResourceBindInfo0 {
235
241
uint32_t ResKind; // PSVResourceKind
236
242
uint32_t ResFlags; // special characteristics of the resource
243
+ void Print (llvm::raw_ostream &O) const ;
237
244
};
238
245
239
246
// Helpers for output dependencies (ViewID and Input-Output tables)
@@ -266,7 +273,8 @@ struct PSVComponentMask {
266
273
if (ComponentIndex < NumVectors * 4 )
267
274
Mask[ComponentIndex >> 5 ] &= ~(1 << (ComponentIndex & 0x1F ));
268
275
}
269
- bool IsValid () { return Mask != nullptr ; }
276
+ bool IsValid () const { return Mask != nullptr ; }
277
+ void Print (llvm::raw_ostream &, const char *, const char *) const ;
270
278
};
271
279
272
280
struct PSVDependencyTable {
@@ -282,14 +290,23 @@ struct PSVDependencyTable {
282
290
: Table(pTable), InputVectors(inputVectors),
283
291
OutputVectors(outputVectors) {}
284
292
PSVComponentMask GetMaskForInput (uint32_t inputComponentIndex) {
293
+ return getMaskForInput (inputComponentIndex);
294
+ }
295
+ const PSVComponentMask GetMaskForInput (uint32_t inputComponentIndex) const {
296
+ return getMaskForInput (inputComponentIndex);
297
+ }
298
+ bool IsValid () const { return Table != nullptr ; }
299
+ void Print (llvm::raw_ostream &, const char *, const char *) const ;
300
+
301
+ private:
302
+ PSVComponentMask getMaskForInput (uint32_t inputComponentIndex) const {
285
303
if (!Table || !InputVectors || !OutputVectors)
286
304
return PSVComponentMask ();
287
305
return PSVComponentMask (
288
306
Table + (PSVComputeMaskDwordsFromVectors (OutputVectors) *
289
307
inputComponentIndex),
290
308
OutputVectors);
291
309
}
292
- bool IsValid () { return Table != nullptr ; }
293
310
};
294
311
295
312
struct PSVString {
@@ -431,6 +448,7 @@ class PSVSignatureElement {
431
448
uint32_t GetDynamicIndexMask () const {
432
449
return !m_pElement0 ? 0 : (uint32_t )m_pElement0->DynamicMaskAndStream & 0xF ;
433
450
}
451
+ void Print (llvm::raw_ostream &O) const ;
434
452
};
435
453
436
454
#define MAX_PSV_VERSION 3
@@ -732,6 +750,9 @@ class DxilPipelineStateValidation {
732
750
? m_StringTable.Get (m_pPSVRuntimeInfo3->EntryFunctionName )
733
751
: " " ;
734
752
}
753
+ void PrintPSVRuntimeInfo (llvm::raw_ostream &O, uint8_t ShaderKind,
754
+ const char *Comment) const ;
755
+ void Print (llvm::raw_ostream &O, uint8_t ShaderKind) const ;
735
756
};
736
757
737
758
// Return true if size fits in remaing buffer.
@@ -1036,6 +1057,10 @@ DxilPipelineStateValidation::ReadOrWrite(const void *pBits, uint32_t *pSize,
1036
1057
1037
1058
namespace hlsl {
1038
1059
1060
+ class DxilResourceBase ;
1061
+ class DxilSignatureElement ;
1062
+ class DxilModule ;
1063
+
1039
1064
class ViewIDValidator {
1040
1065
public:
1041
1066
enum class Result {
@@ -1059,6 +1084,21 @@ class ViewIDValidator {
1059
1084
ViewIDValidator *NewViewIDValidator (unsigned viewIDCount,
1060
1085
unsigned gsRastStreamIndex);
1061
1086
1087
+ void InitPSVResourceBinding (PSVResourceBindInfo0 *, PSVResourceBindInfo1 *,
1088
+ DxilResourceBase *);
1089
+
1090
+ // Setup PSVSignatureElement0 with DxilSignatureElement.
1091
+ // Note that the SemanticName and SemanticIndexes are not done.
1092
+ void InitPSVSignatureElement (PSVSignatureElement0 &E,
1093
+ const DxilSignatureElement &SE,
1094
+ bool i1ToUnknownCompat);
1095
+
1096
+ // Setup PSVRuntimeInfo* with DxilModule.
1097
+ // Note that the EntryFunctionName is not done.
1098
+ void InitPSVRuntimeInfo (PSVRuntimeInfo0 *pInfo, PSVRuntimeInfo1 *pInfo1,
1099
+ PSVRuntimeInfo2 *pInfo2, PSVRuntimeInfo3 *pInfo3,
1100
+ const DxilModule &DM);
1101
+
1062
1102
} // namespace hlsl
1063
1103
1064
1104
#undef PSV_RETB
0 commit comments