MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / issueContentsCheck

Function issueContentsCheck

test/webgpu_basic_rendering.cpp:189–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

187}
188
189void 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
211void doCopyTestMappedAtCreation(ScopedCounter scope, bool useRange) {
212 static constexpr uint32_t kValue = 0x05060708;

Callers 3

doCopyTestMapAsyncFunction · 0.85
doRenderTestFunction · 0.85

Calls 4

printfFunction · 0.85
assertFunction · 0.50
c_strMethod · 0.45
UnmapMethod · 0.45

Tested by

no test coverage detected