# C1.Util.DX.Direct3D11.DeviceContext.UpdateSubresource

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Util_DX_Direct3D11_DeviceContext_UpdateSubresource_" data-uid="C1.Util.DX.Direct3D11.DeviceContext.UpdateSubresource*">UpdateSubresource Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Util_DX_Direct3D11_DeviceContext_UpdateSubresource_" data-uid="C1.Util.DX.Direct3D11.DeviceContext.UpdateSubresource*"></a>
<h4 id="C1_Util_DX_Direct3D11_DeviceContext_UpdateSubresource__1___0__C1_Util_DX_Direct3D11_Resource_System_Int32_System_Int32_System_Int32_System_Nullable_C1_Util_DX_Direct3D11_ResourceRegion__" data-uid="C1.Util.DX.Direct3D11.DeviceContext.UpdateSubresource``1(``0@,C1.Util.DX.Direct3D11.Resource,System.Int32,System.Int32,System.Int32,System.Nullable{C1.Util.DX.Direct3D11.ResourceRegion})">UpdateSubresource&lt;T&gt;(ref T, Resource, int, int, int, ResourceRegion?)</h4>
<div class="markdown level1 summary"><p>Copies data from the CPU to to a non-mappable subresource region.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void UpdateSubresource&lt;T&gt;(ref T data, Resource resource, int subresource = 0, int rowPitch = 0, int depthPitch = 0, ResourceRegion? region = null) where T : struct</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub UpdateSubresource(Of T As Structure)(ByRef data As T, resource As Resource, Optional subresource As Integer = 0, Optional rowPitch As Integer = 0, Optional depthPitch As Integer = 0, Optional region As ResourceRegion? = Nothing)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><span class="xref">T</span></td>
      <td><span class="parametername">data</span></td>
      <td><p>A reference to the data to upload.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.Direct3D11.Resource.html">Resource</a></td>
      <td><span class="parametername">resource</span></td>
      <td><p>The destination resource.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">subresource</span></td>
      <td><p>The destination subresource.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">rowPitch</span></td>
      <td><p>The row pitch.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">depthPitch</span></td>
      <td><p>The depth pitch.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.Direct3D11.ResourceRegion.html">ResourceRegion</a>?</td>
      <td><span class="parametername">region</span></td>
      <td><p>The region</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="typeParameters">Type Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><span class="parametername">T</span></td>
      <td><p>Type of the data to upload</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_Util_DX_Direct3D11_DeviceContext_UpdateSubresource_" data-uid="C1.Util.DX.Direct3D11.DeviceContext.UpdateSubresource*"></a>
<h4 id="C1_Util_DX_Direct3D11_DeviceContext_UpdateSubresource__1___0___C1_Util_DX_Direct3D11_Resource_System_Int32_System_Int32_System_Int32_System_Nullable_C1_Util_DX_Direct3D11_ResourceRegion__" data-uid="C1.Util.DX.Direct3D11.DeviceContext.UpdateSubresource``1(``0[],C1.Util.DX.Direct3D11.Resource,System.Int32,System.Int32,System.Int32,System.Nullable{C1.Util.DX.Direct3D11.ResourceRegion})">UpdateSubresource&lt;T&gt;(T[], Resource, int, int, int, ResourceRegion?)</h4>
<div class="markdown level1 summary"><p>Copies data from the CPU to to a non-mappable subresource region.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void UpdateSubresource&lt;T&gt;(T[] data, Resource resource, int subresource = 0, int rowPitch = 0, int depthPitch = 0, ResourceRegion? region = null) where T : struct</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub UpdateSubresource(Of T As Structure)(data As T(), resource As Resource, Optional subresource As Integer = 0, Optional rowPitch As Integer = 0, Optional depthPitch As Integer = 0, Optional region As ResourceRegion? = Nothing)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>T[]</td>
      <td><span class="parametername">data</span></td>
      <td><p>A reference to the data to upload.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.Direct3D11.Resource.html">Resource</a></td>
      <td><span class="parametername">resource</span></td>
      <td><p>The destination resource.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">subresource</span></td>
      <td><p>The destination subresource.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">rowPitch</span></td>
      <td><p>The row pitch.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">depthPitch</span></td>
      <td><p>The depth pitch.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.Direct3D11.ResourceRegion.html">ResourceRegion</a>?</td>
      <td><span class="parametername">region</span></td>
      <td><p>A region that defines the portion of the destination subresource to copy the resource data into. Coordinates are in bytes for buffers and in texels for textures.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="typeParameters">Type Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><span class="parametername">T</span></td>
      <td><p>Type of the data to upload</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_Util_DX_Direct3D11_DeviceContext_UpdateSubresource_" data-uid="C1.Util.DX.Direct3D11.DeviceContext.UpdateSubresource*"></a>
