You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NativeEngine: support standalone sampleable depth/stencil textures
Babylon's NativeEngine._createDepthStencilTexture requests a standalone,
sampleable depth/stencil texture by calling createFrameBuffer with a
freshly-created (and therefore uninitialized) color texture whose bgfx
handle is still kInvalidHandle. CreateFrameBuffer only guarded against a
null texture, so it attached the invalid handle as a color target. bgfx
framebuffer validation then rejected the attachment ("Invalid texture
attachment") and threw, aborting the entire headless Playground sweep.
Detect this request (non-null texture with an invalid bgfx handle) and:
- skip attaching the invalid color handle (depth-only framebuffer),
- allocate the depth attachment as a readable BGFX_TEXTURE_RT so it can
be sampled, and
- alias the framebuffer's depth attachment back into the caller-supplied
texture (ownsHandle=false; the framebuffer owns the handle) so Babylon
can sample it (e.g. fluid rendering's depth copy).
This removes the whole-sweep abort and makes the depth/stencil texture
sampleable per Babylon's contract.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
if (texture != nullptr && bgfx::isValid(texture->Handle()))
1818
1824
{
1819
1825
const bgfx::Caps* caps = bgfx::getCaps();
1820
1826
// bgfx validation now asserts when trying to use BGFX_RESOLVE_AUTO_GEN_MIPS with a texture that doesn't have the BGFX_CAPS_FORMAT_TEXTURE_MIP_AUTOGEN flag,
0 commit comments