HLSL: minor: add warning for mat() matrix size truncation

Minor change to add a compilation warning on implicit matrix size
truncations.
This commit is contained in:
LoopDawg
2017-11-29 10:00:01 -07:00
parent 7199a6d1a9
commit 8c49f9b4e6
3 changed files with 16 additions and 1 deletions

View File

@@ -3238,7 +3238,7 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte
// Index into the array to find the item being loaded.
// Byte address buffers index in bytes (only multiples of 4 permitted... not so much a byte address
// buffer then, but that's what it calls itself.
// buffer then, but that's what it calls itself).
int size = 0;
@@ -5243,6 +5243,10 @@ void HlslParseContext::addGenMulArgumentConversion(const TSourceLoc& loc, TFunct
// downstream.
}
// Warn if we altered one of the arguments
if (arg0 != argAggregate->getSequence()[0] || arg1 != argAggregate->getSequence()[1])
warn(loc, "mul() matrix size mismatch", "", "");
// Put arguments back. (They might be unchanged, in which case this is harmless).
argAggregate->getSequence()[0] = arg0;
argAggregate->getSequence()[1] = arg1;