Skip to content

Commit

Permalink
Cherry pick: PIX: Check for null (pass-through) HS case (microsoft#4094)
Browse files Browse the repository at this point in the history
* PIX: Use DebugLoc for filenames instead of file list (microsoft#4077)

This fix is for shaders (in particular those for materials from Unreal Engine) that feature #line directives.

In the UE case, for example, there is one source file called hlsl.hlsl, with many #line directives pointing to the original HLSL files from which the source was assembled via UE's material system.

At the start of shader debugging, all the filenames from DebugLoc are returned from code near here to PIX. Those filenames are the ones from the #line directives.

The previous code would iterate over source file names (which in the UE case would be just hlsl.hlsl), and fail to find the filename that PIX is now asking to find the instructions for.

Instead, we now gather the filenames from the DebugLoc. Note that the filename comparison is done after the line number comparison for performance's sake.

* PIX: Check for null HS entry point (pass-through case) (microsoft#4092)

With a null HS, just the patch constant function is present. PIX passes crash on the null, so this change suppresses that null return value.

Co-authored-by: Jeff Noyle <[email protected]>
  • Loading branch information
jeffnn and Jeff Noyle authored Nov 19, 2021
1 parent 1544083 commit bb5e3d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions lib/DXIL/DxilModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ const Function *DxilModule::GetEntryFunction() const {
llvm::SmallVector<llvm::Function *, 64> DxilModule::GetExportedFunctions() const {
llvm::SmallVector<llvm::Function *, 64> ret;
for (auto const& fn : m_DxilEntryPropsMap) {
if (fn.first != nullptr) {
ret.push_back(const_cast<llvm::Function*>(fn.first));
}
}
return ret;
}
Expand Down
8 changes: 4 additions & 4 deletions lib/DxilPIXPasses/PixPassHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,10 @@ std::vector<llvm::BasicBlock*> GetAllBlocks(hlsl::DxilModule& DM) {
std::vector<llvm::BasicBlock*> ret;
auto entryPoints = DM.GetExportedFunctions();
for (auto& fn : entryPoints) {
auto & blocks = fn->getBasicBlockList();
for (auto & block : blocks) {
ret.push_back(&block);
}
auto& blocks = fn->getBasicBlockList();
for (auto& block : blocks) {
ret.push_back(&block);
}
}
return ret;
}
Expand Down

0 comments on commit bb5e3d5

Please sign in to comment.