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_D3D10_INTEROP_H__)
51#define __CUDA_D3D10_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 <d3d10_1.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_D3D10 Direct3D 10 Interoperability
92 * This section describes the Direct3D 10 interoperability functions of the CUDA
93 * runtime application programming interface. Note that mapping of Direct3D 10
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 D3D10 device
102 */
103enum cudaD3D10DeviceList
104{
105 cudaD3D10DeviceListAll = 1, /**< The CUDA devices for all GPUs used by a D3D10 device */
106 cudaD3D10DeviceListCurrentFrame = 2, /**< The CUDA devices for the GPUs used by a D3D10 device in its currently rendering frame */
107 cudaD3D10DeviceListNextFrame = 3 /**< The CUDA devices for the GPUs to be used by a D3D10 device in the next frame */
108};
109
110/**
111 * \brief Registers a Direct3D 10 resource for access by CUDA
112 *
113 * Registers the Direct3D 10 resource \p pD3DResource for access by CUDA.
114 *
115 * If this call is successful, then the application will be able to map and
116 * unmap this resource until it is unregistered through
117 * ::cudaGraphicsUnregisterResource(). Also on success, this call will increase the
118 * internal reference count on \p pD3DResource. This reference count will be
119 * decremented when this resource is unregistered through
120 * ::cudaGraphicsUnregisterResource().
121 *
122 * This call potentially has a high-overhead and should not be called every frame
123 * in interactive applications.
124 *
125 * The type of \p pD3DResource must be one of the following.
126 *
127 * - ::ID3D10Buffer: may be accessed via a device pointer
128 * - ::ID3D10Texture1D: individual subresources of the texture may be accessed via arrays
129 * - ::ID3D10Texture2D: individual subresources of the texture may be accessed via arrays
130 * - ::ID3D10Texture3D: individual subresources of the texture may be accessed via arrays
131 *
132 * The \p flags argument may be used to specify additional parameters at register
133 * time. The valid values for this parameter are
134 *
135 * - ::cudaGraphicsRegisterFlagsNone: Specifies no hints about how this
136 * resource will be used.
137 * - ::cudaGraphicsRegisterFlagsSurfaceLoadStore: Specifies that CUDA will
138 * bind this resource to a surface reference.
139 * - ::cudaGraphicsRegisterFlagsTextureGather: Specifies that CUDA will perform
140 * texture gather operations on this resource.
141 *
142 * Not all Direct3D resources of the above types may be used for
143 * interoperability with CUDA. The following are some limitations.
144 *
145 * - The primary rendertarget may not be registered with CUDA.
146 * - Textures which are not of a format which is 1, 2, or 4 channels of 8, 16,
147 * or 32-bit integer or floating-point data cannot be shared.
148 * - Surfaces of depth or stencil formats cannot be shared.
149 *
150 * A complete list of supported DXGI formats is as follows. For compactness the
151 * notation A_{B,C,D} represents A_B, A_C, and A_D.
152 * - DXGI_FORMAT_A8_UNORM
153 * - DXGI_FORMAT_B8G8R8A8_UNORM
154 * - DXGI_FORMAT_B8G8R8X8_UNORM
155 * - DXGI_FORMAT_R16_FLOAT
156 * - DXGI_FORMAT_R16G16B16A16_{FLOAT,SINT,SNORM,UINT,UNORM}
157 * - DXGI_FORMAT_R16G16_{FLOAT,SINT,SNORM,UINT,UNORM}
158 * - DXGI_FORMAT_R16_{SINT,SNORM,UINT,UNORM}
159 * - DXGI_FORMAT_R32_FLOAT
160 * - DXGI_FORMAT_R32G32B32A32_{FLOAT,SINT,UINT}
161 * - DXGI_FORMAT_R32G32_{FLOAT,SINT,UINT}
162 * - DXGI_FORMAT_R32_{SINT,UINT}
163 * - DXGI_FORMAT_R8G8B8A8_{SINT,SNORM,UINT,UNORM,UNORM_SRGB}
164 * - DXGI_FORMAT_R8G8_{SINT,SNORM,UINT,UNORM}
165 * - DXGI_FORMAT_R8_{SINT,SNORM,UINT,UNORM}
166 *
167 * If \p pD3DResource is of incorrect type or is already registered, then
168 * ::cudaErrorInvalidResourceHandle is returned.
169 * If \p pD3DResource cannot be registered, then ::cudaErrorUnknown is returned.
170 *
171 * \param resource - Pointer to returned resource handle
172 * \param pD3DResource - Direct3D resource to register
173 * \param flags - Parameters for resource registration
174 *
175 * \return
176 * ::cudaSuccess,
177 * ::cudaErrorInvalidDevice,
178 * ::cudaErrorInvalidValue,
179 * ::cudaErrorInvalidResourceHandle,
180 * ::cudaErrorUnknown
181 * \notefnerr
182 *
183 * \sa
184 * ::cudaGraphicsUnregisterResource,
185 * ::cudaGraphicsMapResources,
186 * ::cudaGraphicsSubResourceGetMappedArray,
187 * ::cudaGraphicsResourceGetMappedPointer,
188 * ::cuGraphicsD3D10RegisterResource
189 */
190extern __host__ cudaError_t CUDARTAPI cudaGraphicsD3D10RegisterResource(struct cudaGraphicsResource **resource, ID3D10Resource *pD3DResource, unsigned int flags);
191
192/**
193 * \brief Gets the device number for an adapter
194 *
195 * Returns in \p *device the CUDA-compatible device corresponding to the
196 * adapter \p pAdapter obtained from ::IDXGIFactory::EnumAdapters. This call
197 * will succeed only if a device on adapter \p pAdapter is CUDA-compatible.
198 *
199 * \param device - Returns the device corresponding to pAdapter
200 * \param pAdapter - D3D10 adapter to get device for
201 *
202 * \return
203 * ::cudaSuccess,
204 * ::cudaErrorInvalidValue,
205 * ::cudaErrorUnknown
206 * \notefnerr
207 *
208 * \sa
209 * ::cudaGraphicsD3D10RegisterResource,
210 * ::cuD3D10GetDevice
211 */
212extern __host__ cudaError_t CUDARTAPI cudaD3D10GetDevice(int *device, IDXGIAdapter *pAdapter);
213
214/**
215 * \brief Gets the CUDA devices corresponding to a Direct3D 10 device
216 *
217 * Returns in \p *pCudaDeviceCount the number of CUDA-compatible devices corresponding
218 * to the Direct3D 10 device \p pD3D10Device.
219 * Also returns in \p *pCudaDevices at most \p cudaDeviceCount of the the CUDA-compatible devices
220 * corresponding to the Direct3D 10 device \p pD3D10Device.
221 *
222 * If any of the GPUs being used to render \p pDevice are not CUDA capable then the
223 * call will return ::cudaErrorNoDevice.
224 *
225 * \param pCudaDeviceCount - Returned number of CUDA devices corresponding to \p pD3D10Device
226 * \param pCudaDevices - Returned CUDA devices corresponding to \p pD3D10Device
227 * \param cudaDeviceCount - The size of the output device array \p pCudaDevices
228 * \param pD3D10Device - Direct3D 10 device to query for CUDA devices
229 * \param deviceList - The set of devices to return. This set may be
230 * ::cudaD3D10DeviceListAll for all devices,
231 * ::cudaD3D10DeviceListCurrentFrame for the devices used to
232 * render the current frame (in SLI), or
233 * ::cudaD3D10DeviceListNextFrame for the devices used to
234 * render the next frame (in SLI).
235 *
236 * \return
237 * ::cudaSuccess,
238 * ::cudaErrorNoDevice,
239 * ::cudaErrorUnknown
240 * \notefnerr
241 *
242 * \sa
243 * ::cudaGraphicsUnregisterResource,
244 * ::cudaGraphicsMapResources,
245 * ::cudaGraphicsSubResourceGetMappedArray,
246 * ::cudaGraphicsResourceGetMappedPointer,
247 * ::cuD3D10GetDevices
248 */
249extern __host__ cudaError_t CUDARTAPI cudaD3D10GetDevices(unsigned int *pCudaDeviceCount, int *pCudaDevices, unsigned int cudaDeviceCount, ID3D10Device *pD3D10Device, enum cudaD3D10DeviceList deviceList);
250
251/** @} */ /* END CUDART_D3D10 */
252
253/**
254 * \addtogroup CUDART_D3D10_DEPRECATED Direct3D 10 Interoperability [DEPRECATED]
255 * This section describes deprecated Direct3D 10 interoperability functions.
256 *
257 * @{
258 */
259
260/**
261 * CUDA D3D10 Register Flags
262 */
263enum cudaD3D10RegisterFlags
264{
265 cudaD3D10RegisterFlagsNone = 0, /**< Default; Resource can be accessed through a void* */
266 cudaD3D10RegisterFlagsArray = 1 /**< Resource can be accessed through a CUarray* */
267};
268
269/**
270 * CUDA D3D10 Map Flags
271 */
272enum cudaD3D10MapFlags
273{
274 cudaD3D10MapFlagsNone = 0, /**< Default; Assume resource can be read/written */
275 cudaD3D10MapFlagsReadOnly = 1, /**< CUDA kernels will not write to this resource */
276 cudaD3D10MapFlagsWriteDiscard = 2 /**< CUDA kernels will only write to and will not read from this resource */
277};
278
279/**
280 * \brief Gets the Direct3D device against which the current CUDA context was
281 * created
282 *
283 * \deprecated This function is deprecated as of CUDA 5.0.
284 *
285 * This function is deprecated and should no longer be used. It is
286 * no longer necessary to associate a CUDA device with a D3D10
287 * device in order to achieve maximum interoperability performance.
288 *
289 * \param ppD3D10Device - Returns the Direct3D device for this thread
290 *
291 * \return
292 * ::cudaSuccess,
293 * ::cudaErrorUnknown
294 * \notefnerr
295 *
296 * \sa
297 * ::cudaD3D10SetDirect3DDevice
298 */
299extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D10GetDirect3DDevice(ID3D10Device **ppD3D10Device);
300
301/**
302 * \brief Sets the Direct3D 10 device to use for interoperability with
303 * a CUDA device
304 *
305 * \deprecated This function is deprecated as of CUDA 5.0.
306 *
307 * This function is deprecated and should no longer be used. It is
308 * no longer necessary to associate a CUDA device with a D3D10
309 * device in order to achieve maximum interoperability performance.
310 *
311 * This function will immediately initialize the primary context on
312 * \p device if needed.
313 *
314 * \param pD3D10Device - Direct3D device to use for interoperability
315 * \param device - The CUDA device to use. This device must be among the devices
316 * returned when querying ::cudaD3D10DeviceListAll from ::cudaD3D10GetDevices,
317 * may be set to -1 to automatically select an appropriate CUDA device.
318 *
319 * \return
320 * ::cudaSuccess,
321 * ::cudaErrorInitializationError,
322 * ::cudaErrorInvalidValue,
323 * ::cudaErrorSetOnActiveProcess
324 * \notefnerr
325 *
326 * \sa
327 * ::cudaD3D10GetDevice,
328 * ::cudaGraphicsD3D10RegisterResource,
329 * ::cudaDeviceReset
330 */
331extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D10SetDirect3DDevice(ID3D10Device *pD3D10Device, int device __dv(-1));
332
333/**
334 * \brief Registers a Direct3D 10 resource for access by CUDA
335 *
336 * \deprecated This function is deprecated as of CUDA 3.0.
337 *
338 * Registers the Direct3D resource \p pResource for access by CUDA.
339 *
340 * If this call is successful, then the application will be able to map and
341 * unmap this resource until it is unregistered through
342 * ::cudaD3D10UnregisterResource(). Also on success, this call will increase
343 * the internal reference count on \p pResource. This reference count will be
344 * decremented when this resource is unregistered through
345 * ::cudaD3D10UnregisterResource().
346 *
347 * This call potentially has a high-overhead and should not be called every frame
348 * in interactive applications.
349 *
350 * The type of \p pResource must be one of the following:
351 *
352 * - ::ID3D10Buffer: Cannot be used with \p flags set to
353 * \p cudaD3D10RegisterFlagsArray.
354 * - ::ID3D10Texture1D: No restrictions.
355 * - ::ID3D10Texture2D: No restrictions.
356 * - ::ID3D10Texture3D: No restrictions.
357 *
358 * The \p flags argument specifies the mechanism through which CUDA will
359 * access the Direct3D resource. The following values are allowed.
360 *
361 * - ::cudaD3D10RegisterFlagsNone: Specifies that CUDA will access this
362 * resource through a \p void*. The pointer, size, and pitch for each
363 * subresource of this resource may be queried through
364 * ::cudaD3D10ResourceGetMappedPointer(), ::cudaD3D10ResourceGetMappedSize(),
365 * and ::cudaD3D10ResourceGetMappedPitch() respectively. This option is valid
366 * for all resource types.
367 * - ::cudaD3D10RegisterFlagsArray: Specifies that CUDA will access this
368 * resource through a \p CUarray queried on a sub-resource basis through
369 * ::cudaD3D10ResourceGetMappedArray(). This option is only valid for resources
370 * of type ::ID3D10Texture1D, ::ID3D10Texture2D, and ::ID3D10Texture3D.
371 *
372 * Not all Direct3D resources of the above types may be used for
373 * interoperability with CUDA. The following are some limitations.
374 *
375 * - The primary rendertarget may not be registered with CUDA.
376 * - Resources allocated as shared may not be registered with CUDA.
377 * - Textures which are not of a format which is 1, 2, or 4 channels of 8, 16,
378 * or 32-bit integer or floating-point data cannot be shared.
379 * - Surfaces of depth or stencil formats cannot be shared.
380 *
381 * If Direct3D interoperability is not initialized on this context then
382 * ::cudaErrorInvalidDevice is returned. If \p pResource is of incorrect type
383 * or is already registered then ::cudaErrorInvalidResourceHandle is returned.
384 * If \p pResource cannot be registered then ::cudaErrorUnknown is returned.
385 *
386 * \param pResource - Resource to register
387 * \param flags - Parameters for resource registration
388 *
389 * \return
390 * ::cudaSuccess,
391 * ::cudaErrorInvalidDevice,
392 * ::cudaErrorInvalidValue,
393 * ::cudaErrorInvalidResourceHandle,
394 * ::cudaErrorUnknown
395 * \notefnerr
396 *
397 * \sa ::cudaGraphicsD3D10RegisterResource
398 */
399extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D10RegisterResource(ID3D10Resource *pResource, unsigned int flags);
400
401/**
402 * \brief Unregisters a Direct3D resource
403 *
404 * \deprecated This function is deprecated as of CUDA 3.0.
405 *
406 * Unregisters the Direct3D resource \p resource so it is not accessible by
407 * CUDA unless registered again.
408 *
409 * If \p pResource is not registered, then ::cudaErrorInvalidResourceHandle
410 * is returned.
411 *
412 * \param pResource - Resource to unregister
413 *
414 * \return
415 * ::cudaSuccess,
416 * ::cudaErrorInvalidResourceHandle,
417 * ::cudaErrorUnknown
418 * \notefnerr
419 *
420 * \sa ::cudaGraphicsUnregisterResource
421 */
422extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D10UnregisterResource(ID3D10Resource *pResource);
423
424/**
425 * \brief Maps Direct3D Resources for access by CUDA
426 *
427 * \deprecated This function is deprecated as of CUDA 3.0.
428 *
429 * Maps the \p count Direct3D resources in \p ppResources for access by CUDA.
430 *
431 * The resources in \p ppResources may be accessed in CUDA kernels until they
432 * are unmapped. Direct3D should not access any resources while they are
433 * mapped by CUDA. If an application does so, the results are undefined.
434 *
435 * This function provides the synchronization guarantee that any Direct3D
436 * calls issued before ::cudaD3D10MapResources() will complete before any CUDA
437 * kernels issued after ::cudaD3D10MapResources() begin.
438 *
439 * If any of \p ppResources have not been registered for use with CUDA or if
440 * \p ppResources contains any duplicate entries then ::cudaErrorInvalidResourceHandle
441 * is returned. If any of \p ppResources are presently mapped for access by
442 * CUDA then ::cudaErrorUnknown is returned.
443 *
444 * \param count - Number of resources to map for CUDA
445 * \param ppResources - Resources to map for CUDA
446 *
447 * \return
448 * ::cudaSuccess,
449 * ::cudaErrorInvalidResourceHandle,
450 * ::cudaErrorUnknown
451 * \notefnerr
452 *
453 * \sa ::cudaGraphicsMapResources
454 */
455extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D10MapResources(int count, ID3D10Resource **ppResources);
456
457/**
458 * \brief Unmaps Direct3D resources
459 *
460 * \deprecated This function is deprecated as of CUDA 3.0.
461 *
462 * Unmaps the \p count Direct3D resource in \p ppResources.
463 *
464 * This function provides the synchronization guarantee that any CUDA kernels
465 * issued before ::cudaD3D10UnmapResources() will complete before any Direct3D
466 * calls issued after ::cudaD3D10UnmapResources() begin.
467 *
468 * If any of \p ppResources have not been registered for use with CUDA or if
469 * \p ppResources contains any duplicate entries, then
470 * ::cudaErrorInvalidResourceHandle is returned. If any of \p ppResources are
471 * not presently mapped for access by CUDA then ::cudaErrorUnknown is returned.
472 *
473 * \param count - Number of resources to unmap for CUDA
474 * \param ppResources - Resources to unmap for CUDA
475 *
476 * \return
477 * ::cudaSuccess,
478 * ::cudaErrorInvalidResourceHandle,
479 * ::cudaErrorUnknown
480 * \notefnerr
481 *
482 * \sa ::cudaGraphicsUnmapResources
483 */
484extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D10UnmapResources(int count, ID3D10Resource **ppResources);
485
486/**
487 * \brief Gets an array through which to access a subresource of a Direct3D
488 * resource which has been mapped for access by CUDA
489 *
490 * \deprecated This function is deprecated as of CUDA 3.0.
491 *
492 * Returns in \p *ppArray an array through which the subresource of the mapped
493 * Direct3D resource \p pResource which corresponds to \p subResource may be
494 * accessed. The value set in \p ppArray may change every time that
495 * \p pResource is mapped.
496 *
497 * If \p pResource is not registered, then ::cudaErrorInvalidResourceHandle is
498 * returned. If \p pResource was not registered with usage flags
499 * ::cudaD3D10RegisterFlagsArray, then ::cudaErrorInvalidResourceHandle is
500 * returned. If \p pResource is not mapped then ::cudaErrorUnknown is returned.
501 *
502 * For usage requirements of the \p subResource parameter, see
503 * ::cudaD3D10ResourceGetMappedPointer().
504 *
505 * \param ppArray - Returned array corresponding to subresource
506 * \param pResource - Mapped resource to access
507 * \param subResource - Subresource of pResource to access
508 *
509 * \return
510 * ::cudaSuccess,
511 * ::cudaErrorInvalidValue,
512 * ::cudaErrorInvalidResourceHandle,
513 * ::cudaErrorUnknown
514 * \notefnerr
515 *
516 * \sa ::cudaGraphicsSubResourceGetMappedArray
517 */
518extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D10ResourceGetMappedArray(cudaArray **ppArray, ID3D10Resource *pResource, unsigned int subResource);
519
520/**
521 * \brief Set usage flags for mapping a Direct3D resource
522 *
523 * \deprecated This function is deprecated as of CUDA 3.0.
524 *
525 * Set usage flags for mapping the Direct3D resource \p pResource.
526 *
527 * Changes to flags will take effect the next time \p pResource is mapped.
528 * The \p flags argument may be any of the following:
529 *
530 * - ::cudaD3D10MapFlagsNone: Specifies no hints about how this resource will
531 * be used. It is therefore assumed that this resource will be read from and
532 * written to by CUDA kernels. This is the default value.
533 * - ::cudaD3D10MapFlagsReadOnly: Specifies that CUDA kernels which access
534 * this resource will not write to this resource.
535 * - ::cudaD3D10MapFlagsWriteDiscard: Specifies that CUDA kernels which access
536 * this resource will not read from this resource and will write over the
537 * entire contents of the resource, so none of the data previously stored in
538 * the resource will be preserved.
539 *
540 * If \p pResource has not been registered for use with CUDA then
541 * ::cudaErrorInvalidHandle is returned. If \p pResource is presently mapped
542 * for access by CUDA then ::cudaErrorUnknown is returned.
543 *
544 * \param pResource - Registered resource to set flags for
545 * \param flags - Parameters for resource mapping
546 *
547 * \return
548 * ::cudaSuccess,
549 * ::cudaErrorInvalidValue,
550 * ::cudaErrorInvalidResourceHandle,
551 * ::cudaErrorUnknown,
552 * \notefnerr
553 *
554 * \sa ::cudaGraphicsResourceSetMapFlags
555 */
556extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D10ResourceSetMapFlags(ID3D10Resource *pResource, unsigned int flags);
557
558/**
559 * \brief Gets the dimensions of a registered Direct3D surface
560 *
561 * \deprecated This function is deprecated as of CUDA 3.0.
562 *
563 * Returns in \p *pWidth, \p *pHeight, and \p *pDepth the dimensions of the
564 * subresource of the mapped Direct3D resource \p pResource which corresponds
565 * to \p subResource.
566 *
567 * Since anti-aliased surfaces may have multiple samples per pixel, it is
568 * possible that the dimensions of a resource will be an integer factor larger
569 * than the dimensions reported by the Direct3D runtime.
570 *
571 * The parameters \p pWidth, \p pHeight, and \p pDepth are optional. For 2D
572 * surfaces, the value returned in \p *pDepth will be 0.
573 *
574 * If \p pResource is not of type ::ID3D10Texture1D, ::ID3D10Texture2D, or
575 * ::ID3D10Texture3D, or if \p pResource has not been registered for use with
576 * CUDA, then ::cudaErrorInvalidHandle is returned.
577
578 * For usage requirements of \p subResource parameters see
579 * ::cudaD3D10ResourceGetMappedPointer().
580 *
581 * \param pWidth - Returned width of surface
582 * \param pHeight - Returned height of surface
583 * \param pDepth - Returned depth of surface
584 * \param pResource - Registered resource to access
585 * \param subResource - Subresource of pResource to access
586 *
587 * \return
588 * ::cudaSuccess,
589 * ::cudaErrorInvalidValue,
590 * ::cudaErrorInvalidResourceHandle,
591 * \notefnerr
592 *
593 * \sa ::cudaGraphicsSubResourceGetMappedArray
594 */
595extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D10ResourceGetSurfaceDimensions(size_t *pWidth, size_t *pHeight, size_t *pDepth, ID3D10Resource *pResource, unsigned int subResource);
596
597/**
598 * \brief Gets a pointer through which to access a subresource of a Direct3D
599 * resource which has been mapped for access by CUDA
600 *
601 * \deprecated This function is deprecated as of CUDA 3.0.
602 *
603 * Returns in \p *pPointer the base pointer of the subresource of the mapped
604 * Direct3D resource \p pResource which corresponds to \p subResource. The
605 * value set in \p pPointer may change every time that \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 * ::cudaD3D9RegisterFlagsNone, then ::cudaErrorInvalidResourceHandle is
610 * returned. If \p pResource is not mapped then ::cudaErrorUnknown is returned.
611 *
612 * If \p pResource is of type ::ID3D10Buffer then \p subResource must be 0.
613 * If \p pResource is of any other type, then the value of \p subResource must
614 * come from the subresource calculation in ::D3D10CalcSubResource().
615 *
616 * \param pPointer - Returned pointer corresponding to subresource
617 * \param pResource - Mapped resource to access
618 * \param subResource - Subresource of pResource to access
619 *
620 * \return
621 * ::cudaSuccess,
622 * ::cudaErrorInvalidValue,
623 * ::cudaErrorInvalidResourceHandle,
624 * ::cudaErrorUnknown
625 * \notefnerr
626 *
627 * \sa ::cudaGraphicsResourceGetMappedPointer
628 */
629extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D10ResourceGetMappedPointer(void **pPointer, ID3D10Resource *pResource, unsigned int subResource);
630
631/**
632 * \brief Gets the size of a subresource of a Direct3D resource which has been
633 * mapped for access by CUDA
634 *
635 * \deprecated This function is deprecated as of CUDA 3.0.
636 *
637 * Returns in \p *pSize the size of the subresource of the mapped Direct3D
638 * resource \p pResource which corresponds to \p subResource. The value set in
639 * \p pSize may change every time that \p pResource is mapped.
640 *
641 * If \p pResource has not been registered for use with CUDA then
642 * ::cudaErrorInvalidHandle is returned. If \p pResource was not registered
643 * with usage flags ::cudaD3D10RegisterFlagsNone, then
644 * ::cudaErrorInvalidResourceHandle is returned. If \p pResource is not mapped for
645 * access by CUDA then ::cudaErrorUnknown is returned.
646 *
647 * For usage requirements of the \p subResource parameter see
648 * ::cudaD3D10ResourceGetMappedPointer().
649 *
650 * \param pSize - Returned size of subresource
651 * \param pResource - Mapped resource to access
652 * \param subResource - Subresource of pResource to access
653 *
654 * \return
655 * ::cudaSuccess,
656 * ::cudaErrorInvalidValue,
657 * ::cudaErrorInvalidResourceHandle,
658 * ::cudaErrorUnknown
659 * \notefnerr
660 *
661 * \sa ::cudaGraphicsResourceGetMappedPointer
662 */
663extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D10ResourceGetMappedSize(size_t *pSize, ID3D10Resource *pResource, unsigned int subResource);
664
665/**
666 * \brief Gets the pitch of a subresource of a Direct3D resource which has been
667 * mapped for access by CUDA
668 *
669 * \deprecated This function is deprecated as of CUDA 3.0.
670 *
671 * Returns in \p *pPitch and \p *pPitchSlice the pitch and Z-slice pitch of
672 * the subresource of the mapped Direct3D resource \p pResource, which
673 * corresponds to \p subResource. The values set in \p pPitch and
674 * \p pPitchSlice may change every time that \p pResource is mapped.
675 *
676 * The pitch and Z-slice pitch values may be used to compute the location of a
677 * sample on a surface as follows.
678 *
679 * For a 2D surface, the byte offset of the sample at position \b x, \b y from
680 * the base pointer of the surface is:
681 *
682 * \b y * \b pitch + (<b>bytes per pixel</b>) * \b x
683 *
684 * For a 3D surface, the byte offset of the sample at position \b x, \b y,
685 * \b z from the base pointer of the surface is:
686 *
687 * \b z* \b slicePitch + \b y * \b pitch + (<b>bytes per pixel</b>) * \b x
688 *
689 * Both parameters \p pPitch and \p pPitchSlice are optional and may be set to
690 * NULL.
691 *
692 * If \p pResource is not of type ::ID3D10Texture1D, ::ID3D10Texture2D, or
693 * ::ID3D10Texture3D, or if \p pResource has not been registered for use with
694 * CUDA, then ::cudaErrorInvalidResourceHandle is returned. If \p pResource was
695 * not registered with usage flags ::cudaD3D10RegisterFlagsNone, then
696 * ::cudaErrorInvalidResourceHandle is returned. If \p pResource is not mapped
697 * for access by CUDA then ::cudaErrorUnknown is returned.
698 *
699 * For usage requirements of the \p subResource parameter see
700 * ::cudaD3D10ResourceGetMappedPointer().
701 *
702 * \param pPitch - Returned pitch of subresource
703 * \param pPitchSlice - Returned Z-slice pitch of subresource
704 * \param pResource - Mapped resource to access
705 * \param subResource - Subresource of pResource to access
706 *
707 * \return
708 * ::cudaSuccess,
709 * ::cudaErrorInvalidValue,
710 * ::cudaErrorInvalidResourceHandle,
711 * ::cudaErrorUnknown
712 * \notefnerr
713 *
714 * \sa ::cudaGraphicsSubResourceGetMappedArray
715 */
716extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D10ResourceGetMappedPitch(size_t *pPitch, size_t *pPitchSlice, ID3D10Resource *pResource, unsigned int subResource);
717
718/** @} */ /* END CUDART_D3D10_DEPRECATED */
719
720#if defined(__cplusplus)
721}
722#endif /* __cplusplus */
723
724#undef __dv
725#undef __CUDA_DEPRECATED
726
727#endif /* __CUDA_D3D10_INTEROP_H__ */
728 