Commit 755d205
committed
bugfix(bgfx): Sample the scene composite the right way up on GLES
The composite pass reads the scene render target back to the swapchain with a
fullscreen triangle. Render targets are bottom-left origin on GLES and WebGL but
top-left on DX11 and Metal, and nothing accounted for that: the vertex shader
built one fixed set of texture coordinates and the backend passed a hardcoded 0
where the flip flag belongs.
So everything that goes through the composite - the whole 3D scene - came out
vertically mirrored on those renderers, while the UI, which draws straight to the
swapchain, stayed upright. That reads as "the game is upside down but the menus
are not".
Carry the flag in u_postTexelSize.z again, from bgfx's originBottomLeft cap, and
flip V in the vertex shader when it is set. DX11 and Metal report false and pass
0.0, so they are byte-for-byte unaffected.1 parent 156e7a2 commit 755d205
2 files changed
Lines changed: 20 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4045 | 4045 | | |
4046 | 4046 | | |
4047 | 4047 | | |
| 4048 | + | |
| 4049 | + | |
| 4050 | + | |
| 4051 | + | |
| 4052 | + | |
4048 | 4053 | | |
4049 | 4054 | | |
4050 | 4055 | | |
4051 | | - | |
| 4056 | + | |
4052 | 4057 | | |
4053 | 4058 | | |
4054 | 4059 | | |
| |||
Lines changed: 14 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
10 | 17 | | |
11 | 18 | | |
12 | 19 | | |
13 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
14 | 27 | | |
0 commit comments