@@ -157,13 +157,13 @@ void D3D12Quad::LoadAssets()
157157 m_commandList->ResourceBarrier (1 , &present_to_copy_src);
158158
159159 auto desc = m_renderTargets[m_frameIndex]->GetDesc ();
160- UINT64 rowSize, totalSize ;
161- m_device->GetCopyableFootprints (&desc, 0 , 1 , 0 , nullptr , nullptr , &rowSize , &totalSize );
160+ UINT64 rowSizeInBytes, totalSizeInBytes ;
161+ m_device->GetCopyableFootprints (&desc, 0 , 1 , 0 , nullptr , nullptr , &rowSizeInBytes , &totalSizeInBytes );
162162 D3D12_PLACED_SUBRESOURCE_FOOTPRINT bufferFootprint = {};
163163 bufferFootprint.Footprint .Width = static_cast <UINT>(desc.Width );
164164 bufferFootprint.Footprint .Height = desc.Height ;
165165 bufferFootprint.Footprint .Depth = 1 ;
166- bufferFootprint.Footprint .RowPitch = static_cast <UINT>((rowSize + 255 ) & ~255 );
166+ bufferFootprint.Footprint .RowPitch = static_cast <UINT>((rowSizeInBytes + 255 ) & ~255 );
167167 bufferFootprint.Footprint .Format = desc.Format ;
168168
169169 const CD3DX12_TEXTURE_COPY_LOCATION copyDest (currentBuffer.Get (), bufferFootprint);
@@ -395,19 +395,19 @@ void D3D12Quad::CreateCurrentBuffer()
395395 D3D12_RESOURCE_DESC bufferDesc = {};
396396 bufferDesc.DepthOrArraySize = 1 ;
397397 bufferDesc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER;
398- bufferDesc.Flags = D3D12_RESOURCE_FLAG_NONE ;
398+ bufferDesc.Flags = D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS ;
399399 bufferDesc.Format = DXGI_FORMAT_UNKNOWN;
400400 // bufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
401401 bufferDesc.Height = 1 ;
402- bufferDesc.Width = ((desc.Width + 255 ) & ~255 ) * 4 * desc.Height ;
402+ bufferDesc.Width = ((desc.Width * 4 + 255 ) & ~255 ) * desc.Height ;
403403 // bufferDesc.Width = static_cast<uint64_t>(800 * 600 * 3 * 4);
404404 bufferDesc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR;
405405 // bufferDesc.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN;
406406 bufferDesc.MipLevels = 1 ;
407407 bufferDesc.SampleDesc .Count = 1 ;
408408
409409 // auto heap_properties = CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT);
410- const CD3DX12_HEAP_PROPERTIES readBackHeapProperties (D3D12_HEAP_TYPE_READBACK );
410+ const CD3DX12_HEAP_PROPERTIES readBackHeapProperties (D3D12_HEAP_TYPE_DEFAULT );
411411 auto some_hr = m_device->CreateCommittedResource (
412412 &readBackHeapProperties,
413413 D3D12_HEAP_FLAG_NONE,
@@ -535,13 +535,13 @@ void D3D12Quad::PopulateCommandList()
535535 // m_commandList->CopyResource(currentBuffer.Get(), m_renderTargets[m_frameIndex].Get());
536536
537537 auto desc = m_renderTargets[m_frameIndex]->GetDesc ();
538- UINT64 rowSize, totalSize ;
539- m_device->GetCopyableFootprints (&desc, 0 , 1 , 0 , nullptr , nullptr , &rowSize , &totalSize );
538+ UINT64 rowSizeInBytes, totalSizeInBytes ;
539+ m_device->GetCopyableFootprints (&desc, 0 , 1 , 0 , nullptr , nullptr , &rowSizeInBytes , &totalSizeInBytes );
540540 D3D12_PLACED_SUBRESOURCE_FOOTPRINT bufferFootprint = {};
541541 bufferFootprint.Footprint .Width = desc.Width ;
542542 bufferFootprint.Footprint .Height = desc.Height ;
543543 bufferFootprint.Footprint .Depth = 1 ;
544- bufferFootprint.Footprint .RowPitch = static_cast <UINT>((rowSize + 255 ) & ~255 );
544+ bufferFootprint.Footprint .RowPitch = static_cast <UINT>((rowSizeInBytes + 255 ) & ~255 );
545545 bufferFootprint.Footprint .Format = desc.Format ;
546546
547547 const CD3DX12_TEXTURE_COPY_LOCATION copyDest (currentBuffer.Get (), bufferFootprint);
0 commit comments