refactor: JA_Sound_t RAII — buffer amb unique_ptr + SDLFreeDeleter, elimina JA_NewSound
This commit is contained in:
@@ -5,7 +5,9 @@
|
||||
|
||||
#include "core/locale/locale.hpp"
|
||||
#include "core/rendering/overlay.hpp"
|
||||
#ifndef NO_SHADERS
|
||||
#include "core/rendering/sdl3gpu/sdl3gpu_shader.hpp"
|
||||
#endif
|
||||
#include "game/defines.hpp"
|
||||
#include "game/options.hpp"
|
||||
#include "utils/utils.hpp"
|
||||
@@ -56,10 +58,12 @@ Screen::~Screen() {
|
||||
Options::window.zoom = zoom_;
|
||||
Options::window.fullscreen = fullscreen_;
|
||||
|
||||
// Destrueix el backend GPU
|
||||
// Destrueix el backend GPU (només existeix si s'ha compilat amb shaders)
|
||||
if (shader_backend_) {
|
||||
#ifndef NO_SHADERS
|
||||
auto* gpu = dynamic_cast<Rendering::SDL3GPUShader*>(shader_backend_.get());
|
||||
if (gpu) gpu->destroy();
|
||||
#endif
|
||||
shader_backend_.reset();
|
||||
}
|
||||
|
||||
@@ -69,6 +73,13 @@ Screen::~Screen() {
|
||||
}
|
||||
|
||||
void Screen::initShaders() {
|
||||
#ifdef NO_SHADERS
|
||||
// Build sense shaders (p.ex. emscripten/WebGL2, on SDL3 GPU no està
|
||||
// disponible). Es salta tota la inicialització — shader_backend_ es
|
||||
// queda nul·lptr i tots els `if (shader_backend_)` del render path
|
||||
// curtcircuiten cap al fallback SDL_Renderer.
|
||||
return;
|
||||
#else
|
||||
if (!Options::video.gpu_acceleration) return;
|
||||
|
||||
shader_backend_ = std::make_unique<Rendering::SDL3GPUShader>();
|
||||
@@ -122,6 +133,7 @@ void Screen::initShaders() {
|
||||
|
||||
applyCurrentPostFXPreset();
|
||||
applyCurrentCrtPiPreset();
|
||||
#endif
|
||||
}
|
||||
|
||||
void Screen::present(Uint32* pixel_data) {
|
||||
|
||||
Reference in New Issue
Block a user