Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Apps/Playground/Scripts/validation_native.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
done(false);
}
});
});
}, true);
}

function loadPlayground(test, done, referenceImage, compareFunction) {
Expand Down
5 changes: 5 additions & 0 deletions Plugins/NativeEngine/Source/NativeEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1859,6 +1859,8 @@ namespace Babylon
const auto depthStencilFormat{generateStencilBuffer ? bgfx::TextureFormat::D24S8 : bgfx::TextureFormat::D32};
#endif
assert(bgfx::isTextureValid(0, false, 1, depthStencilFormat, flags));
// _mem is NULL so content of the texture is uninitialized.
// framebuffer is cleared to be consistent with browsers.
depthStencilTextureHandle = bgfx::createTexture2D(width, height, false, 1, depthStencilFormat, flags);

// bgfx doesn't add flag D3D11_RESOURCE_MISC_GENERATE_MIPS for depth textures (missing that flag will crash D3D with resolving)
Expand All @@ -1880,6 +1882,9 @@ namespace Babylon
}

Graphics::FrameBuffer* frameBuffer = new Graphics::FrameBuffer(m_deviceContext, frameBufferHandle, width, height, false, generateDepth, generateStencilBuffer);
// Clear framebuffer : https://registry.khronos.org/webgl/specs/latest/1.0/#TEXIMAGE2D
auto encoder = GetUpdateToken().GetEncoder();
frameBuffer->Clear(*encoder, BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH | BGFX_CLEAR_STENCIL, 0, 0.0f, 0);
return Napi::Pointer<Graphics::FrameBuffer>::Create(info.Env(), frameBuffer, [frameBuffer, depthStencilTextureHandle]() {
if (bgfx::isValid(depthStencilTextureHandle))
{
Expand Down
Loading