WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
194406
[Web GPU] Update GPUSwapChainDescriptor, GPUSwapChain and implement GPUCanvasContext
https://bugs.webkit.org/show_bug.cgi?id=194406
Summary
[Web GPU] Update GPUSwapChainDescriptor, GPUSwapChain and implement GPUCanvas...
Justin Fan
Reported
2019-02-07 12:06:06 PST
GPUSwapChainDescriptor has been simplified in the sketch IDL (
https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl#L630
). For example, height and width of the swap chain are now gleaned from the canvas. In addition, GPUTextureUsageFlags has been implemented and should be taken into account when creating the swap chain.
Attachments
Patch
(118.11 KB, patch)
2019-03-09 03:59 PST
,
Justin Fan
no flags
Details
Formatted Diff
Diff
Archive of layout-test-results from ews107 for mac-highsierra-wk2
(2.60 MB, application/zip)
2019-03-09 06:14 PST
,
EWS Watchlist
no flags
Details
Patch
(120.59 KB, patch)
2019-03-10 22:58 PDT
,
Justin Fan
no flags
Details
Formatted Diff
Diff
Patch for landing
(120.59 KB, patch)
2019-03-11 17:07 PDT
,
Justin Fan
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2019-02-07 12:06:29 PST
<
rdar://problem/47892466
>
Justin Fan
Comment 2
2019-02-07 15:34:08 PST
This also involves providing the GPUDevice to Web GPU during context/swapChain creation (canvas.getContext()) rather than by configuring it on the swap chain object.
Justin Fan
Comment 3
2019-03-09 03:59:52 PST
Created
attachment 364125
[details]
Patch
Justin Fan
Comment 4
2019-03-09 04:04:02 PST
Comment on
attachment 364125
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=364125&action=review
> Source/WebCore/Modules/webgpu/DOMWindowWebGPU.idl:31 > + [Replaceable, SameObject] readonly attribute WebGPU gpu;
This isn't permanent, as the API now exposes "gpu" as just a namespace on window rather than as an object. I made this change while trying to fix Inspector.
Justin Fan
Comment 5
2019-03-09 04:04:40 PST
Patch is still WIP as ChangeLogs have to be elaborated on, but tossing it at EWS to see what sticks.
EWS Watchlist
Comment 6
2019-03-09 04:05:20 PST
Attachment 364125
[details]
did not pass style-queue: ERROR: Source/WebCore/ChangeLog:8: You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible. [changelog/nonewtests] [5] Total errors found: 1 in 66 files If any of these errors are false positives, please file a bug against check-webkit-style.
EWS Watchlist
Comment 7
2019-03-09 06:14:28 PST
Comment on
attachment 364125
[details]
Patch
Attachment 364125
[details]
did not pass mac-wk2-ews (mac-wk2): Output:
https://webkit-queues.webkit.org/results/11438496
New failing tests: accessibility/mac/selection-notification-focus-change.html
EWS Watchlist
Comment 8
2019-03-09 06:14:29 PST
Created
attachment 364129
[details]
Archive of layout-test-results from ews107 for mac-highsierra-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-highsierra-wk2 Platform: Mac OS X 10.13.6
Justin Fan
Comment 9
2019-03-10 22:58:52 PDT
Created
attachment 364235
[details]
Patch
Myles C. Maxfield
Comment 10
2019-03-11 16:07:25 PDT
Comment on
attachment 364235
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=364235&action=review
> Source/WebCore/Modules/webgpu/WebGPUDevice.idl:36 > + GPUTextureUsageFlags usage = 16; // FIXME: How to set this to GPUTextureUsage.OUTPUT_ATTACHMENT in IDL?
Might want to add a comment in GPUTextureUsage so we know if we modify those flags we have to modify this value too. Also would be good to file a new bug about this.
Myles C. Maxfield
Comment 11
2019-03-11 16:30:56 PDT
Comment on
attachment 364235
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=364235&action=review
> Source/WebCore/Modules/webgpu/GPUCanvasContext.cpp:71 > + if (m_swapChain && m_swapChain->swapChain()) > + m_swapChain->swapChain()->present();
I don't quite understand this. Maybe Dean can help here.
> Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:170 > + useAttachments(buffer, WTFMove(descriptor));
Cool.
> Source/WebCore/platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm:66 > +static RetainPtr<WebGPULayer> tryCreateSwapLayer(MTLDevice *device, MTLPixelFormat format, OptionSet<GPUTextureUsage::Flags> usage)
"Create Swap"? "Swap Layer"? This could be named better.
> Source/WebCore/platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm:109 > + setLayerShape(swapLayer.get(), width, height);
Shouldn't we be hooking this up to get called when the canvas backing store changes size?
Justin Fan
Comment 12
2019-03-11 16:55:22 PDT
(In reply to Myles C. Maxfield from
comment #11
)
> Comment on
attachment 364235
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=364235&action=review
> > > Source/WebCore/Modules/webgpu/GPUCanvasContext.cpp:71 > > + if (m_swapChain && m_swapChain->swapChain()) > > + m_swapChain->swapChain()->present(); > > I don't quite understand this. Maybe Dean can help here.
Yeah, I'm not entirely sure if this implementation is necessary either.
> > Source/WebCore/platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm:109 > > + setLayerShape(swapLayer.get(), width, height); > > Shouldn't we be hooking this up to get called when the canvas backing store > changes size?
This should happen because GPUCanvasContext::reshape() also calls setLayerShape().
Justin Fan
Comment 13
2019-03-11 17:07:50 PDT
Created
attachment 364314
[details]
Patch for landing
WebKit Commit Bot
Comment 14
2019-03-11 17:46:47 PDT
Comment on
attachment 364314
[details]
Patch for landing Clearing flags on attachment: 364314 Committed
r242759
: <
https://trac.webkit.org/changeset/242759
>
WebKit Commit Bot
Comment 15
2019-03-11 17:46:49 PDT
All reviewed patches have been landed. Closing bug.
Devin Rousso
Comment 16
2019-03-11 19:18:56 PDT
Comment on
attachment 364314
[details]
Patch for landing View in context:
https://bugs.webkit.org/attachment.cgi?id=364314&action=review
> Source/JavaScriptCore/inspector/scripts/codegen/generator.py:53 > + 'webgpu': 'WebGPU', # Canvas.ContextType.gpu
NIT: `Canvas.ContextType.webgpu` to match Canvas.json.
> Source/WebCore/inspector/agents/InspectorCanvasAgent.cpp:253 > + return toJS(&state, deprecatedGlobalObjectForPrototype(&state), downcast<GPUCanvasContext>(context));
You'd also want to update `WebCore::canvasRenderingContext` in PageConsoleClient.cpp with the same type of thing.
> Source/WebInspectorUI/UserInterface/Models/Canvas.js:415 > + WebGPU: "gpu",
We keep these values in sync with the ones in Canvas.json, so it should be "webgpu".
Devin Rousso
Comment 17
2019-03-11 19:21:20 PDT
(In reply to Devin Rousso from
comment #16
)
> Comment on
attachment 364314
[details]
> Patch for landing
Dunno why this didn't save with my other comments, but here it is. Thanks for adding some inspector support for this! In the future, please reach out (or just CC) one of us on the bug so we can provide feedback (if needed). I noticed a few things while reading the inspector parts. I've commented on them inline.
Devin Rousso
Comment 18
2019-03-11 19:22:28 PDT
Comment on
attachment 364314
[details]
Patch for landing View in context:
https://bugs.webkit.org/attachment.cgi?id=364314&action=review
>> Source/WebCore/inspector/agents/InspectorCanvasAgent.cpp:253 >> + return toJS(&state, deprecatedGlobalObjectForPrototype(&state), downcast<GPUCanvasContext>(context)); > > You'd also want to update `WebCore::canvasRenderingContext` in PageConsoleClient.cpp with the same type of thing.
Actually, I take this back. We don't support recording Web GPU contexts right now, so you wouldn't want to add it there. My mistake!
Justin Fan
Comment 19
2019-03-11 20:13:00 PDT
(In reply to Devin Rousso from
comment #17
)
> (In reply to Devin Rousso from
comment #16
) > > Comment on
attachment 364314
[details]
> > Patch for landing > Dunno why this didn't save with my other comments, but here it is. > > Thanks for adding some inspector support for this! In the future, please > reach out (or just CC) one of us on the bug so we can provide feedback (if > needed). I noticed a few things while reading the inspector parts. I've > commented on them inline.
Thanks for looking it over! I apologize for not roping you guys in as I really only made the changes to Inspector because my renaming had caused it to keep crashing. In the future we can work together on improved Inspector support and I can clean up the naming (unfortunately it still isn't final).
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug