<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-us" xml:lang="en-us"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta> <meta http-equiv="X-UA-Compatible" content="IE=edge"></meta> <meta name="copyright" content="(C) Copyright 2005"></meta> <meta name="DC.rights.owner" content="(C) Copyright 2005"></meta> <meta name="DC.Type" content="cppModule"></meta> <meta name="DC.Title" content="Graphics Interoperability"></meta> <meta name="abstract" content=""></meta> <meta name="description" content=""></meta> <meta name="DC.Format" content="XHTML"></meta> <meta name="DC.Identifier" content="group__CUDART__INTEROP"></meta> <link rel="stylesheet" type="text/css" href="../common/formatting/commonltr.css"></link> <link rel="stylesheet" type="text/css" href="../common/formatting/site.css"></link> <title>CUDA Runtime API :: CUDA Toolkit Documentation</title> <!--[if lt IE 9]> <script src="../common/formatting/html5shiv-printshiv.min.js"></script> <![endif]--> <script type="text/javascript" charset="utf-8" src="//assets.adobedtm.com/b92787824f2e0e9b68dc2e993f9bd995339fe417/satelliteLib-7ba51e58dc61bcb0e9311aadd02a0108ab24cc6c.js"></script> <script type="text/javascript" charset="utf-8" src="../common/formatting/jquery.min.js"></script> <script type="text/javascript" charset="utf-8" src="../common/formatting/jquery.ba-hashchange.min.js"></script> <script type="text/javascript" charset="utf-8" src="../common/formatting/jquery.scrollintoview.min.js"></script> <script type="text/javascript" src="../search/htmlFileList.js"></script> <script type="text/javascript" src="../search/htmlFileInfoList.js"></script> <script type="text/javascript" src="../search/nwSearchFnt.min.js"></script> <script type="text/javascript" src="../search/stemmers/en_stemmer.min.js"></script> <script type="text/javascript" src="../search/index-1.js"></script> <script type="text/javascript" src="../search/index-2.js"></script> <script type="text/javascript" src="../search/index-3.js"></script> <link rel="canonical" href="http://docs.nvidia.com/cuda/cuda-runtime-api/index.html"></link> <link rel="stylesheet" type="text/css" href="../common/formatting/qwcode.highlight.css"></link> </head> <body> <header id="header"><span id="company">NVIDIA</span><span id="site-title">CUDA Toolkit Documentation</span><form id="search" method="get" action="search"> <input type="text" name="search-text"></input><fieldset id="search-location"> <legend>Search In:</legend> <label><input type="radio" name="search-type" value="site"></input>Entire Site</label> <label><input type="radio" name="search-type" value="document"></input>Just This Document</label></fieldset> <button type="reset">clear search</button> <button id="submit" type="submit">search</button></form> </header> <div id="site-content"> <nav id="site-nav"> <div class="category closed"><a href="../index.html" title="The root of the site.">CUDA Toolkit v10.1.168</a></div> <div class="category"><a href="index.html" title="CUDA Runtime API">CUDA Runtime API</a></div> <ul> <li> <div class="section-link"><a href="driver-vs-runtime-api.html#driver-vs-runtime-api">1. Difference between the driver and runtime APIs </a></div> </li> <li> <div class="section-link"><a href="api-sync-behavior.html#api-sync-behavior">2. API synchronization behavior </a></div> </li> <li> <div class="section-link"><a href="stream-sync-behavior.html#stream-sync-behavior">3. Stream synchronization behavior</a></div> </li> <li> <div class="section-link"><a href="graphs-thread-safety.html#graphs-thread-safety">4. Graph object thread safety</a></div> </li> <li> <div class="section-link"><a href="modules.html#modules">5. Modules</a></div> <ul> <li> <div class="section-link"><a href="group__CUDART__DEVICE.html#group__CUDART__DEVICE">5.1. Device Management</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__THREAD__DEPRECATED.html#group__CUDART__THREAD__DEPRECATED">5.2. Thread Management [DEPRECATED]</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__ERROR.html#group__CUDART__ERROR">5.3. Error Handling</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__STREAM.html#group__CUDART__STREAM">5.4. Stream Management</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__EVENT.html#group__CUDART__EVENT">5.5. Event Management</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__EXTRES__INTEROP.html#group__CUDART__EXTRES__INTEROP">5.6. External Resource Interoperability</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__EXECUTION.html#group__CUDART__EXECUTION">5.7. Execution Control</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__OCCUPANCY.html#group__CUDART__OCCUPANCY">5.8. Occupancy</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__MEMORY.html#group__CUDART__MEMORY">5.9. Memory Management</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__MEMORY__DEPRECATED.html#group__CUDART__MEMORY__DEPRECATED">5.10. Memory Management [DEPRECATED]</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__UNIFIED.html#group__CUDART__UNIFIED">5.11. Unified Addressing</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__PEER.html#group__CUDART__PEER">5.12. Peer Device Memory Access</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__OPENGL.html#group__CUDART__OPENGL">5.13. OpenGL Interoperability</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__OPENGL__DEPRECATED.html#group__CUDART__OPENGL__DEPRECATED">5.14. OpenGL Interoperability [DEPRECATED]</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__D3D9.html#group__CUDART__D3D9">5.15. Direct3D 9 Interoperability</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__D3D9__DEPRECATED.html#group__CUDART__D3D9__DEPRECATED">5.16. Direct3D 9 Interoperability [DEPRECATED]</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__D3D10.html#group__CUDART__D3D10">5.17. Direct3D 10 Interoperability</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__D3D10__DEPRECATED.html#group__CUDART__D3D10__DEPRECATED">5.18. Direct3D 10 Interoperability [DEPRECATED]</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__D3D11.html#group__CUDART__D3D11">5.19. Direct3D 11 Interoperability</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__D3D11__DEPRECATED.html#group__CUDART__D3D11__DEPRECATED">5.20. Direct3D 11 Interoperability [DEPRECATED]</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__VDPAU.html#group__CUDART__VDPAU">5.21. VDPAU Interoperability</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__EGL.html#group__CUDART__EGL">5.22. EGL Interoperability</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__INTEROP.html#group__CUDART__INTEROP">5.23. Graphics Interoperability</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__TEXTURE.html#group__CUDART__TEXTURE">5.24. Texture Reference Management [DEPRECATED]</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__SURFACE.html#group__CUDART__SURFACE">5.25. Surface Reference Management [DEPRECATED]</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__TEXTURE__OBJECT.html#group__CUDART__TEXTURE__OBJECT">5.26. Texture Object Management</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__SURFACE__OBJECT.html#group__CUDART__SURFACE__OBJECT">5.27. Surface Object Management</a></div> </li> <li> <div class="section-link"><a href="group__CUDART____VERSION.html#group__CUDART____VERSION">5.28. Version Management</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__GRAPH.html#group__CUDART__GRAPH">5.29. Graph Management</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL">5.30. C++ API Routines</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__DRIVER.html#group__CUDART__DRIVER">5.31. Interactions with the CUDA Driver API</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__PROFILER.html#group__CUDART__PROFILER">5.32. Profiler Control</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__TYPES.html#group__CUDART__TYPES">5.33. Data types used by CUDA Runtime</a></div> </li> </ul> </li> <li> <div class="section-link"><a href="annotated.html#annotated">6. Data Structures</a></div> <ul> <li> <div class="section-link"><a href="class____cudaOccupancyB2DHelper.html#class____cudaOccupancyB2DHelper">6.1. __cudaOccupancyB2DHelper</a></div> </li> <li> <div class="section-link"><a href="structcudaChannelFormatDesc.html#structcudaChannelFormatDesc">6.2. cudaChannelFormatDesc</a></div> </li> <li> <div class="section-link"><a href="structcudaDeviceProp.html#structcudaDeviceProp">6.3. cudaDeviceProp</a></div> </li> <li> <div class="section-link"><a href="structcudaEglFrame.html#structcudaEglFrame">6.4. cudaEglFrame</a></div> </li> <li> <div class="section-link"><a href="structcudaEglPlaneDesc.html#structcudaEglPlaneDesc">6.5. cudaEglPlaneDesc</a></div> </li> <li> <div class="section-link"><a href="structcudaExtent.html#structcudaExtent">6.6. cudaExtent</a></div> </li> <li> <div class="section-link"><a href="structcudaExternalMemoryBufferDesc.html#structcudaExternalMemoryBufferDesc">6.7. cudaExternalMemoryBufferDesc</a></div> </li> <li> <div class="section-link"><a href="structcudaExternalMemoryHandleDesc.html#structcudaExternalMemoryHandleDesc">6.8. cudaExternalMemoryHandleDesc</a></div> </li> <li> <div class="section-link"><a href="structcudaExternalMemoryMipmappedArrayDesc.html#structcudaExternalMemoryMipmappedArrayDesc">6.9. cudaExternalMemoryMipmappedArrayDesc</a></div> </li> <li> <div class="section-link"><a href="structcudaExternalSemaphoreHandleDesc.html#structcudaExternalSemaphoreHandleDesc">6.10. cudaExternalSemaphoreHandleDesc</a></div> </li> <li> <div class="section-link"><a href="structcudaExternalSemaphoreSignalParams.html#structcudaExternalSemaphoreSignalParams">6.11. cudaExternalSemaphoreSignalParams</a></div> </li> <li> <div class="section-link"><a href="structcudaExternalSemaphoreWaitParams.html#structcudaExternalSemaphoreWaitParams">6.12. cudaExternalSemaphoreWaitParams</a></div> </li> <li> <div class="section-link"><a href="structcudaFuncAttributes.html#structcudaFuncAttributes">6.13. cudaFuncAttributes</a></div> </li> <li> <div class="section-link"><a href="structcudaHostNodeParams.html#structcudaHostNodeParams">6.14. cudaHostNodeParams</a></div> </li> <li> <div class="section-link"><a href="structcudaIpcEventHandle__t.html#structcudaIpcEventHandle__t">6.15. cudaIpcEventHandle_t</a></div> </li> <li> <div class="section-link"><a href="structcudaIpcMemHandle__t.html#structcudaIpcMemHandle__t">6.16. cudaIpcMemHandle_t</a></div> </li> <li> <div class="section-link"><a href="structcudaKernelNodeParams.html#structcudaKernelNodeParams">6.17. cudaKernelNodeParams</a></div> </li> <li> <div class="section-link"><a href="structcudaLaunchParams.html#structcudaLaunchParams">6.18. cudaLaunchParams</a></div> </li> <li> <div class="section-link"><a href="structcudaMemcpy3DParms.html#structcudaMemcpy3DParms">6.19. cudaMemcpy3DParms</a></div> </li> <li> <div class="section-link"><a href="structcudaMemcpy3DPeerParms.html#structcudaMemcpy3DPeerParms">6.20. cudaMemcpy3DPeerParms</a></div> </li> <li> <div class="section-link"><a href="structcudaMemsetParams.html#structcudaMemsetParams">6.21. cudaMemsetParams</a></div> </li> <li> <div class="section-link"><a href="structcudaPitchedPtr.html#structcudaPitchedPtr">6.22. cudaPitchedPtr</a></div> </li> <li> <div class="section-link"><a href="structcudaPointerAttributes.html#structcudaPointerAttributes">6.23. cudaPointerAttributes</a></div> </li> <li> <div class="section-link"><a href="structcudaPos.html#structcudaPos">6.24. cudaPos</a></div> </li> <li> <div class="section-link"><a href="structcudaResourceDesc.html#structcudaResourceDesc">6.25. cudaResourceDesc</a></div> </li> <li> <div class="section-link"><a href="structcudaResourceViewDesc.html#structcudaResourceViewDesc">6.26. cudaResourceViewDesc</a></div> </li> <li> <div class="section-link"><a href="structcudaTextureDesc.html#structcudaTextureDesc">6.27. cudaTextureDesc</a></div> </li> <li> <div class="section-link"><a href="structCUuuid__st.html#structCUuuid__st">6.28. CUuuid_st</a></div> </li> <li> <div class="section-link"><a href="structsurfaceReference.html#structsurfaceReference">6.29. surfaceReference</a></div> </li> <li> <div class="section-link"><a href="structtextureReference.html#structtextureReference">6.30. textureReference</a></div> </li> </ul> </li> <li> <div class="section-link"><a href="functions.html#functions">7. Data Fields</a></div> </li> <li> <div class="section-link"><a href="deprecated.html#deprecated">8. Deprecated List</a></div> </li> <li> <div class="section-link"><a href="notices-header.html#notices-header">Notices</a></div> <ul></ul> </li> </ul> </nav> <div id="resize-nav"></div> <nav id="search-results"> <h2>Search Results</h2> <ol></ol> </nav> <div id="contents-container"> <div id="breadcrumbs-container"> <div id="breadcrumbs"><a href="group__CUDART__EGL.html" shape="rect">< Previous</a> | <a href="group__CUDART__TEXTURE.html" shape="rect">Next ></a></div> <div id="release-info">CUDA Runtime API (<a href="../../pdf/CUDA_Runtime_API.pdf">PDF</a>) - v10.1.168 (<a href="https://developer.nvidia.com/cuda-toolkit-archive">older</a>) - Last updated April 24, 2019 - <a href="mailto:CUDAIssues@nvidia.com?subject=CUDA Toolkit Documentation Feedback: CUDA Runtime API">Send Feedback</a></div> </div> <article id="contents"> <div class="topic reference apiRef apiPackage cppModule" id="group__CUDART__INTEROP"><a name="group__CUDART__INTEROP" shape="rect"> <!-- --></a><h2 class="topictitle2 cppModule">5.23. Graphics Interoperability</h2> <div class="section"> <p>This section describes the graphics interoperability functions of the CUDA runtime application programming interface. </p> </div> <h3 class="fake_sectiontitle member_header">Functions</h3> <dl class="members"> <dt><span class="member_type"><span class="keyword keyword apiItemName">__host__</span> <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf599e5b8b829ce7db0f5216928f6ecb6" title="" shape="rect">cudaError_t</a> </span><span class="member_name"><a href="#group__CUDART__INTEROP_1gad8fbe74d02adefb8e7efb4971ee6322" shape="rect">cudaGraphicsMapResources</a> ( int <span> </span><span class="keyword keyword apiItemName">count</span>, <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf58dd8d3c7a65714ff7f5459adbf7e6f" title="" shape="rect">cudaGraphicsResource_t</a>*<span> </span><span class="keyword keyword apiItemName">resources</span>, <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1ge15d9c8b7a240312b533d6122558085a" title="" shape="rect">cudaStream_t</a><span> </span><span class="keyword keyword apiItemName">stream</span> = <span class="ph ph apiData">0</span> ) </span></dt> <dd class="shortdesc"><span></span><span class="desc">Map graphics resources for access by CUDA. </span></dd> <dt><span class="member_type"><span class="keyword keyword apiItemName">__host__</span> <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf599e5b8b829ce7db0f5216928f6ecb6" title="" shape="rect">cudaError_t</a> </span><span class="member_name"><a href="#group__CUDART__INTEROP_1g84c3772d2ed06cda8c92bc43cdc893d0" shape="rect">cudaGraphicsResourceGetMappedMipmappedArray</a> ( <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1g1b03ad14fc0ab86f8b033837f5562d8a" title="" shape="rect">cudaMipmappedArray_t</a>*<span> </span><span class="keyword keyword apiItemName">mipmappedArray</span>, <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf58dd8d3c7a65714ff7f5459adbf7e6f" title="" shape="rect">cudaGraphicsResource_t</a><span> </span><span class="keyword keyword apiItemName">resource</span> ) </span></dt> <dd class="shortdesc"><span></span><span class="desc">Get a mipmapped array through which to access a mapped graphics resource. </span></dd> <dt><span class="member_type"><span class="keyword keyword apiItemName">__host__</span> <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf599e5b8b829ce7db0f5216928f6ecb6" title="" shape="rect">cudaError_t</a> </span><span class="member_name"><a href="#group__CUDART__INTEROP_1ga36881081c8deb4df25c256158e1ac99" shape="rect">cudaGraphicsResourceGetMappedPointer</a> ( void**<span> </span><span class="keyword keyword apiItemName">devPtr</span>, size_t*<span> </span><span class="keyword keyword apiItemName">size</span>, <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf58dd8d3c7a65714ff7f5459adbf7e6f" title="" shape="rect">cudaGraphicsResource_t</a><span> </span><span class="keyword keyword apiItemName">resource</span> ) </span></dt> <dd class="shortdesc"><span></span><span class="desc">Get an device pointer through which to access a mapped graphics resource. </span></dd> <dt><span class="member_type"><span class="keyword keyword apiItemName">__host__</span> <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf599e5b8b829ce7db0f5216928f6ecb6" title="" shape="rect">cudaError_t</a> </span><span class="member_name"><a href="#group__CUDART__INTEROP_1g5f94a0043909fddc100ab5f0c2476b9f" shape="rect">cudaGraphicsResourceSetMapFlags</a> ( <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf58dd8d3c7a65714ff7f5459adbf7e6f" title="" shape="rect">cudaGraphicsResource_t</a><span> </span><span class="keyword keyword apiItemName">resource</span>, unsigned int <span> </span><span class="keyword keyword apiItemName">flags</span> ) </span></dt> <dd class="shortdesc"><span></span><span class="desc">Set usage flags for mapping a graphics resource. </span></dd> <dt><span class="member_type"><span class="keyword keyword apiItemName">__host__</span> <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf599e5b8b829ce7db0f5216928f6ecb6" title="" shape="rect">cudaError_t</a> </span><span class="member_name"><a href="#group__CUDART__INTEROP_1g0dd6b5f024dfdcff5c28a08ef9958031" shape="rect">cudaGraphicsSubResourceGetMappedArray</a> ( <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gaf8b3ba752727d996074a71ee997ce68" title="" shape="rect">cudaArray_t</a>*<span> </span><span class="keyword keyword apiItemName">array</span>, <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf58dd8d3c7a65714ff7f5459adbf7e6f" title="" shape="rect">cudaGraphicsResource_t</a><span> </span><span class="keyword keyword apiItemName">resource</span>, unsigned int <span> </span><span class="keyword keyword apiItemName">arrayIndex</span>, unsigned int <span> </span><span class="keyword keyword apiItemName">mipLevel</span> ) </span></dt> <dd class="shortdesc"><span></span><span class="desc">Get an array through which to access a subresource of a mapped graphics resource. </span></dd> <dt><span class="member_type"><span class="keyword keyword apiItemName">__host__</span> <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf599e5b8b829ce7db0f5216928f6ecb6" title="" shape="rect">cudaError_t</a> </span><span class="member_name"><a href="#group__CUDART__INTEROP_1g11988ab4431b11ddb7cbde7aedb60491" shape="rect">cudaGraphicsUnmapResources</a> ( int <span> </span><span class="keyword keyword apiItemName">count</span>, <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf58dd8d3c7a65714ff7f5459adbf7e6f" title="" shape="rect">cudaGraphicsResource_t</a>*<span> </span><span class="keyword keyword apiItemName">resources</span>, <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1ge15d9c8b7a240312b533d6122558085a" title="" shape="rect">cudaStream_t</a><span> </span><span class="keyword keyword apiItemName">stream</span> = <span class="ph ph apiData">0</span> ) </span></dt> <dd class="shortdesc"><span></span><span class="desc">Unmap graphics resources. </span></dd> <dt><span class="member_type"><span class="keyword keyword apiItemName">__host__</span> <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf599e5b8b829ce7db0f5216928f6ecb6" title="" shape="rect">cudaError_t</a> </span><span class="member_name"><a href="#group__CUDART__INTEROP_1gc65d1f2900086747de1e57301d709940" shape="rect">cudaGraphicsUnregisterResource</a> ( <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf58dd8d3c7a65714ff7f5459adbf7e6f" title="" shape="rect">cudaGraphicsResource_t</a><span> </span><span class="keyword keyword apiItemName">resource</span> ) </span></dt> <dd class="shortdesc"><span></span><span class="desc">Unregisters a graphics resource for access by CUDA. </span></dd> </dl> <div class="description"> <h3 class="sectiontitle">Functions</h3> <dl class="description"> <dt class="description"><a name="group__CUDART__INTEROP_1gad8fbe74d02adefb8e7efb4971ee6322" id="group__CUDART__INTEROP_1gad8fbe74d02adefb8e7efb4971ee6322" shape="rect"> <!-- --></a><span><span class="keyword keyword apiItemName">__host__</span> <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf599e5b8b829ce7db0f5216928f6ecb6" title="" shape="rect">cudaError_t</a> cudaGraphicsMapResources ( int <span> </span><span class="keyword keyword apiItemName">count</span>, <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf58dd8d3c7a65714ff7f5459adbf7e6f" title="" shape="rect">cudaGraphicsResource_t</a>*<span> </span><span class="keyword keyword apiItemName">resources</span>, <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1ge15d9c8b7a240312b533d6122558085a" title="" shape="rect">cudaStream_t</a><span> </span><span class="keyword keyword apiItemName">stream</span> = <span class="ph ph apiData">0</span> ) </span></dt> <dd class="description"> <div class="section">Map graphics resources for access by CUDA. </div> <div class="section"> <h6 class="parameter_header"> Parameters </h6> <dl class="table-display-params"> <dt><tt class="code"><span class="keyword keyword apiItemName">count</span></tt></dt> <dd>- Number of resources to map </dd> <dt><tt class="code"><span class="keyword keyword apiItemName">resources</span></tt></dt> <dd>- Resources to map for CUDA </dd> <dt><tt class="code"><span class="keyword keyword apiItemName">stream</span></tt></dt> <dd>- Stream for synchronization</dd> </dl> </div> <div class="section"> <h6 class="return_header">Returns</h6> <p class="return"><a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038e355f04607d824883b4a50662830d591" shape="rect">cudaSuccess</a>, <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038c4673247aee4d1ab8d07871f376e0273" shape="rect">cudaErrorInvalidResourceHandle</a>, <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e00382e491daacef266c7b3e3c1e140a6133c" shape="rect">cudaErrorUnknown</a></p> </div> <div class="section"> <h6 class="description_header">Description</h6> <p>Maps the <tt class="ph tt code">count</tt> graphics resources in <tt class="ph tt code">resources</tt> for access by CUDA. </p> <p class="p">The resources in <tt class="ph tt code">resources</tt> may be accessed by CUDA until they are unmapped. The graphics API from which <tt class="ph tt code">resources</tt> were registered should not access any resources while they are mapped by CUDA. If an application does so, the results are undefined. </p> <p class="p">This function provides the synchronization guarantee that any graphics calls issued before <a class="xref" href="group__CUDART__INTEROP.html#group__CUDART__INTEROP_1gad8fbe74d02adefb8e7efb4971ee6322" title="Map graphics resources for access by CUDA." shape="rect">cudaGraphicsMapResources()</a> will complete before any subsequent CUDA work issued in <tt class="ph tt code">stream</tt> begins. </p> <p class="p">If <tt class="ph tt code">resources</tt> contains any duplicate entries then <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038c4673247aee4d1ab8d07871f376e0273" shape="rect">cudaErrorInvalidResourceHandle</a> is returned. If any of <tt class="ph tt code">resources</tt> are presently mapped for access by CUDA then <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e00382e491daacef266c7b3e3c1e140a6133c" shape="rect">cudaErrorUnknown</a> is returned. </p> <p class="p"></p> <p class="p"></p> <p class="p"> <div class="note note"><span class="notetitle">Note:</span><ul class="ul"> <li class="li"> <p class="p">This function uses standard <a class="xref xmlonly" href="stream-sync-behavior.html#stream-sync-behavior__default-stream" shape="rect">default stream</a> semantics. </p> </li> <li class="li"> <p class="p">Note that this function may also return error codes from previous, asynchronous launches. </p> </li> <li class="li"> <p class="p">Note that this function may also return <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038ce7993a88ecf2c57b8102d55d997a18c" shape="rect">cudaErrorInitializationError</a>, <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038f5e52d1774934b77ba55d2aa2c063067" shape="rect">cudaErrorInsufficientDriver</a> or <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038e942e4cbbd2bef6e92e293253f055613" shape="rect">cudaErrorNoDevice</a> if this call tries to initialize internal CUDA RT state. </p> </li> <li class="li"> <p class="p">Note that as specified by <a class="xref" href="group__CUDART__STREAM.html#group__CUDART__STREAM_1g74aa9f4b1c2f12d994bf13876a5a2498" title="Add a callback to a compute stream." shape="rect">cudaStreamAddCallback</a> no CUDA function may be called from callback. <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e003867b6095ab719b21659a400b553963eb3" shape="rect">cudaErrorNotPermitted</a> may, but is not guaranteed to, be returned as a diagnostic in such case. </p> </li> </ul> </div> </p> <p class="p"></p> <p class="p apiDesc_subtitle"><strong class="ph b">See also:</strong></p> <p class="p see_subsection"><a class="xref" href="group__CUDART__INTEROP.html#group__CUDART__INTEROP_1ga36881081c8deb4df25c256158e1ac99" title="Get an device pointer through which to access a mapped graphics resource." shape="rect">cudaGraphicsResourceGetMappedPointer</a>, <a class="xref" href="group__CUDART__INTEROP.html#group__CUDART__INTEROP_1g0dd6b5f024dfdcff5c28a08ef9958031" title="Get an array through which to access a subresource of a mapped graphics resource." shape="rect">cudaGraphicsSubResourceGetMappedArray</a>, <a class="xref" href="group__CUDART__INTEROP.html#group__CUDART__INTEROP_1g11988ab4431b11ddb7cbde7aedb60491" title="Unmap graphics resources." shape="rect">cudaGraphicsUnmapResources</a>, <a class="xref" href="../cuda-driver-api/group__CUDA__GRAPHICS.html#group__CUDA__GRAPHICS_1gffcfd8e78d82cc4f6dd987e8bce4edb0" target="_blank" shape="rect">cuGraphicsMapResources</a></p> <p class="p"></p> </div> </dd> <dt class="description"><a name="group__CUDART__INTEROP_1g84c3772d2ed06cda8c92bc43cdc893d0" id="group__CUDART__INTEROP_1g84c3772d2ed06cda8c92bc43cdc893d0" shape="rect"> <!-- --></a><span><span class="keyword keyword apiItemName">__host__</span> <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf599e5b8b829ce7db0f5216928f6ecb6" title="" shape="rect">cudaError_t</a> cudaGraphicsResourceGetMappedMipmappedArray ( <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1g1b03ad14fc0ab86f8b033837f5562d8a" title="" shape="rect">cudaMipmappedArray_t</a>*<span> </span><span class="keyword keyword apiItemName">mipmappedArray</span>, <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf58dd8d3c7a65714ff7f5459adbf7e6f" title="" shape="rect">cudaGraphicsResource_t</a><span> </span><span class="keyword keyword apiItemName">resource</span> ) </span></dt> <dd class="description"> <div class="section">Get a mipmapped array through which to access a mapped graphics resource. </div> <div class="section"> <h6 class="parameter_header"> Parameters </h6> <dl class="table-display-params"> <dt><tt class="code"><span class="keyword keyword apiItemName">mipmappedArray</span></tt></dt> <dd>- Returned mipmapped array through which <tt class="ph tt code">resource</tt> may be accessed </dd> <dt><tt class="code"><span class="keyword keyword apiItemName">resource</span></tt></dt> <dd>- Mapped resource to access</dd> </dl> </div> <div class="section"> <h6 class="return_header">Returns</h6> <p class="return"><a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038e355f04607d824883b4a50662830d591" shape="rect">cudaSuccess</a>, <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e00383e8aef5398ee38e28ed41e357b48917c" shape="rect">cudaErrorInvalidValue</a>, <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038c4673247aee4d1ab8d07871f376e0273" shape="rect">cudaErrorInvalidResourceHandle</a>, <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e00382e491daacef266c7b3e3c1e140a6133c" shape="rect">cudaErrorUnknown</a></p> </div> <div class="section"> <h6 class="description_header">Description</h6> <p>Returns in <tt class="ph tt code">*mipmappedArray</tt> a mipmapped array through which the mapped graphics resource <tt class="ph tt code">resource</tt> may be accessed. The value set in <tt class="ph tt code">mipmappedArray</tt> may change every time that <tt class="ph tt code">resource</tt> is mapped. </p> <p class="p">If <tt class="ph tt code">resource</tt> is not a texture then it cannot be accessed via an array and <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e00382e491daacef266c7b3e3c1e140a6133c" shape="rect">cudaErrorUnknown</a> is returned. If <tt class="ph tt code">resource</tt> is not mapped then <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e00382e491daacef266c7b3e3c1e140a6133c" shape="rect">cudaErrorUnknown</a> is returned. </p> <p class="p"></p> <p class="p"></p> <p class="p"> <div class="note note"><span class="notetitle">Note:</span><ul class="ul"> <li class="li"> <p class="p">Note that this function may also return error codes from previous, asynchronous launches. </p> </li> <li class="li"> <p class="p">Note that this function may also return <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038ce7993a88ecf2c57b8102d55d997a18c" shape="rect">cudaErrorInitializationError</a>, <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038f5e52d1774934b77ba55d2aa2c063067" shape="rect">cudaErrorInsufficientDriver</a> or <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038e942e4cbbd2bef6e92e293253f055613" shape="rect">cudaErrorNoDevice</a> if this call tries to initialize internal CUDA RT state. </p> </li> <li class="li"> <p class="p">Note that as specified by <a class="xref" href="group__CUDART__STREAM.html#group__CUDART__STREAM_1g74aa9f4b1c2f12d994bf13876a5a2498" title="Add a callback to a compute stream." shape="rect">cudaStreamAddCallback</a> no CUDA function may be called from callback. <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e003867b6095ab719b21659a400b553963eb3" shape="rect">cudaErrorNotPermitted</a> may, but is not guaranteed to, be returned as a diagnostic in such case. </p> </li> </ul> </div> </p> <p class="p"></p> <p class="p apiDesc_subtitle"><strong class="ph b">See also:</strong></p> <p class="p see_subsection"><a class="xref" href="group__CUDART__INTEROP.html#group__CUDART__INTEROP_1ga36881081c8deb4df25c256158e1ac99" title="Get an device pointer through which to access a mapped graphics resource." shape="rect">cudaGraphicsResourceGetMappedPointer</a>, <a class="xref" href="../cuda-driver-api/group__CUDA__GRAPHICS.html#group__CUDA__GRAPHICS_1g37680bbe89c7fe5c613563eaab9d14c1" target="_blank" shape="rect">cuGraphicsResourceGetMappedMipmappedArray</a></p> <p class="p"></p> </div> </dd> <dt class="description"><a name="group__CUDART__INTEROP_1ga36881081c8deb4df25c256158e1ac99" id="group__CUDART__INTEROP_1ga36881081c8deb4df25c256158e1ac99" shape="rect"> <!-- --></a><span><span class="keyword keyword apiItemName">__host__</span> <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf599e5b8b829ce7db0f5216928f6ecb6" title="" shape="rect">cudaError_t</a> cudaGraphicsResourceGetMappedPointer ( void**<span> </span><span class="keyword keyword apiItemName">devPtr</span>, size_t*<span> </span><span class="keyword keyword apiItemName">size</span>, <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf58dd8d3c7a65714ff7f5459adbf7e6f" title="" shape="rect">cudaGraphicsResource_t</a><span> </span><span class="keyword keyword apiItemName">resource</span> ) </span></dt> <dd class="description"> <div class="section">Get an device pointer through which to access a mapped graphics resource. </div> <div class="section"> <h6 class="parameter_header"> Parameters </h6> <dl class="table-display-params"> <dt><tt class="code"><span class="keyword keyword apiItemName">devPtr</span></tt></dt> <dd>- Returned pointer through which <tt class="ph tt code">resource</tt> may be accessed </dd> <dt><tt class="code"><span class="keyword keyword apiItemName">size</span></tt></dt> <dd>- Returned size of the buffer accessible starting at <tt class="ph tt code">*devPtr</tt></dd> <dt><tt class="code"><span class="keyword keyword apiItemName">resource</span></tt></dt> <dd>- Mapped resource to access</dd> </dl> </div> <div class="section"> <h6 class="return_header">Returns</h6> <p class="return"><a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038e355f04607d824883b4a50662830d591" shape="rect">cudaSuccess</a>, <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e00383e8aef5398ee38e28ed41e357b48917c" shape="rect">cudaErrorInvalidValue</a>, <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038c4673247aee4d1ab8d07871f376e0273" shape="rect">cudaErrorInvalidResourceHandle</a>, <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e00382e491daacef266c7b3e3c1e140a6133c" shape="rect">cudaErrorUnknown</a></p> </div> <div class="section"> <h6 class="description_header">Description</h6> <p>Returns in <tt class="ph tt code">*devPtr</tt> a pointer through which the mapped graphics resource <tt class="ph tt code">resource</tt> may be accessed. Returns in <tt class="ph tt code">*size</tt> the size of the memory in bytes which may be accessed from that pointer. The value set in <tt class="ph tt code">devPtr</tt> may change every time that <tt class="ph tt code">resource</tt> is mapped. </p> <p class="p">If <tt class="ph tt code">resource</tt> is not a buffer then it cannot be accessed via a pointer and <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e00382e491daacef266c7b3e3c1e140a6133c" shape="rect">cudaErrorUnknown</a> is returned. If <tt class="ph tt code">resource</tt> is not mapped then <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e00382e491daacef266c7b3e3c1e140a6133c" shape="rect">cudaErrorUnknown</a> is returned. * </p> <p class="p"></p> <p class="p"> <div class="note note"><span class="notetitle">Note:</span><ul class="ul"> <li class="li"> <p class="p">Note that this function may also return error codes from previous, asynchronous launches. </p> </li> <li class="li"> <p class="p">Note that this function may also return <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038ce7993a88ecf2c57b8102d55d997a18c" shape="rect">cudaErrorInitializationError</a>, <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038f5e52d1774934b77ba55d2aa2c063067" shape="rect">cudaErrorInsufficientDriver</a> or <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038e942e4cbbd2bef6e92e293253f055613" shape="rect">cudaErrorNoDevice</a> if this call tries to initialize internal CUDA RT state. </p> </li> <li class="li"> <p class="p">Note that as specified by <a class="xref" href="group__CUDART__STREAM.html#group__CUDART__STREAM_1g74aa9f4b1c2f12d994bf13876a5a2498" title="Add a callback to a compute stream." shape="rect">cudaStreamAddCallback</a> no CUDA function may be called from callback. <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e003867b6095ab719b21659a400b553963eb3" shape="rect">cudaErrorNotPermitted</a> may, but is not guaranteed to, be returned as a diagnostic in such case. </p> </li> </ul> </div> </p> <p class="p"></p> <p class="p apiDesc_subtitle"><strong class="ph b">See also:</strong></p> <p class="p see_subsection"><a class="xref" href="group__CUDART__INTEROP.html#group__CUDART__INTEROP_1gad8fbe74d02adefb8e7efb4971ee6322" title="Map graphics resources for access by CUDA." shape="rect">cudaGraphicsMapResources</a>, <a class="xref" href="group__CUDART__INTEROP.html#group__CUDART__INTEROP_1g0dd6b5f024dfdcff5c28a08ef9958031" title="Get an array through which to access a subresource of a mapped graphics resource." shape="rect">cudaGraphicsSubResourceGetMappedArray</a>, <a class="xref" href="../cuda-driver-api/group__CUDA__GRAPHICS.html#group__CUDA__GRAPHICS_1g8a634cf4150d399f0018061580592457" target="_blank" shape="rect">cuGraphicsResourceGetMappedPointer</a></p> <p class="p"></p> </div> </dd> <dt class="description"><a name="group__CUDART__INTEROP_1g5f94a0043909fddc100ab5f0c2476b9f" id="group__CUDART__INTEROP_1g5f94a0043909fddc100ab5f0c2476b9f" shape="rect"> <!-- --></a><span><span class="keyword keyword apiItemName">__host__</span> <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf599e5b8b829ce7db0f5216928f6ecb6" title="" shape="rect">cudaError_t</a> cudaGraphicsResourceSetMapFlags ( <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf58dd8d3c7a65714ff7f5459adbf7e6f" title="" shape="rect">cudaGraphicsResource_t</a><span> </span><span class="keyword keyword apiItemName">resource</span>, unsigned int <span> </span><span class="keyword keyword apiItemName">flags</span> ) </span></dt> <dd class="description"> <div class="section">Set usage flags for mapping a graphics resource. </div> <div class="section"> <h6 class="parameter_header"> Parameters </h6> <dl class="table-display-params"> <dt><tt class="code"><span class="keyword keyword apiItemName">resource</span></tt></dt> <dd>- Registered resource to set flags for </dd> <dt><tt class="code"><span class="keyword keyword apiItemName">flags</span></tt></dt> <dd>- Parameters for resource mapping</dd> </dl> </div> <div class="section"> <h6 class="return_header">Returns</h6> <p class="return"><a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038e355f04607d824883b4a50662830d591" shape="rect">cudaSuccess</a>, <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e00383e8aef5398ee38e28ed41e357b48917c" shape="rect">cudaErrorInvalidValue</a>, <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038c4673247aee4d1ab8d07871f376e0273" shape="rect">cudaErrorInvalidResourceHandle</a>, <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e00382e491daacef266c7b3e3c1e140a6133c" shape="rect">cudaErrorUnknown</a>, </p> </div> <div class="section"> <h6 class="description_header">Description</h6> <p>Set <tt class="ph tt code">flags</tt> for mapping the graphics resource <tt class="ph tt code">resource</tt>. </p> <p class="p">Changes to <tt class="ph tt code">flags</tt> will take effect the next time <tt class="ph tt code">resource</tt> is mapped. The <tt class="ph tt code">flags</tt> argument may be any of the following: <ul class="ul"> <li class="li"> <p class="p"><a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg2c3c3a69caaf333d29d0b38b75de5ffd81ae074138583e9421692bec52bfe44b" shape="rect">cudaGraphicsMapFlagsNone</a>: Specifies no hints about how <tt class="ph tt code">resource</tt> will be used. It is therefore assumed that CUDA may read from or write to <tt class="ph tt code">resource</tt>. </p> </li> <li class="li"> <p class="p"><a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg2c3c3a69caaf333d29d0b38b75de5ffde34096084cfafea1399b5682efd8b74c" shape="rect">cudaGraphicsMapFlagsReadOnly</a>: Specifies that CUDA will not write to <tt class="ph tt code">resource</tt>. </p> </li> <li class="li"> <p class="p"><a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg2c3c3a69caaf333d29d0b38b75de5ffd3d4fa7699e964ffc201daac20d2ecd6b" shape="rect">cudaGraphicsMapFlagsWriteDiscard</a>: Specifies CUDA will not read from <tt class="ph tt code">resource</tt> and will write over the entire contents of <tt class="ph tt code">resource</tt>, so none of the data previously stored in <tt class="ph tt code">resource</tt> will be preserved. </p> </li> </ul> </p> <p class="p">If <tt class="ph tt code">resource</tt> is presently mapped for access by CUDA then <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e00382e491daacef266c7b3e3c1e140a6133c" shape="rect">cudaErrorUnknown</a> is returned. If <tt class="ph tt code">flags</tt> is not one of the above values then <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e00383e8aef5398ee38e28ed41e357b48917c" shape="rect">cudaErrorInvalidValue</a> is returned. </p> <p class="p"></p> <p class="p"></p> <p class="p"> <div class="note note"><span class="notetitle">Note:</span><ul class="ul"> <li class="li"> <p class="p">Note that this function may also return error codes from previous, asynchronous launches. </p> </li> <li class="li"> <p class="p">Note that this function may also return <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038ce7993a88ecf2c57b8102d55d997a18c" shape="rect">cudaErrorInitializationError</a>, <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038f5e52d1774934b77ba55d2aa2c063067" shape="rect">cudaErrorInsufficientDriver</a> or <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038e942e4cbbd2bef6e92e293253f055613" shape="rect">cudaErrorNoDevice</a> if this call tries to initialize internal CUDA RT state. </p> </li> <li class="li"> <p class="p">Note that as specified by <a class="xref" href="group__CUDART__STREAM.html#group__CUDART__STREAM_1g74aa9f4b1c2f12d994bf13876a5a2498" title="Add a callback to a compute stream." shape="rect">cudaStreamAddCallback</a> no CUDA function may be called from callback. <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e003867b6095ab719b21659a400b553963eb3" shape="rect">cudaErrorNotPermitted</a> may, but is not guaranteed to, be returned as a diagnostic in such case. </p> </li> </ul> </div> </p> <p class="p"></p> <p class="p apiDesc_subtitle"><strong class="ph b">See also:</strong></p> <p class="p see_subsection"><a class="xref" href="group__CUDART__INTEROP.html#group__CUDART__INTEROP_1gad8fbe74d02adefb8e7efb4971ee6322" title="Map graphics resources for access by CUDA." shape="rect">cudaGraphicsMapResources</a>, <a class="xref" href="../cuda-driver-api/group__CUDA__GRAPHICS.html#group__CUDA__GRAPHICS_1gfe96aa7747f8b11d44a6fa6a851e1b39" target="_blank" shape="rect">cuGraphicsResourceSetMapFlags</a></p> <p class="p"></p> </div> </dd> <dt class="description"><a name="group__CUDART__INTEROP_1g0dd6b5f024dfdcff5c28a08ef9958031" id="group__CUDART__INTEROP_1g0dd6b5f024dfdcff5c28a08ef9958031" shape="rect"> <!-- --></a><span><span class="keyword keyword apiItemName">__host__</span> <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf599e5b8b829ce7db0f5216928f6ecb6" title="" shape="rect">cudaError_t</a> cudaGraphicsSubResourceGetMappedArray ( <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gaf8b3ba752727d996074a71ee997ce68" title="" shape="rect">cudaArray_t</a>*<span> </span><span class="keyword keyword apiItemName">array</span>, <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf58dd8d3c7a65714ff7f5459adbf7e6f" title="" shape="rect">cudaGraphicsResource_t</a><span> </span><span class="keyword keyword apiItemName">resource</span>, unsigned int <span> </span><span class="keyword keyword apiItemName">arrayIndex</span>, unsigned int <span> </span><span class="keyword keyword apiItemName">mipLevel</span> ) </span></dt> <dd class="description"> <div class="section">Get an array through which to access a subresource of a mapped graphics resource. </div> <div class="section"> <h6 class="parameter_header"> Parameters </h6> <dl class="table-display-params"> <dt><tt class="code"><span class="keyword keyword apiItemName">array</span></tt></dt> <dd>- Returned array through which a subresource of <tt class="ph tt code">resource</tt> may be accessed </dd> <dt><tt class="code"><span class="keyword keyword apiItemName">resource</span></tt></dt> <dd>- Mapped resource to access </dd> <dt><tt class="code"><span class="keyword keyword apiItemName">arrayIndex</span></tt></dt> <dd>- Array index for array textures or cubemap face index as defined by <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gbf3ce16a621826a09263b8a58902fee8" shape="rect">cudaGraphicsCubeFace</a> for cubemap textures for the subresource to access </dd> <dt><tt class="code"><span class="keyword keyword apiItemName">mipLevel</span></tt></dt> <dd>- Mipmap level for the subresource to access</dd> </dl> </div> <div class="section"> <h6 class="return_header">Returns</h6> <p class="return"><a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038e355f04607d824883b4a50662830d591" shape="rect">cudaSuccess</a>, <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e00383e8aef5398ee38e28ed41e357b48917c" shape="rect">cudaErrorInvalidValue</a>, <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038c4673247aee4d1ab8d07871f376e0273" shape="rect">cudaErrorInvalidResourceHandle</a>, <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e00382e491daacef266c7b3e3c1e140a6133c" shape="rect">cudaErrorUnknown</a></p> </div> <div class="section"> <h6 class="description_header">Description</h6> <p>Returns in <tt class="ph tt code">*array</tt> an array through which the subresource of the mapped graphics resource <tt class="ph tt code">resource</tt> which corresponds to array index <tt class="ph tt code">arrayIndex</tt> and mipmap level <tt class="ph tt code">mipLevel</tt> may be accessed. The value set in <tt class="ph tt code">array</tt> may change every time that <tt class="ph tt code">resource</tt> is mapped. </p> <p class="p">If <tt class="ph tt code">resource</tt> is not a texture then it cannot be accessed via an array and <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e00382e491daacef266c7b3e3c1e140a6133c" shape="rect">cudaErrorUnknown</a> is returned. If <tt class="ph tt code">arrayIndex</tt> is not a valid array index for <tt class="ph tt code">resource</tt> then <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e00383e8aef5398ee38e28ed41e357b48917c" shape="rect">cudaErrorInvalidValue</a> is returned. If <tt class="ph tt code">mipLevel</tt> is not a valid mipmap level for <tt class="ph tt code">resource</tt> then <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e00383e8aef5398ee38e28ed41e357b48917c" shape="rect">cudaErrorInvalidValue</a> is returned. If <tt class="ph tt code">resource</tt> is not mapped then <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e00382e491daacef266c7b3e3c1e140a6133c" shape="rect">cudaErrorUnknown</a> is returned. </p> <p class="p"></p> <p class="p"></p> <p class="p"> <div class="note note"><span class="notetitle">Note:</span><ul class="ul"> <li class="li"> <p class="p">Note that this function may also return error codes from previous, asynchronous launches. </p> </li> <li class="li"> <p class="p">Note that this function may also return <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038ce7993a88ecf2c57b8102d55d997a18c" shape="rect">cudaErrorInitializationError</a>, <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038f5e52d1774934b77ba55d2aa2c063067" shape="rect">cudaErrorInsufficientDriver</a> or <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038e942e4cbbd2bef6e92e293253f055613" shape="rect">cudaErrorNoDevice</a> if this call tries to initialize internal CUDA RT state. </p> </li> <li class="li"> <p class="p">Note that as specified by <a class="xref" href="group__CUDART__STREAM.html#group__CUDART__STREAM_1g74aa9f4b1c2f12d994bf13876a5a2498" title="Add a callback to a compute stream." shape="rect">cudaStreamAddCallback</a> no CUDA function may be called from callback. <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e003867b6095ab719b21659a400b553963eb3" shape="rect">cudaErrorNotPermitted</a> may, but is not guaranteed to, be returned as a diagnostic in such case. </p> </li> </ul> </div> </p> <p class="p"></p> <p class="p apiDesc_subtitle"><strong class="ph b">See also:</strong></p> <p class="p see_subsection"><a class="xref" href="group__CUDART__INTEROP.html#group__CUDART__INTEROP_1ga36881081c8deb4df25c256158e1ac99" title="Get an device pointer through which to access a mapped graphics resource." shape="rect">cudaGraphicsResourceGetMappedPointer</a>, <a class="xref" href="../cuda-driver-api/group__CUDA__GRAPHICS.html#group__CUDA__GRAPHICS_1g61c55e987e54558cce547240d6123078" target="_blank" shape="rect">cuGraphicsSubResourceGetMappedArray</a></p> <p class="p"></p> </div> </dd> <dt class="description"><a name="group__CUDART__INTEROP_1g11988ab4431b11ddb7cbde7aedb60491" id="group__CUDART__INTEROP_1g11988ab4431b11ddb7cbde7aedb60491" shape="rect"> <!-- --></a><span><span class="keyword keyword apiItemName">__host__</span> <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf599e5b8b829ce7db0f5216928f6ecb6" title="" shape="rect">cudaError_t</a> cudaGraphicsUnmapResources ( int <span> </span><span class="keyword keyword apiItemName">count</span>, <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf58dd8d3c7a65714ff7f5459adbf7e6f" title="" shape="rect">cudaGraphicsResource_t</a>*<span> </span><span class="keyword keyword apiItemName">resources</span>, <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1ge15d9c8b7a240312b533d6122558085a" title="" shape="rect">cudaStream_t</a><span> </span><span class="keyword keyword apiItemName">stream</span> = <span class="ph ph apiData">0</span> ) </span></dt> <dd class="description"> <div class="section">Unmap graphics resources. </div> <div class="section"> <h6 class="parameter_header"> Parameters </h6> <dl class="table-display-params"> <dt><tt class="code"><span class="keyword keyword apiItemName">count</span></tt></dt> <dd>- Number of resources to unmap </dd> <dt><tt class="code"><span class="keyword keyword apiItemName">resources</span></tt></dt> <dd>- Resources to unmap </dd> <dt><tt class="code"><span class="keyword keyword apiItemName">stream</span></tt></dt> <dd>- Stream for synchronization</dd> </dl> </div> <div class="section"> <h6 class="return_header">Returns</h6> <p class="return"><a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038e355f04607d824883b4a50662830d591" shape="rect">cudaSuccess</a>, <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038c4673247aee4d1ab8d07871f376e0273" shape="rect">cudaErrorInvalidResourceHandle</a>, <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e00382e491daacef266c7b3e3c1e140a6133c" shape="rect">cudaErrorUnknown</a></p> </div> <div class="section"> <h6 class="description_header">Description</h6> <p>Unmaps the <tt class="ph tt code">count</tt> graphics resources in <tt class="ph tt code">resources</tt>. </p> <p class="p">Once unmapped, the resources in <tt class="ph tt code">resources</tt> may not be accessed by CUDA until they are mapped again. </p> <p class="p">This function provides the synchronization guarantee that any CUDA work issued in <tt class="ph tt code">stream</tt> before <a class="xref" href="group__CUDART__INTEROP.html#group__CUDART__INTEROP_1g11988ab4431b11ddb7cbde7aedb60491" title="Unmap graphics resources." shape="rect">cudaGraphicsUnmapResources()</a> will complete before any subsequently issued graphics work begins. </p> <p class="p">If <tt class="ph tt code">resources</tt> contains any duplicate entries then <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038c4673247aee4d1ab8d07871f376e0273" shape="rect">cudaErrorInvalidResourceHandle</a> is returned. If any of <tt class="ph tt code">resources</tt> are not presently mapped for access by CUDA then <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e00382e491daacef266c7b3e3c1e140a6133c" shape="rect">cudaErrorUnknown</a> is returned. </p> <p class="p"></p> <p class="p"></p> <p class="p"> <div class="note note"><span class="notetitle">Note:</span><ul class="ul"> <li class="li"> <p class="p">This function uses standard <a class="xref xmlonly" href="stream-sync-behavior.html#stream-sync-behavior__default-stream" shape="rect">default stream</a> semantics. </p> </li> <li class="li"> <p class="p">Note that this function may also return error codes from previous, asynchronous launches. </p> </li> <li class="li"> <p class="p">Note that this function may also return <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038ce7993a88ecf2c57b8102d55d997a18c" shape="rect">cudaErrorInitializationError</a>, <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038f5e52d1774934b77ba55d2aa2c063067" shape="rect">cudaErrorInsufficientDriver</a> or <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038e942e4cbbd2bef6e92e293253f055613" shape="rect">cudaErrorNoDevice</a> if this call tries to initialize internal CUDA RT state. </p> </li> <li class="li"> <p class="p">Note that as specified by <a class="xref" href="group__CUDART__STREAM.html#group__CUDART__STREAM_1g74aa9f4b1c2f12d994bf13876a5a2498" title="Add a callback to a compute stream." shape="rect">cudaStreamAddCallback</a> no CUDA function may be called from callback. <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e003867b6095ab719b21659a400b553963eb3" shape="rect">cudaErrorNotPermitted</a> may, but is not guaranteed to, be returned as a diagnostic in such case. </p> </li> </ul> </div> </p> <p class="p"></p> <p class="p apiDesc_subtitle"><strong class="ph b">See also:</strong></p> <p class="p see_subsection"><a class="xref" href="group__CUDART__INTEROP.html#group__CUDART__INTEROP_1gad8fbe74d02adefb8e7efb4971ee6322" title="Map graphics resources for access by CUDA." shape="rect">cudaGraphicsMapResources</a>, <a class="xref" href="../cuda-driver-api/group__CUDA__GRAPHICS.html#group__CUDA__GRAPHICS_1g8e9ff25d071375a0df1cb5aee924af32" target="_blank" shape="rect">cuGraphicsUnmapResources</a></p> <p class="p"></p> </div> </dd> <dt class="description"><a name="group__CUDART__INTEROP_1gc65d1f2900086747de1e57301d709940" id="group__CUDART__INTEROP_1gc65d1f2900086747de1e57301d709940" shape="rect"> <!-- --></a><span><span class="keyword keyword apiItemName">__host__</span> <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf599e5b8b829ce7db0f5216928f6ecb6" title="" shape="rect">cudaError_t</a> cudaGraphicsUnregisterResource ( <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf58dd8d3c7a65714ff7f5459adbf7e6f" title="" shape="rect">cudaGraphicsResource_t</a><span> </span><span class="keyword keyword apiItemName">resource</span> ) </span></dt> <dd class="description"> <div class="section">Unregisters a graphics resource for access by CUDA. </div> <div class="section"> <h6 class="parameter_header"> Parameters </h6> <dl class="table-display-params"> <dt><tt class="code"><span class="keyword keyword apiItemName">resource</span></tt></dt> <dd>- Resource to unregister</dd> </dl> </div> <div class="section"> <h6 class="return_header">Returns</h6> <p class="return"><a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038e355f04607d824883b4a50662830d591" shape="rect">cudaSuccess</a>, <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038c4673247aee4d1ab8d07871f376e0273" shape="rect">cudaErrorInvalidResourceHandle</a>, <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e00382e491daacef266c7b3e3c1e140a6133c" shape="rect">cudaErrorUnknown</a></p> </div> <div class="section"> <h6 class="description_header">Description</h6> <p>Unregisters the graphics resource <tt class="ph tt code">resource</tt> so it is not accessible by CUDA unless registered again. </p> <p class="p">If <tt class="ph tt code">resource</tt> is invalid then <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038c4673247aee4d1ab8d07871f376e0273" shape="rect">cudaErrorInvalidResourceHandle</a> is returned. </p> <p class="p"></p> <p class="p"></p> <p class="p"> <div class="note note"><span class="notetitle">Note:</span><ul class="ul"> <li class="li"> <p class="p">Note that this function may also return error codes from previous, asynchronous launches. </p> </li> <li class="li"> <p class="p">Note that this function may also return <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038ce7993a88ecf2c57b8102d55d997a18c" shape="rect">cudaErrorInitializationError</a>, <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038f5e52d1774934b77ba55d2aa2c063067" shape="rect">cudaErrorInsufficientDriver</a> or <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038e942e4cbbd2bef6e92e293253f055613" shape="rect">cudaErrorNoDevice</a> if this call tries to initialize internal CUDA RT state. </p> </li> <li class="li"> <p class="p">Note that as specified by <a class="xref" href="group__CUDART__STREAM.html#group__CUDART__STREAM_1g74aa9f4b1c2f12d994bf13876a5a2498" title="Add a callback to a compute stream." shape="rect">cudaStreamAddCallback</a> no CUDA function may be called from callback. <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e003867b6095ab719b21659a400b553963eb3" shape="rect">cudaErrorNotPermitted</a> may, but is not guaranteed to, be returned as a diagnostic in such case. </p> </li> </ul> </div> </p> <p class="p"></p> <p class="p apiDesc_subtitle"><strong class="ph b">See also:</strong></p> <p class="p see_subsection"><a class="xref" href="group__CUDART__D3D9.html#group__CUDART__D3D9_1gab5efa8a8882a6e0ee99717a434730b0" title="Register a Direct3D 9 resource for access by CUDA." shape="rect">cudaGraphicsD3D9RegisterResource</a>, <a class="xref" href="group__CUDART__D3D10.html#group__CUDART__D3D10_1g438731f7af2b799fb757910be6cff62b" title="Registers a Direct3D 10 resource for access by CUDA." shape="rect">cudaGraphicsD3D10RegisterResource</a>, <a class="xref" href="group__CUDART__D3D11.html#group__CUDART__D3D11_1g85d07753780643584b8febab0370623b" title="Register a Direct3D 11 resource for access by CUDA." shape="rect">cudaGraphicsD3D11RegisterResource</a>, <a class="xref" href="group__CUDART__OPENGL.html#group__CUDART__OPENGL_1g0fd33bea77ca7b1e69d1619caf44214b" title="Registers an OpenGL buffer object." shape="rect">cudaGraphicsGLRegisterBuffer</a>, <a class="xref" href="group__CUDART__OPENGL.html#group__CUDART__OPENGL_1g80d12187ae7590807c7676697d9fe03d" title="Register an OpenGL texture or renderbuffer object." shape="rect">cudaGraphicsGLRegisterImage</a>, <a class="xref" href="../cuda-driver-api/group__CUDA__GRAPHICS.html#group__CUDA__GRAPHICS_1ga7e5e97b74eaa13dfa6582e853e4c96d" target="_blank" shape="rect">cuGraphicsUnregisterResource</a></p> <p class="p"></p> </div> </dd> </dl> </div> </div> <hr id="contents-end"></hr> </article> </div> </div> <script language="JavaScript" type="text/javascript" charset="utf-8" src="../common/formatting/common.min.js"></script> <script language="JavaScript" type="text/javascript" charset="utf-8" src="../common/scripts/google-analytics/google-analytics-write.js"></script> <script language="JavaScript" type="text/javascript" charset="utf-8" src="../common/scripts/google-analytics/google-analytics-tracker.js"></script> <script type="text/javascript">var switchTo5x=true;</script><script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script><script type="text/javascript">stLight.options({publisher: "998dc202-a267-4d8e-bce9-14debadb8d92", doNotHash: false, doNotCopy: false, hashAddressBar: false});</script><script type="text/javascript">_satellite.pageBottom();</script></body> </html>