<?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>137897</bug_id>
          
          <creation_ts>2014-10-20 15:51:31 -0700</creation_ts>
          <short_desc>Use glFinish instead of glFlush when drawing final GL output to screen</short_desc>
          <delta_ts>2014-10-20 18:07:56 -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>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Roger Fong">roger_fong</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>bfulgham</cc>
    
    <cc>commit-queue</cc>
    
    <cc>dino</cc>
    
    <cc>jonlee</cc>
    
    <cc>kondapallykalyan</cc>
    
    <cc>noam</cc>
    
    <cc>roger_fong</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1042991</commentid>
    <comment_count>0</comment_count>
    <who name="Roger Fong">roger_fong</who>
    <bug_when>2014-10-20 15:51:31 -0700</bug_when>
    <thetext>When we want to draw the final WebGL output to the screen we call drawInCGLContext which in turn calls GraphicsContext3D::prepareTexture.
We used to call glFinish here, which pushes all buffered gl operations and blocks until every operation has been completed and every last pixel has been drawn.

glFlush also pushes all buffered gl operations but returns immediately.

Using glFinish is a huge performance hit and based on my testing does not seem to offer any particular benefit over glFlush.
Thus we will switch to using glFlush.

This gives us a 20% performance boost on Unity 3d tests and a 33% boost on the frame rate on http://threejs.org/examples/#webgl_performance.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1042992</commentid>
    <comment_count>1</comment_count>
      <attachid>240154</attachid>
    <who name="Roger Fong">roger_fong</who>
    <bug_when>2014-10-20 15:54:52 -0700</bug_when>
    <thetext>Created attachment 240154
patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1042993</commentid>
    <comment_count>2</comment_count>
    <who name="Roger Fong">roger_fong</who>
    <bug_when>2014-10-20 15:57:02 -0700</bug_when>
    <thetext>We should commit this, live on it, and keep an eye out for any unforeseen consequences.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1042994</commentid>
    <comment_count>3</comment_count>
    <who name="Roger Fong">roger_fong</who>
    <bug_when>2014-10-20 15:58:09 -0700</bug_when>
    <thetext>rdar://problem/15846550</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1043002</commentid>
    <comment_count>4</comment_count>
      <attachid>240154</attachid>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2014-10-20 16:16:31 -0700</bug_when>
    <thetext>Comment on attachment 240154
patch

Looks good! r=me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1043044</commentid>
    <comment_count>5</comment_count>
    <who name="Roger Fong">roger_fong</who>
    <bug_when>2014-10-20 18:07:56 -0700</bug_when>
    <thetext>http://trac.webkit.org/changeset/174915</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>240154</attachid>
            <date>2014-10-20 15:54:52 -0700</date>
            <delta_ts>2014-10-20 16:16:31 -0700</delta_ts>
            <desc>patch</desc>
            <filename>patch.patch</filename>
            <type>text/plain</type>
            <size>1521</size>
            <attacher name="Roger Fong">roger_fong</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL0NoYW5nZ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V2ViQ29yZS9wbGF0
Zm9ybS9ncmFwaGljcy9vcGVuZ2wvR3JhcGhpY3NDb250ZXh0M0RPcGVuR0xDb21tb24uY3BwCj09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT0KLS0tIFNvdXJjZS9XZWJDb3JlL3BsYXRmb3JtL2dyYXBoaWNzL29wZW5nbC9HcmFw
aGljc0NvbnRleHQzRE9wZW5HTENvbW1vbi5jcHAJKHJldmlzaW9uIDE3NDc5NSkKKysrIFNvdXJj
ZS9XZWJDb3JlL3BsYXRmb3JtL2dyYXBoaWNzL29wZW5nbC9HcmFwaGljc0NvbnRleHQzRE9wZW5H
TENvbW1vbi5jcHAJKHdvcmtpbmcgY29weSkKQEAgLTIyMyw3ICsyMjMsNyBAQCB2b2lkIEdyYXBo
aWNzQ29udGV4dDNEOjpwcmVwYXJlVGV4dHVyZSgpCiAgICAgOjpnbEFjdGl2ZVRleHR1cmUobV9z
dGF0ZS5hY3RpdmVUZXh0dXJlKTsKICAgICBpZiAobV9zdGF0ZS5ib3VuZEZCTyAhPSBtX2ZibykK
ICAgICAgICAgOjpnbEJpbmRGcmFtZWJ1ZmZlckVYVChHcmFwaGljc0NvbnRleHQzRDo6RlJBTUVC
VUZGRVIsIG1fc3RhdGUuYm91bmRGQk8pOwotICAgIDo6Z2xGaW5pc2goKTsKKyAgICA6OmdsRmx1
c2goKTsKIH0KIAogdm9pZCBHcmFwaGljc0NvbnRleHQzRDo6cmVhZFJlbmRlcmluZ1Jlc3VsdHMo
dW5zaWduZWQgY2hhciAqcGl4ZWxzLCBpbnQgcGl4ZWxzU2l6ZSkK
</data>
<flag name="review"
          id="264921"
          type_id="1"
          status="+"
          setter="bfulgham"
    />
          </attachment>
      

    </bug>

</bugzilla>