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

Make IDXGISwapChain buffer cast conditional #1728

Merged
merged 1 commit into from
Sep 7, 2024
Merged
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
10 changes: 9 additions & 1 deletion framework/decode/dx12_replay_consumer_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2405,7 +2405,15 @@ HRESULT Dx12ReplayConsumerBase::OverrideGetBuffer(DxObjectInfo* r
if (swapchain_info->image_ids[buffer] == format::kNullHandleId)
{
auto object_info = static_cast<DxObjectInfo*>(surface->GetConsumerData(0));
InitialResourceExtraInfo(surface, D3D12_RESOURCE_STATE_PRESENT, false);

// Ensure that the retrieved buffer is a D3D12 resource prior to casting to ID3D12Resource.
const auto& buffer_iid = *riid.decoded_value;
if (IsEqualIID(buffer_iid, __uuidof(ID3D12Resource)) ||
IsEqualIID(buffer_iid, __uuidof(ID3D12Resource1)) ||
IsEqualIID(buffer_iid, __uuidof(ID3D12Resource2)))
{
InitialResourceExtraInfo(surface, D3D12_RESOURCE_STATE_PRESENT, false);
}

// Increment the replay reference to prevent the swapchain image info entry from being removed from the
// object info table while the swapchain is active.
Expand Down
Loading