Commit 5adc34d
[Native] Add cube render target support to the native engine (#18561)
Paired native PR: BabylonJS/BabylonNative#1750
## What
Adds cube render target support to the Babylon Native engine. Previously
the
native engine had no `createRenderTargetCubeTexture` override and
`bindFramebuffer(faceIndex)` threw, so any feature that renders into a
cube map
— `ReflectionProbe`, point-light cube shadow maps — fell through to the
WebGL
code path and dereferenced the null `_gl` context (`TEXTURE_CUBE_MAP
undefined`).
## Changes (`packages/dev/core/src/Engines`)
- `thinNativeEngine.pure.ts`
- `createRenderTargetCubeTexture`: creates a native cube color texture
and one
framebuffer per face (the native side binds the matching cube layer).
- `bindFramebuffer`: binds the per-face framebuffer for cube render
targets.
- `generateMipMapsForCubemap`: no-op on Native — bgfx auto-generates the
mip
chain on render-target resolve, the same way 2D RTTs get their mips.
- `Native/nativeRenderTargetWrapper.ts`: tracks per-face framebuffers
and
releases them on dispose.
- `Native/nativeInterfaces.ts`: threads the cube/layer params through
`initializeTexture` and `createFrameBuffer`.
## Paired native change
Requires the matching BabylonNative C++ change (cube color texture +
per-face
attachment). Draft until both land.
## Testing
Built `babylon.max.js` and ran the BabylonNative Playground validation
suite
(D3D11). The "Shadows with instances" tests (left/right handed), which
previously crashed, now pass; the ReflectionProbe and point-light-shadow
scenes
render with correct geometry and orientation.
---
## Related PRs & landing order
- **Babylon.js (engine / TS):**
#18561
- **BabylonNative (C++ engine + test re-enable):**
BabylonJS/BabylonNative#1750
Co-dependent; land in this order:
1. **Babylon.js #18561 first** — adds the cube render-target TS
overrides; no WebGL behavior change.
2. A **`babylonjs` npm release** ships that TS change.
3. **BabylonNative #1750 last** — bumps the bundled `babylonjs` and
re-enables the 2 `Shadows with instances` (left/right handed) validation
tests, which only pass once the paired JS is present in the bundled
engine.
---------
Co-authored-by: Branimir Karadzic <branimirkaradzic@gmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 4d4dad2 commit 5adc34d
3 files changed
Lines changed: 168 additions & 16 deletions
File tree
- packages/dev/core/src/Engines
- Native
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
65 | 75 | | |
66 | 76 | | |
67 | 77 | | |
| |||
101 | 111 | | |
102 | 112 | | |
103 | 113 | | |
104 | | - | |
| 114 | + | |
| 115 | + | |
105 | 116 | | |
106 | 117 | | |
107 | 118 | | |
| |||
Lines changed: 25 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
| |||
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
26 | 44 | | |
27 | 45 | | |
28 | 46 | | |
| |||
40 | 58 | | |
41 | 59 | | |
42 | 60 | | |
43 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
44 | 68 | | |
45 | 69 | | |
46 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2359 | 2359 | | |
2360 | 2360 | | |
2361 | 2361 | | |
| 2362 | + | |
| 2363 | + | |
| 2364 | + | |
| 2365 | + | |
| 2366 | + | |
| 2367 | + | |
| 2368 | + | |
| 2369 | + | |
| 2370 | + | |
| 2371 | + | |
| 2372 | + | |
| 2373 | + | |
| 2374 | + | |
| 2375 | + | |
| 2376 | + | |
| 2377 | + | |
| 2378 | + | |
| 2379 | + | |
| 2380 | + | |
| 2381 | + | |
| 2382 | + | |
| 2383 | + | |
| 2384 | + | |
| 2385 | + | |
| 2386 | + | |
| 2387 | + | |
| 2388 | + | |
| 2389 | + | |
| 2390 | + | |
| 2391 | + | |
| 2392 | + | |
| 2393 | + | |
| 2394 | + | |
| 2395 | + | |
| 2396 | + | |
| 2397 | + | |
| 2398 | + | |
| 2399 | + | |
| 2400 | + | |
| 2401 | + | |
| 2402 | + | |
| 2403 | + | |
| 2404 | + | |
| 2405 | + | |
| 2406 | + | |
| 2407 | + | |
| 2408 | + | |
| 2409 | + | |
| 2410 | + | |
| 2411 | + | |
| 2412 | + | |
| 2413 | + | |
| 2414 | + | |
| 2415 | + | |
| 2416 | + | |
| 2417 | + | |
| 2418 | + | |
| 2419 | + | |
| 2420 | + | |
| 2421 | + | |
| 2422 | + | |
| 2423 | + | |
| 2424 | + | |
| 2425 | + | |
| 2426 | + | |
| 2427 | + | |
| 2428 | + | |
| 2429 | + | |
| 2430 | + | |
| 2431 | + | |
| 2432 | + | |
| 2433 | + | |
| 2434 | + | |
| 2435 | + | |
| 2436 | + | |
| 2437 | + | |
| 2438 | + | |
| 2439 | + | |
| 2440 | + | |
| 2441 | + | |
| 2442 | + | |
| 2443 | + | |
| 2444 | + | |
| 2445 | + | |
2362 | 2446 | | |
2363 | 2447 | | |
2364 | 2448 | | |
| |||
2404 | 2488 | | |
2405 | 2489 | | |
2406 | 2490 | | |
2407 | | - | |
2408 | | - | |
2409 | | - | |
2410 | | - | |
2411 | | - | |
| 2491 | + | |
| 2492 | + | |
2412 | 2493 | | |
2413 | 2494 | | |
2414 | 2495 | | |
2415 | | - | |
2416 | | - | |
2417 | | - | |
| 2496 | + | |
| 2497 | + | |
| 2498 | + | |
| 2499 | + | |
| 2500 | + | |
| 2501 | + | |
2418 | 2502 | | |
2419 | 2503 | | |
| 2504 | + | |
| 2505 | + | |
| 2506 | + | |
| 2507 | + | |
| 2508 | + | |
| 2509 | + | |
| 2510 | + | |
| 2511 | + | |
| 2512 | + | |
| 2513 | + | |
| 2514 | + | |
| 2515 | + | |
| 2516 | + | |
| 2517 | + | |
| 2518 | + | |
| 2519 | + | |
| 2520 | + | |
| 2521 | + | |
| 2522 | + | |
| 2523 | + | |
| 2524 | + | |
| 2525 | + | |
| 2526 | + | |
| 2527 | + | |
| 2528 | + | |
| 2529 | + | |
| 2530 | + | |
| 2531 | + | |
| 2532 | + | |
| 2533 | + | |
| 2534 | + | |
| 2535 | + | |
2420 | 2536 | | |
2421 | 2537 | | |
2422 | 2538 | | |
| |||
2440 | 2556 | | |
2441 | 2557 | | |
2442 | 2558 | | |
2443 | | - | |
2444 | | - | |
2445 | | - | |
2446 | | - | |
2447 | 2559 | | |
2448 | 2560 | | |
2449 | 2561 | | |
2450 | 2562 | | |
2451 | | - | |
| 2563 | + | |
| 2564 | + | |
| 2565 | + | |
| 2566 | + | |
| 2567 | + | |
| 2568 | + | |
2452 | 2569 | | |
2453 | 2570 | | |
2454 | 2571 | | |
| |||
0 commit comments