From c28d8b6aec721fa3350fc52647f1572a353f6151 Mon Sep 17 00:00:00 2001 From: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> Date: Tue, 23 Jul 2024 11:08:05 -0400 Subject: 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` 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`. --- source/slang/slang-parameter-binding.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source/slang/slang-parameter-binding.cpp') 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 generateParameterBindings( if( varLayout->typeLayout->FindResourceInfo(LayoutResourceKind::Uniform) ) { needDefaultConstantBuffer = true; + if(varLayout->varDecl.getDecl()->hasModifier() || varLayout->varDecl.getDecl()->hasModifier()) + sink->diagnose(varLayout->varDecl, Diagnostics::explicitUniformLocation, as(varLayout->varDecl).getDecl()->getType()); diagnoseGlobalUniform(&sharedContext, as(varLayout->varDecl.getDecl())); } } -- cgit v1.2.3