Merge branch 'postprocess_version' into 'master'

[Postprocessing] Add an API version, mirroring Lua

See merge request OpenMW/openmw!3552
macos_ci_fix
uramer 1 year ago
commit d6220b7d03

@ -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 "")

@ -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}"

@ -15,6 +15,7 @@
#include <components/sceneutil/lightmanager.hpp>
#include <components/settings/values.hpp>
#include <components/stereo/multiview.hpp>
#include <components/version/version.hpp>
#include "stateupdater.hpp"
#include "technique.hpp"
@ -67,6 +68,7 @@ namespace fx
@uboStruct
#define OMW_API_VERSION @apiVersion
#define OMW_REVERSE_Z @reverseZ
#define OMW_RADIAL_FOG @radialFog
#define OMW_EXPONENTIAL_FOG @exponentialFog
@ -259,6 +261,7 @@ float omw_EstimateFogCoverageFromUV(vec2 uv)
const std::vector<std::pair<std::string, std::string>> 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" },

@ -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 ";

@ -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();

@ -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

@ -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

Loading…
Cancel
Save