Skip to content

Commit 2631811

Browse files
gtong-nvcsyonghe
andauthored
Correct modifier isConst initialization (shader-slang#6645)
The previous implementation had two issues in the modifier processing loop: 1. isConst was incorrectly initialized to true, making the const check redundant 2. Premature loop break could skip processing important modifiers. e.g. isExtern Changes: - Initialize isConst to false by default - Remove early break condition to process all modifiers Fixes: shader-slang#6606 Co-authored-by: Yong He <yonghe@outlook.com>
1 parent 9b1e10e commit 2631811

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

source/slang/slang.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -2879,7 +2879,7 @@ static void collectExportedConstantInContainer(
28792879
if (!varMember->val)
28802880
continue;
28812881
bool isExported = false;
2882-
bool isConst = true;
2882+
bool isConst = false;
28832883
bool isExtern = false;
28842884
for (auto modifier : m->modifiers)
28852885
{
@@ -2892,8 +2892,6 @@ static void collectExportedConstantInContainer(
28922892
}
28932893
if (as<ConstModifier>(modifier))
28942894
isConst = true;
2895-
if (isExported && isConst)
2896-
break;
28972895
}
28982896
if (isExported && isConst)
28992897
{

0 commit comments

Comments
 (0)