Commit Graph

823 Commits

Author SHA1 Message Date
ShuangLiu1992
cceedb60cf Fix: reset s_renderFrameCalled in bgfx::shutdown() to allow re-init (#3690)
bgfx::renderFrame() sets s_renderFrameCalled = true on its first call
(line 1541) and never clears it. bgfx::shutdown() resets s_threadIndex
to 0 (line 3958) but leaves s_renderFrameCalled sticky, which means
that on a 2nd renderFrame after shutdown the gate at line 1534 still
runs BGFX_CHECK_RENDER_THREAD(). That assertion checks
(s_ctx != NULL && single-threaded) || (~BGFX_API_THREAD_MAGIC == s_threadIndex);
both branches fail post-shutdown (s_ctx is NULL, s_threadIndex is 0),
and the assertion fires in debug builds — blocking re-init of the
bgfx context within the same process.

Adding the symmetric s_renderFrameCalled reset to shutdown() makes
shutdown leave bgfx in the same state as a fresh process, so a
subsequent renderFrame()+init() pair behaves like the first one.

Verified locally: a downstream test that constructs an SDL+bgfx
context, runs a frame, destroys it, then constructs another from the
same thread now passes in debug builds with this patch (it asserts at
line 1536 without it).
2026-04-25 20:15:29 -07:00
Branimir Karadžić
e528e9d880 Fixed stremMask check. (#3681) 2026-04-21 11:15:04 -07:00
Branimir Karadžić
6c820091e4 macOS: Fixed deprecated warning. (#3672) 2026-04-19 01:36:19 +00:00
Branimir Karadžić
0b0ddb7f6b Added generate mips on frame buffer resolve. (#3664) 2026-04-17 05:04:57 +00:00
Branimir Karadžić
f3ad0e91af Removed bgfx::weldVertices. (#3659) 2026-04-13 01:30:57 +00:00
Branimir Karadžić
8532b2c45d Fix race between bgfx::begin and bgfx::frame encoder allocation. (#3646)
* Fix race between bgfx::begin and bgfx::frame encoder allocation.

* Update src/bgfx.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-25 21:36:02 -07:00
Matteo Valdina
fd8d480b28 Fix x86 crash: CreateTexture command buffer read uses wrong type (#3643)
The _external parameter is written to the command buffer as uint64_t (8 bytes)
but read back as uintptr_t (4 bytes on 32-bit). This causes a 4-byte
deserialization misalignment on x86, corrupting all subsequent command
buffer reads and leading to EXCEPTION_ACCESS_VIOLATION (0xC0000005) during
D3D11 initialization.

Co-authored-by: Matteo Valdina <mavaldin@microsoft.com>
2026-03-23 16:05:18 +00:00
Branimir Karadžić
b28febb4a8 NonLocalAllocator: Remove orphaned slabs. Fixed #2867. (#3625) 2026-03-08 04:02:40 +00:00
Branimir Karadžić
2721c747ae Added BGFX_FRAME_FLUSH. (#3623) 2026-03-07 04:50:46 +00:00
Branimir Karadžić
91814c9729 Added flag for texture formats that can be used as back-buffer format. (#3605) 2026-02-22 02:44:26 +00:00
Branimir Karadžić
651c203116 Undo default back buffer format. Fix VK. (#3604) 2026-02-20 03:14:27 +00:00
Branimir Karadžić
856208328c Use back buffer format when capturing screen shot. (#3603) 2026-02-20 00:46:41 +00:00
Branimir Karadžić
c85fa25266 Added BGFX_FRAME_* flags to add ability to discard all draw calls. (#3599) 2026-02-19 01:42:31 +00:00
Branimir Karadžić
40e614c45d Added external texture parameter. (#3596)
* Added external texture parameter.

* Use uint64_t instead of uintptr_t for external texture because VkImage is always 64-bit.
2026-02-18 20:12:37 +00:00
Martijn Courteaux
85d0b7ad3f Switch to BGRA8 as the default swapchain format. (#3569) 2026-01-30 18:58:02 +00:00
Branimir Karadžić
4baed6e076 Happy New Year! (#3550) 2026-01-14 16:26:51 +00:00
Branimir Karadžić
cded7e8d6c Fixed amalgamated build. (#3546) 2026-01-10 17:39:37 +00:00
Branimir Karadžić
868c66e1ed Added WebGPU. (#3544) 2026-01-10 04:09:39 +00:00
Branimir Karadžić
ae944eea43 Fixed MSAA texture validation. (#3529) 2025-12-31 22:30:19 +00:00
Бранимир Караџић
d19f3a5222 Validate that texutre supports MSAA. 2025-12-28 18:26:47 -08:00
Branimir Karadžić
241e9c3330 Added Init.fallback option. Cleanup. (#3522) 2025-12-24 04:29:32 +00:00
Branimir Karadžić
23410d248c Fixed build.a (#3513) 2025-12-13 20:46:12 +00:00
Branimir Karadžić
d396404fd3 Added Superluminal Profiler support. (#3504) 2025-11-21 19:08:12 +00:00
Бранимир Караџић
8a6a40108a Improved profiler colors. 2025-11-21 10:31:54 -08:00
Branimir Karadžić
f888f9d9a4 Fixed per view uniform order, and added more validation. (#3497) 2025-11-14 15:56:46 +00:00
Branimir Karadžić
35911ac2d9 Added uniform frequency. (#3485)
* Added uniform frequency.

* Cleanup.

* Cleanup.
2025-11-10 23:41:33 +00:00
Бранимир Караџић
8a9bc3ed65 EGL: Improved initialization. 2025-11-08 20:16:08 -08:00
Бранимир Караџић
358223c63e Added variable rate shading. 2025-11-06 17:21:53 -08:00
Бранимир Караџић
45df9833a9 Metal: Added ability to make capture programmatically. 2025-11-05 13:45:20 -08:00
Branimir Karadžić
5d8eb6d67c Cleanup. 2025-10-31 08:44:02 -07:00
Бранимир Караџић
6b84a02e26 Metal: Improve release macros to keep track of refcount. 2025-10-30 10:13:32 -07:00
ProPuke
df53a7ca84 Fixed: BGFX_TEXTURE_MSAA_SAMPLE and msaa sampling bugs with gl (#3351)
* fixed: multiple BGFX_TEXTURE_MSAA_SAMPLE attachments could not be present in a framebuffer at once (sample locations were not fixed)
I've just set the sample location as always fixed for now, although technically this can be false if only 1 msaa texture attachment is present

* fixed: framebuffer with a resolved msaa AND a sample msaa at the same time would result in an invalid framebuffer
it would try to also resolve the sample-msaa texture at the same, leading to an invalid target type

* fixed: depth attachments could not be sample-msaa
this is valid, they don't resolving

* fixed: shader error sampking msaa textures in gl
parameter duplication on texelFetch(sampler2DMS,*) led to failed shaders
2025-10-30 00:29:36 +00:00
Branimir Karadžić
16cf4f8683 Added ability to configure minimum uniform buffer size. 2025-10-29 16:06:17 -07:00
Бранимир Караџић
959cab248e Added ability to configure backbuffer depth/stencil. 2025-10-29 12:10:41 -07:00
Бранимир Караџић
52bac63cd7 Updated RenderDoc interface. 2025-10-26 22:43:43 -07:00
Бранимир Караџић
cd3749dac9 Cleanup. 2025-10-25 22:18:15 -07:00
Gary Hsu
e7c2c69edb Add optional layerIndex argument to overrideInternal (#3477)
* Add optional layerIndex argument to overrideInternal

* Run genie idl
2025-10-26 05:12:34 +00:00
Branimir Karadžić
a85a76c484 Fixed build. 2025-10-23 12:42:45 -07:00
Бранимир Караџић
89e24f1849 Fixed Android build. 2025-10-23 12:39:42 -07:00
Бранимир Караџић
577db969fb Removed unused code. 2025-10-20 16:15:30 -07:00
Branimir Karadžić
5eeed00aaa Replaced use of dynamic StringT with FixedStringT. 2025-09-19 20:38:26 -07:00
Branimir Karadžić
0c4e7e2283 Fixed warning. 2025-09-14 10:36:01 -07:00
korsil
2e73bbb962 fix blit dstDepth calculation using src.m_numLayers instead of dst.m_numLayers (#3460) 2025-09-14 15:48:36 +00:00
Vincent Bousquet
d763739516 Fix blitting between texture array layers (#3428) 2025-05-31 00:46:12 +00:00
Luigi Malomo
c8f237a39b Add u_invModelView uniform to shader and documentation (#3421) 2025-04-11 23:54:42 +00:00
Бранимир Караџић
72f9b8b516 Workaround VK scratch buffer issue. 2025-03-29 08:21:28 -07:00
Martijn Courteaux
abe193a407 Fix UniformBuffer UB regarding UniformType::Enum with extra bits. (#3398) 2025-01-28 09:58:22 -08:00
Бранимир Караџић
860bafb23f Happy New Year! 2025-01-13 15:45:40 -08:00
Бранимир Караџић
7b3e1ebf62 Revert "Fix: Fix Uniform buffer doing too many iterations when updating rende…" (#3391)
This reverts commit 4bc652939f.
2024-12-31 09:07:30 -08:00
Бранимир Караџић
896c610b72 Removing alloca compat include. 2024-12-21 19:25:00 -08:00