Skip to content

Commit

Permalink
Use STATE_COMMON to read/write resource data
Browse files Browse the repository at this point in the history
When reading or writing resource data in Dx12ResourceDataUtil,
transition the resource to D3D12_RESOURCE_STATE_COMMON instead of
D3D12_RESOURCE_STATE_GENERIC_READ or D3D12_RESOURCE_STATE_COPY_DEST. The
resource should automatically be promoted to COPY_SOURCE or COPY_DEST by
the command list. This fixes corruption occasionally seen in the first
frame of trimmed captures.
  • Loading branch information
davidd-lunarg committed Jan 30, 2023
1 parent 61e1210 commit a4ad90b
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions framework/graphics/dx12_resource_data_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -625,11 +625,8 @@ Dx12ResourceDataUtil::ExecuteCopyCommandList(ID3D12Resource*
ID3D12Resource* staging_buffer,
bool batching)
{
const dx12::ResourceStateInfo kReadState = { D3D12_RESOURCE_STATE_GENERIC_READ, D3D12_RESOURCE_BARRIER_FLAG_NONE };
const dx12::ResourceStateInfo kWriteState = { D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_BARRIER_FLAG_NONE };

// The resource state required to copy data to the target resource.
const dx12::ResourceStateInfo copy_state = (copy_type == kCopyTypeRead) ? kReadState : kWriteState;
const dx12::ResourceStateInfo copy_state = { D3D12_RESOURCE_STATE_COMMON, D3D12_RESOURCE_BARRIER_FLAG_NONE };

uint64_t subresource_count = subresource_layouts.size();

Expand Down

0 comments on commit a4ad90b

Please sign in to comment.