Texture
The Texture class represents a GPU texture resource supporting 2D, 3D, and Cube types with configurable format, dimensions, layers, mipmaps, and multisampling. It includes flags for usage patterns such as read/write access, target rendering, sharing, and interop with external or sparse resources. The class provides functions to query texture properties, format characteristics, and memory usage for efficient texture management across rendering platforms.
#include <platform/TellusimTexture.h>
Constructors
Texture()
Methods
Texture platform.
Platform getPlatform() const
const char *getPlatformName() const
Texture device index.
uint32_t getIndex() const
Clear texture.
void clear()
Check texture.
bool isCreated() const
Texture name.
void setName(const char *name)
String getName() const
Create texture.
bool create(Type type, Format format, Size size, uint32_t layers, Flags flags = DefaultFlags)
bool create2D(Format format, uint32_t size, Flags flags = DefaultFlags)
bool create3D(Format format, uint32_t size, Flags flags = DefaultFlags)
bool createCube(Format format, uint32_t size, Flags flags = DefaultFlags)
bool create2D(Format format, uint32_t width, uint32_t height, Flags flags = DefaultFlags)
bool create3D(Format format, uint32_t width, uint32_t height, uint32_t depth, Flags flags = DefaultFlags)
bool create2D(Format format, uint32_t width, uint32_t height, uint32_t layers, Flags flags = DefaultFlags)
bool createCube(Format format, uint32_t size, uint32_t layers, Flags flags = DefaultFlags)
Texture type.
Type getType() const
static const char *getTypeName(Type type)
const char *getTypeName() const
bool is2DType() const
bool is3DType() const
bool isCubeType() const
Texture format.
Format getFormat() const
const char *getFormatName() const
bool isColorFormat() const
bool isDepthFormat() const
bool isPixelFormat() const
bool isPlainFormat() const
bool isMixedFormat() const
bool isBlockFormat() const
bool isStencilFormat() const
bool isNormFormat() const
bool isSRGBFormat() const
bool isFloatFormat() const
bool isSignedFormat() const
bool isUnsignedFormat() const
bool isIntegerFormat() const
bool isi8Format() const
bool isu8Format() const
bool is8BitFormat() const
bool isi16Format() const
bool isu16Format() const
bool isf16Format() const
bool is16BitFormat() const
bool isi32Format() const
bool isu32Format() const
bool isf32Format() const
bool is32BitFormat() const
bool isi64Format() const
bool isu64Format() const
bool isf64Format() const
bool is64BitFormat() const
bool isBC15Format() const
bool isBC67Format() const
bool isETC2Format() const
bool isASTCFormat() const
uint32_t getComponents() const
uint32_t getPixelSize() const
uint32_t getBlockSize() const
uint32_t getBlockWidth() const
uint32_t getBlockHeight() const
Texture flags.
Flags getFlags() const
bool hasFlag(Flags flags) const
bool hasFlags(Flags flags) const
String getFlagsName() const
Texture multisample.
uint32_t getMultisample() const
bool hasMultisample() const
Texture dimension.
uint32_t getWidth() const
uint32_t getHeight() const
uint32_t getDepth() const
uint32_t getFaces() const
uint32_t getLayers() const
uint32_t getMipmaps() const
uint32_t findMipmap(Size size) const
uint32_t getWidth(uint32_t mipmap) const
uint32_t getHeight(uint32_t mipmap) const
uint32_t getDepth(uint32_t mipmap) const
bool hasFaces() const
bool hasLayers() const
bool hasMipmaps() const
Size getSize() const
Region getRegion() const
Slice getSlice() const
Size getSize(uint32_t mipmap) const
Region getRegion(uint32_t mipmap) const
Slice getSlice(uint32_t mipmap) const
Sparse texture dimension.
uint32_t getTileWidth() const
uint32_t getTileHeight() const
uint32_t getTileDepth() const
uint32_t getTileMipmaps() const
Size getTileSize() const
Texture description.
String getDescription() const
Memory usage.
size_t getMemory() const
Enums
Type
Texture types.
Name | Value |
---|---|
TypeUnknown | 0 |
Type2D | 1 |
Type3D | 2 |
TypeCube | 3 |
NumTypes | 4 |
Flags
Texture flags.
Name | Value | Description |
---|---|---|
FlagNone | 0 | |
FlagRead | (1 << 0) | Read texture. |
FlagWrite | (1 << 1) | Write texture. |
FlagTarget | (1 << 2) | Target texture. |
FlagBuffer | (1 << 3) | Buffer texture. |
FlagSource | (1 << 4) | Source texture. |
FlagSparse | (1 << 5) | Sparse texture. |
FlagShared | (1 << 6) | Shared texture. |
FlagExtern | (1 << 7) | Extern texture. |
FlagInterop | (1 << 8) | Interop texture. |
FlagSurface | (1 << 9) | Surface texture. |
FlagMutable | (1 << 10) | Mutable texture. |
FlagMipmaps | (1 << 11) | Mipmaps texture. |
FlagGenerate | (1 << 12) | Generate mipmaps. |
FlagFormatNorm | (1 << 13) | Convert to norm format. |
FlagFormatSRGB | (1 << 14) | Convert to sRGB format. |
FlagFormatSigned | (1 << 15) | Convert to signed format. |
FlagMultisample2 | (1 << 16) | 2x multisample texture. |
FlagMultisample4 | (1 << 17) | 4x multisample texture. |
FlagMultisample8 | (1 << 18) | 8x multisample texture. |
FlagClearOne | (1 << 19) | Clear value is one. |
FlagClearZero | (1 << 20) | Clear value is zero. |
FlagClearNormal | (1 << 21) | Clear value is normal. |
FlagMultisample | (FlagMultisample2 | FlagMultisample4 | FlagMultisample8) | |
DefaultFlags | FlagNone | |
NumFlags | 22 |