Changeset 247366 in webkit
- Timestamp:
- Jul 11, 2019 2:32:06 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 14 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r247362 r247366 1 2019-07-11 Justin Fan <justin_fan@apple.com> 2 3 [WebGPU] Implement GPUError and error scopes 4 https://bugs.webkit.org/show_bug.cgi?id=199655 5 6 Reviewed by Myles C. Maxfield. 7 8 Add a test to cover the cases outlined in the WebGPU error handling design doc. 9 10 * webgpu/error-scopes-test-expected.txt: Added. 11 * webgpu/error-scopes-test.html: Added. 12 1 13 2019-07-11 Commit Queue <commit-queue@webkit.org> 2 14 -
trunk/Source/WebCore/CMakeLists.txt
r246874 r247366 481 481 Modules/webgpu/GPUCompareFunction.idl 482 482 Modules/webgpu/GPUDepthStencilStateDescriptor.idl 483 Modules/webgpu/GPUErrorFilter.idl 483 484 Modules/webgpu/GPUExtent3D.idl 484 485 Modules/webgpu/GPULoadOp.idl 485 486 Modules/webgpu/GPUOrigin3D.idl 487 Modules/webgpu/GPUOutOfMemoryError.idl 486 488 Modules/webgpu/GPURequestAdapterOptions.idl 487 489 Modules/webgpu/GPUSamplerDescriptor.idl … … 491 493 Modules/webgpu/GPUTextureFormat.idl 492 494 Modules/webgpu/GPUTextureUsage.idl 495 Modules/webgpu/GPUValidationError.idl 493 496 Modules/webgpu/GPUVertexAttributeDescriptor.idl 494 497 Modules/webgpu/GPUVertexBufferDescriptor.idl … … 509 512 Modules/webgpu/WebGPUComputePipelineDescriptor.idl 510 513 Modules/webgpu/WebGPUDevice.idl 514 Modules/webgpu/WebGPUDeviceErrorScopes.idl 511 515 Modules/webgpu/WebGPUPipelineDescriptorBase.idl 512 516 Modules/webgpu/WebGPUPipelineLayout.idl -
trunk/Source/WebCore/ChangeLog
r247365 r247366 1 2019-07-11 Justin Fan <justin_fan@apple.com> 2 3 [WebGPU] Implement GPUError and error scopes 4 https://bugs.webkit.org/show_bug.cgi?id=199655 5 6 Reviewed by Myles C. Maxfield. 7 8 Add GPUErrorFilter, GPUError, and the ability to push and pop error scopes on a GPUDevice. 9 This will allow us to check for WebGPU errors from JavaScript. 10 Currently, only some GPUBuffer creation errors are reported for testing; more errors will follow in later patches. 11 12 Test: webgpu/error-scopes-test.html 13 14 * Modules/webgpu/GPUErrorFilter.idl: Added. 15 * Modules/webgpu/GPUOutOfMemoryError.idl: Added. 16 * Modules/webgpu/GPUValidationError.idl: Added. 17 * Modules/webgpu/WebGPUDevice.cpp: 18 (WebCore::WebGPUDevice::pushErrorScope): 19 (WebCore::WebGPUDevice::popErrorScope): Resolve the Promise here, since GPUDevice shouldn't worry about DOM layer. 20 * Modules/webgpu/WebGPUDevice.h: 21 * Modules/webgpu/WebGPUDeviceErrorScopes.cpp: Added. 22 (WebCore::WebGPUDeviceErrorScopes::pushErrorScope): Delegates to WebGPUDevice. 23 (WebCore::WebGPUDeviceErrorScopes::popErrorScope): Ditto. 24 * Modules/webgpu/WebGPUDeviceErrorScopes.h: Added. 25 * Modules/webgpu/WebGPUDeviceErrorScopes.idl: Added. 26 * platform/graphics/gpu/GPUBuffer.h: 27 * platform/graphics/gpu/GPUDevice.cpp: The actual error stack lives here. 28 (WebCore::GPUDevice::pushErrorScope): 29 (WebCore::GPUDevice::popErrorScope): Calls a callback with a GPUError, if any. 30 (WebCore::GPUDevice::registerError): Actually creates GPUErrors. 31 * platform/graphics/gpu/GPUDevice.h: 32 * platform/graphics/gpu/GPUError.cpp: Added. 33 (WebCore::createError): Factory function for various error types. 34 * platform/graphics/gpu/GPUError.h: Added. 35 * platform/graphics/gpu/GPUErrorFilter.h: Added. 36 * platform/graphics/gpu/GPUOutOfMemoryError.h: Added. 37 (WebCore::GPUOutOfMemoryError::create): 38 * platform/graphics/gpu/GPUValidationError.cpp: Added. 39 (WebCore::GPUValidationError::create): 40 (WebCore::GPUValidationError::GPUValidationError): 41 * platform/graphics/gpu/GPUValidationError.h: Added. 42 (WebCore::GPUValidationError::message const): 43 * platform/graphics/gpu/cocoa/GPUBufferMetal.mm: 44 (WebCore::GPUBuffer::validateBufferUsage): Create an actual GPUValidationError :) 45 (WebCore::GPUBuffer::tryCreate): Create GPUOutOfMemoryErrors where appropriate. 46 47 Add file/name references: 48 * CMakeLists.txt: 49 * DerivedSources-input.xcfilelist: 50 * DerivedSources-output.xcfilelist: 51 * DerivedSources.make: 52 * Sources.txt: 53 * WebCore.xcodeproj/project.pbxproj: 54 * bindings/js/WebCoreBuiltinNames.h: 55 56 Missing includes: 57 * Modules/webgpu/WHLSL/WHLSLCheckTextureReferences.cpp: 58 1 59 2019-07-11 Tim Horton <timothy_horton@apple.com> 2 60 -
trunk/Source/WebCore/DerivedSources-input.xcfilelist
r247174 r247366 331 331 $(PROJECT_DIR)/Modules/webgpu/GPUCompareFunction.idl 332 332 $(PROJECT_DIR)/Modules/webgpu/GPUDepthStencilStateDescriptor.idl 333 $(PROJECT_DIR)/Modules/webgpu/GPUErrorFilter.idl 333 334 $(PROJECT_DIR)/Modules/webgpu/GPUExtent3D.idl 334 335 $(PROJECT_DIR)/Modules/webgpu/GPUInputStateDescriptor.idl 335 336 $(PROJECT_DIR)/Modules/webgpu/GPULoadOp.idl 336 337 $(PROJECT_DIR)/Modules/webgpu/GPUOrigin3D.idl 338 $(PROJECT_DIR)/Modules/webgpu/GPUOutOfMemoryError.idl 337 339 $(PROJECT_DIR)/Modules/webgpu/GPURequestAdapterOptions.idl 338 340 $(PROJECT_DIR)/Modules/webgpu/GPUSamplerDescriptor.idl … … 342 344 $(PROJECT_DIR)/Modules/webgpu/GPUTextureFormat.idl 343 345 $(PROJECT_DIR)/Modules/webgpu/GPUTextureUsage.idl 346 $(PROJECT_DIR)/Modules/webgpu/GPUValidationError.idl 344 347 $(PROJECT_DIR)/Modules/webgpu/GPUVertexAttributeDescriptor.idl 345 348 $(PROJECT_DIR)/Modules/webgpu/GPUVertexBufferDescriptor.idl … … 362 365 $(PROJECT_DIR)/Modules/webgpu/WebGPUComputePipelineDescriptor.idl 363 366 $(PROJECT_DIR)/Modules/webgpu/WebGPUDevice.idl 367 $(PROJECT_DIR)/Modules/webgpu/WebGPUDeviceErrorScopes.idl 364 368 $(PROJECT_DIR)/Modules/webgpu/WebGPUPipelineDescriptorBase.idl 365 369 $(PROJECT_DIR)/Modules/webgpu/WebGPUPipelineLayout.idl -
trunk/Source/WebCore/DerivedSources-output.xcfilelist
r247174 r247366 610 610 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUDepthStencilStateDescriptor.cpp 611 611 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUDepthStencilStateDescriptor.h 612 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUErrorFilter.cpp 613 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUErrorFilter.h 612 614 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUExtent3D.cpp 613 615 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUExtent3D.h … … 618 620 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUOrigin3D.cpp 619 621 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUOrigin3D.h 622 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUOutOfMemoryError.cpp 623 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUOutOfMemoryError.h 620 624 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPURequestAdapterOptions.cpp 621 625 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPURequestAdapterOptions.h … … 632 636 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUTextureUsage.cpp 633 637 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUTextureUsage.h 638 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUValidationError.cpp 639 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUValidationError.h 634 640 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUVertexAttributeDescriptor.cpp 635 641 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUVertexAttributeDescriptor.h … … 1944 1950 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebGPUDevice.cpp 1945 1951 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebGPUDevice.h 1952 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebGPUDeviceErrorScopes.cpp 1953 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebGPUDeviceErrorScopes.h 1946 1954 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebGPUPipelineDescriptorBase.cpp 1947 1955 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebGPUPipelineDescriptorBase.h -
trunk/Source/WebCore/DerivedSources.make
r247174 r247366 387 387 $(WebCore)/Modules/webgpu/GPUCompareFunction.idl \ 388 388 $(WebCore)/Modules/webgpu/GPUDepthStencilStateDescriptor.idl \ 389 $(WebCore)/Modules/webgpu/GPUErrorFilter.idl \ 389 390 $(WebCore)/Modules/webgpu/GPUExtent3D.idl \ 390 391 $(WebCore)/Modules/webgpu/GPULoadOp.idl \ 391 392 $(WebCore)/Modules/webgpu/GPUOrigin3D.idl \ 393 $(WebCore)/Modules/webgpu/GPUOutOfMemoryError.idl \ 392 394 $(WebCore)/Modules/webgpu/GPURequestAdapterOptions.idl \ 393 395 $(WebCore)/Modules/webgpu/GPUSamplerDescriptor.idl \ … … 397 399 $(WebCore)/Modules/webgpu/GPUTextureFormat.idl \ 398 400 $(WebCore)/Modules/webgpu/GPUTextureUsage.idl \ 401 $(WebCore)/Modules/webgpu/GPUValidationError.idl \ 399 402 $(WebCore)/Modules/webgpu/GPUVertexAttributeDescriptor.idl \ 400 403 $(WebCore)/Modules/webgpu/GPUVertexBufferDescriptor.idl \ … … 415 418 $(WebCore)/Modules/webgpu/WebGPUComputePipelineDescriptor.idl \ 416 419 $(WebCore)/Modules/webgpu/WebGPUDevice.idl \ 420 $(WebCore)/Modules/webgpu/WebGPUDeviceErrorScopes.idl \ 417 421 $(WebCore)/Modules/webgpu/WebGPUQueue.idl \ 418 422 $(WebCore)/Modules/webgpu/WebGPUPipelineDescriptorBase.idl \ -
trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLCheckTextureReferences.cpp
r246631 r247366 27 27 #include "WHLSLCheckTextureReferences.h" 28 28 29 #if ENABLE(WEBGPU) 30 31 #include "WHLSLArrayReferenceType.h" 32 #include "WHLSLArrayType.h" 29 33 #include "WHLSLInferTypes.h" 30 31 #if ENABLE(WEBGPU) 34 #include "WHLSLNativeTypeDeclaration.h" 35 #include "WHLSLPointerType.h" 36 #include "WHLSLVisitor.h" 32 37 33 38 namespace WebCore { -
trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp
r246217 r247366 29 29 #if ENABLE(WEBGPU) 30 30 31 #include "Exception.h" 31 32 #include "GPUBindGroup.h" 32 33 #include "GPUBindGroupBinding.h" … … 43 44 #include "GPUTextureDescriptor.h" 44 45 #include "JSDOMConvertBufferSource.h" 46 #include "JSGPUOutOfMemoryError.h" 47 #include "JSGPUValidationError.h" 45 48 #include "JSWebGPUBuffer.h" 46 49 #include "Logging.h" … … 64 67 #include "WebGPUSwapChain.h" 65 68 #include "WebGPUTexture.h" 69 #include <wtf/Optional.h> 66 70 67 71 namespace WebCore { … … 181 185 } 182 186 187 void WebGPUDevice::pushErrorScope(GPUErrorFilter filter) const 188 { 189 m_device->pushErrorScope(filter); 190 } 191 192 void WebGPUDevice::popErrorScope(ErrorPromise&& promise) const 193 { 194 m_device->popErrorScope([promise = WTFMove(promise)] (Optional<GPUError>&& error, const String& failMessage) mutable { 195 if (failMessage.isEmpty()) 196 promise.resolve(error); 197 else 198 promise.reject(Exception { OperationError, failMessage }); 199 }); 200 } 201 183 202 } // namespace WebCore 184 203 -
trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.h
r246217 r247366 29 29 30 30 #include "GPUDevice.h" 31 #include "JSDOMPromiseDeferred.h" 31 32 #include "WebGPUAdapter.h" 32 33 #include "WebGPUQueue.h" … … 44 45 namespace WebCore { 45 46 47 class GPUOutOfMemoryError; 48 class GPUValidationError; 46 49 class ScriptExecutionContext; 47 50 class WebGPUBindGroup; … … 66 69 struct WebGPURenderPipelineDescriptor; 67 70 struct WebGPUShaderModuleDescriptor; 71 72 enum class GPUErrorFilter; 73 74 using ErrorIDLUnion = IDLUnion<IDLInterface<GPUOutOfMemoryError>, IDLInterface<GPUValidationError>>; 75 using ErrorPromise = DOMPromiseDeferred<IDLNullable<ErrorIDLUnion>>; 68 76 69 77 class WebGPUDevice : public RefCounted<WebGPUDevice> { … … 92 100 Ref<WebGPUQueue> getQueue() const; 93 101 102 void pushErrorScope(GPUErrorFilter) const; 103 void popErrorScope(ErrorPromise&&) const; 104 94 105 private: 95 106 WebGPUDevice(Ref<const WebGPUAdapter>&&, Ref<GPUDevice>&&); -
trunk/Source/WebCore/Sources.txt
r247174 r247366 368 368 Modules/webgpu/WebGPUComputePipelineDescriptor.cpp 369 369 Modules/webgpu/WebGPUDevice.cpp 370 Modules/webgpu/WebGPUDeviceErrorScopes.cpp 370 371 Modules/webgpu/WebGPUQueue.cpp 371 372 Modules/webgpu/WebGPUPipelineLayout.cpp … … 1828 1829 1829 1830 platform/graphics/gpu/GPUDevice.cpp 1831 platform/graphics/gpu/GPUError.cpp 1832 platform/graphics/gpu/GPUValidationError.cpp 1830 1833 platform/graphics/gpu/GPUPipelineLayout.cpp 1831 1834 platform/graphics/gpu/GPUProgrammablePassEncoder.cpp … … 2757 2760 JSGPUCompareFunction.cpp 2758 2761 JSGPUDepthStencilStateDescriptor.cpp 2762 JSGPUErrorFilter.cpp 2759 2763 JSGPUExtent3D.cpp 2760 2764 JSGPULoadOp.cpp 2761 2765 JSGPUOrigin3D.cpp 2766 JSGPUOutOfMemoryError.cpp 2762 2767 JSGPURequestAdapterOptions.cpp 2763 2768 JSGPUSamplerDescriptor.cpp … … 2767 2772 JSGPUTextureFormat.cpp 2768 2773 JSGPUTextureUsage.cpp 2774 JSGPUValidationError.cpp 2769 2775 JSGPUVertexAttributeDescriptor.cpp 2770 2776 JSGPUVertexBufferDescriptor.cpp … … 3319 3325 JSWebGPUComputePipelineDescriptor.cpp 3320 3326 JSWebGPUDevice.cpp 3327 JSWebGPUDeviceErrorScopes.cpp 3321 3328 JSWebGPUQueue.cpp 3322 3329 JSWebGPUPipelineDescriptorBase.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r247282 r247366 14019 14019 D093D227217951D400329217 /* GPUCanvasContext.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = GPUCanvasContext.idl; sourceTree = "<group>"; }; 14020 14020 D093D2292179541600329217 /* GPUCanvasContext.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GPUCanvasContext.cpp; sourceTree = "<group>"; }; 14021 D09AFAFF22D02E5300C4538C /* WebGPUDeviceErrorScopes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUDeviceErrorScopes.h; sourceTree = "<group>"; }; 14022 D09AFB0122D02E5300C4538C /* WebGPUDeviceErrorScopes.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUDeviceErrorScopes.cpp; sourceTree = "<group>"; }; 14023 D09AFB0222D0471900C4538C /* GPUErrorFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GPUErrorFilter.h; sourceTree = "<group>"; }; 14024 D09AFB0322D40CC500C4538C /* WebGPUDeviceErrorScopes.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUDeviceErrorScopes.idl; sourceTree = "<group>"; }; 14025 D09AFB0622D417B300C4538C /* GPUErrorFilter.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = GPUErrorFilter.idl; sourceTree = "<group>"; }; 14026 D09AFB0722D5391B00C4538C /* GPUError.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUError.h; sourceTree = "<group>"; }; 14027 D09AFB0822D5542800C4538C /* GPUError.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GPUError.cpp; sourceTree = "<group>"; }; 14028 D09AFB0C22D55E9000C4538C /* GPUValidationError.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = GPUValidationError.idl; sourceTree = "<group>"; }; 14029 D09AFB0D22D55F3B00C4538C /* GPUValidationError.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUValidationError.h; sourceTree = "<group>"; }; 14030 D09AFB0E22D55FF500C4538C /* GPUValidationError.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GPUValidationError.cpp; sourceTree = "<group>"; }; 14031 D09AFB1722D6694E00C4538C /* GPUOutOfMemoryError.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = GPUOutOfMemoryError.idl; sourceTree = "<group>"; }; 14032 D09AFB1922D6698A00C4538C /* GPUOutOfMemoryError.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUOutOfMemoryError.h; sourceTree = "<group>"; }; 14033 D09AFB2D22D6C01400C4538C /* GPUError.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GPUError.cpp; sourceTree = "<group>"; }; 14021 14034 D0A20D542092A0A600E0C259 /* WebGLCompressedTextureASTC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGLCompressedTextureASTC.h; sourceTree = "<group>"; }; 14022 14035 D0A20D562092A0A600E0C259 /* WebGLCompressedTextureASTC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebGLCompressedTextureASTC.cpp; sourceTree = "<group>"; }; … … 18321 18334 312FF8BF21A4C2F100EB199D /* GPUDevice.cpp */, 18322 18335 312FF8BE21A4C2F100EB199D /* GPUDevice.h */, 18336 D09AFB0822D5542800C4538C /* GPUError.cpp */, 18337 D09AFB2D22D6C01400C4538C /* GPUError.cpp */, 18338 D09AFB0722D5391B00C4538C /* GPUError.h */, 18339 D09AFB0222D0471900C4538C /* GPUErrorFilter.h */, 18323 18340 D026F47D220A2AC600AC5F49 /* GPUExtent3D.h */, 18324 18341 D0F7559F2203BA1400118058 /* GPULimits.h */, 18325 18342 D08AA02F220D0BD50058C502 /* GPULoadOp.h */, 18343 D09AFB1922D6698A00C4538C /* GPUOutOfMemoryError.h */, 18326 18344 312FF8C421A4C2F400EB199D /* GPUPipelineDescriptorBase.h */, 18327 18345 D003288721C9A4E500622AA6 /* GPUPipelineLayout.cpp */, … … 18349 18367 D026F485220A477200AC5F49 /* GPUTextureUsage.h */, 18350 18368 D06EF552220BA26A0018724E /* GPUUtils.h */, 18369 D09AFB0E22D55FF500C4538C /* GPUValidationError.cpp */, 18370 D09AFB0D22D55F3B00C4538C /* GPUValidationError.h */, 18351 18371 D0D8649B21BA1C2D003C983C /* GPUVertexAttributeDescriptor.h */, 18352 18372 D0D8649C21BA1CE8003C983C /* GPUVertexBufferDescriptor.h */, … … 25938 25958 D03C849E21FFCF000002227F /* GPUCompareFunction.idl */, 25939 25959 D03C84A221FFD7230002227F /* GPUDepthStencilStateDescriptor.idl */, 25960 D09AFB0622D417B300C4538C /* GPUErrorFilter.idl */, 25940 25961 D026F480220A2B7000AC5F49 /* GPUExtent3D.idl */, 25941 25962 D08AA02D220D0B9C0058C502 /* GPULoadOp.idl */, 25942 25963 D0CCA94922299F97006979B6 /* GPUOrigin3D.h */, 25943 25964 D0CCA94A22299F97006979B6 /* GPUOrigin3D.idl */, 25965 D09AFB1722D6694E00C4538C /* GPUOutOfMemoryError.idl */, 25944 25966 D02C26922181416D00D818E4 /* GPURequestAdapterOptions.idl */, 25945 25967 D0ADB26322309D7600A22935 /* GPUSamplerDescriptor.idl */, … … 25950 25972 D0EACFAE219E30FD000FA75C /* GPUTextureFormat.idl */, 25951 25973 D026F483220A472F00AC5F49 /* GPUTextureUsage.idl */, 25974 D09AFB0C22D55E9000C4538C /* GPUValidationError.idl */, 25952 25975 D0D8649621BA18F4003C983C /* GPUVertexAttributeDescriptor.idl */, 25953 25976 D0D8649821BA19A7003C983C /* GPUVertexBufferDescriptor.idl */, … … 25996 26019 D00F595221701D8C000D71DB /* WebGPUDevice.h */, 25997 26020 D00F595421701D8C000D71DB /* WebGPUDevice.idl */, 26021 D09AFB0122D02E5300C4538C /* WebGPUDeviceErrorScopes.cpp */, 26022 D09AFAFF22D02E5300C4538C /* WebGPUDeviceErrorScopes.h */, 26023 D09AFB0322D40CC500C4538C /* WebGPUDeviceErrorScopes.idl */, 25998 26024 D0C419F02183EB31009EC1DE /* WebGPUPipelineDescriptorBase.h */, 25999 26025 D0C419F12183EB31009EC1DE /* WebGPUPipelineDescriptorBase.idl */, … … 28401 28427 7C1843FE1C8B7283002EB973 /* Autofill.h in Headers */, 28402 28428 7C1E97281A9F9834007BF0FB /* AutoFillButtonElement.h in Headers */, 28429 5CCC270922D5483A00964FA0 /* AutofillElements.h in Headers */, 28403 28430 C9D467051E60C465008195FB /* AutoplayEvent.h in Headers */, 28404 28431 45830D4E1679B4F800ACF8C3 /* AutoscrollController.h in Headers */, … … 30045 30072 A77979290D6B9E64003851B9 /* JSImageData.h in Headers */, 30046 30073 7C193C011F5E11050088F3E6 /* JSImageSmoothingQuality.h in Headers */, 30047 5CCC270922D5483A00964FA0 /* AutofillElements.h in Headers */,30048 30074 A86629D309DA2B48009633A6 /* JSInputEvent.h in Headers */, 30049 30075 9175CE5E21E281ED00DF2C28 /* JSInspectorAuditAccessibilityObject.h in Headers */, -
trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h
r245788 r247366 95 95 macro(GPUComputePipeline) \ 96 96 macro(GPUDevice) \ 97 macro(GPUOutOfMemoryError) \ 97 98 macro(GPUPipelineLayout) \ 98 99 macro(GPUProgrammablePassEncoder) \ … … 107 108 macro(GPUTextureUsage) \ 108 109 macro(GPUTextureView) \ 110 macro(GPUValidationError) \ 109 111 macro(HTMLAttachmentElement) \ 110 112 macro(HTMLAudioElement) \ -
trunk/Source/WebCore/platform/graphics/gpu/GPUBuffer.h
r246217 r247366 109 109 110 110 GPUBuffer(PlatformBufferSmartPtr&&, Ref<GPUDevice>&&, size_t, OptionSet<GPUBufferUsage::Flags>, bool); 111 static bool validateBufferUsage( constGPUDevice&, OptionSet<GPUBufferUsage::Flags>);111 static bool validateBufferUsage(GPUDevice&, OptionSet<GPUBufferUsage::Flags>); 112 112 113 113 JSC::ArrayBuffer* stagingBufferForRead(); -
trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.cpp
r246217 r247366 47 47 #include "GPUTexture.h" 48 48 #include "GPUTextureDescriptor.h" 49 #include <algorithm> 49 50 #include <wtf/Optional.h> 50 51 … … 109 110 } 110 111 112 void GPUDevice::pushErrorScope(GPUErrorFilter filter) 113 { 114 m_errorScopes.append(ErrorScope { filter, WTF::nullopt }); 115 } 116 117 void GPUDevice::popErrorScope(ErrorCallback&& callback) 118 { 119 if (!m_platformDevice) 120 callback(WTF::nullopt, "GPUDevice::popErrorScope(): Invalid GPUDevice!"); 121 else if (m_errorScopes.isEmpty()) 122 callback(WTF::nullopt, "GPUDevice::popErrorScope(): No error scope exists!"); 123 else { 124 auto scope = m_errorScopes.takeLast(); 125 callback(scope.filter == GPUErrorFilter::None ? WTF::nullopt : WTFMove(scope.error), { }); 126 } 127 } 128 129 void GPUDevice::registerError(const String& message, GPUErrorFilter filter) 130 { 131 auto iterator = std::find_if(m_errorScopes.rbegin(), m_errorScopes.rend(), [filter](const ErrorScope& scope) { 132 return scope.filter == GPUErrorFilter::None || scope.filter == filter; 133 }); 134 135 // FIXME: https://webkit.org/b/199676 Uncaptured errors need to be fired as GPUUncapturedErrorEvents. 136 if (iterator == m_errorScopes.rend()) 137 return; 138 139 // If the scope has already captured an error, ignore this new one. 140 if (iterator->error) 141 return; 142 143 iterator->error = createError(filter, message); 144 } 145 111 146 } // namespace WebCore 112 147 -
trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.h
r246217 r247366 28 28 #if ENABLE(WEBGPU) 29 29 30 #include "GPUError.h" 31 #include "GPUErrorFilter.h" 30 32 #include "GPUQueue.h" 31 33 #include "GPUSwapChain.h" 34 #include <wtf/Function.h> 35 #include <wtf/Optional.h> 32 36 #include <wtf/RefCounted.h> 33 37 #include <wtf/RetainPtr.h> 38 #include <wtf/Vector.h> 34 39 #include <wtf/WeakPtr.h> 40 #include <wtf/text/WTFString.h> 35 41 36 42 OBJC_PROTOCOL(MTLDevice); … … 58 64 struct GPUSwapChainDescriptor; 59 65 struct GPUTextureDescriptor; 60 66 61 67 using PlatformDevice = MTLDevice; 62 68 using PlatformDeviceSmartPtr = RetainPtr<MTLDevice>; … … 85 91 void setSwapChain(RefPtr<GPUSwapChain>&&); 86 92 93 void pushErrorScope(GPUErrorFilter); 94 95 using ErrorCallback = WTF::Function<void(Optional<GPUError>&&, const String&)>; 96 void popErrorScope(ErrorCallback&&); 97 void registerError(const String&, GPUErrorFilter = GPUErrorFilter::Validation); 98 87 99 private: 100 struct ErrorScope { 101 const GPUErrorFilter filter; 102 Optional<GPUError> error; 103 }; 104 88 105 explicit GPUDevice(PlatformDeviceSmartPtr&&); 89 106 … … 91 108 mutable RefPtr<GPUQueue> m_queue; 92 109 RefPtr<GPUSwapChain> m_swapChain; 110 111 Vector<ErrorScope> m_errorScopes; 93 112 }; 94 113 -
trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUBufferMetal.mm
r246217 r247366 43 43 44 44 45 bool GPUBuffer::validateBufferUsage( constGPUDevice& device, OptionSet<GPUBufferUsage::Flags> usage)45 bool GPUBuffer::validateBufferUsage(GPUDevice& device, OptionSet<GPUBufferUsage::Flags> usage) 46 46 { 47 47 if (!device.platformDevice()) { … … 51 51 52 52 if (usage.containsAll({ GPUBufferUsage::Flags::MapWrite, GPUBufferUsage::Flags::MapRead })) { 53 LOG(WebGPU,"GPUBuffer::tryCreate(): Buffer cannot have both MAP_READ and MAP_WRITE usage!");53 device.registerError("GPUBuffer::tryCreate(): Buffer cannot have both MAP_READ and MAP_WRITE usage!"); 54 54 return false; 55 55 } … … 68 68 NSUInteger size = 0; 69 69 if (!WTF::convertSafely(descriptor.size, size)) { 70 LOG(WebGPU, "GPUBuffer::tryCreate(): Buffer size is too large!");70 device->registerError("", GPUErrorFilter::OutOfMemory); 71 71 return nullptr; 72 72 } … … 103 103 104 104 if (!mtlBuffer) { 105 LOG(WebGPU, "GPUBuffer::tryCreate(): Unable to create MTLBuffer!");105 device->registerError("", GPUErrorFilter::OutOfMemory); 106 106 return nullptr; 107 107 }
Note: See TracChangeset
for help on using the changeset viewer.