MCPcopy Create free account
hub / github.com/KhronosGroup/OpenCL-CTS / CreateRandomData

Function CreateRandomData

test_common/gles/helpers.cpp:963–1072  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

961}
962
963void* CreateRandomData( ExplicitType type, size_t count, MTdata d )
964{
965 switch(type)
966 {
967 case (kChar):
968 {
969 cl_char *p = (cl_char *)malloc(count * sizeof(cl_char));
970 if(!p) return 0;
971
972 for( size_t i = 0; i < count; i++ )
973 {
974 p[ i ] = (cl_char)genrand_int32(d);
975 }
976 return (void*)p;
977 }
978 case (kUChar):
979 {
980 cl_uchar *p = (cl_uchar *)malloc(count * sizeof(cl_uchar));
981 if(!p) return 0;
982
983 for( size_t i = 0; i < count; i++ )
984 {
985 p[ i ] = (cl_uchar)genrand_int32(d);
986 }
987
988 return (void*)p;
989 }
990 case (kShort):
991 {
992 cl_short *p = (cl_short *)malloc(count * sizeof(cl_short));
993 if(!p) return 0;
994
995 for( size_t i = 0; i < count; i++ )
996 {
997 p[ i ] = (cl_short)genrand_int32(d);
998 }
999
1000 return (void*)p;
1001 }
1002 case (kUShort):
1003 {
1004 cl_ushort *p = (cl_ushort *)malloc(count * sizeof(cl_ushort));
1005 if(!p) return 0;
1006
1007 for( size_t i = 0; i < count; i++ )
1008 {
1009 p[ i ] = (cl_ushort)genrand_int32(d);
1010 }
1011
1012 return (void*)p;
1013 }
1014 case (kInt):
1015 {
1016 cl_int *p = (cl_int *)malloc(count * sizeof(cl_int));
1017 if(!p) return 0;
1018
1019 for( size_t i = 0; i < count; i++ )
1020 {

Callers 2

CreateGLTexture2DFunction · 0.70
CreateGLRenderbufferFunction · 0.70

Calls 2

genrand_int32Function · 0.85
get_random_floatFunction · 0.85

Tested by

no test coverage detected