Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
SiliconStudio.Paradox.Graphics.Texture2D Class Reference

A Texture 2D frontend to SharpDX.Direct3D11.Texture2D. More...

Inheritance diagram for SiliconStudio.Paradox.Graphics.Texture2D:
SiliconStudio.Paradox.Graphics.Texture2DBase SiliconStudio.Paradox.Graphics.Texture SiliconStudio.Paradox.Graphics.GraphicsResource SiliconStudio.Paradox.Graphics.GraphicsResourceBase SiliconStudio.Core.ComponentBase SiliconStudio.Core.IComponent SiliconStudio.Core.ICollectorHolder SiliconStudio.Core.IReferencable SiliconStudio.Core.IReferencable SiliconStudio.Paradox.Graphics.FakeTexture2D

Public Member Functions

override Texture Clone ()
 Makes a copy of this texture. More...
 
override Texture ToStaging ()
 Return an equivalent staging texture CPU read-writable from this instance. More...
 
- Public Member Functions inherited from SiliconStudio.Paradox.Graphics.Texture
ToTexture< T > (ViewType viewType, int arrayOrDepthSlice, int mipMapSlice)
 Gets a view on this texture for a particular ViewType, array index (or zIndex for Texture3D), and mipmap index. More...
 
abstract Texture ToTexture (ViewType viewType, int arraySlice, int mipMapSlice)
 Gets a view on this texture for a particular ViewType, array index (or zIndex for Texture3D), and mipmap index. More...
 
RenderTarget ToRenderTarget ()
 
MipMapDescription GetMipMapDescription (int mipmap)
 Gets the mipmap description of this instance for the specified mipmap level. More...
 
int GetSubResourceIndex (int arraySlice, int mipSlice)
 Gets the absolute sub-resource index from the array and mip slice. More...
 
int CalculateWidth< TData > (int mipLevel=0)
 Calculates the expected width of a texture using a specified type. More...
 
int CalculatePixelDataCount< TData > (int mipLevel=0)
 Calculates the number of pixel data this texture is requiring for a particular mip level. More...
 
Clone< T > ()
 Makes a copy of this texture with type casting. More...
 
TData[] GetData< TData > (int arraySlice=0, int mipSlice=0)
 Gets the content of this texture to an array of data. More...
 
bool GetData< TData > (TData[] toData, int arraySlice=0, int mipSlice=0, bool doNotWait=false)
 Copies the content of this texture to an array of data. More...
 
unsafe bool GetData< TData > (Texture stagingTexture, TData[] toData, int arraySlice=0, int mipSlice=0, bool doNotWait=false)
 Copies the content of this texture from GPU memory to an array of data on CPU memory using a specific staging resource. More...
 
void SetData< TData > (TData[] fromData, int arraySlice=0, int mipSlice=0, ResourceRegion?region=null)
 Copies the content an array of data on CPU memory to this texture into GPU memory. More...
 
void SetData (DataPointer fromData, int arraySlice=0, int mipSlice=0, ResourceRegion?region=null)
 Copies the content an data on CPU memory to this texture into GPU memory using the specified GraphicsDevice (The graphics device could be deffered). More...
 
unsafe void SetData< TData > (GraphicsDevice device, TData[] fromData, int arraySlice=0, int mipSlice=0, ResourceRegion?region=null)
 Copies the content an array of data on CPU memory to this texture into GPU memory using the specified GraphicsDevice (The graphics device could be deffered). More...
 
unsafe bool GetData (Texture stagingTexture, DataPointer toData, int arraySlice=0, int mipSlice=0, bool doNotWait=false)
 Copies the content of this texture from GPU memory to a pointer on CPU memory using a specific staging resource. More...
 
unsafe void SetData (GraphicsDevice device, DataPointer fromData, int arraySlice=0, int mipSlice=0, ResourceRegion?region=null)
 Copies the content an data on CPU memory to this texture into GPU memory. More...
 
void Save (Stream stream, ImageFileType fileType)
 Saves this texture to a stream with a specified format. More...
 
Image GetDataAsImage ()
 Gets the GPU content of this texture as an Image on the CPU. More...
 
Image GetDataAsImage (Texture stagingTexture)
 Gets the GPU content of this texture to an Image on the CPU. More...
 
void Save (Stream stream, Texture stagingTexture, ImageFileType fileType)
 Saves this texture to a stream with a specified format. More...
 
- Public Member Functions inherited from SiliconStudio.Core.ComponentBase
void Dispose ()
 
override string ToString ()
 

Static Public Member Functions

static Texture2D New (GraphicsDevice device, Texture2D texture)
 Creates a new texture from a Direct3D11.Texture2D. More...
 
