Changeset 243457 in webkit
- Timestamp:
- Mar 25, 2019, 2:12:25 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 17 deleted
- 38 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/webgpu/compute-squares-expected.txt (deleted)
-
LayoutTests/webgpu/compute-squares.html (deleted)
-
LayoutTests/webgpu/whlsl.html (modified) (1 diff)
-
Source/WebCore/CMakeLists.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/DerivedSources-input.xcfilelist (modified) (1 diff)
-
Source/WebCore/DerivedSources-output.xcfilelist (modified) (1 diff)
-
Source/WebCore/DerivedSources.make (modified) (1 diff)
-
Source/WebCore/Modules/webgpu/WHLSL/WHLSLNameResolver.h (modified) (1 diff)
-
Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.cpp (modified) (2 diffs)
-
Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.h (modified) (2 diffs)
-
Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.idl (modified) (2 diffs)
-
Source/WebCore/Modules/webgpu/WebGPUComputePassEncoder.cpp (deleted)
-
Source/WebCore/Modules/webgpu/WebGPUComputePassEncoder.h (deleted)
-
Source/WebCore/Modules/webgpu/WebGPUComputePassEncoder.idl (deleted)
-
Source/WebCore/Modules/webgpu/WebGPUComputePipeline.cpp (deleted)
-
Source/WebCore/Modules/webgpu/WebGPUComputePipeline.h (deleted)
-
Source/WebCore/Modules/webgpu/WebGPUComputePipeline.idl (deleted)
-
Source/WebCore/Modules/webgpu/WebGPUComputePipelineDescriptor.cpp (deleted)
-
Source/WebCore/Modules/webgpu/WebGPUComputePipelineDescriptor.h (deleted)
-
Source/WebCore/Modules/webgpu/WebGPUComputePipelineDescriptor.idl (deleted)
-
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) (2 diffs)
-
Source/WebCore/Modules/webgpu/WebGPUPipelineStageDescriptor.cpp (deleted)
-
Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.cpp (modified) (2 diffs)
-
Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.h (modified) (3 diffs)
-
Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.cpp (modified) (3 diffs)
-
Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.h (modified) (3 diffs)
-
Source/WebCore/Modules/webgpu/WebGPURenderPipeline.cpp (modified) (1 diff)
-
Source/WebCore/Modules/webgpu/WebGPURenderPipeline.h (modified) (1 diff)
-
Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.cpp (modified) (1 diff)
-
Source/WebCore/Sources.txt (modified) (2 diffs)
-
Source/WebCore/SourcesCocoa.txt (modified) (1 diff)
-
Source/WebCore/WebCore.xcodeproj/project.pbxproj (modified) (6 diffs)
-
Source/WebCore/bindings/js/WebCoreBuiltinNames.h (modified) (1 diff)
-
Source/WebCore/platform/cocoa/VideoFullscreenModel.h (modified) (1 diff)
-
Source/WebCore/platform/graphics/gpu/GPUBindGroup.h (modified) (3 diffs)
-
Source/WebCore/platform/graphics/gpu/GPUComputePassEncoder.h (deleted)
-
Source/WebCore/platform/graphics/gpu/GPUComputePipeline.h (deleted)
-
Source/WebCore/platform/graphics/gpu/GPUComputePipelineDescriptor.h (deleted)
-
Source/WebCore/platform/graphics/gpu/GPUDevice.cpp (modified) (3 diffs)
-
Source/WebCore/platform/graphics/gpu/GPUDevice.h (modified) (5 diffs)
-
Source/WebCore/platform/graphics/gpu/GPUPipelineDescriptorBase.h (modified) (1 diff)
-
Source/WebCore/platform/graphics/gpu/GPUProgrammablePassEncoder.h (modified) (4 diffs)
-
Source/WebCore/platform/graphics/gpu/GPURenderPassEncoder.h (modified) (2 diffs)
-
Source/WebCore/platform/graphics/gpu/GPURenderPipeline.h (modified) (1 diff)
-
Source/WebCore/platform/graphics/gpu/cocoa/GPUBindGroupMetal.mm (modified) (10 diffs)
-
Source/WebCore/platform/graphics/gpu/cocoa/GPUComputePassEncoderMetal.mm (deleted)
-
Source/WebCore/platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm (deleted)
-
Source/WebCore/platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm (modified) (4 diffs)
-
Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm (modified) (6 diffs)
-
Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm (modified) (2 diffs)
-
Source/WebCore/platform/text/mac/TextEncodingRegistryMac.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r243456 r243457 1 2019-03-25 Truitt Savell <tsavell@apple.com> 2 3 Unreviewed, rolling out r243419. 4 5 Caused Mac WK2 testers to crash and become unresponsive. 6 7 Reverted changeset: 8 9 "[Web GPU] Prototype compute pipeline with MSL" 10 https://bugs.webkit.org/show_bug.cgi?id=196107 11 https://trac.webkit.org/changeset/243419 12 1 13 2019-03-25 Truitt Savell <tsavell@apple.com> 2 14 -
trunk/LayoutTests/webgpu/whlsl.html
r243419 r243457 94 94 const swapChain = device.createSwapChain(swapChainDescriptor); 95 95 const outputTexture = swapChain.getCurrentTexture(); 96 const outputTextureView = outputTexture.createDefaultView(); 96 const outputTextureView = outputTexture.createDefaultView(); // createDefaultView() 97 97 98 98 const commandEncoder = device.createCommandEncoder(); // {} -
trunk/Source/WebCore/CMakeLists.txt
r243450 r243457 496 496 Modules/webgpu/WebGPUCommandBuffer.idl 497 497 Modules/webgpu/WebGPUCommandEncoder.idl 498 Modules/webgpu/WebGPUComputePassEncoder.idl499 Modules/webgpu/WebGPUComputePipeline.idl500 Modules/webgpu/WebGPUComputePipelineDescriptor.idl501 498 Modules/webgpu/WebGPUDevice.idl 502 499 Modules/webgpu/WebGPUPipelineDescriptorBase.idl -
trunk/Source/WebCore/ChangeLog
r243456 r243457 1 2019-03-25 Truitt Savell <tsavell@apple.com> 2 3 Unreviewed, rolling out r243419. 4 5 Caused Mac WK2 testers to crash and become unresponsive. 6 7 Reverted changeset: 8 9 "[Web GPU] Prototype compute pipeline with MSL" 10 https://bugs.webkit.org/show_bug.cgi?id=196107 11 https://trac.webkit.org/changeset/243419 12 1 13 2019-03-25 Truitt Savell <tsavell@apple.com> 2 14 -
trunk/Source/WebCore/DerivedSources-input.xcfilelist
r243450 r243457 368 368 $(PROJECT_DIR)/Modules/webgpu/WebGPUCommandBuffer.idl 369 369 $(PROJECT_DIR)/Modules/webgpu/WebGPUCommandEncoder.idl 370 $(PROJECT_DIR)/Modules/webgpu/WebGPUComputePassEncoder.idl371 $(PROJECT_DIR)/Modules/webgpu/WebGPUComputePipeline.idl372 $(PROJECT_DIR)/Modules/webgpu/WebGPUComputePipelineDescriptor.idl373 370 $(PROJECT_DIR)/Modules/webgpu/WebGPUDevice.idl 374 371 $(PROJECT_DIR)/Modules/webgpu/WebGPUIndexFormat.idl -
trunk/Source/WebCore/DerivedSources-output.xcfilelist
r243450 r243457 1932 1932 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebGPUCommandEncoder.cpp 1933 1933 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebGPUCommandEncoder.h 1934 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebGPUComputePassEncoder.cpp1935 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebGPUComputePassEncoder.h1936 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebGPUComputePipeline.cpp1937 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebGPUComputePipeline.h1938 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebGPUComputePipelineDescriptor.cpp1939 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebGPUComputePipelineDescriptor.h1940 1934 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebGPUDevice.cpp 1941 1935 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebGPUDevice.h -
trunk/Source/WebCore/DerivedSources.make
r243450 r243457 408 408 $(WebCore)/Modules/webgpu/WebGPUCommandBuffer.idl \ 409 409 $(WebCore)/Modules/webgpu/WebGPUCommandEncoder.idl \ 410 $(WebCore)/Modules/webgpu/WebGPUComputePassEncoder.idl \411 $(WebCore)/Modules/webgpu/WebGPUComputePipeline.idl \412 $(WebCore)/Modules/webgpu/WebGPUComputePipelineDescriptor.idl \413 410 $(WebCore)/Modules/webgpu/WebGPUDevice.idl \ 414 411 $(WebCore)/Modules/webgpu/WebGPUQueue.idl \ -
trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLNameResolver.h
r243419 r243457 30 30 #include "WHLSLNameContext.h" 31 31 #include "WHLSLVisitor.h" 32 #include <wtf/HashSet.h>33 32 34 33 namespace WebCore { -
trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.cpp
r243419 r243457 29 29 #if ENABLE(WEBGPU) 30 30 31 #include "GPUComputePassEncoder.h"32 31 #include "GPURenderPassDescriptor.h" 33 32 #include "GPURenderPassEncoder.h" 34 33 #include "WebGPUBuffer.h" 35 #include "WebGPUComputePassEncoder.h"36 34 #include "WebGPURenderPassDescriptor.h" 37 35 #include "WebGPURenderPassEncoder.h" … … 79 77 if (!m_commandBuffer) { 80 78 LOG(WebGPU, "WebGPUCommandEncoder::beginRenderPass(): Invalid operation!"); 81 return WebGPURenderPassEncoder::create( nullptr);79 return WebGPURenderPassEncoder::create(*this, nullptr); 82 80 } 83 81 auto gpuDescriptor = descriptor.tryCreateGPURenderPassDescriptor(); 84 82 if (!gpuDescriptor) 85 return WebGPURenderPassEncoder::create( nullptr);83 return WebGPURenderPassEncoder::create(*this, nullptr); 86 84 87 85 auto encoder = GPURenderPassEncoder::tryCreate(makeRef(*m_commandBuffer), WTFMove(*gpuDescriptor)); 88 return WebGPURenderPassEncoder::create(WTFMove(encoder)); 89 } 90 91 Ref<WebGPUComputePassEncoder> WebGPUCommandEncoder::beginComputePass() 92 { 93 if (!m_commandBuffer) { 94 LOG(WebGPU, "WebGPUCommandEncoder::beginComputePass(): Invalid operation!"); 95 return WebGPUComputePassEncoder::create(nullptr); 96 } 97 auto encoder = GPUComputePassEncoder::tryCreate(makeRef(*m_commandBuffer)); 98 return WebGPUComputePassEncoder::create(WTFMove(encoder)); 86 return WebGPURenderPassEncoder::create(*this, WTFMove(encoder)); 99 87 } 100 88 -
trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.h
r243419 r243457 36 36 37 37 class WebGPUBuffer; 38 class WebGPUComputePassEncoder;39 38 class WebGPURenderPassEncoder; 40 39 class WebGPUTexture; … … 60 59 61 60 Ref<WebGPURenderPassEncoder> beginRenderPass(WebGPURenderPassDescriptor&&); 62 Ref<WebGPUComputePassEncoder> beginComputePass();63 61 void copyBufferToBuffer(const WebGPUBuffer&, unsigned long srcOffset, const WebGPUBuffer&, unsigned long dstOffset, unsigned long size); 64 62 void copyBufferToTexture(const WebGPUBufferCopyView&, const WebGPUTextureCopyView&, const GPUExtent3D&); -
trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.idl
r243419 r243457 57 57 ] interface WebGPUCommandEncoder { 58 58 WebGPURenderPassEncoder beginRenderPass(WebGPURenderPassDescriptor descriptor); 59 WebGPUComputePassEncoder beginComputePass();60 59 61 60 void copyBufferToBuffer( … … 82 81 83 82 WebGPUCommandBuffer finish(); 83 84 // Not Yet Implemented 85 // WebGPUComputePassEncoder beginComputePass(); 84 86 }; -
trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp
r243419 r243457 50 50 #include "WebGPUBufferBinding.h" 51 51 #include "WebGPUCommandEncoder.h" 52 #include "WebGPUComputePipeline.h"53 #include "WebGPUComputePipelineDescriptor.h"54 52 #include "WebGPUPipelineLayout.h" 55 53 #include "WebGPUPipelineLayoutDescriptor.h" … … 140 138 } 141 139 142 Ref<WebGPUComputePipeline> WebGPUDevice::createComputePipeline(const WebGPUComputePipelineDescriptor& descriptor) const143 {144 auto gpuDescriptor = descriptor.tryCreateGPUComputePipelineDescriptor();145 if (!gpuDescriptor)146 return WebGPUComputePipeline::create(nullptr);147 148 auto pipeline = m_device->tryCreateComputePipeline(*gpuDescriptor);149 return WebGPUComputePipeline::create(WTFMove(pipeline));150 }151 152 140 Ref<WebGPUCommandEncoder> WebGPUDevice::createCommandEncoder() const 153 141 { -
trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.h
r243419 r243457 43 43 class WebGPUBuffer; 44 44 class WebGPUCommandEncoder; 45 class WebGPUComputePipeline;46 45 class WebGPUPipelineLayout; 47 46 class WebGPURenderPipeline; … … 56 55 struct GPUTextureDescriptor; 57 56 struct WebGPUBindGroupDescriptor; 58 struct WebGPUComputePipelineDescriptor;59 57 struct WebGPUPipelineLayoutDescriptor; 60 58 struct WebGPURenderPipelineDescriptor; … … 78 76 RefPtr<WebGPUShaderModule> createShaderModule(WebGPUShaderModuleDescriptor&&) const; 79 77 Ref<WebGPURenderPipeline> createRenderPipeline(const WebGPURenderPipelineDescriptor&) const; 80 Ref<WebGPUComputePipeline> createComputePipeline(const WebGPUComputePipelineDescriptor&) const;81 78 82 79 Ref<WebGPUCommandEncoder> createCommandEncoder() const; -
trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.idl
r243456 r243457 54 54 WebGPUShaderModule createShaderModule(WebGPUShaderModuleDescriptor descriptor); 55 55 WebGPURenderPipeline createRenderPipeline(WebGPURenderPipelineDescriptor descriptor); 56 WebGPUComputePipeline createComputePipeline(WebGPUComputePipelineDescriptor descriptor);57 56 58 57 // FIXME: Currently, GPUCommandEncoderDescriptor is an empty dictionary. … … 67 66 // readonly attribute WebGPULimits limits; 68 67 68 // WebGPUComputePipeline createComputePipeline(WebGPUComputePipelineDescriptor descriptor); 69 69 // WebGPUFence createFence(WebGPUFenceDescriptor descriptor); 70 70 -
trunk/Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.cpp
r243419 r243457 32 32 #include "Logging.h" 33 33 #include "WebGPUBindGroup.h" 34 #include "WebGPURenderPipeline.h" 34 35 35 36 namespace WebCore { 37 38 WebGPUProgrammablePassEncoder::WebGPUProgrammablePassEncoder(Ref<WebGPUCommandEncoder>&& creator) 39 : m_commandBuffer(WTFMove(creator)) 40 { 41 } 36 42 37 43 void WebGPUProgrammablePassEncoder::endPass() … … 44 50 } 45 51 46 void WebGPUProgrammablePassEncoder::setBindGroup(unsigned index, WebGPUBindGroup& bindGroup) 52 void WebGPUProgrammablePassEncoder::setBindGroup(unsigned index, WebGPUBindGroup& bindGroup) const 47 53 { 48 54 if (!passEncoder()) { -
trunk/Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.h
r243419 r243457 28 28 #if ENABLE(WEBGPU) 29 29 30 #include "WebGPUCommandEncoder.h" 30 31 #include <wtf/RefCounted.h> 31 32 … … 34 35 class GPUProgrammablePassEncoder; 35 36 class WebGPUBindGroup; 37 class WebGPURenderPipeline; 36 38 37 39 class WebGPUProgrammablePassEncoder : public RefCounted<WebGPUProgrammablePassEncoder> { … … 40 42 41 43 void endPass(); 42 void setBindGroup(unsigned, WebGPUBindGroup&) ;44 void setBindGroup(unsigned, WebGPUBindGroup&) const; 43 45 44 46 protected: 45 WebGPUProgrammablePassEncoder( ) = default;47 WebGPUProgrammablePassEncoder(Ref<WebGPUCommandEncoder>&&); 46 48 47 virtual GPUProgrammablePassEncoder* passEncoder() = 0; 48 virtual const GPUProgrammablePassEncoder* passEncoder() const = 0; 49 virtual GPUProgrammablePassEncoder* passEncoder() const = 0; 50 51 private: 52 Ref<WebGPUCommandEncoder> m_commandBuffer; 49 53 }; 50 54 -
trunk/Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.cpp
r243419 r243457 34 34 #include "Logging.h" 35 35 #include "WebGPUBuffer.h" 36 #include "WebGPURenderPipeline.h"37 36 38 37 namespace WebCore { 39 38 40 Ref<WebGPURenderPassEncoder> WebGPURenderPassEncoder::create(Ref Ptr<GPURenderPassEncoder>&& encoder)39 Ref<WebGPURenderPassEncoder> WebGPURenderPassEncoder::create(Ref<WebGPUCommandEncoder>&& commandBuffer, RefPtr<GPURenderPassEncoder>&& encoder) 41 40 { 42 return adoptRef(*new WebGPURenderPassEncoder(WTFMove( encoder)));41 return adoptRef(*new WebGPURenderPassEncoder(WTFMove(commandBuffer), WTFMove(encoder))); 43 42 } 44 43 45 WebGPURenderPassEncoder::WebGPURenderPassEncoder(RefPtr<GPURenderPassEncoder>&& encoder) 46 : m_passEncoder { WTFMove(encoder) } 44 WebGPURenderPassEncoder::WebGPURenderPassEncoder(Ref<WebGPUCommandEncoder>&& creator, RefPtr<GPURenderPassEncoder>&& encoder) 45 : WebGPUProgrammablePassEncoder(WTFMove(creator)) 46 , m_passEncoder(WTFMove(encoder)) 47 47 { 48 48 } … … 51 51 { 52 52 if (!m_passEncoder) { 53 LOG(WebGPU, "GPU RenderPassEncoder::setPipeline(): Invalid operation!");53 LOG(WebGPU, "GPUProgrammablePassEncoder::setPipeline(): Invalid operation!"); 54 54 return; 55 55 } 56 56 if (!pipeline.renderPipeline()) { 57 LOG(WebGPU, "GPU RenderPassEncoder::setPipeline(): Invalid pipeline!");57 LOG(WebGPU, "GPUProgrammablePassEncoder::setPipeline(): Invalid pipeline!"); 58 58 return; 59 59 } … … 109 109 } 110 110 111 GPUProgrammablePassEncoder* WebGPURenderPassEncoder::passEncoder() 112 { 113 return m_passEncoder.get(); 114 } 115 116 const GPUProgrammablePassEncoder* WebGPURenderPassEncoder::passEncoder() const 111 GPUProgrammablePassEncoder* WebGPURenderPassEncoder::passEncoder() const 117 112 { 118 113 return m_passEncoder.get(); -
trunk/Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.h
r243419 r243457 29 29 30 30 #include "WebGPUProgrammablePassEncoder.h" 31 31 32 #include <wtf/RefPtr.h> 32 33 #include <wtf/Vector.h> … … 37 38 class GPURenderPassEncoder; 38 39 class WebGPUBuffer; 39 class WebGPURenderPipeline;40 40 41 41 class WebGPURenderPassEncoder final : public WebGPUProgrammablePassEncoder { 42 42 public: 43 static Ref<WebGPURenderPassEncoder> create(Ref Ptr<GPURenderPassEncoder>&&);43 static Ref<WebGPURenderPassEncoder> create(Ref<WebGPUCommandEncoder>&&, RefPtr<GPURenderPassEncoder>&&); 44 44 45 45 void setPipeline(const WebGPURenderPipeline&); … … 48 48 49 49 private: 50 WebGPURenderPassEncoder(Ref Ptr<GPURenderPassEncoder>&&);50 WebGPURenderPassEncoder(Ref<WebGPUCommandEncoder>&&, RefPtr<GPURenderPassEncoder>&&); 51 51 52 GPUProgrammablePassEncoder* passEncoder() final; 53 const GPUProgrammablePassEncoder* passEncoder() const final; 52 GPUProgrammablePassEncoder* passEncoder() const final; 54 53 55 54 RefPtr<GPURenderPassEncoder> m_passEncoder; -
trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipeline.cpp
r243419 r243457 29 29 #if ENABLE(WEBGPU) 30 30 31 #include "GPURenderPipeline.h" 32 31 33 namespace WebCore { 32 34 -
trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipeline.h
r243419 r243457 29 29 30 30 #include "GPURenderPipeline.h" 31 31 32 #include <wtf/RefCounted.h> 32 33 #include <wtf/RefPtr.h> -
trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.cpp
r243419 r243457 29 29 #if ENABLE(WEBGPU) 30 30 31 #include "Logging.h" 31 namespace WebCore { 32 32 33 namespace WebCore { 33 Optional<GPUPipelineStageDescriptor> WebGPUPipelineStageDescriptor::tryCreateGPUPipelineStageDescriptor() const 34 { 35 if (!module || !module->module() || entryPoint.isEmpty()) 36 return WTF::nullopt; 37 38 return GPUPipelineStageDescriptor { makeRef(*module->module()), *this }; 39 } 34 40 35 41 Optional<GPURenderPipelineDescriptor> WebGPURenderPipelineDescriptor::tryCreateGPURenderPipelineDescriptor() const -
trunk/Source/WebCore/Sources.txt
r243433 r243457 349 349 Modules/webgpu/WHLSL/WHLSLPrepare.cpp 350 350 Modules/webgpu/WebGPU.cpp 351 Modules/webgpu/WebGPUAdapter.cpp352 351 Modules/webgpu/WebGPUBindGroup.cpp 353 352 Modules/webgpu/WebGPUBindGroupDescriptor.cpp 353 Modules/webgpu/WebGPUCommandBuffer.cpp 354 Modules/webgpu/WebGPUCommandEncoder.cpp 355 Modules/webgpu/WebGPUAdapter.cpp 354 356 Modules/webgpu/WebGPUBindGroupLayout.cpp 355 357 Modules/webgpu/WebGPUBuffer.cpp 356 Modules/webgpu/WebGPUCommandBuffer.cpp357 Modules/webgpu/WebGPUCommandEncoder.cpp358 Modules/webgpu/WebGPUComputePassEncoder.cpp359 Modules/webgpu/WebGPUComputePipeline.cpp360 Modules/webgpu/WebGPUComputePipelineDescriptor.cpp361 358 Modules/webgpu/WebGPUDevice.cpp 362 359 Modules/webgpu/WebGPUQueue.cpp 363 360 Modules/webgpu/WebGPUPipelineLayout.cpp 364 Modules/webgpu/WebGPUPipelineStageDescriptor.cpp365 361 Modules/webgpu/WebGPUProgrammablePassEncoder.cpp 366 362 Modules/webgpu/WebGPURenderPassDescriptor.cpp … … 3337 3333 JSWebGPUCommandBuffer.cpp 3338 3334 JSWebGPUCommandEncoder.cpp 3339 JSWebGPUComputePassEncoder.cpp3340 JSWebGPUComputePipeline.cpp3341 JSWebGPUComputePipelineDescriptor.cpp3342 3335 JSWebGPUDevice.cpp 3343 3336 JSWebGPUQueue.cpp -
trunk/Source/WebCore/SourcesCocoa.txt
r243419 r243457 323 323 platform/graphics/gpu/cocoa/GPUBufferMetal.mm 324 324 platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm 325 platform/graphics/gpu/cocoa/GPUComputePassEncoderMetal.mm326 platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm327 325 platform/graphics/gpu/cocoa/GPUDeviceMetal.mm 328 326 platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r243456 r243457 14010 14010 D003288721C9A4E500622AA6 /* GPUPipelineLayout.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GPUPipelineLayout.cpp; sourceTree = "<group>"; }; 14011 14011 D003914122248D400098998C /* GPUProgrammablePassEncoder.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GPUProgrammablePassEncoder.cpp; sourceTree = "<group>"; }; 14012 D00D77FD2242ED450043F12C /* WebGPUComputePassEncoder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUComputePassEncoder.h; sourceTree = "<group>"; };14013 D00D77FE2242ED450043F12C /* WebGPUComputePassEncoder.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUComputePassEncoder.cpp; sourceTree = "<group>"; };14014 D00D77FF2242ED450043F12C /* WebGPUComputePassEncoder.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUComputePassEncoder.idl; sourceTree = "<group>"; };14015 14012 D00F5940216ECC7A000D71DB /* DOMWindowWebGPU.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DOMWindowWebGPU.h; sourceTree = "<group>"; }; 14016 14013 D00F5941216ECC7A000D71DB /* DOMWindowWebGPU.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowWebGPU.cpp; sourceTree = "<group>"; }; … … 14152 14149 D087CE3F21ACA94200BDE174 /* GPUTextureMetal.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = GPUTextureMetal.mm; sourceTree = "<group>"; }; 14153 14150 D087CE4021ACA94200BDE174 /* GPUShaderModuleMetal.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = GPUShaderModuleMetal.mm; sourceTree = "<group>"; }; 14154 D08903342240601D00F3F440 /* WebGPUComputePipelineDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUComputePipelineDescriptor.h; sourceTree = "<group>"; };14155 D08903352240601D00F3F440 /* WebGPUComputePipelineDescriptor.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUComputePipelineDescriptor.idl; sourceTree = "<group>"; };14156 D0890337224061AC00F3F440 /* WebGPUPipelineStageDescriptor.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUPipelineStageDescriptor.cpp; sourceTree = "<group>"; };14157 D08903382240628900F3F440 /* WebGPUComputePipelineDescriptor.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUComputePipelineDescriptor.cpp; sourceTree = "<group>"; };14158 D08903392240642D00F3F440 /* GPUComputePipelineDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUComputePipelineDescriptor.h; sourceTree = "<group>"; };14159 D089033A224179B500F3F440 /* GPUComputePipeline.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUComputePipeline.h; sourceTree = "<group>"; };14160 D089033B224179B500F3F440 /* GPUComputePipelineMetal.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = GPUComputePipelineMetal.mm; sourceTree = "<group>"; };14161 D089033C2241A99F00F3F440 /* WebGPUComputePipeline.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUComputePipeline.h; sourceTree = "<group>"; };14162 D089033D2241A99F00F3F440 /* WebGPUComputePipeline.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUComputePipeline.cpp; sourceTree = "<group>"; };14163 D089033E2241A99F00F3F440 /* WebGPUComputePipeline.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUComputePipeline.idl; sourceTree = "<group>"; };14164 D089033F2241CE4600F3F440 /* GPUComputePassEncoder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUComputePassEncoder.h; sourceTree = "<group>"; };14165 D08903402241CE4600F3F440 /* GPUComputePassEncoderMetal.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = GPUComputePassEncoderMetal.mm; sourceTree = "<group>"; };14166 14151 D08AA02D220D0B9C0058C502 /* GPULoadOp.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = GPULoadOp.idl; sourceTree = "<group>"; }; 14167 14152 D08AA02F220D0BD50058C502 /* GPULoadOp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPULoadOp.h; sourceTree = "<group>"; }; … … 18609 18594 312FF8BD21A4C2F100EB199D /* GPUCommandBuffer.h */, 18610 18595 D03C849C21FFC7FC0002227F /* GPUCompareFunction.h */, 18611 D089033F2241CE4600F3F440 /* GPUComputePassEncoder.h */,18612 D089033A224179B500F3F440 /* GPUComputePipeline.h */,18613 D08903392240642D00F3F440 /* GPUComputePipelineDescriptor.h */,18614 18596 D03C849A21FFC6670002227F /* GPUDepthStencilStateDescriptor.h */, 18615 18597 312FF8BF21A4C2F100EB199D /* GPUDevice.cpp */, … … 26266 26248 D0EACF7621937228000FA75C /* WebGPUCommandEncoder.h */, 26267 26249 D0EACF7821937228000FA75C /* WebGPUCommandEncoder.idl */, 26268 D00D77FE2242ED450043F12C /* WebGPUComputePassEncoder.cpp */,26269 D00D77FD2242ED450043F12C /* WebGPUComputePassEncoder.h */,26270 D00D77FF2242ED450043F12C /* WebGPUComputePassEncoder.idl */,26271 D089033D2241A99F00F3F440 /* WebGPUComputePipeline.cpp */,26272 D089033C2241A99F00F3F440 /* WebGPUComputePipeline.h */,26273 D089033E2241A99F00F3F440 /* WebGPUComputePipeline.idl */,26274 D08903382240628900F3F440 /* WebGPUComputePipelineDescriptor.cpp */,26275 D08903342240601D00F3F440 /* WebGPUComputePipelineDescriptor.h */,26276 D08903352240601D00F3F440 /* WebGPUComputePipelineDescriptor.idl */,26277 26250 D00F595321701D8C000D71DB /* WebGPUDevice.cpp */, 26278 26251 D00F595221701D8C000D71DB /* WebGPUDevice.h */, … … 26286 26259 D05A99E121C9B50F00032B75 /* WebGPUPipelineLayoutDescriptor.h */, 26287 26260 D05A99E221C9B50F00032B75 /* WebGPUPipelineLayoutDescriptor.idl */, 26288 D0890337224061AC00F3F440 /* WebGPUPipelineStageDescriptor.cpp */,26289 26261 D0C419EB2183CFA2009EC1DE /* WebGPUPipelineStageDescriptor.h */, 26290 26262 D0C419EC2183CFA2009EC1DE /* WebGPUPipelineStageDescriptor.idl */, … … 26336 26308 D0D8649121B760C4003C983C /* GPUBufferMetal.mm */, 26337 26309 D087CE3821ACA94200BDE174 /* GPUCommandBufferMetal.mm */, 26338 D08903402241CE4600F3F440 /* GPUComputePassEncoderMetal.mm */,26339 D089033B224179B500F3F440 /* GPUComputePipelineMetal.mm */,26340 26310 D087CE3C21ACA94200BDE174 /* GPUDeviceMetal.mm */, 26341 26311 D087CE3B21ACA94200BDE174 /* GPUProgrammablePassEncoderMetal.mm */, -
trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h
r243456 r243457 87 87 macro(GPUCommandBuffer) \ 88 88 macro(GPUCommandEncoder) \ 89 macro(GPUComputePassEncoder) \90 macro(GPUComputePipeline) \91 89 macro(GPUShaderStageBit) \ 92 90 macro(GPUSwapChain) \ -
trunk/Source/WebCore/platform/cocoa/VideoFullscreenModel.h
r243419 r243457 35 35 #include "PlaybackSessionModel.h" 36 36 #include <wtf/CompletionHandler.h> 37 #include <wtf/WeakPtr.h>38 37 39 38 #if PLATFORM(IOS_FAMILY) -
trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroup.h
r243419 r243457 28 28 #if ENABLE(WEBGPU) 29 29 30 #include "GPUBuffer.h"31 #include "GPUTexture.h"32 30 #include <wtf/RefCounted.h> 33 31 #include <wtf/RefPtr.h> 34 32 #include <wtf/RetainPtr.h> 35 33 #include <wtf/Vector.h> 34 #include "GPUBuffer.h" 35 #include "GPUTexture.h" 36 36 37 37 OBJC_PROTOCOL(MTLBuffer); … … 46 46 47 47 #if USE(METAL) 48 const MTLBuffer *vertexArgsBuffer() const { return m_vertexArgsBuffer.get(); } 49 const MTLBuffer *fragmentArgsBuffer() const { return m_fragmentArgsBuffer.get(); } 50 const MTLBuffer *computeArgsBuffer() const { return m_computeArgsBuffer.get(); } 48 MTLBuffer *vertexArgsBuffer() { return m_vertexArgsBuffer.get(); } 49 MTLBuffer *fragmentArgsBuffer() { return m_fragmentArgsBuffer.get(); } 51 50 #endif 52 51 const Vector<Ref<GPUBuffer>>& boundBuffers() const { return m_boundBuffers; } … … 55 54 private: 56 55 #if USE(METAL) 57 GPUBindGroup(RetainPtr<MTLBuffer>&& vertexBuffer, RetainPtr<MTLBuffer>&& fragmentBuffer, RetainPtr<MTLBuffer>&& computeArgsBuffer,Vector<Ref<GPUBuffer>>&&, Vector<Ref<GPUTexture>>&&);56 GPUBindGroup(RetainPtr<MTLBuffer>&& vertexBuffer, RetainPtr<MTLBuffer>&& fragmentBuffer, Vector<Ref<GPUBuffer>>&&, Vector<Ref<GPUTexture>>&&); 58 57 59 58 RetainPtr<MTLBuffer> m_vertexArgsBuffer; 60 59 RetainPtr<MTLBuffer> m_fragmentArgsBuffer; 61 RetainPtr<MTLBuffer> m_computeArgsBuffer;62 60 #endif 63 61 Vector<Ref<GPUBuffer>> m_boundBuffers; -
trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.cpp
r243419 r243457 34 34 #include "GPUBufferDescriptor.h" 35 35 #include "GPUCommandBuffer.h" 36 #include "GPUComputePipeline.h"37 #include "GPUComputePipelineDescriptor.h"38 36 #include "GPUPipelineLayout.h" 39 37 #include "GPUPipelineLayoutDescriptor.h" … … 45 43 #include "GPUShaderModuleDescriptor.h" 46 44 #include "GPUSwapChain.h" 47 #include "GPUSwapChainDescriptor.h"48 45 #include "GPUTexture.h" 49 46 #include "GPUTextureDescriptor.h" … … 87 84 } 88 85 89 RefPtr<GPUComputePipeline> GPUDevice::tryCreateComputePipeline(const GPUComputePipelineDescriptor& descriptor) const90 {91 return GPUComputePipeline::tryCreate(*this, descriptor);92 }93 94 86 RefPtr<GPUCommandBuffer> GPUDevice::tryCreateCommandBuffer() const 95 87 { -
trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.h
r243419 r243457 29 29 30 30 #include "GPUQueue.h" 31 #include "GPUSwapChainDescriptor.h" 31 32 #include <wtf/RefCounted.h> 32 33 #include <wtf/RetainPtr.h> … … 40 41 class GPUBuffer; 41 42 class GPUCommandBuffer; 42 class GPUComputePipeline;43 43 class GPUPipelineLayout; 44 44 class GPURenderPipeline; … … 50 50 struct GPUBindGroupLayoutDescriptor; 51 51 struct GPUBufferDescriptor; 52 struct GPUComputePipelineDescriptor;53 52 struct GPUPipelineLayoutDescriptor; 54 53 struct GPURenderPipelineDescriptor; … … 56 55 struct GPUSamplerDescriptor; 57 56 struct GPUShaderModuleDescriptor; 58 struct GPUSwapChainDescriptor;59 57 struct GPUTextureDescriptor; 60 58 … … 75 73 RefPtr<GPUShaderModule> createShaderModule(GPUShaderModuleDescriptor&&) const; 76 74 RefPtr<GPURenderPipeline> createRenderPipeline(GPURenderPipelineDescriptor&&) const; 77 RefPtr<GPUComputePipeline> tryCreateComputePipeline(const GPUComputePipelineDescriptor&) const;78 75 79 76 RefPtr<GPUCommandBuffer> tryCreateCommandBuffer() const; -
trunk/Source/WebCore/platform/graphics/gpu/GPUPipelineDescriptorBase.h
r243419 r243457 30 30 #include "GPUPipelineLayout.h" 31 31 #include "GPUPipelineStageDescriptor.h" 32 #include <wtf/RefPtr.h> 32 33 33 #include <wtf/Vector.h> 34 34 -
trunk/Source/WebCore/platform/graphics/gpu/GPUProgrammablePassEncoder.h
r243419 r243457 29 29 30 30 #include "GPUBindGroupBinding.h" 31 #include "GPUCommandBuffer.h"32 31 #include <wtf/RefCounted.h> 33 32 … … 41 40 42 41 class GPUBindGroup; 42 class GPUCommandBuffer; 43 43 class GPURenderPipeline; 44 44 … … 49 49 virtual ~GPUProgrammablePassEncoder() = default; 50 50 51 v oid endPass();51 virtual void endPass(); 52 52 void setBindGroup(unsigned, GPUBindGroup&); 53 53 … … 56 56 57 57 GPUCommandBuffer& commandBuffer() const { return m_commandBuffer.get(); } 58 virtual constPlatformProgrammablePassEncoder* platformPassEncoder() const = 0;58 virtual PlatformProgrammablePassEncoder* platformPassEncoder() const = 0; 59 59 60 60 private: 61 virtual void invalidateEncoder() = 0;62 61 #if USE(METAL) 63 virtual void useResource( constMTLResource *, unsigned) = 0;62 virtual void useResource(MTLResource *, unsigned) = 0; 64 63 65 64 // Render command encoder methods. 66 virtual void setVertexBuffer(const MTLBuffer *, unsigned, unsigned) { } 67 virtual void setFragmentBuffer(const MTLBuffer *, unsigned, unsigned) { } 68 // Compute. 69 virtual void setComputeBuffer(const MTLBuffer *, unsigned, unsigned) { } 65 virtual void setVertexBuffer(MTLBuffer *, unsigned, unsigned) { } 66 virtual void setFragmentBuffer(MTLBuffer *, unsigned, unsigned) { } 70 67 #endif // USE(METAL) 71 68 -
trunk/Source/WebCore/platform/graphics/gpu/GPURenderPassEncoder.h
r243419 r243457 52 52 static RefPtr<GPURenderPassEncoder> tryCreate(Ref<GPUCommandBuffer>&&, GPURenderPassDescriptor&&); 53 53 54 void endPass() final; 54 55 void setPipeline(Ref<const GPURenderPipeline>&&); 56 55 57 void setVertexBuffers(unsigned long, Vector<Ref<GPUBuffer>>&&, Vector<unsigned long long>&&); 56 58 void draw(unsigned long vertexCount, unsigned long instanceCount, unsigned long firstVertex, unsigned long firstInstance); … … 58 60 private: 59 61 GPURenderPassEncoder(Ref<GPUCommandBuffer>&&, PlatformRenderPassEncoderSmartPtr&&); 60 ~GPURenderPassEncoder() { endPass(); } 62 ~GPURenderPassEncoder() { endPass(); } // Ensure that encoding has ended before release. 61 63 64 PlatformProgrammablePassEncoder* platformPassEncoder() const final; 65 66 #if USE(METAL) 62 67 // GPUProgrammablePassEncoder 63 const PlatformProgrammablePassEncoder* platformPassEncoder() const final; 64 void invalidateEncoder() final { m_platformRenderPassEncoder = nullptr; } 65 #if USE(METAL) 66 void useResource(const MTLResource *, unsigned usage) final; 67 void setVertexBuffer(const MTLBuffer *, unsigned offset, unsigned index) final; 68 void setFragmentBuffer(const MTLBuffer *, unsigned offset, unsigned index) final; 68 void useResource(MTLResource *, unsigned usage) final; 69 void setVertexBuffer(MTLBuffer *, unsigned offset, unsigned index) final; 70 void setFragmentBuffer(MTLBuffer *, unsigned offset, unsigned index) final; 69 71 #endif // USE(METAL) 70 72 -
trunk/Source/WebCore/platform/graphics/gpu/GPURenderPipeline.h
r243419 r243457 62 62 #endif // USE(METAL) 63 63 PlatformRenderPipelineSmartPtr m_platformRenderPipeline; 64 RefPtr<GPUPipelineLayout> m_layout; 64 65 GPUPrimitiveTopology m_primitiveTopology; 65 66 }; -
trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUBindGroupMetal.mm
r243419 r243457 32 32 #import "GPUBindGroupDescriptor.h" 33 33 #import "GPUBindGroupLayout.h" 34 #import "GPUBuffer.h" 34 35 #import "GPUSampler.h" 36 #import "GPUTexture.h" 35 37 #import "Logging.h" 36 38 #import <Metal/Metal.h> … … 76 78 } 77 79 78 static MTLSamplerState *tryGetResourceAsMTLSamplerState(const GPUBindingResource& resource, const char* const functionName)80 static RefPtr<GPUSampler> tryGetResourceAsSampler(const GPUBindingResource& resource, const char* const functionName) 79 81 { 80 82 #if LOG_DISABLED … … 85 87 return nullptr; 86 88 } 87 auto samplerState = WTF::get<Ref<GPUSampler>>(resource)->platformSampler();88 if (!sampler State)89 auto& samplerRef = WTF::get<Ref<GPUSampler>>(resource); 90 if (!samplerRef->platformSampler()) { 89 91 LOG(WebGPU, "%s: Invalid MTLSamplerState in GPUSampler binding!", functionName); 90 91 return samplerState; 92 return nullptr; 93 } 94 return samplerRef.copyRef(); 92 95 } 93 96 … … 133 136 MTLArgumentEncoder *vertexEncoder = descriptor.layout->vertexEncoder(); 134 137 MTLArgumentEncoder *fragmentEncoder = descriptor.layout->fragmentEncoder(); 135 MTLArgumentEncoder *computeEncoder = descriptor.layout->computeEncoder();138 // FIXME: Finish support for compute. 136 139 137 140 RetainPtr<MTLBuffer> vertexArgsBuffer; … … 145 148 return nullptr; 146 149 } 147 RetainPtr<MTLBuffer> computeArgsBuffer;148 if (computeEncoder && !(computeArgsBuffer = tryCreateArgumentBuffer(computeEncoder))) {149 LOG(WebGPU, "%s: Unable to create MTLBuffer for compute argument buffer!", functionName);150 return nullptr;151 }152 150 153 151 Vector<Ref<GPUBuffer>> boundBuffers; … … 157 155 const auto& layoutBindingsMap = descriptor.layout->bindingsMap(); 158 156 for (const auto& resourceBinding : descriptor.bindings) { 159 auto index = resourceBinding.binding; 160 auto layoutIterator = layoutBindingsMap.find(index); 157 auto layoutIterator = layoutBindingsMap.find(resourceBinding.binding); 161 158 if (layoutIterator == layoutBindingsMap.end()) { 162 LOG(WebGPU, "%s: GPUBindGroupBinding %lu not found in GPUBindGroupLayout!", functionName, index);159 LOG(WebGPU, "%s: GPUBindGroupBinding %lu not found in GPUBindGroupLayout!", functionName, resourceBinding.binding); 163 160 return nullptr; 164 161 } … … 166 163 if (layoutBinding.visibility == GPUShaderStageBit::Flags::None) 167 164 continue; 168 169 bool isForVertex = layoutBinding.visibility & GPUShaderStageBit::Flags::Vertex; 170 bool isForFragment = layoutBinding.visibility & GPUShaderStageBit::Flags::Fragment; 171 bool isForCompute = layoutBinding.visibility & GPUShaderStageBit::Flags::Compute; 172 173 if (isForVertex && !vertexEncoder) { 174 LOG(WebGPU, "%s: No vertex argument encoder found for binding %lu!", functionName, index); 175 return nullptr; 176 } 177 if (isForFragment && !fragmentEncoder) { 178 LOG(WebGPU, "%s: No fragment argument encoder found for binding %lu!", functionName, index); 179 return nullptr; 180 } 181 if (isForCompute && !computeEncoder) { 182 LOG(WebGPU, "%s: No compute argument encoder found for binding %lu!", functionName, index); 183 return nullptr; 184 } 185 165 if ((layoutBinding.visibility & GPUShaderStageBit::Flags::Vertex) && !vertexEncoder) { 166 LOG(WebGPU, "%s: No vertex encoder found for binding %lu!", functionName, resourceBinding.binding); 167 return nullptr; 168 } 169 if ((layoutBinding.visibility & GPUShaderStageBit::Flags::Fragment) && !fragmentEncoder) { 170 LOG(WebGPU, "%s: No fragment encoder found for binding %lu!", functionName, resourceBinding.binding); 171 return nullptr; 172 } 173 186 174 switch (layoutBinding.type) { 187 175 // FIXME: Support more resource types. 188 // FIXME: We could avoid this ugly switch-on-type using virtual functions if GPUBindingResource is refactored as a base class rather than a Variant.189 176 case GPUBindingType::UniformBuffer: 190 177 case GPUBindingType::StorageBuffer: { … … 192 179 if (!bufferResource) 193 180 return nullptr; 194 if (isForVertex) 195 setBufferOnEncoder(vertexEncoder, *bufferResource, index); 196 if (isForFragment) 197 setBufferOnEncoder(fragmentEncoder, *bufferResource, index); 198 if (isForCompute) 199 setBufferOnEncoder(computeEncoder, *bufferResource, index); 181 if (layoutBinding.visibility & GPUShaderStageBit::Flags::Vertex) 182 setBufferOnEncoder(vertexEncoder, *bufferResource, resourceBinding.binding); 183 if (layoutBinding.visibility & GPUShaderStageBit::Flags::Fragment) 184 setBufferOnEncoder(fragmentEncoder, *bufferResource, resourceBinding.binding); 200 185 boundBuffers.append(bufferResource->buffer.copyRef()); 201 186 break; 202 187 } 203 188 case GPUBindingType::Sampler: { 204 auto sampler State = tryGetResourceAsMTLSamplerState(resourceBinding.resource, functionName);205 if (!sampler State)189 auto samplerResource = tryGetResourceAsSampler(resourceBinding.resource, functionName); 190 if (!samplerResource) 206 191 return nullptr; 207 if (isForVertex) 208 setSamplerOnEncoder(vertexEncoder, samplerState, index); 209 if (isForFragment) 210 setSamplerOnEncoder(fragmentEncoder, samplerState, index); 211 if (isForCompute) 212 setSamplerOnEncoder(computeEncoder, samplerState, index); 192 if (layoutBinding.visibility & GPUShaderStageBit::Flags::Vertex) 193 setSamplerOnEncoder(vertexEncoder, samplerResource->platformSampler(), resourceBinding.binding); 194 if (layoutBinding.visibility & GPUShaderStageBit::Flags::Fragment) 195 setSamplerOnEncoder(fragmentEncoder, samplerResource->platformSampler(), resourceBinding.binding); 213 196 break; 214 197 } … … 217 200 if (!textureResource) 218 201 return nullptr; 219 if (isForVertex) 220 setTextureOnEncoder(vertexEncoder, textureResource->platformTexture(), index); 221 if (isForFragment) 222 setTextureOnEncoder(fragmentEncoder, textureResource->platformTexture(), index); 223 if (isForCompute) 224 setTextureOnEncoder(computeEncoder, textureResource->platformTexture(), index); 202 if (layoutBinding.visibility & GPUShaderStageBit::Flags::Vertex) 203 setTextureOnEncoder(vertexEncoder, textureResource->platformTexture(), resourceBinding.binding); 204 if (layoutBinding.visibility & GPUShaderStageBit::Flags::Fragment) 205 setTextureOnEncoder(fragmentEncoder, textureResource->platformTexture(), resourceBinding.binding); 225 206 boundTextures.append(textureResource.releaseNonNull()); 226 207 break; … … 232 213 } 233 214 234 return adoptRef(new GPUBindGroup(WTFMove(vertexArgsBuffer), WTFMove(fragmentArgsBuffer), WTFMove( computeArgsBuffer), WTFMove(boundBuffers), WTFMove(boundTextures)));235 } 236 237 GPUBindGroup::GPUBindGroup(RetainPtr<MTLBuffer>&& vertexBuffer, RetainPtr<MTLBuffer>&& fragmentBuffer, RetainPtr<MTLBuffer>&& computeBuffer,Vector<Ref<GPUBuffer>>&& buffers, Vector<Ref<GPUTexture>>&& textures)215 return adoptRef(new GPUBindGroup(WTFMove(vertexArgsBuffer), WTFMove(fragmentArgsBuffer), WTFMove(boundBuffers), WTFMove(boundTextures))); 216 } 217 218 GPUBindGroup::GPUBindGroup(RetainPtr<MTLBuffer>&& vertexBuffer, RetainPtr<MTLBuffer>&& fragmentBuffer, Vector<Ref<GPUBuffer>>&& buffers, Vector<Ref<GPUTexture>>&& textures) 238 219 : m_vertexArgsBuffer(WTFMove(vertexBuffer)) 239 220 , m_fragmentArgsBuffer(WTFMove(fragmentBuffer)) 240 , m_computeArgsBuffer(WTFMove(computeBuffer))241 221 , m_boundBuffers(WTFMove(buffers)) 242 222 , m_boundTextures(WTFMove(textures)) -
trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm
r243419 r243457 30 30 31 31 #import "GPUBindGroup.h" 32 #import "GPUCommandBuffer.h" 32 33 #import "Logging.h" 33 34 #import <Metal/Metal.h> … … 38 39 void GPUProgrammablePassEncoder::endPass() 39 40 { 40 if (!platformPassEncoder()) 41 return; 41 ASSERT(platformPassEncoder()); 42 42 43 43 BEGIN_BLOCK_OBJC_EXCEPTIONS; … … 45 45 END_BLOCK_OBJC_EXCEPTIONS; 46 46 47 invalidateEncoder();48 47 m_commandBuffer->setIsEncodingPass(false); 49 48 } … … 60 59 if (bindGroup.fragmentArgsBuffer()) 61 60 setFragmentBuffer(bindGroup.fragmentArgsBuffer(), 0, index); 62 if (bindGroup.computeArgsBuffer())63 setComputeBuffer(bindGroup.computeArgsBuffer(), 0, index);64 61 65 62 for (auto& bufferRef : bindGroup.boundBuffers()) { -
trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm
r243419 r243457 179 179 } 180 180 181 constMTLCommandEncoder *GPURenderPassEncoder::platformPassEncoder() const181 MTLCommandEncoder *GPURenderPassEncoder::platformPassEncoder() const 182 182 { 183 183 return m_platformRenderPassEncoder.get(); 184 184 } 185 185 186 void GPURenderPassEncoder::endPass() 187 { 188 if (!m_platformRenderPassEncoder) 189 return; 190 GPUProgrammablePassEncoder::endPass(); 191 m_platformRenderPassEncoder = nullptr; 192 } 193 186 194 void GPURenderPassEncoder::setPipeline(Ref<const GPURenderPipeline>&& pipeline) 187 195 { … … 191 199 } 192 200 193 // FIXME: Metal throws an error if the MTLPipelineState's attachment formats do not match the MTLCommandEncoder's attachment formats. 201 // FIXME: Metal throws an error if the MTLPipelineState's attachment formats do not match the MTLCommandEncoder's attachment formats. Does this have to be validated at the Web GPU level? 194 202 195 203 BEGIN_BLOCK_OBJC_EXCEPTIONS; … … 258 266 } 259 267 260 BEGIN_BLOCK_OBJC_EXCEPTIONS;261 268 [m_platformRenderPassEncoder 262 269 drawPrimitives:primitiveTypeForGPUPrimitiveTopology(m_pipeline->primitiveTopology()) … … 265 272 instanceCount:instanceCount 266 273 baseInstance:firstInstance]; 267 END_BLOCK_OBJC_EXCEPTIONS;268 274 } 269 275 270 276 #if USE(METAL) 271 277 272 void GPURenderPassEncoder::useResource(const MTLResource *resource, unsigned usage) 273 { 274 ASSERT(m_platformRenderPassEncoder); 275 278 void GPURenderPassEncoder::useResource(MTLResource *resource, unsigned usage) 279 { 280 if (!m_platformRenderPassEncoder) { 281 LOG(WebGPU, "GPURenderPassEncoder: Invalid operation: Encoding is ended!"); 282 return; 283 } 276 284 BEGIN_BLOCK_OBJC_EXCEPTIONS; 277 285 [m_platformRenderPassEncoder useResource:resource usage:usage]; … … 279 287 } 280 288 281 void GPURenderPassEncoder::setVertexBuffer(const MTLBuffer *buffer, unsigned offset, unsigned index) 282 { 283 ASSERT(m_platformRenderPassEncoder); 284 289 void GPURenderPassEncoder::setVertexBuffer(MTLBuffer *buffer, unsigned offset, unsigned index) 290 { 291 if (!m_platformRenderPassEncoder) { 292 LOG(WebGPU, "GPURenderPassEncoder: Invalid operation: Encoding is ended!"); 293 return; 294 } 285 295 BEGIN_BLOCK_OBJC_EXCEPTIONS; 286 296 [m_platformRenderPassEncoder setVertexBuffer:buffer offset:offset atIndex:index]; … … 288 298 } 289 299 290 void GPURenderPassEncoder::setFragmentBuffer(const MTLBuffer *buffer, unsigned offset, unsigned index) 291 { 292 ASSERT(m_platformRenderPassEncoder); 293 300 void GPURenderPassEncoder::setFragmentBuffer(MTLBuffer *buffer, unsigned offset, unsigned index) 301 { 302 if (!m_platformRenderPassEncoder) { 303 LOG(WebGPU, "GPURenderPassEncoder: Invalid operation: Encoding is ended!"); 304 return; 305 } 294 306 BEGIN_BLOCK_OBJC_EXCEPTIONS; 295 307 [m_platformRenderPassEncoder setFragmentBuffer:buffer offset:offset atIndex:index]; -
trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm
r243419 r243457 29 29 #if ENABLE(WEBGPU) 30 30 31 #import "GPUDevice.h"32 31 #import "GPULimits.h" 33 32 #import "GPUUtils.h" … … 443 442 : m_depthStencilState(WTFMove(depthStencil)) 444 443 , m_platformRenderPipeline(WTFMove(pipeline)) 444 , m_layout(WTFMove(descriptor.layout)) 445 445 , m_primitiveTopology(descriptor.primitiveTopology) 446 446 { -
trunk/Source/WebCore/platform/text/mac/TextEncodingRegistryMac.mm
r243419 r243457 29 29 #if PLATFORM(MAC) 30 30 31 #import <Carbon/Carbon.h> 31 32 #import <wtf/spi/cf/CFStringSPI.h> 32 33
Note:
See TracChangeset
for help on using the changeset viewer.