clGetContextInfo
clGetContextInfo
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.
3
clGetContextInfo Query information about a context.

##

cl_int `clGetContextInfo` cl_context context cl_context_info param_name size_t param_value_size void *param_value size_t *param_value_size_ret

## Parameters

`context`

  Specifies the OpenCL context being queried.

`param_name`

  An enumeration constant that specifies the information to query. The valid values for `param_name` are:

  cl_context_info | Return Type | Information returned in param_value
  --- | --- | ---
  `CL_CONTEXT_REFERENCE_COUNT` | cl_uint | Return the `context` reference count. The reference count returned should be considered immediately stale. It is unsuitable for general use in applications. This feature is provided for identifying memory leaks.
  `CL_CONTEXT_NUM_DEVICES` | cl_uint | Return the number of devices in `context`.
  `CL_CONTEXT_DEVICES` | cl_device_id[] | Return the list of devices in `context`.
  `CL_CONTEXT_PROPERTIES` | cl_context_- properties[] | Return the `properties` argument specified in clCreateContext or clCreateContextFromType. If the `properties` argument specified in clCreateContext or clCreateContextFromType used to create `context` is not NULL, the implementation must return the values specified in the `properties` argument. If the `properties` argument specified in clCreateContext or clCreateContextFromType used to create `context` is NULL, the implementation may return either a `param_value_size_ret` of 0, i.e. there is no context property value to be returned or can return a context property value of 0 (where 0 is used to terminate the context properties list) in the memory that `param_value` points to.
  `CL_CONTEXT_D3D10_PREFER_- SHARED_RESOURCES_KHR` | cl_bool | If the cl_khr_d3d10_sharing extension is enabled, returns CL_TRUE if Direct3D 10 resources created as shared by setting `MiscFlags` to include `D3D10_RESOURCE_MISC_SHARED` will perform faster when shared with OpenCL, compared with resources which have not set this flag. Otherwise returns `CL_FALSE`.
  `CL_CONTEXT_D3D11_PREFER_- SHARED_RESOURCES_KHR` | cl_bool | If the cl_khr_d3d11_sharing extension is supported, Returns `CL_TRUE` if Direct3D 11 resources created as shared by setting `MiscFlags` to include `D3D11_RESOURCE_MISC_SHARED` will perform faster when shared with OpenCL, compared with resources which have not set this flag. Otherwise returns `CL_FALSE`.

`param_value`

  A pointer to memory where the appropriate result being queried is returned. If `param_value` is NULL, it is ignored.

`param_value_size`

  Specifies the size in bytes of memory pointed to by `param_value`. This size must be greater than or equal to the size of return type as described in the table above.

`param_value_size_ret`

  Returns the actual size in bytes of data being queried by `param_value`. If `param_value_size_ret` is NULL, it is ignored.

## Errors

Returns CL_SUCCESS if the function executed successfully, or one of the errors below:

- CL_INVALID_CONTEXT if `context` is not a valid context.
- CL_INVALID_VALUE if `param_name` is not one of the supported values or if size in bytes specified by `param_value_size` is < size of return type as specified in the table above and `param_value` is not a NULL value.
- 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.

## Specification

OpenCL Specification

## Also see

clGetDeviceInfo

##