HLSL: Protect against some crashes
This commit is contained in:
parent
4e06d7a2bb
commit
0bb89f5809
@ -3256,7 +3256,8 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte
|
|||||||
if (argAggregate) {
|
if (argAggregate) {
|
||||||
if (argAggregate->getSequence().empty())
|
if (argAggregate->getSequence().empty())
|
||||||
return;
|
return;
|
||||||
bufferObj = argAggregate->getSequence()[0]->getAsTyped();
|
if (argAggregate->getSequence()[0])
|
||||||
|
bufferObj = argAggregate->getSequence()[0]->getAsTyped();
|
||||||
} else {
|
} else {
|
||||||
bufferObj = arguments->getAsSymbolNode();
|
bufferObj = arguments->getAsSymbolNode();
|
||||||
}
|
}
|
||||||
@ -3755,7 +3756,8 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
|
|||||||
if (arguments->getAsTyped()->getBasicType() != EbtSampler)
|
if (arguments->getAsTyped()->getBasicType() != EbtSampler)
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
if (argAggregate->getSequence().size() == 0 ||
|
if (argAggregate->getSequence().size() == 0 ||
|
||||||
|
argAggregate->getSequence()[0] == nullptr ||
|
||||||
argAggregate->getSequence()[0]->getAsTyped()->getBasicType() != EbtSampler)
|
argAggregate->getSequence()[0]->getAsTyped()->getBasicType() != EbtSampler)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -5294,7 +5296,7 @@ TIntermTyped* HlslParseContext::handleFunctionCall(const TSourceLoc& loc, TFunct
|
|||||||
|
|
||||||
TIntermTyped* arg0 = nullptr;
|
TIntermTyped* arg0 = nullptr;
|
||||||
|
|
||||||
if (aggregate && aggregate->getSequence().size() > 0)
|
if (aggregate && aggregate->getSequence().size() > 0 && aggregate->getSequence()[0])
|
||||||
arg0 = aggregate->getSequence()[0]->getAsTyped();
|
arg0 = aggregate->getSequence()[0]->getAsTyped();
|
||||||
else if (arguments->getAsSymbolNode())
|
else if (arguments->getAsSymbolNode())
|
||||||
arg0 = arguments->getAsSymbolNode();
|
arg0 = arguments->getAsSymbolNode();
|
||||||
@ -5768,7 +5770,7 @@ void HlslParseContext::addStructBuffArguments(const TSourceLoc& loc, TIntermAggr
|
|||||||
std::any_of(aggregate->getSequence().begin(),
|
std::any_of(aggregate->getSequence().begin(),
|
||||||
aggregate->getSequence().end(),
|
aggregate->getSequence().end(),
|
||||||
[this](const TIntermNode* node) {
|
[this](const TIntermNode* node) {
|
||||||
return (node->getAsTyped() != nullptr) && hasStructBuffCounter(node->getAsTyped()->getType());
|
return (node && node->getAsTyped() != nullptr) && hasStructBuffCounter(node->getAsTyped()->getType());
|
||||||
});
|
});
|
||||||
|
|
||||||
// Nothing to do, if we didn't find one.
|
// Nothing to do, if we didn't find one.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user