Skip to content
Closed
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
27 changes: 24 additions & 3 deletions runtime/test/xbox_present_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -793,12 +793,33 @@ int main() {
return true;
};
// One PresentX of `count` planes, a fresh token for all; the swapchain frame is read back into `frame`.
// Fails for three different reasons, and "false" alone does not say which: the frame token, the call's
// HRESULT, or the read-back. Name the step, so a failing EXPECT above points at one of three places.
const auto present_planes = [&](rt::d3d12::XboxPresentPlaneParameters* planes_, UINT count_, HRESULT want = S_OK) {
clock.advance_us(4 * period);
if (!next_token(token)) return false;
if (!next_token(token)) {
std::printf("present_planes: no frame token left\n");
return false;
}
for (UINT i = 0; i < count_; ++i) planes_[i].Token = token;
if (xbox.PresentX(count_, planes_, nullptr) != want) return false;
return want != S_OK || grab(frame);
const HRESULT got = xbox.PresentX(count_, planes_, nullptr);
if (got != want) {
std::printf("present_planes: PresentX returned 0x%08lX, wanted 0x%08lX (count %u)\n",
static_cast<unsigned long>(got), static_cast<unsigned long>(want), static_cast<unsigned>(count_));
return false;
}
if (want != S_OK) return true;
if (!grab(frame)) {
// The layer may skip a present (nothing shown) and still report success - that is its contract -
// and the following present shows the frame. Retry once instead of calling that a failure.
if (xbox.PresentX(count_, planes_, nullptr) == want && grab(frame)) {
std::printf("present_planes: the first present was skipped, the next one captured\n");
return true;
}
std::printf("present_planes: read-back failed\n");
return false;
}
return true;
};
const auto parameters = [&](Source& s, const XboxViewRect* place, int filter, int color_space = 0,
UINT flags = 0, const D3D12_RECT* rect = nullptr) {
Expand Down
Loading