static Texture2D New (GraphicsDevice device, TextureDescription textureDescription)
 Creates a new texture from a Direct3D11.Texture2D. More...
 
static Texture2D New (GraphicsDevice device, int width, int height, PixelFormat format, TextureFlags textureFlags=TextureFlags.ShaderResource, int arraySize=1, GraphicsResourceUsage usage=GraphicsResourceUsage.Default)
 Creates a new Texture2D with a single mipmap. More...
 
static Texture2D New (GraphicsDevice device, int width, int height, MipMapCount mipCount, PixelFormat format, TextureFlags textureFlags=TextureFlags.ShaderResource, int arraySize=1, GraphicsResourceUsage usage=GraphicsResourceUsage.Default)
 Creates a new Texture2D. More...
 
static unsafe Texture2D New< T > (GraphicsDevice device, int width, int height, PixelFormat format, T[] textureData, TextureFlags textureFlags=TextureFlags.ShaderResource, GraphicsResourceUsage usage=GraphicsResourceUsage.Immutable)
 Creates a new Texture2D with a single level of mipmap. More...
 
static Texture2D New (GraphicsDevice device, int width, int height, MipMapCount mipCount, PixelFormat format, DataBox[] textureData, TextureFlags textureFlags=TextureFlags.ShaderResource, int arraySize=1, GraphicsResourceUsage usage=GraphicsResourceUsage.Default)
 Creates a new Texture2D. More...
 
static new Texture2D New (GraphicsDevice device, Image image, TextureFlags textureFlags=TextureFlags.ShaderResource, GraphicsResourceUsage usage=GraphicsResourceUsage.Immutable)
 Creates a new Texture2D directly from an Image. More...
 
static new Texture2D Load (GraphicsDevice device, Stream stream, TextureFlags textureFlags=TextureFlags.ShaderResource, GraphicsResourceUsage usage=GraphicsResourceUsage.Immutable)
 Loads a 2D texture from a stream. More...
 
- Static Public Member Functions inherited from SiliconStudio.Paradox.Graphics.Texture2DBase
static TextureDescription NewDescription (int width, int height, PixelFormat format, TextureFlags textureFlags, int mipCount, int arraySize, GraphicsResourceUsage usage)
 
- Static Public Member Functions inherited from SiliconStudio.Paradox.Graphics.Texture
static int CalculateMipSize (int width, int mipLevel)
 
static Texture Load (GraphicsDevice device, Stream stream, TextureFlags textureFlags=TextureFlags.ShaderResource, GraphicsResourceUsage usage=GraphicsResourceUsage.Immutable)
 Loads a texture from a stream. More...
 
static Texture New (GraphicsDevice device, Image image, TextureFlags textureFlags=TextureFlags.ShaderResource, GraphicsResourceUsage usage=GraphicsResourceUsage.Immutable)
 Loads a texture from a stream. More...
 
static Texture New (GraphicsDevice graphicsDevice, TextureDescription description)
 Creates a new texture with the specified generic texture description. More...
 

Protected Member Functions

 Texture2D ()
 
- Protected Member Functions inherited from SiliconStudio.Paradox.Graphics.Texture2DBase
 Texture2DBase ()
 
- Protected Member Functions inherited from SiliconStudio.Paradox.Graphics.Texture
 Texture ()
 
 Texture (GraphicsDevice device, Texture parentTexture, ViewType viewType, int viewArraySlice, int viewMipLevel, PixelFormat viewFormat=PixelFormat.None)
 
 Texture (GraphicsDevice device, TextureDescription description, ViewType viewType, int viewArraySlice, int viewMipLevel, PixelFormat viewFormat=PixelFormat.None)
 
virtual TextureDescription GetCloneableDescription ()
 
override void Destroy ()
 Disposes of object resources. More...
 
- Protected Member Functions inherited from SiliconStudio.Paradox.Graphics.GraphicsResource
 GraphicsResource ()
 
 GraphicsResource (GraphicsDevice device)
 
 GraphicsResource (GraphicsDevice device, string name)
 
- Protected Member Functions inherited from SiliconStudio.Paradox.Graphics.GraphicsResourceBase
 GraphicsResourceBase ()
 Initializes a new instance of the GraphicsResourceBase class. More...
 
 GraphicsResourceBase (GraphicsDevice device)
 Initializes a new instance of the GraphicsResourceBase class. More...
 
 GraphicsResourceBase (GraphicsDevice device, string name)
 Initializes a new instance of the GraphicsResourceBase class. More...
 
- Protected Member Functions inherited from SiliconStudio.Core.ComponentBase
 ComponentBase ()
 Initializes a new instance of the ComponentBase class. More...
 
 ComponentBase (string name)
 Initializes a new instance of the ComponentBase class. More...
 
virtual void OnNameChanged ()
 Called when Name property was changed. More...
 

Additional Inherited Members

- Public Attributes inherited from SiliconStudio.Paradox.Graphics.Texture
readonly TextureDescription Description
 Common description for the original texture. More...
 
int Width
 The width of this texture view. More...
 
int Height
 The height of this texture view. More...
 
readonly int Depth
 The depth of this texture view. More...
 
readonly PixelFormat ViewFormat
 The format of this texture view. More...
 
readonly ViewType ViewType
 The format of this texture view. More...
 
readonly int MipLevel
 The miplevel index of this texture view. More...
 
readonly int ArraySlice
 The array index of this texture view. More...
 
readonly bool IsBlockCompressed
 Gets a boolean indicating whether this Texture is a using a block compress format (BC1, BC2, BC3, BC4, BC5, BC6H, BC7). More...
 
- Public Attributes inherited from SiliconStudio.Paradox.Graphics.GraphicsResourceBase
Action< GraphicsResourceBaseReload
 
- Public Attributes inherited from SiliconStudio.Core.ComponentBase
PropertyContainer Tags
 Gets the attached properties to this component. More...
 
- Static Protected Member Functions inherited from SiliconStudio.Paradox.Graphics.Texture
static DataBox GetDataBox< T > (PixelFormat format, int width, int height, int depth, T[] textureData, IntPtr fixedPointer)
 
- Properties inherited from SiliconStudio.Paradox.Graphics.GraphicsResourceBase
GraphicsDevice GraphicsDevice [get, set]
 Gets the graphics device attached to this instance. More...
 
- Properties inherited from SiliconStudio.Core.ComponentBase
long Id [get, set]
 
string Name [get, set]
 Gets or sets the name of this component. More...
 
bool IsDisposed [get, set]
 Has the component been disposed or not yet. More...
 
- Properties inherited from SiliconStudio.Core.IComponent
long Id [get]
 Gets the id of this component. More...
 
string Name [get]
 Gets the name of this component. More...
 
- Properties inherited from SiliconStudio.Core.IReferencable
int ReferenceCount [get]
 Gets the reference count of this instance. More...
 
- Properties inherited from SiliconStudio.Core.ICollectorHolder
ObjectCollector Collector [get]
 Gets the collector. More...
 

Detailed Description

A Texture 2D frontend to SharpDX.Direct3D11.Texture2D.

Definition at line 37 of file Texture2D.cs.

Constructor & Destructor Documentation

SiliconStudio.Paradox.Graphics.Texture2D.Texture2D ( )
protected

Definition at line 39 of file Texture2D.cs.

Member Function Documentation

override Texture SiliconStudio.Paradox.Graphics.Texture2D.Clone ( )
virtual

Makes a copy of this texture.

This method doesn't copy the content of the texture.

Returns
A copy of this texture.

Implements SiliconStudio.Paradox.Graphics.Texture.

Definition at line 52 of file Texture2D.cs.

static new Texture2D SiliconStudio.Paradox.Graphics.Texture2D.Load ( GraphicsDevice  device,
Stream  stream,
TextureFlags  textureFlags = TextureFlags.ShaderResource,
GraphicsResourceUsage  usage = GraphicsResourceUsage.Immutable 
)
static

Loads a 2D texture from a stream.

Parameters
deviceThe GraphicsDevice.
streamThe stream to load the texture from.
textureFlagsTrue to load the texture with unordered access enabled. Default is false.
usageUsage of the resource. Default is GraphicsResourceUsage.Immutable
Exceptions
ArgumentExceptionIf the texture is not of type 2D
Returns
A texture

Definition at line 189 of file Texture2D.cs.

static Texture2D SiliconStudio.Paradox.Graphics.Texture2D.New ( GraphicsDevice  device,
Texture2D  texture 
)
static

Creates a new texture from a Direct3D11.Texture2D.

Parameters
deviceThe GraphicsDevice.
textureThe native texture Direct3D11.Texture2D.
Returns
A new instance of Texture2D class.

Definition at line 74 of file Texture2D.cs.

static Texture2D SiliconStudio.Paradox.Graphics.Texture2D.New ( GraphicsDevice  device,
TextureDescription  textureDescription 
)
static

Creates a new texture from a Direct3D11.Texture2D.

Parameters
deviceThe GraphicsDevice.
textureThe native texture Direct3D11.Texture2D.
Returns
A new instance of Texture2D class.

Definition at line 87 of file Texture2D.cs.

static Texture2D SiliconStudio.Paradox.Graphics.Texture2D.New ( GraphicsDevice  device,
int  width,
int  height,
PixelFormat  format,
TextureFlags  textureFlags = TextureFlags.ShaderResource,
int  arraySize = 1,
GraphicsResourceUsage  usage = GraphicsResourceUsage.Default 
)
static

Creates a new Texture2D with a single mipmap.

Parameters
deviceThe GraphicsDevice.
widthThe width.
heightThe height.
formatDescribes the format to use.
textureFlagstrue if the texture needs to support unordered read write.
arraySizeSize of the texture 2D array, default to 1.
usageThe usage.
Returns
A new instance of Texture2D class.

Definition at line 103 of file Texture2D.cs.

static Texture2D SiliconStudio.Paradox.Graphics.Texture2D.New ( GraphicsDevice  device,
int  width,
int  height,
MipMapCount  mipCount,
PixelFormat  format,
TextureFlags  textureFlags = TextureFlags.ShaderResource,
int  arraySize = 1,
GraphicsResourceUsage  usage = GraphicsResourceUsage.Default 
)
static

Creates a new Texture2D.

Parameters
deviceThe GraphicsDevice.
widthThe width.
heightThe height.
formatDescribes the format to use.
mipCountNumber of mipmaps, set to true to have all mipmaps, set to an int >=1 for a particular mipmap count.
textureFlagstrue if the texture needs to support unordered read write.
arraySizeSize of the texture 2D array, default to 1.
usageThe usage.
Returns
A new instance of Texture2D class.

Definition at line 120 of file Texture2D.cs.

static Texture2D SiliconStudio.Paradox.Graphics.Texture2D.New ( GraphicsDevice  device,
int  width,
int  height,
MipMapCount  mipCount,
PixelFormat  format,
DataBox[]  textureData,
TextureFlags  textureFlags = TextureFlags.ShaderResource,
int  arraySize = 1,
GraphicsResourceUsage  usage = GraphicsResourceUsage.Default 
)
static

Creates a new Texture2D.

Parameters
deviceThe GraphicsDevice.
widthThe width.
heightThe height.
formatDescribes the format to use.
mipCountNumber of mipmaps, set to true to have all mipmaps, set to an int >=1 for a particular mipmap count.
textureDataTexture datas through an array of DataBox
textureFlagstrue if the texture needs to support unordered read write.
arraySizeSize of the texture 2D array, default to 1.
usageThe usage.
Returns
A new instance of Texture2D class.

Definition at line 158 of file Texture2D.cs.

static new Texture2D SiliconStudio.Paradox.Graphics.Texture2D.New ( GraphicsDevice  device,
Image  image,
TextureFlags  textureFlags = TextureFlags.ShaderResource,
GraphicsResourceUsage  usage = GraphicsResourceUsage.Immutable 
)
static

Creates a new Texture2D directly from an Image.

Parameters
deviceThe GraphicsDevice.
imageAn image in CPU memory.
textureFlagstrue if the texture needs to support unordered read write.
usageThe usage.
Returns
A new instance of Texture2D class.

Definition at line 171 of file Texture2D.cs.

References SiliconStudio.Paradox.Graphics.Image.Description, SiliconStudio.Paradox.Graphics.ImageDescription.Dimension, and SiliconStudio.Paradox.Graphics.Image.ToDataBox().

static unsafe Texture2D SiliconStudio.Paradox.Graphics.Texture2D.New< T > ( GraphicsDevice  device,
int  width,
int  height,
PixelFormat  format,
T[]  textureData,
TextureFlags  textureFlags = TextureFlags.ShaderResource,
GraphicsResourceUsage  usage = GraphicsResourceUsage.Immutable 
)
static

Creates a new Texture2D with a single level of mipmap.

Template Parameters
TType of the pixel data to upload to the texture.
Parameters
deviceThe GraphicsDevice.
widthThe width.
heightThe height.
formatDescribes the format to use.
usageThe usage.
textureFlagstrue if the texture needs to support unordered read write.
textureDataThe texture data for a single mipmap and a single array slice. See remarks
Returns
A new instance of Texture2D class.

Each value in textureData is a pixel in the destination texture.

Type Constraints
T :struct 

Definition at line 140 of file Texture2D.cs.

References DirectX.format.

override Texture SiliconStudio.Paradox.Graphics.Texture2D.ToStaging ( )
virtual

Return an equivalent staging texture CPU read-writable from this instance.

Returns

Implements SiliconStudio.Paradox.Graphics.Texture.

Definition at line 61 of file Texture2D.cs.


The documentation for this class was generated from the following file: