Bug 231314

Summary: Cache PannerNode's azimuth, elevation and coneGain
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: Web AudioAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, darin, eric.carlson, ews-watchlist, ggaren, glenn, jer.noble, philipj, sergio, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=230950
Attachments:
Description Flags
Patch
none
Patch none

Description Chris Dumez 2021-10-06 11:15:26 PDT
Cache PannerNode's azimuth, elevation and coneGain for better performance. I have noticed while profiling https://downloads.scirra.com/labs/bugs/safaripannerquality/ that PannerNode::process() spends most of its CPU time under PannerNode::calculateAzimuthElevation(). We shouldn't have to re-calculate those properties for every rendering quantum.
Comment 1 Chris Dumez 2021-10-06 11:21:55 PDT
Created attachment 440393 [details]
Patch
Comment 2 Geoffrey Garen 2021-10-06 16:31:37 PDT
Comment on attachment 440393 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=440393&action=review

> Source/WebCore/Modules/webaudio/AudioListener.cpp:126
> +void AudioListener::updateDirtyState()

I must be missing something, but it seems like this function says "if nothing has changed, then we are dirty", which is opposite how I usually understand the phrase "dirty" in rendering. What am I missing?
Comment 3 Chris Dumez 2021-10-06 16:33:17 PDT
Comment on attachment 440393 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=440393&action=review

>> Source/WebCore/Modules/webaudio/AudioListener.cpp:126
>> +void AudioListener::updateDirtyState()
> 
> I must be missing something, but it seems like this function says "if nothing has changed, then we are dirty", which is opposite how I usually understand the phrase "dirty" in rendering. What am I missing?

Uh? I think I messed things up with a last minute patch clean up before uploading. I agree this looks backwards now.
Comment 4 Chris Dumez 2021-10-06 17:53:14 PDT
Created attachment 440461 [details]
Patch
Comment 5 Chris Dumez 2021-10-06 18:17:42 PDT
The cache is being leveraged by imported/w3c/web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-rolloff-clamping.html
Comment 6 Eric Carlson 2021-10-07 13:30:50 PDT
Comment on attachment 440461 [details]
Patch

r=me
Comment 7 EWS 2021-10-07 13:36:39 PDT
Committed r283740 (242662@main): <https://commits.webkit.org/242662@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 440461 [details].
Comment 8 Radar WebKit Bug Importer 2021-10-07 13:39:46 PDT
<rdar://problem/83996910>