[WebGPU] Convert GPUComputePipeline LOG statements to generate GPUErrors
authorjustin_fan@apple.com <justin_fan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Jul 2019 23:51:48 +0000 (23:51 +0000)
committerjustin_fan@apple.com <justin_fan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Jul 2019 23:51:48 +0000 (23:51 +0000)
commitee86f6011fd165fb9ce5692a30f26b4ac4932c0f
treeb66431f46477e498a4b528e0c6c5bf9d663efe69
parentb142b72dad70eba03f0d69d00cb34652f7661a69
[WebGPU] Convert GPUComputePipeline LOG statements to generate GPUErrors
https://bugs.webkit.org/show_bug.cgi?id=199773

Reviewed by Myles C. Maxfield.

Source/WebCore:

Generate a GPUError if GPUComputePipeline creation fails.
Rework the WHLSL test harness to take advantage of this.

Test: webgpu/compute-pipeline-errors.html

* Modules/webgpu/WebGPUComputePipelineDescriptor.cpp:
(WebCore::WebGPUComputePipelineDescriptor::tryCreateGPUComputePipelineDescriptor const):
* Modules/webgpu/WebGPUComputePipelineDescriptor.h:
* Modules/webgpu/WebGPUDevice.cpp:
(WebCore::WebGPUDevice::createComputePipeline const):
* platform/graphics/gpu/GPUBuffer.h:
* platform/graphics/gpu/GPUComputePipeline.h:
        Now inherits from GPUObjectBase, though this isn't super useful yet
        since GPUComputePipeline itself does not expose any operations that can error.
* platform/graphics/gpu/GPUDevice.cpp:
(WebCore::GPUDevice::tryCreateComputePipeline const):
* platform/graphics/gpu/GPUDevice.h:
* platform/graphics/gpu/cocoa/GPUBufferMetal.mm:
(WebCore::GPUBuffer::validateBufferUsage):
* platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm:
(WebCore::trySetMetalFunctions):
(WebCore::trySetFunctions):
(WebCore::convertComputePipelineDescriptor):
(WebCore::tryCreateMTLComputePipelineState):
(WebCore::GPUComputePipeline::tryCreate):
(WebCore::GPUComputePipeline::GPUComputePipeline):

LayoutTests:

Add a test to ensure GPUComputePipeline errors generate correctly.
Rework checkFail in the WHLSL test harness to check for GPUError.

* webgpu/compute-pipeline-errors-expected.txt: Added.
* webgpu/compute-pipeline-errors.html: Added.
* webgpu/error-scopes-test.html:
* webgpu/js/webgpu-functions.js:
(runTestsWithDevice): Runs tests in an object all with the same device.
* webgpu/js/whlsl-test-harness.js: Add shader compilation error checking.
(Harness.prototype.async.callTypedFunction):
(Harness.prototype.async.checkCompileFail):
(Harness.prototype.async._callFunction):
(Harness):
(async.checkFail):
(Harness.prototype._callFunction): Deleted.
* webgpu/whlsl-recursive-structs-expected.txt: Remove a WHLSL compiler buggy test.
* webgpu/whlsl-recursive-structs.html:
* webgpu/whlsl-test-harness-test-expected.txt:
* webgpu/whlsl-test-harness-test.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247500 268f45cc-cd09-0410-ab3c-d52691b4dbfc
48 files changed:
LayoutTests/ChangeLog
LayoutTests/webgpu/compute-pipeline-errors-expected.txt [new file with mode: 0644]
LayoutTests/webgpu/compute-pipeline-errors.html [new file with mode: 0644]
LayoutTests/webgpu/error-scopes-test-expected.txt [new file with mode: 0644]
LayoutTests/webgpu/error-scopes-test.html [new file with mode: 0644]
LayoutTests/webgpu/js/webgpu-functions.js
LayoutTests/webgpu/js/whlsl-test-harness.js
LayoutTests/webgpu/whlsl-recursive-structs-expected.txt
LayoutTests/webgpu/whlsl-recursive-structs.html
LayoutTests/webgpu/whlsl-test-harness-test-expected.txt
LayoutTests/webgpu/whlsl-test-harness-test.html
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources-input.xcfilelist
Source/WebCore/DerivedSources-output.xcfilelist
Source/WebCore/DerivedSources.make
Source/WebCore/Modules/webgpu/GPUErrorFilter.idl [new file with mode: 0644]
Source/WebCore/Modules/webgpu/GPUOutOfMemoryError.idl [new file with mode: 0644]
Source/WebCore/Modules/webgpu/GPUValidationError.idl [new file with mode: 0644]
Source/WebCore/Modules/webgpu/WHLSL/WHLSLCheckTextureReferences.cpp
Source/WebCore/Modules/webgpu/WHLSL/WHLSLRecursionChecker.cpp
Source/WebCore/Modules/webgpu/WebGPUComputePipelineDescriptor.cpp
Source/WebCore/Modules/webgpu/WebGPUComputePipelineDescriptor.h
Source/WebCore/Modules/webgpu/WebGPUDevice.cpp
Source/WebCore/Modules/webgpu/WebGPUDevice.h
Source/WebCore/Modules/webgpu/WebGPUDeviceErrorScopes.cpp [new file with mode: 0644]
Source/WebCore/Modules/webgpu/WebGPUDeviceErrorScopes.h [new file with mode: 0644]
Source/WebCore/Modules/webgpu/WebGPUDeviceErrorScopes.idl [new file with mode: 0644]
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/WebCoreBuiltinNames.h
Source/WebCore/platform/graphics/gpu/GPUBuffer.h
Source/WebCore/platform/graphics/gpu/GPUBufferDescriptor.h
Source/WebCore/platform/graphics/gpu/GPUComputePipeline.h
Source/WebCore/platform/graphics/gpu/GPUDevice.cpp
Source/WebCore/platform/graphics/gpu/GPUDevice.h
Source/WebCore/platform/graphics/gpu/GPUError.cpp [new file with mode: 0644]
Source/WebCore/platform/graphics/gpu/GPUError.h [new file with mode: 0644]
Source/WebCore/platform/graphics/gpu/GPUErrorFilter.h [new file with mode: 0644]
Source/WebCore/platform/graphics/gpu/GPUErrorScopes.cpp [new file with mode: 0644]
Source/WebCore/platform/graphics/gpu/GPUErrorScopes.h [new file with mode: 0644]
Source/WebCore/platform/graphics/gpu/GPUObjectBase.h [new file with mode: 0644]
Source/WebCore/platform/graphics/gpu/GPUOutOfMemoryError.h [new file with mode: 0644]
Source/WebCore/platform/graphics/gpu/GPUValidationError.cpp [new file with mode: 0644]
Source/WebCore/platform/graphics/gpu/GPUValidationError.h [new file with mode: 0644]
Source/WebCore/platform/graphics/gpu/cocoa/GPUBufferMetal.mm
Source/WebCore/platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm
Source/WebCore/platform/graphics/gpu/cocoa/GPUQueueMetal.mm