<?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>38560</bug_id>
          
          <creation_ts>2010-05-04 18:33:20 -0700</creation_ts>
          <short_desc>WebGL demos show bad flicker</short_desc>
          <delta_ts>2010-06-18 13:51:37 -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>All</rep_platform>
          <op_sys>OS X 10.6</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://plopbyte.net/?page_id=111/</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P1</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>33416</dependson>
    
    <dependson>36908</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Simon Fraser (smfr)">simon.fraser</reporter>
          <assigned_to name="Zhenyao Mo">zmo</assigned_to>
          <cc>cmarrin</cc>
    
    <cc>dglazkov</cc>
    
    <cc>eric</cc>
    
    <cc>kbr</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>220927</commentid>
    <comment_count>0</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2010-05-04 18:33:20 -0700</bug_when>
    <thetext>With a recent nightly, these two WebGL demos show bad flickering:

http://plopbyte.net/?page_id=111/
http://www.cubicvr.org/CubicVR.js/LandscapeTest1.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>220930</commentid>
    <comment_count>1</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2010-05-04 18:43:39 -0700</bug_when>
    <thetext>My graphics hardware:


ATI Radeon HD 2600 XT:

  Chipset Model:	ATI Radeon HD 2600
  Type:	GPU
  Bus:	PCIe
  Slot:	Slot-1
  PCIe Lane Width:	x16
  VRAM (Total):	256 MB
  Vendor:	ATI (0x1002)
  Device ID:	0x9588
  Revision ID:	0x0000
  ROM Revision:	113-B1480A-252
  EFI Driver Version:	01.00.252
  Displays:
Cinema HD Display:
  Resolution:	1920 x 1200
  Pixel Depth:	32-Bit Color (ARGB8888)
  Main Display:	Yes
  Mirror:	Off
  Online:	Yes
  Rotation:	Supported
DELL 2005FPW:
  Resolution:	1680 x 1050 @ 60 Hz
  Pixel Depth:	32-Bit Color (ARGB8888)
  Mirror:	Off
  Online:	Yes
  Rotation:	Supported</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>220932</commentid>
    <comment_count>2</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2010-05-04 18:45:43 -0700</bug_when>
    <thetext>This is is particularly bad:
http://www.cubicvr.org/CubicVR.js/ObjectCompositeTest.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>232015</commentid>
    <comment_count>3</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2010-05-28 17:03:13 -0700</bug_when>
    <thetext>This regressed in http://trac.webkit.org/changeset/56872
Performance in general on my machine is much worse after this change.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>232027</commentid>
    <comment_count>4</comment_count>
    <who name="Zhenyao Mo">zmo</who>
    <bug_when>2010-05-28 17:16:33 -0700</bug_when>
    <thetext>Can you run the demo with {antialias: false} for context attributes?  And what&apos;s the performance like?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>232028</commentid>
    <comment_count>5</comment_count>
    <who name="Zhenyao Mo">zmo</who>
    <bug_when>2010-05-28 17:19:19 -0700</bug_when>
    <thetext>Forget about the previous comments.  I see your card is ATI, for which the antialias is false.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>232029</commentid>
    <comment_count>6</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2010-05-28 17:23:40 -0700</bug_when>
    <thetext>For example, when http://www.cubicvr.org/CubicVR.js/ObjectCompositeTest.html is loading,  entire parts of the scene, like the walls and columns, flicker in and out, and the animation overall is jerky. That didn&apos;t happen prior to r56872.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>232034</commentid>
    <comment_count>7</comment_count>
    <who name="Zhenyao Mo">zmo</who>
    <bug_when>2010-05-28 17:35:37 -0700</bug_when>
    <thetext>I had a quick look at the patch.  Seems like the difference (for your machine) is the stencil is on.

