Skip to content

UWP: QI IDXGISwapChain2 before SetMaximumFrameLatency - #77

Merged
bkaradzic-microsoft merged 1 commit into
masterfrom
fix/uwp-swapchain2-frame-latency
Aug 31, 2026
Merged

UWP: QI IDXGISwapChain2 before SetMaximumFrameLatency#77
bkaradzic-microsoft merged 1 commit into
masterfrom
fix/uwp-swapchain2-frame-latency

Conversation

@bkaradzic-microsoft

Copy link
Copy Markdown
Member

Summary

UWP CI fails after the present-pacing change because SetMaximumFrameLatency is called on SwapChainI, which is IDXGISwapChain1 on WinRT (method is on IDXGISwapChain2+).

Fix

QueryInterface for IDXGISwapChain2 before setting latency.

Needed so BabylonNative can consume the latest bgfx.cmake pin on UWP.

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
bkaradzic-microsoft merged commit eb1e6a6 into master Aug 31, 2026
@bkaradzic-microsoft
bkaradzic-microsoft deleted the fix/uwp-swapchain2-frame-latency branch August 31, 2026 20:28
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
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants