# C1.Util.DX.Direct3D11.DeviceContext.UpdateSubresourceSafe

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Util_DX_Direct3D11_DeviceContext_UpdateSubresourceSafe_" data-uid="C1.Util.DX.Direct3D11.DeviceContext.UpdateSubresourceSafe*">UpdateSubresourceSafe Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Util_DX_Direct3D11_DeviceContext_UpdateSubresourceSafe_" data-uid="C1.Util.DX.Direct3D11.DeviceContext.UpdateSubresourceSafe*"></a>
<h4 id="C1_Util_DX_Direct3D11_DeviceContext_UpdateSubresourceSafe__1___0__C1_Util_DX_Direct3D11_Resource_System_Int32_System_Int32_System_Int32_System_Int32_System_Boolean_" data-uid="C1.Util.DX.Direct3D11.DeviceContext.UpdateSubresourceSafe``1(``0@,C1.Util.DX.Direct3D11.Resource,System.Int32,System.Int32,System.Int32,System.Int32,System.Boolean)">UpdateSubresourceSafe&lt;T&gt;(ref T, Resource, int, int, int, int, bool)</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 UpdateSubresourceSafe&lt;T&gt;(ref T data, Resource resource, int srcBytesPerElement, int subresource = 0, int rowPitch = 0, int depthPitch = 0, bool isCompressedResource = false) where T : struct</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub UpdateSubresourceSafe(Of T As Structure)(ByRef data As T, resource As Resource, srcBytesPerElement As Integer, Optional subresource As Integer = 0, Optional rowPitch As Integer = 0, Optional depthPitch As Integer = 0, Optional isCompressedResource As Boolean = False)</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">srcBytesPerElement</span></td>
      <td><p>The size in bytes per pixel/block element.</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="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">isCompressedResource</span></td>
      <td><p>if set to <code>true</code> the resource is a block/compressed resource</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_UpdateSubresourceSafe_" data-uid="C1.Util.DX.Direct3D11.DeviceContext.UpdateSubresourceSafe*"></a>
<h4 id="C1_Util_DX_Direct3D11_DeviceContext_UpdateSubresourceSafe__1___0___C1_Util_DX_Direct3D11_Resource_System_Int32_System_Int32_System_Int32_System_Int32_System_Boolean_" data-uid="C1.Util.DX.Direct3D11.DeviceContext.UpdateSubresourceSafe``1(``0[],C1.Util.DX.Direct3D11.Resource,System.Int32,System.Int32,System.Int32,System.Int32,System.Boolean)">UpdateSubresourceSafe&lt;T&gt;(T[], Resource, int, int, int, int, bool)</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 UpdateSubresourceSafe&lt;T&gt;(T[] data, Resource resource, int srcBytesPerElement, int subresource = 0, int rowPitch = 0, int depthPitch = 0, bool isCompressedResource = false) where T : struct</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub UpdateSubresourceSafe(Of T As Structure)(data As T(), resource As Resource, srcBytesPerElement As Integer, Optional subresource As Integer = 0, Optional rowPitch As Integer = 0, Optional depthPitch As Integer = 0, Optional isCompressedResource As Boolean = False)</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">srcBytesPerElement</span></td>
      <td><p>The size in bytes per pixel/block element.</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="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">isCompressedResource</span></td>
      <td><p>if set to <code>true</code> the resource is a block/compressed resource</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_UpdateSubresourceSafe_" data-uid="C1.Util.DX.Direct3D11.DeviceContext.UpdateSubresourceSafe*"></a>
<h4 id="C1_Util_DX_Direct3D11_DeviceContext_UpdateSubresourceSafe_C1_Util_DX_DataBox_C1_Util_DX_Direct3D11_Resource_System_Int32_System_Int32_System_Boolean_" data-uid="C1.Util.DX.Direct3D11.DeviceContext.UpdateSubresourceSafe(C1.Util.DX.DataBox,C1.Util.DX.Direct3D11.Resource,System.Int32,System.Int32,System.Boolean)">UpdateSubresourceSafe(DataBox, Resource, int, int, bool)</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 UpdateSubresourceSafe(DataBox source, Resource resource, int srcBytesPerElement, int subresource = 0, bool isCompressedResource = false)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub UpdateSubresourceSafe(source As DataBox, resource As Resource, srcBytesPerElement As Integer, Optional subresource As Integer = 0, Optional isCompressedResource As Boolean = False)</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">srcBytesPerElement</span></td>
      <td><p>The size in bytes per pixel/block element.</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.boolean">bool</a></td>
      <td><span class="parametername">isCompressedResource</span></td>
      <td><p>if set to <code>true</code> the resource is a block/compressed resource</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_Util_DX_Direct3D11_DeviceContext_UpdateSubresourceSafe_" data-uid="C1.Util.DX.Direct3D11.DeviceContext.UpdateSubresourceSafe*"></a>
<h4 id="C1_Util_DX_Direct3D11_DeviceContext_UpdateSubresourceSafe_C1_Util_DX_DataBox_C1_Util_DX_Direct3D11_Resource_System_Int32_System_Int32_C1_Util_DX_Direct3D11_ResourceRegion_System_Boolean_" data-uid="C1.Util.DX.Direct3D11.DeviceContext.UpdateSubresourceSafe(C1.Util.DX.DataBox,C1.Util.DX.Direct3D11.Resource,System.Int32,System.Int32,C1.Util.DX.Direct3D11.ResourceRegion,System.Boolean)">UpdateSubresourceSafe(DataBox, Resource, int, int, ResourceRegion, bool)</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 UpdateSubresourceSafe(DataBox source, Resource resource, int srcBytesPerElement, int subresource, ResourceRegion region, bool isCompressedResource = false)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub UpdateSubresourceSafe(source As DataBox, resource As Resource, srcBytesPerElement As Integer, subresource As Integer, region As ResourceRegion, Optional isCompressedResource As Boolean = False)</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">srcBytesPerElement</span></td>
      <td><p>The size in bytes per pixel/block element.</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>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">isCompressedResource</span></td>
      <td><p>if set to <code>true</code> the resource is a block/compressed resource</p>
</td>
    </tr>
  </tbody>
</table>
</div>