<h4 id="C1_Util_DX_Direct3D11_DeviceContext_UpdateSubresource_C1_Util_DX_DataBox_C1_Util_DX_Direct3D11_Resource_System_Int32_" data-uid="C1.Util.DX.Direct3D11.DeviceContext.UpdateSubresource(C1.Util.DX.DataBox,C1.Util.DX.Direct3D11.Resource,System.Int32)">UpdateSubresource(DataBox, Resource, int)</h4>
<div class="markdown level1 summary"><p>Copies data from the CPU to to a non-mappable subresource region.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void UpdateSubresource(DataBox source, Resource resource, int subresource = 0)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub UpdateSubresource(source As DataBox, resource As Resource, Optional subresource As Integer = 0)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="C1.Util.DX.DataBox.html">DataBox</a></td>
      <td><span class="parametername">source</span></td>
      <td><p>The source data.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.Direct3D11.Resource.html">Resource</a></td>
      <td><span class="parametername">resource</span></td>
      <td><p>The destination resource.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">subresource</span></td>
      <td><p>The destination subresource.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_Util_DX_Direct3D11_DeviceContext_UpdateSubresource_" data-uid="C1.Util.DX.Direct3D11.DeviceContext.UpdateSubresource*"></a>
<h4 id="C1_Util_DX_Direct3D11_DeviceContext_UpdateSubresource_C1_Util_DX_DataBox_C1_Util_DX_Direct3D11_Resource_System_Int32_C1_Util_DX_Direct3D11_ResourceRegion_" data-uid="C1.Util.DX.Direct3D11.DeviceContext.UpdateSubresource(C1.Util.DX.DataBox,C1.Util.DX.Direct3D11.Resource,System.Int32,C1.Util.DX.Direct3D11.ResourceRegion)">UpdateSubresource(DataBox, Resource, int, ResourceRegion)</h4>
<div class="markdown level1 summary"><p>Copies data from the CPU to to a non-mappable subresource region.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void UpdateSubresource(DataBox source, Resource resource, int subresource, ResourceRegion region)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub UpdateSubresource(source As DataBox, resource As Resource, subresource As Integer, region As ResourceRegion)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="C1.Util.DX.DataBox.html">DataBox</a></td>
      <td><span class="parametername">source</span></td>
      <td><p>The source data.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.Direct3D11.Resource.html">Resource</a></td>
      <td><span class="parametername">resource</span></td>
      <td><p>The destination resource.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">subresource</span></td>
      <td><p>The destination subresource.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.Direct3D11.ResourceRegion.html">ResourceRegion</a></td>
      <td><span class="parametername">region</span></td>
      <td><p>The destination region within the resource.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_Util_DX_Direct3D11_DeviceContext_UpdateSubresource_" data-uid="C1.Util.DX.Direct3D11.DeviceContext.UpdateSubresource*"></a>
<h4 id="C1_Util_DX_Direct3D11_DeviceContext_UpdateSubresource_C1_Util_DX_Direct3D11_Resource_System_Int32_System_Nullable_C1_Util_DX_Direct3D11_ResourceRegion__System_IntPtr_System_Int32_System_Int32_" data-uid="C1.Util.DX.Direct3D11.DeviceContext.UpdateSubresource(C1.Util.DX.Direct3D11.Resource,System.Int32,System.Nullable{C1.Util.DX.Direct3D11.ResourceRegion},System.IntPtr,System.Int32,System.Int32)">UpdateSubresource(Resource, int, ResourceRegion?, IntPtr, int, int)</h4>
<div class="markdown level1 summary"><p>void ID3D11DeviceContext::UpdateSubresource([In] ID3D11Resource* pDstResource,[In] unsigned int DstSubresource,[In, Optional] const D3D11_BOX* pDstBox,[In] const void* pSrcData,[In] unsigned int SrcRowPitch,[In] unsigned int SrcDepthPitch)</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void UpdateSubresource(Resource dstResourceRef, int dstSubresource, ResourceRegion? dstBoxRef, IntPtr srcDataRef, int srcRowPitch, int srcDepthPitch)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub UpdateSubresource(dstResourceRef As Resource, dstSubresource As Integer, dstBoxRef As ResourceRegion?, srcDataRef As IntPtr, srcRowPitch As Integer, srcDepthPitch As Integer)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="C1.Util.DX.Direct3D11.Resource.html">Resource</a></td>
      <td><span class="parametername">dstResourceRef</span></td>
      <td></td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">dstSubresource</span></td>
      <td></td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.Direct3D11.ResourceRegion.html">ResourceRegion</a>?</td>
      <td><span class="parametername">dstBoxRef</span></td>
      <td></td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.intptr">IntPtr</a></td>
      <td><span class="parametername">srcDataRef</span></td>
      <td></td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">srcRowPitch</span></td>
      <td></td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">srcDepthPitch</span></td>
      <td></td>
    </tr>
  </tbody>
</table>
</div>
