ID3D11DeviceContext1::UpdateSubresource1 method (d3d11_1.h)

The CPU copies data from memory to a subresource created in non-mappable memory.


void UpdateSubresource1(
  ID3D11Resource  *pDstResource,
  UINT            DstSubresource,
  const D3D11_BOX *pDstBox,
  const void      *pSrcData,
  UINT            SrcRowPitch,
  UINT            SrcDepthPitch,
  UINT            CopyFlags



Type: ID3D11Resource*

A pointer to the destination resource.


Type: UINT

A zero-based index that identifies the destination subresource. See D3D11CalcSubresource for more details.


Type: const D3D11_BOX*

A pointer to a box 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. If NULL, UpdateSubresource1 writes the data to the destination subresource with no offset. The dimensions of the source must fit the destination.

An empty box results in a no-op. A box is empty if the top value is greater than or equal to the bottom value, or the left value is greater than or equal to the right value, or the front value is greater than or equal to the back value. When the box is empty, UpdateSubresource1 doesn't perform an update operation.


Type: const void*

A pointer to the source data in memory.


Type: UINT

The size of one row of the source data.


Type: UINT

The size of one depth slice of source data.


Type: UINT

A D3D11_COPY_FLAGS-typed value that specifies how to perform the update operation. If you specify zero for no update option, UpdateSubresource1 behaves like ID3D11DeviceContext::UpdateSubresource. For existing display drivers that can't process these flags, the runtime doesn't use them.

Return value



If you call UpdateSubresource1 to update a constant buffer, pass any region, and the driver has not been implemented to Windows 8, the runtime drops the call (except feature level 9.1, 9.2, and 9.3 where the runtime emulates support). The runtime also drops the call if you update a constant buffer with a partial region whose extent is not aligned to 16-byte granularity (16 bytes being a full constant). When the runtime drops the call, the runtime doesn't call the corresponding device driver interface (DDI).

When you record a call to UpdateSubresource with an offset pDstBox in a software command list, the offset in pDstBox is incorrectly applied to pSrcData when you play back the command list. The new-for-Windows 8UpdateSubresource1 fixes this issue. In a call to UpdateSubresource1, pDstBox does not affect pSrcData.

For info about various resource types and how UpdateSubresource1 might work with each resource type, see Introduction to a Resource in Direct3D 11.

Note  Applies only to feature level 9_x hardware If you use UpdateSubresource1 or ID3D11DeviceContext1::CopySubresourceRegion1 to copy from a staging resource to a default resource, you can corrupt the destination contents. This occurs if you pass a NULL source box and if the source resource has different dimensions from those of the destination resource or if you use destination offsets, (x, y, and z). In this situation, always pass a source box that is the full size of the source resource.


Minimum supported client Windows 8 and Platform Update for Windows 7 [desktop apps | UWP apps]
Minimum supported server Windows Server 2012 and Platform Update for Windows Server 2008 R2 [desktop apps | UWP apps]
Target Platform Windows
Header d3d11_1.h
Library D3D11.lib

See also