5.5.10. Querying OpenGL Object Information From an OpenCL Memory Object
5.5.10. 从OpenCL内存对象查询OpenGL对象信息
To query the OpenGL object and object type used to create an OpenCL memory object, call the function
要查询OpenGL对象和用于创建OpenCL内存对象的对象类型,请调用函数
// Provided by cl_khr_gl_sharing
cl_int clGetGLObjectInfo(
cl_mem memobj,
cl_gl_object_type* gl_object_type,
cl_GLuint* gl_object_name);
clGetGLObjectInfo is provided by the clGetGLObjectInfo由cl_khr_gl_sharing扩展提供。 |
-
memobj is the memory object to query.
-
memobj是要查询的内存对象。
-
gl_object_type returns the type of OpenGL object attached to memobj and can be CL_GL_OBJECT_BUFFER, CL_GL_OBJECT_TEXTURE2D, CL_GL_OBJECT_TEXTURE3D, CL_GL_OBJECT_TEXTURE2D_ARRAY, CL_GL_OBJECT_TEXTURE1D, CL_GL_OBJECT_TEXTURE1D_ARRAY, CL_GL_OBJECT_TEXTURE_BUFFER, or CL_GL_OBJECT_RENDERBUFFER. If gl_object_type is
NULL
, it is ignored -
gl_object_type返回附加到memobj的OpenGL对象的类型,并且可以是CL_GL_OBJECT_BUFFER、CL_GL_OBJECT_TEXTURE2D、CL_GL_OBJECT_TEXTURE3D、CL_GL_OBJECT_TEXTURE2D_ARRAY、CL_GL_OBJECT_TEXTURE1D、CL_GL_OBJECT_TEXTURE1D_ARRAY、CL_GL_OBJECT_TEXTURE_BUFFER或CL_GL_OBJECT_RENDERBUFFER。如果gl_object_type为NULL,则忽略它
-
gl_object_name returns the OpenGL object name used to create memobj. If gl_object_name is
NULL
, it is ignored. -
gl_object_name返回用于创建memobj的OpenGL对象名称。如果gl_object_name为NULL,则忽略它。
clGetGLObjectInfo returns CL_SUCCESS if the call was executed successfully. Otherwise, it returns one of the following errors:
如果调用执行成功,clGetGLObjectInfo将返回CL_SUCCESS。否则,它将返回以下错误之一:
-
CL_INVALID_MEM_OBJECT if memobj is not a valid OpenCL memory object.
-
如果memobj不是有效的OpenCL内存对象,则CL_INVALID_MEM_OBJECT。
-
CL_INVALID_GL_OBJECT if there is no OpenGL object associated with memobj.
-
CL_INVALID_GL_OBJECT(如果没有与memobj关联的OpenGL对象)。
-
CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.
-
CL_OUT_OF_RESOURCES,如果在设备上分配OpenCL实现所需的资源失败。
-
CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.
-
CL_OUT_OF_HOST_MEMORY,如果在主机上分配OpenCL实现所需的资源失败。
To query additional information about the OpenGL texture object associated with an OpenCL memory object, call the function
要查询与OpenCL内存对象相关联的OpenGL纹理对象的其他信息,请调用函数
// Provided by cl_khr_gl_sharing
cl_int clGetGLTextureInfo(
cl_mem memobj,
cl_gl_texture_info param_name,
size_t param_value_size,
void* param_value,
size_t* param_value_size_ret);
clGetGLTextureInfo is provided by the clGetGLTextureInfo由cl_khr_gl_sharing扩展提供。 |
-
memobj is the memory object to query.
-
memobj是要查询的内存对象。
-
param_name specifies what additional information about the OpenGL texture object associated with memobj to query. The list of supported param_name types and the information returned in param_value by clGetGLTextureInfo is described in the table below.
-
param_name指定要查询的有关与memobj关联的OpenGL纹理对象的附加信息。支持的param_name类型列表以及clGetGLTextureInfo以param_value返回的信息如下表所示。
-
param_value is a pointer to memory where the result being queried is returned. If param_value is
NULL
, it is ignored. -
param_value是指向返回查询结果的内存的指针。如果param_value为NULL,则忽略它。
-
param_value_size is used to specify the size in bytes of memory pointed to by param_value. This size must be >= size of return type as described in the table below.
-
param_value_size用于指定param_value指向的内存大小(以字节为单位)。此大小必须>=返回类型的大小,如下表所述。
-
param_value_size_ret returns the actual size in bytes of data copied to param_value. If param_value_size_ret is
NULL
, it is ignored. -
param_value_size_ret返回复制到param_value的数据的实际大小(以字节为单位)。如果param_value_size_ret为NULL,则忽略它。
cl_gl_texture_info | Return Type 返回类型 | Info. Returned in param_value 信息。以param_value返回 |
---|---|---|
provided by the |
| The texture_target argument specified in clCreateFromGLTexture. 在clCreateFromGLTexture中指定的texture_target参数。 |
provided by the |
| The miplevel argument specified in clCreateFromGLTexture. 在clCreateFromGLTexture中指定的milevel参数。 |
provided by the |
| The samples argument passed to If image is not a MSAA texture, 1 is returned. 传递给glTexImage2DMultisample或glTexImage3DMultisample的samples参数。 |
clGetGLTextureInfo returns CL_SUCCESS if the function is executed successfully. Otherwise, it returns one of the following errors:
如果函数执行成功,clGetGLTextureInfo将返回CL_SUCCESS。否则,它将返回以下错误之一:
-
CL_INVALID_MEM_OBJECT if memobj is not a valid OpenCL memory object.
-
如果memobj不是有效的OpenCL内存对象,则CL_INVALID_MEM_OBJECT。
-
CL_INVALID_GL_OBJECT if there is no OpenGL texture object associated with memobj.
-
CL_INVALID_GL_OBJECT(如果没有与memobj关联的OpenGL纹理对象)。
-
CL_INVALID_VALUE if param_name is not valid, or if size in bytes specified by param_value_size is less than the size of the return type as described in the table above and param_value is not
NULL
, or if param_value and param_value_size_ret areNULL
. -
CL_INVALID_VALUE,如果param_name无效,或者param_value_size指定的字节大小小于上表中所述的返回类型的大小,并且param_value不为NULL,或者param_value和param_value_size_ret为NULL。
-
CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.
-
CL_OUT_OF_RESOURCES,如果在设备上分配OpenCL实现所需的资源失败。
-
CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.
-
CL_OUT_OF_HOST_MEMORY,如果在主机上分配OpenCL实现所需的资源失败。