Fix maybe-uninitialized warning
The 'set' and 'setRT' variables were warning as maybe-uninitialized even though in practice that case would never trigger (due to how the function flow-controls). The code blocks where these variables are actually read do not overlap, so merge them into the same 'set' variable. Simplify the control flow of the function with early-returns, which drops indentation and simplifies the function.
This commit is contained in:
parent
d5f3ad6c9a
commit
9afd346127
@ -1633,7 +1633,6 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
|
||||
typeCollision = false;
|
||||
|
||||
int set;
|
||||
int setRT;
|
||||
if (qualifier.isPipeInput())
|
||||
set = 0;
|
||||
else if (qualifier.isPipeOutput())
|
||||
@ -1645,11 +1644,11 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
|
||||
else if (qualifier.storage == EvqTileImageEXT)
|
||||
set = 4;
|
||||
else if (qualifier.isAnyPayload())
|
||||
setRT = 0;
|
||||
set = 0;
|
||||
else if (qualifier.isAnyCallable())
|
||||
setRT = 1;
|
||||
set = 1;
|
||||
else if (qualifier.isHitObjectAttrNV())
|
||||
setRT = 2;
|
||||
set = 2;
|
||||
else
|
||||
return -1;
|
||||
|
||||
@ -1691,10 +1690,12 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
|
||||
#ifndef GLSLANG_WEB
|
||||
if (qualifier.isAnyPayload() || qualifier.isAnyCallable() || qualifier.isHitObjectAttrNV()) {
|
||||
TRange range(qualifier.layoutLocation, qualifier.layoutLocation);
|
||||
collision = checkLocationRT(setRT, qualifier.layoutLocation);
|
||||
collision = checkLocationRT(set, qualifier.layoutLocation);
|
||||
if (collision < 0)
|
||||
usedIoRT[setRT].push_back(range);
|
||||
} else if (size == 2 && type.getBasicType() == EbtDouble && type.getVectorSize() == 3 &&
|
||||
usedIoRT[set].push_back(range);
|
||||
return collision;
|
||||
}
|
||||
if (size == 2 && type.getBasicType() == EbtDouble && type.getVectorSize() == 3 &&
|
||||
(qualifier.isPipeInput() || qualifier.isPipeOutput())) {
|
||||
// Dealing with dvec3 in/out split across two locations.
|
||||
// Need two io-ranges.
|
||||
@ -1720,9 +1721,9 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
|
||||
if (collision < 0)
|
||||
usedIo[set].push_back(range2);
|
||||
}
|
||||
} else
|
||||
return collision;
|
||||
}
|
||||
#endif
|
||||
{
|
||||
// Not a dvec3 in/out split across two locations, generic path.
|
||||
// Need a single IO-range block.
|
||||
|
||||
@ -1747,7 +1748,6 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
|
||||
|
||||
if (collision < 0)
|
||||
usedIo[set].push_back(range);
|
||||
}
|
||||
|
||||
return collision;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user