Bug 87345 - Severe noise corruption observed while running WebGL “Fluid Simulation ”
Summary: Severe noise corruption observed while running WebGL “Fluid Simulation ”
Status: RESOLVED NOTOURBUG
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: 10.3
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: Kenneth Graunke
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
: 79414 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-12-16 00:11 UTC by qiang.miao
Modified: 2015-02-09 04:17 UTC (History)
4 users (show)

See Also:
i915 platform:
i915 features:


Attachments
screenshot from Ubuntu Linux with Intel GPU (1.83 MB, image/jpeg)
2014-12-16 00:14 UTC, qiang.miao
Details
screenshot from windows 8 (612.97 KB, image/jpeg)
2014-12-16 00:15 UTC, qiang.miao
Details
Patch to the test that fixes the undefined variables (1000 bytes, text/plain)
2015-02-06 00:19 UTC, Jason Ekstrand
Details
Patch v2 to the test that fixes undefined variables (785 bytes, text/plain)
2015-02-09 04:15 UTC, Jason Ekstrand
Details

Description qiang.miao 2014-12-16 00:11:27 UTC
on an intel GPU based PC running Ubuntu Linux
Open Chrome web browser and open cake23.de/turing-fluid.html

 Expected Result
 =============
 see screenshot from Windows 8


 Actual Result
 ===========
 see screenshot from Ubuntu Linux with Intel GPU
Comment 1 qiang.miao 2014-12-16 00:14:40 UTC
Created attachment 110885 [details]
screenshot from Ubuntu Linux with Intel GPU
Comment 2 qiang.miao 2014-12-16 00:15:46 UTC
Created attachment 110886 [details]
screenshot from windows 8
Comment 3 qiang.miao 2014-12-17 21:45:48 UTC
do we have any update on this bug?
Thanks
Comment 4 Tapani Pälli 2014-12-18 07:54:15 UTC
I took a brief look, this looks good when disabling optimizations, all of them from brw_fs backend and most of the frontend running ones (everything under opt_constant_folding, except loop handling stuff which is not optimization).
Comment 5 qiang.miao 2015-01-05 23:53:40 UTC
Great
do we have fix for it now?
When the patch will be released?
Thanks a lot
Comment 6 qiang.miao 2015-01-09 23:54:58 UTC
Is there any update on this issue?
Thanks
Comment 7 Tapani Pälli 2015-01-12 08:57:37 UTC
(In reply to qiang.miao from comment #6)
> Is there any update on this issue?
> Thanks

Sorry no fix or patch available for the bug. I just made a quick look to see if bug can be pinpointed to a single location. Unfortunately this is not the case, there are likely a couple of separate issues here.
Comment 8 Jason Ekstrand 2015-02-06 00:19:58 UTC
Created attachment 113212 [details]
Patch to the test that fixes the undefined variables

This is caused by undefined variables in the webGL shaders.  The attached patch to the test fixes the problem.  In short: Not a mesa bug.
Comment 9 qiang.miao 2015-02-06 00:42:09 UTC
Can't agree with you
Why the same code can work correctly on Windows?

If these variables areundefined variables like you said
WebGL will report error and draw nothing

+  vec2 uv = vec2(0, 0);
   vec2 motion = decode2( texture2D(sampler_fluid, uv))*pixelSize*0.75;
 
-  vec2 uv = uv - motion; // add fluid motion
+  uv = uv - motion; // add fluid motion


-  vec2 gz; // blue blur2 gradient vector
+  vec2 gz = vec2(0, 0); // blue blur2 gradient vector

Those variables are defined without initial value
There is something wrong with shader compiler on how to handle default value
Comment 10 Matt Turner 2015-02-06 02:37:27 UTC
(In reply to qiang.miao from comment #9)
> Can't agree with you
> Why the same code can work correctly on Windows?
> 
> If these variables areundefined variables like you said
> WebGL will report error and draw nothing
> 
> +  vec2 uv = vec2(0, 0);
>    vec2 motion = decode2( texture2D(sampler_fluid, uv))*pixelSize*0.75;
>  
> -  vec2 uv = uv - motion; // add fluid motion
> +  uv = uv - motion; // add fluid motion
> 
> 
> -  vec2 gz; // blue blur2 gradient vector
> +  vec2 gz = vec2(0, 0); // blue blur2 gradient vector
> 
> Those variables are defined without initial value
> There is something wrong with shader compiler on how to handle default value

No.

The GLSL spec says "Reading a variable before writing (or initializing) it is legal, however the value is undefined."
Comment 11 Jason Ekstrand 2015-02-06 05:45:26 UTC
(In reply to qiang.miao from comment #9)
> Can't agree with you
> Why the same code can work correctly on Windows?

It works "correctly" on windows because their shader compiler probably puts that vec2 in a different register that just so happens to be zero.  That's a matter of luck not default values.  As matt said,

(In reply to Matt Turner from comment #10)
> The GLSL spec says "Reading a variable before writing (or initializing) it
> is legal, however the value is undefined."

Therefore, it's perfectly legal for us to give them a junk value if they don't assign one.  Any shader that uses undefined values is a broken shader.  The fact that it looks OK on windows is a fluke.
Comment 12 Jason Ekstrand 2015-02-09 04:15:25 UTC
Created attachment 113265 [details]
Patch v2 to the test that fixes undefined variables

The author of the test pointed out that the uv variable is actually defined as an input varying.  However, the "gz" variable is still undefined.  Fixing just "gz" fixes the test so that was probably the root problem.
Comment 13 Jason Ekstrand 2015-02-09 04:17:02 UTC
*** Bug 79414 has been marked as a duplicate of this bug. ***


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.