GroveEngine/tests/visual
StillHammer 63751d6f91 fix: Multi-texture sprite rendering - setState per batch + transient buffers
Fixed two critical bugs preventing multiple textured sprites from rendering correctly:

1. **setState consumed by submit**: Render state was set once at the beginning,
   but bgfx consumes state at each submit(). Batches 2+ had no state → invisible.

   FIX: Call setState() before EACH batch, not once globally.

2. **Buffer overwrite race condition**: updateBuffer() is immediate but submit()
   is deferred. When batch 2 called updateBuffer(), it overwrote batch 1's data
   BEFORE bgfx executed the draw calls. All batches used the last batch's data
   → all sprites rendered at the same position (superimposed).

   FIX: Use transient buffers (one per batch, frame-local) instead of reusing
   the same dynamic buffer. Each batch gets its own isolated memory.

Changes:
- SpritePass: setState before each batch + transient buffer allocation per batch
- UIRenderer: Retained mode rendering (render:sprite:add/update/remove)
- test_ui_showcase: Added 3 textured buttons demo section
- test_3buttons_minimal: Minimal test case for multi-texture debugging

Tested: 3 textured buttons now render at correct positions with correct textures.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-14 14:05:56 +07:00
..
README_FULL_STACK.md fix: Resolve bgfx Frame 1 crash on Windows DLL + MinGW GCC 15 compatibility 2025-12-30 11:03:06 +07:00
test_3buttons_minimal.cpp fix: Multi-texture sprite rendering - setState per batch + transient buffers 2026-01-14 14:05:56 +07:00
test_23_bgfx_sprites_visual.cpp feat(BgfxRenderer): Fix multi-texture batching and add particle effects 2025-11-28 17:15:45 +08:00
test_24_ui_basic.cpp feat: Complete UIModule Phase 7 - ScrollPanel & Tooltips 2025-11-29 07:13:13 +08:00
test_25_ui_layout.cpp feat: Complete UIModule Phase 7 - ScrollPanel & Tooltips 2025-11-29 07:13:13 +08:00
test_26_ui_buttons.cpp feat: Complete UIModule Phase 7 - ScrollPanel & Tooltips 2025-11-29 07:13:13 +08:00
test_28_ui_scroll.cpp feat: Complete UIModule Phase 7 - ScrollPanel & Tooltips 2025-11-29 07:13:13 +08:00
test_29_ui_advanced.cpp feat: Complete UIModule Phase 7 - ScrollPanel & Tooltips 2025-11-29 07:13:13 +08:00
test_30_input_module.cpp Migration Gitea 2025-12-04 20:15:53 +08:00
test_bgfx_device_only.cpp fix: UIModule button interaction + JsonDataNode array children support 2026-01-05 18:23:16 +07:00
test_bgfx_minimal_win.cpp fix: UIModule button interaction + JsonDataNode array children support 2026-01-05 18:23:16 +07:00
test_bgfx_sprites.cpp feat(BgfxRenderer): Complete Phase 4 - ShaderManager integration 2025-11-26 22:27:19 +08:00
test_bgfx_static_only.cpp fix: UIModule button interaction + JsonDataNode array children support 2026-01-05 18:23:16 +07:00
test_bgfx_triangle.cpp feat(BgfxRenderer): Complete Phase 2-3 with shaders and triangle rendering 2025-11-26 16:43:17 +08:00
test_filesystem.cpp fix: Resolve bgfx Frame 1 crash on Windows DLL + MinGW GCC 15 compatibility 2025-12-30 11:03:06 +07:00
test_full_stack_interactive.cpp fix: UIModule button interaction + JsonDataNode array children support 2026-01-05 18:23:16 +07:00
test_full_stack_interactive.cpp.orig fix: UIModule button interaction + JsonDataNode array children support 2026-01-05 18:23:16 +07:00
test_groveengine_link.cpp fix: Resolve bgfx Frame 1 crash on Windows DLL + MinGW GCC 15 compatibility 2025-12-30 11:03:06 +07:00
test_headers_progressive.cpp fix: Resolve bgfx Frame 1 crash on Windows DLL + MinGW GCC 15 compatibility 2025-12-30 11:03:06 +07:00
test_iio_only.cpp fix: Resolve bgfx Frame 1 crash on Windows DLL + MinGW GCC 15 compatibility 2025-12-30 11:03:06 +07:00
test_logger_direct.cpp fix: Resolve bgfx Frame 1 crash on Windows DLL + MinGW GCC 15 compatibility 2025-12-30 11:03:06 +07:00
test_logger_only.cpp fix: Resolve bgfx Frame 1 crash on Windows DLL + MinGW GCC 15 compatibility 2025-12-30 11:03:06 +07:00
test_minimal_sdl.cpp fix: Resolve bgfx Frame 1 crash on Windows DLL + MinGW GCC 15 compatibility 2025-12-30 11:03:06 +07:00
test_progressive.cpp fix: Resolve bgfx Frame 1 crash on Windows DLL + MinGW GCC 15 compatibility 2025-12-30 11:03:06 +07:00
test_renderer_showcase.cpp fix: UIModule button interaction + JsonDataNode array children support 2026-01-05 18:23:16 +07:00
test_sdl_groveengine.cpp fix: Resolve bgfx Frame 1 crash on Windows DLL + MinGW GCC 15 compatibility 2025-12-30 11:03:06 +07:00
test_single_button.cpp fix: UIModule button interaction + JsonDataNode array children support 2026-01-05 18:23:16 +07:00
test_spdlog_filesystem.cpp fix: Resolve bgfx Frame 1 crash on Windows DLL + MinGW GCC 15 compatibility 2025-12-30 11:03:06 +07:00
test_spdlog_only.cpp fix: Resolve bgfx Frame 1 crash on Windows DLL + MinGW GCC 15 compatibility 2025-12-30 11:03:06 +07:00
test_spdlog_register.cpp fix: Resolve bgfx Frame 1 crash on Windows DLL + MinGW GCC 15 compatibility 2025-12-30 11:03:06 +07:00
test_sprite_debug.cpp fix: UIModule button interaction + JsonDataNode array children support 2026-01-05 18:23:16 +07:00
test_ui_showcase.cpp fix: Multi-texture sprite rendering - setState per batch + transient buffers 2026-01-14 14:05:56 +07:00
test_use_sdl_and_iio.cpp fix: Resolve bgfx Frame 1 crash on Windows DLL + MinGW GCC 15 compatibility 2025-12-30 11:03:06 +07:00
test_use_sdl.cpp fix: Resolve bgfx Frame 1 crash on Windows DLL + MinGW GCC 15 compatibility 2025-12-30 11:03:06 +07:00
test_with_modules_include.cpp fix: Resolve bgfx Frame 1 crash on Windows DLL + MinGW GCC 15 compatibility 2025-12-30 11:03:06 +07:00