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

Function CreateRandomData

test_common/gl/helpers.cpp:2165–2275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2163}
2164
2165void* CreateRandomData( ExplicitType type, size_t count, MTdata d )
2166{
2167 switch(type)
2168 {
2169 case (kChar):
2170 {
2171 cl_char *p = (cl_char *)malloc(count * sizeof(cl_char));
2172 if(!p) return 0;
2173
2174 for( size_t i = 0; i < count; i++ )
2175 {
2176 p[ i ] = (cl_char)genrand_int32(d);
2177 }
2178 return (void*)p;
2179 }
2180 case (kUChar):
2181 case (kUnsignedChar):
2182 {
2183 cl_uchar *p = (cl_uchar *)malloc(count * sizeof(cl_uchar));
2184 if(!p) return 0;
2185
2186 for( size_t i = 0; i < count; i++ )
2187 {
2188 p[ i ] = (cl_uchar)genrand_int32(d);
2189 }
2190
2191 return (void*)p;
2192 }
2193 case (kShort):
2194 {
2195 cl_short *p = (cl_short *)malloc(count * sizeof(cl_short));
2196 if(!p) return 0;
2197
2198 for( size_t i = 0; i < count; i++ )
2199 {
2200 p[ i ] = (cl_short)genrand_int32(d);
2201 }
2202
2203 return (void*)p;
2204 }
2205 case (kUShort):
2206 case (kUnsignedShort):
2207 {
2208 cl_ushort *p = (cl_ushort *)malloc(count * sizeof(cl_ushort));
2209 if(!p) return 0;
2210
2211 for( size_t i = 0; i < count; i++ )
2212 {
2213 p[ i ] = (cl_ushort)genrand_int32(d);
2214 }
2215
2216 return (void*)p;
2217 }
2218 case (kInt):
2219 {
2220 cl_int *p = (cl_int *)malloc(count * sizeof(cl_int));
2221 if(!p) return 0;
2222

Callers 8

CreateGLTexture1DArrayFunction · 0.70
CreateGLTexture2DArrayFunction · 0.70
CreateGLTextureBufferFunction · 0.70
CreateGLTexture1DFunction · 0.70
CreateGLTexture2DFunction · 0.70
CreateGLRenderbufferFunction · 0.70
test_cl_image_writeFunction · 0.50
test_cl_image_writeFunction · 0.50

Calls 3

genrand_int32Function · 0.85
get_random_floatFunction · 0.85
convert_float_to_halfFunction · 0.85

Tested by 2

test_cl_image_writeFunction · 0.40
test_cl_image_writeFunction · 0.40