Changeset 238451 in webkit
- Timestamp:
- Nov 22, 2018, 1:17:41 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 13 edited
- 3 copied
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/webgpu/queue-creation-expected.txt (added)
-
LayoutTests/webgpu/queue-creation.html (added)
-
Source/WebCore/CMakeLists.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/DerivedSources.make (modified) (2 diffs)
-
Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.h (modified) (1 diff)
-
Source/WebCore/Modules/webgpu/WebGPUDevice.cpp (modified) (2 diffs)
-
Source/WebCore/Modules/webgpu/WebGPUDevice.h (modified) (3 diffs)
-
Source/WebCore/Modules/webgpu/WebGPUDevice.idl (modified) (1 diff)
-
Source/WebCore/Modules/webgpu/WebGPUQueue.cpp (copied) (copied from trunk/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.h ) (1 diff)
-
Source/WebCore/Modules/webgpu/WebGPUQueue.h (copied) (copied from trunk/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.h ) (1 diff)
-
Source/WebCore/Modules/webgpu/WebGPUQueue.idl (copied) (copied from trunk/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.h ) (1 diff)
-
Source/WebCore/Sources.txt (modified) (2 diffs)
-
Source/WebCore/WebCore.xcodeproj/project.pbxproj (modified) (3 diffs)
-
Source/WebCore/bindings/js/WebCoreBuiltinNames.h (modified) (1 diff)
-
Source/WebCore/platform/graphics/gpu/GPUQueue.h (modified) (2 diffs)
-
Source/WebCore/platform/graphics/gpu/cocoa/GPUQueueMetal.mm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r238450 r238451 1 2018-11-22 Dean Jackson <dino@apple.com> 2 3 Implement WebGPUQueue and device.getQueue() 4 https://bugs.webkit.org/show_bug.cgi?id=191911 5 <rdar://problem/46214871> 6 7 Reviewed by Antoine Quint. 8 9 WPT-style test for queue creation. 10 11 * webgpu/queue-creation-expected.txt: Added. 12 * webgpu/queue-creation.html: Added. 13 1 14 2018-11-22 Frederic Wang <fwang@igalia.com> 2 15 -
trunk/Source/WebCore/CMakeLists.txt
r238382 r238451 463 463 Modules/webgpu/WebGPUPipelineDescriptorBase.idl 464 464 Modules/webgpu/WebGPUPipelineStageDescriptor.idl 465 Modules/webgpu/WebGPUQueue.idl 465 466 Modules/webgpu/WebGPURenderPipeline.idl 466 467 Modules/webgpu/WebGPURenderPipelineDescriptor.idl -
trunk/Source/WebCore/ChangeLog
r238449 r238451 1 2018-11-22 Dean Jackson <dino@apple.com> 2 3 Implement WebGPUQueue and device.getQueue() 4 https://bugs.webkit.org/show_bug.cgi?id=191911 5 <rdar://problem/46214871> 6 7 Reviewed by Antoine Quint. 8 9 Implement WebGPUDevice::getQueue(), which creates a WebGPUQueue 10 instance if necessary. Also link WebGPUQueue to the existing 11 GPUQueue object, and expose the label IDL property. 12 13 This patch is based on some work from Justin Fan. 14 15 Test: webgpu/queue-creation.html 16 17 * DerivedSources.make: 18 * Sources.txt: 19 * WebCore.xcodeproj/project.pbxproj: 20 New files. 21 22 * Modules/webgpu/WebGPUCommandBuffer.h: 23 (WebCore::WebGPUCommandBuffer::commandBuffer const): 24 Expose a GPUCommandBuffer getter, used when submitting (even though 25 the actual GPU submission isn't implemented yet). 26 27 * Modules/webgpu/WebGPUDevice.cpp: 28 (WebCore::WebGPUDevice::getQueue): 29 * Modules/webgpu/WebGPUDevice.h: 30 * Modules/webgpu/WebGPUDevice.idl: 31 Implement getQueue(). 32 33 * Modules/webgpu/WebGPUQueue.cpp: 34 (WebCore::WebGPUQueue::create): 35 (WebCore::WebGPUQueue::WebGPUQueue): 36 (WebCore::WebGPUQueue::submit): 37 * Modules/webgpu/WebGPUQueue.h: 38 (WebCore::WebGPUQueue::label const): 39 (WebCore::WebGPUQueue::setLabel): 40 * Modules/webgpu/WebGPUQueue.idl: 41 New class. Mostly sends stuff onto GPUQueue. 42 43 * bindings/js/WebCoreBuiltinNames.h: 44 Add WebGPUQueue. 45 46 * platform/graphics/gpu/GPUQueue.h: 47 * platform/graphics/gpu/cocoa/GPUQueueMetal.mm: 48 (WebCore::GPUQueue::create): 49 (WebCore::GPUQueue::submit): 50 (WebCore::GPUQueue::label const): 51 (WebCore::GPUQueue::setLabel const): 52 "label" getter/setter that uses 53 the underlying MTLCommandQueue label property, but prefixes 54 it with a WebKit identifier, so it can be correctly 55 identified in system crash logs as coming from WebGPU. 56 1 57 2018-11-22 Zalan Bujtas <zalan@apple.com> 2 58 -
trunk/Source/WebCore/DerivedSources.make
r238382 r238451 378 378 $(WebCore)/Modules/webgpu/WebGPUCommandBuffer.idl \ 379 379 $(WebCore)/Modules/webgpu/WebGPUDevice.idl \ 380 $(WebCore)/Modules/webgpu/WebGPUQueue.idl \ 380 381 $(WebCore)/Modules/webgpu/WebGPUPipelineDescriptorBase.idl \ 381 382 $(WebCore)/Modules/webgpu/WebGPUPipelineStageDescriptor.idl \ … … 389 390 $(WebCore)/Modules/webgpu/WebGPUTexture.idl \ 390 391 $(WebCore)/Modules/webgpu/WebGPUTextureFormatEnum.idl \ 391 $(WebCore)/Modules/webgpu/WebGPUTextureView.idl \392 $(WebCore)/Modules/webgpu/WebGPUTextureView.idl \ 392 393 $(WebCore)/Modules/websockets/CloseEvent.idl \ 393 394 $(WebCore)/Modules/websockets/WebSocket.idl \ -
trunk/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.h
r238245 r238451 40 40 static RefPtr<WebGPUCommandBuffer> create(RefPtr<GPUCommandBuffer>&&); 41 41 42 const GPUCommandBuffer& commandBuffer() const { return m_commandBuffer.get(); } 43 42 44 private: 43 45 WebGPUCommandBuffer(Ref<GPUCommandBuffer>&&); -
trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp
r238382 r238451 36 36 #include "WebGPUCommandBuffer.h" 37 37 #include "WebGPUPipelineStageDescriptor.h" 38 #include "WebGPUQueue.h" 38 39 #include "WebGPURenderPipeline.h" 39 40 #include "WebGPURenderPipelineDescriptor.h" … … 125 126 } 126 127 128 RefPtr<WebGPUQueue> WebGPUDevice::getQueue() 129 { 130 if (!m_queue) 131 m_queue = WebGPUQueue::create(m_device->getQueue()); 132 133 return m_queue; 134 } 135 127 136 } // namespace WebCore 128 137 -
trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.h
r238245 r238451 30 30 #include "GPUDevice.h" 31 31 #include "WebGPUAdapter.h" 32 32 #include "WebGPUQueue.h" 33 33 #include <wtf/Ref.h> 34 34 #include <wtf/RefCounted.h> … … 56 56 57 57 RefPtr<WebGPUCommandBuffer> createCommandBuffer() const; 58 RefPtr<WebGPUQueue> getQueue(); 58 59 59 60 private: … … 61 62 62 63 Ref<WebGPUAdapter> m_adapter; 63 64 64 RefPtr<GPUDevice> m_device; 65 RefPtr<WebGPUQueue> m_queue; 65 66 }; 66 67 -
trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.idl
r238245 r238451 40 40 WebGPUCommandBuffer createCommandBuffer(/*WebGPUCommandBufferDescriptor descriptor*/); 41 41 42 /* To Be Implemented:43 WebGPUBuffer createBuffer(WebGPUBufferDescriptor descriptor);44 WebGPUTexture createTexture(WebGPUTextureDescriptor descriptor);45 WebGPUSampler createSampler(WebGPUSamplerDescriptor descriptor);46 47 WebGPUBindGroupLayout createBindGroupLayout(WebGPUBindGroupLayoutDescriptor descriptor);48 WebGPUPipelineLayout createPipelineLayout(WebGPUPipelineLayoutDescriptor descriptor);49 WebGPUBindGroup createBindGroup(WebGPUBindGroupDescriptor descriptor);50 51 WebGPUBlendState createBlendState(WebGPUBlendStateDescriptor descriptor);52 WebGPUDepthStencilState createDepthStencilState(WebGPUDepthStencilStateDescriptor descriptor);53 WebGPUInputState createInputState(WebGPUInputStateDescriptor descriptor);54 WebGPUAttachmentState createAttachmentState(WebGPUAttachmentStateDescriptor descriptor);55 WebGPUComputePipeline createComputePipeline(WebGPUComputePipelineDescriptor descriptor);56 WebGPUFence createFence(WebGPUFenceDescriptor descriptor);57 58 42 WebGPUQueue getQueue(); 59 43 60 attribute WebGPULogCallback onLog; 61 WebGPUObjectStatusQuery getObjectStatus(StatusableObject statusableObject); 62 */ 44 // FIXME: Unimplemented. 45 // WebGPUBuffer createBuffer(WebGPUBufferDescriptor descriptor); 46 // WebGPUTexture createTexture(WebGPUTextureDescriptor descriptor); 47 // WebGPUSampler createSampler(WebGPUSamplerDescriptor descriptor); 48 // 49 // WebGPUBindGroupLayout createBindGroupLayout(WebGPUBindGroupLayoutDescriptor descriptor); 50 // WebGPUPipelineLayout createPipelineLayout(WebGPUPipelineLayoutDescriptor descriptor); 51 // WebGPUBindGroup createBindGroup(WebGPUBindGroupDescriptor descriptor); 52 // 53 // WebGPUBlendState createBlendState(WebGPUBlendStateDescriptor descriptor); 54 // WebGPUDepthStencilState createDepthStencilState(WebGPUDepthStencilStateDescriptor descriptor); 55 // WebGPUInputState createInputState(WebGPUInputStateDescriptor descriptor); 56 // WebGPUAttachmentState createAttachmentState(WebGPUAttachmentStateDescriptor descriptor); 57 // WebGPUComputePipeline createComputePipeline(WebGPUComputePipelineDescriptor descriptor); 58 // WebGPUFence createFence(WebGPUFenceDescriptor descriptor); 59 // 60 // attribute WebGPULogCallback onLog; 61 // WebGPUObjectStatusQuery getObjectStatus(StatusableObject statusableObject); 63 62 }; -
trunk/Source/WebCore/Modules/webgpu/WebGPUQueue.cpp
r238450 r238451 24 24 */ 25 25 26 #pragma once 26 #include "config.h" 27 #include "WebGPUQueue.h" 27 28 28 29 #if ENABLE(WEBGPU) 29 30 30 #include <wtf/Ref.h>31 #include <wtf/RefCounted.h>32 #include <wtf/RefPtr.h>31 #include "GPUCommandBuffer.h" 32 #include "GPUQueue.h" 33 #include "WebGPUCommandBuffer.h" 33 34 34 35 namespace WebCore { 35 36 36 class GPUCommandBuffer; 37 RefPtr<WebGPUQueue> WebGPUQueue::create(RefPtr<GPUQueue>&& queue) 38 { 39 if (!queue) 40 return nullptr; 37 41 38 class WebGPUCommandBuffer : public RefCounted<WebGPUCommandBuffer> { 39 public: 40 static RefPtr<WebGPUCommandBuffer> create(RefPtr<GPUCommandBuffer>&&); 42 return adoptRef(new WebGPUQueue(queue.releaseNonNull())); 43 } 41 44 42 private: 43 WebGPUCommandBuffer(Ref<GPUCommandBuffer>&&); 45 WebGPUQueue::WebGPUQueue(Ref<GPUQueue>&& queue) 46 : m_queue(WTFMove(queue)) 47 { 48 } 44 49 45 Ref<GPUCommandBuffer> m_commandBuffer; 46 }; 50 void WebGPUQueue::submit(Vector<RefPtr<WebGPUCommandBuffer>>&& buffers) 51 { 52 auto gpuBuffers = buffers.map([] (const auto& buffer) -> Ref<const GPUCommandBuffer> { 53 return buffer->commandBuffer(); 54 }); 55 m_queue->submit(WTFMove(gpuBuffers)); 56 } 47 57 48 58 } // namespace WebCore -
trunk/Source/WebCore/Modules/webgpu/WebGPUQueue.h
r238450 r238451 28 28 #if ENABLE(WEBGPU) 29 29 30 #include <wtf/Ref.h>30 #include "GPUQueue.h" 31 31 #include <wtf/RefCounted.h> 32 32 #include <wtf/RefPtr.h> 33 #include <wtf/Vector.h> 33 34 34 35 namespace WebCore { 35 36 36 class GPUCommandBuffer;37 class WebGPUCommandBuffer; 37 38 38 class WebGPU CommandBuffer : public RefCounted<WebGPUCommandBuffer> {39 class WebGPUQueue : public RefCounted<WebGPUQueue> { 39 40 public: 40 static RefPtr<WebGPUCommandBuffer> create(RefPtr<GPUCommandBuffer>&&); 41 static RefPtr<WebGPUQueue> create(RefPtr<GPUQueue>&&); 42 43 void submit(Vector<RefPtr<WebGPUCommandBuffer>>&&); 44 45 String label() const { return m_queue->label(); } 46 void setLabel(const String& label) { m_queue->setLabel(label); } 41 47 42 48 private: 43 WebGPU CommandBuffer(Ref<GPUCommandBuffer>&&);49 WebGPUQueue(Ref<GPUQueue>&&); 44 50 45 Ref<GPU CommandBuffer> m_commandBuffer;51 Ref<GPUQueue> m_queue; 46 52 }; 47 53 -
trunk/Source/WebCore/Modules/webgpu/WebGPUQueue.idl
r238450 r238451 23 23 * THE POSSIBILITY OF SUCH DAMAGE. 24 24 */ 25 // https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl 25 26 26 #pragma once 27 [ 28 Conditional=WEBGPU, 29 EnabledAtRuntime=WebGPU, 30 ImplementationLacksVTable 31 ] interface WebGPUQueue { 32 void submit(sequence<WebGPUCommandBuffer> buffers); 27 33 28 #if ENABLE(WEBGPU) 29 30 #include <wtf/Ref.h> 31 #include <wtf/RefCounted.h> 32 #include <wtf/RefPtr.h> 33 34 namespace WebCore { 35 36 class GPUCommandBuffer; 37 38 class WebGPUCommandBuffer : public RefCounted<WebGPUCommandBuffer> { 39 public: 40 static RefPtr<WebGPUCommandBuffer> create(RefPtr<GPUCommandBuffer>&&); 41 42 private: 43 WebGPUCommandBuffer(Ref<GPUCommandBuffer>&&); 44 45 Ref<GPUCommandBuffer> m_commandBuffer; 34 // FIXME: Unimplemented. 35 // void signal(WebGPUFence fence, u64 signalValue); 36 // void wait(WebGPUFence fence, u64 valueToWait); 46 37 }; 47 48 } // namespace WebCore49 50 #endif // ENABLE(WEBGPU) -
trunk/Source/WebCore/Sources.txt
r238419 r238451 306 306 Modules/webgpu/WebGPUCommandBuffer.cpp 307 307 Modules/webgpu/WebGPUDevice.cpp 308 Modules/webgpu/WebGPUQueue.cpp 308 309 Modules/webgpu/WebGPURenderingContext.cpp 309 310 Modules/webgpu/WebGPURenderPipeline.cpp … … 3215 3216 JSWebGPUCommandBuffer.cpp 3216 3217 JSWebGPUDevice.cpp 3218 JSWebGPUQueue.cpp 3217 3219 JSWebGPUPipelineDescriptorBase.cpp 3218 3220 JSWebGPUPipelineStageDescriptor.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r238434 r238451 6941 6941 312FF90F21A4C33F00EB199D /* GPULegacyCommandQueue.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GPULegacyCommandQueue.cpp; sourceTree = "<group>"; }; 6942 6942 312FF91021A4C33F00EB199D /* GPULegacyFunction.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPULegacyFunction.h; sourceTree = "<group>"; }; 6943 312FF93921A61C9F00EB199D /* WebGPUQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGPUQueue.h; sourceTree = "<group>"; }; 6944 312FF93B21A61CA000EB199D /* WebGPUQueue.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebGPUQueue.idl; sourceTree = "<group>"; }; 6945 312FF93C21A61CA100EB199D /* WebGPUQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUQueue.cpp; sourceTree = "<group>"; }; 6946 312FF93D21A61F0700EB199D /* JSWebGPUQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSWebGPUQueue.h; path = JSWebGPUQueue.h; sourceTree = "<group>"; }; 6947 312FF93E21A61F0700EB199D /* JSWebGPUQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSWebGPUQueue.cpp; path = JSWebGPUQueue.cpp; sourceTree = "<group>"; }; 6943 6948 313171541FB079D1008D91FC /* CanvasBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CanvasBase.h; sourceTree = "<group>"; }; 6944 6949 313171571FB0969E008D91FC /* CanvasBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CanvasBase.cpp; sourceTree = "<group>"; }; … … 22730 22735 31A089301E738D59003B6609 /* JSWebGPULibrary.cpp */, 22731 22736 31A089321E738D59003B6609 /* JSWebGPULibrary.h */, 22737 312FF93E21A61F0700EB199D /* JSWebGPUQueue.cpp */, 22738 312FF93D21A61F0700EB199D /* JSWebGPUQueue.h */, 22732 22739 31A089331E738D59003B6609 /* JSWebGPURenderCommandEncoder.cpp */, 22733 22740 31A089351E738D59003B6609 /* JSWebGPURenderCommandEncoder.h */, … … 25673 25680 D0C419EB2183CFA2009EC1DE /* WebGPUPipelineStageDescriptor.h */, 25674 25681 D0C419EC2183CFA2009EC1DE /* WebGPUPipelineStageDescriptor.idl */, 25682 312FF93C21A61CA100EB199D /* WebGPUQueue.cpp */, 25683 312FF93921A61C9F00EB199D /* WebGPUQueue.h */, 25684 312FF93B21A61CA000EB199D /* WebGPUQueue.idl */, 25675 25685 D093D2292179541600329217 /* WebGPURenderingContext.cpp */, 25676 25686 D093D225217951D400329217 /* WebGPURenderingContext.h */, -
trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h
r238382 r238451 182 182 macro(WebGPUDevice) \ 183 183 macro(WebGPUCommandBuffer) \ 184 macro(WebGPUQueue) \ 184 185 macro(WebGPURenderingContext) \ 185 186 macro(WebGPURenderPipeline) \ -
trunk/Source/WebCore/platform/graphics/gpu/GPUQueue.h
r238419 r238451 36 36 namespace WebCore { 37 37 38 class GPUDevice;39 40 38 using PlatformQueue = MTLCommandQueue; 41 39 using PlatformQueueSmartPtr = RetainPtr<MTLCommandQueue>; 40 41 class GPUCommandBuffer; 42 class GPUDevice; 42 43 43 44 class GPUQueue : public RefCounted<GPUQueue> { … … 46 47 47 48 PlatformQueue* platformQueue() const { return m_platformQueue.get(); } 49 50 void submit(Vector<Ref<const GPUCommandBuffer>>&&); 51 52 String label() const; 53 void setLabel(const String&) const; 48 54 49 55 private: -
trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUQueueMetal.mm
r238419 r238451 34 34 #import <Metal/Metal.h> 35 35 #import <wtf/BlockObjCExceptions.h> 36 #import <wtf/text/WTFString.h> 36 37 37 38 namespace WebCore { 39 40 static NSString * const commandQueueDefaultLabel = @"com.apple.WebKit"; 41 static NSString * const commandQueueLabelPrefix = @"com.apple.WebKit."; 38 42 39 43 RefPtr<GPUQueue> GPUQueue::create(const GPUDevice& device) 40 44 { 41 45 if (!device.platformDevice()) { 42 LOG(WebGPU, "GPUQueue::create(): Invalid GPUDevice !");46 LOG(WebGPU, "GPUQueue::create(): Invalid GPUDevice."); 43 47 return nullptr; 44 48 } … … 49 53 50 54 queue = adoptNS([device.platformDevice() newCommandQueue]); 55 [queue setLabel:commandQueueDefaultLabel]; 51 56 52 57 END_BLOCK_OBJC_EXCEPTIONS; 53 58 54 59 if (!queue) { 55 LOG(WebGPU, "GPUQueue::create(): Unable to create MTLCommandQueue !");60 LOG(WebGPU, "GPUQueue::create(): Unable to create MTLCommandQueue."); 56 61 return nullptr; 57 62 } … … 65 70 } 66 71 72 void GPUQueue::submit(Vector<Ref<const GPUCommandBuffer>>&&) 73 { 74 // FIXME: Missing implementation. 75 } 76 77 String GPUQueue::label() const 78 { 79 if (!m_platformQueue) 80 return emptyString(); 81 82 NSString *prefixedLabel = [m_platformQueue label]; 83 84 if ([prefixedLabel isEqualToString:commandQueueDefaultLabel]) 85 return emptyString(); 86 87 ASSERT(prefixedLabel.length > commandQueueLabelPrefix.length); 88 return [prefixedLabel substringFromIndex:commandQueueLabelPrefix.length]; 89 } 90 91 void GPUQueue::setLabel(const String& label) const 92 { 93 if (label.isEmpty()) 94 [m_platformQueue setLabel:commandQueueDefaultLabel]; 95 else 96 [m_platformQueue setLabel:[commandQueueLabelPrefix stringByAppendingString:label]]; 97 } 98 67 99 } // namespace WebCore 68 100
Note:
See TracChangeset
for help on using the changeset viewer.