Sdílet prostřednictvím


Texture3D.SetData Generic Method (Int32, Int32, Int32, Int32, Int32, Int32, Int32, T , Int32, Int32, SetDataOptions)

Copies array data to the texture, specifying the dimensions of the volume and the mipmap level where the data is to be placed.

Namespace: Microsoft.Xna.Framework.Graphics
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

Syntax

public void SetData<T> (
         int level,
         int left,
         int top,
         int right,
         int bottom,
         int front,
         int back,
         T[] data,
         int startIndex,
         int elementCount,
         SetDataOptions options
) where T : ValueType

Type Parameters

  • T
    The type of the elements in the array.

Parameters

  • level
    The mipmap level where the data will be placed.
  • left
    Position of the left side of the box on the x-axis.
  • top
    Position of the top of the box on the y-axis.
  • right
    Position of the right side of the box on the x-axis.
  • bottom
    Position of the bottom of the box on the y-axis.
  • front
    Position of the front of the box on the z-axis.
  • back
    Position of the back of the box on the z-axis.
  • data
    The array of data to copy. The number of elements in the array should be equal to the size of the box where the data will be placed.
  • startIndex
    The index of the element in the array at which to start copying.
  • elementCount
    The number of elements to copy.
  • options
    Option specifying whether existing data in the buffer will be kept after this operation.

Exceptions

Exception type Condition
ArgumentException data is null.
InvalidOperationException The size of the data passed in is too large or too small for this resource.

Remarks

On Windows, GetData and SetData will fail if Texture3D.ResourceManagementMode is ResourceManagementMode.Manual and the format cannot be used as a render target.

Warning

In the Draw method of an Xbox 360 game, vertex buffers, index buffers, and textures should not be written using when they are intended to be used for rendering. This condition may lead to graphics corruption or crashes.

This is because, in cases where the size of the back buffer and depth-stencil buffer exceed the size of the Xbox 360 10 MB of embedded memory (EDRAM), predicated tiling is utilized on this platform to compensate for the additional memory requirements. Predicated tiling is a process by which scene rendering is performed multiple times on subsections of the final render target dimensions.

When predicated tiling has been triggered, the drawing commands contained in the Draw function are not submitted until Present is called. (Note that Draw implicitly calls Present at the end of this method.) In this case, these resources are not available for modification until the GPU is finished with presenting the entire frame.

See Also

Concepts

Predicated Tiling

Reference

Texture3D Class
Texture3D Members
Microsoft.Xna.Framework.Graphics Namespace

Platforms

Xbox 360, Windows XP SP2, Windows Vista