openMSX
Public Member Functions | List of all members
gl::PixelBuffer< T > Class Template Reference

Wrapper around a pixel buffer. More...

#include <GLUtil.hh>

Inheritance diagram for gl::PixelBuffer< T >:
Inheritance graph
[legend]

Public Member Functions

 PixelBuffer ()
 
 PixelBuffer (const PixelBuffer &other)=delete
 
 PixelBuffer (PixelBuffer &&other) noexcept
 
PixelBufferoperator= (const PixelBuffer &other)=delete
 
PixelBufferoperator= (PixelBuffer &&other) noexcept
 
 ~PixelBuffer ()
 
void allocate (GLuint size)
 Allocate the maximum required size for this buffer.
 
void bind () const
 Bind this PixelBuffer.
 
void unbind () const
 Unbind this buffer.
 
std::span< T > mapWrite ()
 Maps the contents of this buffer into memory.
 
void unmap () const
 Unmaps the contents of this buffer.
 

Detailed Description

template<typename T>
class gl::PixelBuffer< T >

Wrapper around a pixel buffer.

The pixel buffer will be allocated in VRAM if possible, in main RAM otherwise. The pixel type is templatized T.

Note: openGL ES 2.0 does not yet support this. So for now we always use the fallback implementation, maybe we can re-enable this when we switch to openGL ES 3.0.

Definition at line 158 of file GLUtil.hh.

Constructor & Destructor Documentation

◆ PixelBuffer() [1/3]

template<typename T >
gl::PixelBuffer< T >::PixelBuffer ( )

Definition at line 211 of file GLUtil.hh.

◆ PixelBuffer() [2/3]

template<typename T >
gl::PixelBuffer< T >::PixelBuffer ( const PixelBuffer< T > &  other)
delete

◆ PixelBuffer() [3/3]

template<typename T >
gl::PixelBuffer< T >::PixelBuffer ( PixelBuffer< T > &&  other)
noexcept

Definition at line 223 of file GLUtil.hh.

◆ ~PixelBuffer()

template<typename T >
gl::PixelBuffer< T >::~PixelBuffer ( )

Definition at line 217 of file GLUtil.hh.

Member Function Documentation

◆ allocate()

template<typename T >
void gl::PixelBuffer< T >::allocate ( GLuint  size)

Allocate the maximum required size for this buffer.

Definition at line 239 of file GLUtil.hh.

Referenced by openmsx::GLHQScaler::GLHQScaler(), and openmsx::PostProcessor::PostProcessor().

◆ bind()

template<typename T >
void gl::PixelBuffer< T >::bind ( ) const

Bind this PixelBuffer.

Must be called before the methods getOffset() or mapWrite() are used. (Is a wrapper around glBindBuffer).

Definition at line 255 of file GLUtil.hh.

Referenced by openmsx::GLHQScaler::uploadBlock().

◆ mapWrite()

template<typename T >
std::span< T > gl::PixelBuffer< T >::mapWrite ( )

Maps the contents of this buffer into memory.

The returned buffer is write-only (reading could be very slow or even result in a segfault).

Returns
Pointer through which you can write pixels to this buffer, or 0 if the buffer could not be mapped.
Precondition
This PixelBuffer must be bound (see bind()) before calling this method.

Definition at line 271 of file GLUtil.hh.

Referenced by openmsx::GLHQScaler::uploadBlock().

◆ operator=() [1/2]

template<typename T >
PixelBuffer & gl::PixelBuffer< T >::operator= ( const PixelBuffer< T > &  other)
delete

◆ operator=() [2/2]

template<typename T >
PixelBuffer< T > & gl::PixelBuffer< T >::operator= ( PixelBuffer< T > &&  other)
noexcept

Definition at line 231 of file GLUtil.hh.

◆ unbind()

template<typename T >
void gl::PixelBuffer< T >::unbind ( ) const

Unbind this buffer.

Definition at line 263 of file GLUtil.hh.

Referenced by openmsx::GLHQScaler::uploadBlock().

◆ unmap()

template<typename T >
void gl::PixelBuffer< T >::unmap ( ) const

Unmaps the contents of this buffer.

After this call, you must no longer use the pointer returned by mapWrite.

Definition at line 282 of file GLUtil.hh.

Referenced by openmsx::GLHQScaler::uploadBlock().


The documentation for this class was generated from the following file: