http://bugs.winehq.org/show_bug.cgi?id=21469
Summary: Civilization 4 whows a myriad of errors of unnecessary wined3d check. Product: Wine Version: 1.1.37 Platform: All OS/Version: All Status: UNCONFIRMED Severity: minor Priority: P2 Component: directx-d3d AssignedTo: wine-bugs@winehq.org ReportedBy: luis.busquets@ilidium.com
From some time when I run Civilization4 I get a myriad of these messages and
others with other formats:
err:d3d:getColorBits Unsupported format: WINED3DFMT_R16G16_FLOAT err:d3d:IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt Unable to check compatibility for Format=WINED3DFMT_R16G16_FLOAT
After looking in the wine code I have found out that what happens is that Civ calls the function IDirect3D9Impl_CheckDepthStencilMatch (no error of the application on that)
The implementation of wine then calls IWineD3D_CheckDepthStencilMatch which then calls
IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt
for each format that the adapter supports until it finds a supported format:
Problem:
IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt tries to match the supported pixel format of the adapter with the requested format. If the supported pixel format of the adapter is of type WGL_TYPE_RGBA_ARB, it tries to getColorBits of the format even if the format to try is a floating format, getColorBits responds with an error and same does IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt. Certainly, the answer is correct (FALSE) but the problem is that it fills the screen with ERR that are due to wine checking things for which there is no need as they are directly false.
Possible solution: to do IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt right away check if: cfg->iPixelType == WGL_TYPE_RGBA_ARB and format_desc is a floating format then return FALSE right away no need to fill ERR
same if cfg->iPixelType == WGL_TYPE_RGBA_FLOAT_ARB and format_desc is not a floating format then return FALSE right away no need to fill ERR
If you do not like this solution, getColorBits could be modified so that it does not file an error for floating point formats but just responds with 0 for all bit sizes when the format is a floating point without filling an error.
What do you prefer?
Can somebody propose a patch with this kind of behaviour or something better so that my Civ4 does not respond with this myriad of errors?
The myriad of unnecessary checks and of reports of ERR causes a some slowness that can be quantified eliminated unnecessary checks.