From 13ee03868e386b8a07a07b3e32395b766c07d127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 1 Apr 2024 11:45:52 +0200 Subject: [PATCH] Nothing to see here. --- src/Magnum/British.h | 7 +++- src/Magnum/GL/AbstractFramebuffer.h | 18 ++++++--- src/Magnum/GL/DefaultFramebuffer.h | 8 +++- src/Magnum/GL/Framebuffer.h | 4 ++ src/Magnum/GL/Renderer.h | 21 ++++++++++- src/Magnum/Test/BritishTest.cpp | 58 +++++++++++++++++++++++++++++ src/Magnum/Test/CMakeLists.txt | 7 ++++ 7 files changed, 112 insertions(+), 11 deletions(-) create mode 100644 src/Magnum/Test/BritishTest.cpp diff --git a/src/Magnum/British.h b/src/Magnum/British.h index c3e274551..4dab17e7f 100644 --- a/src/Magnum/British.h +++ b/src/Magnum/British.h @@ -25,7 +25,12 @@ DEALINGS IN THE SOFTWARE. */ -/* You bloody hell better not tell anybody you bumped into this, aye? Ta! */ +/* You bloody hell better not tell anybody you bumped into this, aye? Ta! + + This file, and everything wrapped in #ifdef Magnum_British_h, is only + allowed to be edited on April 1st. I don't make the rules. All such changes + should also be ABI-independent, so it's effectively limited to enum aliases + and typedefs. */ #include "Magnum/Magnum.h" diff --git a/src/Magnum/GL/AbstractFramebuffer.h b/src/Magnum/GL/AbstractFramebuffer.h index bb02aa8db..1d5f5eb4c 100644 --- a/src/Magnum/GL/AbstractFramebuffer.h +++ b/src/Magnum/GL/AbstractFramebuffer.h @@ -45,9 +45,12 @@ namespace Magnum { namespace GL { @m_enum_values_as_keywords */ enum class FramebufferClear: GLbitfield { - Color = GL_COLOR_BUFFER_BIT, /**< Color buffer */ - Depth = GL_DEPTH_BUFFER_BIT, /**< Depth buffer */ - Stencil = GL_STENCIL_BUFFER_BIT /**< Stencil buffer */ + Color = GL_COLOR_BUFFER_BIT, /**< Color buffer */ + Depth = GL_DEPTH_BUFFER_BIT, /**< Depth buffer */ + Stencil = GL_STENCIL_BUFFER_BIT, /**< Stencil buffer */ + #ifdef Magnum_British_h + Colour = Color + #endif }; /** @@ -74,9 +77,12 @@ typedef Containers::EnumSet FramebufferClearMask; @requires_webgl20 Framebuffer blit is not available in WebGL 1.0. */ enum class FramebufferBlit: GLbitfield { - Color = GL_COLOR_BUFFER_BIT, /**< Color buffer */ - Depth = GL_DEPTH_BUFFER_BIT, /**< Depth buffer */ - Stencil = GL_STENCIL_BUFFER_BIT /**< Stencil buffer */ + Color = GL_COLOR_BUFFER_BIT, /**< Color buffer */ + Depth = GL_DEPTH_BUFFER_BIT, /**< Depth buffer */ + Stencil = GL_STENCIL_BUFFER_BIT, /**< Stencil buffer */ + #ifdef Magnum_British_h + Colour = Color + #endif }; /** diff --git a/src/Magnum/GL/DefaultFramebuffer.h b/src/Magnum/GL/DefaultFramebuffer.h index a8762ba22..aa561af6f 100644 --- a/src/Magnum/GL/DefaultFramebuffer.h +++ b/src/Magnum/GL/DefaultFramebuffer.h @@ -301,9 +301,13 @@ class MAGNUM_GL_EXPORT DefaultFramebuffer: public AbstractFramebuffer { /** Invalidate stencil buffer. */ #ifndef MAGNUM_TARGET_GLES2 - Stencil = GL_STENCIL + Stencil = GL_STENCIL, #else - Stencil = GL_STENCIL_EXT + Stencil = GL_STENCIL_EXT, + #endif + + #ifdef Magnum_British_h + Colour = Color #endif }; #endif diff --git a/src/Magnum/GL/Framebuffer.h b/src/Magnum/GL/Framebuffer.h index ad77e7a14..fbc299ef6 100644 --- a/src/Magnum/GL/Framebuffer.h +++ b/src/Magnum/GL/Framebuffer.h @@ -146,6 +146,10 @@ class MAGNUM_GL_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractO GLenum attachment; }; + #ifdef Magnum_British_h + typedef ColorAttachment ColurAttachment; + #endif + /** * @brief Draw attachment * diff --git a/src/Magnum/GL/Renderer.h b/src/Magnum/GL/Renderer.h index ff527f4e2..61efb62df 100644 --- a/src/Magnum/GL/Renderer.h +++ b/src/Magnum/GL/Renderer.h @@ -1667,7 +1667,13 @@ class MAGNUM_GL_EXPORT Renderer { * @requires_webgl_extension Extension * @webgl_extension{WEBGL,blend_equation_advanced_coherent} */ - HslLuminosity = GL_HSL_LUMINOSITY_KHR + HslLuminosity = GL_HSL_LUMINOSITY_KHR, + + #ifdef Magnum_British_h + ColourDodge = ColorDodge, + ColourBurn = ColorBurn, + HslColour = HslColor + #endif }; /** @@ -1812,7 +1818,18 @@ class MAGNUM_GL_EXPORT Renderer { /** * One minus source alpha (@f$ RGB = (1.0 - A_d, 1.0 - A_d, 1.0 - A_d); A = 1.0 - A_d @f$) */ - OneMinusDestinationAlpha = GL_ONE_MINUS_DST_ALPHA + OneMinusDestinationAlpha = GL_ONE_MINUS_DST_ALPHA, + + #ifdef Magnum_British_h + ConstantColour = ConstantColor, + OneMinusConstantColour = OneMinusConstantColor, + SourceColour = SourceColor, + SecondSourceColour = SecondSourceColor, + OneMinusSourceColour = OneMinusSourceColor, + OneMinusSecondSourceColour = OneMinusSecondSourceColor, + DestinationColour = DestinationColor, + OneMinusDestinationColour = OneMinusDestinationColor + #endif }; /** diff --git a/src/Magnum/Test/BritishTest.cpp b/src/Magnum/Test/BritishTest.cpp new file mode 100644 index 000000000..c9bff6282 --- /dev/null +++ b/src/Magnum/Test/BritishTest.cpp @@ -0,0 +1,58 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, + 2020, 2021, 2022, 2023 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include "Magnum/British.h" +/* Include all files with functionality wrapped in #ifdef Magnum_British_h + here. As all such code should be limited to enum aliases and typedefs, it + should be enough to verify it parses correctly. */ +#include "Magnum/Math/Color.h" +#ifdef MAGNUM_TARGET_GL +#include "Magnum/GL/DefaultFramebuffer.h" +#include "Magnum/GL/Framebuffer.h" +#include "Magnum/GL/Renderer.h" +#endif + +namespace Magnum { namespace Test { namespace { + +struct BritishTest: TestSuite::Tester { + explicit BritishTest(); + + void cheers(); +}; + +BritishTest::BritishTest() { + addTests({&BritishTest::cheers}); +} + +void BritishTest::cheers() { + Colour3 colour; + CORRADE_COMPARE(colour.r(), 0.0f); +} + +}}} + +CORRADE_TEST_MAIN(Magnum::Test::BritishTest) diff --git a/src/Magnum/Test/CMakeLists.txt b/src/Magnum/Test/CMakeLists.txt index c2d98cdaf..6d65b245c 100644 --- a/src/Magnum/Test/CMakeLists.txt +++ b/src/Magnum/Test/CMakeLists.txt @@ -29,6 +29,13 @@ set(CMAKE_FOLDER "Magnum/Test") find_package(Corrade REQUIRED PluginManager) +corrade_add_test(BritishTest BritishTest.cpp LIBRARIES Magnum) +# Just to have the GL headers pulled in correctly. Shouldn't be needed in most +# cases as the headers are self-contained in MagnumExternal, but some platforms +# such as iOS may disagree. +if(MAGNUM_TARGET_GL) + target_link_libraries(BritishTest PRIVATE MagnumGL) +endif() corrade_add_test(ConverterUtilitiesTest ConverterUtilitiesTest.cpp LIBRARIES Magnum Corrade::PluginManager) corrade_add_test(FileCallbackTest FileCallbackTest.cpp LIBRARIES Magnum) corrade_add_test(ImageTest ImageTest.cpp LIBRARIES MagnumTestLib)