@@ -1284,30 +1284,32 @@ class DxcAssemblyAnnotationWriter : public llvm::AssemblyAnnotationWriter {
12841284 }
12851285};
12861286
1287- void PrintPipelineStateValidationRuntimeInfo (const char *pBuffer,
1287+ void PrintPipelineStateValidationRuntimeInfo (const char *pBuffer, const uint32_t uBufferSize,
12881288 DXIL::ShaderKind shaderKind,
12891289 raw_string_ostream &OS,
12901290 StringRef comment) {
12911291 OS << comment << " \n "
12921292 << comment << " Pipeline Runtime Information: \n "
12931293 << comment << " \n " ;
12941294
1295- const unsigned offset = sizeof (unsigned );
1296- const PSVRuntimeInfo0 *pInfo = (const PSVRuntimeInfo0 *)(pBuffer + offset);
1297- const PSVRuntimeInfo2 *pInfo2 = (const PSVRuntimeInfo2 *)(pBuffer + offset);
1295+ DxilPipelineStateValidation PSV;
1296+ PSV.InitFromPSV0 (pBuffer, uBufferSize);
1297+ const PSVRuntimeInfo0 *pInfo0 = PSV.GetPSVRuntimeInfo0 ();
1298+ const PSVRuntimeInfo1 *pInfo1 = PSV.GetPSVRuntimeInfo1 ();
1299+ const PSVRuntimeInfo2 *pInfo2 = PSV.GetPSVRuntimeInfo2 ();
12981300
12991301 switch (shaderKind) {
13001302 case DXIL::ShaderKind::Hull: {
13011303 OS << comment << " Hull Shader\n " ;
13021304 OS << comment
1303- << " InputControlPointCount=" << pInfo ->HS .InputControlPointCount
1305+ << " InputControlPointCount=" << pInfo0 ->HS .InputControlPointCount
13041306 << " \n " ;
13051307 OS << comment
1306- << " OutputControlPointCount=" << pInfo ->HS .OutputControlPointCount
1308+ << " OutputControlPointCount=" << pInfo0 ->HS .OutputControlPointCount
13071309 << " \n " ;
13081310 OS << comment << " Domain=" ;
13091311 DXIL::TessellatorDomain domain =
1310- static_cast <DXIL::TessellatorDomain>(pInfo ->HS .TessellatorDomain );
1312+ static_cast <DXIL::TessellatorDomain>(pInfo0 ->HS .TessellatorDomain );
13111313 switch (domain) {
13121314 case DXIL::TessellatorDomain::IsoLine:
13131315 OS << " isoline\n " ;
@@ -1325,7 +1327,7 @@ void PrintPipelineStateValidationRuntimeInfo(const char *pBuffer,
13251327 OS << comment << " OutputPrimitive=" ;
13261328 DXIL::TessellatorOutputPrimitive primitive =
13271329 static_cast <DXIL::TessellatorOutputPrimitive>(
1328- pInfo ->HS .TessellatorOutputPrimitive );
1330+ pInfo0 ->HS .TessellatorOutputPrimitive );
13291331 switch (primitive) {
13301332 case DXIL::TessellatorOutputPrimitive::Point:
13311333 OS << " point\n " ;
@@ -1347,17 +1349,17 @@ void PrintPipelineStateValidationRuntimeInfo(const char *pBuffer,
13471349 case DXIL::ShaderKind::Domain:
13481350 OS << comment << " Domain Shader\n " ;
13491351 OS << comment
1350- << " InputControlPointCount=" << pInfo ->DS .InputControlPointCount
1352+ << " InputControlPointCount=" << pInfo0 ->DS .InputControlPointCount
13511353 << " \n " ;
13521354 OS << comment
1353- << " OutputPositionPresent=" << (bool )pInfo ->DS .OutputPositionPresent
1355+ << " OutputPositionPresent=" << (bool )pInfo0 ->DS .OutputPositionPresent
13541356 << " \n " ;
13551357 break ;
13561358 case DXIL::ShaderKind::Geometry: {
13571359 OS << comment << " Geometry Shader\n " ;
13581360 OS << comment << " InputPrimitive=" ;
13591361 DXIL::InputPrimitive primitive =
1360- static_cast <DXIL::InputPrimitive>(pInfo ->GS .InputPrimitive );
1362+ static_cast <DXIL::InputPrimitive>(pInfo0 ->GS .InputPrimitive );
13611363 switch (primitive) {
13621364 case DXIL::InputPrimitive::Point:
13631365 OS << " point\n " ;
@@ -1476,7 +1478,7 @@ void PrintPipelineStateValidationRuntimeInfo(const char *pBuffer,
14761478 }
14771479 OS << comment << " OutputTopology=" ;
14781480 DXIL::PrimitiveTopology topology =
1479- static_cast <DXIL::PrimitiveTopology>(pInfo ->GS .OutputTopology );
1481+ static_cast <DXIL::PrimitiveTopology>(pInfo0 ->GS .OutputTopology );
14801482 switch (topology) {
14811483 case DXIL::PrimitiveTopology::PointList:
14821484 OS << " point\n " ;
@@ -1491,43 +1493,67 @@ void PrintPipelineStateValidationRuntimeInfo(const char *pBuffer,
14911493 OS << " invalid\n " ;
14921494 break ;
14931495 }
1494- OS << comment << " OutputStreamMask=" << pInfo ->GS .OutputStreamMask << " \n " ;
1496+ OS << comment << " OutputStreamMask=" << pInfo0 ->GS .OutputStreamMask << " \n " ;
14951497 OS << comment
1496- << " OutputPositionPresent=" << (bool )pInfo ->GS .OutputPositionPresent
1498+ << " OutputPositionPresent=" << (bool )pInfo0 ->GS .OutputPositionPresent
14971499 << " \n " ;
14981500 } break ;
14991501 case DXIL::ShaderKind::Vertex:
15001502 OS << comment << " Vertex Shader\n " ;
15011503 OS << comment
1502- << " OutputPositionPresent=" << (bool )pInfo ->VS .OutputPositionPresent
1504+ << " OutputPositionPresent=" << (bool )pInfo0 ->VS .OutputPositionPresent
15031505 << " \n " ;
15041506 break ;
15051507 case DXIL::ShaderKind::Pixel:
15061508 OS << comment << " Pixel Shader\n " ;
1507- OS << comment << " DepthOutput=" << (bool )pInfo ->PS .DepthOutput << " \n " ;
1508- OS << comment << " SampleFrequency=" << (bool )pInfo ->PS .SampleFrequency
1509+ OS << comment << " DepthOutput=" << (bool )pInfo0 ->PS .DepthOutput << " \n " ;
1510+ OS << comment << " SampleFrequency=" << (bool )pInfo0 ->PS .SampleFrequency
15091511 << " \n " ;
15101512 break ;
15111513 case DXIL::ShaderKind::Compute:
15121514 OS << comment << " Compute Shader\n " ;
1513- OS << comment << " Numthreads: (" << pInfo2->NumThreadsX << " ," << pInfo2->NumThreadsY << " ," << pInfo2->NumThreadsZ << " )\n " ;
1515+ if (pInfo2) {
1516+ OS << comment << " NumThreads=(" << pInfo2->NumThreadsX << " ," << pInfo2->NumThreadsY << " ," << pInfo2->NumThreadsZ << " )\n " ;
1517+ }
15141518 break ;
15151519 case DXIL::ShaderKind::Amplification:
15161520 OS << comment << " Amplification Shader\n " ;
1517- OS << comment << " Numthreads: (" << pInfo2->NumThreadsX << " ," << pInfo2->NumThreadsY << " ," << pInfo2->NumThreadsZ << " )\n " ;
1521+ if (pInfo2) {
1522+ OS << comment << " NumThreads=(" << pInfo2->NumThreadsX << " ," << pInfo2->NumThreadsY << " ," << pInfo2->NumThreadsZ << " )\n " ;
1523+ }
15181524 break ;
15191525 case DXIL::ShaderKind::Mesh:
15201526 OS << comment << " Mesh Shader\n " ;
1521- OS << comment << " Numthreads: (" << pInfo2->NumThreadsX << " ," << pInfo2->NumThreadsY << " ," << pInfo2->NumThreadsZ << " )\n " ;
1527+ if (pInfo1) {
1528+ OS << comment << " MeshOutputTopology=" ;
1529+ DXIL::MeshOutputTopology topology = static_cast <DXIL::MeshOutputTopology>(pInfo1->MS1 .MeshOutputTopology );
1530+ switch (topology) {
1531+ case DXIL::MeshOutputTopology::Undefined:
1532+ OS << " undefined\n " ;
1533+ break ;
1534+ case DXIL::MeshOutputTopology::Line:
1535+ OS << " line\n " ;
1536+ break ;
1537+ case DXIL::MeshOutputTopology::Triangle:
1538+ OS << " triangle\n " ;
1539+ break ;
1540+ default :
1541+ OS << " invalid\n " ;
1542+ break ;
1543+ }
1544+ }
1545+ if (pInfo2) {
1546+ OS << comment << " NumThreads=(" << pInfo2->NumThreadsX << " ," << pInfo2->NumThreadsY << " ," << pInfo2->NumThreadsZ << " )\n " ;
1547+ }
15221548 break ;
15231549 case DXIL::ShaderKind::Library:
15241550 case DXIL::ShaderKind::Invalid:
15251551 // Nothing to print for these shader kinds.
15261552 break ;
15271553 }
15281554
1529- if (pInfo ->MinimumExpectedWaveLaneCount == pInfo ->MaximumExpectedWaveLaneCount ) {
1530- OS << comment << " WaveSize=" << pInfo ->MinimumExpectedWaveLaneCount << " \n " ;
1555+ if (pInfo0 ->MinimumExpectedWaveLaneCount == pInfo0 ->MaximumExpectedWaveLaneCount ) {
1556+ OS << comment << " WaveSize=" << pInfo0 ->MinimumExpectedWaveLaneCount << " \n " ;
15311557 }
15321558
15331559 OS << comment << " \n " ;
@@ -1639,7 +1665,7 @@ HRESULT Disassemble(IDxcBlob *pProgram, raw_string_ostream &Stream) {
16391665 DxilPartIsType (DFCC_PipelineStateValidation));
16401666 if (it != end (pContainer)) {
16411667 PrintPipelineStateValidationRuntimeInfo (
1642- GetDxilPartData (*it),
1668+ GetDxilPartData (*it), (*it)-> PartSize ,
16431669 GetVersionShaderType (pProgramHeader->ProgramVersion ), Stream,
16441670 /* comment*/ " ;" );
16451671 }
0 commit comments