Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
cudaGL.h609 linesDownload Raw Back to include
1/*
2 * Copyright 1993-2014 NVIDIA Corporation.  All rights reserved.
3 *
4 * NOTICE TO LICENSEE:
5 *
6 * This source code and/or documentation ("Licensed Deliverables") are
7 * subject to NVIDIA intellectual property rights under U.S. and
8 * international Copyright laws.
9 *
10 * These Licensed Deliverables contained herein is PROPRIETARY and
11 * CONFIDENTIAL to NVIDIA and is being provided under the terms and
12 * conditions of a form of NVIDIA software license agreement by and
13 * between NVIDIA and Licensee ("License Agreement") or electronically
14 * accepted by Licensee.  Notwithstanding any terms or conditions to
15 * the contrary in the License Agreement, reproduction or disclosure
16 * of the Licensed Deliverables to any third party without the express
17 * written consent of NVIDIA is prohibited.
18 *
19 * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
20 * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
21 * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE.  IT IS
22 * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
23 * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
24 * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
25 * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
26 * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
27 * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
28 * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
29 * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
31 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
32 * OF THESE LICENSED DELIVERABLES.
33 *
34 * U.S. Government End Users.  These Licensed Deliverables are a
35 * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
36 * 1995), consisting of "commercial computer software" and "commercial
37 * computer software documentation" as such terms are used in 48
38 * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
39 * only as a commercial end item.  Consistent with 48 C.F.R.12.212 and
40 * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
41 * U.S. Government End Users acquire the Licensed Deliverables with
42 * only those rights set forth herein.
43 *
44 * Any use of the Licensed Deliverables in individual and commercial
45 * software must include, in the user documentation and internal
46 * comments to the code, the above Disclaimer and U.S. Government End
47 * Users Notice.
48 */
49
50#ifndef CUDAGL_H
51#define CUDAGL_H
52
53#include <cuda.h>
54#include <GL/gl.h>
55
56#if defined(__CUDA_API_VERSION_INTERNAL) || defined(__DOXYGEN_ONLY__) || defined(CUDA_ENABLE_DEPRECATED)
57#define __CUDA_DEPRECATED
58#elif defined(_MSC_VER)
59#define __CUDA_DEPRECATED __declspec(deprecated)
60#elif defined(__GNUC__)
61#define __CUDA_DEPRECATED __attribute__((deprecated))
62#else
63#define __CUDA_DEPRECATED
64#endif
65
66#ifdef CUDA_FORCE_API_VERSION
67#error "CUDA_FORCE_API_VERSION is no longer supported."
68#endif
69
70#if defined(__CUDA_API_VERSION_INTERNAL) || defined(CUDA_API_PER_THREAD_DEFAULT_STREAM)
71    #define __CUDA_API_PER_THREAD_DEFAULT_STREAM
72    #define __CUDA_API_PTDS(api) api ## _ptds
73    #define __CUDA_API_PTSZ(api) api ## _ptsz
74#else
75    #define __CUDA_API_PTDS(api) api
76    #define __CUDA_API_PTSZ(api) api
77#endif
78
79#define cuGLCtxCreate            cuGLCtxCreate_v2
80#define cuGLMapBufferObject      __CUDA_API_PTDS(cuGLMapBufferObject_v2)
81#define cuGLMapBufferObjectAsync __CUDA_API_PTSZ(cuGLMapBufferObjectAsync_v2)
82#define cuGLGetDevices           cuGLGetDevices_v2
83
84#ifdef __cplusplus
85extern "C" {
86#endif
87
88/**
89 * \file cudaGL.h
90 * \brief Header file for the OpenGL interoperability functions of the
91 * low-level CUDA driver application programming interface.
92 */
93
94/**
95 * \defgroup CUDA_GL OpenGL Interoperability
96 * \ingroup CUDA_DRIVER
97 *
98 * ___MANBRIEF___ OpenGL interoperability functions of the low-level CUDA
99 * driver API (___CURRENT_FILE___) ___ENDMANBRIEF___
100 *
101 * This section describes the OpenGL interoperability functions of the
102 * low-level CUDA driver application programming interface. Note that mapping 
103 * of OpenGL resources is performed with the graphics API agnostic, resource 
104 * mapping interface described in \ref CUDA_GRAPHICS "Graphics Interoperability".
105 *
106 * @{
107 */
108
109#if defined(_WIN32)
110#if !defined(WGL_NV_gpu_affinity)
111typedef void* HGPUNV;
112#endif
113#endif /* _WIN32 */
114
115/**
116 * \brief Registers an OpenGL buffer object
117 *
118 * Registers the buffer object specified by \p buffer for access by
119 * CUDA.  A handle to the registered object is returned as \p
120 * pCudaResource.  The register flags \p Flags specify the intended usage,
121 * as follows:
122 *
123 * - ::CU_GRAPHICS_REGISTER_FLAGS_NONE: Specifies no hints about how this
124 *   resource will be used. It is therefore assumed that this resource will be
125 *   read from and written to by CUDA. This is the default value.
126 * - ::CU_GRAPHICS_REGISTER_FLAGS_READ_ONLY: Specifies that CUDA
127 *   will not write to this resource.
128 * - ::CU_GRAPHICS_REGISTER_FLAGS_WRITE_DISCARD: Specifies that
129 *   CUDA will not read from this resource and will write over the
130 *   entire contents of the resource, so none of the data previously
131 *   stored in the resource will be preserved.
132 *
133 * \param pCudaResource - Pointer to the returned object handle
134 * \param buffer - name of buffer object to be registered
135 * \param Flags - Register flags
136 *
137 * \return
138 * ::CUDA_SUCCESS,
139 * ::CUDA_ERROR_INVALID_HANDLE,
140 * ::CUDA_ERROR_ALREADY_MAPPED,
141 * ::CUDA_ERROR_INVALID_CONTEXT,
142 * ::CUDA_ERROR_OPERATING_SYSTEM
143 * \notefnerr
144 *
145 * \sa 
146 * ::cuGraphicsUnregisterResource,
147 * ::cuGraphicsMapResources,
148 * ::cuGraphicsResourceGetMappedPointer,
149 * ::cudaGraphicsGLRegisterBuffer
150 */
151CUresult CUDAAPI cuGraphicsGLRegisterBuffer(CUgraphicsResource *pCudaResource, GLuint buffer, unsigned int Flags);
152
153/**
154 * \brief Register an OpenGL texture or renderbuffer object
155 *
156 * Registers the texture or renderbuffer object specified by \p image for access by CUDA.  
157 * A handle to the registered object is returned as \p pCudaResource.  
158 *
159 * \p target must match the type of the object, and must be one of ::GL_TEXTURE_2D, 
160 * ::GL_TEXTURE_RECTANGLE, ::GL_TEXTURE_CUBE_MAP, ::GL_TEXTURE_3D, ::GL_TEXTURE_2D_ARRAY, 
161 * or ::GL_RENDERBUFFER.
162 *
163 * The register flags \p Flags specify the intended usage, as follows:
164 *
165 * - ::CU_GRAPHICS_REGISTER_FLAGS_NONE: Specifies no hints about how this
166 *   resource will be used. It is therefore assumed that this resource will be
167 *   read from and written to by CUDA. This is the default value.
168 * - ::CU_GRAPHICS_REGISTER_FLAGS_READ_ONLY: Specifies that CUDA
169 *   will not write to this resource.
170 * - ::CU_GRAPHICS_REGISTER_FLAGS_WRITE_DISCARD: Specifies that
171 *   CUDA will not read from this resource and will write over the
172 *   entire contents of the resource, so none of the data previously
173 *   stored in the resource will be preserved.
174 * - ::CU_GRAPHICS_REGISTER_FLAGS_SURFACE_LDST: Specifies that CUDA will
175 *   bind this resource to a surface reference.
176 * - ::CU_GRAPHICS_REGISTER_FLAGS_TEXTURE_GATHER: Specifies that CUDA will perform
177 *   texture gather operations on this resource.
178 *
179 * The following image formats are supported. For brevity's sake, the list is abbreviated.
180 * For ex., {GL_R, GL_RG} X {8, 16} would expand to the following 4 formats 
181 * {GL_R8, GL_R16, GL_RG8, GL_RG16} :
182 * - GL_RED, GL_RG, GL_RGBA, GL_LUMINANCE, GL_ALPHA, GL_LUMINANCE_ALPHA, GL_INTENSITY
183 * - {GL_R, GL_RG, GL_RGBA} X {8, 16, 16F, 32F, 8UI, 16UI, 32UI, 8I, 16I, 32I}
184 * - {GL_LUMINANCE, GL_ALPHA, GL_LUMINANCE_ALPHA, GL_INTENSITY} X
185 * {8, 16, 16F_ARB, 32F_ARB, 8UI_EXT, 16UI_EXT, 32UI_EXT, 8I_EXT, 16I_EXT, 32I_EXT}
186 *
187 * The following image classes are currently disallowed:
188 * - Textures with borders
189 * - Multisampled renderbuffers
190 *
191 * \param pCudaResource - Pointer to the returned object handle
192 * \param image - name of texture or renderbuffer object to be registered
193 * \param target - Identifies the type of object specified by \p image
194 * \param Flags - Register flags
195 *
196 * \return
197 * ::CUDA_SUCCESS,
198 * ::CUDA_ERROR_INVALID_HANDLE,
199 * ::CUDA_ERROR_ALREADY_MAPPED,
200 * ::CUDA_ERROR_INVALID_CONTEXT,
201 * ::CUDA_ERROR_OPERATING_SYSTEM
202 * \notefnerr
203 *
204 * \sa 
205 * ::cuGraphicsUnregisterResource,
206 * ::cuGraphicsMapResources,
207 * ::cuGraphicsSubResourceGetMappedArray,
208 * ::cudaGraphicsGLRegisterImage
209 */
210CUresult CUDAAPI cuGraphicsGLRegisterImage(CUgraphicsResource *pCudaResource, GLuint image, GLenum target, unsigned int Flags);
211
212#ifdef _WIN32
213/**
214 * \brief Gets the CUDA device associated with hGpu
215 *
216 * Returns in \p *pDevice the CUDA device associated with a \p hGpu, if
217 * applicable.
218 *
219 * \param pDevice - Device associated with hGpu
220 * \param hGpu    - Handle to a GPU, as queried via ::WGL_NV_gpu_affinity()
221 *
222 * \return
223 * ::CUDA_SUCCESS,
224 * ::CUDA_ERROR_DEINITIALIZED,
225 * ::CUDA_ERROR_NOT_INITIALIZED,
226 * ::CUDA_ERROR_INVALID_CONTEXT,
227 * ::CUDA_ERROR_INVALID_VALUE
228 * \notefnerr
229 *
230 * \sa ::cuGLMapBufferObject,
231 * ::cuGLRegisterBufferObject, ::cuGLUnmapBufferObject,
232 * ::cuGLUnregisterBufferObject, ::cuGLUnmapBufferObjectAsync,
233 * ::cuGLSetBufferObjectMapFlags,
234 * ::cudaWGLGetDevice
235 */
236CUresult CUDAAPI cuWGLGetDevice(CUdevice *pDevice, HGPUNV hGpu);
237#endif /* _WIN32 */
238
239/**
240 * CUDA devices corresponding to an OpenGL device
241 */
242typedef enum CUGLDeviceList_enum {
243    CU_GL_DEVICE_LIST_ALL            = 0x01, /**< The CUDA devices for all GPUs used by the current OpenGL context */
244    CU_GL_DEVICE_LIST_CURRENT_FRAME  = 0x02, /**< The CUDA devices for the GPUs used by the current OpenGL context in its currently rendering frame */
245    CU_GL_DEVICE_LIST_NEXT_FRAME     = 0x03, /**< The CUDA devices for the GPUs to be used by the current OpenGL context in the next frame */
246} CUGLDeviceList;
247
248/**
249 * \brief Gets the CUDA devices associated with the current OpenGL context
250 *
251 * Returns in \p *pCudaDeviceCount the number of CUDA-compatible devices 
252 * corresponding to the current OpenGL context. Also returns in \p *pCudaDevices 
253 * at most cudaDeviceCount of the CUDA-compatible devices corresponding to 
254 * the current OpenGL context. If any of the GPUs being used by the current OpenGL
255 * context are not CUDA capable then the call will return CUDA_ERROR_NO_DEVICE.
256 *
257 * The \p deviceList argument may be any of the following:
258 * - ::CU_GL_DEVICE_LIST_ALL: Query all devices used by the current OpenGL context.
259 * - ::CU_GL_DEVICE_LIST_CURRENT_FRAME: Query the devices used by the current OpenGL context to
260 *   render the current frame (in SLI).
261 * - ::CU_GL_DEVICE_LIST_NEXT_FRAME: Query the devices used by the current OpenGL context to
262 *   render the next frame (in SLI). Note that this is a prediction, it can't be guaranteed that
263 *   this is correct in all cases.
264 *
265 * \param pCudaDeviceCount - Returned number of CUDA devices.
266 * \param pCudaDevices     - Returned CUDA devices.
267 * \param cudaDeviceCount  - The size of the output device array pCudaDevices.
268 * \param deviceList       - The set of devices to return.
269 *
270 * \return
271 * ::CUDA_SUCCESS,
272 * ::CUDA_ERROR_NO_DEVICE,
273 * ::CUDA_ERROR_INVALID_VALUE,
274 * ::CUDA_ERROR_INVALID_CONTEXT,
275 * ::CUDA_ERROR_INVALID_GRAPHICS_CONTEXT,
276 * ::CUDA_ERROR_OPERATING_SYSTEM
277 *
278 * \notefnerr
279 *
280 * \sa
281 * ::cuWGLGetDevice,
282 * ::cudaGLGetDevices
283 */
284CUresult CUDAAPI cuGLGetDevices(unsigned int *pCudaDeviceCount, CUdevice *pCudaDevices, unsigned int cudaDeviceCount, CUGLDeviceList deviceList);
285
286/**
287 * \defgroup CUDA_GL_DEPRECATED OpenGL Interoperability [DEPRECATED]
288 *
289 * ___MANBRIEF___ deprecated OpenGL interoperability functions of the low-level
290 * CUDA driver API (___CURRENT_FILE___) ___ENDMANBRIEF___
291 *
292 * This section describes deprecated OpenGL interoperability functionality.
293 *
294 * @{
295 */
296
297/** Flags to map or unmap a resource */
298typedef enum CUGLmap_flags_enum {
299    CU_GL_MAP_RESOURCE_FLAGS_NONE          = 0x00,
300    CU_GL_MAP_RESOURCE_FLAGS_READ_ONLY     = 0x01,
301    CU_GL_MAP_RESOURCE_FLAGS_WRITE_DISCARD = 0x02,    
302} CUGLmap_flags;
303
304/**
305 * \brief Create a CUDA context for interoperability with OpenGL
306 *
307 * \deprecated This function is deprecated as of Cuda 5.0. 
308 *
309 * This function is deprecated and should no longer be used.  It is
310 * no longer necessary to associate a CUDA context with an OpenGL
311 * context in order to achieve maximum interoperability performance.
312 *
313 * \param pCtx   - Returned CUDA context
314 * \param Flags  - Options for CUDA context creation
315 * \param device - Device on which to create the context
316 *
317 * \return
318 * ::CUDA_SUCCESS,
319 * ::CUDA_ERROR_DEINITIALIZED,
320 * ::CUDA_ERROR_NOT_INITIALIZED,
321 * ::CUDA_ERROR_INVALID_CONTEXT,
322 * ::CUDA_ERROR_INVALID_VALUE,
323 * ::CUDA_ERROR_OUT_OF_MEMORY
324 * \notefnerr
325 *
326 * \sa ::cuCtxCreate, ::cuGLInit, ::cuGLMapBufferObject,
327 * ::cuGLRegisterBufferObject, ::cuGLUnmapBufferObject,
328 * ::cuGLUnregisterBufferObject, ::cuGLMapBufferObjectAsync,
329 * ::cuGLUnmapBufferObjectAsync, ::cuGLSetBufferObjectMapFlags,
330 * ::cuWGLGetDevice
331 */
332__CUDA_DEPRECATED CUresult CUDAAPI cuGLCtxCreate(CUcontext *pCtx, unsigned int Flags, CUdevice device );
333
334/**
335 * \brief Initializes OpenGL interoperability
336 *
337 * \deprecated This function is deprecated as of Cuda 3.0. 
338 *
339 * Initializes OpenGL interoperability. This function is deprecated
340 * and calling it is no longer required. It may fail if the needed
341 * OpenGL driver facilities are not available.
342 *
343 * \return
344 * ::CUDA_SUCCESS,
345 * ::CUDA_ERROR_DEINITIALIZED,
346 * ::CUDA_ERROR_NOT_INITIALIZED,
347 * ::CUDA_ERROR_INVALID_CONTEXT,
348 * ::CUDA_ERROR_UNKNOWN
349 * \notefnerr
350 *
351 * \sa ::cuGLMapBufferObject,
352 * ::cuGLRegisterBufferObject, ::cuGLUnmapBufferObject,
353 * ::cuGLUnregisterBufferObject, ::cuGLMapBufferObjectAsync,
354 * ::cuGLUnmapBufferObjectAsync, ::cuGLSetBufferObjectMapFlags,
355 * ::cuWGLGetDevice
356 */
357__CUDA_DEPRECATED CUresult CUDAAPI cuGLInit(void);
358
359/**
360 * \brief Registers an OpenGL buffer object
361 *
362 * \deprecated This function is deprecated as of Cuda 3.0. 
363 *
364 * Registers the buffer object specified by \p buffer for access by
365 * CUDA. This function must be called before CUDA can map the buffer
366 * object.  There must be a valid OpenGL context bound to the current
367 * thread when this function is called, and the buffer name is
368 * resolved by that context.
369 *
370 * \param buffer - The name of the buffer object to register.
371 *
372 * \return
373 * ::CUDA_SUCCESS,
374 * ::CUDA_ERROR_DEINITIALIZED,
375 * ::CUDA_ERROR_NOT_INITIALIZED,
376 * ::CUDA_ERROR_INVALID_CONTEXT,
377 * ::CUDA_ERROR_ALREADY_MAPPED
378 * \notefnerr
379 *
380 * \sa ::cuGraphicsGLRegisterBuffer
381 */
382__CUDA_DEPRECATED CUresult CUDAAPI cuGLRegisterBufferObject(GLuint buffer);
383
384/**
385 * \brief Maps an OpenGL buffer object
386 *
387 * \deprecated This function is deprecated as of Cuda 3.0. 
388 *
389 * Maps the buffer object specified by \p buffer into the address space of the
390 * current CUDA context and returns in \p *dptr and \p *size the base pointer
391 * and size of the resulting mapping.
392 *
393 * There must be a valid OpenGL context bound to the current thread
394 * when this function is called.  This must be the same context, or a
395 * member of the same shareGroup, as the context that was bound when
396 * the buffer was registered.
397 *
398 * All streams in the current CUDA context are synchronized with the
399 * current GL context.
400 *
401 * \param dptr   - Returned mapped base pointer
402 * \param size   - Returned size of mapping
403 * \param buffer - The name of the buffer object to map
404 *
405 * \return
406 * ::CUDA_SUCCESS,
407 * ::CUDA_ERROR_DEINITIALIZED,
408 * ::CUDA_ERROR_NOT_INITIALIZED,
409 * ::CUDA_ERROR_INVALID_CONTEXT,
410 * ::CUDA_ERROR_INVALID_VALUE,
411 * ::CUDA_ERROR_MAP_FAILED
412 * \notefnerr
413 *
414 * \sa ::cuGraphicsMapResources
415 */
416__CUDA_DEPRECATED CUresult CUDAAPI cuGLMapBufferObject(CUdeviceptr *dptr, size_t *size,  GLuint buffer);  
417
418/**
419 * \brief Unmaps an OpenGL buffer object
420 *
421 * \deprecated This function is deprecated as of Cuda 3.0. 
422 *
423 * Unmaps the buffer object specified by \p buffer for access by CUDA.
424 *
425 * There must be a valid OpenGL context bound to the current thread
426 * when this function is called.  This must be the same context, or a
427 * member of the same shareGroup, as the context that was bound when
428 * the buffer was registered.
429 *
430 * All streams in the current CUDA context are synchronized with the
431 * current GL context.
432 *
433 * \param buffer - Buffer object to unmap
434 *
435 * \return
436 * ::CUDA_SUCCESS,
437 * ::CUDA_ERROR_DEINITIALIZED,
438 * ::CUDA_ERROR_NOT_INITIALIZED,
439 * ::CUDA_ERROR_INVALID_CONTEXT,
440 * ::CUDA_ERROR_INVALID_VALUE
441 * \notefnerr
442 *
443 * \sa ::cuGraphicsUnmapResources
444 */
445__CUDA_DEPRECATED CUresult CUDAAPI cuGLUnmapBufferObject(GLuint buffer);
446
447/**
448 * \brief Unregister an OpenGL buffer object
449 *
450 * \deprecated This function is deprecated as of Cuda 3.0. 
451 *
452 * Unregisters the buffer object specified by \p buffer.  This
453 * releases any resources associated with the registered buffer.
454 * After this call, the buffer may no longer be mapped for access by
455 * CUDA.
456 *
457 * There must be a valid OpenGL context bound to the current thread
458 * when this function is called.  This must be the same context, or a
459 * member of the same shareGroup, as the context that was bound when
460 * the buffer was registered.
461 *
462 * \param buffer - Name of the buffer object to unregister
463 *
464 * \return
465 * ::CUDA_SUCCESS,
466 * ::CUDA_ERROR_DEINITIALIZED,
467 * ::CUDA_ERROR_NOT_INITIALIZED,
468 * ::CUDA_ERROR_INVALID_CONTEXT,
469 * ::CUDA_ERROR_INVALID_VALUE
470 * \notefnerr
471 *
472 * \sa ::cuGraphicsUnregisterResource
473 */
474__CUDA_DEPRECATED CUresult CUDAAPI cuGLUnregisterBufferObject(GLuint buffer);
475
476/**
477 * \brief Set the map flags for an OpenGL buffer object
478 *
479 * \deprecated This function is deprecated as of Cuda 3.0. 
480 *
481 * Sets the map flags for the buffer object specified by \p buffer.
482 *
483 * Changes to \p Flags will take effect the next time \p buffer is mapped.
484 * The \p Flags argument may be any of the following:
485 * - ::CU_GL_MAP_RESOURCE_FLAGS_NONE: Specifies no hints about how this
486 *   resource will be used. It is therefore assumed that this resource will be
487 *   read from and written to by CUDA kernels. This is the default value.
488 * - ::CU_GL_MAP_RESOURCE_FLAGS_READ_ONLY: Specifies that CUDA kernels which
489 *   access this resource will not write to this resource.
490 * - ::CU_GL_MAP_RESOURCE_FLAGS_WRITE_DISCARD: Specifies that CUDA kernels
491 *   which access this resource will not read from this resource and will
492 *   write over the entire contents of the resource, so none of the data
493 *   previously stored in the resource will be preserved.
494 *
495 * If \p buffer has not been registered for use with CUDA, then
496 * ::CUDA_ERROR_INVALID_HANDLE is returned. If \p buffer is presently
497 * mapped for access by CUDA, then ::CUDA_ERROR_ALREADY_MAPPED is returned.
498 *
499 * There must be a valid OpenGL context bound to the current thread
500 * when this function is called.  This must be the same context, or a
501 * member of the same shareGroup, as the context that was bound when
502 * the buffer was registered.
503 *
504 * \param buffer - Buffer object to unmap
505 * \param Flags  - Map flags
506 *
507 * \return
508 * ::CUDA_SUCCESS,
509 * ::CUDA_ERROR_NOT_INITIALIZED,
510 * ::CUDA_ERROR_INVALID_HANDLE,
511 * ::CUDA_ERROR_ALREADY_MAPPED,
512 * ::CUDA_ERROR_INVALID_CONTEXT,
513 * \notefnerr
514 *
515 * \sa ::cuGraphicsResourceSetMapFlags
516 */
517__CUDA_DEPRECATED CUresult CUDAAPI cuGLSetBufferObjectMapFlags(GLuint buffer, unsigned int Flags);
518
519/**
520 * \brief Maps an OpenGL buffer object
521 *
522 * \deprecated This function is deprecated as of Cuda 3.0. 
523 *
524 * Maps the buffer object specified by \p buffer into the address space of the
525 * current CUDA context and returns in \p *dptr and \p *size the base pointer
526 * and size of the resulting mapping.
527 *
528 * There must be a valid OpenGL context bound to the current thread
529 * when this function is called.  This must be the same context, or a
530 * member of the same shareGroup, as the context that was bound when
531 * the buffer was registered.
532 *
533 * Stream \p hStream in the current CUDA context is synchronized with
534 * the current GL context.
535 *
536 * \param dptr    - Returned mapped base pointer
537 * \param size    - Returned size of mapping
538 * \param buffer  - The name of the buffer object to map
539 * \param hStream - Stream to synchronize
540 *
541 * \return
542 * ::CUDA_SUCCESS,
543 * ::CUDA_ERROR_DEINITIALIZED,
544 * ::CUDA_ERROR_NOT_INITIALIZED,
545 * ::CUDA_ERROR_INVALID_CONTEXT,
546 * ::CUDA_ERROR_INVALID_VALUE,
547 * ::CUDA_ERROR_MAP_FAILED
548 * \notefnerr
549 *
550 * \sa ::cuGraphicsMapResources
551 */
552__CUDA_DEPRECATED CUresult CUDAAPI cuGLMapBufferObjectAsync(CUdeviceptr *dptr, size_t *size,  GLuint buffer, CUstream hStream);
553
554/**
555 * \brief Unmaps an OpenGL buffer object
556 *
557 * \deprecated This function is deprecated as of Cuda 3.0. 
558 *
559 * Unmaps the buffer object specified by \p buffer for access by CUDA.
560 *
561 * There must be a valid OpenGL context bound to the current thread
562 * when this function is called.  This must be the same context, or a
563 * member of the same shareGroup, as the context that was bound when
564 * the buffer was registered.
565 *
566 * Stream \p hStream in the current CUDA context is synchronized with
567 * the current GL context.
568 *
569 * \param buffer  - Name of the buffer object to unmap
570 * \param hStream - Stream to synchronize
571 *
572 * \return
573 * ::CUDA_SUCCESS,
574 * ::CUDA_ERROR_DEINITIALIZED,
575 * ::CUDA_ERROR_NOT_INITIALIZED,
576 * ::CUDA_ERROR_INVALID_CONTEXT,
577 * ::CUDA_ERROR_INVALID_VALUE
578 * \notefnerr
579 *
580 * \sa ::cuGraphicsUnmapResources
581 */
582__CUDA_DEPRECATED CUresult CUDAAPI cuGLUnmapBufferObjectAsync(GLuint buffer, CUstream hStream);
583
584/** @} */ /* END CUDA_GL_DEPRECATED */
585/** @} */ /* END CUDA_GL */
586
587
588#if defined(__CUDA_API_VERSION_INTERNAL)
589    #undef cuGLCtxCreate
590    #undef cuGLMapBufferObject
591    #undef cuGLMapBufferObjectAsync
592    #undef cuGLGetDevices
593
594    CUresult CUDAAPI cuGLGetDevices(unsigned int *pCudaDeviceCount, CUdevice *pCudaDevices, unsigned int cudaDeviceCount, CUGLDeviceList deviceList);
595    CUresult CUDAAPI cuGLMapBufferObject_v2(CUdeviceptr *dptr, size_t *size,  GLuint buffer);
596    CUresult CUDAAPI cuGLMapBufferObjectAsync_v2(CUdeviceptr *dptr, size_t *size,  GLuint buffer, CUstream hStream);
597    CUresult CUDAAPI cuGLCtxCreate(CUcontext *pCtx, unsigned int Flags, CUdevice device );
598    CUresult CUDAAPI cuGLMapBufferObject(CUdeviceptr_v1 *dptr, unsigned int *size,  GLuint buffer);
599    CUresult CUDAAPI cuGLMapBufferObjectAsync(CUdeviceptr_v1 *dptr, unsigned int *size,  GLuint buffer, CUstream hStream);
600#endif /* __CUDA_API_VERSION_INTERNAL */
601
602#ifdef __cplusplus
603};
604#endif
605
606#undef __CUDA_DEPRECATED
607
608#endif
609 
codekingpro/portable-devtools · Team Ai