Bug 37652

Summary: [r300g] No texture shadow in ogre3d
Product: Mesa Reporter: Sven-Hendrik Haase <svenstaro>
Component: Drivers/Gallium/r300Assignee: Default DRI bug account <dri-devel>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: svenstaro
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: r300g glxinfo
r300g ogrelog
llvmpipe glxinfo
llvmpipe ogrelog
trace ogre3d scene with texture shadow

Description Sven-Hendrik Haase 2011-05-26 22:54:01 UTC
Using r300g, I'm unable to get texture shadows using the ogre3d graphics engine. Mesa texture shadow demos work fine. In fact, in the ogre3d texture shadow showcase demo I can see a very distorted texture shadow on the side of the base plane. In my own scenes, I get no shadows at all. Stencil shadows work just fine.

In order to pin down the problem, I ran a few tests. As it turns out, the problem really only exists in r300g (as far as I could test). It works fine in r600g and gallium3d llvmpipe. For reference, it also works in the NVIDIA and AMD proprietary drivers.

I also reported the problem in the ogre3d forums (http://www.ogre3d.org/forums/viewtopic.php?f=4&t=64781) but it appears to be the wrong audience to post this issue in. 

Due to the abstract nature of ogre3d, it is hard for me to create a minimal case without ogre3d.
Comment 1 Sven-Hendrik Haase 2011-05-26 22:55:05 UTC
Created attachment 47204 [details]
r300g glxinfo
Comment 2 Sven-Hendrik Haase 2011-05-26 22:56:03 UTC
Created attachment 47205 [details]
r300g ogrelog
Comment 3 Sven-Hendrik Haase 2011-05-26 22:58:18 UTC
Created attachment 47206 [details]
llvmpipe glxinfo
Comment 4 Sven-Hendrik Haase 2011-05-26 22:58:35 UTC
Created attachment 47207 [details]
llvmpipe ogrelog
Comment 5 Sven-Hendrik Haase 2011-05-26 23:05:34 UTC
The warnings about libtxc_dxtn.so might be irritating so I installed the required library but to no avail. After all, it would be fairly strange if ogre's texture shadows used S3TC compression in memory.

Further info: My distro is Arch Linux x86_64. The card is a Mobility Radeon X2100. The logs were taken from a very recent git revision. It is not a regression of r300g as I can't remember ever having texture shadows with this driver. They did work back then with r300c, though.
Comment 6 Sven-Hendrik Haase 2011-05-27 07:10:38 UTC
For those without ogre3d, here is an apitrace: http://ompldr.org/vOHRlOQ

The character should show a shadow on the ground. It currently doesn't on r300g.
Comment 7 Sven-Hendrik Haase 2011-05-28 03:01:26 UTC
A further, smaller, more conclusive trace in a less complex scene: http://ompldr.org/vOHRyMQ

The planet is supposed to cast a shadow towards the camera.

Retrace call 19396 and notice how the shadow texture in texture 0 exist but at the glDrawElements isn't actually drawn to the framebuffer.
Comment 8 Sven-Hendrik Haase 2011-05-28 03:55:22 UTC
Basically the same trace as before, but now all additional (and unused) ogre3d default materials as well as all scene materials were disabled. This removes some error and call noise during frame 1 and cuts down the size a lot.

Also I made the shadow green and the light white so it would be easier to see.

One call of interest is at 13429.
Comment 9 Sven-Hendrik Haase 2011-05-28 03:56:23 UTC
Created attachment 47249 [details]
trace ogre3d scene with texture shadow
Comment 10 Marek Olšák 2011-06-13 08:21:24 UTC
Fixed by some of my latest r300g commits (not sure which one because I was fixing other bugs) and the fix appears to be cherry-picked to 7.10 as well. Closing.

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.