Implement render scale adjustments for OpenXR D3D12 and Vulkan backends

- Added SetRenderScale method to both D3D12 and Vulkan backends to adjust the render scale dynamically.
- Updated eye size calculations to reflect the new render scale in both backends.
- Implemented ResizeWritablePair method to handle resizing of swapchains based on the requested eye sizes.
- Modified BeginFrame methods to ensure swapchains are resized appropriately before rendering.
- Enhanced error handling to maintain current eye sizes when the requested sizes cannot be allocated.
- Added tests to validate render scale functionality, ensuring correct behavior when scaling up and down, including handling of refused sizes.
This commit is contained in:
iChris4 committed 2026-09-26 02:25:34 +02:00
1 parent f013f9d2f7
commit e4d198ee13
22 files changed
+779 -48

No files matched your search

+30
View File
@@ -319,6 +319,26 @@ public:
return true;
}
// The command references keep a destroyed swapchain's resources alive, but
// not necessarily the runtime's memory behind them, so a copy still writing
// one is waited for. Usually the last one finished frames ago.
bool ForgetTargets(void* const* resources, uint32_t count) noexcept {
std::lock_guard lock(m_mutex);
if (m_framePending) {
return false;
}
CollectCompletedCommandsLocked();
const auto writesOne = [&](const InFlightCommand& command) {
return std::any_of(command.destinations.begin(), command.destinations.end(), [&](const auto& destination) {
return destination && std::find(resources, resources + count, destination.Get()) != resources + count;
});
};
if (std::none_of(m_commands.begin(), m_commands.end(), writesOne)) {
return true;
}
return WaitForGpuLocked();
}
private:
bool EnsureIntermediate(uint32_t eye, const stereo::EyeImage& source) noexcept {
auto& intermediate = m_intermediates[eye];
@@ -756,6 +776,14 @@ bool aurora_d3d12_cancel_stereo_targets(uint64_t frameToken) {
return g_bridge && g_bridge->CancelBeforeEncode(frameToken);
}
bool aurora_d3d12_forget_stereo_targets(void* const* resources, uint32_t count) {
using namespace aurora::d3d12_interop;
if (!g_bridge) {
return true;
}
return resources != nullptr && g_bridge->ForgetTargets(resources, count);
}
bool aurora_d3d12_disable_stereo_bridge() {
using namespace aurora::d3d12_interop;
if (!g_bridge) {
@@ -798,6 +826,8 @@ bool aurora_d3d12_set_stereo_targets_with_panel(uint64_t, const AuroraD3D12Stere
bool aurora_d3d12_cancel_stereo_targets(uint64_t) { return false; }
bool aurora_d3d12_forget_stereo_targets(void* const*, uint32_t) { return true; }
bool aurora_d3d12_disable_stereo_bridge() { return true; }
#endif