Can you try the demo with {stencil: false} in context creation and let me know the performance?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>232119</commentid>
    <comment_count>8</comment_count>
    <who name="Chris Marrin">cmarrin</who>
    <bug_when>2010-05-29 09:50:25 -0700</bug_when>
    <thetext>This also happens for me on two different machines, both of which have different ATI chipsets. It looks like your logic for deciding how to deal with the textures is flipping frame-to-frame or something like that.

This needs to be fixed ASAP. If you can&apos;t determine the root cause, please disable whatever is causing the flicker on ATI cards in Safari.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>232142</commentid>
    <comment_count>9</comment_count>
    <who name="Zhenyao Mo">zmo</who>
    <bug_when>2010-05-29 14:04:31 -0700</bug_when>
    <thetext>I don&apos;t have access to a machine with ATI card, so if anyone with ATI card can run the demo with {stensil: false} at content creation and let me know if it solves the performance issue, then I&apos;ll know what to do.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>233514</commentid>
    <comment_count>10</comment_count>
    <who name="Zhenyao Mo">zmo</who>
    <bug_when>2010-06-02 17:17:47 -0700</bug_when>
    <thetext>See https://bugs.webkit.org/show_bug.cgi?id=40090.

Hopefully the landing of a patch there will resolve this issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>233746</commentid>
    <comment_count>11</comment_count>
    <who name="Chris Marrin">cmarrin</who>
    <bug_when>2010-06-03 07:06:33 -0700</bug_when>
    <thetext>Yes, that patch may resolve the issue, but I assume the problem would return if you turn on stencil in your content. So we really need to understand why stencil being on causes the flicker</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>233837</commentid>
    <comment_count>12</comment_count>
    <who name="Zhenyao Mo">zmo</who>
    <bug_when>2010-06-03 11:11:28 -0700</bug_when>
    <thetext>(In reply to comment #11)
&gt; Yes, that patch may resolve the issue, but I assume the problem would return if you turn on stencil in your content. So we really need to understand why stencil being on causes the flicker

I tried on kbr&apos;s Mac which has ATI card and couldn&apos;t reproduce the flicking.

When the patch lands and either you or Simon can confirm it does resolve the issue, then we should file a driver bug to Apple.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>233841</commentid>
    <comment_count>13</comment_count>
    <who name="Zhenyao Mo">zmo</who>
    <bug_when>2010-06-03 11:17:32 -0700</bug_when>
    <thetext>(In reply to comment #11)
&gt; Yes, that patch may resolve the issue, but I assume the problem would return if you turn on stencil in your content. So we really need to understand why stencil being on causes the flicker

One thing we could do is use something other than GL_DEPTH24_STENCIL8_EXT for certain ATI cards when a user requests stencil buffer.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>234418</commentid>
    <comment_count>14</comment_count>
    <who name="Zhenyao Mo">zmo</who>
    <bug_when>2010-06-04 16:18:50 -0700</bug_when>
    <thetext>Patch for https://bugs.webkit.org/show_bug.cgi?id=40090 landed last night.  Please verify if the flicking is gone.  We couldn&apos;t reproduce it on our side.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>237148</commentid>
    <comment_count>15</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2010-06-11 16:50:24 -0700</bug_when>
    <thetext>There is no improvement in the flickering.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>237149</commentid>
    <comment_count>16</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2010-06-11 16:53:11 -0700</bug_when>
    <thetext>http://www.cubicvr.org/CubicVR.js/ObjectCompositeTest.html doesn&apos;t work at all for me in a recent nightly.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>238087</commentid>
    <comment_count>17</comment_count>
    <who name="Zhenyao Mo">zmo</who>
    <bug_when>2010-06-14 15:27:17 -0700</bug_when>
    <thetext>(In reply to comment #15)
&gt; There is no improvement in the flickering.

That&apos;s really weird.  Because with antialias==false and stencil==false, WebGL should be the same with/without http://trac.webkit.org/changeset/56872.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>238089</commentid>
    <comment_count>18</comment_count>
    <who name="Zhenyao Mo">zmo</who>
    <bug_when>2010-06-14 15:28:36 -0700</bug_when>
    <thetext>(In reply to comment #17)
&gt; (In reply to comment #15)
&gt; &gt; There is no improvement in the flickering.
&gt; 
&gt; That&apos;s really weird.  Because with antialias==false and stencil==false, WebGL should be the same with/without http://trac.webkit.org/changeset/56872.

(In reply to comment #16)
&gt; http://www.cubicvr.org/CubicVR.js/ObjectCompositeTest.html doesn&apos;t work at all for me in a recent nightly.

This is also weird.  I just synced with the codebase and built webkit.  The demo worked fine on my side.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>238114</commentid>
    <comment_count>19</comment_count>
    <who name="Kenneth Russell">kbr</who>
    <bug_when>2010-06-14 15:56:56 -0700</bug_when>
    <thetext>FYI, we&apos;re trying to schedule some time in the Apple Compatibility Lab to diagnose this on the hardware in questions.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>240070</commentid>
    <comment_count>20</comment_count>
    <who name="Kenneth Russell">kbr</who>
    <bug_when>2010-06-18 12:04:32 -0700</bug_when>
    <thetext>zmo and I tracked down the regression to the moving of the ensureContext call in GraphicsContext3D::prepareTexture (GraphicsContext3DMac.mm) into the &quot;if (m_attrs.antialias)&quot; block in bug 33416. Bug 36908 fixed part of this regression (the moving of a glFinish call into the same block) but not this part. svn diff follows; a patch will be filed shortly.



Index: WebCore/platform/graphics/mac/GraphicsContext3DMac.mm
===================================================================
--- WebCore/platform/graphics/mac/GraphicsContext3DMac.mm	(revision 61422)
+++ WebCore/platform/graphics/mac/GraphicsContext3DMac.mm	(working copy)
@@ -383,8 +383,8 @@
 
 void GraphicsContext3D::prepareTexture()
 {
+    ensureContext(m_contextObj);
     if (m_attrs.antialias) {
-        ensureContext(m_contextObj);
         ::glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, m_multisampleFBO);
         ::glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, m_fbo);
         ::glBlitFramebufferEXT(0, 0, m_currentWidth, m_currentHeight, 0, 0, m_currentWidth, m_currentHeight, GL_COLOR_BUFFER_BIT, GL_LINEAR);</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>240105</commentid>
    <comment_count>21</comment_count>
      <attachid>59149</attachid>
    <who name="Zhenyao Mo">zmo</who>
    <bug_when>2010-06-18 13:32:39 -0700</bug_when>
    <thetext>Created attachment 59149
patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>240111</commentid>
    <comment_count>22</comment_count>
    <who name="Kenneth Russell">kbr</who>
    <bug_when>2010-06-18 13:44:36 -0700</bug_when>
    <thetext>Looks good.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>240113</commentid>
    <comment_count>23</comment_count>
    <who name="Zhenyao Mo">zmo</who>
    <bug_when>2010-06-18 13:47:11 -0700</bug_when>
    <thetext>Committed manually: http://trac.webkit.org/changeset/61432</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>240115</commentid>
    <comment_count>24</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2010-06-18 13:51:37 -0700</bug_when>
    <thetext>Please copy the ChangeLog into the commit message.  Tools like &quot;webkit-patch land&quot; can help do that for you.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>59149</attachid>
            <date>2010-06-18 13:32:39 -0700</date>
            <delta_ts>2010-06-18 13:36:12 -0700</delta_ts>
            <desc>patch</desc>
            <filename>fix.patch</filename>
            <type>text/plain</type>
            <size>1398</size>
            <attacher name="Zhenyao Mo">zmo</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYkNvcmUvQ2hhbmdlTG9n
CShyZXZpc2lvbiA2MTQzMCkKKysrIFdlYkNvcmUvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBA
IC0xLDMgKzEsMTMgQEAKKzIwMTAtMDYtMTggIFpoZW55YW8gTW8gIDx6bW9AZ29vZ2xlLmNvbT4K
KworICAgICAgICBSZXZpZXdlZCBieSBOT0JPRFkgKE9PUFMhKS4KKworICAgICAgICBXZWJHTCBk
ZW1vcyBzaG93IGJhZCBmbGlja2VyCisgICAgICAgIGh0dHBzOi8vYnVncy53ZWJraXQub3JnL3No
b3dfYnVnLmNnaT9pZD0zODU2MAorCisgICAgICAgICogcGxhdGZvcm0vZ3JhcGhpY3MvbWFjL0dy
YXBoaWNzQ29udGV4dDNETWFjLm1tOgorICAgICAgICAoV2ViQ29yZTo6R3JhcGhpY3NDb250ZXh0
M0Q6OnByZXBhcmVUZXh0dXJlKTogTW92ZSBlbnN1cmVDb250ZXh0KCkgb3V0IG9mIGlmLWJsb2Nr
IHNvIGl0J3MgYWx3YXlzIGV4ZWN1dGVkLgorCiAyMDEwLTA2LTE4ICBBbmRlcnMgQ2FybHNzb24g
IDxhbmRlcnNjYUBhcHBsZS5jb20+CiAKICAgICAgICAgUmV2aWV3ZWQgYnkgU2FtIFdlaW5pZy4K
SW5kZXg6IFdlYkNvcmUvcGxhdGZvcm0vZ3JhcGhpY3MvbWFjL0dyYXBoaWNzQ29udGV4dDNETWFj
Lm1tCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT0KLS0tIFdlYkNvcmUvcGxhdGZvcm0vZ3JhcGhpY3MvbWFjL0dyYXBoaWNz
Q29udGV4dDNETWFjLm1tCShyZXZpc2lvbiA2MTMzOSkKKysrIFdlYkNvcmUvcGxhdGZvcm0vZ3Jh
cGhpY3MvbWFjL0dyYXBoaWNzQ29udGV4dDNETWFjLm1tCSh3b3JraW5nIGNvcHkpCkBAIC0zODMs
OCArMzgzLDggQEAgc3RhdGljIGlubGluZSB2b2lkIGVuc3VyZUNvbnRleHQoQ0dMQ29udAogCiB2
b2lkIEdyYXBoaWNzQ29udGV4dDNEOjpwcmVwYXJlVGV4dHVyZSgpCiB7CisgICAgZW5zdXJlQ29u
dGV4dChtX2NvbnRleHRPYmopOwogICAgIGlmIChtX2F0dHJzLmFudGlhbGlhcykgewotICAgICAg
ICBlbnN1cmVDb250ZXh0KG1fY29udGV4dE9iaik7CiAgICAgICAgIDo6Z2xCaW5kRnJhbWVidWZm
ZXJFWFQoR0xfUkVBRF9GUkFNRUJVRkZFUl9FWFQsIG1fbXVsdGlzYW1wbGVGQk8pOwogICAgICAg
ICA6OmdsQmluZEZyYW1lYnVmZmVyRVhUKEdMX0RSQVdfRlJBTUVCVUZGRVJfRVhULCBtX2Zibyk7
CiAgICAgICAgIDo6Z2xCbGl0RnJhbWVidWZmZXJFWFQoMCwgMCwgbV9jdXJyZW50V2lkdGgsIG1f
Y3VycmVudEhlaWdodCwgMCwgMCwgbV9jdXJyZW50V2lkdGgsIG1fY3VycmVudEhlaWdodCwgR0xf
Q09MT1JfQlVGRkVSX0JJVCwgR0xfTElORUFSKTsK
</data>
<flag name="review"
          id="45829"
          type_id="1"
          status="+"
          setter="simon.fraser"
    />
          </attachment>
      

    </bug>

</bugzilla>