11#ifndef GAMP_RENDER_GL_GLCAPABILITIES_HPP_
12#define GAMP_RENDER_GL_GLCAPABILITIES_HPP_
25 using namespace gamp::wt;
42 bool m_doubleBuffered =
true;
43 bool m_stereo =
false;
44 bool m_hardwareAccelerated =
true;
46 int m_stencilBits = 0;
47 int m_accumRedBits = 0;
48 int m_accumGreenBits = 0;
49 int m_accumBlueBits = 0;
50 int m_accumAlphaBits = 0;
54 bool m_hasSamples =
false;
55 int m_samplesCount = 2;
70 hash = ((hash << 5) - hash) + (m_hardwareAccelerated ? 1 : 0);
71 hash = ((hash << 5) - hash) + (m_stereo ? 1 : 0);
72 hash = ((hash << 5) - hash) + (m_isFBO ? 1 : 0);
74 hash = ((hash << 5) - hash) + (m_hasSamples ? 1 : 0);
77 hash = ((hash << 5) - hash) + m_depthBits;
78 hash = ((hash << 5) - hash) + m_stencilBits;
79 hash = ((hash << 5) - hash) + m_accumRedBits;
80 hash = ((hash << 5) - hash) + m_accumGreenBits;
81 hash = ((hash << 5) - hash) + m_accumBlueBits;
82 hash = ((hash << 5) - hash) + m_accumAlphaBits;
96 rhs.
isFBO() == m_isFBO &&
98 rhs.
stereo() == m_stereo &&
107 if( res && m_hasSamples ) {
130 if( m_stereo && !rhs.
stereo() ) {
132 }
else if( !m_stereo && rhs.
stereo() ) {
147 }
else if( ms < xms ) {
165 }
else if( m_depthBits < rhs.
depthBits() ) {
181 constexpr bool isFBO() const noexcept {
return m_isFBO; }
195 constexpr void setFBO(
bool enable)
noexcept {
219 constexpr bool stereo() const noexcept {
return m_stereo; }
222 constexpr void setStereo(
bool enable)
noexcept { m_stereo = enable; }
238 constexpr int depthBits() const noexcept {
return m_depthBits; }
241 constexpr int&
depthBits() noexcept {
return m_depthBits; }
249 constexpr int stencilBits() const noexcept {
return m_stencilBits; }
331 constexpr bool hasSamples() const noexcept {
return m_hasSamples; }
342 m_hasSamples = enable;
355 constexpr int samplesCount() const noexcept {
return m_hasSamples ? m_samplesCount : 0; }
367 std::string msg(
"GLCaps[");
375 const int samples = m_hasSamples ? m_samplesCount : 0;
379 sink.append(
", accum-rgba ").append(std::to_string(m_accumRedBits)).append(
ESEP).append(std::to_string(m_accumGreenBits)).append(
ESEP)
380 .append(std::to_string(m_accumBlueBits)).append(
ESEP).append(std::to_string(m_accumAlphaBits));
381 sink.append(
", dp/st/ms ").append(std::to_string(m_depthBits)).append(
ESEP)
382 .append(std::to_string(m_stencilBits)).append(
ESEP).append(std::to_string(samples));
384 if( m_doubleBuffered ) {
385 sink.append(
", dbl");
387 sink.append(
", one");
390 sink.append(
", stereo");
392 sink.append(
", mono ");
394 if( m_hardwareAccelerated ) {
395 sink.append(
", hw, ");
401 sink.append(
", on-scr[");
403 sink.append(
", offscr[");
411 if( ns ) { sink.append(
CSEP); }
412 sink.append(
"bitmap");
419 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.
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 int depthBits() const noexcept
Returns the number of depth buffer bits.
constexpr void setDoubleBuffered(bool enable) noexcept
Enables or disables double buffering.
constexpr void setHasSamples(bool enable) noexcept
Defaults to false.
constexpr int accumAlphaBits() const noexcept
Returns the number of bits for the accumulation buffer's alpha component.
constexpr void setFBO(bool enable) noexcept
Requesting offscreen FBO mode.
constexpr int & stencilBits() noexcept
Sets the number of bits requested for the stencil buffer.
constexpr GLCapabilities() noexcept=default
constexpr void setHardwareAccelerated(bool enable) noexcept
Enables or disables hardware acceleration.
constexpr int & samplesCount() noexcept
If sample buffers are enabled, indicates the number of buffers to be allocated.
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 int samplesCount() const noexcept
Returns the number of sample buffers to be allocated if sample buffers are enabled,...
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
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 hasSamples() const noexcept
Sets the desired extension for full-scene antialiasing (FSAA), default is DEFAULT_SAMPLE_EXTENSION.
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.
constexpr void setStereo(bool enable) noexcept
Enables or disables stereo viewing.
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 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 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.
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.