Merge pull request #1780 from billhollings/out-of-bounds-swizzle-fix

Per spec, support undefined behavior for out-of-bounds swizzles.
This commit is contained in:
Hans-Kristian Arntzen 2021-10-20 22:24:18 +02:00 committed by GitHub
commit 6d13c99273
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8525,7 +8525,7 @@ const char *CompilerGLSL::index_to_swizzle(uint32_t index)
case 3:
return "w";
default:
SPIRV_CROSS_THROW("Swizzle index out of range");
return "x"; // Don't crash, but engage the "undefined behavior" described for out-of-bounds logical addressing in spec.
}
}