OpenCL™规范 5.3.11. 从Direct3D10纹理和资源创建OpenCL图像对象

5.3.11. Creating OpenCL Image Objects From Direct3D 10 Textures and Resources
5.3.11. 从Direct3D10纹理和资源创建OpenCL图像对象

To create an OpenCL 2D image object from a subresource of a Direct3D 10 2D texture, call the function

要从Direct3D 10 2D纹理的子源创建OpenCL 2D图像对象,请调用函数

// Provided by cl_khr_d3d10_sharing
cl_mem clCreateFromD3D10Texture2DKHR(
    cl_context context,
    cl_mem_flags flags,
    ID3D10Texture2D* resource,
    UINT subresource,
    cl_int* errcode_ret);

clCreateFromD3D10Texture2DKHR is provided by the cl_khr_d3d10_sharing extension.

clCreateFromD3D10Texture2DKHR由cl_khr_d3d10_shareing扩展提供。

  • context is a valid OpenCL context created from a Direct3D 10 device.

  • context是从Direct3D10设备创建的有效OpenCL上下文。

  • flags is a bit-field that is used to specify usage information. Refer to the List of supported memory flag values table for a description of flags. Only the CL_MEM_READ_ONLYCL_MEM_WRITE_ONLY and CL_MEM_READ_WRITE flags specified in that table can be used.

  • ​flags是一个用于指定使用信息的位字段。有关标志的描述,请参阅支持的内存标志值列表表。只能使用该表中指定的CL_MEM_READ_ONLY、CL_MEM_WRITE_ONLY和CL_MEM_READ_WRITE标志。

  • resource is a pointer to the Direct3D 10 2D texture to share.

  • resource是指向要共享的Direct3D 10 2D纹理的指针。

  • subresource is the subresource of resource to share.

  • subresource是要共享的resource的子资源。

  • errcode_ret will return an appropriate error code. If errcode_ret is NULL, no error code is returned.

  • errcode_ret将返回相应的错误代码。如果errcode_ret为NULL,则不会返回任何错误代码。

The width and height of the returned OpenCL 2D image object are determined by the width and height of subresource subresource of resource. The channel type and order of the returned OpenCL 2D image object is determined by the format of resource and the DXGI Formats and Corresponding OpenCL Image Formats table.

​返回的OpenCL 2D图像对象的宽度和高度由资源的子资源子资源的宽度和宽度决定。返回的OpenCL 2D图像对象的通道类型和顺序由资源的格式和DXGI格式和相应的OpenCL图像格式表确定。

This call will increment the internal Direct3D 10 reference count on resource. The internal Direct3D 10 reference count on resource will be decremented when the OpenCL reference count on the returned OpenCL memory object drops to zero.

此调用将增加resource上的内部Direct3D 10引用计数。当返回的OpenCL内存对象上的OpenCL引用计数降至零时,resource上的内部Direct3D 10引用计数将递减。

Refer to the Lifetime of Shared Direct3D Memory Objects and Acquiring, Releasing, and Synchronizing Access to Shared OpenCL/OpenGL Memory Objects sections for more information.


有关更多信息,请参阅共享Direct3D内存对象的寿命以及获取、释放和同步对共享OpenCL/OPENGL内存对象的访问部分。

clCreateFromD3D10Texture2DKHR returns a valid non-zero OpenCL image object and errcode_ret is set to CL_SUCCESS if the image object is created successfully. Otherwise, it returns a NULL value with one of the following error values returned in errcode_ret:

​clCreateFromD3D10Texture2DKHR返回有效的非零OpenCL图像对象,如果图像对象创建成功,则errcode_ret设置为CL_SUCCESS。否则,它将返回一个NULL值,并在errcode_ret中返回以下错误值之一:

  • CL_INVALID_CONTEXT if context is not a valid context.

  • CL_INVALID_CONTEXT(如果context不是有效上下文)。

  • CL_INVALID_VALUE if values specified in flags are not valid or if subresource is not a valid subresource index for resource.

  • 如果标志中指定的值无效,或者subresource不是资源的有效子资源索引,则CL_INVALID_VALUE。

  • CL_INVALID_D3D10_RESOURCE_KHR if resource is not a Direct3D 10 texture resource, if resource was created with the D3D10_USAGE flag D3D10_USAGE_IMMUTABLE, if resource is a multisampled texture, if a cl_mem from subresource subresource of resource has already been created using clCreateFromD3D10Texture2DKHR, or if context was not created against the same Direct3D 10 device from which resource was created.

  • CL_INVALID_D3D10_RESOURCE_KHR如果资源不是Direct3D 10纹理资源,如果资源是使用D3D10_USAGE标志D3D10_USAGE_IMUTABLE创建的,如果资源为多采样纹理,如果资源的子资源子资源中的CL_mem已经使用clCreateFromD3D10Texture2DKHR创建,或者如果上下文不是针对创建资源的同一Direct3D 10设备创建的。

  • CL_INVALID_IMAGE_FORMAT_DESCRIPTOR if the Direct3D 10 texture format of resource is not listed in the DXGI Formats and Corresponding OpenCL Image Formats table or if the Direct3D 10 texture format of resource does not map to a supported OpenCL image format.

  • CL_INVALID_IMAGE_FORMAT_DESCRIPTOR如果resource的Direct3D 10纹理格式未在DXGI格式和相应的OpenCL图像格式表中列出,或者resource的Direct3D10纹理格式没有映射到支持的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 create an OpenCL 3D image object from a subresource of a Direct3D 10 3D texture, call the function

要从Direct3D 10 3D纹理的子源创建OpenCL 3D图像对象,请调用函数

// Provided by cl_khr_d3d10_sharing
cl_mem clCreateFromD3D10Texture3DKHR(
    cl_context context,
    cl_mem_flags flags,
    ID3D10Texture3D* resource,
    UINT subresource,
    cl_int* errcode_ret);

clCreateFromD3D10Texture3DKHR is provided by the cl_khr_d3d10_sharing extension.

clCreateFromD3D10Texture3DKHR由cl_khr_d3d10_shareing扩展提供。

  • context is a valid OpenCL context created from a Direct3D 10 device.

  • context是从Direct3D10设备创建的有效OpenCL上下文。

  • flags is a bit-field that is used to specify usage information. Refer to the List of supported memory flag values table for a description of flags. Only the CL_MEM_READ_ONLYCL_MEM_WRITE_ONLY and CL_MEM_READ_WRITE flags specified in that table can be used.

  • ​flags是一个用于指定使用信息的位字段。有关标志的描述,请参阅支持的内存标志值列表表。只能使用该表中指定的CL_MEM_READ_ONLY、CL_MEM_WRITE_ONLY和CL_MEM_READ_WRITE标志。

  • resource is a pointer to the Direct3D 10 3D texture to share.

  • resource是指向要共享的Direct3D 10 3D纹理的指针。

  • subresource is the subresource of resource to share.

  • subresource是要共享的resource的子资源。

  • errcode_ret will return an appropriate error code. If errcode_ret is NULL, no error code is returned.

  • errcode_ret将返回相应的错误代码。如果errcode_ret为NULL,则不会返回任何错误代码。

The width, height and depth of the returned OpenCL 3D image object are determined by the width, height and depth of subresource subresource of resource. The channel type and order of the returned OpenCL 3D image object is determined by the format of resource and the DXGI Formats and Corresponding OpenCL Image Formats table.

​返回的OpenCL 3D图像对象的宽度、高度和深度由resource的子资源subresource的宽度、身高和深度决定。返回的OpenCL 3D图像对象的通道类型和顺序由资源的格式和DXGI格式和相应的OpenCL图像格式表确定。

This call will increment the internal Direct3D 10 reference count on resource. The internal Direct3D 10 reference count on resource will be decremented when the OpenCL reference count on the returned OpenCL memory object drops to zero.

此调用将增加resource上的内部Direct3D 10引用计数。当返回的OpenCL内存对象上的OpenCL引用计数降至零时,resource上的内部Direct3D 10引用计数将递减。

Refer to the Lifetime of Shared Direct3D Memory Objects and Acquiring, Releasing, and Synchronizing Access to Shared OpenCL/OpenGL Memory Objects sections for more information.


有关更多信息,请参阅共享Direct3D内存对象的寿命以及获取、释放和同步对共享OpenCL/ONGL内存对象的访问部分。

clCreateFromD3D10Texture3DKHR returns a valid non-zero OpenCL image object and errcode_ret is set to CL_SUCCESS if the image object is created successfully. Otherwise, it returns a NULL value with one of the following error values returned in errcode_ret:

​clCreateFromD3D10Texture3DKHR返回有效的非零OpenCL图像对象,如果图像对象创建成功,则errcode_ret设置为CL_SUCCESS。否则,它将返回一个NULL值,并在errcode_ret中返回以下错误值之一:

  • CL_INVALID_CONTEXT if context is not a valid context.

  • CL_INVALID_CONTEXT(如果context不是有效上下文)。

  • CL_INVALID_VALUE if values specified in flags are not valid or if subresource is not a valid subresource index for resource.

  • 如果标志中指定的值无效,或者subresource不是resource的有效子资源索引,则CL_INVALID_VALUE。

  • CL_INVALID_D3D10_RESOURCE_KHR if resource is not a Direct3D 10 texture resource, if resource was created with the D3D10_USAGE flag D3D10_USAGE_IMMUTABLE, if resource is a multisampled texture, if a cl_mem from subresource subresource of resource has already been created using clCreateFromD3D10Texture3DKHR, or if context was not created against the same Direct3D 10 device from which resource was created.

  • CL_INVALID_D3D10_RESOURCE_KHR如果resource不是Direct3D 10纹理资源,如果resource是使用D3D10_USAGE标志D3D10_USAGE_IMUTABLE创建的,如果resource为多采样纹理,如果resource的子资源subresource的CL_mem已经使用clCreateFromD3D10Texture3DKHR创建,或者如果context不是针对创建资源的同一Direct3D 10设备创建的。

  • CL_INVALID_IMAGE_FORMAT_DESCRIPTOR if the Direct3D 10 texture format of resource is not listed in the DXGI Formats and Corresponding OpenCL Image Formats table or if the Direct3D 10 texture format of resource does not map to a supported OpenCL image format.

  • CL_INVALID_IMAGE_FORMAT_DESCRIPTOR如果resource的Direct3D 10纹理格式未在DXGI格式和相应的OpenCL图像格式表中列出,或者资源的Direct3D10纹理格式没有映射到支持的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实现所需的资源失败。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值