template<UnsignedInt dimensions>
MultisampleTexture class
Mulitsample texture.
Contents
Template class for 2D mulitsample texture and 2D multisample texture array. Used only from shaders for manual multisample resolve and other operations. See also AbstractTexture documentation for more information.
Usage
As multisample textures have no sampler state, the only thing you need is to set storage:
GL::MultisampleTexture2D texture; texture.setStorage(16, GL::TextureFormat::RGBA8, {1024, 1024});
In shader, the texture is used via sampler2DMS
/ sampler2DMSArray
, isampler2DMS
/ isampler2DMSArray
or usampler2DMS
/ usampler2DMSArray
. See AbstractShaderProgram documentation for more information about usage in shaders.
Note that multisample textures don't support compressed formats.
Base classes
- class AbstractTexture
- Base for textures.
Public types
- enum (anonymous): UnsignedInt { Dimensions = dimensions }
Public static functions
- static auto maxSize() -> VectorTypeFor<dimensions, Int>
- Max supported multisample texture size.
- static auto wrap(GLuint id, ObjectFlags flags = {}) -> MultisampleTexture<dimensions>
- Wrap existing OpenGL multisample texture object.
Constructors, destructors, conversion operators
- MultisampleTexture() explicit
- Constructor.
- MultisampleTexture(NoCreateT) explicit noexcept
- Construct without creating the underlying OpenGL object.
Public functions
- void bindImage(Int imageUnit, ImageAccess access, ImageFormat format)
- Bind texture to given image unit.
- void bindImage(Int imageUnit, Int layer, ImageAccess access, ImageFormat format)
- Bind texture layer to given image unit.
- void bindImageLayered(Int imageUnit, ImageAccess access, ImageFormat format)
- Bind layered texture to given image unit.
-
auto setStorage(Int samples,
TextureFormat internalFormat,
const VectorTypeFor<dimensions, Int>& size,
MultisampleTextureSampleLocations sampleLocations = MultisampleTextureSampleLocations::
NotFixed) -> MultisampleTexture<dimensions>& - Set storage.
- auto imageSize() -> VectorTypeFor<dimensions, Int>
- Texture image size.
- void invalidateImage()
- Invalidate texture image.
- void invalidateSubImage(const VectorTypeFor<dimensions, Int>& offset, const VectorTypeFor<dimensions, Int>& size)
- Invalidate texture subimage.
Enum documentation
template<UnsignedInt dimensions>
enum Magnum:: GL:: MultisampleTexture<dimensions>:: (anonymous): UnsignedInt
Enumerators | |
---|---|
Dimensions |
Texture dimension count |
Function documentation
template<UnsignedInt dimensions>
static VectorTypeFor<dimensions, Int> Magnum:: GL:: MultisampleTexture<dimensions>:: maxSize()
Max supported multisample texture size.
The result is cached, repeated queries don't result in repeated OpenGL calls. If neither extension ARB_
template<UnsignedInt dimensions>
static MultisampleTexture<dimensions> Magnum:: GL:: MultisampleTexture<dimensions>:: wrap(GLuint id,
ObjectFlags flags = {})
Wrap existing OpenGL multisample texture object.
Parameters | |
---|---|
id | OpenGL multisample texture ID |
flags | Object creation flags |
The id
is expected to be of an existing OpenGL texture object with target GL_TEXTURE_2D_MULTISAMPLE
or GL_TEXTURE_2D_MULTISAMPLE_ARRAY
based on dimension count. Unlike texture created using constructor, the OpenGL object is by default not deleted on destruction, use flags
for different behavior.
template<UnsignedInt dimensions>
Magnum:: GL:: MultisampleTexture<dimensions>:: MultisampleTexture() explicit
Constructor.
Creates new OpenGL texture object. If ARB_
template<UnsignedInt dimensions>
Magnum:: GL:: MultisampleTexture<dimensions>:: MultisampleTexture(NoCreateT) explicit noexcept
Construct without creating the underlying OpenGL object.
The constructed instance is equivalent to moved-from state. Useful in cases where you will overwrite the instance later anyway. Move another object over it to make it useful.
This function can be safely used for constructing (and later destructing) objects even without any OpenGL context being active.
template<UnsignedInt dimensions>
void Magnum:: GL:: MultisampleTexture<dimensions>:: bindImage(Int imageUnit,
ImageAccess access,
ImageFormat format)
Bind texture to given image unit.
Parameters | |
---|---|
imageUnit | Image unit |
access | Image access |
format | Image format |
Available only on 2D multisample textures.
template<UnsignedInt dimensions>
void Magnum:: GL:: MultisampleTexture<dimensions>:: bindImage(Int imageUnit,
Int layer,
ImageAccess access,
ImageFormat format)
Bind texture layer to given image unit.
Parameters | |
---|---|
imageUnit | Image unit |
layer | Texture layer |
access | Image access |
format | Image format |
Available only on 2D multisample texture arrays.
template<UnsignedInt dimensions>
void Magnum:: GL:: MultisampleTexture<dimensions>:: bindImageLayered(Int imageUnit,
ImageAccess access,
ImageFormat format)
Bind layered texture to given image unit.
Parameters | |
---|---|
imageUnit | Image unit |
access | Image access |
format | Image format |
Available only on 2D multisample texture arrays.
template<UnsignedInt dimensions>
MultisampleTexture<dimensions>& Magnum:: GL:: MultisampleTexture<dimensions>:: setStorage(Int samples,
TextureFormat internalFormat,
const VectorTypeFor<dimensions, Int>& size,
MultisampleTextureSampleLocations sampleLocations = MultisampleTextureSampleLocations:: NotFixed)
Set storage.
Parameters | |
---|---|
samples | Sample count |
internalFormat | Internal format |
size | Texture size |
sampleLocations | Whether to use fixed sample locations |
Returns | Reference to self (for method chaining) |
After calling this function the texture is immutable and calling setStorage() again is not allowed.
If neither ARB_
template<UnsignedInt dimensions>
VectorTypeFor<dimensions, Int> Magnum:: GL:: MultisampleTexture<dimensions>:: imageSize()
Texture image size.
See Texture::
template<UnsignedInt dimensions>
void Magnum:: GL:: MultisampleTexture<dimensions>:: invalidateImage()
Invalidate texture image.
See Texture::
template<UnsignedInt dimensions>
void Magnum:: GL:: MultisampleTexture<dimensions>:: invalidateSubImage(const VectorTypeFor<dimensions, Int>& offset,
const VectorTypeFor<dimensions, Int>& size)
Invalidate texture subimage.
See Texture::