11#ifndef GAMP_RENDER_GL_GLCAPABILITIES_HPP_
12#define GAMP_RENDER_GL_GLCAPABILITIES_HPP_
25 using namespace gamp::wt;
65 bool m_doubleBuffered =
true;
66 bool m_stereo =
false;
67 bool m_hardwareAccelerated =
true;
69 int m_stencilBits = 0;
70 int m_accumRedBits = 0;
71 int m_accumGreenBits = 0;
72 int m_accumBlueBits = 0;
73 int m_accumAlphaBits = 0;
77 int m_multiSamplesCount = 0;
93 hash = ((hash << 5) - hash) + (m_hardwareAccelerated ? 1 : 0);
94 hash = ((hash << 5) - hash) + (m_stereo ? 1 : 0);
95 hash = ((hash << 5) - hash) + (m_isFBO ? 1 : 0);
99 hash = ((hash << 5) - hash) + m_depthBits;
100 hash = ((hash << 5) - hash) + m_stencilBits;
101 hash = ((hash << 5) - hash) + m_accumRedBits;
102 hash = ((hash << 5) - hash) + m_accumGreenBits;
103 hash = ((hash << 5) - hash) + m_accumBlueBits;
104 hash = ((hash << 5) - hash) + m_accumAlphaBits;
118 rhs.
isFBO() == m_isFBO &&
120 rhs.
stereo() == m_stereo &&
148 if( m_stereo && !rhs.
stereo() ) {
150 }
else if( !m_stereo && rhs.
stereo() ) {
165 }
else if( ms < xms ) {
183 }
else if( m_depthBits < rhs.
depthBits() ) {
199 constexpr bool isFBO() const noexcept {
return m_isFBO; }
238 constexpr bool stereo() const noexcept {
return m_stereo; }
257 constexpr int depthBits() const noexcept {
return m_depthBits; }
260 constexpr int&
depthBits() noexcept {
return m_depthBits; }
268 constexpr int stencilBits() const noexcept {
return m_stencilBits; }
360 m_multiSamplesCount = v;
379 std::string msg(
"GLCaps[");
389 sink.append(
", accum-rgba ").append(std::to_string(m_accumRedBits)).append(
ESEP).append(std::to_string(m_accumGreenBits)).append(
ESEP)
390 .append(std::to_string(m_accumBlueBits)).append(
ESEP).append(std::to_string(m_accumAlphaBits));
391 sink.append(
", dp/st/ms ").append(std::to_string(m_depthBits)).append(
ESEP)
394 if( m_doubleBuffered ) {
395 sink.append(
", dbl");
397 sink.append(
", one");
400 sink.append(
", stereo");
402 sink.append(
", mono ");
404 if( m_hardwareAccelerated ) {
405 sink.append(
", hw, ");
411 sink.append(
", on-scr[");
413 sink.append(
", offscr[");
421 if( ns ) { sink.append(
CSEP); }
422 sink.append(
"bitmap");
429 sink.append(
"auto-cfg");
constexpr int stencilBits() const noexcept
Returns the number of stencil buffer bits.
constexpr int accumGreenBits() const noexcept
Returns the number of bits for the accumulation buffer's green component.
static const jau::type_info & GLSignature() noexcept
constexpr int & accumBlueBits() noexcept
Sets the number of bits requested for the accumulation buffer's blue component.
constexpr int accumBlueBits() const noexcept
Returns the number of bits for the accumulation buffer's blue component.
constexpr GLCapabilities & setMultiSamplesCount(int v) noexcept
Defaults to 0, i.e.
constexpr GLCapabilities & setFBO(bool enable) noexcept
Requesting offscreen FBO mode.
constexpr int depthBits() const noexcept
Returns the number of depth buffer bits.
constexpr int multiSamplesCount() const noexcept
Returns the number of sample buffers to be allocated if sample buffers are enabled,...
constexpr int accumAlphaBits() const noexcept
Returns the number of bits for the accumulation buffer's alpha component.
constexpr int & stencilBits() noexcept
Sets the number of bits requested for the stencil buffer.
constexpr GLCapabilities() noexcept=default
bool operator==(const Capabilities &rhs0) const noexcept override
constexpr bool stereo() const noexcept
Returns whether stereo is requested, available or chosen.
std::string toString(std::string &sink) const
constexpr GLCapabilities & setDoubleBuffered(bool enable) noexcept
Enables or disables double buffering.
constexpr int & accumGreenBits() noexcept
Sets the number of bits requested for the accumulation buffer's green component.
std::size_t hash_code() const noexcept override
constexpr GLCapabilities & setHardwareAccelerated(bool enable) noexcept
Enables or disables hardware acceleration.
int compare(const Capabilities &rhs0) const noexcept override
comparing hw/sw, stereo, multisample, stencil, RGBA and depth only
constexpr int & accumAlphaBits() noexcept
Sets number of bits requested for accumulation buffer's alpha component.
constexpr bool isFBO() const noexcept
Returns whether FBO offscreen mode is requested, available or chosen.
constexpr int accumRedBits() const noexcept
Returns the number of bits for the accumulation buffer's red component.
constexpr bool doubleBuffered() const noexcept
Returns whether double-buffering is requested, available or chosen.
std::string toString() const override
Returns a textual representation of this GLCapabilities object.
constexpr int & depthBits() noexcept
Sets the number of bits requested for the depth buffer.
constexpr GLCapabilities & setStereo(bool enable) noexcept
Enables or disables stereo viewing.
constexpr int & accumRedBits() noexcept
Sets the number of bits requested for the accumulation buffer's red component.
const jau::type_info & signature() const noexcept override
CapabilitiesPtr clone() const noexcept override
constexpr bool hasMultiSamples() const noexcept
Sets the desired extension for full-scene antialiasing (FSAA), default is DEFAULT_SAMPLE_EXTENSION.
constexpr bool hardwareAccelerated() const noexcept
Returns whether hardware acceleration is requested, available or chosen.
static constexpr std::string_view ESEP
Element separator.
constexpr bool isOnscreen() const noexcept
Returns whether an on- or offscreen surface is requested, available or chosen.
constexpr bool isBitmap() const noexcept
Returns whether bitmap offscreen mode is requested, available or chosen.
virtual int compare(const Capabilities &rhs) const noexcept
Comparing RGBA values only.
static constexpr std::string_view CSEP
Component separator.
virtual std::size_t hash_code() const noexcept
constexpr void setOnscreen(bool v) noexcept
Sets whether the surface shall be on- or offscreen.
virtual std::string toString() const
Returns a textual representation of this Capabilities object.
constexpr int alphaBits() const noexcept
Returns the number of bits for the color buffer's alpha component.
virtual bool operator==(const Capabilities &rhs) const noexcept
constexpr Capabilities() noexcept=default
Creates a Capabilities object.
Generic type information using either Runtime type information (RTTI) or Compile time type informatio...
const jau::type_info & static_ctti() noexcept
Returns a static global reference of make_ctti<T>(true) w/ identity instance.
std::unique_ptr< GLCapabilities > GLCapabilitiesPtr
std::unique_ptr< Capabilities > CapabilitiesPtr
__pack(...): Produces MSVC, clang and gcc compatible lead-in and -out macros.