| 187 | } |
| 188 | |
| 189 | void issueContentsCheck(ScopedCounter scope, std::string functionName, wgpu::Buffer readbackBuffer, uint32_t expectData) { |
| 190 | readbackBuffer.MapAsync( |
| 191 | wgpu::MapMode::Read, 0, 4, wgpu::CallbackMode::AllowSpontaneous, |
| 192 | [=, scope=scope](wgpu::MapAsyncStatus status, wgpu::StringView message) { |
| 193 | if (message.length) { |
| 194 | printf("readbackBuffer.MapAsync: %.*s\n", int(message.length), message.data); |
| 195 | } |
| 196 | assert(status == wgpu::MapAsyncStatus::Success); |
| 197 | |
| 198 | const void* ptr = readbackBuffer.GetConstMappedRange(); |
| 199 | |
| 200 | printf("%s: readback -> %p%s\n", functionName.c_str(), |
| 201 | ptr, ptr ? "" : " <------- FAILED"); |
| 202 | assert(ptr != nullptr); |
| 203 | uint32_t readback = static_cast<const uint32_t*>(ptr)[0]; |
| 204 | readbackBuffer.Unmap(); |
| 205 | printf(" got %08x, expected %08x%s\n", |
| 206 | readback, expectData, |
| 207 | readback == expectData ? "" : " <------- FAILED"); |
| 208 | }); |
| 209 | } |
| 210 | |
| 211 | void doCopyTestMappedAtCreation(ScopedCounter scope, bool useRange) { |
| 212 | static constexpr uint32_t kValue = 0x05060708; |
no test coverage detected