Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions glslang/HLSL/hlslParseHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10284,4 +10284,14 @@ void HlslParseContext::finish()
TParseContextBase::finish();
}


const char* HlslParseContext::getGlobalUniformBlockName() const
{
const char* name = intermediate.getGlobalUniformBlockName();
if (std::string(name) == "")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is allocating a string just to compare against an empty literal. Please compare name[0] == '\0'.

return "$Global";
else
return name;
}

} // end namespace glslang
2 changes: 1 addition & 1 deletion glslang/HLSL/hlslParseHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class HlslParseContext : public TParseContextBase {

void setLimits(const TBuiltInResource&) override;
bool parseShaderStrings(TPpContext&, TInputScanner& input, bool versionWillBeError = false) override;
virtual const char* getGlobalUniformBlockName() const override { return "$Global"; }
virtual const char* getGlobalUniformBlockName() const override;
virtual void setUniformBlockDefaults(TType& block) const override
{
block.getQualifier().layoutPacking = globalUniformDefaults.layoutPacking;
Expand Down