Fix asserts related to writing nameless parameters in HLSL
We rely on TSymbol::name() to generate names also for nameless
parameters. Fix asserts to reflect this.
BUG=chromium:823041
TEST=angle_unittests
Change-Id: Ie9b8253a150e79965bf85d8a7f36643ada6c54cc
Reviewed-on: https://chromium-review.googlesource.com/968242
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/Symbol.cpp b/src/compiler/translator/Symbol.cpp
index 5f1bcd8..cb3331c 100644
--- a/src/compiler/translator/Symbol.cpp
+++ b/src/compiler/translator/Symbol.cpp
@@ -46,11 +46,13 @@
ImmutableString TSymbol::name() const
{
- if (mName != "")
+ if (!mName.empty())
{
return mName;
}
- ASSERT(mSymbolType == SymbolType::AngleInternal);
+ // This can be called for nameless function parameters in HLSL.
+ ASSERT(mSymbolType == SymbolType::AngleInternal ||
+ (mSymbolType == SymbolType::Empty && isVariable()));
int uniqueId = mUniqueId.get();
ImmutableStringBuilder symbolNameOut(sizeof(uniqueId) * 2u + 1u);
symbolNameOut << 's';