anv/grl: Use union for reinterpreting integer as float
Fixes strict aliasing violations flagged by GCC 12:
../src/intel/vulkan/grl/include/GRLOCLCompatibility.h: In function ‘float as_float(uint32_t)’:
../src/intel/vulkan/grl/include/GRLOCLCompatibility.h:182:13: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
182 | return *reinterpret_cast<float*>(&i);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/intel/vulkan/grl/include/GRLOCLCompatibility.h: In function ‘float3 as_float3(int3)’:
../src/intel/vulkan/grl/include/GRLOCLCompatibility.h:187:13: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
187 | return *reinterpret_cast<float3*>(&i3);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/intel/vulkan/grl/include/GRLOCLCompatibility.h:187:13: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../src/intel/vulkan/grl/include/GRLOCLCompatibility.h: In function ‘float4 as_float4(int4)’:
../src/intel/vulkan/grl/include/GRLOCLCompatibility.h:192:13: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
192 | return *reinterpret_cast<float4*>(&i4);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/intel/vulkan/grl/include/GRLOCLCompatibility.h:192:13: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
Fixes: 5f948503e40c ("anv: Import GRL")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21236>
(cherry picked from commit 53ce756eebef47a37ababc6c3c701752b6451366)
2 files changed