summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-parameter-binding.cpp
diff options
context:
space:
mode:
authorArielG-NV <159081215+ArielG-NV@users.noreply.github.com>2024-07-23 11:08:05 -0400
committerGitHub <noreply@github.com>2024-07-23 11:08:05 -0400
commitc28d8b6aec721fa3350fc52647f1572a353f6151 (patch)
treee4570b2b4c4bb3efaf7259fb543c056963f5bfe6 /source/slang/slang-parameter-binding.cpp
parent509bfd8bbaaf021507c4045b5fd9eaf43276dc0a (diff)
Warn if providing explicit bindings to a object using uniform locations (#4708)
fixes: #4700 Changes: * If a uniform object (which uses uniform locations) has explicit bindings we will warn to use `ConstantBuffer<T>` instead. We check for a warning specifically when we know an object uses uniform layouts because objects may not use a uniform-layout register even if tagged with `uniform`. A good example of this is `uniform ConstantBuffer<T>`.
Diffstat (limited to 'source/slang/slang-parameter-binding.cpp')
-rw-r--r--source/slang/slang-parameter-binding.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/source/slang/slang-parameter-binding.cpp b/source/slang/slang-parameter-binding.cpp
index fd7fae430..6f8504a31 100644
--- a/source/slang/slang-parameter-binding.cpp
+++ b/source/slang/slang-parameter-binding.cpp
@@ -4097,6 +4097,8 @@ RefPtr<ProgramLayout> generateParameterBindings(
if( varLayout->typeLayout->FindResourceInfo(LayoutResourceKind::Uniform) )
{
needDefaultConstantBuffer = true;
+ if(varLayout->varDecl.getDecl()->hasModifier<GLSLBindingAttribute>() || varLayout->varDecl.getDecl()->hasModifier<GLSLLocationLayoutModifier>())
+ sink->diagnose(varLayout->varDecl, Diagnostics::explicitUniformLocation, as<VarDecl>(varLayout->varDecl).getDecl()->getType());
diagnoseGlobalUniform(&sharedContext, as<VarDeclBase>(varLayout->varDecl.getDecl()));
}
}