Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
MappedResource.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 namespace SiliconStudio.Paradox.Graphics
4 {
5  /// <summary>
6  /// A GPU resource mapped for CPU access. This is returned by using <see cref="GraphicsDevice.MapSubresource"/>
7  /// </summary>
8  public struct MappedResource
9  {
10  /// <summary>
11  /// Initializes a new instance of the <see cref="MappedResource"/> struct.
12  /// </summary>
13  /// <param name="resource">The resource.</param>
14  /// <param name="subResourceIndex">Index of the sub resource.</param>
15  /// <param name="dataBox">The data box.</param>
16  internal MappedResource(GraphicsResource resource, int subResourceIndex, DataBox dataBox)
17  {
18  Resource = resource;
19  SubResourceIndex = subResourceIndex;
20  DataBox = dataBox;
21  OffsetInBytes = 0;
22  SizeInBytes = -1;
23  }
24 
25  /// <summary>
26  /// Initializes a new instance of the <see cref="MappedResource"/> struct.
27  /// </summary>
28  /// <param name="resource">The resource.</param>
29  /// <param name="subResourceIndex">Index of the sub resource.</param>
30  /// <param name="dataBox">The data box.</param>
31  /// <param name="offsetInBytes">Offset since the beginning of the buffer.</param>
32  /// <param name="sizeInBytes">Size of the mapped resource.</param>
33  internal MappedResource(GraphicsResource resource, int subResourceIndex, DataBox dataBox, int offsetInBytes, int sizeInBytes)
34  {
35  Resource = resource;
36  SubResourceIndex = subResourceIndex;
37  DataBox = dataBox;
38  OffsetInBytes = offsetInBytes;
39  SizeInBytes = sizeInBytes;
40  }
41 
42  /// <summary>
43  /// The resource mapped.
44  /// </summary>
45  public readonly GraphicsResource Resource;
46 
47  /// <summary>
48  /// The subresource index.
49  /// </summary>
50  public readonly int SubResourceIndex;
51 
52  /// <summary>
53  /// The data box
54  /// </summary>
55  public readonly DataBox DataBox;
56 
57  /// <summary>
58  /// the offset of the mapped resource since the beginning of the buffer
59  /// </summary>
60  public readonly int OffsetInBytes;
61 
62  /// <summary>
63  /// the size of the mapped resource
64  /// </summary>
65  public readonly int SizeInBytes;
66  }
67 }
readonly GraphicsResource Resource
The resource mapped.
readonly int SubResourceIndex
The subresource index.
readonly DataBox DataBox
The data box
readonly int OffsetInBytes
the offset of the mapped resource since the beginning of the buffer
readonly int SizeInBytes
the size of the mapped resource
A GPU resource mapped for CPU access. This is returned by using GraphicsDevice.MapSubresource ...
Provides access to data organized in 3D.
Definition: DataBox.cs:12