Struct which contains all the parameters that are needed for texture creation. More...
#include <kanzi/core.ui/graphics2d/texture_create_info.hpp>
Public Member Functions | |
Status | adjust (const Renderer &renderer, string_view name) |
Validates and applies adjustments to some texture creation parameters in case of avoidable error conditions. More... | |
CreateInfo () | |
Default constructor for texture create info. More... | |
void | updateShapeAndFormatFromImages () |
Use updateShapeAndFormatFromImages() to fill in format, width, height from images. More... | |
Status | validate (const Renderer &renderer, string_view name) const |
Perform validation of texture creation parameters. More... | |
Status | validate (const Renderer &renderer) const |
Perform validation of texture creation parameters. More... | |
Static Public Member Functions | |
static CreateInfo | createSubstitutePattern (const Renderer &renderer, TextureType type) |
Create a texture create info structure for a black 1x1 texture. More... | |
Public Attributes | |
Sampler::AddressingMode | addressingMode |
Texture addressing mode. More... | |
float | anisotropy |
Texture anisotropy. More... | |
unsigned int | depth |
Reserved for future use. More... | |
GraphicsCompareFunction | depthCompareFunction |
Depth comparison function. More... | |
GraphicsFormat | depthStencilFormat |
DepthStencil format. More... | |
unsigned int | features |
Required format features. More... | |
GraphicsFormat | format |
Format for texture. More... | |
unsigned int | height |
Height for the base level of texture. More... | |
unsigned int | heightDivisor |
Automatic size determination divisor for height, 0 when not automatic. More... | |
vector< BitmapImageSharedPtr > | images |
Images that are used to create the texture. More... | |
Sampler::Filter | magnificationFilter |
Texture minification filter. More... | |
float | maxLod |
Reserved for future use. More... | |
MemoryType | memoryType |
Memory type for the texture. More... | |
Sampler::Filter | minificationFilter |
Texture magnification filter. More... | |
float | minLod |
Reserved for future use. More... | |
float | mipLodBias |
Reserved for future use. More... | |
unsigned int | mipmapLevelCount |
Number of mipmap levels for the texture. More... | |
Sampler::MipmapMode | mipmapMode |
Mipmap mode for the texture. More... | |
NativeDeploymentTarget | nativeDeploymentTarget |
Native deployment target to use for memory storage if supported by the backend. More... | |
RenderTargetMode | renderTargetMode |
RenderTarget mode for the texture. More... | |
unsigned int | renderTargetSampleCount |
Specifies number of samples for the draw renderbuffer when RenderTargetMode is RenderTargetModeExternal. More... | |
TextureType | type |
Texture type. More... | |
unsigned int | width |
Width for the base level of texture. More... | |
unsigned int | widthDivisor |
Automatic size determination divisor for width, 0 when not automatic. More... | |
Protected Member Functions | |
Status | validateFormat (const Renderer &renderer) const |
Validates texture format and features. More... | |
Status | validateImages (const Renderer &renderer) const |
Test if given set of images can be used to create Texture. More... | |
Status | validateSize (const Renderer &renderer) const |
Validates texture size against minimum valid texture size (1x1) and maximum supported by graphics adapter. More... | |
Status | validateTargetCompatibility (const Renderer &renderer) const |
Checks for known device incompatibilities, for example with texture formats and size. More... | |
Friends | |
class | Texture |
Struct which contains all the parameters that are needed for texture creation.
Status tells if texture creation parameters can be used to create a texture.
If status is not StatusValid, create info must not be passed to Texture::create().
Enumerator | |
---|---|
StatusInvalidType | Invalid texture type. See Texture::Type for valid texture types. |
StatusTypeNotSupported | Requested Texture type is not supported. |
StatusInvalidRenderTargetMode | Requested rendertarget mode is not valid. |
StatusInvalidImageCount | Wrong number of images. Two dimensional textures must have 0 or 1 image, cubemap textures must have 0 or 6 images. |
StatusMissingImages | Not all images were properly defined. |
StatusImageMissingMipmaps | Mipmaps are required, but the image is missing them. |
StatusInvalidImageSize | Sizes of images are inconsistent. |
StatusInvalidMinimumSize | Image size must be at least 1 x 1. |
StatusInvalidMaximumSize | Image size cannot exceed size supported by the GL device. |
StatusInvalidMipmapSize | Image mipmap size was not correctly derived from base image. |
StatusUnsupportedGraphicsFormat | Unsupported image format. |
StatusUnsupportedTextureFilter | Requested filtering mode is not supported for requested graphics format. |
StatusInvalidFeatures | Requested graphics format features are not valid for texture. |
StatusUnsupportedMultisampleFilter | Multisample textures do not support filtering. |
StatusUnsupportedMultisampleMipmaps | Multisample textures do not support mipmaps. |
StatusUnsupportedMultisampleSamples | Multisample textures must have a valid number of samples. |
StatusUnsupportedInternalRenderTargetSampleCount | Textures with rendertarget mode set to RenderTargetModeInternal do not support multisampling. |
StatusUnsupportedSampleCount | Requested number of multisample sample exceeds number of multisample samples supported by the graphics device. |
StatusImageFormatMismatch | Inconsistent image formats. |
StatusImageIncompatibleWithDevice | Image incompatible with target device. |
StatusUnsupportedDepthComparisonMode | Requested depth comparison mode is not supported by graphics device. |
StatusValid | CreateInfo is valid and can be used to create Texture. |
|
explicit |
Default constructor for texture create info.
After the CreateInfo constructor:
If you use this constructor, then you must fill in at least type, format, width and height before CreateInfo can be used to create texture.
Perform validation of texture creation parameters.
You can call validate() to see if texture creation parameters are valid before you pass create info to Texture::create().
renderer | Renderer to validate with. |
name | A name to be used for this texture in possible warning log messages. |
Perform validation of texture creation parameters.
You can call validate() to see if texture creation parameters are valid before you pass create info to Texture::create().
renderer | Renderer to validate with. |
Validates and applies adjustments to some texture creation parameters in case of avoidable error conditions.
Some error conditions cause adjustments instead of resulting in an error. These include:
renderer | Renderer to validate with. |
name | A name to be used for this texture in possible warning log messages. |
|
static |
Create a texture create info structure for a black 1x1 texture.
renderer | Renderer to use for feature queries. |
type | The type of the texture. |
void kanzi::Texture::CreateInfo::updateShapeAndFormatFromImages | ( | ) |
Use updateShapeAndFormatFromImages() to fill in format, width, height from images.
Those parameters must match images in order for Texture::create() to accept CreateInfo.
Validates texture format and features.
renderer | Renderer to validate with. |
Validates texture size against minimum valid texture size (1x1) and maximum supported by graphics adapter.
renderer | Renderer to validate with. |
|
protected |
Checks for known device incompatibilities, for example with texture formats and size.
renderer | Renderer to validate with. |
|
friend |
vector<BitmapImageSharedPtr> kanzi::Texture::CreateInfo::images |
Images that are used to create the texture.
If you set texture type to two dimensional, images must contain zero or one image. If you set texture type to cube map, images must contain zero or six images.
Default CreateInfo constructor initializes this to empty.
GraphicsFormat kanzi::Texture::CreateInfo::format |
Format for texture.
Default CreateInfo constructor initializes this to GraphicsFormatNone, which is not valid value for Texture::create().
GraphicsFormat kanzi::Texture::CreateInfo::depthStencilFormat |
DepthStencil format.
This is only used when you set renderTargetMode to RenderTargetModeInternal.
Default CreateInfo constructor initializes this to GraphicsFormatNone, meaning there will be no depth/stencil for native framebuffer that is created if you set renderTargetMode to RenderTargetModeInternal.
unsigned int kanzi::Texture::CreateInfo::features |
Required format features.
Default CreateInfo constructor initializes this to GraphicsFormatFeatureSampledImage.
TextureType kanzi::Texture::CreateInfo::type |
Texture type.
Default CreateInfo constructor initializes this to TypeInvalid, which is not valid value for Texture::create().
unsigned int kanzi::Texture::CreateInfo::width |
Width for the base level of texture.
Default CreateInfo constructor initializes this to 0, which is not valid value for Texture::create().
unsigned int kanzi::Texture::CreateInfo::height |
Height for the base level of texture.
Default CreateInfo constructor initializes this to 0, which is not valid value for Texture::create().
unsigned int kanzi::Texture::CreateInfo::widthDivisor |
Automatic size determination divisor for width, 0 when not automatic.
Default CreateInfo constructor initializes this to 0.
unsigned int kanzi::Texture::CreateInfo::heightDivisor |
Automatic size determination divisor for height, 0 when not automatic.
Default CreateInfo constructor initializes this to 0.
unsigned int kanzi::Texture::CreateInfo::depth |
Reserved for future use.
Set to 1.
Depth for the base level of texture.
Default CreateInfo constructor initializes this to 1.
unsigned int kanzi::Texture::CreateInfo::renderTargetSampleCount |
Specifies number of samples for the draw renderbuffer when RenderTargetMode is RenderTargetModeExternal.
Default CreateInfo constructor initializes this to 0, meaning no multisample samples.
unsigned int kanzi::Texture::CreateInfo::mipmapLevelCount |
Number of mipmap levels for the texture.
Default CreateInfo constructor initializes this to 1, meaning there is only base level image and no mipmap images.
MemoryType kanzi::Texture::CreateInfo::memoryType |
Memory type for the texture.
If Gpu is not included, texture will not be deployed when created.
If Ram is not included, texture will not contain images after it has been deployed.
Default CreateInfo constructor initializes this to GpuOnly.
NativeDeploymentTarget kanzi::Texture::CreateInfo::nativeDeploymentTarget |
Native deployment target to use for memory storage if supported by the backend.
Default CreateInfo constructor initializes this to None.
RenderTargetMode kanzi::Texture::CreateInfo::renderTargetMode |
RenderTarget mode for the texture.
Default CreateInfo constructor initializes this to RenderTargetModeNone.
Sampler::MipmapMode kanzi::Texture::CreateInfo::mipmapMode |
Mipmap mode for the texture.
Default CreateInfo constructor initializes this to Sampler::MipmapModeBase.
Sampler::Filter kanzi::Texture::CreateInfo::minificationFilter |
Texture magnification filter.
Default CreateInfo constructor initializes this to Sampler::FilterNearest.
Sampler::Filter kanzi::Texture::CreateInfo::magnificationFilter |
Texture minification filter.
Default CreateInfo constructor initializes this to Sampler::FilterNearest.
Sampler::AddressingMode kanzi::Texture::CreateInfo::addressingMode |
Texture addressing mode.
Default CreateInfo constructor initializes this to Sampler::AddressingModeClamp.
float kanzi::Texture::CreateInfo::anisotropy |
Texture anisotropy.
Default CreateInfo constructor initializes this to 1.0 (no anisotropy).
GraphicsCompareFunction kanzi::Texture::CreateInfo::depthCompareFunction |
Depth comparison function.
Default CreateInfo constructor initializes this to GraphicsCompareFunctionLessOrEqual.
float kanzi::Texture::CreateInfo::mipLodBias |
Reserved for future use.
Set to 0.0f. Texture mipmap level of detail bias. Default CreateInfo constructor initializes this to 0.
float kanzi::Texture::CreateInfo::minLod |
Reserved for future use.
Set to -1000.0f. Minimum texture level of detail. Default CreateInfo constructor initializes this to -1000.0f (effectively no clamping for level of detail).
float kanzi::Texture::CreateInfo::maxLod |
Reserved for future use.
Maximum texture level of detail. Default CreateInfo constructor initializes this to 1000 (effectively no clamping for level of detail).