Ejemplo n.º 1
0
 /// <summary>
 /// Copy a multisampled resource into a non-multisampled resource. This API is most useful when re-using the resulting render target of one render pass as an input to a second render pass.
 /// </summary>
 /// <remarks>
 /// Both the source and destination resources must be the same {{resource type}} and have the same dimensions. The source and destination must have compatible formats. There are three scenarios for this:  ScenarioRequirements Source and destination are prestructured and typedBoth the source and destination must have identical formats and that format must be specified in the Format parameter. One resource is prestructured and typed and the other is prestructured and typelessThe typed resource must have a format that is compatible with the typeless resource (i.e. the typed resource is DXGI_FORMAT_R32_FLOAT and the typeless resource is DXGI_FORMAT_R32_TYPELESS). The format of the typed resource must be specified in the Format parameter. Source and destination are prestructured and typelessBoth the source and destination must have the same typeless format (i.e. both must have DXGI_FORMAT_R32_TYPELESS), and the Format parameter must specify a format that is compatible with the source and destination (i.e. if both are DXGI_FORMAT_R32_TYPELESS then DXGI_FORMAT_R32_FLOAT or DXGI_FORMAT_R32_UINT could be specified in the Format parameter).  ?
 /// </remarks>
 /// <param name="source">Source resource. Must be multisampled. </param>
 /// <param name="sourceSubresource">The source subresource of the source resource. </param>
 /// <param name="destination">Destination resource. Must be a created with the <see cref="SharpDX.Direct3D10.ResourceUsage.Default"/> flag and be single-sampled. See <see cref="SharpDX.Direct3D10.Resource"/>. </param>
 /// <param name="destinationSubresource">A zero-based index, that identifies the destination subresource. See {{D3D10CalcSubresource}} for more details. </param>
 /// <param name="format">that indicates how the multisampled resource will be resolved to a single-sampled resource. See remarks. </param>
 /// <unmanaged>void ID3D10Device::ResolveSubresource([In] ID3D10Resource* pDstResource,[In] int DstSubresource,[In] ID3D10Resource* pSrcResource,[In] int SrcSubresource,[In] DXGI_FORMAT Format)</unmanaged>
 public void ResolveSubresource(SharpDX.Direct3D10.Resource source, int sourceSubresource, SharpDX.Direct3D10.Resource destination, int destinationSubresource, SharpDX.DXGI.Format format)
 {
     ResolveSubresource_(destination, destinationSubresource, source, sourceSubresource, format);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Copy a region from a source resource to a destination resource.
 /// </summary>
 /// <remarks>
 /// The source box must be within the size of the source resource. The destination location is an absolute value (not a relative value). The destination location can be offset from the source location; however, the size of the region to copy (including the destination location) must fit in the destination resource. If the resources are buffers, all coordinates are in bytes; if the resources are textures, all coordinates are in texels.   {{D3D10CalcSubresource}} is a helper function for calculating subresource indexes. CopySubresourceRegion performs the copy on the GPU (similar to a memcpy by the CPU). As a consequence, the source and destination resources must meet the following criteria:  Must be different subresources (although they can be from the same resource). Must be the same {{type}}. Must have compatible {{formats}} (the formats must either be identical or be from the same type group). For example, a DXGI_FORMAT_R32G32B32_FLOAT texture can be copied to an DXGI_FORMAT_R32G32B32_UINT texture because both of these formats are in the DXGI_FORMAT_R32G32B32_TYPELESS group. May not be currently {{mapped}}.  CopySubresourceRegion supports only copy; it does not support any stretch, color key, blend, or format conversions. An application that needs to copy an entire resource should use <see cref="SharpDX.Direct3D10.Device.CopyResource_"/> instead. CopySubresourceRegion is an asynchronous call that the runtime can add  to the command-buffer queue. This asynchronous behavior attempts to remove pipeline stalls that may occur when copying data. See {{performance considerations}} for more details.   Differences between Direct3D 10 and Direct3D 10.1: Direct3D 10 has the following limitations:  You cannot use a depth-stencil resource as a destination. You cannot use an immutable resource as a destination. You cannot use a multisampled texture as either a source or a destination  Direct3D 10.1 has added support for the following features:  You can use a depth-stencil buffer as a source or a destination. You can use multisampled resources as  source and destination only if both source and destination have identical multisampled count and quality. If source and destination differ in multisampled count and quality or if the source is multisampled and the destination is not multisampled (or vice versa), the call to ID3D10Device::CopySubresourceRegion fails. You can copy between uncompressed and compressed resources. During copy, the format conversions that are specified in  {{Format Conversion using Direct3D 10.1}} are supported automatically. The uncompressed resource must be at least prestructured, and typed. You must also account for the difference between the virtual and the physical size of the mipmap levels.    ? Note??If you use CopySubresourceRegion with a depth-stencil buffer or a multisampled resource, you must copy the whole subresource. You must also pass 0 to the DstX, DstY, and DstZ parameters and NULL to the pSrcBox parameter. In addition, source and destination resources, which are represented by the pSrcResource and pDstResource parameters respectively, must have identical sample count values. Example The following code snippet copies a box (located at (120,100),(200,220)) from a source texture into a region (130,120),(210,240) in a destination texture.
 /// <code> D3D10_BOX sourceRegion;
 /// sourceRegion.left = 120;
 /// sourceRegion.right = 200;
 /// sourceRegion.top = 100;
 /// sourceRegion.bottom = 220;
 /// sourceRegion.front = 0;
 /// sourceRegion.back = 1; pd3dDevice-&gt;CopySubresourceRegion( pDestTexture, 0, 130, 120, 0, pSourceTexture, 0, &amp;sourceRegion ); </code>
 ///
 ///  Notice that, for a 2D texture, front and back are always set to 0 and 1 respectively.
 /// </remarks>
 /// <param name="source">A reference to the source resource (see <see cref="SharpDX.Direct3D10.Resource"/>). </param>
 /// <param name="sourceSubresource">index of the source. </param>
 /// <param name="sourceRegion">A 3D box (see <see cref="SharpDX.Direct3D10.ResourceRegion"/>) that defines the source subresources that can be copied. If NULL, the entire source subresource is copied. The box must fit within the source resource. </param>
 /// <param name="destination">A reference to the destination resource (see <see cref="SharpDX.Direct3D10.Resource"/>). </param>
 /// <param name="destinationSubResource">index of the destination. </param>
 /// <param name="dstX">The x coordinate of the upper left corner of the destination region. </param>
 /// <param name="dstY">The y coordinate of the upper left corner of the destination region. </param>
 /// <param name="dstZ">The z coordinate of the upper left corner of the destination region. For a 1D or 2D subresource, this must be zero. </param>
 /// <unmanaged>void ID3D10Device::CopySubresourceRegion([In] ID3D10Resource* pDstResource,[In] int DstSubresource,[In] int DstX,[In] int DstY,[In] int DstZ,[In] ID3D10Resource* pSrcResource,[In] int SrcSubresource,[In, Optional] const D3D10_BOX* pSrcBox)</unmanaged>
 public void CopySubresourceRegion(SharpDX.Direct3D10.Resource source, int sourceSubresource, SharpDX.Direct3D10.ResourceRegion?sourceRegion, SharpDX.Direct3D10.Resource destination, int destinationSubResource, int dstX, int dstY, int dstZ)
 {
     CopySubresourceRegion_(destination, destinationSubResource, dstX, dstY, dstZ, source, sourceSubresource, sourceRegion);
 }