diff --git a/lib/HLSL/DxilContainerReflection.cpp b/lib/HLSL/DxilContainerReflection.cpp index ad71d3452..9d3c64a3f 100644 --- a/lib/HLSL/DxilContainerReflection.cpp +++ b/lib/HLSL/DxilContainerReflection.cpp @@ -2043,37 +2043,51 @@ void DxilShaderReflection::MarkUsedSignatureElements() { DxilInst_StoreOutput SO(&*I); DxilInst_LoadPatchConstant LPC(&*I); DxilInst_StorePatchConstant SPC(&*I); + DxilInst_StoreVertexOutput SVO(&*I); + DxilInst_StorePrimitiveOutput SPO(&*I); std::vector *pDescs; const DxilSignature *pSig; uint32_t col, row, sigId; if (LI) { if (!GetUnsignedVal(LI.get_inputSigId(), &sigId)) continue; if (!GetUnsignedVal(LI.get_colIndex(), &col)) continue; - if (!GetUnsignedVal(LI.get_rowIndex(), &row)) continue; + GetUnsignedVal(LI.get_rowIndex(), &row); pDescs = &m_InputSignature; pSig = &m_pDxilModule->GetInputSignature(); } else if (SO) { if (!GetUnsignedVal(SO.get_outputSigId(), &sigId)) continue; if (!GetUnsignedVal(SO.get_colIndex(), &col)) continue; - if (!GetUnsignedVal(SO.get_rowIndex(), &row)) continue; + GetUnsignedVal(SO.get_rowIndex(), &row); pDescs = &m_OutputSignature; pSig = &m_pDxilModule->GetOutputSignature(); } else if (SPC) { if (!GetUnsignedVal(SPC.get_outputSigID(), &sigId)) continue; if (!GetUnsignedVal(SPC.get_col(), &col)) continue; - if (!GetUnsignedVal(SPC.get_row(), &row)) continue; + GetUnsignedVal(SPC.get_row(), &row); pDescs = &m_PatchConstantSignature; pSig = &m_pDxilModule->GetPatchConstOrPrimSignature(); } else if (LPC) { if (!GetUnsignedVal(LPC.get_inputSigId(), &sigId)) continue; if (!GetUnsignedVal(LPC.get_col(), &col)) continue; - if (!GetUnsignedVal(LPC.get_row(), &row)) continue; + GetUnsignedVal(LPC.get_row(), &row); pDescs = &m_PatchConstantSignature; pSig = &m_pDxilModule->GetPatchConstOrPrimSignature(); } + else if (SVO) { + if (!GetUnsignedVal(SVO.get_outputSigId(), &sigId)) continue; + if (!GetUnsignedVal(SVO.get_colIndex(), &col)) continue; + GetUnsignedVal(SVO.get_rowIndex(), &row); + pSig = &m_pDxilModule->GetOutputSignature(); + } + else if (SPO) { + if (!GetUnsignedVal(SPO.get_outputSigId(), &sigId)) continue; + if (!GetUnsignedVal(SPO.get_colIndex(), &col)) continue; + GetUnsignedVal(SPO.get_rowIndex(), &row); + pSig = &m_pDxilModule->GetPatchConstOrPrimSignature(); + } else { continue; } diff --git a/lib/HLSL/DxilPreparePasses.cpp b/lib/HLSL/DxilPreparePasses.cpp index fe90b3520..376679879 100644 --- a/lib/HLSL/DxilPreparePasses.cpp +++ b/lib/HLSL/DxilPreparePasses.cpp @@ -270,6 +270,8 @@ static void MarkUsedSignatureElements(Function *F, DxilModule &DM) { DxilInst_StoreOutput SO(&*I); DxilInst_LoadPatchConstant LPC(&*I); DxilInst_StorePatchConstant SPC(&*I); + DxilInst_StoreVertexOutput SVO(&*I); + DxilInst_StorePrimitiveOutput SPO(&*I); DxilSignature *pSig; uint32_t col, row, sigId; bool bDynIdx = false; @@ -297,6 +299,18 @@ static void MarkUsedSignatureElements(Function *F, DxilModule &DM) { if (!GetUnsignedVal(LPC.get_row(), &row)) bDynIdx = true; pSig = &DM.GetPatchConstOrPrimSignature(); } + else if (SVO) { + if (!GetUnsignedVal(SVO.get_outputSigId(), &sigId)) continue; + if (!GetUnsignedVal(SVO.get_colIndex(), &col)) continue; + if (!GetUnsignedVal(SVO.get_rowIndex(), &row)) bDynIdx = true; + pSig = &DM.GetOutputSignature(); + } + else if (SPO) { + if (!GetUnsignedVal(SPO.get_outputSigId(), &sigId)) continue; + if (!GetUnsignedVal(SPO.get_colIndex(), &col)) continue; + if (!GetUnsignedVal(SPO.get_rowIndex(), &row)) bDynIdx = true; + pSig = &DM.GetPatchConstOrPrimSignature(); + } else { continue; } diff --git a/tools/clang/unittests/HLSL/ValidationTest.cpp b/tools/clang/unittests/HLSL/ValidationTest.cpp index b4aeda09b..47c4ffb23 100644 --- a/tools/clang/unittests/HLSL/ValidationTest.cpp +++ b/tools/clang/unittests/HLSL/ValidationTest.cpp @@ -3675,10 +3675,10 @@ TEST_F(ValidationTest, MeshGreaterThanMaxXYZ) { TEST_F(ValidationTest, MeshGreaterThanMaxVSigRowCount) { RewriteAssemblyCheckMsg(L"..\\CodeGenHLSL\\mesh-val\\mesh.hlsl", "ms_6_5", - "!([0-9]+) = !{i32 1, !\"COLOR\", i8 9, i8 0, !([0-9]+), i8 2, i32 4, i8 1, i32 1, i8 0, null}\n" - "!([0-9]+) = !{i32 0, i32 1, i32 2, i32 3}", - "!\\1 = !{i32 1, !\"COLOR\", i8 9, i8 0, !\\2, i8 2, i32 32, i8 1, i32 1, i8 0, null}\n" - "!\\3 = !{i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10," + "!([0-9]+) = !{i32 1, !\"COLOR\", i8 9, i8 0, !([0-9]+), i8 2, i32 4, i8 1, i32 1, i8 0, (.*)" + "!\\2 = !{i32 0, i32 1, i32 2, i32 3}", + "!\\1 = !{i32 1, !\"COLOR\", i8 9, i8 0, !\\2, i8 2, i32 32, i8 1, i32 1, i8 0, \\3" + "!\\2 = !{i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10," "i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20," "i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31}", "For shader 'main', vertex output signatures are taking up more than 32 rows", @@ -3687,10 +3687,10 @@ TEST_F(ValidationTest, MeshGreaterThanMaxVSigRowCount) { TEST_F(ValidationTest, MeshGreaterThanMaxPSigRowCount) { RewriteAssemblyCheckMsg(L"..\\CodeGenHLSL\\mesh-val\\mesh.hlsl", "ms_6_5", - "!([0-9]+) = !{i32 4, !\"LAYER\", i8 4, i8 0, !([0-9]+), i8 1, i32 6, i8 1, i32 1, i8 0, null}\n" - "!([0-9]+) = !{i32 0, i32 1, i32 2, i32 3, i32 4, i32 5}", - "!\\1 = !{i32 4, !\"LAYER\", i8 4, i8 0, !\\2, i8 1, i32 32, i8 1, i32 1, i8 0, null}\n" - "!\\3 = !{i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10," + "!([0-9]+) = !{i32 4, !\"LAYER\", i8 4, i8 0, !([0-9]+), i8 1, i32 6, i8 1, i32 1, i8 0, (.*)" + "!\\2 = !{i32 0, i32 1, i32 2, i32 3, i32 4, i32 5}", + "!\\1 = !{i32 4, !\"LAYER\", i8 4, i8 0, !\\2, i8 1, i32 32, i8 1, i32 1, i8 0, \\3" + "!\\2 = !{i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10," "i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20," "i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31}", "For shader 'main', primitive output signatures are taking up more than 32 rows", @@ -3699,15 +3699,15 @@ TEST_F(ValidationTest, MeshGreaterThanMaxPSigRowCount) { TEST_F(ValidationTest, MeshGreaterThanMaxTotalSigRowCount) { RewriteAssemblyCheckMsg(L"..\\CodeGenHLSL\\mesh-val\\mesh.hlsl", "ms_6_5", - { "!([0-9]+) = !{i32 1, !\"COLOR\", i8 9, i8 0, !([0-9]+), i8 2, i32 4, i8 1, i32 1, i8 0, null}\n" - "!([0-9]+) = !{i32 0, i32 1, i32 2, i32 3}", - "!([0-9]+) = !{i32 4, !\"LAYER\", i8 4, i8 0, !([0-9]+), i8 1, i32 6, i8 1, i32 1, i8 0, null}\n" - "!([0-9]+) = !{i32 0, i32 1, i32 2, i32 3, i32 4, i32 5}" }, - { "!\\1 = !{i32 1, !\"COLOR\", i8 9, i8 0, !\\2, i8 2, i32 16, i8 1, i32 1, i8 0, null}\n" - "!\\3 = !{i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10," + { "!([0-9]+) = !{i32 1, !\"COLOR\", i8 9, i8 0, !([0-9]+), i8 2, i32 4, i8 1, i32 1, i8 0, (.*)" + "!\\2 = !{i32 0, i32 1, i32 2, i32 3}", + "!([0-9]+) = !{i32 4, !\"LAYER\", i8 4, i8 0, !([0-9]+), i8 1, i32 6, i8 1, i32 1, i8 0, (.*)" + "!\\2 = !{i32 0, i32 1, i32 2, i32 3, i32 4, i32 5}" }, + { "!\\1 = !{i32 1, !\"COLOR\", i8 9, i8 0, !\\2, i8 2, i32 16, i8 1, i32 1, i8 0, \\3" + "!\\2 = !{i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10," "i32 11, i32 12, i32 13, i32 14, i32 15}", - "!\\1 = !{i32 4, !\"LAYER\", i8 4, i8 0, !\\2, i8 1, i32 16, i8 1, i32 1, i8 0, null}\n" - "!\\3 = !{i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10," + "!\\1 = !{i32 4, !\"LAYER\", i8 4, i8 0, !\\2, i8 1, i32 16, i8 1, i32 1, i8 0, \\3" + "!\\2 = !{i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10," "i32 11, i32 12, i32 13, i32 14, i32 15}", }, "For shader 'main', vertex and primitive output signatures are taking up more than 32 rows",