Bug 88627

Summary: [BYT HSW] Papo & Yo ground surface rendering is broken
Product: Mesa Reporter: Md Imam Hossain <imamdxl8805>
Component: Drivers/DRI/i965Assignee: Intel 3D Bugs Mailing List <intel-3d-bugs>
Status: RESOLVED NOTOURBUG QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: normal    
Priority: medium CC: vadym.shovkoplias
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: bug screenshot
bug screenshot1
bug screenshot2
bug screenshot3
another screenshot on baytrail
Fragment shader
Vertex shader

Description Md Imam Hossain 2015-01-20 12:20:51 UTC
Created attachment 112542 [details]
bug screenshot

Please look at the attachments, in the first level of the game there are several places where some specific grounds are not rendered at all.

This problem persist on all combination of graphics settings from low to high.

This problem most likely occurs in the Intel graphics drivers.

I have tested with two different GPUs with the same problem.

This is a long standing bug in the core Mesa3D, not a regression.

System:

Kubuntu 14.10
Linux kernel 3.16.0-29-generic
Mesa 10.5.0-devel (git-7a182d2) using oibaf ppa

https://launchpad.net/~oibaf/+archive/ubuntu/graphics-drivers

X.Org X Server 1.16.0

tested GPUs

Intel GMA 4500MHD, device id: 2a42
Intel Bay Trail, device id: 0f31
Comment 1 Md Imam Hossain 2015-01-20 12:21:31 UTC
Created attachment 112543 [details]
bug screenshot1
Comment 2 Md Imam Hossain 2015-01-20 12:22:02 UTC
Created attachment 112544 [details]
bug screenshot2
Comment 3 Md Imam Hossain 2015-01-20 12:22:22 UTC
Created attachment 112545 [details]
bug screenshot3
Comment 4 Tapani Pälli 2015-01-22 07:29:00 UTC
please try installing package libtxc_dxtn
Comment 5 Tapani Pälli 2015-01-22 07:39:20 UTC
(In reply to Tapani Pälli from comment #4)
> please try installing package libtxc_dxtn

... and test again, for me it looks like you might be missing DXT texture format support which with Mesa is handled by and external package libtxc_dxtn.
Comment 6 Md Imam Hossain 2015-01-22 10:42:13 UTC
I have already libtxc_dxtn on my system, I have checked all other games working fine. Terminal ouputs:

emamk@emamk-workstation-PC:~$ glxinfo | grep s3
    GL_EXT_texture_compression_s3tc, GL_EXT_texture_filter_anisotropic, 
    GL_OES_EGL_image, GL_OES_read_format, GL_S3_s3tc
    GL_EXT_texture_compression_rgtc, GL_EXT_texture_compression_s3tc, 
    GL_OES_read_format, GL_S3_s3tc, GL_SGIS_generate_mipmap,

emamk@emamk-workstation-PC:~$ ldd /usr/lib/x86_64-linux-gnu/libtxc_dxtn.so 
        linux-vdso.so.1 =>  (0x00007ffffa481000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f57cf9ce000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f57cffc2000)

emamk@emamk-workstation-PC:~$ ldd /usr/lib/i386-linux-gnu/libtxc_dxtn.so 
        linux-gate.so.1 =>  (0xf770c000)
        libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf752b000)
        /lib/ld-linux.so.2 (0xf770e000)
Comment 7 Tapani Pälli 2015-01-22 10:55:38 UTC
Thanks for checking this, the reason for asking is that this game renders fine for me on IVB laptop using current Mesa master. I found 2 of the screenshot areas and I don't have black floor there. This could be Baytrail specific so I will try to get this tested on Baytrail.
Comment 8 Tapani Pälli 2015-01-23 05:55:43 UTC
Yep, I've reproduced the 'black floors' now on Bay Trail NUC running Mesa 10.5.0-devel (git-adc8cdf).
Comment 9 Tapani Pälli 2015-01-23 06:02:46 UTC
Created attachment 112697 [details]
another screenshot on baytrail
Comment 10 Md Imam Hossain 2015-01-27 07:06:20 UTC
Okay I have tested this on Intel Haswell HD Graphics 4600 and the bug is not present, so this bug is exclusively related to Intel Bay Trail graphics.
Comment 11 Tapani Pälli 2015-01-29 11:41:13 UTC
(In reply to Md Imam Hossain from comment #10)
> Okay I have tested this on Intel Haswell HD Graphics 4600 and the bug is not
> present, so this bug is exclusively related to Intel Bay Trail graphics.

What was the Mesa version used in this test? I've reproduced this today on Haswell and confirmed that still works on IVB.
Comment 12 Md Imam Hossain 2015-01-29 15:03:09 UTC
(In reply to Tapani Pälli from comment #11)
> (In reply to Md Imam Hossain from comment #10)
> > Okay I have tested this on Intel Haswell HD Graphics 4600 and the bug is not
> > present, so this bug is exclusively related to Intel Bay Trail graphics.
> 
> What was the Mesa version used in this test? I've reproduced this today on
> Haswell and confirmed that still works on IVB.

Fresh Kubuntu 14.10 install
Mesa 10.5.0-devel (git-9f5fee8 2015-01-26 utopic-oibaf-ppa)
Linux kernel version 3.16.0-23-generic

https://www.youtube.com/watch?v=Iy9yOp5Mm7w
Comment 13 Tapani Pälli 2015-03-13 11:43:26 UTC
Now game crashes when Mesa compiled with '--enable-debug' on HSW, I've filed a bug #89569 about it.

On BYT there are much more artifacts visible but no crash.
Comment 14 Md Imam Hossain 2015-12-22 01:08:40 UTC
Just to confirm, this bug is still present in latest mesa git master

System:

Ubuntu 15.10
Mesa 11.2.0-devel (git-b476c58 2015-12-19)
Linux kernel version 4.2.0-22-generic
Comment 15 Md Imam Hossain 2016-02-16 23:59:16 UTC
tested with latest Mesa, bug only seems to occur when I change the graphics settings from the default settings to something else and restart the game. If I do the touch default graphics settings or set everything to HIGH detail than bug does not occur.

System:

Ubuntu 15.10
Comment 16 Matt Turner 2016-11-03 23:43:49 UTC
Is there any chance you could create an apitrace?
Comment 17 Tapani Pälli 2016-11-04 06:33:14 UTC
I'll try to produce a trace today, IIRC this is Pygame and Unreal Engine 3 so could be problem in some other games as well .. not sure if I have anymore access to baytrail to test myself.
Comment 18 vadym 2018-06-27 09:43:57 UTC
Confirm that this issue is reproducible when switching graphics mode from defaulut mode. And after restart grass surface is rendered as a black color. Issue is reproducible on the following platforms:
HSW, SKL, KBL, llvmpipe and AMD.

Shaders responsible for this render was found using qapitrace and frameretrace tools:
FS_c5d224633770824b77948abaa21ac7101f4da3d8.glsl
VS_7a5820722988a8a7897f64f28a35ba4cf47d4aac.glsl

It was found that PConstFloat uniform in a fragment shader is initialized differently for default graphics mode
and low fraphics mode:

Default graphics mode:
======================
PConstFloat[0]:  0.15516959130764008, 1.4687154293060303, 0.6459256410598755, 0.6465722322463989
PConstFloat[1]:  1.4499469995498657, -0.1571781486272812, -0.06912530213594437, -0.069194495677948
PConstFloat[2]:  0.0, 1.2643097639083862, -0.7589484453201294, -0.7597081661224365
PConstFloat[3]:  0.0017628404311835766, 0.0015916860429570079, -9.989959716796875, 3.970821853727102e-5
PConstFloat[4]:  0.0, 0.0, 0.0, 1.0
PConstFloat[5]:  1.0, 1.0, 0.0, 0.0
PConstFloat[6]:  0.5800891518592834, 0.3527241349220276, 0.0, 1.0
PConstFloat[7]:  0.4309230148792267, 0.3861844539642334, 0.29760390520095825, 1.0
PConstFloat[8]:  0.8999999761581421, 0.8999999761581421, 0.0, 0.0
PConstFloat[9]:  0.0, 0.0, 0.0, 1.0
PConstFloat[10]: 0.009999999776482582, 0.20000000298023224, 2.0, 0.20000000298023224
PConstFloat[11]: 2.0, 1.0, 0.0, 2.0
PConstFloat[12]: 0.20000000298023224, 0.0, 0.0, 0.0
PConstFloat[13]: 2.0, 1.2241312265396118, 0.5098317265510559, 0.0
PConstFloat[14]: -0.46666666865348816, 14.999999046325684, 2.0, 0.0
PConstFloat[15]: 0.20000000298023224, 0.0, 0.0, 0.0

Low graphics mode:
==================
PConstFloat[0]:  1.3075134754180908, -0.3961544334888458, -0.3926851153373718, -0.39307817816734314
PConstFloat[1]:  -0.645625650882721, -0.8022872805595398, -0.7952612638473511, -0.7960572838783264
PConstFloat[2]:  0.0, 1.7261825799942017, -0.4597381055355072, -0.4601982831954956
PConstFloat[3]:  -0.00077915407018736, -0.00024380529066547751, -9.989983558654785, 1.6511185094714165e-5
PConstFloat[4]:  0.0, 0.0, 0.0, 1.0
PConstFloat[5]:  1.0, 1.0, 0.0, 0.0
PConstFloat[6]:  0.5800891518592834, 0.3527241349220276, 0.0, 1.0
PConstFloat[7]:  0.4309230148792267, 0.3861844539642334, 0.29760390520095825, 1.0
PConstFloat[8]:  0.8999999761581421, 0.8999999761581421, 0.0, 0.0
PConstFloat[9]:  0.0, 0.0, 0.0, 1.0
PConstFloat[10]: 0.009999999776482582, 0.20000000298023224, 2.0, 0.20000000298023224
PConstFloat[11]: 2.0, 1.0, 0.0, 2.0
PConstFloat[12]: 0.20000000298023224, 0.0, 0.0, 0.0
PConstFloat[13]: 2.0, 1.2241312265396118, 0.5098317265510559, 0.0


Looks like PConstFloat[14] and PConstFloat[15] are not initialized explicitly for low graphics. Accordingly to the spec it is initialized to zeroes and this leads to wrong calculations in a fragment shader:

    Temporary0.a = (Temporary6.r + PConstFloat[14].r);
    Temporary0.a = (Temporary0.a * PConstFloat[14].g);
    Temporary0.a = clamp(Temporary0.a, 0.0, 1.0);
    Temporary0.a = (( log2( abs( Temporary0.a ) ) ) );
    Temporary0.a = (Temporary0.a * PConstFloat[14].b);


In the second line of the code above Temporary0.a is set to 0.0 because uniform PConstFloat[14] was not explicitly initialized. Then float log2(float x) is run with zero input parameter, that is why it returns NaN. In the further calculations NaN value from log2() is set to gl_FragData[0].rgb which leads to incorrect rendering of the ground.

This issue can be fixed by explicit initialization of PConstFloat[14] with the following values (used in default graphics mode):

PConstFloat[14]: -0.46666666865348816, 14.999999046325684, 2.0, 0.0


So, this bug is not related to Mesa.
Comment 19 vadym 2018-06-27 09:48:28 UTC
Created attachment 140357 [details]
Fragment shader
Comment 20 vadym 2018-06-27 09:48:53 UTC
Created attachment 140358 [details]
Vertex shader
Comment 21 Dylan Baker 2018-08-15 21:11:50 UTC
Sounds like this isn't our bug, so I'm going to close it. Feel free to re-open if I misunderstood.

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.