Closed Bug 1249361 Opened 8 years ago Closed 7 years ago

Compositor glitches out the final rendering of an image.

Categories

(Core :: Graphics: CanvasWebGL, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jujjyl, Unassigned)

References

Details

(Whiteboard: gfx-noted)

Attachments

(1 file)

Attached image compositor_glitch.png
Debugging an asm.js WebGL page, on certain Windows NVidia configurations, the final page rendered output comes out glitched. This only occurs on this one engine demo, not on all WebGL content.

The application renders the contents to an offscreen render target (1280x720 RGBA8), and as a final step, blits that out to the WebGL canvas screen buffer.

The final image produced onto the offscreen render target is ok, and that is blitted onto the canvas using the vertex shader

#version 300 es
layout ( location = 0 ) in vec4 in_pos ;
layout ( location = 8 ) in vec2 in_uv0 ;
uniform mat4 world_view_proj ;
out vec2 v_uv0 ;
void main ()
{
    v_uv0 = vec2 ( in_uv0 . x , 1.0 - in_uv0 . y ) ;
    gl_Position = vec4((in_pos * world_view_proj).xy, 0.5,  1.0) ;
}

and the fragment shader

#version 300 es
in vec2 v_uv0 ;
layout ( location = 0 ) out vec4 out_color ;
uniform sampler2D input_texture0 ;
void main ( )
{
    vec4 c = texture ( input_texture0 , v_uv0 ) ;
    out_color = c ;
}

but for some reason, this blit produces completely incorrectly textured result. Using GLcontext.readPixels() to obtain the image of the offscreen render target before blitting, it looks ok. See the attached screenshot. The above canvas is the WebGL 2 canvas, where the rendering is done. The canvas below is a clone of that, which displays a manually .readPixel()ed copy of the final rendering before it is blitted to screen.

Jeff Gilbert asked for STR in games meeting, sending it to him directly (closed source).
Seeing this occur on my HASWELL Windows 10 system with about:graphics

Adapter Description	NVIDIA GeForce GTX 980 Ti
Adapter Drivers	nvd3dumx,nvwgf2umx,nvwgf2umx,nvwgf2umx nvd3dum,nvwgf2um,nvwgf2um,nvwgf2um
Adapter RAM	4095
Asynchronous Pan/Zoom	wheel input enabled; touch input enabled
Device ID	0x17c8
Direct2D Enabled	true
DirectWrite Enabled	true (10.0.10586.0)
Driver Date	2-8-2016
Driver Version	10.18.13.6191
GPU #2 Active	false
GPU Accelerated Windows	1/1 Direct3D 11 (OMTC)
Subsys ID	00000000
Supports Hardware H264 Decoding	Yes
Vendor ID	0x10de
WebGL Renderer	Google Inc. -- ANGLE (NVIDIA GeForce GTX 980 Ti Direct3D11 vs_5_0 ps_5_0)
windowLayerManagerRemote	true
AzureCanvasBackend	direct2d 1.1
AzureContentBackend	direct2d 1.1
AzureFallbackCanvasBackend	cairo
AzureSkiaAccelerated	0
Also on Anthony's Windows 10 system with 

Graphics
Adapter Description    NVIDIA GeForce GTX 970
Adapter Drivers    nvd3dumx,nvwgf2umx,nvwgf2umx,nvwgf2umx nvd3dum,nvwgf2um,nvwgf2um,nvwgf2um
Adapter RAM    4095
Asynchronous Pan/Zoom    wheel input enabled; touch input enabled
Device ID    0x13c2
Direct2D Enabled    true
DirectWrite Enabled    true (10.0.10586.0)
Driver Date    1-22-2016
Driver Version    10.18.13.6175
GPU #2 Active    false
GPU Accelerated Windows    1/1 Direct3D 11 (OMTC)
Subsys ID    29723842
Supports Hardware H264 Decoding    Yes
Vendor ID    0x10de
WebGL Renderer    Google Inc. -- ANGLE (NVIDIA GeForce GTX 970 Direct3D11 vs_5_0 ps_5_0)
windowLayerManagerRemote    true
AzureCanvasBackend    direct2d 1.1
AzureContentBackend    direct2d 1.1
AzureFallbackCanvasBackend    cairo
AzureSkiaAccelerated    0
Does not occur on Macbook Pro running Windows 8.1 Pro in bootcamp which has about:support with

