Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ddprobe): verifying frames should test up to 10 frames #3414

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
17 changes: 11 additions & 6 deletions tools/ddprobe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ is_valid_frame(const D3D11_MAPPED_SUBRESOURCE &mappedResource, const D3D11_TEXTU
*/
HRESULT
test_frame_capture(dxgi::dup_t &dup, ComPtr<ID3D11Device> device) {
HRESULT failStatus;
for (int i = 0; i < 10; ++i) {
std::cout << "Attempting to acquire frame " << (i + 1) << " of 10..." << std::endl;
ComPtr<IDXGIResource> frameResource;
Expand All @@ -137,7 +138,8 @@ test_frame_capture(dxgi::dup_t &dup, ComPtr<ID3D11Device> device) {

if (FAILED(status)) {
std::cout << "Error: Failed to acquire next frame [0x"sv << util::hex(status).to_string_view() << ']' << std::endl;
return status;
failStatus = status;
continue;
}

auto cleanup = util::fail_guard([&dup]() {
Expand All @@ -150,7 +152,8 @@ test_frame_capture(dxgi::dup_t &dup, ComPtr<ID3D11Device> device) {
status = frameResource->QueryInterface(IID_PPV_ARGS(&frameTexture));
if (FAILED(status)) {
std::cout << "Error: Failed to query texture interface from frame resource [0x"sv << util::hex(status).to_string_view() << ']' << std::endl;
return status;
failStatus = status;
continue;
}

D3D11_TEXTURE2D_DESC frameDesc;
Expand All @@ -163,7 +166,8 @@ test_frame_capture(dxgi::dup_t &dup, ComPtr<ID3D11Device> device) {
status = device->CreateTexture2D(&frameDesc, nullptr, &stagingTexture);
if (FAILED(status)) {
std::cout << "Error: Failed to create staging texture [0x"sv << util::hex(status).to_string_view() << ']' << std::endl;
return status;
failStatus = status;
continue;
}

context->CopyResource(stagingTexture.Get(), frameTexture.Get());
Expand All @@ -172,7 +176,8 @@ test_frame_capture(dxgi::dup_t &dup, ComPtr<ID3D11Device> device) {
status = context->Map(stagingTexture.Get(), 0, D3D11_MAP_READ, 0, &mappedResource);
if (FAILED(status)) {
std::cout << "Error: Failed to map the staging texture for inspection [0x"sv << util::hex(status).to_string_view() << ']' << std::endl;
return status;
failStatus = status;
continue;
}

auto contextCleanup = util::fail_guard([&context, &stagingTexture]() {
Expand All @@ -181,14 +186,14 @@ test_frame_capture(dxgi::dup_t &dup, ComPtr<ID3D11Device> device) {

if (is_valid_frame(mappedResource, frameDesc)) {
std::cout << "Frame " << (i + 1) << " is non-empty (contains visible content)." << std::endl;
return S_OK;
return S_OK; // We don't need to test anymore frames at this point.
}

std::cout << "Frame " << (i + 1) << " is empty (no visible content)." << std::endl;
}

// All frames were empty, indicating potential capture issues.
return E_FAIL;
return failStatus;
}

HRESULT
Expand Down
Loading