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

Function get_pixel_bytes

test_common/harness/kernelHelpers.cpp:1252–1330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1250}
1251
1252size_t get_pixel_bytes(const cl_image_format *fmt)
1253{
1254 size_t chanCount;
1255 switch (fmt->image_channel_order)
1256 {
1257 case CL_R:
1258 case CL_A:
1259 case CL_Rx:
1260 case CL_INTENSITY:
1261 case CL_LUMINANCE:
1262 case CL_DEPTH: chanCount = 1; break;
1263 case CL_RG:
1264 case CL_RA:
1265 case CL_RGx: chanCount = 2; break;
1266 case CL_RGB:
1267 case CL_RGBx:
1268 case CL_sRGB:
1269 case CL_sRGBx: chanCount = 3; break;
1270 case CL_RGBA:
1271 case CL_ARGB:
1272 case CL_BGRA:
1273 case CL_sBGRA:
1274 case CL_sRGBA:
1275#ifdef CL_1RGB_APPLE
1276 case CL_1RGB_APPLE:
1277#endif
1278#ifdef CL_BGR1_APPLE
1279 case CL_BGR1_APPLE:
1280#endif
1281 chanCount = 4;
1282 break;
1283 default:
1284 log_error("Unknown channel order at %s:%d!\n", __FILE__, __LINE__);
1285 abort();
1286 break;
1287 }
1288
1289 switch (fmt->image_channel_data_type)
1290 {
1291 case CL_UNORM_SHORT_565:
1292 case CL_UNORM_SHORT_555: return 2;
1293
1294 case CL_UNORM_INT_101010:
1295 case CL_UNORM_INT_101010_2:
1296 case CL_UNORM_INT_2_101010_EXT: return 4;
1297
1298 case CL_SNORM_INT8:
1299 case CL_UNORM_INT8:
1300 case CL_SIGNED_INT8:
1301 case CL_UNSIGNED_INT8: return chanCount;
1302
1303 case CL_UNSIGNED_INT10X6_EXT:
1304 case CL_UNSIGNED_INT12X4_EXT:
1305 case CL_UNSIGNED_INT14X2_EXT:
1306 case CL_UNORM_INT10X6_EXT:
1307 case CL_UNORM_INT12X4_EXT:
1308 case CL_UNORM_INT14X2_EXT:
1309 case CL_SNORM_INT16:

Callers 1

CreateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected