d3d11: unmmap staging buffer before copy from it
D3D11 requires that buffers are unmapped before being used in a copy. Bug: dawn:1772 Change-Id: I58c6d587538836a6aa70abecd8a764fc50c1e9ec Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128740 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Peng Huang <penghuang@chromium.org>
This commit is contained in:
parent
ae39e6d628
commit
65786ac998
|
@ -458,6 +458,9 @@ MaybeError BufferBase::CopyFromStagingBuffer() {
|
|||
return {};
|
||||
}
|
||||
|
||||
// D3D11 requires that buffers are unmapped before being used in a copy.
|
||||
DAWN_TRY(mStagingBuffer->Unmap());
|
||||
|
||||
DAWN_TRY(
|
||||
GetDevice()->CopyFromStagingToBuffer(mStagingBuffer.Get(), 0, this, 0, GetAllocatedSize()));
|
||||
|
||||
|
|
|
@ -779,10 +779,6 @@ TEST_P(BufferMappedAtCreationTests, MapReadUsageSmall) {
|
|||
|
||||
// Test that the simplest mappedAtCreation works for non-mappable buffers.
|
||||
TEST_P(BufferMappedAtCreationTests, NonMappableUsageSmall) {
|
||||
// ID3D11DeviceContext::CopySubresourceRegion doesn't allow copying between mapped buffers.
|
||||
// TODO(dawn:1772): enable this test for D3D11
|
||||
DAWN_SUPPRESS_TEST_IF(IsD3D11() && IsBackendValidationEnabled());
|
||||
|
||||
uint32_t myData = 4239;
|
||||
wgpu::Buffer buffer = BufferMappedAtCreationWithData(wgpu::BufferUsage::CopySrc, {myData});
|
||||
UnmapBuffer(buffer);
|
||||
|
@ -824,10 +820,6 @@ TEST_P(BufferMappedAtCreationTests, MapReadUsageLarge) {
|
|||
|
||||
// Test mappedAtCreation for a large non-mappable buffer
|
||||
TEST_P(BufferMappedAtCreationTests, NonMappableUsageLarge) {
|
||||
// ID3D11DeviceContext::CopySubresourceRegion doesn't allow copying between mapped buffers.
|
||||
// TODO(dawn:1772): enable this test for D3D11
|
||||
DAWN_SUPPRESS_TEST_IF(IsD3D11() && IsBackendValidationEnabled());
|
||||
|
||||
constexpr uint64_t kDataSize = 1000 * 1000;
|
||||
std::vector<uint32_t> myData;
|
||||
for (uint32_t i = 0; i < kDataSize; ++i) {
|
||||
|
|
Loading…
Reference in New Issue