BabylonJS / BabylonNative

Build cross-platform native applications with the power of the Babylon.js JavaScript framework
MIT License
761 stars 131 forks source link

RTT mip-maps are not being generated automatically on D3D12 #1265

Open docEdub opened 1 year ago

docEdub commented 1 year ago

Running playground https://playground.babylonjs.com/#W7E7CF#25 on D3D12 shows the following when the window is small or the camera is moved far enough away...

MicrosoftTeams-image (4)

It should look like this ...

Cedric and I looked at this in RenderDoc and saw the RTT mip-maps are missing on D3D12. They are generated automatically for other graphics APIs, but not D3D12.

CedricGuillemet commented 1 year ago

I believe we can close this issue ? @docEdub

docEdub commented 1 year ago

I believe we can close this issue ? @docEdub

I don't think this is fixed, yet.

docEdub commented 11 months ago

I found this bgfx issue that may be related: https://github.com/bkaradzic/bgfx/issues/798

TLDR; Automatic mip-map generation is not provided by D3D12, Vulkan, or Metal, so it needs to be explicitly implemented in bgfx to match the behavior seen in other graphics APIs. For Vulkan, this was implemented in bgfx in PR https://github.com/bkaradzic/bgfx/pull/2472, and for Metal in PR https://github.com/bkaradzic/bgfx/pull/2784, but it has not been implemented in D3D12, yet, and afaict there is no plan to do so.

The end-result is the mip-map layers get created by bgfx on D3D12, but they are all black.