1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-05 22:19:42 +00:00

sRGB option. Finally an option for users whose headsets make the game too bright.

This commit is contained in:
madsbuvi 2021-03-06 13:53:38 +01:00
parent 55bd6dd7fb
commit f8f94249fe
5 changed files with 51 additions and 29 deletions

View file

@ -196,6 +196,7 @@ bool Launcher::AdvancedPage::loadSettings()
loadSettingBool(useSharedShadowMaps, "shared shadow maps", "Stereo");
loadSettingBool(preferDirectXSwapchains, "Prefer DirectX swapchains", "VR");
loadSettingBool(preferSRGBSwapchains, "Prefer sRGB swapchains", "VR");
loadSettingBool(useXrDebug, "enable XR_EXT_debug_utils", "VR Debug");
loadSettingBool(logAllXrCalls, "log all openxr calls", "VR Debug");
loadSettingBool(ignoreXrErrors, "continue on errors", "VR Debug");
@ -349,7 +350,8 @@ void Launcher::AdvancedPage::saveSettings()
mEngineSettings.setString("stereo method", "Stereo", stereoMethod);
saveSettingBool(useSharedShadowMaps, "shared shadow maps", "Stereo");
saveSettingBool(preferDirectXSwapchains, "Prefer DirectX swapchains", "VR");
saveSettingBool(preferDirectXSwapchains, "Prefer sRGB swapchains", "VR");
saveSettingBool(preferSRGBSwapchains, "Prefer DirectX swapchains", "VR");
saveSettingBool(useXrDebug, "enable XR_EXT_debug_utils", "VR Debug");
saveSettingBool(logAllXrCalls, "log all openxr calls", "VR Debug");
saveSettingBool(ignoreXrErrors, "continue on errors", "VR Debug");

View file

@ -559,31 +559,38 @@ namespace MWVR
std::string graphicsAPIExtension = graphicsAPIExtensionName();
if (graphicsAPIExtension == XR_KHR_OPENGL_ENABLE_EXTENSION_NAME)
{
// Find supported color swapchain format.
std::vector<int64_t> requestedColorSwapchainFormats = {
0x8058, // GL_RGBA8
0x8F97, // GL_RGBA8_SNORM
0x881A, // GL_RGBA16F
0x881B, // GL_RGB16F
// Offered by SteamVR but is broken: // 0x805B, // GL_RGBA16
0x8C3A, // GL_R11F_G11F_B10F
// Don't need srgb: 0x8C43, // GL_SRGB8_ALPHA8
// Don't need srgb: 0x8C41, // GL_SRGB8
};
std::vector<int64_t> requestedColorSwapchainFormats;
if (Settings::Manager::getBool("Prefer sRGB swapchains", "VR"))
{
requestedColorSwapchainFormats.push_back(0x8C43); // GL_SRGB8_ALPHA8
requestedColorSwapchainFormats.push_back(0x8C41); // GL_SRGB8
}
requestedColorSwapchainFormats.push_back(0x8058); // GL_RGBA8
requestedColorSwapchainFormats.push_back(0x8F97); // GL_RGBA8_SNORM
requestedColorSwapchainFormats.push_back(0x881A); // GL_RGBA16F
requestedColorSwapchainFormats.push_back(0x881B); // GL_RGB16F
requestedColorSwapchainFormats.push_back(0x8C3A); // GL_R11F_G11F_B10F
return selectFormat(requestedColorSwapchainFormats);
}
#ifdef XR_USE_GRAPHICS_API_D3D11
else if (graphicsAPIExtension == XR_KHR_D3D11_ENABLE_EXTENSION_NAME)
{
// Find supported color swapchain format.
std::vector<int64_t> requestedColorSwapchainFormats = {
0x1c, // DXGI_FORMAT_R8G8B8A8_UNORM
0x57, // DXGI_FORMAT_B8G8R8A8_UNORM
0xa , // DXGI_FORMAT_R16G16B16A16_FLOAT
0x18, // DXGI_FORMAT_R10G10B10A2_UNORM
// Don't need srgb: 0x1d, // DXGI_FORMAT_R8G8B8A8_UNORM_SRGB
// Don't need srgb: 0x5b, // DXGI_FORMAT_B8G8R8A8_UNORM_SRGB
};
std::vector<int64_t> requestedColorSwapchainFormats;
if (Settings::Manager::getBool("Prefer sRGB swapchains", "VR"))
{
requestedColorSwapchainFormats.push_back(0x1d); // DXGI_FORMAT_R8G8B8A8_UNORM_SRGB
requestedColorSwapchainFormats.push_back(0x5b); // DXGI_FORMAT_B8G8R8A8_UNORM_SRGB
}
requestedColorSwapchainFormats.push_back(0x1c); // DXGI_FORMAT_R8G8B8A8_UNORM
requestedColorSwapchainFormats.push_back(0x57); // DXGI_FORMAT_B8G8R8A8_UNORM
requestedColorSwapchainFormats.push_back(0xa); // DXGI_FORMAT_R16G16B16A16_FLOAT
requestedColorSwapchainFormats.push_back(0x18); // DXGI_FORMAT_R10G10B10A2_UNORM
return selectFormat(requestedColorSwapchainFormats);
}
#endif

View file

@ -378,7 +378,6 @@ namespace MWVR
int screenHeight = traits->height;
if (!mMirrorTexture)
{
;
mMirrorTexture.reset(new VRFramebuffer(state,
screenWidth,
screenHeight,
@ -390,7 +389,6 @@ namespace MWVR
int mirrorWidth = screenWidth / mMirrorTextureViews.size();
//// Since OpenXR does not include native support for mirror textures, we have to generate them ourselves
//// which means resolving msaa twice.
mMsaaResolveTexture->bindFramebuffer(gc, GL_FRAMEBUFFER_EXT);
mFramebuffer->blit(gc, 0, 0, mFramebuffer->width(), mFramebuffer->height(), 0, 0, mMsaaResolveTexture->width(), mMsaaResolveTexture->height(), GL_COLOR_BUFFER_BIT, GL_NEAREST);
@ -402,6 +400,7 @@ namespace MWVR
mMsaaResolveTexture->blit(gc, 0, 0, mMsaaResolveTexture->width(), mMsaaResolveTexture->height(), 0, 0, mGammaResolveTexture->width(), mGammaResolveTexture->height(), GL_COLOR_BUFFER_BIT, GL_NEAREST);
}
mGammaResolveTexture->bindFramebuffer(gc, GL_FRAMEBUFFER_EXT);
mFramebuffer->blit(gc, 0, 0, mFramebuffer->width(), mFramebuffer->height(), 0, 0, mGammaResolveTexture->width(), mGammaResolveTexture->height(), GL_DEPTH_BUFFER_BIT, GL_NEAREST);
if (mMirrorTexture)

View file

@ -1068,6 +1068,10 @@ left hand hud position = wrist
# As the general quality of OpenXR DirectX runtimes is better than OpenGL runtimes, i default this to true.
Prefer DirectX swapchains = true
# If true, OpenMW-VR will use sRGB textures in its swapchains if available. Needed for some headsets that don't play nice without sRGB.
Prefer sRGB swapchains = false
# If true, OpenMW-VR will enable seated play.
seated play = false
[VR Debug]

View file

@ -1097,7 +1097,17 @@
</property>
</widget>
</item>
<item row="3" column="0">
<item row="3" column="0">
<widget class="QCheckBox" name="preferSRGBSwapchains">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Makes OpenMW VR use sRGB format for its swapchain textures if available. Needed for some headsets that don't play nice without sRGB. Enable this if the game seems much brighter in your headset than what's shown on the mirror texture.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Prefer sRGB swapchains.</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="useSharedShadowMaps">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Makes OpenMW VR map shadows for both eyes in one pass, instead of once per eye. This is a significant performance benefit, and should only be disabled for debugging or masochism purposes.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
@ -1107,7 +1117,7 @@
</property>
</widget>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QCheckBox" name="useGeometryShaders">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Makes OpenMW VR render stereo using geometry shaders instead of two render passes. Players with a CPU bound will benefit from this, but players with a gpu bound will not. E.g. with a high cell view distance (distant lands) this will degrade your performance instead. NOTE: This feature is experimental, broken on AMD GPUs, and untested on Intel.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
@ -1117,7 +1127,7 @@
</property>
</widget>
</item>
<item row="5" column="0">
<item row="6" column="0">
<widget class="QCheckBox" name="preferDirectXSwapchains">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Makes OpenMW VR use DirectX swapchains even if OpenGL swapchains are available. Note that OpenMW will always fall back to DirectX swapchains if OpenGL swapchains are not available. This option exists to debug/work around runtimes with bad OpenGL implementations.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
@ -1127,7 +1137,7 @@
</property>
</widget>
</item>
<item row="6" column="0">
<item row="7" column="0">
<widget class="QCheckBox" name="useXrDebug">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Makes OpenMW VR enable and use the XR_EXT_debug_utils extension, which may help produce more detailed debug information.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
@ -1137,7 +1147,7 @@
</property>
</widget>
</item>
<item row="7" column="0">
<item row="8" column="0">
<widget class="QCheckBox" name="logAllXrCalls">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Makes OpenMW VR log every single OpenXR call. This degrades performance and creates a massive log. You probably want this disabled.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
@ -1147,7 +1157,7 @@
</property>
</widget>
</item>
<item row="8" column="0">
<item row="9" column="0">
<widget class="QCheckBox" name="ignoreXrErrors">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Makes OpenMW VR ignore unsuccessful calls to OpenXR. You probably want this enabled.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>