codekingpro/portable-devtools
114k
1/*
2 * Copyright 1993-2012 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#if !defined(__CUDA_D3D9_INTEROP_H__)
51#define __CUDA_D3D9_INTEROP_H__
52
53#include "cuda_runtime_api.h"
54
55/** \cond impl_private */
56#if !defined(__dv)
57
58#if defined(__cplusplus)
59
60#define __dv(v) \
61 = v
62
63#else /* __cplusplus */
64
65#define __dv(v)
66
67#endif /* __cplusplus */
68
69#endif /* !__dv */
70/** \endcond impl_private */
71
72#include <d3d9.h>
73
74/** \cond impl_private */
75#if defined(__DOXYGEN_ONLY__) || defined(CUDA_ENABLE_DEPRECATED)
76#define __CUDA_DEPRECATED
77#elif defined(_MSC_VER)
78#define __CUDA_DEPRECATED __declspec(deprecated)
79#elif defined(__GNUC__)
80#define __CUDA_DEPRECATED __attribute__((deprecated))
81#else
82#define __CUDA_DEPRECATED
83#endif
84/** \endcond impl_private */
85
86#if defined(__cplusplus)
87extern "C" {
88#endif /* __cplusplus */
89
90/**
91 * \addtogroup CUDART_D3D9 Direct3D 9 Interoperability
92 * This section describes the Direct3D 9 interoperability functions of the CUDA
93 * runtime application programming interface. Note that mapping of Direct3D 9
94 * resources is performed with the graphics API agnostic, resource mapping
95 * interface described in \ref CUDART_INTEROP "Graphics Interopability".
96 *
97 * @{
98 */
99
100/**
101 * CUDA devices corresponding to a D3D9 device
102 */
103enum cudaD3D9DeviceList
104{
105 cudaD3D9DeviceListAll = 1, /**< The CUDA devices for all GPUs used by a D3D9 device */
106 cudaD3D9DeviceListCurrentFrame = 2, /**< The CUDA devices for the GPUs used by a D3D9 device in its currently rendering frame */
107 cudaD3D9DeviceListNextFrame = 3 /**< The CUDA devices for the GPUs to be used by a D3D9 device in the next frame */
108};
109
110/**
111 * \brief Gets the Direct3D device against which the current CUDA context was
112 * created
113 *
114 * Returns in \p *ppD3D9Device the Direct3D device against which this CUDA
115 * context was created in ::cudaD3D9SetDirect3DDevice().
116 *
117 * \param ppD3D9Device - Returns the Direct3D device for this thread
118 *
119 * \return
120 * ::cudaSuccess,
121 * ::cudaErrorInvalidGraphicsContext,
122 * ::cudaErrorUnknown
123 * \notefnerr
124 *
125 * \sa
126 * ::cudaD3D9SetDirect3DDevice,
127 * ::cuD3D9GetDirect3DDevice
128 */
129extern __host__ cudaError_t CUDARTAPI cudaD3D9GetDirect3DDevice(IDirect3DDevice9 **ppD3D9Device);
130
131/**
132 * \brief Register a Direct3D 9 resource for access by CUDA
133 *
134 * Registers the Direct3D 9 resource \p pD3DResource for access by CUDA.
135 *
136 * If this call is successful then the application will be able to map and
137 * unmap this resource until it is unregistered through
138 * ::cudaGraphicsUnregisterResource(). Also on success, this call will increase the
139 * internal reference count on \p pD3DResource. This reference count will be
140 * decremented when this resource is unregistered through
141 * ::cudaGraphicsUnregisterResource().
142 *
143 * This call potentially has a high-overhead and should not be called every frame
144 * in interactive applications.
145 *
146 * The type of \p pD3DResource must be one of the following.
147 *
148 * - ::IDirect3DVertexBuffer9: may be accessed through a device pointer
149 * - ::IDirect3DIndexBuffer9: may be accessed through a device pointer
150 * - ::IDirect3DSurface9: may be accessed through an array.
151 * Only stand-alone objects of type ::IDirect3DSurface9
152 * may be explicitly shared. In particular, individual mipmap levels and faces
153 * of cube maps may not be registered directly. To access individual surfaces
154 * associated with a texture, one must register the base texture object.
155 * - ::IDirect3DBaseTexture9: individual surfaces on this texture may be accessed
156 * through an array.
157 *
158 * The \p flags argument may be used to specify additional parameters at register
159 * time. The valid values for this parameter are
160 *
161 * - ::cudaGraphicsRegisterFlagsNone: Specifies no hints about how this
162 * resource will be used.
163 * - ::cudaGraphicsRegisterFlagsSurfaceLoadStore: Specifies that CUDA will
164 * bind this resource to a surface reference.
165 * - ::cudaGraphicsRegisterFlagsTextureGather: Specifies that CUDA will perform
166 * texture gather operations on this resource.
167 *
168 * Not all Direct3D resources of the above types may be used for
169 * interoperability with CUDA. The following are some limitations.
170 *
171 * - The primary rendertarget may not be registered with CUDA.
172 * - Resources allocated as shared may not be registered with CUDA.
173 * - Textures which are not of a format which is 1, 2, or 4 channels of 8, 16,
174 * or 32-bit integer or floating-point data cannot be shared.
175 * - Surfaces of depth or stencil formats cannot be shared.
176 *
177 * A complete list of supported formats is as follows:
178 * - D3DFMT_L8
179 * - D3DFMT_L16
180 * - D3DFMT_A8R8G8B8
181 * - D3DFMT_X8R8G8B8
182 * - D3DFMT_G16R16
183 * - D3DFMT_A8B8G8R8
184 * - D3DFMT_A8
185 * - D3DFMT_A8L8
186 * - D3DFMT_Q8W8V8U8
187 * - D3DFMT_V16U16
188 * - D3DFMT_A16B16G16R16F
189 * - D3DFMT_A16B16G16R16
190 * - D3DFMT_R32F
191 * - D3DFMT_G16R16F
192 * - D3DFMT_A32B32G32R32F
193 * - D3DFMT_G32R32F
194 * - D3DFMT_R16F
195 *
196 * If \p pD3DResource is of incorrect type or is already registered, then
197 * ::cudaErrorInvalidResourceHandle is returned.
198 * If \p pD3DResource cannot be registered, then ::cudaErrorUnknown is returned.
199 *
200 * \param resource - Pointer to returned resource handle
201 * \param pD3DResource - Direct3D resource to register
202 * \param flags - Parameters for resource registration
203 *
204 * \return
205 * ::cudaSuccess,
206 * ::cudaErrorInvalidDevice,
207 * ::cudaErrorInvalidValue,
208 * ::cudaErrorInvalidResourceHandle,
209 * ::cudaErrorUnknown
210 * \notefnerr
211 *
212 * \sa
213 * ::cudaD3D9SetDirect3DDevice,
214 * ::cudaGraphicsUnregisterResource,
215 * ::cudaGraphicsMapResources,
216 * ::cudaGraphicsSubResourceGetMappedArray,
217 * ::cudaGraphicsResourceGetMappedPointer,
218 * ::cuGraphicsD3D9RegisterResource
219 */
220extern __host__ cudaError_t CUDARTAPI cudaGraphicsD3D9RegisterResource(struct cudaGraphicsResource **resource, IDirect3DResource9 *pD3DResource, unsigned int flags);
221
222/**
223 * \brief Gets the device number for an adapter
224 *
225 * Returns in \p *device the CUDA-compatible device corresponding to the
226 * adapter name \p pszAdapterName obtained from ::EnumDisplayDevices or
227 * ::IDirect3D9::GetAdapterIdentifier(). If no device on the adapter with name
228 * \p pszAdapterName is CUDA-compatible then the call will fail.
229 *
230 * \param device - Returns the device corresponding to pszAdapterName
231 * \param pszAdapterName - D3D9 adapter to get device for
232 *
233 * \return
234 * ::cudaSuccess,
235 * ::cudaErrorInvalidValue,
236 * ::cudaErrorUnknown
237 * \notefnerr
238 *
239 * \sa
240 * ::cudaD3D9SetDirect3DDevice,
241 * ::cudaGraphicsD3D9RegisterResource,
242 * ::cuD3D9GetDevice
243 */
244extern __host__ cudaError_t CUDARTAPI cudaD3D9GetDevice(int *device, const char *pszAdapterName);
245
246/**
247 * \brief Gets the CUDA devices corresponding to a Direct3D 9 device
248 *
249 * Returns in \p *pCudaDeviceCount the number of CUDA-compatible devices corresponding
250 * to the Direct3D 9 device \p pD3D9Device.
251 * Also returns in \p *pCudaDevices at most \p cudaDeviceCount of the the CUDA-compatible devices
252 * corresponding to the Direct3D 9 device \p pD3D9Device.
253 *
254 * If any of the GPUs being used to render \p pDevice are not CUDA capable then the
255 * call will return ::cudaErrorNoDevice.
256 *
257 * \param pCudaDeviceCount - Returned number of CUDA devices corresponding to \p pD3D9Device
258 * \param pCudaDevices - Returned CUDA devices corresponding to \p pD3D9Device
259 * \param cudaDeviceCount - The size of the output device array \p pCudaDevices
260 * \param pD3D9Device - Direct3D 9 device to query for CUDA devices
261 * \param deviceList - The set of devices to return. This set may be
262 * ::cudaD3D9DeviceListAll for all devices,
263 * ::cudaD3D9DeviceListCurrentFrame for the devices used to
264 * render the current frame (in SLI), or
265 * ::cudaD3D9DeviceListNextFrame for the devices used to
266 * render the next frame (in SLI).
267 *
268 * \return
269 * ::cudaSuccess,
270 * ::cudaErrorNoDevice,
271 * ::cudaErrorUnknown
272 * \notefnerr
273 *
274 * \sa
275 * ::cudaGraphicsUnregisterResource,
276 * ::cudaGraphicsMapResources,
277 * ::cudaGraphicsSubResourceGetMappedArray,
278 * ::cudaGraphicsResourceGetMappedPointer,
279 * ::cuD3D9GetDevices
280 */
281extern __host__ cudaError_t CUDARTAPI cudaD3D9GetDevices(unsigned int *pCudaDeviceCount, int *pCudaDevices, unsigned int cudaDeviceCount, IDirect3DDevice9 *pD3D9Device, enum cudaD3D9DeviceList deviceList);
282
283/**
284 * \brief Sets the Direct3D 9 device to use for interoperability with
285 * a CUDA device
286 *
287 * Records \p pD3D9Device as the Direct3D 9 device to use for Direct3D 9
288 * interoperability with the CUDA device \p device and sets \p device as
289 * the current device for the calling host thread.
290 *
291 * This function will immediately initialize the primary context on
292 * \p device if needed.
293 *
294 * If \p device has already been initialized then this call will fail with
295 * the error ::cudaErrorSetOnActiveProcess. In this case it is necessary
296 * to reset \p device using ::cudaDeviceReset() before Direct3D 9
297 * interoperability on \p device may be enabled.
298 *
299 * Successfully initializing CUDA interoperability with \p pD3D9Device
300 * will increase the internal reference count on \p pD3D9Device. This
301 * reference count will be decremented when \p device is reset using
302 * ::cudaDeviceReset().
303 *
304 * Note that this function is never required for correct functionality. Use of
305 * this function will result in accelerated interoperability only when the
306 * operating system is Windows Vista or Windows 7, and the device \p pD3DDdevice
307 * is not an IDirect3DDevice9Ex. In all other cirumstances, this function is
308 * not necessary.
309 *
310 * \param pD3D9Device - Direct3D device to use for this thread
311 * \param device - The CUDA device to use. This device must be among the devices
312 * returned when querying ::cudaD3D9DeviceListAll from ::cudaD3D9GetDevices,
313 * may be set to -1 to automatically select an appropriate CUDA device.
314 *
315 * \return
316 * ::cudaSuccess,
317 * ::cudaErrorInitializationError,
318 * ::cudaErrorInvalidValue,
319 * ::cudaErrorSetOnActiveProcess
320 * \notefnerr
321 *
322 * \sa
323 * ::cudaD3D9GetDevice,
324 * ::cudaGraphicsD3D9RegisterResource,
325 * ::cudaDeviceReset
326 */
327extern __host__ cudaError_t CUDARTAPI cudaD3D9SetDirect3DDevice(IDirect3DDevice9 *pD3D9Device, int device __dv(-1));
328
329/** @} */ /* END CUDART_D3D9 */
330
331/**
332 * \addtogroup CUDART_D3D9_DEPRECATED Direct3D 9 Interoperability [DEPRECATED]
333 * This section describes deprecated Direct3D 9 interoperability functions.
334 *
335 * @{
336 */
337
338/**
339 * CUDA D3D9 Register Flags
340 */
341enum cudaD3D9RegisterFlags
342{
343 cudaD3D9RegisterFlagsNone = 0, /**< Default; Resource can be accessed througa void* */
344 cudaD3D9RegisterFlagsArray = 1 /**< Resource can be accessed through a CUarray* */
345};
346
347/**
348 * CUDA D3D9 Map Flags
349 */
350enum cudaD3D9MapFlags
351{
352 cudaD3D9MapFlagsNone = 0, /**< Default; Assume resource can be read/written */
353 cudaD3D9MapFlagsReadOnly = 1, /**< CUDA kernels will not write to this resource */
354 cudaD3D9MapFlagsWriteDiscard = 2 /**< CUDA kernels will only write to and will not read from this resource */
355};
356
357/**
358 * \brief Registers a Direct3D resource for access by CUDA
359 *
360 * \deprecated This function is deprecated as of CUDA 3.0.
361 *
362 * Registers the Direct3D resource \p pResource for access by CUDA.
363 *
364 * If this call is successful, then the application will be able to map and
365 * unmap this resource until it is unregistered through
366 * ::cudaD3D9UnregisterResource(). Also on success, this call will increase
367 * the internal reference count on \p pResource. This reference count will be
368 * decremented when this resource is unregistered through
369 * ::cudaD3D9UnregisterResource().
370 *
371 * This call potentially has a high-overhead and should not be called every frame
372 * in interactive applications.
373 *
374 * The type of \p pResource must be one of the following.
375 *
376 * - ::IDirect3DVertexBuffer9: No notes.
377 * - ::IDirect3DIndexBuffer9: No notes.
378 * - ::IDirect3DSurface9: Only stand-alone objects of type ::IDirect3DSurface9
379 * may be explicitly shared. In particular, individual mipmap levels and faces
380 * of cube maps may not be registered directly. To access individual surfaces
381 * associated with a texture, one must register the base texture object.
382 * - ::IDirect3DBaseTexture9: When a texture is registered, all surfaces
383 * associated with all mipmap levels of all faces of the texture will be
384 * accessible to CUDA.
385 *
386 * The \p flags argument specifies the mechanism through which CUDA will
387 * access the Direct3D resource. The following value is allowed:
388 *
389 * - ::cudaD3D9RegisterFlagsNone: Specifies that CUDA will access this
390 * resource through a \p void*. The pointer, size, and pitch for each
391 * subresource of this resource may be queried through
392 * ::cudaD3D9ResourceGetMappedPointer(), ::cudaD3D9ResourceGetMappedSize(),
393 * and ::cudaD3D9ResourceGetMappedPitch() respectively. This option is valid
394 * for all resource types.
395 *
396 * Not all Direct3D resources of the above types may be used for
397 * interoperability with CUDA. The following are some limitations:
398 *
399 * - The primary rendertarget may not be registered with CUDA.
400 * - Resources allocated as shared may not be registered with CUDA.
401 * - Any resources allocated in ::D3DPOOL_SYSTEMMEM or ::D3DPOOL_MANAGED may
402 * not be registered with CUDA.
403 * - Textures which are not of a format which is 1, 2, or 4 channels of 8, 16,
404 * or 32-bit integer or floating-point data cannot be shared.
405 * - Surfaces of depth or stencil formats cannot be shared.
406 *
407 * If Direct3D interoperability is not initialized on this context, then
408 * ::cudaErrorInvalidDevice is returned. If \p pResource is of incorrect type
409 * (e.g, is a non-stand-alone ::IDirect3DSurface9) or is already registered,
410 * then ::cudaErrorInvalidResourceHandle is returned. If \p pResource cannot
411 * be registered then ::cudaErrorUnknown is returned.
412 *
413 * \param pResource - Resource to register
414 * \param flags - Parameters for resource registration
415 *
416 * \return
417 * ::cudaSuccess,
418 * ::cudaErrorInvalidValue,
419 * ::cudaErrorInvalidResourceHandle,
420 * ::cudaErrorUnknown
421 * \notefnerr
422 *
423 * \sa
424 * ::cudaGraphicsD3D9RegisterResource
425 */
426extern __host__ cudaError_t CUDARTAPI cudaD3D9RegisterResource(IDirect3DResource9 *pResource, unsigned int flags);
427
428/**
429 * \brief Unregisters a Direct3D resource for access by CUDA
430 *
431 * \deprecated This function is deprecated as of CUDA 3.0.
432 *
433 * Unregisters the Direct3D resource \p pResource so it is not accessible by
434 * CUDA unless registered again.
435 *
436 * If \p pResource is not registered, then ::cudaErrorInvalidResourceHandle is
437 * returned.
438 *
439 * \param pResource - Resource to unregister
440 *
441 * \return
442 * ::cudaSuccess,
443 * ::cudaErrorInvalidResourceHandle,
444 * ::cudaErrorUnknown
445 * \notefnerr
446 *
447 * \sa
448 * ::cudaGraphicsUnregisterResource
449 */
450extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D9UnregisterResource(IDirect3DResource9 *pResource);
451
452/**
453 * \brief Map Direct3D resources for access by CUDA
454 *
455 * \deprecated This function is deprecated as of CUDA 3.0.
456 *
457 * Maps the \p count Direct3D resources in \p ppResources for access by CUDA.
458 *
459 * The resources in \p ppResources may be accessed in CUDA kernels until they
460 * are unmapped. Direct3D should not access any resources while they are
461 * mapped by CUDA. If an application does so, the results are undefined.
462 *
463 * This function provides the synchronization guarantee that any Direct3D
464 * calls issued before ::cudaD3D9MapResources() will complete before any CUDA
465 * kernels issued after ::cudaD3D9MapResources() begin.
466 *
467 * If any of \p ppResources have not been registered for use with CUDA or if
468 * \p ppResources contains any duplicate entries then
469 * ::cudaErrorInvalidResourceHandle is returned. If any of \p ppResources are
470 * presently mapped for access by CUDA then ::cudaErrorUnknown is returned.
471 *
472 * \param count - Number of resources to map for CUDA
473 * \param ppResources - Resources to map for CUDA
474 *
475 * \return
476 * ::cudaSuccess,
477 * ::cudaErrorInvalidResourceHandle,
478 * ::cudaErrorUnknown
479 * \notefnerr
480 *
481 * \sa
482 * ::cudaGraphicsMapResources
483 */
484extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D9MapResources(int count, IDirect3DResource9 **ppResources);
485
486/**
487 * \brief Unmap Direct3D resources for access by CUDA
488 *
489 * \deprecated This function is deprecated as of CUDA 3.0.
490 *
491 * Unmaps the \p count Direct3D resources in \p ppResources.
492 *
493 * This function provides the synchronization guarantee that any CUDA kernels
494 * issued before ::cudaD3D9UnmapResources() will complete before any Direct3D
495 * calls issued after ::cudaD3D9UnmapResources() begin.
496 *
497 * If any of \p ppResources have not been registered for use with CUDA or if
498 * \p ppResources contains any duplicate entries, then
499 * ::cudaErrorInvalidResourceHandle is returned. If any of \p ppResources are
500 * not presently mapped for access by CUDA then ::cudaErrorUnknown is returned.
501 *
502 * \param count - Number of resources to unmap for CUDA
503 * \param ppResources - Resources to unmap for CUDA
504 *
505 * \return
506 * ::cudaSuccess,
507 * ::cudaErrorInvalidResourceHandle,
508 * ::cudaErrorUnknown
509 * \notefnerr
510 *
511 * \sa
512 * ::cudaGraphicsUnmapResources
513 */
514extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D9UnmapResources(int count, IDirect3DResource9 **ppResources);
515
516/**
517 * \brief Set usage flags for mapping a Direct3D resource
518 *
519 * \deprecated This function is deprecated as of CUDA 3.0.
520 *
521 * Set flags for mapping the Direct3D resource \p pResource.
522 *
523 * Changes to flags will take effect the next time \p pResource is mapped.
524 * The \p flags argument may be any of the following:
525 *
526 * - ::cudaD3D9MapFlagsNone: Specifies no hints about how this resource will
527 * be used. It is therefore assumed that this resource will be read from and
528 * written to by CUDA kernels. This is the default value.
529 * - ::cudaD3D9MapFlagsReadOnly: Specifies that CUDA kernels which access this
530 * resource will not write to this resource.
531 * - ::cudaD3D9MapFlagsWriteDiscard: Specifies that CUDA kernels which access
532 * this resource will not read from this resource and will write over the
533 * entire contents of the resource, so none of the data previously stored in
534 * the resource will be preserved.
535 *
536 * If \p pResource has not been registered for use with CUDA, then
537 * ::cudaErrorInvalidResourceHandle is returned. If \p pResource is presently
538 * mapped for access by CUDA, then ::cudaErrorUnknown is returned.
539 *
540 * \param pResource - Registered resource to set flags for
541 * \param flags - Parameters for resource mapping
542 *
543 * \return
544 * ::cudaSuccess,
545 * ::cudaErrorInvalidValue,
546 * ::cudaErrorInvalidResourceHandle,
547 * ::cudaErrorUnknown
548 * \notefnerr
549 *
550 * \sa
551 * ::cudaInteropResourceSetMapFlags
552 */
553extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D9ResourceSetMapFlags(IDirect3DResource9 *pResource, unsigned int flags);
554
555/**
556 * \brief Get the dimensions of a registered Direct3D surface
557 *
558 * \deprecated This function is deprecated as of CUDA 3.0.
559 *
560 * Returns in \p *pWidth, \p *pHeight, and \p *pDepth the dimensions of the
561 * subresource of the mapped Direct3D resource \p pResource which corresponds
562 * to \p face and \p level.
563 *
564 * Since anti-aliased surfaces may have multiple samples per pixel, it is
565 * possible that the dimensions of a resource will be an integer factor larger
566 * than the dimensions reported by the Direct3D runtime.
567 *
568 * The parameters \p pWidth, \p pHeight, and \p pDepth are optional. For 2D
569 * surfaces, the value returned in \p *pDepth will be 0.
570 *
571 * If \p pResource is not of type ::IDirect3DBaseTexture9 or
572 * ::IDirect3DSurface9 or if \p pResource has not been registered for use with
573 * CUDA, then ::cudaErrorInvalidResourceHandle is returned.
574 *
575 * For usage requirements of \p face and \p level parameters, see
576 * ::cudaD3D9ResourceGetMappedPointer.
577 *
578 * \param pWidth - Returned width of surface
579 * \param pHeight - Returned height of surface
580 * \param pDepth - Returned depth of surface
581 * \param pResource - Registered resource to access
582 * \param face - Face of resource to access
583 * \param level - Level of resource to access
584 *
585 * \return
586 * ::cudaSuccess,
587 * ::cudaErrorInvalidValue,
588 * ::cudaErrorInvalidResourceHandle,
589 * \notefnerr
590 *
591 * \sa
592 * ::cudaGraphicsSubResourceGetMappedArray
593 */
594extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D9ResourceGetSurfaceDimensions(size_t *pWidth, size_t *pHeight, size_t *pDepth, IDirect3DResource9 *pResource, unsigned int face, unsigned int level);
595
596/**
597 * \brief Get an array through which to access a subresource of a Direct3D
598 * resource which has been mapped for access by CUDA
599 *
600 * \deprecated This function is deprecated as of CUDA 3.0.
601 *
602 * Returns in \p *pArray an array through which the subresource of the mapped
603 * Direct3D resource \p pResource, which corresponds to \p face and \p level
604 * may be accessed. The value set in \p pArray may change every time that
605 * \p pResource is mapped.
606 *
607 * If \p pResource is not registered then ::cudaErrorInvalidResourceHandle is
608 * returned. If \p pResource was not registered with usage flags
609 * ::cudaD3D9RegisterFlagsArray, then ::cudaErrorInvalidResourceHandle is
610 * returned. If \p pResource is not mapped, then ::cudaErrorUnknown is
611 * returned.
612 *
613 * For usage requirements of \p face and \p level parameters, see
614 * ::cudaD3D9ResourceGetMappedPointer().
615 *
616 * \param ppArray - Returned array corresponding to subresource
617 * \param pResource - Mapped resource to access
618 * \param face - Face of resource to access
619 * \param level - Level of resource to access
620 *
621 * \return
622 * ::cudaSuccess,
623 * ::cudaErrorInvalidResourceHandle,
624 * ::cudaErrorUnknown
625 * \notefnerr
626 *
627 * \sa
628 * ::cudaGraphicsSubResourceGetMappedArray
629 */
630extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D9ResourceGetMappedArray(cudaArray **ppArray, IDirect3DResource9 *pResource, unsigned int face, unsigned int level);
631
632/**
633 * \brief Get a pointer through which to access a subresource of a Direct3D
634 * resource which has been mapped for access by CUDA
635 *
636 * \deprecated This function is deprecated as of CUDA 3.0.
637 *
638 * Returns in \p *pPointer the base pointer of the subresource of the mapped
639 * Direct3D resource \p pResource, which corresponds to \p face and \p level.
640 * The value set in \p pPointer may change every time that \p pResource is
641 * mapped.
642 *
643 * If \p pResource is not registered, then ::cudaErrorInvalidResourceHandle is
644 * returned. If \p pResource was not registered with usage flags
645 * ::cudaD3D9RegisterFlagsNone, then ::cudaErrorInvalidResourceHandle is
646 * returned. If \p pResource is not mapped, then ::cudaErrorUnknown is
647 * returned.
648 *
649 * If \p pResource is of type ::IDirect3DCubeTexture9, then \p face must one
650 * of the values enumerated by type ::D3DCUBEMAP_FACES. For all other types,
651 * \p face must be 0. If \p face is invalid, then ::cudaErrorInvalidValue is
652 * returned.
653 *
654 * If \p pResource is of type ::IDirect3DBaseTexture9, then \p level must
655 * correspond to a valid mipmap level. Only mipmap level 0 is supported for
656 * now. For all other types \p level must be 0. If \p level is invalid, then
657 * ::cudaErrorInvalidValue is returned.
658 *
659 * \param pPointer - Returned pointer corresponding to subresource
660 * \param pResource - Mapped resource to access
661 * \param face - Face of resource to access
662 * \param level - Level of resource to access
663 *
664 * \return
665 * ::cudaSuccess,
666 * ::cudaErrorInvalidValue,
667 * ::cudaErrorInvalidResourceHandle,
668 * ::cudaErrorUnknown
669 * \notefnerr
670 *
671 * \sa
672 * ::cudaGraphicsResourceGetMappedPointer
673 */
674extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D9ResourceGetMappedPointer(void **pPointer, IDirect3DResource9 *pResource, unsigned int face, unsigned int level);
675
676/**
677 * \brief Get the size of a subresource of a Direct3D resource which has been
678 * mapped for access by CUDA
679 *
680 * \deprecated This function is deprecated as of CUDA 3.0.
681 *
682 * Returns in \p *pSize the size of the subresource of the mapped Direct3D
683 * resource \p pResource, which corresponds to \p face and \p level. The value
684 * set in \p pSize may change every time that \p pResource is mapped.
685 *
686 * If \p pResource has not been registered for use with CUDA then
687 * ::cudaErrorInvalidResourceHandle is returned. If \p pResource was not
688 * registered with usage flags ::cudaD3D9RegisterFlagsNone, then
689 * ::cudaErrorInvalidResourceHandle is returned. If \p pResource is not mapped
690 * for access by CUDA then ::cudaErrorUnknown is returned.
691 *
692 * For usage requirements of \p face and \p level parameters, see
693 * ::cudaD3D9ResourceGetMappedPointer().
694 *
695 * \param pSize - Returned size of subresource
696 * \param pResource - Mapped resource to access
697 * \param face - Face of resource to access
698 * \param level - Level of resource to access
699 *
700 * \return
701 * ::cudaSuccess,
702 * ::cudaErrorInvalidValue,
703 * ::cudaErrorInvalidResourceHandle,
704 * ::cudaErrorUnknown
705 * \notefnerr
706 *
707 * \sa
708 * ::cudaGraphicsResourceGetMappedPointer
709 */
710extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D9ResourceGetMappedSize(size_t *pSize, IDirect3DResource9 *pResource, unsigned int face, unsigned int level);
711
712/**
713 * \brief Get the pitch of a subresource of a Direct3D resource which has been
714 * mapped for access by CUDA
715 *
716 * \deprecated This function is deprecated as of CUDA 3.0.
717 *
718 * Returns in \p *pPitch and \p *pPitchSlice the pitch and Z-slice pitch of
719 * the subresource of the mapped Direct3D resource \p pResource, which
720 * corresponds to \p face and \p level. The values set in \p pPitch and
721 * \p pPitchSlice may change every time that \p pResource is mapped.
722 *
723 * The pitch and Z-slice pitch values may be used to compute the location of a
724 * sample on a surface as follows.
725 *
726 * For a 2D surface, the byte offset of the sample at position \b x, \b y from
727 * the base pointer of the surface is:
728 *
729 * \b y * \b pitch + (<b>bytes per pixel</b>) * \b x
730 *
731 * For a 3D surface, the byte offset of the sample at position \b x, \b y,
732 * \b z from the base pointer of the surface is:
733 *
734 * \b z* \b slicePitch + \b y * \b pitch + (<b>bytes per pixel</b>) * \b x
735 *
736 * Both parameters \p pPitch and \p pPitchSlice are optional and may be set to
737 * NULL.
738 *
739 * If \p pResource is not of type ::IDirect3DBaseTexture9 or one of its
740 * sub-types or if \p pResource has not been registered for use with CUDA,
741 * then ::cudaErrorInvalidResourceHandle is returned. If \p pResource was not
742 * registered with usage flags ::cudaD3D9RegisterFlagsNone, then
743 * ::cudaErrorInvalidResourceHandle is returned. If \p pResource is not mapped
744 * for access by CUDA then ::cudaErrorUnknown is returned.
745 *
746 * For usage requirements of \p face and \p level parameters, see
747 * ::cudaD3D9ResourceGetMappedPointer().
748 *
749 * \param pPitch - Returned pitch of subresource
750 * \param pPitchSlice - Returned Z-slice pitch of subresource
751 * \param pResource - Mapped resource to access
752 * \param face - Face of resource to access
753 * \param level - Level of resource to access
754 *
755 * \return
756 * ::cudaSuccess,
757 * ::cudaErrorInvalidValue,
758 * ::cudaErrorInvalidResourceHandle,
759 * ::cudaErrorUnknown
760 * \notefnerr
761 *
762 * \sa
763 * ::cudaGraphicsResourceGetMappedPointer
764 */
765extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D9ResourceGetMappedPitch(size_t *pPitch, size_t *pPitchSlice, IDirect3DResource9 *pResource, unsigned int face, unsigned int level);
766
767/* D3D9 1.x interop interface */
768
769extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D9Begin(IDirect3DDevice9 *pDevice);
770extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D9End(void);
771extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D9RegisterVertexBuffer(IDirect3DVertexBuffer9 *pVB);
772extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D9UnregisterVertexBuffer(IDirect3DVertexBuffer9 *pVB);
773extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D9MapVertexBuffer(void **dptr, IDirect3DVertexBuffer9 *pVB);
774extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D9UnmapVertexBuffer(IDirect3DVertexBuffer9 *pVB);
775
776/** @} */ /* END CUDART_D3D9_DEPRECATED */
777
778#if defined(__cplusplus)
779}
780#endif /* __cplusplus */
781
782#undef __dv
783#undef __CUDA_DEPRECATED
784
785#endif /* __CUDA_D3D9_INTEROP_H__ */
786 