From cbfcd21d98bfd7ba396cc58a614a5c8a9f594cdc Mon Sep 17 00:00:00 2001 From: Zackhasacat Date: Thu, 16 Nov 2023 15:23:09 +0000 Subject: [PATCH 1/2] Make actor.providedServices read only --- apps/openmw/mwlua/types/actor.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwlua/types/actor.hpp b/apps/openmw/mwlua/types/actor.hpp index 409559475f..4a16b65cbf 100644 --- a/apps/openmw/mwlua/types/actor.hpp +++ b/apps/openmw/mwlua/types/actor.hpp @@ -45,7 +45,7 @@ namespace MWLua providedServices[name] = (services & flag) != 0; } providedServices["Travel"] = !rec.getTransport().empty(); - return providedServices; + return LuaUtil::makeReadOnly(providedServices); }); } } From de8c93d04926bb0885ce7e90461e5ac96462614b Mon Sep 17 00:00:00 2001 From: Cody Glassman Date: Thu, 16 Nov 2023 15:24:16 +0000 Subject: [PATCH 2/2] [Postprocessing] Add an API version, mirroring Lua --- CMakeLists.txt | 1 + components/CMakeLists.txt | 1 + components/fx/pass.cpp | 3 + components/version/version.cpp.in | 5 ++ components/version/version.hpp | 1 + docs/source/conf.py | 5 ++ .../source/reference/postprocessing/omwfx.rst | 82 ++++++++++--------- 7 files changed, 59 insertions(+), 39 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cad6290274..e0687ec198 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,6 +72,7 @@ set(OPENMW_VERSION_MAJOR 0) set(OPENMW_VERSION_MINOR 49) set(OPENMW_VERSION_RELEASE 0) set(OPENMW_LUA_API_REVISION 50) +set(OPENMW_POSTPROCESSING_API_REVISION 1) set(OPENMW_VERSION_COMMITHASH "") set(OPENMW_VERSION_TAGHASH "") diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index b2fc46f358..85f6c26449 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -26,6 +26,7 @@ if (GIT_CHECKOUT) -DOPENMW_VERSION_MINOR=${OPENMW_VERSION_MINOR} -DOPENMW_VERSION_RELEASE=${OPENMW_VERSION_RELEASE} -DOPENMW_LUA_API_REVISION=${OPENMW_LUA_API_REVISION} + -DOPENMW_POSTPROCESSING_API_REVISION=${OPENMW_POSTPROCESSING_API_REVISION} -DOPENMW_VERSION=${OPENMW_VERSION} -DMACROSFILE=${CMAKE_SOURCE_DIR}/cmake/OpenMWMacros.cmake "-DCMAKE_CONFIGURATION_TYPES=${CMAKE_CONFIGURATION_TYPES}" diff --git a/components/fx/pass.cpp b/components/fx/pass.cpp index 7a7329d755..6b692272db 100644 --- a/components/fx/pass.cpp +++ b/components/fx/pass.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include "stateupdater.hpp" #include "technique.hpp" @@ -68,6 +69,7 @@ namespace fx @uboStruct +#define OMW_API_VERSION @apiVersion #define OMW_REVERSE_Z @reverseZ #define OMW_RADIAL_FOG @radialFog #define OMW_EXPONENTIAL_FOG @exponentialFog @@ -255,6 +257,7 @@ float omw_EstimateFogCoverageFromUV(vec2 uv) const std::vector> defines = { { "@pointLightCount", std::to_string(SceneUtil::PPLightBuffer::sMaxPPLightsArraySize) }, + { "@apiVersion", std::to_string(Version::getPostprocessingApiRevision()) }, { "@version", std::to_string(technique.getGLSLVersion()) }, { "@multiview", Stereo::getMultiview() ? "1" : "0" }, { "@builtinSampler", Stereo::getMultiview() ? "sampler2DArray" : "sampler2D" }, diff --git a/components/version/version.cpp.in b/components/version/version.cpp.in index d95e47cbd6..312520acbb 100644 --- a/components/version/version.cpp.in +++ b/components/version/version.cpp.in @@ -25,6 +25,11 @@ namespace Version return @OPENMW_LUA_API_REVISION@; } + int getPostprocessingApiRevision() + { + return @OPENMW_POSTPROCESSING_API_REVISION@; + } + std::string getOpenmwVersionDescription() { std::string str = "OpenMW version "; diff --git a/components/version/version.hpp b/components/version/version.hpp index 64b8cd05e0..c05cf8a594 100644 --- a/components/version/version.hpp +++ b/components/version/version.hpp @@ -11,6 +11,7 @@ namespace Version std::string_view getCommitHash(); std::string_view getTagHash(); int getLuaApiRevision(); + int getPostprocessingApiRevision(); // Prepares string that contains version and commit hash. std::string getOpenmwVersionDescription(); diff --git a/docs/source/conf.py b/docs/source/conf.py index 096dec6ae0..902e84c393 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -67,6 +67,7 @@ copyright = u'2023, OpenMW Team' release = version = "UNRELEASED" luaApiRevision = "UNKNOWN" +ppApiRevision = "UNDEFINED" try: cmake_raw = open(project_root+'/CMakeLists.txt', 'r').read() @@ -80,6 +81,9 @@ try: luaApiRevisionMatch = re.search('set\(OPENMW_LUA_API_REVISION (\d+)\)', cmake_raw) if luaApiRevisionMatch: luaApiRevision = luaApiRevisionMatch.group(1) + ppApiRevisionMatch = re.search('set\(OPENMW_POSTPROCESSING_API_REVISION (\d+)\)', cmake_raw) + if ppApiRevisionMatch: + ppApiRevision = ppApiRevisionMatch.group(1) except Exception as ex: print("WARNING: Version will be set to '{0}' because: '{1}'.".format(release, str(ex))) @@ -87,6 +91,7 @@ except Exception as ex: rst_prolog = f""" .. |luaApiRevision| replace:: {luaApiRevision} +.. |ppApiRevision| replace:: {ppApiRevision} """ # The language for content autogenerated by Sphinx. Refer to documentation diff --git a/docs/source/reference/postprocessing/omwfx.rst b/docs/source/reference/postprocessing/omwfx.rst index 36a6f0883a..2909f8cc70 100644 --- a/docs/source/reference/postprocessing/omwfx.rst +++ b/docs/source/reference/postprocessing/omwfx.rst @@ -126,45 +126,49 @@ Builtin Uniforms Builtin Macros ############## -+-----------------------+----------------+----------------------------------------------------------------------+ -| Macro | Definition | Description | -+=======================+================+======================================================================+ -|``OMW_REVERSE_Z`` | ``0`` or ``1`` | Whether a reversed depth buffer is in use. | -| | | | -| | | ``0`` Depth sampler will be in range [1, 0] | -| | | | -| | | ``1`` Depth sampler will be in range [0, 1] | -+-----------------------+----------------+----------------------------------------------------------------------+ -|``OMW_RADIAL_FOG`` | ``0`` or ``1`` | Whether radial fog is in use. | -| | | | -| | | ``0`` Fog is linear | -| | | | -| | | ``1`` Fog is radial | -+-----------------------+----------------+----------------------------------------------------------------------+ -|``OMW_EXPONENTIAL_FOG``| ``0`` or ``1`` | Whether exponential fog is in use. | -| | | | -| | | ``0`` Fog is linear | -| | | | -| | | ``1`` Fog is exponential | -+-----------------------+----------------+----------------------------------------------------------------------+ -| ``OMW_HDR`` | ``0`` or ``1`` | Whether average scene luminance is computed every frame. | -| | | | -| | | ``0`` Average scene luminance is not computed | -| | | | -| | | ``1`` Average scene luminance is computed | -+-----------------------+----------------+----------------------------------------------------------------------+ -| ``OMW_NORMALS`` | ``0`` or ``1`` | Whether normals are available as a sampler in the technique. | -| | | | -| | | ``0`` Normals are not available | -| | | | -| | | ``1`` Normals are available. | -+-----------------------+----------------+----------------------------------------------------------------------+ -| ``OMW_MULTIVIEW`` | ``0`` or ``1`` | Whether multiview rendering is in use. | -| | | | -| | | ``0`` Multiview not in use | -| | | | -| | | ``1`` Multiview in use. | -+-----------------------+----------------+----------------------------------------------------------------------+ ++-----------------------+-----------------+----------------------------------------------------------------------+ +| Macro | Definition | Description | ++=======================+=================+======================================================================+ +|``OMW_REVERSE_Z`` | ``0`` or ``1`` | Whether a reversed depth buffer is in use. | +| | | | +| | | ``0`` Depth sampler will be in range [1, 0] | +| | | | +| | | ``1`` Depth sampler will be in range [0, 1] | ++-----------------------+-----------------+----------------------------------------------------------------------+ +|``OMW_RADIAL_FOG`` | ``0`` or ``1`` | Whether radial fog is in use. | +| | | | +| | | ``0`` Fog is linear | +| | | | +| | | ``1`` Fog is radial | ++-----------------------+-----------------+----------------------------------------------------------------------+ +|``OMW_EXPONENTIAL_FOG``| ``0`` or ``1`` | Whether exponential fog is in use. | +| | | | +| | | ``0`` Fog is linear | +| | | | +| | | ``1`` Fog is exponential | ++-----------------------+-----------------+----------------------------------------------------------------------+ +| ``OMW_HDR`` | ``0`` or ``1`` | Whether average scene luminance is computed every frame. | +| | | | +| | | ``0`` Average scene luminance is not computed | +| | | | +| | | ``1`` Average scene luminance is computed | ++-----------------------+-----------------+----------------------------------------------------------------------+ +| ``OMW_NORMALS`` | ``0`` or ``1`` | Whether normals are available as a sampler in the technique. | +| | | | +| | | ``0`` Normals are not available | +| | | | +| | | ``1`` Normals are available. | ++-----------------------+-----------------+----------------------------------------------------------------------+ +| ``OMW_MULTIVIEW`` | ``0`` or ``1`` | Whether multiview rendering is in use. | +| | | | +| | | ``0`` Multiview not in use | +| | | | +| | | ``1`` Multiview in use. | ++-----------------------+-----------------+----------------------------------------------------------------------+ +| ``OMW_API_VERSION`` | |ppApiRevision| | The revision of OpenMW postprocessing API. | +| | | It is an integer that is incremented every time the API is changed. | +| | | This was added in 0.49, so it will be undefined in 0.48. | ++-----------------------+-----------------+----------------------------------------------------------------------+ Builtin Functions