<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>257644</bug_id>
          
          <creation_ts>2023-06-02 04:36:06 -0700</creation_ts>
          <short_desc>GPUP WebGL flush() and finish() are asynchronous</short_desc>
          <delta_ts>2023-06-28 22:46:01 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebGL</component>
          <version>WebKit Local Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=252876</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Kimmo Kinnunen">kkinnunen</reporter>
          <assigned_to name="Kimmo Kinnunen">kkinnunen</assigned_to>
          <cc>dino</cc>
    
    <cc>kbr</cc>
    
    <cc>kkinnunen</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1959521</commentid>
    <comment_count>0</comment_count>
    <who name="Kimmo Kinnunen">kkinnunen</who>
    <bug_when>2023-06-02 04:36:06 -0700</bug_when>
    <thetext>GPUP WebGL flush() and finish() are asynchronous

Should be synchronous</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1959522</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-06-02 04:38:12 -0700</bug_when>
    <thetext>&lt;rdar://problem/110163403&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1959523</commentid>
    <comment_count>2</comment_count>
    <who name="Kimmo Kinnunen">kkinnunen</who>
    <bug_when>2023-06-02 04:39:45 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/14623</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1959525</commentid>
    <comment_count>3</comment_count>
    <who name="Kimmo Kinnunen">kkinnunen</who>
    <bug_when>2023-06-02 04:42:35 -0700</bug_when>
    <thetext>Blocks bug 252876 for benchmarking before/after read pixels perf</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1959558</commentid>
    <comment_count>4</comment_count>
    <who name="Kenneth Russell">kbr</who>
    <bug_when>2023-06-02 09:48:05 -0700</bug_when>
    <thetext>The side-effects of flush() and finish() can&apos;t be observed by application code in the WebGL context. Even with finish(), there&apos;s a WebGL spec difference compared to OpenGL ES that the status of objects like queries can&apos;t change unless control is returned to the browser. For this reason it should be safe to leave these asynchronous, and I think WebKit might incur a performance penalty compared to other implementations by making them synchronous. If it&apos;s necessary to use these for synchronization with other subsystems in WebKit like the media stack, I&apos;d suggest adding another internal primitive that can&apos;t be called by the web platform - Chromium does this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1959560</commentid>
    <comment_count>5</comment_count>
    <who name="Kimmo Kinnunen">kkinnunen</who>
    <bug_when>2023-06-02 09:51:06 -0700</bug_when>
    <thetext>Think Chrome&apos;s implementation is also synchronous, e.g. the call between renderer and GPU process.
I think previously we discussed wrt &quot;real finish vs gl.finish as gl.flush()&quot;, which cannot be observed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1959562</commentid>
    <comment_count>6</comment_count>
    <who name="Kimmo Kinnunen">kkinnunen</who>
    <bug_when>2023-06-02 09:52:20 -0700</bug_when>
    <thetext>Or, maybe not maybe it is indeed async?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1959565</commentid>
    <comment_count>7</comment_count>
    <who name="Kenneth Russell">kbr</who>
    <bug_when>2023-06-02 09:57:32 -0700</bug_when>
    <thetext>In Chrome at the lowest level, Finish is synchronous:
https://source.chromium.org/chromium/chromium/src/+/refs/heads/main:gpu/command_buffer/client/cmd_buffer_helper.cc;l=220;drc=b8a0323a84f483b25e94b3a24d80fda16c5dd1ae;bpv=1;bpt=1

but Flush isn&apos;t:
https://source.chromium.org/chromium/chromium/src/+/refs/heads/main:gpu/command_buffer/client/cmd_buffer_helper.cc;l=173;drc=b8a0323a84f483b25e94b3a24d80fda16c5dd1ae;bpv=0;bpt=1

However, the WebGL implementation never calls the underlying Finish, only Flush:
https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc;l=3034?q=webgl_rendering_context_base.cc</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1959850</commentid>
    <comment_count>8</comment_count>
    <who name="Kimmo Kinnunen">kkinnunen</who>
    <bug_when>2023-06-05 04:18:19 -0700</bug_when>
    <thetext>&gt; However, the WebGL implementation never calls the underlying Finish, only Flush:

Ah, right! I keep on forgetting.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>