mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-25 08:19:02 +00:00
Use float<->half conversion routines from the OpenCL headers (#884)
* Use float<->half conversion routines from the OpenCL headers Fixes #870 Signed-off-by: Kevin Petit <kevin.petit@arm.com> * Use cl_half_from_double * Fix windows build errors * Fix more build errors * Code formatting * Remove TEST class
This commit is contained in:
@@ -41,6 +41,8 @@
|
||||
#include "rounding_mode.h"
|
||||
#include "clImageHelper.h"
|
||||
|
||||
#include <CL/cl_half.h>
|
||||
|
||||
extern cl_device_type gDeviceType;
|
||||
extern bool gTestRounding;
|
||||
|
||||
@@ -154,7 +156,6 @@ size_t compute_mip_level_offset( image_descriptor * imageInfo , size_t lod);
|
||||
template <class T> void read_image_pixel( void *imageData, image_descriptor *imageInfo,
|
||||
int x, int y, int z, T *outData, int lod )
|
||||
{
|
||||
float convert_half_to_float( unsigned short halfValue );
|
||||
size_t width_lod = imageInfo->width, height_lod = imageInfo->height, depth_lod = imageInfo->depth, slice_pitch_lod = 0/*imageInfo->slicePitch*/ , row_pitch_lod = 0/*imageInfo->rowPitch*/;
|
||||
width_lod = ( imageInfo->width >> lod) ?( imageInfo->width >> lod):1;
|
||||
|
||||
@@ -278,7 +279,7 @@ template <class T> void read_image_pixel( void *imageData, image_descriptor *ima
|
||||
{
|
||||
cl_ushort *dPtr = (cl_ushort *)ptr;
|
||||
for( i = 0; i < get_format_channel_count( format ); i++ )
|
||||
tempData[ i ] = (T)convert_half_to_float( dPtr[ i ] );
|
||||
tempData[i] = (T)cl_half_to_float(dPtr[i]);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -638,6 +639,7 @@ protected:
|
||||
size_t mVecSize;
|
||||
};
|
||||
|
||||
extern cl_ushort convert_float_to_half(float f);
|
||||
extern int DetectFloatToHalfRoundingMode( cl_command_queue ); // Returns CL_SUCCESS on success
|
||||
|
||||
// sign bit: don't care, exponent: maximum value, significand: non-zero
|
||||
@@ -649,9 +651,6 @@ static int inline is_half_denorm( cl_ushort half ){ return IsHalfSubnormal( half
|
||||
// sign bit: don't care, exponent: zero, significand: zero
|
||||
static int inline is_half_zero( cl_ushort half ){ return ( half & 0x7fff ) == 0; }
|
||||
|
||||
cl_ushort convert_float_to_half( cl_float f );
|
||||
cl_float convert_half_to_float( cl_ushort h );
|
||||
|
||||
extern double sRGBmap(float fc);
|
||||
|
||||
#endif // _imageHelpers_h
|
||||
|
||||
Reference in New Issue
Block a user