Disabled GCC loop vectorization for R_LoadKVX() function

This prevents crash (unaligned memory access by SSE instruction) on loading voxels in Release (-O3) builds
https://forum.zdoom.org/viewtopic.php?t=59656
This commit is contained in:
alexey.lysiuk 2018-03-08 12:24:33 +02:00
parent 7f17121df8
commit 53a9819283
1 changed files with 9 additions and 0 deletions

View File

@ -180,6 +180,11 @@ static void RemapVoxelSlabs(kvxslab_t *dest, int size, const uint8_t *remap)
// //
//========================================================================== //==========================================================================
#if defined __GNUC__ && !defined __clang__
#pragma GCC push_options
#pragma GCC optimize ("-fno-tree-loop-vectorize")
#endif // __GNUC__ && !__clang__
FVoxel *R_LoadKVX(int lumpnum) FVoxel *R_LoadKVX(int lumpnum)
{ {
const kvxslab_t *slabs[MAXVOXMIPS]; const kvxslab_t *slabs[MAXVOXMIPS];
@ -320,6 +325,10 @@ FVoxel *R_LoadKVX(int lumpnum)
return voxel; return voxel;
} }
#if defined __GNUC__ && !defined __clang__
#pragma GCC pop_options
#endif // __GNUC__ && !__clang__
//========================================================================== //==========================================================================
// //
// //