ITextureFactory
Description
- Extended by
-
TextureFactory abstract
Base interface for classes that create texture resources for rendering.
The following figures gives an overview of the classes that are related to the ITextureFactory interface.
+-----------------+ | ITextureFactory | +-----------------+ | | V +----------------+ (1) <---- | TextureFormat | The binary texel format. | +----------------+ | | | | (3) | V V +----------------+ (5) +-------------+ (2) <---- | TexelBuffer | <----- | ColorBuffer | | +----------------+ +-------------+ | | Pixel buffer, filled | | (4) by application | V | +----------------+ °-------> | ITexture2D | Texture for GPU-based rendering +----------------+
(1)
: CreateTexture2D
(2)
: CreateTexture2DStatic
(3)
: TextureFormat.CreateBuffer
(4)
: ITexture2D.SetTexels
(5)
: TexelBuffer.PixelEncode
- See also
Public / Methods
CreateTexture2D
Creates a ITexture2D object with ResourceAccessPattern.Dynamic access.
If the given combination of width in, height in, format in and srgb opt is not supported (see ValidateTextureSize and ValidateTextureFormat), a RenderException is thrown.
- RenderException
-
If a graphics subsystem error has occurred.
CreateTexture2DStatic
Creates a ITexture2D object with ResourceAccessPattern.Static access.
The ValidateTextureSize method will be called to determine supported texture dimensions (see ITexelBufferInfo.Width / ITexelBufferInfo.Height), and the texture contents will be scaled, if necessary (see TexelBuffer.Convert3).
The ValidateTextureFormat method will be called to find a supported texture format for the given texture contents (see ITexelBufferInfo.Format), and the texture contents will be converted, if necessary (see TexelBuffer.Convert1).
- RenderException
-
If a graphics subsystem error has occurred.
ValidateTextureFormat
Checks if this texture factory supports the given texture format. If not it returns a supported format that matches format in as closely as possible.
Implementations usually need to perform render API calls in order to determine texture format support, which may include creation of dummy resources. However, implementations will cache validation results for each (format in,srgb in) tuple, to avoid unnecessary work at runtime.
Public / Attributes
AvailableVideoMemory
Returns a coarse estimate of the total amount of (dedicated) GPU memory.
This value should only be used for large-scale decisions regarding use of resource sets and can never be used to decide whether a specific resource will fit into free memory.
Extensions
ComputeTextureCount
Translates the given logical texture count in a supported combination of texture resource count and texture slice count.
CreateTexture2DStatic
3 overloads
Creates a ITexture2D object with ResourceAccessPattern.Static access.
The ITextureFactory.ValidateTextureSize method will be called to determine supported texture dimensions (see ITexelBufferInfo.Width / ITexelBufferInfo.Height), and the texture contents will be scaled, if necessary (see TexelBuffer.Convert3).
The ITextureFactory.ValidateTextureFormat method will be called to find a supported texture format for the given texture contents (see ITexelBufferInfo.Format), and the texture contents will be converted, if necessary (see TexelBuffer.Convert1).
- RenderException
-
If a graphics subsystem error has occurred.
Creates a ITexture2D object with ResourceAccessPattern.Static access.
The ISrgb.Srgb flag of the loaded texel buffer (see IImage.ReadTexture) defines the sRGB behaviour of the created texture (see ITexture.IsSrgb).
- IOException
-
If an I/O error has occurred.
- ValidatingException
-
If the image reader has reported an error, for example because of an unsupported file format feature.
- RenderException
-
If a graphics subsystem error has occurred.
Creates a ITexture2D object with ResourceAccessPattern.Static access.
The created texture has the default format, see DefaultTextureFormat.
- RenderException
-
If a graphics subsystem error has occurred.
ValidateTextureSize
2 overloads
Validates the given texture size by adjusting the width and height according to the texture size restrictions of this factory (e.g. must-be-square).
Validates the given texture size by adjusting the width and height according to the texture size restrictions of this factory (e.g. must-be-square).