#include <Magnum/GL/MultisampleTexture.h>
template<UnsignedInt dimensions>
MultisampleTexture class
Mulitsample texture.
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 view(MultisampleTexture2D& original, TextureFormat internalFormat) -> MultisampleTexture<dimensions> new in Git master
- Create a view on a multisample texture.
- static auto view(MultisampleTexture2DArray& original, TextureFormat internalFormat, Int layer) -> MultisampleTexture<dimensions> new in Git master
- Create a view on a layer of a multisample texture array.
- static auto view(MultisampleTexture2DArray& original, TextureFormat internalFormat, Int layerOffset, Int layerCount) -> MultisampleTexture<dimensions> new in Git master
- Create a view on a multisample texture array.
- 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>:: view(MultisampleTexture2D& original,
TextureFormat internalFormat) new in Git master
Create a view on a multisample texture.
The internalFormat
has to either match the format of original
, or be compatible with it, such as having the same pixel size and other restrictions described in the OpenGL specification.
template<UnsignedInt dimensions>
static MultisampleTexture<dimensions> Magnum:: GL:: MultisampleTexture<dimensions>:: view(MultisampleTexture2DArray& original,
TextureFormat internalFormat,
Int layer) new in Git master
Create a view on a layer of a multisample texture array.
Enabled only on a MultisampleTexture2D. The internalFormat
has to either match the format of original
, or be compatible with it, such as having the same pixel size and other restrictions described in the OpenGL specification.
template<UnsignedInt dimensions>
static MultisampleTexture<dimensions> Magnum:: GL:: MultisampleTexture<dimensions>:: view(MultisampleTexture2DArray& original,
TextureFormat internalFormat,
Int layerOffset,
Int layerCount) new in Git master
Create a view on a multisample texture array.
Enabled only on a MultisampleTexture2DArray. The internalFormat
has to either match the format of original
, or be compatible with it, such as having the same pixel size and other restrictions described in the OpenGL specification.
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. However note that this is a low-level and a potentially dangerous API, see the documentation of NoCreate for alternatives.
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 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::