OpenCL™规范 5.5.10. 从OpenCL内存对象查询OpenGL对象信息

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 cl_khr_gl_sharing extension.

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_BUFFERCL_GL_OBJECT_TEXTURE2DCL_GL_OBJECT_TEXTURE3DCL_GL_OBJECT_TEXTURE2D_ARRAYCL_GL_OBJECT_TEXTURE1DCL_GL_OBJECT_TEXTURE1D_ARRAYCL_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 cl_khr_gl_sharing extension.

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,则忽略它。

Table 39. OpenGL texture info that may be queried with clGetGLTextureInfo

表39 可以使用clGetGLTextureInfo查询的OpenGL纹理信息

cl_gl_texture_info

Return Type

返回类型

Info. Returned in param_value

信息。以param_value返回

CL_GL_TEXTURE_TARGET

provided by the cl_khr_gl_sharing extension.

GLenum

The texture_target argument specified in clCreateFromGLTexture.

在clCreateFromGLTexture中指定的texture_target参数。

CL_GL_MIPMAP_LEVEL

provided by the cl_khr_gl_sharing extension.

GLint

The miplevel argument specified in clCreateFromGLTexture.

在clCreateFromGLTexture中指定的milevel参数。

CL_GL_NUM_SAMPLES

provided by the cl_khr_gl_msaa_sharing extension.

GLsizei

The samples argument passed to glTexImage2DMultisample or glTexImage3DMultisample.

If image is not a MSAA texture, 1 is returned.

传递给glTexImage2DMultisample或glTexImage3DMultisample的samples参数。
若图像不是MSAA纹理,则返回1。

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 are NULL.

  • CL_INVALID_VALUE,如果param_name无效,或者param_value_size指定的字节大小小于上表中所述的返回类型的大小,并且param_value不为NULL,或者param_valueparam_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实现所需的资源失败。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值