CLGETIMAGEINFO(3clc)
β¨ NAME β¨
okay so bestie, welcome to clGetImageInfo π β this is the OpenCL Manual (3clc) page for it, and it does exactly one thing: it gets info that's specific to an image object that you made with clCreateImage. that's it. that's the whole job. π
here's the signature, copy it exactly, don't freestyle:
cl_intclGetImageInfo(cl_mem image, cl_image_info param_name,
size_t param_value_size, void *param_value,
size_t *param_value_size_ret);
like, she's giving "small function, big responsibilities" energy and honestly? iconic. π«Ά
πΈ PARAMETERS πΈ
okay so this is the part where we meet the whole cast. three of them. all serving very different purposes. let's go. π
imageβ this is the image object you're interrogating. specify the one you want to ask about. it's the main character of this whole operation. πparam_nameβ this tells her what you wanna know. the list of supportedparam_nametypes, plus what actually comes back inparam_valueforclGetImageInfo, is described in the table below. so yeah, the table is the moment. πparam_valueβ a pointer to memory where the appropriate result you asked for gets returned. and listen: ifparam_valueisNULL, it is ignored. she just... doesn't engage. no cap. π
lowkey important:param_value_sizeandparam_value_size_retare chillin' right there in the signature, but they don't get their own little bullet in this section. the original keeps them un-listed here, so we're keeping it that way. fr fr. π§
more parts coming, don't go anywhere π
param_value_sizeβ this is where you tell the function how many bytes of memoryparam_valueis pointing at. This size must be β₯ the size of the return type as described in the table below. π«Ά
okay so here's the tea on what your cl_image_info can be, what type comes back, and what actually lands in param_value:
CL_IMAGE_FORMATβ return type:cl_image_format. Returns the image format descriptor specified when the image is created withclCreateImage(3clc). β¨CL_IMAGE_ELEMENT_SIZEβ return type:size_t. Returns the size of each element of the image memory object given byimage. An element is made up ofnchannels. The value ofnis given in thecl_image_formatdescriptor. πCL_IMAGE_ROW_PITCHβ return type:size_t. Returns the size in bytes of a row of elements of the image object given byimage. πΈCL_IMAGE_SLICE_PITCHβ return type:size_t. Returns the calculated slice pitch in bytes of a 2D slice for the 3D image object or the size of each image in a 1D or 2D image array given byimage. For a 1D image, 1D image buffer and 2D image object return 0. π¦CL_IMAGE_WIDTHβ return type:size_t. Returns the width of the image in pixels. πCL_IMAGE_HEIGHTβ return type:size_t. Returns the height of the image in pixels. For a 1D image, 1D image buffer and 1D image array object, height = 0. πCL_IMAGE_DEPTHβ return type:size_t. Returns the depth of the image in pixels. For a 1D image, 1D image buffer, 2D image or 1D and 2D image array object, depth = 0. πCL_IMAGE_ARRAY_SIZEβ return type:size_t. Returns the number of images in the image array. Ifimageis not an image array, 0 is returned. πCL_IMAGE_BUFFERβ return type:cl_mem. Returns the buffer object associated withimage. πCL_IMAGE_NUM_MIP_LEVELSβ return type:cl_uint. Returnsnum_mip_levelsassociated withimage. π§CL_IMAGE_NUM_SAMPLESβ return type:cl_uint. Returnsnum_samplesassociated withimage. πCL_IMAGE_D3D10_SUBRESOURCE_KHRβ return type:ID3D10Resource *. (if thecl_khr_d3d10_sharing(3clc)extension is enabled) Ifimagewas created usingclCreateFromD3D10Texture2DKHR(3clc)orclCreateFromD3D10Texture3DKHR(3clc), returns theCL_IMAGE_DX9_MEDIA_PLANE_KHRβ typecl_uint. It hands you back the plane argument value that was set whenmemobjgot created withclCreateFromDX9MediaSurfaceKHR(3clc). π (only a thing if thecl_khr_dx9_media_sharing(3clc)extension is supported, okurrr)CL_IMAGE_DX9_MEDIA_SURFACE_PLANE_KHRβ alsocl_uint, and yes it's the same energy: returns the plane argument value that was specified whenmemobjwas created usingclCreateFromDX9MediaSurfaceKHR(3clc). β¨ (again, only if thecl_khr_dx9_media_sharing(3clc)extension is supported)CL_IMAGE_D3D11_SUBRESOURCE_KHRβ typeID3D11Resource *. If thecl_khr_d3d11_sharing(3clc)extension is supported, and if the image was created usingclCreateFromD3D11Texture2DKHR(3clc)orclCreateFromD3D11Texture3DKHR(3clc), it returns the subresource argument that was specified when the image was created. π¦
param_value_size_ret β this one returns the actual size in bytes of the data you're querying through param_value. And if param_value_size_ret is NULL? Bestie, it's simply ignored. π
π NOTES
To get info that's common to all memory objects β so both buffer objects and image objects, the whole family β use the clGetMemObjectInfo(3clc) function instead. iykyk π
π¨ ERRORS
Returns CL_SUCCESS when everything goes right. Otherwise, it throws one of these at you:
CL_INVALID_VALUEβ ifparam_nameis not valid, or if the size in bytes specified byparam_value_sizeis<the size of the return type as described in the table above andparam_valueis notNULL.CL_INVALID_MEM_OBJECTβ ifimageis a not a valid image object. πCL_OUT_OF_RESOURCESβ if there's a failure to allocate resources required by the OpenCL implementation on the device.CL_OUT_OF_HOST_MEMORYβ if there's a failure to allocate resources required by the OpenCL implementation on the host. πCL_INVALID_DX9_MEDIA_SURFACE_KHRβ ifparam_nameisCL_IMAGE_DX9_MEDIA_PLANE_KHRandimagewas not created by the functionclCreateFromDX9MediaSurfaceKHR(3clc). (If thecl_khr_dx9_media_sharing(3clc)extension is supported)CL_INVALID_D3D10_RESOURCE_KHRβ ifparam_nameisCL_MEM_D3D10_SUBRESOURCE_KHRandimagewas not created by the functionclCreateFromD3D10Texture2DKHR(3clc)orclCreateFromD3D10Texture3DKHR(3clc). (If thecl_khr_d3d10_sharing(3clc)extension is supported)CL_INVALID_D3D11_RESOURCE_KHRβ ifparam_nameisCL_MEM_D3D11_SUBRESOURCE_KHRandimagewas not created by the functionclCreateFromD3D11Texture2DKHR(3clc)orclCreateFromD3D11Texture3DKHR(3clc). (If thecl_khr_d3d11_sharing(3clc)extension is supported)
no cap, if you're getting one of those last three, it's almost always a "wrong function made this image" situation, not a you problem. π
π SPECIFICATION
OpenCL Specification[1]
π SEE ALSO
βοΈ AUTHORS
The Khronos Group
Β©οΈ COPYRIGHT
Copyright Β© 2007-2011 The Khronos Group Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or associated documentation files (the "Materials"), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Materials, and to permit persons to whom the Materials are furnished to do so, subject to the condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials.
ποΈ NOTES
- OpenCL Specification β page 116, section 5.3.6 - Image Object Queries.
and that's the whole page bestie, we ate and left zero crumbs π This lil icon dropped on 01/14/2021, it's the baby of The Khronos Group, and its whole official name is CLGETIMAGEINFO(3clc). go query those images, main character π
β¨
π¦ where this page comes from
- ubuntu jammy: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- ubuntu noble: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms