Skip to content

Commit

Permalink
Merge pull request #86 from siliconvoodoo/auto-option-ranks
Browse files Browse the repository at this point in the history
Fix a crash
  • Loading branch information
siliconvoodoo authored Oct 11, 2023
2 parents ae0bd5c + c934df8 commit d378fd4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/AzslcMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace StdFs = std::filesystem;
// For large features or milestones. Minor version allows for breaking changes. Existing tests can change.
#define AZSLC_MINOR "8" // last change: introduction of class inheritance
// For small features or bug fixes. They cannot introduce breaking changes. Existing tests shouldn't change.
#define AZSLC_REVISION "18" // last change: automatic option ranks
#define AZSLC_REVISION "19" // last change: fix crash in option ranks analysis in case of bodiless functions

namespace AZ::ShaderCompiler
{
Expand Down
9 changes: 6 additions & 3 deletions src/AzslcReflection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1194,9 +1194,12 @@ namespace AZ::ShaderCompiler
{
verboseCout << " " << concrete << " non-memoized. discovering cost\n";
funcInfo->m_costScore = 0;
using AstFDef = azslParser::HlslFunctionDefinitionContext;
AnalyzeImpact(polymorphic_downcast<AstFDef*>(funcInfo->m_defNode->parent)->block(),
funcInfo->m_costScore); // recurse and cache
if (funcInfo->m_defNode) // undefined functions can't be explored
{
using AstFDef = azslParser::HlslFunctionDefinitionContext;
AnalyzeImpact(polymorphic_downcast<AstFDef*>(funcInfo->m_defNode->parent)->block(),
funcInfo->m_costScore); // recurse and cache
}
}
scoreAccumulator += funcInfo->m_costScore;
verboseCout << " " << concrete << " cost score " << funcInfo->m_costScore << " added\n";
Expand Down

0 comments on commit d378fd4

Please sign in to comment.