Adapter Description	NVIDIA GeForce GT 650M
Adapter Drivers	nvd3dumx,nvwgf2umx,nvwgf2umx nvd3dum,nvwgf2um,nvwgf2um
Adapter RAM	1024
Asynchronous Pan/Zoom	wheel input enabled; touch input enabled
Device ID	0x0fd5
Direct2D Enabled	true
DirectWrite Enabled	true (6.3.9600.18123)
Driver Date	6-17-2015
Driver Version	10.18.13.5330
GPU #2 Active	false
GPU Accelerated Windows	1/1 Direct3D 11 (OMTC)
Subsys ID	00f2106b
Supports Hardware H264 Decoding	Yes
Vendor ID	0x10de
WebGL Renderer	Google Inc. -- ANGLE (NVIDIA GeForce GT 650M Direct3D11 vs_5_0 ps_5_0)
windowLayerManagerRemote	true
AzureCanvasBackend	direct2d 1.1
AzureContentBackend	direct2d 1.1
AzureFallbackCanvasBackend	cairo
AzureSkiaAccelerated	0
Also does not occur on a desktop Windows 8.1 Pro PC with about:support

Adapter Description	NVIDIA GeForce 9600 GT
Adapter Drivers	nvd3dumx,nvwgf2umx,nvwgf2umx nvd3dum,nvwgf2um,nvwgf2um
Adapter RAM	512
Asynchronous Pan/Zoom	wheel input enabled; touch input enabled
Device ID	0x0622
Direct2D Enabled	true
DirectWrite Enabled	true (6.3.9600.18123)
Driver Date	7-2-2014
Driver Version	9.18.13.4052
GPU #2 Active	false
GPU Accelerated Windows	1/1 Direct3D 11 (OMTC)
Subsys ID	34a01458
Supports Hardware H264 Decoding	Yes
Vendor ID	0x10de
WebGL Renderer	Google Inc. -- ANGLE (NVIDIA GeForce 9600 GT Direct3D11 vs_4_0 ps_4_0)
windowLayerManagerRemote	true
AzureCanvasBackend	direct2d 1.1
AzureContentBackend	direct2d 1.1
AzureFallbackCanvasBackend	cairo
AzureSkiaAccelerated	0
Also the bug does not occur on a Hewlett Packard Windows 10 laptop with about:support

Adapter Description	Intel(R) HD Graphics 4600
Adapter Description (GPU #2)	NVIDIA Quadro K1100M
Adapter Drivers	igdumdim64 igd10iumd64 igd10iumd64 igd12umd64 igdumdim32 igd10iumd32 igd10iumd32 igd12umd32
Adapter Drivers (GPU #2)	nvd3dumx,nvwgf2umx,nvwgf2umx,nvwgf2umx nvd3dum,nvwgf2um,nvwgf2um,nvwgf2um
Adapter RAM	Unknown
Adapter RAM (GPU #2)	2048
Asynchronous Pan/Zoom	none
Device ID	0x0416
Device ID (GPU #2)	0x0ff6
Direct2D Enabled	true
DirectWrite Enabled	true (10.0.10240.16430)
Driver Date	12-15-2015
Driver Date (GPU #2)	7-22-2015
Driver Version	20.19.15.4352
Driver Version (GPU #2)	10.18.13.5362
GPU #2 Active	false
GPU Accelerated Windows	1/1 Direct3D 11 (OMTC)
Subsys ID	00000000
Subsys ID (GPU #2)	00000000
Supports Hardware H264 Decoding	Yes
Vendor ID	0x8086
Vendor ID (GPU #2)	0x10de
WebGL Renderer	Google Inc. -- ANGLE (Intel(R) HD Graphics 4600 Direct3D11 vs_5_0 ps_5_0)
windowLayerManagerRemote	true
AzureCanvasBackend	direct2d 1.1
AzureContentBackend	direct2d 1.1
AzureFallbackCanvasBackend	cairo
AzureSkiaAccelerated	0

Looks like this laptop is a dual GPU one, and according to "WebGL Renderer" field, the Intel one is used instead of the Quadro one. Jeff, is there a way to force Firefox use the NVIDIA GPU on this for WebGL?
Flags: needinfo?(jgilbert)
Also the bug does not occur on the same Macbook Pro laptop from comment 3, after its GPU driver is updated to latest version:

Adapter Description	NVIDIA GeForce GT 650M
Adapter Drivers	nvd3dumx,nvwgf2umx,nvwgf2umx nvd3dum,nvwgf2um,nvwgf2um
Adapter RAM	1024
Asynchronous Pan/Zoom	wheel input enabled; touch input enabled
Device ID	0x0fd5
Direct2D Enabled	true
DirectWrite Enabled	true (6.3.9600.18123)
Driver Date	2-8-2016
Driver Version	10.18.13.6191
GPU #2 Active	false
GPU Accelerated Windows	1/1 Direct3D 11 (OMTC)
Subsys ID	00f2106b
Supports Hardware H264 Decoding	Yes
Vendor ID	0x10de
WebGL Renderer	Google Inc. -- ANGLE (NVIDIA GeForce GT 650M Direct3D11 vs_5_0 ps_5_0)
windowLayerManagerRemote	true
AzureCanvasBackend	direct2d 1.1
AzureContentBackend	direct2d 1.1
AzureFallbackCanvasBackend	cairo
AzureSkiaAccelerated	0

so not a GPU-card independent NVidia driver regression at least.
Also the bug does not occur on Microsoft Surface 2 Pro tablet/laptop with Windows 10, about:support

Adapter Description	Intel(R) HD Graphics Family
Adapter Drivers	igdumdim64 igd10iumd64 igd10iumd64 igd12umd64 igdumdim32 igd10iumd32 igd10iumd32 igd12umd32
Adapter RAM	Unknown
Asynchronous Pan/Zoom	wheel input enabled; touch input enabled
Device ID	0x0a16
Direct2D Enabled	true
DirectWrite Enabled	true (10.0.10586.0)
Driver Date	7-17-2015
Driver Version	10.18.15.4256
GPU #2 Active	false
GPU Accelerated Windows	1/1 Direct3D 11 (OMTC)
Subsys ID	0a161414
Supports Hardware H264 Decoding	Yes
Vendor ID	0x8086
WebGL Renderer	Google Inc. -- ANGLE (Intel(R) HD Graphics Family Direct3D11 vs_5_0 ps_5_0)
windowLayerManagerRemote	true
AzureCanvasBackend	direct2d 1.1
AzureContentBackend	direct2d 1.1
AzureFallbackCanvasBackend	cairo
AzureSkiaAccelerated	0

For some reason, the exact graphics card is not listed, Wikipedia says this one is an Intel HD Graphics 4400.
(In reply to Jukka Jylänki from comment #5)
> Also the bug does not occur on a Hewlett Packard Windows 10 laptop with
> about:support
> 
> Adapter Description	Intel(R) HD Graphics 4600
> Adapter Description (GPU #2)	NVIDIA Quadro K1100M
> Adapter Drivers	igdumdim64 igd10iumd64 igd10iumd64 igd12umd64 igdumdim32
> igd10iumd32 igd10iumd32 igd12umd32
> Adapter Drivers (GPU #2)	nvd3dumx,nvwgf2umx,nvwgf2umx,nvwgf2umx
> nvd3dum,nvwgf2um,nvwgf2um,nvwgf2um
> Adapter RAM	Unknown
> Adapter RAM (GPU #2)	2048
> Asynchronous Pan/Zoom	none
> Device ID	0x0416
> Device ID (GPU #2)	0x0ff6
> Direct2D Enabled	true
> DirectWrite Enabled	true (10.0.10240.16430)
> Driver Date	12-15-2015
> Driver Date (GPU #2)	7-22-2015
> Driver Version	20.19.15.4352
> Driver Version (GPU #2)	10.18.13.5362
> GPU #2 Active	false
> GPU Accelerated Windows	1/1 Direct3D 11 (OMTC)
> Subsys ID	00000000
> Subsys ID (GPU #2)	00000000
> Supports Hardware H264 Decoding	Yes
> Vendor ID	0x8086
> Vendor ID (GPU #2)	0x10de
> WebGL Renderer	Google Inc. -- ANGLE (Intel(R) HD Graphics 4600 Direct3D11
> vs_5_0 ps_5_0)
> windowLayerManagerRemote	true
> AzureCanvasBackend	direct2d 1.1
> AzureContentBackend	direct2d 1.1
> AzureFallbackCanvasBackend	cairo
> AzureSkiaAccelerated	0
> 
> Looks like this laptop is a dual GPU one, and according to "WebGL Renderer"
> field, the Intel one is used instead of the Quadro one. Jeff, is there a way
> to force Firefox use the NVIDIA GPU on this for WebGL?

Generally messing with the driver's UI for app-specific settings, I think. Some machines can disable one or the other of the GPUs from the BOIS. :bas might know if there's a way to pick in software, though.
Flags: needinfo?(jgilbert) → needinfo?(bas)
It looks like it might be a NV Maxwell-specific bug?

GTX 980ti and GTX 970 only, so far.
It does suggest so.

The first party developer hitting this issue reports that they get the bug with an Asus G751JY – NVidia GeForce GTX 980m – Windows 8.1 Enterprise 64bit, with about:support

Graphics
Adapter Description       NVIDIA GeForce GTX 980M
Adapter Drivers                nvd3dumx,nvwgf2umx,nvwgf2umx nvd3dum,nvwgf2um,nvwgf2um
Adapter RAM    4095
Asynchronous Pan/Zoom             wheel input enabled; touch input enabled
Device ID             0x1617
Direct2D Enabled             true
DirectWrite Enabled       true (6.3.9600.18123)
Driver Date         1-22-2016
Driver Version   10.18.13.6175
GPU #2 Active   false
GPU Accelerated Windows         1/1 Direct3D 11 (OMTC)
Subsys ID             22da1043
Supports Hardware H264 Decoding          Yes
Vendor ID           0x10de
WebGL Renderer             Google Inc. -- ANGLE (NVIDIA GeForce GTX 980M Direct3D11 vs_5_0 ps_5_0)
windowLayerManagerRemote  true
AzureCanvasBackend    direct2d 1.1
AzureContentBackend  direct2d 1.1
AzureFallbackCanvasBackend    cairo
AzureSkiaAccelerated    0

which suggests Maxwell, and rules out that it might have been only a Windows 10 thing, since this is a Windows 8.1 one.
Also occurs on developer's Dell Precision T5610 – NVidia GeForce GTX 980 – Windows 10 Enterprise 64bit, with

Graphics
Adapter Description       NVIDIA GeForce GTX 980
Adapter Drivers                nvd3dumx,nvwgf2umx,nvwgf2umx,nvwgf2umx nvd3dum,nvwgf2um,nvwgf2um,nvwgf2um
Adapter RAM    4095
Asynchronous Pan/Zoom             wheel input enabled; touch input enabled
Device ID             0x13c0
Direct2D Enabled             true
DirectWrite Enabled       true (10.0.10240.16430)
Driver Date         11-24-2015
Driver Version   10.18.13.5906
GPU #2 Active   false
GPU Accelerated Windows         3/3 Direct3D 11 (OMTC)
Subsys ID             36851458
Supports Hardware H264 Decoding          Yes
Vendor ID           0x10de
WebGL Renderer             NVIDIA Corporation -- GeForce GTX 980/PCIe/SSE2
windowLayerManagerRemote  true
AzureCanvasBackend    direct2d 1.1
AzureContentBackend  direct2d 1.1
AzureFallbackCanvasBackend    cairo
AzureSkiaAccelerated    0

which is a Maxwell again.
No corruption on one of last year's GDC machines:

Graphics
Adapter Description	NVIDIA GeForce GTX 760 Ti OEM
Adapter Description (GPU #2)	Intel(R) HD Graphics 4600
Adapter Drivers	nvd3dumx,nvwgf2umx,nvwgf2umx nvd3dum,nvwgf2um,nvwgf2um
Adapter Drivers (GPU #2)	igdumdim64 igd10iumd64 igd10iumd64 igdumdim32 igd10iumd32 igd10iumd32
Adapter RAM	2048
Adapter RAM (GPU #2)	Unknown
Asynchronous Pan/Zoom	wheel input enabled; touch input enabled
Device ID	0x1189
Device ID (GPU #2)	0x0412
Direct2D Enabled	true
DirectWrite Enabled	true (6.3.9600.18123)
Driver Date	2-5-2015
Driver Date (GPU #2)	9-29-2014
Driver Version	9.18.13.4752
Driver Version (GPU #2)	10.18.10.3960
GPU #2 Active	false
GPU Accelerated Windows	1/1 Direct3D 11 (OMTC)
Subsys ID	107410de
Subsys ID (GPU #2)	0000000c
Supports Hardware H264 Decoding	Yes
Vendor ID	0x10de
Vendor ID (GPU #2)	0x8086
WebGL Renderer	Google Inc. -- ANGLE (NVIDIA GeForce GTX 760 Ti OEM Direct3D11 vs_5_0 ps_5_0)
windowLayerManagerRemote	true
AzureCanvasBackend	direct2d 1.1
AzureContentBackend	direct2d 1.1
AzureFallbackCanvasBackend	cairo
AzureSkiaAccelerated	0
(In reply to Jeff Gilbert [:jgilbert] from comment #8)
> (In reply to Jukka Jylänki from comment #5)
> > Also the bug does not occur on a Hewlett Packard Windows 10 laptop with
> > about:support
> > 
> > Adapter Description	Intel(R) HD Graphics 4600
> > Adapter Description (GPU #2)	NVIDIA Quadro K1100M
> > Adapter Drivers	igdumdim64 igd10iumd64 igd10iumd64 igd12umd64 igdumdim32
> > igd10iumd32 igd10iumd32 igd12umd32
> > Adapter Drivers (GPU #2)	nvd3dumx,nvwgf2umx,nvwgf2umx,nvwgf2umx
> > nvd3dum,nvwgf2um,nvwgf2um,nvwgf2um
> > Adapter RAM	Unknown
> > Adapter RAM (GPU #2)	2048
> > Asynchronous Pan/Zoom	none
> > Device ID	0x0416
> > Device ID (GPU #2)	0x0ff6
> > Direct2D Enabled	true
> > DirectWrite Enabled	true (10.0.10240.16430)
> > Driver Date	12-15-2015
> > Driver Date (GPU #2)	7-22-2015
> > Driver Version	20.19.15.4352
> > Driver Version (GPU #2)	10.18.13.5362
> > GPU #2 Active	false
> > GPU Accelerated Windows	1/1 Direct3D 11 (OMTC)
> > Subsys ID	00000000
> > Subsys ID (GPU #2)	00000000
> > Supports Hardware H264 Decoding	Yes
> > Vendor ID	0x8086
> > Vendor ID (GPU #2)	0x10de
> > WebGL Renderer	Google Inc. -- ANGLE (Intel(R) HD Graphics 4600 Direct3D11
> > vs_5_0 ps_5_0)
> > windowLayerManagerRemote	true
> > AzureCanvasBackend	direct2d 1.1
> > AzureContentBackend	direct2d 1.1
> > AzureFallbackCanvasBackend	cairo
> > AzureSkiaAccelerated	0
> > 
> > Looks like this laptop is a dual GPU one, and according to "WebGL Renderer"
> > field, the Intel one is used instead of the Quadro one. Jeff, is there a way
> > to force Firefox use the NVIDIA GPU on this for WebGL?
> 
> Generally messing with the driver's UI for app-specific settings, I think.
> Some machines can disable one or the other of the GPUs from the BOIS. :bas
> might know if there's a way to pick in software, though.

You'd have to start all of firefox on the Nvidia GPU. It's not a well rested scenario but it should be possibly by rightclicking and selecting the GPU from the context menu.
Flags: needinfo?(bas)
Blocks: 1247134
Jeff, have you been able to get your hands on a Maxwell GPU to reproduce this?
(In reply to Jukka Jylänki from comment #14)
> Jeff, have you been able to get your hands on a Maxwell GPU to reproduce
> this?

Yep, I'm borrowing a machine that reproduces this.
(980ti)
Whiteboard: gfx-noted
Any updates on this? We're still able to reproduce this issue with latest Firefox builds. Same GPUs.
Talked with Gfx team, they will be investigating in a few weeks when they bottom out on some WebGL2 work under way.
For a public test case, visit

http://clb.demon.fi/bugs/stingray-webgl-basic-2016-10-14/stingray_webgl_release.html

The test case is also downloadable for local execution at

http://clb.demon.fi/bugs/stingray-webgl-basic-2016-10-14/stingray-webgl-basic-2016-10-14.zip

If someone has a GTX 10x0 GPU, it would be interesting to know if that is affected.
The graphics glitch occurs on Linux Mint 18 as well: (running on ASUS GTX 980 TI DC3OC Gaming)

Name 	Firefox
Version 	52.0a1
Build ID 	20161017030209
Update History 	
Update Channel 	nightly
User Agent 	Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0
OS 	Linux 4.4.0-36-generic
GPU #1
Active	Yes
Description	NVIDIA Corporation -- GeForce GTX 980 Ti/PCIe/SSE2
Vendor ID	NVIDIA Corporation
Device ID	GeForce GTX 980 Ti/PCIe/SSE2
Driver Version	4.5.0 NVIDIA 370.28

so not Windows specific.
Anthony, would you have any NVidia GTX 10x0 GPUs (the new Pascal architecture from this year around that you could check the test case in comment 19? (and compare to screenshot in comment 0)
Flags: needinfo?(anthony.s.hughes)
(In reply to Jukka Jylänki from comment #21)
> Anthony, would you have any NVidia GTX 10x0 GPUs (the new Pascal architecture from this year around 
> that you could check the test case in comment 19?

No I do not.
Flags: needinfo?(anthony.s.hughes)
Ok, I now see what the root problem is.

I think when GLctx.invalidateFramebuffer() is called, it ends up invalidating wrong render target textures.

STR:

a. Visit http://clb.demon.fi/bugs/glinvalidateframebuffer/stingray_webgl_release.html

or

b. Download http://clb.demon.fi/bugs/glinvalidateframebuffer.zip and run stingray_webgl_release.html locally.

Observed:

When running on a Maxwell or Pascal NVidia GPU (GTX 960+ series or GTX 1060+ series), the rendered output is corrupted.

Commenting out the line 7342 in stingray_webgl_release.js that says

   GLctx["invalidateFramebuffer"](target, list)

sidesteps the corruption altogether.

However, tracing through the GL code on the page (the test case above has tracing logs for this), it looks like the page's usage of invalidateFramebuffer() should be correct. The final output of the page consists of the contents of the render target texture with ID 884, and before that, the application calls to invalidate FBOs, which refer to textures with IDs 889, 890, 891, 886, 892, 897 and 893. The texture with ID 884 should not be affected, but somehow that texture does incorrectly get invalidated as well.

This suggests that the bug is that the FBO invalidation code somehow invalidates the contents of a texture that is not part of that FBO.

The reason why this occurs only on Maxwell and Pascal GPUs is then clear, it looks like glInvalidateFramebuffer() is a no-op on older GPUs, as in Maxwell, NVidia switched over to a tile based architecture where glInvalidateFramebuffer() actually has an effect.
Dan, any chance you could take a look at this bug when you come back?
Flags: needinfo?(dglastonbury)
It's been reported that bug 1321450 may have fixed this. IIRC Jukka can no longer reproduce this issue on Nightly.

Jukka, if so, can you mark this as fixed?
Flags: needinfo?(dglastonbury) → needinfo?(jujjyl)
Depends on: 1321450
Yeah, verified as fixed. Great great!
Status: NEW → RESOLVED
Closed: 7 years ago
Flags: needinfo?(jujjyl)
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: