OpenXR - Multipass rendering fixed

This commit is contained in:
Lubos 2022-09-04 14:01:17 +02:00
parent 5be6665df8
commit fb875b94de
4 changed files with 21 additions and 25 deletions

View file

@ -642,7 +642,7 @@ retry_depth:
currentReadHandle_ = fbo->handle;
}
void GLQueueRunner::RunSteps(const std::vector<GLRStep *> &steps, bool skipGLCalls) {
void GLQueueRunner::RunSteps(const std::vector<GLRStep *> &steps, bool skipGLCalls, bool keepSteps) {
if (skipGLCalls) {
// Dry run
for (size_t i = 0; i < steps.size(); i++) {
@ -724,7 +724,9 @@ void GLQueueRunner::RunSteps(const std::vector<GLRStep *> &steps, bool skipGLCal
glPopDebugGroup();
#endif
delete steps[i];
if (!keepSteps) {
delete steps[i];
}
}
CHECK_GL_ERROR_IF_DEBUG();
}

View file

@ -363,7 +363,7 @@ public:
void RunInitSteps(const std::vector<GLRInitStep> &steps, bool skipGLCalls);
void RunSteps(const std::vector<GLRStep *> &steps, bool skipGLCalls);
void RunSteps(const std::vector<GLRStep *> &steps, bool skipGLCalls, bool keepSteps = false);
void LogSteps(const std::vector<GLRStep *> &steps);
void CreateDeviceObjects();

View file

@ -558,7 +558,9 @@ void GLRenderManager::EndSubmitFrame(int frame) {
}
// Render thread
void GLRenderManager::Render(int frame) {
void GLRenderManager::Run(int frame) {
BeginSubmitFrame(frame);
FrameData &frameData = frameData_[frame];
@ -566,30 +568,12 @@ void GLRenderManager::Render(int frame) {
auto &initStepsOnThread = frameData_[frame].initSteps;
// queueRunner_.LogSteps(stepsOnThread);
queueRunner_.RunInitSteps(initStepsOnThread, skipGLCalls_);
initStepsOnThread.clear();
// Run this after RunInitSteps so any fresh GLRBuffers for the pushbuffers can get created.
if (!skipGLCalls_) {
for (auto iter : frameData.activePushBuffers) {
iter->Flush();
iter->UnmapDevice();
}
}
queueRunner_.RunSteps(stepsOnThread, skipGLCalls_);
stepsOnThread.clear();
if (!skipGLCalls_) {
for (auto iter : frameData.activePushBuffers) {
iter->MapDevice(bufferStrategy_);
}
}
}
// Render thread
void GLRenderManager::Run(int frame) {
BeginSubmitFrame(frame);
if (IsVRBuild()) {
if (PreVRRender()) {
@ -599,15 +583,26 @@ void GLRenderManager::Run(int frame) {
}
for (int i = 0; i < passes; i++) {
PreVRFrameRender(i);
Render(frame);
queueRunner_.RunSteps(stepsOnThread, skipGLCalls_, i < passes - 1);
PostVRFrameRender();
}
PostVRRender();
}
} else {
Render(frame);
queueRunner_.RunSteps(stepsOnThread, skipGLCalls_);
}
// Run this after RunInitSteps so any fresh GLRBuffers for the pushbuffers can get created.
if (!skipGLCalls_) {
for (auto iter : frameData.activePushBuffers) {
iter->Flush();
iter->UnmapDevice();
}
}
initStepsOnThread.clear();
stepsOnThread.clear();
switch (frameData_[frame].type) {
case GLRRunType::END:
EndSubmitFrame(frame);

View file

@ -377,7 +377,6 @@ public:
void BeginFrame();
// Can run on a different thread!
void Finish();
void Render(int frame);
void Run(int frame);
// Zaps queued up commands. Use if you know there's a risk you've queued up stuff that has already been deleted. Can happen during in-game shutdown.