mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-29 08:45:36 +00:00
[Postprocessing] Add an API version, mirroring Lua
This commit is contained in:
parent
8a8d77a444
commit
de8c93d049
7 changed files with 59 additions and 39 deletions
|
@ -72,6 +72,7 @@ set(OPENMW_VERSION_MAJOR 0)
|
||||||
set(OPENMW_VERSION_MINOR 49)
|
set(OPENMW_VERSION_MINOR 49)
|
||||||
set(OPENMW_VERSION_RELEASE 0)
|
set(OPENMW_VERSION_RELEASE 0)
|
||||||
set(OPENMW_LUA_API_REVISION 50)
|
set(OPENMW_LUA_API_REVISION 50)
|
||||||
|
set(OPENMW_POSTPROCESSING_API_REVISION 1)
|
||||||
|
|
||||||
set(OPENMW_VERSION_COMMITHASH "")
|
set(OPENMW_VERSION_COMMITHASH "")
|
||||||
set(OPENMW_VERSION_TAGHASH "")
|
set(OPENMW_VERSION_TAGHASH "")
|
||||||
|
|
|
@ -26,6 +26,7 @@ if (GIT_CHECKOUT)
|
||||||
-DOPENMW_VERSION_MINOR=${OPENMW_VERSION_MINOR}
|
-DOPENMW_VERSION_MINOR=${OPENMW_VERSION_MINOR}
|
||||||
-DOPENMW_VERSION_RELEASE=${OPENMW_VERSION_RELEASE}
|
-DOPENMW_VERSION_RELEASE=${OPENMW_VERSION_RELEASE}
|
||||||
-DOPENMW_LUA_API_REVISION=${OPENMW_LUA_API_REVISION}
|
-DOPENMW_LUA_API_REVISION=${OPENMW_LUA_API_REVISION}
|
||||||
|
-DOPENMW_POSTPROCESSING_API_REVISION=${OPENMW_POSTPROCESSING_API_REVISION}
|
||||||
-DOPENMW_VERSION=${OPENMW_VERSION}
|
-DOPENMW_VERSION=${OPENMW_VERSION}
|
||||||
-DMACROSFILE=${CMAKE_SOURCE_DIR}/cmake/OpenMWMacros.cmake
|
-DMACROSFILE=${CMAKE_SOURCE_DIR}/cmake/OpenMWMacros.cmake
|
||||||
"-DCMAKE_CONFIGURATION_TYPES=${CMAKE_CONFIGURATION_TYPES}"
|
"-DCMAKE_CONFIGURATION_TYPES=${CMAKE_CONFIGURATION_TYPES}"
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include <components/sceneutil/lightmanager.hpp>
|
#include <components/sceneutil/lightmanager.hpp>
|
||||||
#include <components/settings/values.hpp>
|
#include <components/settings/values.hpp>
|
||||||
#include <components/stereo/multiview.hpp>
|
#include <components/stereo/multiview.hpp>
|
||||||
|
#include <components/version/version.hpp>
|
||||||
|
|
||||||
#include "stateupdater.hpp"
|
#include "stateupdater.hpp"
|
||||||
#include "technique.hpp"
|
#include "technique.hpp"
|
||||||
|
@ -68,6 +69,7 @@ namespace fx
|
||||||
|
|
||||||
@uboStruct
|
@uboStruct
|
||||||
|
|
||||||
|
#define OMW_API_VERSION @apiVersion
|
||||||
#define OMW_REVERSE_Z @reverseZ
|
#define OMW_REVERSE_Z @reverseZ
|
||||||
#define OMW_RADIAL_FOG @radialFog
|
#define OMW_RADIAL_FOG @radialFog
|
||||||
#define OMW_EXPONENTIAL_FOG @exponentialFog
|
#define OMW_EXPONENTIAL_FOG @exponentialFog
|
||||||
|
@ -255,6 +257,7 @@ float omw_EstimateFogCoverageFromUV(vec2 uv)
|
||||||
|
|
||||||
const std::vector<std::pair<std::string, std::string>> defines
|
const std::vector<std::pair<std::string, std::string>> defines
|
||||||
= { { "@pointLightCount", std::to_string(SceneUtil::PPLightBuffer::sMaxPPLightsArraySize) },
|
= { { "@pointLightCount", std::to_string(SceneUtil::PPLightBuffer::sMaxPPLightsArraySize) },
|
||||||
|
{ "@apiVersion", std::to_string(Version::getPostprocessingApiRevision()) },
|
||||||
{ "@version", std::to_string(technique.getGLSLVersion()) },
|
{ "@version", std::to_string(technique.getGLSLVersion()) },
|
||||||
{ "@multiview", Stereo::getMultiview() ? "1" : "0" },
|
{ "@multiview", Stereo::getMultiview() ? "1" : "0" },
|
||||||
{ "@builtinSampler", Stereo::getMultiview() ? "sampler2DArray" : "sampler2D" },
|
{ "@builtinSampler", Stereo::getMultiview() ? "sampler2DArray" : "sampler2D" },
|
||||||
|
|
|
@ -25,6 +25,11 @@ namespace Version
|
||||||
return @OPENMW_LUA_API_REVISION@;
|
return @OPENMW_LUA_API_REVISION@;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getPostprocessingApiRevision()
|
||||||
|
{
|
||||||
|
return @OPENMW_POSTPROCESSING_API_REVISION@;
|
||||||
|
}
|
||||||
|
|
||||||
std::string getOpenmwVersionDescription()
|
std::string getOpenmwVersionDescription()
|
||||||
{
|
{
|
||||||
std::string str = "OpenMW version ";
|
std::string str = "OpenMW version ";
|
||||||
|
|
|
@ -11,6 +11,7 @@ namespace Version
|
||||||
std::string_view getCommitHash();
|
std::string_view getCommitHash();
|
||||||
std::string_view getTagHash();
|
std::string_view getTagHash();
|
||||||
int getLuaApiRevision();
|
int getLuaApiRevision();
|
||||||
|
int getPostprocessingApiRevision();
|
||||||
|
|
||||||
// Prepares string that contains version and commit hash.
|
// Prepares string that contains version and commit hash.
|
||||||
std::string getOpenmwVersionDescription();
|
std::string getOpenmwVersionDescription();
|
||||||
|
|
|
@ -67,6 +67,7 @@ copyright = u'2023, OpenMW Team'
|
||||||
|
|
||||||
release = version = "UNRELEASED"
|
release = version = "UNRELEASED"
|
||||||
luaApiRevision = "UNKNOWN"
|
luaApiRevision = "UNKNOWN"
|
||||||
|
ppApiRevision = "UNDEFINED"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cmake_raw = open(project_root+'/CMakeLists.txt', 'r').read()
|
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)
|
luaApiRevisionMatch = re.search('set\(OPENMW_LUA_API_REVISION (\d+)\)', cmake_raw)
|
||||||
if luaApiRevisionMatch:
|
if luaApiRevisionMatch:
|
||||||
luaApiRevision = luaApiRevisionMatch.group(1)
|
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:
|
except Exception as ex:
|
||||||
print("WARNING: Version will be set to '{0}' because: '{1}'.".format(release, str(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"""
|
rst_prolog = f"""
|
||||||
.. |luaApiRevision| replace:: {luaApiRevision}
|
.. |luaApiRevision| replace:: {luaApiRevision}
|
||||||
|
.. |ppApiRevision| replace:: {ppApiRevision}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
|
|
|
@ -126,45 +126,49 @@ Builtin Uniforms
|
||||||
Builtin Macros
|
Builtin Macros
|
||||||
##############
|
##############
|
||||||
|
|
||||||
+-----------------------+----------------+----------------------------------------------------------------------+
|
+-----------------------+-----------------+----------------------------------------------------------------------+
|
||||||
| Macro | Definition | Description |
|
| Macro | Definition | Description |
|
||||||
+=======================+================+======================================================================+
|
+=======================+=================+======================================================================+
|
||||||
|``OMW_REVERSE_Z`` | ``0`` or ``1`` | Whether a reversed depth buffer is in use. |
|
|``OMW_REVERSE_Z`` | ``0`` or ``1`` | Whether a reversed depth buffer is in use. |
|
||||||
| | | |
|
| | | |
|
||||||
| | | ``0`` Depth sampler will be in range [1, 0] |
|
| | | ``0`` Depth sampler will be in range [1, 0] |
|
||||||
| | | |
|
| | | |
|
||||||
| | | ``1`` Depth sampler will be in range [0, 1] |
|
| | | ``1`` Depth sampler will be in range [0, 1] |
|
||||||
+-----------------------+----------------+----------------------------------------------------------------------+
|
+-----------------------+-----------------+----------------------------------------------------------------------+
|
||||||
|``OMW_RADIAL_FOG`` | ``0`` or ``1`` | Whether radial fog is in use. |
|
|``OMW_RADIAL_FOG`` | ``0`` or ``1`` | Whether radial fog is in use. |
|
||||||
| | | |
|
| | | |
|
||||||
| | | ``0`` Fog is linear |
|
| | | ``0`` Fog is linear |
|
||||||
| | | |
|
| | | |
|
||||||
| | | ``1`` Fog is radial |
|
| | | ``1`` Fog is radial |
|
||||||
+-----------------------+----------------+----------------------------------------------------------------------+
|
+-----------------------+-----------------+----------------------------------------------------------------------+
|
||||||
|``OMW_EXPONENTIAL_FOG``| ``0`` or ``1`` | Whether exponential fog is in use. |
|
|``OMW_EXPONENTIAL_FOG``| ``0`` or ``1`` | Whether exponential fog is in use. |
|
||||||
| | | |
|
| | | |
|
||||||
| | | ``0`` Fog is linear |
|
| | | ``0`` Fog is linear |
|
||||||
| | | |
|
| | | |
|
||||||
| | | ``1`` Fog is exponential |
|
| | | ``1`` Fog is exponential |
|
||||||
+-----------------------+----------------+----------------------------------------------------------------------+
|
+-----------------------+-----------------+----------------------------------------------------------------------+
|
||||||
| ``OMW_HDR`` | ``0`` or ``1`` | Whether average scene luminance is computed every frame. |
|
| ``OMW_HDR`` | ``0`` or ``1`` | Whether average scene luminance is computed every frame. |
|
||||||
| | | |
|
| | | |
|
||||||
| | | ``0`` Average scene luminance is not computed |
|
| | | ``0`` Average scene luminance is not computed |
|
||||||
| | | |
|
| | | |
|
||||||
| | | ``1`` Average scene luminance is computed |
|
| | | ``1`` Average scene luminance is computed |
|
||||||
+-----------------------+----------------+----------------------------------------------------------------------+
|
+-----------------------+-----------------+----------------------------------------------------------------------+
|
||||||
| ``OMW_NORMALS`` | ``0`` or ``1`` | Whether normals are available as a sampler in the technique. |
|
| ``OMW_NORMALS`` | ``0`` or ``1`` | Whether normals are available as a sampler in the technique. |
|
||||||
| | | |
|
| | | |
|
||||||
| | | ``0`` Normals are not available |
|
| | | ``0`` Normals are not available |
|
||||||
| | | |
|
| | | |
|
||||||
| | | ``1`` Normals are available. |
|
| | | ``1`` Normals are available. |
|
||||||
+-----------------------+----------------+----------------------------------------------------------------------+
|
+-----------------------+-----------------+----------------------------------------------------------------------+
|
||||||
| ``OMW_MULTIVIEW`` | ``0`` or ``1`` | Whether multiview rendering is in use. |
|
| ``OMW_MULTIVIEW`` | ``0`` or ``1`` | Whether multiview rendering is in use. |
|
||||||
| | | |
|
| | | |
|
||||||
| | | ``0`` Multiview not in use |
|
| | | ``0`` Multiview not in use |
|
||||||
| | | |
|
| | | |
|
||||||
| | | ``1`` Multiview 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
|
Builtin Functions
|
||||||
|
|
Loading…
Reference in a new issue