[WHLSL] Allow vertex attributes to have arbitrary names in the shader
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 May 2019 23:38:18 +0000 (23:38 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 May 2019 23:38:18 +0000 (23:38 +0000)
commit4fbb7613cf6338ba7ac0f67947414f47cc672943
tree8018e665464a4707127d75cb422ee73d5aa77402
parent1e72ba6047edab9862d4df87c62fe34ab1ae19ed
[WHLSL] Allow vertex attributes to have arbitrary names in the shader
https://bugs.webkit.org/show_bug.cgi?id=198235

Reviewed by Dean Jackson and Justin Fan.

Source/WebCore:

Metal doesn't allow arbitrary vertex attribute IDs. If you try to create a vertex attribute > 16,
the Metal validation layer will assert. So, we need to have a mapping from whatever the WebGPU
API says the vertex attribute IDs should be to the internally-used vertex attribute IDs.

Test: webgpu/whlsl-arbitrary-vertex-attribute-locations.html

* Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp:
(WebCore::WHLSL::Metal::VertexEntryPointScaffolding::VertexEntryPointScaffolding):
* Modules/webgpu/WHLSL/WHLSLPipelineDescriptor.h:
* Modules/webgpu/WHLSL/WHLSLSemanticMatcher.cpp:
(WebCore::WHLSL::matchVertexAttributes):
* platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
(WebCore::convertRenderPipelineDescriptor):
(WebCore::trySetInputStateForPipelineDescriptor):

LayoutTests:

* webgpu/whlsl-arbitrary-vertex-attribute-locations-expected.html: Added.
* webgpu/whlsl-arbitrary-vertex-attribute-locations.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245759 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/webgpu/whlsl-arbitrary-vertex-attribute-locations-expected.html [new file with mode: 0644]
LayoutTests/webgpu/whlsl-arbitrary-vertex-attribute-locations.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp
Source/WebCore/Modules/webgpu/WHLSL/WHLSLPipelineDescriptor.h
Source/WebCore/Modules/webgpu/WHLSL/WHLSLSemanticMatcher.cpp
Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm