Better follow HLSL offsets rules (#3575)

Matrices consuming one vector are treated like vectors for alignment, and
there is no "trailing padding" for matrices and arrays.
This commit is contained in:
Pavel Asyutchenko 2024-04-18 01:34:28 +02:00 committed by GitHub
parent 9001ec9aa5
commit 593dbafd0d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 229 additions and 8 deletions

View file

@ -2217,9 +2217,9 @@ int TIntermediate::getBaseAlignment(const TType& type, int& size, int& stride, T
}
// To aid the basic HLSL rule about crossing vec4 boundaries.
bool TIntermediate::improperStraddle(const TType& type, int size, int offset)
bool TIntermediate::improperStraddle(const TType& type, int size, int offset, bool vectorLike)
{
if (! type.isVector() || type.isArray())
if (! vectorLike || type.isArray())
return false;
return size <= 16 ? offset / 16 != (offset + size - 1) / 16