WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
212013
Nonmappable buffers with createBufferMapped() doesn't work
https://bugs.webkit.org/show_bug.cgi?id=212013
Summary
Nonmappable buffers with createBufferMapped() doesn't work
Myles C. Maxfield
Reported
2020-05-18 02:01:32 PDT
See the comments in
https://bugs.webkit.org/show_bug.cgi?id=211882
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2020-05-18 02:03:58 PDT
<
rdar://problem/63332658
>
Myles C. Maxfield
Comment 2
2020-05-18 17:02:47 PDT
If you copy/paste this into WebKit, it takes 11 seconds to complete. However, if you put it in a sample project, it takes less than 1 second to complete. Maybe the sandbox is interfering? id<MTLDevice> device = MTLCreateSystemDefaultDevice(); MTLTextureDescriptor *textureDescriptor = [MTLTextureDescriptor new]; textureDescriptor.textureType = MTLTextureType2DArray; textureDescriptor.pixelFormat = MTLPixelFormatRGBA8Unorm; textureDescriptor.width = 512; textureDescriptor.height = 512; textureDescriptor.depth = 1; textureDescriptor.mipmapLevelCount = 9; textureDescriptor.sampleCount = 1; textureDescriptor.arrayLength = 2; textureDescriptor.storageMode = MTLStorageModePrivate; textureDescriptor.usage = MTLTextureUsageShaderRead; id<MTLTexture> texture = [device newTextureWithDescriptor:textureDescriptor]; id<MTLBuffer> buffer = [device newBufferWithLength:1048576 options:MTLStorageModeShared]; uint8_t* p = (uint8_t*)buffer.contents; for (int i = 0; i < 512; ++i) { for (int j = 0; j < 512; ++j) { p[i * 512 * 4 + j * 4 + 0] = 0; p[i * 512 * 4 + j * 4 + 1] = 255; p[i * 512 * 4 + j * 4 + 2] = 0; p[i * 512 * 4 + j * 4 + 3] = 255; } } id<MTLCommandQueue> queue = [device newCommandQueue]; id<MTLCommandBuffer> commandBuffer = [queue commandBuffer]; id<MTLBlitCommandEncoder> commandEncoder = [commandBuffer blitCommandEncoder]; [commandEncoder copyFromBuffer:buffer sourceOffset:0 sourceBytesPerRow:2048 sourceBytesPerImage:1048576 sourceSize:MTLSizeMake(512, 512, 1) toTexture:texture destinationSlice:0 destinationLevel:0 destinationOrigin: MTLOriginMake(0, 0, 0)]; [commandEncoder endEncoding]; [commandBuffer addCompletedHandler:^(id<MTLCommandBuffer> commandBuffer) { NSLog(@"Test Done."); }]; NSLog(@"Test committing"); [commandBuffer commit]; [[NSRunLoop mainRunLoop] run];
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug