1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
3
"http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
8
<keyword>clGetExtensionFunctionAddressForPlatform</keyword>
13
<refentrytitle>clGetExtensionFunctionAddressForPlatform</refentrytitle>
17
<year>2007-2011</year>
18
<holder>The Khronos Group Inc.
19
Permission is hereby granted, free of charge, to any person obtaining a
20
copy of this software and/or associated documentation files (the
21
"Materials"), to deal in the Materials without restriction, including
22
without limitation the rights to use, copy, modify, merge, publish,
23
distribute, sublicense, and/or sell copies of the Materials, and to
24
permit persons to whom the Materials are furnished to do so, subject to
25
the condition that this copyright notice and permission notice shall be included
26
in all copies or substantial portions of the Materials.</holder>
29
<manvolnum>3</manvolnum>
32
<!-- ================================ SYNOPSIS -->
34
<refnamediv id="clGetExtensionFunctionAddressForPlatform">
35
<refname>clGetExtensionFunctionAddressForPlatform</refname>
38
Returns the address of the extension function named by
39
<varname>funcname</varname> for a given <varname>platform</varname>.
43
<refsynopsisdiv xmlns:xlink="http://www.w3.org/1999/xlink"><title></title>
47
<link xlink:href="scalarDataTypes.html">void*</link>
49
clGetExtensionFunctionAddressForPlatform
54
<link xlink:href="abstractDataTypes.html">cl_platform_id</link>
55
<parameter>platform</parameter>
59
<link xlink:href="scalarDataTypes.html">char</link>
60
<parameter>*funcname</parameter>
66
<!-- ================================ PARAMETERS -->
68
<refsect1 id="parameters">
69
<title>Parameters</title>
72
<term> <varname> funcname </varname> </term>
74
<para> <!-- parameter description -->
75
Name of an extension function.
82
<!-- ================================ DESCRIPTION -->
84
<refsect1 id="description"><title>Description</title>
86
The function <function>clGetExtensionFunctionAddressForPlatform</function> returns
87
the address of the extension function named by <varname>funcname</varname> for a
88
given <varname>platform</varname>. The pointer returned should be cast to a function
89
pointer type matching the extension function's definition defined in the appropriate
90
extension specification and header file.
94
A return value of NULL indicates that the specified function does not exist for the
95
implementation or <varname>platform</varname> is not a valid platform. A non-NULL
96
return value for <function>clGetExtensionFunctionAddressForPlatform</function>
97
does not guarantee that an extension function is actually supported by
98
the platform. The application must also make a corresponding query using
99
<citerefentry><refentrytitle>clGetPlatformInfo</refentrytitle></citerefentry>
100
(platform, <constant>CL_PLATFORM_EXTENSIONS</constant>, ... ) or
101
<citerefentry><refentrytitle>clGetDeviceInfo</refentrytitle></citerefentry>
102
(device,<constant>CL_DEVICE_EXTENSIONS</constant>, ... ) to determine if an extension
103
is supported by the OpenCL implementation.
107
<function>clGetExtensionFunctionAddressForPlatform</function> may not be queried
108
for core (non-extension) functions in OpenCL. For functions that are queryable with
109
<function>clGetExtensionFunctionAddressForPlatform</function>, implementations may
110
choose to also export those functions statically from the object libraries implementing
111
those functions. However, portable applications cannot rely on this behavior.
115
Function pointer typedefs must be declared for all extensions that add API entrypoints.
116
These typedefs are a required part of the extension interface, to be provided in
117
an appropriate header (such as <code>cl_ext.h</code> if the extension is an OpenCL
118
extension, or <code>cl_gl_ext.h</code> if the extension is an OpenCL/OpenGL sharing
123
<!-- ================================ NOTES -->
125
<refsect1 id="notes"><title>Notes</title>
127
Since there is no way to qualify the query with a device, the function pointer
128
returned must work for all implementations of that extension on different devices
129
for a platform. The behavior of calling a device extension function on a device not
130
supporting that extension is undefined.
134
<!-- ================================ EXAMPLE -->
135
<!-- DO NOT DELETE IN CASE AN EXAMPLE IS ADDED IN THE FUTURE -->
137
<refsect2 id="example1">
143
The following convention must be followed for all extensions affecting the host API,
144
where TAG can be <constant>KHR</constant>, <constant>EXT</constant> or vendor-specific:
147
<informaltable frame="none">
148
<tgroup cols="1" align="left" colsep="0" rowsep="0">
149
<colspec colname="col1" colnum="1" /> <tbody>
151
<entry>#ifndef extension_name
152
#define extension_name 1
154
// all data typedefs, token #defines, prototypes, and
155
// function pointer typedefs for this extension
157
// function pointer typedefs must use the
158
// following naming convention
159
typedef CL_API_ENTRY return type
160
(CL_API_CALL *clextension_func_nameTAG_fn)(...);
162
#endif // extension_name
170
Consider, for example, the <citerefentry><refentrytitle>cl_khr_gl_sharing</refentrytitle></citerefentry> extension.
171
This extension would add the following to <code>cl_gl_ext</code>.h::
173
<informaltable frame="none">
174
<tgroup cols="1" align="left" colsep="0" rowsep="0">
175
<colspec colname="col1" colnum="1" />
178
<entry>#ifndef cl_khr_gl_sharing
179
#define cl_khr_gl_sharing 1
181
// all data typedefs, token #defines, prototypes, and
182
// function pointer typedefs for this extension
183
#define CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR -1000
184
#define CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR 0x2006
185
#define CL_DEVICES_FOR_GL_CONTEXT_KHR 0x2007
186
#define CL_GL_CONTEXT_KHR 0x2008
187
#define CL_EGL_DISPLAY_KHR 0x2009
188
#define CL_GLX_DISPLAY_KHR 0x200A
189
#define CL_WGL_HDC_KHR 0x200B
190
#define CL_CGL_SHAREGROUP_KHR 0x200C
192
// function pointer typedefs must use the
193
// following naming convention
194
typedef CL_API_ENTRY cl_int
195
(CL_API_CALL *clGetGLContextInfoKHR_fn)(
196
const cl_context_properties * /* properties */,
197
cl_gl_context_info /* param_name */,
198
size_t /* param_value_size */,
199
void * /* param_value */,
200
size_t * /*param_value_size_ret*/);
201
#endif // cl_khr_gl_sharing
209
<!-- ================================ SPECIFICATION -->
210
<!-- Set the "uri" attribute in the <olink /> element to the "named destination" for the PDF page
212
<refsect1 id="specification"><title>Specification</title>
215
<imagedata fileref="pdficon_small1.gif" format="gif" />
218
<olink uri="clGetExtensionFunctionAddressForPlatform">OpenCL Specification</olink>
222
<!-- ================================ ALSO SEE -->
224
<refsect1 id="seealso"><title>Also see</title>
226
<citerefentry><refentrytitle>EXTENSION</refentrytitle></citerefentry>
230
<!-- ============================== COPYRIGHT -->
231
<!-- Content included from copyright.inc.xsl -->
233
<refsect3 id="Copyright"><title></title>
235
<imagedata fileref="KhronosLogo.jpg" format="jpg" />