Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/mods/VR.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,13 @@ class VR : public Mod {
// int32_t get_game_frame_count() const;

bool is_using_async_aer() const {
// openVR has issues with 2 different poses at the same time for non steam native VR hmds like oculus
// for these exceptions need to implement viewport cropping and viewport reprojection
//TODO it looks like runtime does not fully support dx11 reprojeciton, I need to do it manually
return m_use_async_aer->value() && g_framework->is_dx12();
if (!m_use_async_aer->value()) {
return false;
}
if (g_framework->is_dx12()) {
return true;
}
return get_runtime()->is_openxr();
}

bool is_gui_enabled() const {
Expand Down
14 changes: 14 additions & 0 deletions src/mods/vr/D3D11Component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,12 @@ vr::EVRCompositorError D3D11Component::on_frame(VR* vr) {
if (runtime->is_openxr() && runtime->ready()) {
LOG_VERBOSE("Copying left eye");
m_openxr.copy(0, (ID3D11Texture2D*)copy_from_tex.Get());

if (vr->is_using_async_aer()) {
auto right_eye_source = backbufferIs8Bit ? m_right_eye_tex : m_right_eye_rt.tex;
LOG_VERBOSE("Copying right eye (async AER extra copy)");
m_openxr.copy(1, (ID3D11Texture2D*)right_eye_source.Get());
}
}

if (runtime->is_openvr()) {
Expand Down Expand Up @@ -360,11 +366,19 @@ vr::EVRCompositorError D3D11Component::on_frame(VR* vr) {
m_toneMap->SetExposure(settings.toneMapExposure);
m_toneMap->SetHDRSourceTexture(m_backbuffer_copy_rt);
m_toneMap->Process(context.Get());
} else if (backbufferIs8Bit) {
context->CopyResource(m_right_eye_tex.Get(), backbuffer.Get());
}

if (runtime->ready() && runtime->is_openxr()) {
LOG_VERBOSE("Copying right eye");
m_openxr.copy(1, (ID3D11Texture2D*)copy_from_tex.Get());

if (vr->is_using_async_aer()) {
auto left_eye_source = backbufferIs8Bit ? m_left_eye_tex : m_left_eye_rt.tex;
LOG_VERBOSE("Copying left eye (async AER extra copy)");
m_openxr.copy(0, (ID3D11Texture2D*)left_eye_source.Get());
}
}

if (runtime->is_openvr()) {
Expand Down