-
Notifications
You must be signed in to change notification settings - Fork 0
Procedural effect generation #98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Replace the PNG-based visual effect system with procedural generation: - Add effect_generate.c module that generates LINE, GRID, CRT, and SLOT patterns directly into pixel buffers at runtime - Rename EFFECT_GRILLE to EFFECT_CRT with enhanced RGB phosphor tints based on zfast_crt shader (cyan/blue/red vertical stripes + scanlines) - Remove EFFECT_getPatternPath() and EFFECT_getPatternScale() since PNG files are no longer needed - Add EFFECT_usesGeneration() and EFFECT_getGeneratedOpacity() for the new generation path - Update SDL1 platforms (miyoomini, rg35xx, trimuismart) to use EFFECT_createGeneratedSurface() - Update SDL2 platforms to use EFFECT_createGeneratedTexture() Benefits: - No external PNG dependencies (patterns generated on demand) - Per-pixel alpha control for better visual quality - CRT effect now has actual phosphor color tinting, not just shadows
"Grille" specifically describes the aperture grille technology (vertical RGB phosphor stripes + scanlines), while "CRT" is too generic since LINE and SLOT are also CRT-style effects.
- Restore constant global alpha (128/50%)
- Scale up pattern alphas (×2.833) to compensate: LINE {90→255, 2→6},
GRILLE scanlines 90→255, phosphor colors preserved at higher alphas
- Add visual_scale to track final on-screen appearance vs buffer scale
- Fix chunky effects in aspect mode (e.g., NES on TG5040 now uses
visual_scale=3 instead of buffer_scale=5)
- Fix effect alignment on SDL1 platforms by sampling from (0,0) and
rendering to content area (prevents 560p misalignment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request transitions from PNG-based effect patterns to procedural runtime generation of CRT/LCD display effects. The change eliminates 28 PNG resource files and introduces a new code-based pattern generation system that creates scanline, grid, aperture grille, and slot mask effects directly in memory.
Key Changes
- Introduces
effect_generate.c/hwith procedural pattern generation functions for LINE, GRID, GRILLE, and SLOT effects - Removes PNG loading infrastructure and replaces with runtime generation across all platforms
- Adds
visual_scaleparameter to handle GPU downscaling scenarios correctly - Updates opacity system to use constant 128 value instead of scale-dependent formula
- Removes 28 PNG pattern files (grid-2.png through slot-8.png) and generation script
Reviewed changes
Copilot reviewed 28 out of 56 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
| workspace/all/common/effect_generate.c | New procedural pattern generation with ARGB8888 pixel manipulation for all effect types |
| workspace/all/common/effect_generate.h | Public API for pattern generation functions |
| workspace/all/common/effect_system.c | Simplified to constant opacity (128), removed PNG path generation |
| workspace/all/common/effect_system.h | Updated documentation, added EFFECT_usesGeneration() function |
| workspace/all/common/effect_surface.c | Added generation wrappers for SDL1 surface creation |
| workspace/all/common/effect_surface.h | New API declarations for generated surfaces |
| workspace/all/common/effect_utils.c | Added generation wrappers for SDL2 texture creation |
| workspace/all/common/effect_utils.h | New API declarations for generated textures |
| workspace/all/common/render_sdl2.c | Updated to use procedural generation instead of PNG loading |
| workspace/all/common/api.h | Added visual_scale field to GFX_Renderer, updated effect type comments |
| workspace/all/player/player_scaler.c | Added visual_scale calculation for GPU-scaled modes |
| workspace/all/player/player_scaler.h | Added visual_scale field to struct |
| workspace/all/player/player.c | Updated to populate visual_scale field |
| workspace/trimuismart/platform/platform.c | Switched to procedural generation, improved effect alignment |
| workspace/rg35xx/platform/platform.c | Switched to procedural generation, improved effect alignment |
| workspace/miyoomini/platform/platform.c | Switched to procedural generation, added 560p variant support |
| workspace/miyoomini/platform/platform.h | Added VARIANT_MINI_STANDARD_560P variant and refactored macros |
| workspace/all/player/Makefile | Added effect_generate.c to build |
| workspace/all/launcher/Makefile | Added effect_generate.c to build |
| workspace/all/common/build.mk | Added effect_generate.c to build |
| Makefile.qa | Added effect_generate_test target |
| Makefile.dev | Added effect_generate.c to launcher build |
| tests/unit/all/common/test_effect_system.c | Updated tests, removed PNG-related tests |
| tests/unit/all/common/test_effect_generate.c | New comprehensive test suite with 24 tests |
| tests/unit/all/common/test_render_common.c | Added visual_scale to test fixtures |
| tests/README.md | Updated test counts and added effect_generate.c section |
| docs/retro-effects.md | Updated documentation to reflect procedural generation |
| scripts/generate-effect-patterns.py | Removed PNG generation script (no longer needed) |
| skeleton/SYSTEM/res/*.png | Removed 28 PNG pattern files |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
596d34d to
6bd009d
Compare
6bd009d to
e2cd07e
Compare
This pull request transitions from PNG-based effect patterns to procedural runtime generation of CRT/LCD display effects. The change eliminates 28 PNG resource files and introduces a new code-based pattern generation system that creates scanline, grid, aperture grille, and slot mask effects directly in memory.