Skip to content

Commit

Permalink
We could support anonymous namespace and create abritrary names in th…
Browse files Browse the repository at this point in the history
…e HLSL output.

BUT, the path to RFC 71 (o3de#71) ends up in a state where AZSLc erases itself into a non-transforming reflecter, more than a compiler. Therefore, we give up on feature opportunities to commit to that goal.

Signed-off-by: Vivien Oddou <[email protected]>
  • Loading branch information
siliconvoodoo committed Feb 7, 2023
1 parent 0e7b6e5 commit dae10b4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/AzslcException.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ namespace AZ::ShaderCompiler
ORCHESTRATOR_UNKNOWN_OPTION_TYPE = 49u,
ORCHESTRATOR_CONSTANT_FOLDING_FAULT = 50u,
ORCHESTRATOR_TYPE_LOOKUP_FAULT = 51u,
ORCHESTRATOR_ANONYMOUS_NAMESPACE_FORBIDDEN = 52u,


// Treat all compiler warnings as errors
Expand Down
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 "0"
// For small features or bug fixes. They cannot introduce breaking changes. Existing tests shouldn't change.
#define AZSLC_REVISION "7"
#define AZSLC_REVISION "9"


namespace AZ::ShaderCompiler
Expand Down
5 changes: 5 additions & 0 deletions src/AzslcSemanticOrchestrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1998,6 +1998,11 @@ namespace AZ::ShaderCompiler
void SemanticOrchestrator::MakeAndEnterNamespaceScope(UnqualifiedNameView name, Token* scopeFirstToken, ParserRuleContext* ctx)
{
assert(!IsIn('#', name));
if (name.empty())
{
throw AzslcOrchestratorException{ORCHESTRATOR_ANONYMOUS_NAMESPACE_FORBIDDEN,
ctx->start, "HLSL does not support anonymous namespaces"};
}
UnqualifiedName finalUqName{MangleNamespaceName(name)};
QualifiedName finalName = MakeFullyQualified(finalUqName);
// all reopening of the a namespace at the same scope will be the same namespace, including anonymous.
Expand Down

0 comments on commit dae10b4

Please sign in to comment.