UWP: QI IDXGISwapChain2 before SetMaximumFrameLatency - #77
Merged
Conversation
Present-pacing (bkaradzic#3930) calls SetMaximumFrameLatency on SwapChainI. On WinRT SwapChainI is IDXGISwapChain1, which does not expose that method (it is on IDXGISwapChain2+), so UWP builds fail with C2039. QueryInterface for IDXGISwapChain2 first so Win32 and WinRT both compile and only apply latency when the interface is available. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d47cbab2-d751-4cf9-984f-4412dd9ec601
bkaradzic-microsoft
added a commit
to bkaradzic-microsoft/BabylonNative
that referenced
this pull request
Aug 31, 2026
UWP CI failed compiling bgfx dxgi.cpp: SetMaximumFrameLatency is not on IDXGISwapChain1 (WinRT SwapChainI). Pulls BabylonJS/bgfx.cmake#143 / BabylonJS/bgfx#77 which QI for IDXGISwapChain2 first. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d47cbab2-d751-4cf9-984f-4412dd9ec601
This was referenced Aug 31, 2026
bkaradzic-microsoft
added a commit
to BabylonJS/BabylonNative
that referenced
this pull request
Sep 1, 2026
…ings) (#1857) ## Summary Bumps `bgfx.cmake` to `9a569c775917e3dd2a8cfb8836aeddbe790a8deb` (bgfx `0837ead` via BabylonJS/bgfx#78 / bgfx.cmake#144) and adapts Babylon Native to the Graphics/shader packaging changes in that range. ### API adaptations - **Blit / read**: `encoder.blit` / `bgfx::blit` take `TextureRegion` pairs; `bgfx::readTexture` → `bgfx::read(TextureRegion, data)`. Updated in `FrameBuffer`, `DeviceImpl`, `NativeCapture`, `NativeEngine`. - **Shader binary v12**: `CreateBgfxShader` writes `BGFX_SHADER_BIN_VERSION = 12`, raw SRV/UAV masks, and per-uniform `texComponent` / `texDimension` / `texFormat`. Canvas precompiled headers bumped v11 → v12 accordingly. - **Vulkan v12 binding model**: rewrite glslang bindings to match shaderc (`Frame` UBO 0/1, images at `sharedBinding + 2`, samplers at `image + 16`); package `separate_images` with real `regIndex`. Shared `SamplerSplitter` bindings are preserved across VS/FS (not compacted per-stage). - **Depth RT formats**: depth-only FB prefers `D32F` → `D24` → `D24S8` (Android stays `D24S8`). Public `BackBufferDepthStencilFormat::Depth32` maps to `D32F` (plain `D32` has no DSV on D3D11/12). - **ShaderCache**: `CACHE_VERSION` 4 → 5 so stale v6/v11 packages are not served to bgfx v12. ### Upstream pins pulled in | Repo | Change | |------|--------| | BabylonJS/bgfx#77 | UWP: QI `IDXGISwapChain2` before `SetMaximumFrameLatency` | | BabylonJS/bgfx#78 | Define local `IID_IDXGISwapChain2` GUID (fix LNK2001) | | BabylonJS/bgfx.cmake#143/#144 | Submodule bumps for the above | ### Local validation (Win32 Debug) - Nested BBG, thin-instance / motion-blur suite: pass - Playground link after GUID fix: pass ### Test plan - [x] Configure + build Playground Debug (Win32) - [x] Headless Nested BBG + motion-blur / thin-instance suite - [x] CI full platform matrix (green on `14c0b36d`; re-run after this review fix) --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d47cbab2-d751-4cf9-984f-4412dd9ec601
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
UWP CI fails after the present-pacing change because
SetMaximumFrameLatencyis called onSwapChainI, which isIDXGISwapChain1on WinRT (method is onIDXGISwapChain2+).Fix
QueryInterfaceforIDXGISwapChain2before setting latency.Needed so BabylonNative can consume the latest bgfx.cmake pin on UWP.