r300/rv530: Gallium Nine is not 100% compliant with DX9.0c SM3.0 hardware
Description:
It looks that the r300 DX9 functionality and / or Gallium Nine is broken on my rv530 aka ATI Radeon Mobility Radeon X1600 based iMac. I have produced three apitrace which should somehow explain the problem. The OS is Kubuntu 20.04 LTS with kernel 5.11.0-37-generic running Wine 6.19.
Resolution & Explanation of the underlying problem:
Finally it turned out that there exist a further bug #357 (closed) with almost an identical symptom, - a black rendering of D3D based applications. While the resulting error is the same, the root of the problem isn't. Bug #357 (closed) is Wine D3D related and the underlying problem may be the "D3D to OpenGL" translation principle of Wine which doesn't allow a 100% DX9.0c SM3.0 compatibility.
This issue here is effectively Gallium Nine related. Originally Gallium Nine was not coded with all DX9.0c optimizations so the resulting shaders exceeds slightly the DX9.0c SM3.0 hw limits. However, the functionality to support fully the DX9.0c SM3.0 specification is as of 2021 present in Gallium Nine but it is not programmed accordingly.
More information can be found at the following comment of Axel Davy: #5497 (comment 1187761)
Affected and currently by Mesa supported DX9.0c SM3.0 hardware is:
- ATI/AMD Radeon X1000 series, R500 based, supported by the r300 driver
- Nvidia GeForce 6 & 7 series, NV40 based, supported by the nv30 driver
- Intel GMA X3000 iGPU, supported by the crocus driver
All newer DX10+ SM4.0+ class hardware is not affected by this bug because it has more hardware resource available.
Mesa driver information:
name of display: :0
display: :0 screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
Vendor: X.Org R300 Project (0x1002)
Device: ATI RV530 (0x71c5)
Version: 21.0.3
Accelerated: yes
Video memory: 256MB
Unified memory: no
Preferred profile: compat (0x2)
Max core profile version: 0.0
Max compat profile version: 2.1
Max GLES1 profile version: 1.1
Max GLES[23] profile version: 2.0
OpenGL vendor string: X.Org R300 Project
OpenGL renderer string: ATI RV530
OpenGL version string: 2.1 Mesa 21.0.3
OpenGL shading language version string: 1.20
OpenGL ES profile version string: OpenGL ES 2.0 Mesa 21.0.3
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 1.0.16
Examples:
When I start the Game Baldur's Gate Dark Alliance in the Xbox emulator CXBX-R the program window stays black. The game doesn't crash directly, it seems to run, so I can hear the intro music but otherwise nothing else. I have made an apitrace (which somehow looks too small): https://drive.google.com/file/d/1SqROaFvt7nkLus8EzTCj497K4ruaa4s2/view?usp=sharing
Also the Direct3D (DX9) - Initialization test fails looks strange. It shows only a green content. Addition: It was told me that this is right, it should look so simple. The very small apitrace is located here: https://drive.google.com/file/d/1cD-O12TKLL5Sm42scUrPqj0xgG9xi-Fh/view?usp=sharing
Finally the program ShaderMark v2.1 also doesn't work properly. The D3D screen output is only partial present and several errors are displayed at the CLI. Interestingly when the shader tests are performed, the brightness of the computer screen is automatically set to a different higher level, - everything shows massive too bright, even the whole X11/KDE environment. This gets again normal after a re-login or reboot.
The apitrace can be found here: https://drive.google.com/file/d/18u9U5g1RyiG0oe0MeYakrSiyoEc7n71U/view?usp=sharing
test@iMac-4:~/.wine/drive_c/Program Files (x86)/ToMMTi-Systems/ShaderMark v2.1$ wine ShaderMark.exe0024:warn:debugstr:OutputDebugStringA "apitrace: loaded into C:\\Program Files (x86)\\ToMMTi-Systems\\ShaderMark v2.1\\ShaderMark.exe\n"
apitrace: loaded into C:\Program Files (x86)\ToMMTi-Systems\ShaderMark v2.1\ShaderMark.exe
0024:warn:debugstr:OutputDebugStringA "apitrace: tracing to d3d9.trace1\n"
apitrace: tracing to d3d9.trace1
DRI3 backend not active (slower performance)
nine:adapter9:ctor: Your card is at the limit of Gallium Nine requirements. Some games may run into issues because requirements are too tight
Native Direct3D 9 v0.8.0.385-release is active.
For more information visit https://github.com/iXit/wine-nine-standalone
0024:err:system:ChangeDisplaySettingsExW Changing L"\\\\.\\DISPLAY1" display settings returned -2.
0024:err:system:ChangeDisplaySettingsExW Changing L"\\\\.\\DISPLAY1" display settings returned -2.
err:d3d9nine:set_display_mode ChangeDisplaySettingsExW failed with 0xFFFFFFFE
fixme:d3d9nine:DRIPresentGroup_GetMultiheadCount (0x8ba838), stub!
fixme:d3d9nine:DRIPresentGroup_GetMultiheadCount (0x8ba838), stub!
r300 FP: Compiler Error:
Rewrite of inst 11 failed Can't allocate source for Inst 28 src_type=3 new_index=9 new_mask=3
Using a dummy shader instead.
r300 FP: Compiler Error:
Too many hardware temporaries usedUsing a dummy shader instead.
r300 FP: Compiler Error:
Too many hardware temporaries usedUsing a dummy shader instead.
0024:warn:debugstr:OutputDebugStringA "apitrace: unloaded from C:\\Program Files (x86)\\ToMMTi-Systems\\ShaderMark v2.1\\ShaderMark.exe\n"
apitrace: unloaded from C:\Program Files (x86)\ToMMTi-Systems\ShaderMark v2.1\ShaderMark.exe
Maybe this topic here is something for @axeldavy and @gawin. ;-)