narzoul / DDrawCompat

DirectDraw and Direct3D 1-7 compatibility, performance and visual enhancements for Windows Vista, 7, 8, 10 and 11
BSD Zero Clause License
880 stars 67 forks source link

Forcing 24-bit zbuffer results in black screen #259

Closed PrgmrAtHrt closed 2 months ago

PrgmrAtHrt commented 7 months ago

Despite DDrawCompat reporting that my device supports 24-bit zbuffer, I am getting a black screen when forcing it.

24 bit zbuffer issue

DDrawCompat-SWEP1RCR.zip

narzoul commented 7 months ago

I think the problem is not with depth buffer support, but that this game requires CPU access to the depth buffer, so a conversion is needed from the forced format to 16-bit that the CPU expects. This only works correctly on my AMD GPU. I tried the shader approach too, but that doesn't work on either AMD or NVIDIA.

ForceD3D9On12 should work, if supported by your driver. It might not be: https://www.intel.com/content/www/us/en/support/articles/000057520/graphics.html But it introduces stuttering in movies.

Is there a particular reason for forcing a higher precision depth buffer in this game? I didn't see any Z-fighting issues, but I didn't test it much.

The only possible alternative I can see is doing the depth conversion on the CPU, but the performance hit might be significant.

PrgmrAtHrt commented 7 months ago

I am attempting to force it because I do indeed have z-fighting issues.

ForceD3D9On12 gives me a Direct3D failure. My GPU doesn't seem to be compatible.

narzoul commented 7 months ago

What's your CPU model exactly? Is this an NVIDIA Optimus laptop or a desktop PC? Can you try updating your Intel GPU driver?

I find it strange that your GPU doesn't expose any depth texture FOURCCs like INTZ, DF16 or DF24. According to this page all should be supported, the last two even on older GPUs: https://aras-p.info/texts/D3D9GPUHacks.html#depth

It's also possible that these formats are supported, but not exposed by the driver for DirectX 7. I made a quick hack to check what formats would be returned for DX9: ddraw.zip (diff.txt compared to v0.5.1)

Please upload at least info level logs with this. It doesn't matter if it crashes or doesn't work properly, I'm only interested in the supported resource formats list.

PrgmrAtHrt commented 7 months ago

I'm using a laptop. My cpu is an Intel i5-3320m. I'm using integrated graphics. There are no updates as this chip has been sunsetted.

DDrawCompat-SWEP1RCR.log

narzoul commented 7 months ago

Ok, so those formats are supported under DX9 at least. I can try to (ab)use that. Here's an experimental version, I didn't have much time to test but it seems to work on my AMD GPU that supports the same depth texture formats: ddraw.zip (diff.txt compared to v0.5.1)

PrgmrAtHrt commented 7 months ago

Works beautifully! Well done!

narzoul commented 2 months ago

Fixed in v0.5.2.