rhi: metal: Fix incorrect native res. binding map check
Checking for nullptr is insufficient: just because there
is an empty map present, it does not mean it is valid. The
two cases must be handled identically.
This fixes a regression when using QShaders that do not
have an associated native resource binding map.
Amends 4639660ded
Change-Id: Icb239bf9a9261ed32f2cb7b22c60b608195618fc
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
bb10
parent
2671fb2777
commit
e4d0187edc
|
|
@ -664,15 +664,15 @@ static inline int mapBinding(int binding,
|
|||
BindingType type)
|
||||
{
|
||||
const QShader::NativeResourceBindingMap *map = nativeResourceBindingMaps[stageIndex];
|
||||
if (!map)
|
||||
if (!map || map->isEmpty())
|
||||
return binding; // old QShader versions do not have this map, assume 1:1 mapping then
|
||||
|
||||
auto it = map->constFind(binding);
|
||||
if (it != map->cend())
|
||||
return type == BindingType::Sampler ? it->second : it->first; // may be -1, if the resource is inactive
|
||||
|
||||
// Hitting this path is normal too, is not given that the resource (e.g. a
|
||||
// uniform block) is really present in the shaders for all the stages
|
||||
// Hitting this path is normal too. It is not given that the resource (for
|
||||
// example, a uniform block) is present in the shaders for all the stages
|
||||
// specified by the visibility mask in the QRhiShaderResourceBinding.
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue