C Specification

To query a media adapter for any associated OpenCL devices, call the function

// Provided by cl_khr_dx9_media_sharing
cl_int clGetDeviceIDsFromDX9MediaAdapterKHR(
    cl_platform_id platform,
    cl_uint num_media_adapters,
    cl_dx9_media_adapter_type_khr* media_adapter_type,
    void* media_adapters,
    cl_dx9_media_adapter_set_khr media_adapter_set,
    cl_uint num_entries,
    cl_device_id* devices,
    cl_uint* num_devices);
clGetDeviceIDsFromDX9MediaAdapterKHR is provided by the cl_khr_dx9_media_sharing extension.

Parameters

  • platform refers to the platform ID returned by clGetPlatformIDs.

  • num_media_adapters specifies the number of media adapters.

  • media_adapters_type is an array of num_media_adapters entries. Each entry specifies the type of media adapter and must be one of the values described in the media adapter type table below.

  • media_adapters is an array of num_media_adapters entries. Each entry specifies the actual adapter whose type is specified by media_adapter_type. The media_adapters must be one of the types described in the cl_dx9_media_adapter_type_khr values table.

  • media_adapter_set specifies the set of adapters to return and must be one of the values described in the cl_dx9_media_adapter_set_khr values table.

  • num_entries is the number of cl_device_id entries that can be added to devices. If devices is not NULL, the num_entries must be greater than zero.

  • devices returns a list of OpenCL devices found that support the list of media adapters specified. The cl_device_id values returned in devices can be used to identify a specific OpenCL device. If devices argument is NULL, this argument is ignored. The number of OpenCL devices returned is the minimum of the value specified by num_entries or the number of OpenCL devices whose type matches device_type.

  • num_devices returns the number of OpenCL devices. If num_devices is NULL, this argument is ignored.

Description

Table 1. DirectX 9 object types that may be used by clGetDeviceIDsFromDX9MediaAdapterKHR
cl_dx9_media_adapter_type_khr Type of Media Adapter

CL_ADAPTER_D3D9_KHR

provided by the cl_khr_dx9_media_sharing extension.

IDirect3DDevice9 *

CL_ADAPTER_D3D9EX_KHR

provided by the cl_khr_dx9_media_sharing extension.

IDirect3DDevice9Ex *

CL_ADAPTER_DXVA_KHR

provided by the cl_khr_dx9_media_sharing extension.

IDXVAHD_Device *

Table 2. Sets of devices queriable using clGetDeviceIDsFromDX9MediaAdapterKHR
cl_dx9_media_adapter_set_khr Description

CL_PREFERRED_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR

provided by the cl_khr_dx9_media_sharing extension.

The preferred OpenCL devices associated with the media adapter.

CL_ALL_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR

provided by the cl_khr_dx9_media_sharing extension.

All OpenCL devices that may interoperate with the media adapter

clGetDeviceIDsFromDX9MediaAdapterKHR returns CL_SUCCESS if the function is executed successfully. Otherwise, it returns one of the following errors:

  • CL_INVALID_PLATFORM if platform is not a valid platform.

  • CL_INVALID_VALUE if num_media_adapters is zero or if media_adapters_type is NULL or if media_adapters is NULL.

  • CL_INVALID_VALUE if any of the entries in media_adapters_type or media_adapters is not a valid value.

  • CL_INVALID_VALUE if media_adapter_set is not a valid value.

  • CL_INVALID_VALUE if num_entries is equal to zero and devices is not NULL or if both num_devices and devices are NULL.

  • CL_DEVICE_NOT_FOUND if no OpenCL devices that correspond to adapters specified in media_adapters and media_adapters_type were found.

  • CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.

  • CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.

See Also

Document Notes

For more information, see the OpenCL Specification

This page is extracted from the OpenCL Specification. Fixes and changes should be made to the Specification, not directly.

Copyright 2014-2025 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0