<!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="Surface Reference Management"></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__SURFACE"></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="../common/scripts/tynt/tynt.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 v6.5</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="api-sync-behavior.html#api-sync-behavior">1. API synchronization behavior </a></div> </li> <li> <div class="section-link"><a href="stream-sync-behavior.html#stream-sync-behavior">2. Stream synchronization behavior</a></div> </li> <li> <div class="section-link"><a href="modules.html#modules">3. Modules</a></div> <ul> <li> <div class="section-link"><a href="group__CUDART__DEVICE.html#group__CUDART__DEVICE">3.1. Device Management</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__THREAD__DEPRECATED.html#group__CUDART__THREAD__DEPRECATED">3.2. Thread Management [DEPRECATED]</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__ERROR.html#group__CUDART__ERROR">3.3. Error Handling</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__STREAM.html#group__CUDART__STREAM">3.4. Stream Management</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__EVENT.html#group__CUDART__EVENT">3.5. Event Management</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__EXECUTION.html#group__CUDART__EXECUTION">3.6. Execution Control</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__OCCUPANCY.html#group__CUDART__OCCUPANCY">3.7. Occupancy</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__MEMORY.html#group__CUDART__MEMORY">3.8. Memory Management</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__UNIFIED.html#group__CUDART__UNIFIED">3.9. Unified Addressing</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__PEER.html#group__CUDART__PEER">3.10. Peer Device Memory Access</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__OPENGL.html#group__CUDART__OPENGL">3.11. OpenGL Interoperability</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__OPENGL__DEPRECATED.html#group__CUDART__OPENGL__DEPRECATED">3.12. OpenGL Interoperability [DEPRECATED]</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__D3D9.html#group__CUDART__D3D9">3.13. Direct3D 9 Interoperability</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__D3D9__DEPRECATED.html#group__CUDART__D3D9__DEPRECATED">3.14. Direct3D 9 Interoperability [DEPRECATED]</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__D3D10.html#group__CUDART__D3D10">3.15. Direct3D 10 Interoperability</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__D3D10__DEPRECATED.html#group__CUDART__D3D10__DEPRECATED">3.16. Direct3D 10 Interoperability [DEPRECATED]</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__D3D11.html#group__CUDART__D3D11">3.17. Direct3D 11 Interoperability</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__D3D11__DEPRECATED.html#group__CUDART__D3D11__DEPRECATED">3.18. Direct3D 11 Interoperability [DEPRECATED]</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__VDPAU.html#group__CUDART__VDPAU">3.19. VDPAU Interoperability</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__INTEROP.html#group__CUDART__INTEROP">3.20. Graphics Interoperability</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__TEXTURE.html#group__CUDART__TEXTURE">3.21. Texture Reference Management</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__SURFACE.html#group__CUDART__SURFACE">3.22. Surface Reference Management</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__TEXTURE__OBJECT.html#group__CUDART__TEXTURE__OBJECT">3.23. Texture Object Management</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__SURFACE__OBJECT.html#group__CUDART__SURFACE__OBJECT">3.24. Surface Object Management</a></div> </li> <li> <div class="section-link"><a href="group__CUDART____VERSION.html#group__CUDART____VERSION">3.25. Version Management</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL">3.26. C++ API Routines</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__DRIVER.html#group__CUDART__DRIVER">3.27. Interactions with the CUDA Driver API</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__PROFILER.html#group__CUDART__PROFILER">3.28. Profiler Control</a></div> </li> <li> <div class="section-link"><a href="group__CUDART__TYPES.html#group__CUDART__TYPES">3.29. Data types used by CUDA Runtime</a></div> </li> </ul> </li> <li> <div class="section-link"><a href="annotated.html#annotated">4. Data Structures</a></div> <ul> <li> <div class="section-link"><a href="class____cudaOccupancyB2DHelper.html#class____cudaOccupancyB2DHelper">4.1. __cudaOccupancyB2DHelper</a></div> </li> <li> <div class="section-link"><a href="structcudaChannelFormatDesc.html#structcudaChannelFormatDesc">4.2. cudaChannelFormatDesc</a></div> </li> <li> <div class="section-link"><a href="structcudaDeviceProp.html#structcudaDeviceProp">4.3. cudaDeviceProp</a></div> </li> <li> <div class="section-link"><a href="structcudaExtent.html#structcudaExtent">4.4. cudaExtent</a></div> </li> <li> <div class="section-link"><a href="structcudaFuncAttributes.html#structcudaFuncAttributes">4.5. cudaFuncAttributes</a></div> </li> <li> <div class="section-link"><a href="structcudaIpcEventHandle__t.html#structcudaIpcEventHandle__t">4.6. cudaIpcEventHandle_t</a></div> </li> <li> <div class="section-link"><a href="structcudaIpcMemHandle__t.html#structcudaIpcMemHandle__t">4.7. cudaIpcMemHandle_t</a></div> </li> <li> <div class="section-link"><a href="structcudaMemcpy3DParms.html#structcudaMemcpy3DParms">4.8. cudaMemcpy3DParms</a></div> </li> <li> <div class="section-link"><a href="structcudaMemcpy3DPeerParms.html#structcudaMemcpy3DPeerParms">4.9. cudaMemcpy3DPeerParms</a></div> </li> <li> <div class="section-link"><a href="structcudaPitchedPtr.html#structcudaPitchedPtr">4.10. cudaPitchedPtr</a></div> </li> <li> <div class="section-link"><a href="structcudaPointerAttributes.html#structcudaPointerAttributes">4.11. cudaPointerAttributes</a></div> </li> <li> <div class="section-link"><a href="structcudaPos.html#structcudaPos">4.12. cudaPos</a></div> </li> <li> <div class="section-link"><a href="structcudaResourceDesc.html#structcudaResourceDesc">4.13. cudaResourceDesc</a></div> </li> <li> <div class="section-link"><a href="structcudaResourceViewDesc.html#structcudaResourceViewDesc">4.14. cudaResourceViewDesc</a></div> </li> <li> <div class="section-link"><a href="structcudaTextureDesc.html#structcudaTextureDesc">4.15. cudaTextureDesc</a></div> </li> <li> <div class="section-link"><a href="structsurfaceReference.html#structsurfaceReference">4.16. surfaceReference</a></div> </li> <li> <div class="section-link"><a href="structtextureReference.html#structtextureReference">4.17. textureReference</a></div> </li> </ul> </li> <li> <div class="section-link"><a href="functions.html#functions">5. Data Fields</a></div> </li> <li> <div class="section-link"><a href="deprecated.html#deprecated">6. 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__TEXTURE.html" shape="rect">< Previous</a> | <a href="group__CUDART__TEXTURE__OBJECT.html" shape="rect">Next ></a></div> <div id="release-info">CUDA Runtime API (<a href="../../pdf/CUDA_Runtime_API.pdf">PDF</a>) - v6.5 (<a href="https://developer.nvidia.com/cuda-toolkit-archive">older</a>) - Last updated August 1, 2014 - <a href="mailto:cudatools@nvidia.com?subject=CUDA Toolkit Documentation Feedback: CUDA Runtime API">Send Feedback</a> - <span class="st_facebook"></span><span class="st_twitter"></span><span class="st_linkedin"></span><span class="st_reddit"></span><span class="st_slashdot"></span><span class="st_tumblr"></span><span class="st_sharethis"></span></div> </div> <article id="contents"> <div class="topic reference apiRef apiPackage cppModule" id="group__CUDART__SURFACE"><a name="group__CUDART__SURFACE" shape="rect"> <!-- --></a><h2 class="topictitle2 cppModule">3.22. Surface Reference Management</h2> <div class="section"> <p>This section describes the low level surface reference management functions of the CUDA runtime application programming interface.</p> <p class="p">Some functions have overloaded C++ API template versions documented separately in the <a class="xref" href="group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL" title="C++-style interface built on top of CUDA runtime API." shape="rect">C++ API Routines</a> module. </p> </div> <h3 class="fake_sectiontitle member_header">Functions</h3> <dl class="members"> <dt><span class="member_type"><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__SURFACE_1ga2b349f6cf2299d564c21d4e6f0dd636" shape="rect">cudaBindSurfaceToArray</a> ( const <a href="structsurfaceReference.html#structsurfaceReference" title="" shape="rect">surfaceReference</a>*<span> </span><span class="keyword keyword apiItemName">surfref</span>, <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1g1259f0b7bcff80ba46267c9117f9bb21" title="" shape="rect">cudaArray_const_t</a><span> </span><span class="keyword keyword apiItemName">array</span>, const <a href="structcudaChannelFormatDesc.html#structcudaChannelFormatDesc" title="" shape="rect">cudaChannelFormatDesc</a>*<span> </span><span class="keyword keyword apiItemName">desc</span> ) </span></dt> <dd class="shortdesc"><span></span><span class="desc">Binds an array to a surface. </span></dd> <dt><span class="member_type"><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__SURFACE_1g8fc610628c2ff4c45bdd1d2b7bbe2116" shape="rect">cudaGetSurfaceReference</a> ( const <a href="structsurfaceReference.html#structsurfaceReference" title="" shape="rect">surfaceReference</a>**<span> </span><span class="keyword keyword apiItemName">surfref</span>, const void*<span> </span><span class="keyword keyword apiItemName">symbol</span> ) </span></dt> <dd class="shortdesc"><span></span><span class="desc">Get the surface reference associated with a symbol. </span></dd> </dl> <div class="description"> <h3 class="sectiontitle">Functions</h3> <dl class="description"> <dt class="description"><a name="group__CUDART__SURFACE_1ga2b349f6cf2299d564c21d4e6f0dd636" id="group__CUDART__SURFACE_1ga2b349f6cf2299d564c21d4e6f0dd636" shape="rect"> <!-- --></a><span><a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf599e5b8b829ce7db0f5216928f6ecb6" title="" shape="rect">cudaError_t</a> cudaBindSurfaceToArray ( const <a href="structsurfaceReference.html#structsurfaceReference" title="" shape="rect">surfaceReference</a>*<span> </span><span class="keyword keyword apiItemName">surfref</span>, <a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1g1259f0b7bcff80ba46267c9117f9bb21" title="" shape="rect">cudaArray_const_t</a><span> </span><span class="keyword keyword apiItemName">array</span>, const <a href="structcudaChannelFormatDesc.html#structcudaChannelFormatDesc" title="" shape="rect">cudaChannelFormatDesc</a>*<span> </span><span class="keyword keyword apiItemName">desc</span> ) </span></dt> <dd class="description"> <div class="section">Binds an array to a surface. </div> <div class="section"> <h6 class="parameter_header"> Parameters </h6> <dl class="table-display-params"> <dt><tt class="code"><span class="keyword keyword apiItemName">surfref</span></tt></dt> <dd>- Surface to bind </dd> <dt><tt class="code"><span class="keyword keyword apiItemName">array</span></tt></dt> <dd>- Memory array on device </dd> <dt><tt class="code"><span class="keyword keyword apiItemName">desc</span></tt></dt> <dd>- Channel format</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_1gg3f51e3575c2178246db0a94a430e0038aa711d1e9175231dc80eecb7b51936a3" shape="rect">cudaErrorInvalidSurface</a></p> </div> <div class="section"> <h6 class="description_header">Description</h6> <p>Binds the CUDA array <tt class="ph tt code">array</tt> to the surface reference <tt class="ph tt code">surfref</tt>. <tt class="ph tt code">desc</tt> describes how the memory is interpreted when fetching values from the surface. Any CUDA array previously bound to <tt class="ph tt code">surfref</tt> is unbound. </p> <p class="p"></p> <p class="p"></p> <p class="p"> <div class="note note"><span class="notetitle">Note:</span><p class="p">Note that this function may also return error codes from previous, asynchronous launches.</p> </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__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g1ffeea0c649c7cb1328156aa21f00f1e" title="[C++ API] Binds an array to a surface" shape="rect">cudaBindSurfaceToArray ( C++ API)</a>, <a class="xref" href="group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL_1g2871dc1e4e78b7b2f7e12bcba419d870" title="[C++ API] Binds an array to a surface" shape="rect">cudaBindSurfaceToArray ( C++ API, inherited channel descriptor)</a>, <a class="xref" href="group__CUDART__SURFACE.html#group__CUDART__SURFACE_1g8fc610628c2ff4c45bdd1d2b7bbe2116" title="Get the surface reference associated with a symbol." shape="rect">cudaGetSurfaceReference</a></p> <p class="p"></p> </div> </dd> <dt class="description"><a name="group__CUDART__SURFACE_1g8fc610628c2ff4c45bdd1d2b7bbe2116" id="group__CUDART__SURFACE_1g8fc610628c2ff4c45bdd1d2b7bbe2116" shape="rect"> <!-- --></a><span><a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf599e5b8b829ce7db0f5216928f6ecb6" title="" shape="rect">cudaError_t</a> cudaGetSurfaceReference ( const <a href="structsurfaceReference.html#structsurfaceReference" title="" shape="rect">surfaceReference</a>**<span> </span><span class="keyword keyword apiItemName">surfref</span>, const void*<span> </span><span class="keyword keyword apiItemName">symbol</span> ) </span></dt> <dd class="description"> <div class="section">Get the surface reference associated with a symbol. </div> <div class="section"> <h6 class="parameter_header"> Parameters </h6> <dl class="table-display-params"> <dt><tt class="code"><span class="keyword keyword apiItemName">surfref</span></tt></dt> <dd>- Surface reference associated with symbol </dd> <dt><tt class="code"><span class="keyword keyword apiItemName">symbol</span></tt></dt> <dd>- Surface to get reference for</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_1gg3f51e3575c2178246db0a94a430e0038aa711d1e9175231dc80eecb7b51936a3" shape="rect">cudaErrorInvalidSurface</a></p> </div> <div class="section"> <h6 class="description_header">Description</h6> <p>Returns in <tt class="ph tt code">*surfref</tt> the structure associated to the surface reference defined by symbol <tt class="ph tt code">symbol</tt>. </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">Use of a string naming a variable as the <tt class="ph tt code">symbol</tt> paramater was removed in CUDA 5.0. </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__SURFACE.html#group__CUDART__SURFACE_1ga2b349f6cf2299d564c21d4e6f0dd636" title="Binds an array to a surface." shape="rect">cudaBindSurfaceToArray ( C API)</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></body> </html>