WebKit Bugzilla
Attachment 358626 Details for
Bug 193247
: [WebGPU] Update createRenderPipeline for WebGPUPipelineLayout
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for landing
bug-193247-20190108125825.patch (text/plain), 15.52 KB, created by
Justin Fan
on 2019-01-08 12:58:26 PST
(
hide
)
Description:
Patch for landing
Filename:
MIME Type:
Creator:
Justin Fan
Created:
2019-01-08 12:58:26 PST
Size:
15.52 KB
patch
obsolete
>Subversion Revision: 239680 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 3b718d102b27c05fb479747b9368f58f924e93e2..e7ae6c00e55938729dcbeca271ea2f16def4f22a 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,27 @@ >+2019-01-08 Justin Fan <justin_fan@apple.com> >+ >+ [WebGPU] Update createRenderPipeline for WebGPUPipelineLayout >+ https://bugs.webkit.org/show_bug.cgi?id=193247 >+ >+ Reviewed by Dean Jackson. >+ >+ Add WebGPUPipelineLayout to WebGPURenderPipeline via WebGPUPipelineDescriptorBase. >+ >+ Test: Updated render-pipelines.html to test new functionality. >+ >+ * Modules/webgpu/WebGPUDevice.cpp: >+ (WebCore::WebGPUDevice::createRenderPipeline const): Convert WebGPUPipelineLayout to GPUPipelineLayout. >+ * Modules/webgpu/WebGPUPipelineDescriptorBase.h: >+ * Modules/webgpu/WebGPUPipelineDescriptorBase.idl: Add layout field. >+ * Modules/webgpu/WebGPUPipelineLayout.h: >+ (WebCore::WebGPUPipelineLayout::pipelineLayout): Added. Getter. >+ * platform/graphics/gpu/GPUPipelineDescriptorBase.h: Updated from out-of-date version. >+ * platform/graphics/gpu/GPUPipelineLayout.cpp: >+ (WebCore::GPUPipelineLayout::GPUPipelineLayout): Now retains bindGroupLayouts from descriptor. >+ * platform/graphics/gpu/GPUPipelineLayout.h: >+ * platform/graphics/gpu/GPURenderPipelineDescriptor.h: Now inherits from GPUPipelineDescriptorBase. >+ (WebCore::GPURenderPipelineDescriptor::GPURenderPipelineDescriptor): Custom constructor for non-aggregate struct. >+ > 2019-01-07 Zalan Bujtas <zalan@apple.com> > > [LFC][BFC] Margin collapsing should not be limited to in-flow non-replaced boxes. >diff --git a/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp b/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp >index f656acf4a67436c515961031e3d952bf210b0629..2ffa3b7a6d8a9adfb37c1f44cc6699e06c7e53c5 100644 >--- a/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp >+++ b/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp >@@ -103,6 +103,8 @@ static Optional<GPUPipelineStageDescriptor> validateAndConvertPipelineStage(cons > > RefPtr<WebGPURenderPipeline> WebGPUDevice::createRenderPipeline(WebGPURenderPipelineDescriptor&& descriptor) const > { >+ auto pipelineLayout = descriptor.layout ? descriptor.layout->pipelineLayout() : nullptr; >+ > auto vertexStage = validateAndConvertPipelineStage(descriptor.vertexStage); > auto fragmentStage = validateAndConvertPipelineStage(descriptor.fragmentStage); > >@@ -111,7 +113,7 @@ RefPtr<WebGPURenderPipeline> WebGPUDevice::createRenderPipeline(WebGPURenderPipe > return nullptr; > } > >- if (auto pipeline = m_device->createRenderPipeline(GPURenderPipelineDescriptor { WTFMove(*vertexStage), WTFMove(*fragmentStage), descriptor.primitiveTopology, descriptor.inputState })) >+ if (auto pipeline = m_device->createRenderPipeline(GPURenderPipelineDescriptor { WTFMove(pipelineLayout), WTFMove(*vertexStage), WTFMove(*fragmentStage), descriptor.primitiveTopology, WTFMove(descriptor.inputState) })) > return WebGPURenderPipeline::create(pipeline.releaseNonNull()); > return nullptr; > } >diff --git a/Source/WebCore/Modules/webgpu/WebGPUPipelineDescriptorBase.h b/Source/WebCore/Modules/webgpu/WebGPUPipelineDescriptorBase.h >index 52c2f9ac0fb91c407479dfefe3e8e09c20311a09..68a0b845e42890c5923cdfdd48e08da157d728e0 100644 >--- a/Source/WebCore/Modules/webgpu/WebGPUPipelineDescriptorBase.h >+++ b/Source/WebCore/Modules/webgpu/WebGPUPipelineDescriptorBase.h >@@ -27,10 +27,12 @@ > > #if ENABLE(WEBGPU) > >+#include "WebGPUPipelineLayout.h" >+ > namespace WebCore { > > struct WebGPUPipelineDescriptorBase { >- // WebGPUPipelineLayout layout; >+ RefPtr<WebGPUPipelineLayout> layout; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/Modules/webgpu/WebGPUPipelineDescriptorBase.idl b/Source/WebCore/Modules/webgpu/WebGPUPipelineDescriptorBase.idl >index eb135b55746e46164ec6d7870d119c9a3275f111..fddb093d7d7285d3e08130e6bd1f010d4694c672 100644 >--- a/Source/WebCore/Modules/webgpu/WebGPUPipelineDescriptorBase.idl >+++ b/Source/WebCore/Modules/webgpu/WebGPUPipelineDescriptorBase.idl >@@ -28,5 +28,5 @@ > Conditional=WEBGPU, > EnabledAtRuntime=WebGPU > ] dictionary WebGPUPipelineDescriptorBase { >- // WebGPUPipelineLayout layout; >+ WebGPUPipelineLayout layout; > }; >diff --git a/Source/WebCore/Modules/webgpu/WebGPUPipelineLayout.h b/Source/WebCore/Modules/webgpu/WebGPUPipelineLayout.h >index 555157424b0be29960b4b0acb03ec163ffbc9881..65d2f9b24ba506a9dd0b3e85e17c7cf33a73d4af 100644 >--- a/Source/WebCore/Modules/webgpu/WebGPUPipelineLayout.h >+++ b/Source/WebCore/Modules/webgpu/WebGPUPipelineLayout.h >@@ -38,6 +38,8 @@ class WebGPUPipelineLayout : public RefCounted<WebGPUPipelineLayout> { > public: > static Ref<WebGPUPipelineLayout> create(Ref<GPUPipelineLayout>&&); > >+ RefPtr<GPUPipelineLayout> pipelineLayout() { return m_pipelineLayout.copyRef(); } >+ > private: > explicit WebGPUPipelineLayout(Ref<GPUPipelineLayout>&&); > >diff --git a/Source/WebCore/platform/graphics/gpu/GPUPipelineDescriptorBase.h b/Source/WebCore/platform/graphics/gpu/GPUPipelineDescriptorBase.h >index be2755b9e266a2e8b38fa5d4b08fd7e14e281269..bdc3e7d60feb8d4c43e1c5b2e17c5be21e7d86c2 100644 >--- a/Source/WebCore/platform/graphics/gpu/GPUPipelineDescriptorBase.h >+++ b/Source/WebCore/platform/graphics/gpu/GPUPipelineDescriptorBase.h >@@ -27,6 +27,7 @@ > > #if ENABLE(WEBGPU) > >+#include "GPUPipelineLayout.h" > #include "GPUPipelineStageDescriptor.h" > > #include <wtf/Vector.h> >@@ -34,7 +35,7 @@ > namespace WebCore { > > struct GPUPipelineDescriptorBase { >- Vector<GPUPipelineStageDescriptor> stages; >+ RefPtr<GPUPipelineLayout> layout; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/platform/graphics/gpu/GPUPipelineLayout.cpp b/Source/WebCore/platform/graphics/gpu/GPUPipelineLayout.cpp >index aab02954e7b27f0b9ff897950e280a25271b3d76..22930b4c8f3f2c74e929cb51c0dab38866cebc29 100644 >--- a/Source/WebCore/platform/graphics/gpu/GPUPipelineLayout.cpp >+++ b/Source/WebCore/platform/graphics/gpu/GPUPipelineLayout.cpp >@@ -35,9 +35,9 @@ Ref<GPUPipelineLayout> GPUPipelineLayout::create(GPUPipelineLayoutDescriptor&& d > return adoptRef(*new GPUPipelineLayout(WTFMove(descriptor))); > } > >-GPUPipelineLayout::GPUPipelineLayout(GPUPipelineLayoutDescriptor&&) >+GPUPipelineLayout::GPUPipelineLayout(GPUPipelineLayoutDescriptor&& descriptor) >+ : m_bindGroupLayouts(descriptor.bindGroupLayouts) > { >- // FIXME: Stub implementation. > } > > } // namespace WebCore >diff --git a/Source/WebCore/platform/graphics/gpu/GPUPipelineLayout.h b/Source/WebCore/platform/graphics/gpu/GPUPipelineLayout.h >index 870a5da0f3dde5e5641b52c6fab066262a3b3bfb..262618f93151bd2daa4fe3c0cab048d43fc2b461 100644 >--- a/Source/WebCore/platform/graphics/gpu/GPUPipelineLayout.h >+++ b/Source/WebCore/platform/graphics/gpu/GPUPipelineLayout.h >@@ -40,6 +40,8 @@ public: > > private: > explicit GPUPipelineLayout(GPUPipelineLayoutDescriptor&&); >+ >+ Vector<RefPtr<const GPUBindGroupLayout>> m_bindGroupLayouts; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/platform/graphics/gpu/GPURenderPipelineDescriptor.h b/Source/WebCore/platform/graphics/gpu/GPURenderPipelineDescriptor.h >index 5b43b1ee1bfca8770b4b038897d7215c32b6ac0e..3216833d907cf248d397b4dc8238d451153ad4e5 100644 >--- a/Source/WebCore/platform/graphics/gpu/GPURenderPipelineDescriptor.h >+++ b/Source/WebCore/platform/graphics/gpu/GPURenderPipelineDescriptor.h >@@ -35,7 +35,7 @@ > > namespace WebCore { > >-struct GPURenderPipelineDescriptor { >+struct GPURenderPipelineDescriptor : GPUPipelineDescriptorBase { > enum class PrimitiveTopology { > PointList, > LineList, >@@ -44,6 +44,15 @@ struct GPURenderPipelineDescriptor { > TriangleStrip > }; > >+ GPURenderPipelineDescriptor(RefPtr<GPUPipelineLayout>&& layout, GPUPipelineStageDescriptor&& vertex, GPUPipelineStageDescriptor&& fragment, PrimitiveTopology topology, GPUInputStateDescriptor&& input) >+ : GPUPipelineDescriptorBase { WTFMove(layout) } >+ , vertexStage(WTFMove(vertex)) >+ , fragmentStage(WTFMove(fragment)) >+ , primitiveTopology(topology) >+ , inputState(WTFMove(input)) >+ { >+ } >+ > GPUPipelineStageDescriptor vertexStage; > GPUPipelineStageDescriptor fragmentStage; > PrimitiveTopology primitiveTopology; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 1486382618788f2984e185d879169f8de3964695..9199eb452368d04d15980898f6f361218b38ba41 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,17 @@ >+2019-01-08 Justin Fan <justin_fan@apple.com> >+ >+ [WebGPU] Update createRenderPipeline for WebGPUPipelineLayout >+ https://bugs.webkit.org/show_bug.cgi?id=193247 >+ >+ Reviewed by Dean Jackson. >+ >+ Update render-pipelines.html to WPT form and to accomodate WebGPUPipelineLayouts. >+ >+ * webgpu/js/webgpu-functions.js: >+ (createBasicPipeline): Added option to include a WebGPUPipelineLayout. >+ * webgpu/render-pipelines-expected.txt: >+ * webgpu/render-pipelines.html: >+ > 2019-01-07 Claudio Saavedra <csaavedra@igalia.com> > > [WPE][GTK] Skip css-painting-api tests >diff --git a/LayoutTests/webgpu/js/webgpu-functions.js b/LayoutTests/webgpu/js/webgpu-functions.js >index e9ae83862ba1e85168ae70a0763a838a498ec6dd..e0f97794e5c9c4a7c2549b60abe5b35553164b00 100644 >--- a/LayoutTests/webgpu/js/webgpu-functions.js >+++ b/LayoutTests/webgpu/js/webgpu-functions.js >@@ -12,18 +12,19 @@ function createBasicContext(canvas, device) { > return context; > } > >-function createBasicPipeline(shaderModule, device, inputStateDescriptor) { >- vertexStageDescriptor = { >+function createBasicPipeline(shaderModule, device, pipelineLayout, inputStateDescriptor) { >+ const vertexStageDescriptor = { > module: shaderModule, > entryPoint: "vertex_main" > }; > >- fragmentStageDescriptor = { >+ const fragmentStageDescriptor = { > module: shaderModule, > entryPoint: "fragment_main" > }; > >- pipelineDescriptor = { >+ const pipelineDescriptor = { >+ layout: pipelineLayout, > vertexStage: vertexStageDescriptor, > fragmentStage: fragmentStageDescriptor, > primitiveTopology: "triangleStrip", >diff --git a/LayoutTests/webgpu/render-pipelines-expected.txt b/LayoutTests/webgpu/render-pipelines-expected.txt >index f250926214960f9a753d4d7b1b56044d9bad7472..85d59bb63eaaaa2b275832191778c1c11be7c467 100644 >--- a/LayoutTests/webgpu/render-pipelines-expected.txt >+++ b/LayoutTests/webgpu/render-pipelines-expected.txt >@@ -1,10 +1,4 @@ >-PASS [object WebGPU] is defined. >-PASS WebGPURenderPipeline with invalid WebGPURenderPipelineDescriptor was not created. >-PASS WebGPURenderPipeline with invalid shader module was not created. >-PASS WebGPURenderPipeline with invalid vertex shader stage was not created. >-PASS WebGPURenderPipeline with invalid vertex shader entry point was not created. >-All tests complete. >-PASS successfullyParsed is true > >-TEST COMPLETE >+PASS Create basic WebGPURenderPipeline >+PASS Bad pipelines were not created > >diff --git a/LayoutTests/webgpu/render-pipelines.html b/LayoutTests/webgpu/render-pipelines.html >index 6cb4befaa1d749a37795fc405fefbcae99a975c4..fca420729f0ab4335ed47e20774ffbeadde45124 100644 >--- a/LayoutTests/webgpu/render-pipelines.html >+++ b/LayoutTests/webgpu/render-pipelines.html >@@ -1,55 +1,98 @@ > <!DOCTYPE html> > <html> >-<script src="../resources/js-test-pre.js"></script> >-<script src="js/basic-webgpu-functions.js"></script> >+<script src="js/webgpu-functions.js"></script> >+<script src="../resources/testharness.js"></script> >+<script src="../resources/testharnessreport.js"></script> > <script> >-if (window.testRunner) >- window.testRunner.dumpAsText(); >+const shaderCode = ` >+#include <metal_stdlib> >+ >+using namespace metal; > >-function checkBadRenderPipeline(descriptor, testSubjectName) { >- let pipeline = defaultDevice.createRenderPipeline(descriptor); >+struct Vertex >+{ >+ float4 position [[position]]; >+}; > >- if (pipeline) >- testFailed(`WebGPURenderPipeline was created with an invalid ${testSubjectName}!`); >- else >- testPassed(`WebGPURenderPipeline with invalid ${testSubjectName} was not created.`); >+vertex Vertex vertex_main(uint vid [[vertex_id]]) >+{ >+ Vertex v; >+ switch (vid) { >+ case 0: >+ v.position = float4(-1, 1, 0, 1); >+ break; >+ case 1: >+ v.position = float4(-1, -1, 0, 1); >+ break; >+ case 2: >+ v.position = float4(1, 1, 0, 1); >+ break; >+ default: >+ v.position = float4(1, -1, 0, 1); >+ } >+ return v; >+} >+ >+fragment float4 fragment_main(Vertex vertexIn [[stage_in]]) >+{ >+ return float4(0.0, 1.0, 0.0, 1.0); >+} >+` >+ >+promise_test(async () => { >+ const device = await getBasicDevice(); >+ const shaderModule = device.createShaderModule({ code: shaderCode }); >+ >+ const layoutBinding = { binding: 0, visibility: WebGPUShaderStageBit.VERTEX, type: "storageBuffer" }; >+ const bindGroupLayout = device.createBindGroupLayout({ bindings: [layoutBinding] }); >+ const pipelineLayout = device.createPipelineLayout({ bindGroupLayouts: [bindGroupLayout] }); >+ >+ const pipeline = createBasicPipeline(shaderModule, device, pipelineLayout); >+ assert_true(pipeline instanceof WebGPURenderPipeline, "Successfully created WebGPURenderPipeline"); >+}, "Create basic WebGPURenderPipeline"); >+ >+function checkBadRenderPipeline(device, descriptor, testSubjectName) { >+ assert_true(!device.createRenderPipeline(descriptor), `WebGPURenderPipeline with invalid ${testSubjectName} was not created.`); > } > >-function setUpBadPipelines() { >- checkBadRenderPipeline({}, "WebGPURenderPipelineDescriptor"); >+promise_test(async() => { >+ const device = await getBasicDevice(); >+ const shaderModule = device.createShaderModule({ code: shaderCode }); >+ checkBadRenderPipeline(device, {}, "WebGPURenderPipelineDescriptor"); > >- let noModuleVertexDescriptor = { >+ const noModuleVertexDescriptor = { > entryPoint: "vertex_main" > } >- let noModulePipelineDescriptor = { >+ >+ const fragmentStageDescriptor = { >+ module: shaderModule, >+ entryPoint: "fragment_main" >+ }; >+ >+ const noModulePipelineDescriptor = { > vertexStage: noModuleVertexDescriptor, > fragmentStage: fragmentStageDescriptor, > primitiveTopology: "triangleList" > } >- checkBadRenderPipeline(noModulePipelineDescriptor, "shader module"); >+ checkBadRenderPipeline(device, noModulePipelineDescriptor, "shader module"); > > // A (Metal) renderpipeline must have a vertex function. >- let noVertexPipelineDescriptor = { >+ const noVertexPipelineDescriptor = { > fragmentStage: fragmentStageDescriptor, > primitiveTopology: "triangleList" > } >- checkBadRenderPipeline(noVertexPipelineDescriptor, "vertex shader stage") >+ checkBadRenderPipeline(device, noVertexPipelineDescriptor, "vertex shader stage") > >- let badEntryPointDescriptor = { >+ const badEntryPointDescriptor = { > module: shaderModule, > entryPoint: "Vertex_Main" > }; >- let badEntryPointPipelineDescsriptor = { >+ const badEntryPointPipelineDescsriptor = { > vertexStage: badEntryPointDescriptor, > fragmentStage: fragmentStageDescriptor, > primitiveTopology: "triangleList" > } >- checkBadRenderPipeline(badEntryPointPipelineDescsriptor, "vertex shader entry point"); >-} >- >-runWebGPUTests([setUpPipeline, setUpBadPipelines]); >- >-successfullyParsed = true; >+ checkBadRenderPipeline(device, badEntryPointPipelineDescsriptor, "vertex shader entry point"); >+}, "Bad pipelines were not created"); > </script> >-<script src="../resources/js-test-post.js"></script> > </html> >\ No newline at end of file
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193247
:
358617
|
358618
| 358626