![]() |
Paradox Game Engine
v1.0.0 beta06
|
Base class for texture resources. More...
Public Member Functions | |
T | 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... | |
abstract Texture | Clone () |
Makes a copy of this texture. More... | |
T | 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... | |
abstract Texture | ToStaging () |
Return an equivalent staging texture CPU read-writable from this instance. 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... | |
![]() | |
void | Dispose () |
override string | ToString () |
Static Public Member Functions | |
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... | |
Public Attributes | |
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... | |
![]() | |
Action< GraphicsResourceBase > | Reload |
![]() | |
PropertyContainer | Tags |
Gets the attached properties to this component. More... | |
Protected Member Functions | |
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... | |
![]() | |
GraphicsResource () | |
GraphicsResource (GraphicsDevice device) | |
GraphicsResource (GraphicsDevice device, string name) | |
![]() | |
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... | |
![]() | |
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... | |
Static Protected Member Functions | |
static DataBox | GetDataBox< T > (PixelFormat format, int width, int height, int depth, T[] textureData, IntPtr fixedPointer) |
Additional Inherited Members | |
![]() | |
GraphicsDevice | GraphicsDevice [get, set] |
Gets the graphics device attached to this instance. More... | |
![]() | |
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... | |
![]() | |
long | Id [get] |
Gets the id of this component. More... | |
string | Name [get] |
Gets the name of this component. More... | |
![]() | |
int | ReferenceCount [get] |
Gets the reference count of this instance. More... | |
![]() | |
ObjectCollector | Collector [get] |
Gets the collector. More... | |
Base class for texture resources.
T | Type of the N:SharpDX.Direct3D11 texture resource. |
Definition at line 38 of file Texture.cs.
|
protected |
Definition at line 102 of file Texture.cs.
Referenced by SiliconStudio.Paradox.Effects.LightShaftsPlugin.Initialize().
|
protected |
Definition at line 106 of file Texture.cs.
|
protected |
Definition at line 113 of file Texture.cs.
|
static |
Definition at line 183 of file Texture.cs.
int SiliconStudio.Paradox.Graphics.Texture.CalculatePixelDataCount< TData > | ( | int | mipLevel = 0 | ) |
Calculates the number of pixel data this texture is requiring for a particular mip level.
TData | The type of the T pixel data. |
mipLevel | The mip level. |
This method is used to allocated a texture data buffer to hold pixel datas: var textureData = new T[ texture.CalculatePixelCount<T>() ] ;.
TData | : | struct |
Definition at line 227 of file Texture.cs.
int SiliconStudio.Paradox.Graphics.Texture.CalculateWidth< TData > | ( | int | mipLevel = 0 | ) |
Calculates the expected width of a texture using a specified type.
TData | The type of the T pixel data. |
System.ArgumentException | If the size is invalid |
TData | : | struct |
Definition at line 207 of file Texture.cs.
|
pure virtual |
Makes a copy of this texture.
This method doesn't copy the content of the texture.
Implemented in SiliconStudio.Paradox.Graphics.Texture2D, SiliconStudio.Paradox.Graphics.Texture1D, SiliconStudio.Paradox.Graphics.Texture3D, SiliconStudio.Paradox.Graphics.TextureCube, and SiliconStudio.Paradox.Graphics.FakeTexture.
T SiliconStudio.Paradox.Graphics.Texture.Clone< T > | ( | ) |
Makes a copy of this texture with type casting.
This method doesn't copy the content of the texture.
T | : | Texture |
Definition at line 252 of file Texture.cs.
|
protectedvirtual |
Disposes of object resources.
Reimplemented from SiliconStudio.Paradox.Graphics.GraphicsResourceBase.
Definition at line 138 of file Texture.cs.
|
protectedvirtual |
Definition at line 130 of file Texture.cs.
unsafe bool SiliconStudio.Paradox.Graphics.Texture.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.
stagingTexture | The staging texture used to transfer the texture to. |
toData | The pointer to data in CPU memory. |
arraySlice | The array slice index. This value must be set to 0 for Texture 3D. |
mipSlice | The mip slice index. |
doNotWait | if set to true this method will return immediately if the resource is still being used by the GPU for writing. Default is false |
true
if data was correctly retrieved, false
if doNotWait flag was true and the resource is still being used by the GPU for writing.System.ArgumentException | When strides is different from optimal strides, and TData is not the same size as the pixel format, or Width * Height != toData.Length |
This method is only working when called from the main thread that is accessing the main GraphicsDevice.
Definition at line 389 of file Texture.cs.
References SiliconStudio.Paradox.Graphics.DataPointer.Size.
TData [] SiliconStudio.Paradox.Graphics.Texture.GetData< TData > | ( | int | arraySlice = 0 , |
int | mipSlice = 0 |
||
) |
Gets the content of this texture to an array of data.
TData | The type of the T data. |
arraySlice | The array slice index. This value must be set to 0 for Texture 3D. |
mipSlice | The mip slice index. |
This method is only working when called from the main thread that is accessing the main GraphicsDevice. This method creates internally a stagging resource, copies to it and map it to memory. Use method with explicit staging resource for optimal performances.
TData | : | struct |
Definition at line 268 of file Texture.cs.
bool SiliconStudio.Paradox.Graphics.Texture.GetData< TData > | ( | TData[] | toData, |
int | arraySlice = 0 , |
||
int | mipSlice = 0 , |
||
bool | doNotWait = false |
||
) |
Copies the content of this texture to an array of data.
TData | The type of the T data. |
toData | The destination buffer to receive a copy of the texture datas. |
arraySlice | The array slice index. This value must be set to 0 for Texture 3D. |
mipSlice | The mip slice index. |
doNotWait | if set to true this method will return immediately if the resource is still being used by the GPU for writing. Default is false |
true
if data was correctly retrieved, false
if doNotWait flag was true and the resource is still being used by the GPU for writing.This method is only working when called from the main thread that is accessing the main GraphicsDevice. This method creates internally a stagging resource if this texture is not already a stagging resouce, copies to it and map it to memory. Use method with explicit staging resource for optimal performances.
TData | : | struct |
Definition at line 288 of file Texture.cs.
unsafe bool SiliconStudio.Paradox.Graphics.Texture.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.
TData | The type of the T data. |
stagingTexture | The staging texture used to transfer the texture to. |
toData | To data. |
arraySlice | The array slice index. This value must be set to 0 for Texture 3D. |
mipSlice | The mip slice index. |
doNotWait | if set to true this method will return immediately if the resource is still being used by the GPU for writing. Default is false |
true
if data was correctly retrieved, false
if doNotWait flag was true and the resource is still being used by the GPU for writing.System.ArgumentException | When strides is different from optimal strides, and TData is not the same size as the pixel format, or Width * Height != toData.Length |
This method is only working when called from the main thread that is accessing the main GraphicsDevice.
TData | : | struct |
Definition at line 318 of file Texture.cs.
Image SiliconStudio.Paradox.Graphics.Texture.GetDataAsImage | ( | ) |
Gets the GPU content of this texture as an Image on the CPU.
Definition at line 706 of file Texture.cs.
Gets the GPU content of this texture to an Image on the CPU.
stagingTexture | The staging texture used to temporary transfer the image from the GPU to CPU. |
ArgumentException | If stagingTexture is not a staging texture. |
Definition at line 717 of file Texture.cs.
References SiliconStudio.Paradox.Graphics.Texture.Description, and SiliconStudio.Paradox.Graphics.TextureDescription.Usage.
|
staticprotected |
MipMapDescription SiliconStudio.Paradox.Graphics.Texture.GetMipMapDescription | ( | int | mipmap | ) |
Gets the mipmap description of this instance for the specified mipmap level.
mipmap | The mipmap. |
Definition at line 178 of file Texture.cs.
int SiliconStudio.Paradox.Graphics.Texture.GetSubResourceIndex | ( | int | arraySlice, |
int | mipSlice | ||
) |
Gets the absolute sub-resource index from the array and mip slice.
arraySlice | The array slice index. |
mipSlice | The mip slice index. |
Definition at line 196 of file Texture.cs.
|
static |
Loads a texture from a stream.
device | The GraphicsDevice. |
stream | The stream to load the texture from. |
textureFlags | True to load the texture with unordered access enabled. Default is false. |
usage | Usage of the resource. Default is GraphicsResourceUsage.Immutable |
Definition at line 631 of file Texture.cs.
Referenced by ScriptTest.ScriptParticleSmoke.Run().
|
static |
Loads a texture from a stream.
device | The GraphicsDevice. |
image | The image. |
textureFlags | True to load the texture with unordered access enabled. Default is false. |
usage | Usage of the resource. Default is GraphicsResourceUsage.Immutable |
System.InvalidOperationException | Dimension not supported |
Definition at line 646 of file Texture.cs.
References SiliconStudio.Paradox.Graphics.Image.Description, and SiliconStudio.Paradox.Graphics.ImageDescription.Dimension.
Referenced by SiliconStudio.Paradox.Graphics.Data.GpuTextureSerializer2< T >.Serialize().
|
static |
Creates a new texture with the specified generic texture description.
graphicsDevice | The graphics device. |
description | The description. |
Definition at line 671 of file Texture.cs.
References SiliconStudio.Paradox.Graphics.TextureDescription.Dimension.
void SiliconStudio.Paradox.Graphics.Texture.Save | ( | Stream | stream, |
ImageFileType | fileType | ||
) |
Saves this texture to a stream with a specified format.
stream | The stream. |
fileType | Type of the image file. |
Definition at line 696 of file Texture.cs.
void SiliconStudio.Paradox.Graphics.Texture.Save | ( | Stream | stream, |
Texture | stagingTexture, | ||
ImageFileType | fileType | ||
) |
Saves this texture to a stream with a specified format.
stream | The stream. |
stagingTexture | The staging texture used to temporary transfer the image from the GPU to CPU. |
fileType | Type of the image file. |
ArgumentException | If stagingTexture is not a staging texture. |
Definition at line 750 of file Texture.cs.
void SiliconStudio.Paradox.Graphics.Texture.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).
fromData | The data to copy from. |
arraySlice | The array slice index. This value must be set to 0 for Texture 3D. |
mipSlice | The mip slice index. |
region | Destination region |
System.ArgumentException | When strides is different from optimal strides, and TData is not the same size as the pixel format, or Width * Height != toData.Length |
This method is only working on the main graphics device. Use method with explicit graphics device to set data on a deferred context. See also unmanaged documentation about Map/UnMap for usage and restrictions.
Definition at line 353 of file Texture.cs.
unsafe void SiliconStudio.Paradox.Graphics.Texture.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.
device | The GraphicsDevice. |
fromData | The data to copy from. |
arraySlice | The array slice index. This value must be set to 0 for Texture 3D. |
mipSlice | The mip slice index. |
region | Destination region |
System.ArgumentException | When strides is different from optimal strides, and TData is not the same size as the pixel format, or Width * Height != toData.Length |
See unmanaged documentation for usage and restrictions.
Definition at line 497 of file Texture.cs.
References SiliconStudio.Paradox.Graphics.DataPointer.Pointer, and SiliconStudio.Paradox.Graphics.DataPointer.Size.
void SiliconStudio.Paradox.Graphics.Texture.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.
TData | The type of the T data. |
fromData | The data to copy from. |
arraySlice | The array slice index. This value must be set to 0 for Texture 3D. |
mipSlice | The mip slice index. |
region | Destination region |
System.ArgumentException | When strides is different from optimal strides, and TData is not the same size as the pixel format, or Width * Height != toData.Length |
This method is only working on the main graphics device. Use method with explicit graphics device to set data on a deferred context. See also unmanaged documentation about Map/UnMap for usage and restrictions.
TData | : | struct |
Definition at line 336 of file Texture.cs.
unsafe void SiliconStudio.Paradox.Graphics.Texture.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).
TData | The type of the T data. |
device | The GraphicsDevice. |
fromData | The data to copy from. |
arraySlice | The array slice index. This value must be set to 0 for Texture 3D. |
mipSlice | The mip slice index. |
region | Destination region |
System.ArgumentException | When strides is different from optimal strides, and TData is not the same size as the pixel format, or Width * Height != toData.Length |
See unmanaged documentation for usage and restrictions.
TData | : | struct |
Definition at line 371 of file Texture.cs.
RenderTarget SiliconStudio.Paradox.Graphics.Texture.ToRenderTarget | ( | ) |
Definition at line 168 of file Texture.cs.
|
pure virtual |
Return an equivalent staging texture CPU read-writable from this instance.
Implemented in SiliconStudio.Paradox.Graphics.Texture2D, SiliconStudio.Paradox.Graphics.Texture1D, SiliconStudio.Paradox.Graphics.Texture3D, SiliconStudio.Paradox.Graphics.TextureCube, and SiliconStudio.Paradox.Graphics.FakeTexture.
|
pure virtual |
Gets a view on this texture for a particular ViewType, array index (or zIndex for Texture3D), and mipmap index.
viewType | The type of the view to create. |
arraySlice | |
mipMapSlice |
Implemented in SiliconStudio.Paradox.Graphics.FakeTexture.
T 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.
viewType | The type of the view to create. |
arrayOrDepthSlice | |
mipMapSlice |
T | : | Texture |
Definition at line 154 of file Texture.cs.
readonly int SiliconStudio.Paradox.Graphics.Texture.ArraySlice |
The array index of this texture view.
Definition at line 78 of file Texture.cs.
readonly int SiliconStudio.Paradox.Graphics.Texture.Depth |
The depth of this texture view.
Definition at line 58 of file Texture.cs.
readonly TextureDescription SiliconStudio.Paradox.Graphics.Texture.Description |
Common description for the original texture.
Definition at line 43 of file Texture.cs.
Referenced by SiliconStudio.Paradox.Effects.Images.ImageEffectContext.AddReferenceToTemporaryTexture(), SiliconStudio.Paradox.Graphics.Texture.GetDataAsImage(), and SiliconStudio.Paradox.Effects.Images.ImageEffectContext.ReleaseTemporaryTexture().
int SiliconStudio.Paradox.Graphics.Texture.Height |
The height of this texture view.
Definition at line 53 of file Texture.cs.
readonly bool SiliconStudio.Paradox.Graphics.Texture.IsBlockCompressed |
Gets a boolean indicating whether this Texture is a using a block compress format (BC1, BC2, BC3, BC4, BC5, BC6H, BC7).
Definition at line 83 of file Texture.cs.
readonly int SiliconStudio.Paradox.Graphics.Texture.MipLevel |
The miplevel index of this texture view.
Definition at line 73 of file Texture.cs.
readonly PixelFormat SiliconStudio.Paradox.Graphics.Texture.ViewFormat |
The format of this texture view.
Definition at line 63 of file Texture.cs.
readonly ViewType SiliconStudio.Paradox.Graphics.Texture.ViewType |
The format of this texture view.
Definition at line 68 of file Texture.cs.
int SiliconStudio.Paradox.Graphics.Texture.Width |
The width of this texture view.
Definition at line 48 of file Texture.cs.