Skip to content

Commit f14c840

Browse files
committed
SIntendedSubmitInfo overflowSubmit return IQueue::RESULT
1 parent 03e247b commit f14c840

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

include/nbl/video/utilities/SIntendedSubmitInfo.h

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,24 +130,36 @@ struct SIntendedSubmitInfo final : core::Uncopyable
130130

131131
// One thing you might notice is that this results in a few implicit Memory and Execution Dependencies
132132
// So there's a little bit of non-deterministic behaviour we won't fight (will not insert a barrier every time you "could-have" overflown)
133-
inline void overflowSubmit()
133+
inline IQueue::RESULT overflowSubmit()
134134
{
135135
auto cmdbuf = getScratchCommandBuffer();
136136
// first sumbit the already buffered up work
137137
cmdbuf->end();
138+
138139
// we only signal the scratch semaphore when overflowing
139140
const auto submit = popSubmit({});
140-
queue->submit(submit);
141+
IQueue::RESULT res = queue->submit(submit);
142+
if (res != IQueue::RESULT::SUCCESS)
143+
return res;
144+
141145
// We wait (stall) on the immediately preceeding submission, this could be improved in the future with multiple buffering of the commandbuffers
142146
{
143147
const ISemaphore::SWaitInfo info = {.semaphore=scratchSemaphore.semaphore,.value=scratchSemaphore.value};
144-
const_cast<ILogicalDevice*>(cmdbuf->getOriginDevice())->blockForSemaphores({&info,1});
148+
ISemaphore::WAIT_RESULT waitResult = const_cast<ILogicalDevice*>(cmdbuf->getOriginDevice())->blockForSemaphores({&info,1});
149+
if (waitResult != ISemaphore::WAIT_RESULT::SUCCESS)
150+
{
151+
assert(false);
152+
return IQueue::RESULT::OTHER_ERROR;
153+
}
145154
}
146155
// since all the commandbuffers have submitted already we only reuse the last one
147156
commandBuffers = {&commandBuffers.back(),1};
157+
158+
148159
// we will still signal the same set in the future
149160
cmdbuf->reset(IGPUCommandBuffer::RESET_FLAGS::RELEASE_RESOURCES_BIT);
150161
cmdbuf->begin(IGPUCommandBuffer::USAGE::ONE_TIME_SUBMIT_BIT);
162+
return res;
151163
}
152164

153165
// Error Text to Log/Display if you try to use an invalid `SIntendedSubmitInfo`

0 commit comments

Comments
 (0)