[Web GPU] Vertex Buffers/Input State API updates
authorjustin_fan@apple.com <justin_fan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 May 2019 21:05:16 +0000 (21:05 +0000)
committerjustin_fan@apple.com <justin_fan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 May 2019 21:05:16 +0000 (21:05 +0000)
commit23cea755ba6a7442ea30e5f6cd3298bd0584d344
tree2dfa03e08c447ce81cbbff8f87758ec5f30383a5
parentc33a95cd94a26382affea70b072fefcedd28eb31
[Web GPU] Vertex Buffers/Input State API updates
https://bugs.webkit.org/show_bug.cgi?id=194258
<rdar://problem/47806127>

Reviewed by Myles C. Maxfield.

Source/WebCore:

The vertex buffer attributes model for GPURenderPipelines in the WebGPU API has been updated.
Update our implementation to match.

No new tests. Existing tests updated to match new behavior.

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Modules/webgpu/GPUVertexAttributeDescriptor.idl:
* Modules/webgpu/GPUVertexBufferDescriptor.idl: Renamed from Source/WebCore/Modules/webgpu/GPUInputStateDescriptor.idl.
* Modules/webgpu/GPUVertexInputDescriptor.idl:
* Modules/webgpu/WebGPURenderPipelineDescriptor.idl:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/gpu/GPURenderPipelineDescriptor.h:
* platform/graphics/gpu/GPUVertexAttributeDescriptor.h:
* platform/graphics/gpu/GPUVertexBufferDescriptor.h: Renamed from Source/WebCore/platform/graphics/gpu/GPUInputStateDescriptor.h.
* platform/graphics/gpu/GPUVertexInputDescriptor.h:
* platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
(WebCore::trySetVertexInput): Added. Populate Metal and WHLSL pipeline descriptors with vertex attribute metadata.
(WebCore::trySetColorStates): Added. Populate Metal and WHLSL pipeline descriptors with color attachment metadata.
(WebCore::convertLayout): Moved.
(WebCore::trySetMetalFunctions): Moved.
(WebCore::trySetFunctions): Added. WHLSL compilation to Metal SL happens here, then MSL functions are set on pipeline descriptor.
(WebCore::convertRenderPipelineDescriptor): Repurposed. Convert a GPURenderPipelineDescriptor to Metal and WHLSL versions.
(WebCore::tryCreateMtlRenderPipelineState):
(WebCore::GPURenderPipeline::tryCreate):
(WebCore::trySetMetalFunctionsForPipelineDescriptor): Deleted.
(WebCore::trySetWHLSLFunctionsForPipelineDescriptor): Deleted.
(WebCore::trySetFunctionsForPipelineDescriptor): Deleted.
(WebCore::trySetInputStateForPipelineDescriptor): Deleted.
(WebCore::setColorStatesForColorAttachmentArray): Deleted.

LayoutTests:

Update WebGPU tests for the new vertex buffer attributes model.

* webgpu/blend-triangle-strip.html:
* webgpu/buffer-command-buffer-races.html:
* webgpu/buffer-resource-triangles.html:
* webgpu/depth-enabled-triangle-strip.html:
* webgpu/draw-indexed-triangles.html:
* webgpu/js/webgpu-functions.js:
* webgpu/texture-triangle-strip.html:
* webgpu/vertex-buffer-triangle-strip.html:
* webgpu/whlsl-arbitrary-vertex-attribute-locations.html:
* webgpu/whlsl-dereference-pointer-should-type-check.html:
* webgpu/whlsl-dont-crash-parsing-enum.html:
* webgpu/whlsl-dot-expressions.html:
* webgpu/whlsl-nested-dot-expression-rvalue.html:
* webgpu/whlsl.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245905 268f45cc-cd09-0410-ab3c-d52691b4dbfc
31 files changed:
LayoutTests/ChangeLog
LayoutTests/webgpu/blend-triangle-strip.html
LayoutTests/webgpu/buffer-command-buffer-races.html
LayoutTests/webgpu/buffer-resource-triangles.html
LayoutTests/webgpu/depth-enabled-triangle-strip.html
LayoutTests/webgpu/draw-indexed-triangles.html
LayoutTests/webgpu/js/webgpu-functions.js
LayoutTests/webgpu/texture-triangle-strip.html
LayoutTests/webgpu/vertex-buffer-triangle-strip.html
LayoutTests/webgpu/whlsl-arbitrary-vertex-attribute-locations.html
LayoutTests/webgpu/whlsl-dereference-pointer-should-type-check.html
LayoutTests/webgpu/whlsl-dont-crash-parsing-enum.html
LayoutTests/webgpu/whlsl-dot-expressions.html
LayoutTests/webgpu/whlsl-nested-dot-expression-rvalue.html
LayoutTests/webgpu/whlsl.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/GPUVertexAttributeDescriptor.idl
Source/WebCore/Modules/webgpu/GPUVertexBufferDescriptor.idl [moved from Source/WebCore/Modules/webgpu/GPUInputStateDescriptor.idl with 81% similarity]
Source/WebCore/Modules/webgpu/GPUVertexInputDescriptor.idl
Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.idl
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/graphics/gpu/GPURenderPipelineDescriptor.h
Source/WebCore/platform/graphics/gpu/GPUVertexAttributeDescriptor.h
Source/WebCore/platform/graphics/gpu/GPUVertexBufferDescriptor.h [moved from Source/WebCore/platform/graphics/gpu/GPUInputStateDescriptor.h with 82% similarity]
Source/WebCore/platform/graphics/gpu/GPUVertexInputDescriptor.h
Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm