build: unifica .clang-format/.clang-tidy i exclou external/ i spv/ amb dummies
This commit is contained in:
79
.clang-tidy
Normal file
79
.clang-tidy
Normal file
@@ -0,0 +1,79 @@
|
||||
Checks:
|
||||
- readability-*
|
||||
- modernize-*
|
||||
- performance-*
|
||||
- bugprone-*
|
||||
- -readability-identifier-length
|
||||
- -readability-magic-numbers
|
||||
- -bugprone-integer-division
|
||||
- -bugprone-easily-swappable-parameters
|
||||
- -bugprone-narrowing-conversions
|
||||
- -modernize-avoid-c-arrays,-warnings-as-errors
|
||||
|
||||
WarningsAsErrors: '*'
|
||||
# Solo headers del propio código fuente (external/ y spv/ tienen su propio .clang-tidy dummy)
|
||||
HeaderFilterRegex: 'source/.*'
|
||||
FormatStyle: file
|
||||
|
||||
CheckOptions:
|
||||
# bugprone-empty-catch: aceptar catches vacíos marcados con @INTENTIONAL en un comentario
|
||||
- { key: bugprone-empty-catch.IgnoreCatchWithKeywords, value: '@INTENTIONAL' }
|
||||
|
||||
# Variables locales en snake_case
|
||||
- { key: readability-identifier-naming.VariableCase, value: lower_case }
|
||||
|
||||
# Miembros privados en snake_case con sufijo _
|
||||
- { key: readability-identifier-naming.PrivateMemberCase, value: lower_case }
|
||||
- { key: readability-identifier-naming.PrivateMemberSuffix, value: _ }
|
||||
|
||||
# Miembros protegidos en snake_case con sufijo _
|
||||
- { key: readability-identifier-naming.ProtectedMemberCase, value: lower_case }
|
||||
- { key: readability-identifier-naming.ProtectedMemberSuffix, value: _ }
|
||||
|
||||
# Miembros públicos en snake_case (sin sufijo)
|
||||
- { key: readability-identifier-naming.PublicMemberCase, value: lower_case }
|
||||
|
||||
# Namespaces en CamelCase
|
||||
- { key: readability-identifier-naming.NamespaceCase, value: CamelCase }
|
||||
|
||||
# Variables estáticas privadas como miembros privados
|
||||
- { key: readability-identifier-naming.StaticVariableCase, value: lower_case }
|
||||
- { key: readability-identifier-naming.StaticVariableSuffix, value: _ }
|
||||
|
||||
# Constantes estáticas sin sufijo
|
||||
- { key: readability-identifier-naming.StaticConstantCase, value: UPPER_CASE }
|
||||
|
||||
# Constantes globales en UPPER_CASE
|
||||
- { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE }
|
||||
|
||||
# Variables constexpr globales en UPPER_CASE
|
||||
- { key: readability-identifier-naming.ConstexprVariableCase, value: UPPER_CASE }
|
||||
|
||||
# Constantes locales en UPPER_CASE
|
||||
- { key: readability-identifier-naming.LocalConstantCase, value: UPPER_CASE }
|
||||
|
||||
# Constexpr miembros en UPPER_CASE (sin sufijo)
|
||||
- { key: readability-identifier-naming.ConstexprMemberCase, value: UPPER_CASE }
|
||||
|
||||
# Constexpr miembros privados/protegidos con sufijo _
|
||||
- { key: readability-identifier-naming.ConstexprMethodCase, value: UPPER_CASE }
|
||||
|
||||
# Clases, structs y enums en CamelCase
|
||||
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
|
||||
- { key: readability-identifier-naming.StructCase, value: CamelCase }
|
||||
- { key: readability-identifier-naming.EnumCase, value: CamelCase }
|
||||
|
||||
# Valores de enums en UPPER_CASE
|
||||
- { key: readability-identifier-naming.EnumConstantCase, value: UPPER_CASE }
|
||||
|
||||
# Métodos en camelBack (sin sufijos)
|
||||
- { key: readability-identifier-naming.MethodCase, value: camelBack }
|
||||
- { key: readability-identifier-naming.PrivateMethodCase, value: camelBack }
|
||||
- { key: readability-identifier-naming.ProtectedMethodCase, value: camelBack }
|
||||
- { key: readability-identifier-naming.PublicMethodCase, value: camelBack }
|
||||
|
||||
# Funciones en camelBack
|
||||
- { key: readability-identifier-naming.FunctionCase, value: camelBack }
|
||||
|
||||
# Parámetros en lower_case
|
||||
- { key: readability-identifier-naming.ParameterCase, value: lower_case }
|
||||
@@ -3,6 +3,11 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(aee VERSION 1.00)
|
||||
|
||||
# Tipus de build per defecte (Debug) si no se n'ha especificat cap
|
||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
set(CMAKE_BUILD_TYPE Debug CACHE STRING "" FORCE)
|
||||
endif()
|
||||
|
||||
# Estándar de C++
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
@@ -136,7 +141,7 @@ if(NOT APPLE AND NOT EMSCRIPTEN)
|
||||
find_program(GLSLC_EXE NAMES glslc)
|
||||
|
||||
set(SHADERS_DIR "${CMAKE_SOURCE_DIR}/data/shaders")
|
||||
set(HEADERS_DIR "${CMAKE_SOURCE_DIR}/source/core/rendering/sdl3gpu")
|
||||
set(HEADERS_DIR "${CMAKE_SOURCE_DIR}/source/core/rendering/sdl3gpu/spv")
|
||||
|
||||
set(ALL_SHADER_HEADERS
|
||||
"${HEADERS_DIR}/postfx_vert_spv.h"
|
||||
@@ -302,9 +307,7 @@ file(GLOB_RECURSE ALL_SOURCE_FILES
|
||||
)
|
||||
list(FILTER ALL_SOURCE_FILES EXCLUDE REGEX ".*/external/.*")
|
||||
|
||||
# Para clang-tidy, excluir headers SPIR-V generados
|
||||
set(CLANG_TIDY_SOURCES ${ALL_SOURCE_FILES})
|
||||
list(FILTER CLANG_TIDY_SOURCES EXCLUDE REGEX ".*_spv\\.h$")
|
||||
|
||||
# Para cppcheck, pasar solo .cpp (los headers se procesan transitivamente).
|
||||
set(CPPCHECK_SOURCES ${ALL_SOURCE_FILES})
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -31,17 +31,18 @@ namespace Gamepad {
|
||||
|
||||
char mapping[512];
|
||||
SDL_snprintf(mapping, sizeof(mapping),
|
||||
"%s,%s,"
|
||||
"a:b0,b:b1,x:b2,y:b3,"
|
||||
"leftshoulder:b4,rightshoulder:b5,"
|
||||
"lefttrigger:b6,righttrigger:b7,"
|
||||
"back:b8,start:b9,"
|
||||
"leftstick:b10,rightstick:b11,"
|
||||
"dpup:b12,dpdown:b13,dpleft:b14,dpright:b15,"
|
||||
"guide:b16,"
|
||||
"leftx:a0,lefty:a1,rightx:a2,righty:a3,"
|
||||
"platform:Emscripten",
|
||||
guidStr, name);
|
||||
"%s,%s,"
|
||||
"a:b0,b:b1,x:b2,y:b3,"
|
||||
"leftshoulder:b4,rightshoulder:b5,"
|
||||
"lefttrigger:b6,righttrigger:b7,"
|
||||
"back:b8,start:b9,"
|
||||
"leftstick:b10,rightstick:b11,"
|
||||
"dpup:b12,dpdown:b13,dpleft:b14,dpright:b15,"
|
||||
"guide:b16,"
|
||||
"leftx:a0,lefty:a1,rightx:a2,righty:a3,"
|
||||
"platform:Emscripten",
|
||||
guidStr,
|
||||
name);
|
||||
SDL_AddGamepadMapping(mapping);
|
||||
#else
|
||||
(void)jid;
|
||||
|
||||
@@ -43,9 +43,9 @@ namespace Menu {
|
||||
static constexpr int SUBTITLE_H = 8 + 3; // línia de subtítol + gap
|
||||
|
||||
// --- Animació ---
|
||||
static constexpr float OPEN_SPEED = 8.0F; // 1.0 / 0.125s
|
||||
static constexpr float CLOSE_SPEED = 10.0F; // 1.0 / 0.1s (una mica més ràpida que l'obertura)
|
||||
static constexpr float HEIGHT_RATE = 12.0F; // smoothing exponencial de l'alçada (~150 ms al 90%)
|
||||
static constexpr float OPEN_SPEED = 8.0F; // 1.0 / 0.125s
|
||||
static constexpr float CLOSE_SPEED = 10.0F; // 1.0 / 0.1s (una mica més ràpida que l'obertura)
|
||||
static constexpr float HEIGHT_RATE = 12.0F; // smoothing exponencial de l'alçada (~150 ms al 90%)
|
||||
|
||||
// --- Items ---
|
||||
enum class ItemKind { Toggle,
|
||||
@@ -89,11 +89,11 @@ namespace Menu {
|
||||
// --- Estat ---
|
||||
static std::vector<Page> stack_;
|
||||
static std::unique_ptr<Text> font_;
|
||||
static float open_anim_{0.0F}; // 0 = tancat, 1 = obert
|
||||
static float open_anim_{0.0F}; // 0 = tancat, 1 = obert
|
||||
static float animated_h_{0.0F}; // alçada actual animada (smoothing cap al target visible)
|
||||
static Uint32 last_ticks_{0};
|
||||
static SDL_Scancode* capturing_{nullptr}; // != null → esperant tecla per assignar
|
||||
static bool closing_{false}; // true mentre l'animació de tancament és en curs
|
||||
static bool closing_{false}; // true mentre l'animació de tancament és en curs
|
||||
|
||||
// --- Transició entre pàgines ---
|
||||
static constexpr float TRANSITION_SPEED = 5.5F; // ~180 ms
|
||||
@@ -171,10 +171,9 @@ namespace Menu {
|
||||
}
|
||||
return std::string(Locale::get("menu.values.scaling_integer")); }, [](int dir) { Screen::get()->cycleScalingMode(dir); }, nullptr, nullptr, nullptr});
|
||||
|
||||
p.items.push_back({Locale::get("menu.items.texture_filter"), ItemKind::Cycle, [] {
|
||||
return std::string(Options::video.texture_filter == Options::TextureFilter::LINEAR
|
||||
? Locale::get("menu.values.linear")
|
||||
: Locale::get("menu.values.nearest")); }, [](int dir) { Screen::get()->cycleTextureFilter(dir); }, nullptr, nullptr, nullptr});
|
||||
p.items.push_back({Locale::get("menu.items.texture_filter"), ItemKind::Cycle, [] { return std::string(Options::video.texture_filter == Options::TextureFilter::LINEAR
|
||||
? Locale::get("menu.values.linear")
|
||||
: Locale::get("menu.values.nearest")); }, [](int dir) { Screen::get()->cycleTextureFilter(dir); }, nullptr, nullptr, nullptr});
|
||||
|
||||
p.items.push_back({Locale::get("menu.items.internal_resolution"), ItemKind::IntRange, [] {
|
||||
char buf[16];
|
||||
@@ -187,20 +186,16 @@ namespace Menu {
|
||||
|
||||
p.items.push_back({Locale::get("menu.items.shader_type"), ItemKind::Cycle, [] { return std::string(Screen::get()->getActiveShaderName()); }, [](int dir) {
|
||||
if (dir < 0) Screen::get()->prevShaderType();
|
||||
else Screen::get()->nextShaderType(); }, nullptr, nullptr,
|
||||
[] { return Options::video.shader_enabled; }});
|
||||
else Screen::get()->nextShaderType(); }, nullptr, nullptr, [] { return Options::video.shader_enabled; }});
|
||||
|
||||
p.items.push_back({Locale::get("menu.items.preset"), ItemKind::Cycle, [] { return std::string(Screen::get()->getCurrentPresetName()); }, [](int dir) {
|
||||
if (dir < 0) Screen::get()->prevPreset();
|
||||
else Screen::get()->nextPreset(); }, nullptr, nullptr,
|
||||
[] { return Options::video.shader_enabled; }});
|
||||
else Screen::get()->nextPreset(); }, nullptr, nullptr, [] { return Options::video.shader_enabled; }});
|
||||
|
||||
p.items.push_back({Locale::get("menu.items.supersampling"), ItemKind::Toggle, [] { return onOff(Options::video.supersampling); }, [](int) { Screen::get()->toggleSupersampling(); }, nullptr, nullptr,
|
||||
[] {
|
||||
p.items.push_back({Locale::get("menu.items.supersampling"), ItemKind::Toggle, [] { return onOff(Options::video.supersampling); }, [](int) { Screen::get()->toggleSupersampling(); }, nullptr, nullptr, [] {
|
||||
if (!Options::video.shader_enabled) return false;
|
||||
const char* name = Screen::get()->getActiveShaderName();
|
||||
return name && std::string(name) == "POSTFX";
|
||||
}});
|
||||
return name && std::string(name) == "POSTFX"; }});
|
||||
#endif
|
||||
|
||||
// Informació de render
|
||||
@@ -212,8 +207,7 @@ namespace Menu {
|
||||
}
|
||||
return std::string(Locale::get("menu.values.off")); }, [](int dir) { Overlay::cycleRenderInfo(dir); }, nullptr, nullptr, nullptr});
|
||||
|
||||
p.items.push_back({Locale::get("menu.items.uptime"), ItemKind::Toggle, [] { return onOff(Options::render_info.show_time); }, [](int) { Options::render_info.show_time = !Options::render_info.show_time; }, nullptr, nullptr,
|
||||
[] { return Options::render_info.position != Options::RenderInfoPosition::OFF; }});
|
||||
p.items.push_back({Locale::get("menu.items.uptime"), ItemKind::Toggle, [] { return onOff(Options::render_info.show_time); }, [](int) { Options::render_info.show_time = !Options::render_info.show_time; }, nullptr, nullptr, [] { return Options::render_info.position != Options::RenderInfoPosition::OFF; }});
|
||||
|
||||
return p;
|
||||
}
|
||||
@@ -285,15 +279,17 @@ namespace Menu {
|
||||
p.subtitle = std::string("v") + Texts::VERSION + " (" + Version::GIT_HASH + ")";
|
||||
|
||||
p.items.push_back({Locale::get("menu.items.restart"), ItemKind::Action, nullptr, nullptr, [] {
|
||||
if (Director::get()) Director::get()->requestRestart();
|
||||
},
|
||||
nullptr, nullptr});
|
||||
if (Director::get()) Director::get()->requestRestart();
|
||||
},
|
||||
nullptr,
|
||||
nullptr});
|
||||
|
||||
#ifndef __EMSCRIPTEN__
|
||||
p.items.push_back({Locale::get("menu.items.exit_game"), ItemKind::Action, nullptr, nullptr, [] {
|
||||
if (Director::get()) Director::get()->requestQuit();
|
||||
},
|
||||
nullptr, nullptr});
|
||||
if (Director::get()) Director::get()->requestQuit();
|
||||
},
|
||||
nullptr,
|
||||
nullptr});
|
||||
#endif
|
||||
|
||||
return p;
|
||||
@@ -527,7 +523,8 @@ namespace Menu {
|
||||
}
|
||||
// Compta visibles — si cap, dibuixa placeholder (caixa totalment col·lapsada però oberta)
|
||||
int visible_count = 0;
|
||||
for (const auto& it : page.items) if (isVisible(it)) ++visible_count;
|
||||
for (const auto& it : page.items)
|
||||
if (isVisible(it)) ++visible_count;
|
||||
if (visible_count == 0) {
|
||||
const char* empty_text = Locale::get("menu.values.empty");
|
||||
int ew = font_->width(empty_text);
|
||||
|
||||
@@ -32,26 +32,26 @@
|
||||
// resincronitzar l'estat intern de SDL — sense això la logical presentation
|
||||
// no encaixa amb el canvas real.
|
||||
namespace {
|
||||
Screen* g_screen_instance = nullptr;
|
||||
Screen* g_screen_instance = nullptr;
|
||||
|
||||
void deferredCanvasResize(void* /*userData*/) {
|
||||
if (g_screen_instance != nullptr) {
|
||||
g_screen_instance->handleCanvasResized();
|
||||
void deferredCanvasResize(void* /*userData*/) {
|
||||
if (g_screen_instance != nullptr) {
|
||||
g_screen_instance->handleCanvasResized();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EM_BOOL onEmFullscreenChange(int /*eventType*/, const EmscriptenFullscreenChangeEvent* event, void* /*userData*/) {
|
||||
if (g_screen_instance != nullptr && event != nullptr) {
|
||||
g_screen_instance->syncFullscreenFlagFromBrowser(event->isFullscreen != 0);
|
||||
EM_BOOL onEmFullscreenChange(int /*eventType*/, const EmscriptenFullscreenChangeEvent* event, void* /*userData*/) {
|
||||
if (g_screen_instance != nullptr && event != nullptr) {
|
||||
g_screen_instance->syncFullscreenFlagFromBrowser(event->isFullscreen != 0);
|
||||
}
|
||||
emscripten_async_call(deferredCanvasResize, nullptr, 0);
|
||||
return EM_FALSE;
|
||||
}
|
||||
emscripten_async_call(deferredCanvasResize, nullptr, 0);
|
||||
return EM_FALSE;
|
||||
}
|
||||
|
||||
EM_BOOL onEmOrientationChange(int /*eventType*/, const EmscriptenOrientationChangeEvent* /*event*/, void* /*userData*/) {
|
||||
emscripten_async_call(deferredCanvasResize, nullptr, 0);
|
||||
return EM_FALSE;
|
||||
}
|
||||
EM_BOOL onEmOrientationChange(int /*eventType*/, const EmscriptenOrientationChangeEvent* /*event*/, void* /*userData*/) {
|
||||
emscripten_async_call(deferredCanvasResize, nullptr, 0);
|
||||
return EM_FALSE;
|
||||
}
|
||||
} // namespace
|
||||
#endif // __EMSCRIPTEN__
|
||||
|
||||
@@ -356,8 +356,8 @@ void Screen::cycleTextureFilter(int dir) {
|
||||
(void)dir;
|
||||
Options::video.texture_filter =
|
||||
(Options::video.texture_filter == Options::TextureFilter::LINEAR)
|
||||
? Options::TextureFilter::NEAREST
|
||||
: Options::TextureFilter::LINEAR;
|
||||
? Options::TextureFilter::NEAREST
|
||||
: Options::TextureFilter::LINEAR;
|
||||
if (shader_backend_) {
|
||||
shader_backend_->setTextureFilter(Options::video.texture_filter);
|
||||
} else {
|
||||
@@ -543,8 +543,8 @@ void Screen::applyFallbackPresentation() {
|
||||
// Fallback SDL_Renderer (p.ex. emscripten/WebGL2 sense shaders GPU).
|
||||
// Filtre global (texture_filter) s'aplica sempre, independent de 4:3.
|
||||
SDL_ScaleMode scale = (Options::video.texture_filter == Options::TextureFilter::LINEAR)
|
||||
? SDL_SCALEMODE_LINEAR
|
||||
: SDL_SCALEMODE_NEAREST;
|
||||
? SDL_SCALEMODE_LINEAR
|
||||
: SDL_SCALEMODE_NEAREST;
|
||||
if (texture_) SDL_SetTextureScaleMode(texture_, scale);
|
||||
|
||||
// Si 4:3 actiu, la finestra ja té aspect 4:3 (alçada × 1.2); STRETCH és
|
||||
@@ -555,11 +555,21 @@ void Screen::applyFallbackPresentation() {
|
||||
mode = SDL_LOGICAL_PRESENTATION_STRETCH;
|
||||
} else {
|
||||
switch (Options::video.scaling_mode) {
|
||||
case Options::ScalingMode::DISABLED: mode = SDL_LOGICAL_PRESENTATION_DISABLED; break;
|
||||
case Options::ScalingMode::STRETCH: mode = SDL_LOGICAL_PRESENTATION_STRETCH; break;
|
||||
case Options::ScalingMode::LETTERBOX: mode = SDL_LOGICAL_PRESENTATION_LETTERBOX; break;
|
||||
case Options::ScalingMode::OVERSCAN: mode = SDL_LOGICAL_PRESENTATION_OVERSCAN; break;
|
||||
case Options::ScalingMode::INTEGER: mode = SDL_LOGICAL_PRESENTATION_INTEGER_SCALE; break;
|
||||
case Options::ScalingMode::DISABLED:
|
||||
mode = SDL_LOGICAL_PRESENTATION_DISABLED;
|
||||
break;
|
||||
case Options::ScalingMode::STRETCH:
|
||||
mode = SDL_LOGICAL_PRESENTATION_STRETCH;
|
||||
break;
|
||||
case Options::ScalingMode::LETTERBOX:
|
||||
mode = SDL_LOGICAL_PRESENTATION_LETTERBOX;
|
||||
break;
|
||||
case Options::ScalingMode::OVERSCAN:
|
||||
mode = SDL_LOGICAL_PRESENTATION_OVERSCAN;
|
||||
break;
|
||||
case Options::ScalingMode::INTEGER:
|
||||
mode = SDL_LOGICAL_PRESENTATION_INTEGER_SCALE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Amb resolució interna N > 1, la mida lògica creix proporcionalment
|
||||
|
||||
@@ -28,16 +28,16 @@ class Screen {
|
||||
// no es complia. Els callers (F-keys, menú) poden suprimir notificacions
|
||||
// o feedback quan la crida no ha tingut efecte.
|
||||
void toggleShaders();
|
||||
auto toggleSupersampling() -> bool; // false si GPU off / shaders off / actiu != POSTFX
|
||||
auto toggleSupersampling() -> bool; // false si GPU off / shaders off / actiu != POSTFX
|
||||
void toggleAspectRatio();
|
||||
void cycleScalingMode(int dir); // Cicla DISABLED/STRETCH/LETTERBOX/OVERSCAN/INTEGER
|
||||
void cycleScalingMode(int dir); // Cicla DISABLED/STRETCH/LETTERBOX/OVERSCAN/INTEGER
|
||||
void toggleVSync();
|
||||
void cycleTextureFilter(int dir); // Cicla NEAREST/LINEAR
|
||||
void changeInternalResolution(int dir); // +/−1, clampat a [1, max_zoom_]
|
||||
auto nextShaderType() -> bool; // false si GPU off / shaders off
|
||||
auto prevShaderType() -> bool; // idem
|
||||
auto nextPreset() -> bool; // false si GPU off / shaders off
|
||||
auto prevPreset() -> bool; // idem
|
||||
void cycleTextureFilter(int dir); // Cicla NEAREST/LINEAR
|
||||
void changeInternalResolution(int dir); // +/−1, clampat a [1, max_zoom_]
|
||||
auto nextShaderType() -> bool; // false si GPU off / shaders off
|
||||
auto prevShaderType() -> bool; // idem
|
||||
auto nextPreset() -> bool; // false si GPU off / shaders off
|
||||
auto prevPreset() -> bool; // idem
|
||||
[[nodiscard]] auto getCurrentPresetName() const -> const char*;
|
||||
void setActiveShader(Rendering::ShaderType type);
|
||||
void applyCurrentPostFXPreset();
|
||||
@@ -67,7 +67,7 @@ class Screen {
|
||||
void adjustWindowSize();
|
||||
void calculateMaxZoom();
|
||||
void initShaders();
|
||||
void applyFallbackPresentation(); // Logical presentation + scale mode per al path SDL_Renderer
|
||||
void applyFallbackPresentation(); // Logical presentation + scale mode per al path SDL_Renderer
|
||||
void ensureFallbackInternalTexture(); // Recrea internal_texture_sdl_ si cal (fallback path)
|
||||
|
||||
static Screen* instance_;
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
#include <iostream> // std::cout
|
||||
|
||||
#ifndef __APPLE__
|
||||
#include "core/rendering/sdl3gpu/crtpi_frag_spv.h"
|
||||
#include "core/rendering/sdl3gpu/downscale_frag_spv.h"
|
||||
#include "core/rendering/sdl3gpu/postfx_frag_spv.h"
|
||||
#include "core/rendering/sdl3gpu/postfx_vert_spv.h"
|
||||
#include "core/rendering/sdl3gpu/upscale_frag_spv.h"
|
||||
#include "core/rendering/sdl3gpu/spv/crtpi_frag_spv.h"
|
||||
#include "core/rendering/sdl3gpu/spv/downscale_frag_spv.h"
|
||||
#include "core/rendering/sdl3gpu/spv/postfx_frag_spv.h"
|
||||
#include "core/rendering/sdl3gpu/spv/postfx_vert_spv.h"
|
||||
#include "core/rendering/sdl3gpu/spv/upscale_frag_spv.h"
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
@@ -939,8 +939,7 @@ namespace Rendering {
|
||||
break;
|
||||
}
|
||||
case Options::ScalingMode::INTEGER: {
|
||||
const int SCALE = std::max(1, std::min(static_cast<int>(sw) / static_cast<int>(logical_w),
|
||||
static_cast<int>(sh) / static_cast<int>(logical_h)));
|
||||
const int SCALE = std::max(1, std::min(static_cast<int>(sw) / static_cast<int>(logical_w), static_cast<int>(sh) / static_cast<int>(logical_h)));
|
||||
vw = logical_w * static_cast<float>(SCALE);
|
||||
vh = logical_h * static_cast<float>(SCALE);
|
||||
break;
|
||||
@@ -1482,7 +1481,10 @@ namespace Rendering {
|
||||
internal_texture_ = SDL_CreateGPUTexture(device_, &info);
|
||||
if (internal_texture_ == nullptr) {
|
||||
SDL_Log("SDL3GPUShader: failed to create internal texture %dx%d (×%d): %s",
|
||||
W, H, internal_res_, SDL_GetError());
|
||||
W,
|
||||
H,
|
||||
internal_res_,
|
||||
SDL_GetError());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -184,8 +184,8 @@ namespace Rendering {
|
||||
bool is_initialized_ = false;
|
||||
bool vsync_ = true;
|
||||
Options::ScalingMode scaling_mode_ = Options::ScalingMode::INTEGER;
|
||||
bool stretch_4_3_ = false; // Estirament vertical 4:3
|
||||
bool texture_filter_linear_ = false; // Filtre global (false=NEAREST, true=LINEAR)
|
||||
bool stretch_4_3_ = false; // Estirament vertical 4:3
|
||||
bool texture_filter_linear_ = false; // Filtre global (false=NEAREST, true=LINEAR)
|
||||
};
|
||||
|
||||
} // namespace Rendering
|
||||
|
||||
2
source/core/rendering/sdl3gpu/spv/.clang-format
Normal file
2
source/core/rendering/sdl3gpu/spv/.clang-format
Normal file
@@ -0,0 +1,2 @@
|
||||
DisableFormat: true
|
||||
SortIncludes: Never
|
||||
4
source/core/rendering/sdl3gpu/spv/.clang-tidy
Normal file
4
source/core/rendering/sdl3gpu/spv/.clang-tidy
Normal file
@@ -0,0 +1,4 @@
|
||||
# source/core/rendering/sdl3gpu/spv/.clang-tidy
|
||||
Checks: '-*'
|
||||
WarningsAsErrors: ''
|
||||
HeaderFilterRegex: ''
|
||||
4
source/external/.clang-tidy
vendored
Normal file
4
source/external/.clang-tidy
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
# source/external/.clang-tidy
|
||||
Checks: '-*'
|
||||
WarningsAsErrors: ''
|
||||
HeaderFilterRegex: ''
|
||||
@@ -125,11 +125,16 @@ namespace Options {
|
||||
video.supersampling = node["supersampling"].get_value<bool>();
|
||||
if (node.contains("scaling_mode")) {
|
||||
auto s = node["scaling_mode"].get_value<std::string>();
|
||||
if (s == "disabled") video.scaling_mode = ScalingMode::DISABLED;
|
||||
else if (s == "stretch") video.scaling_mode = ScalingMode::STRETCH;
|
||||
else if (s == "letterbox") video.scaling_mode = ScalingMode::LETTERBOX;
|
||||
else if (s == "overscan") video.scaling_mode = ScalingMode::OVERSCAN;
|
||||
else video.scaling_mode = ScalingMode::INTEGER;
|
||||
if (s == "disabled")
|
||||
video.scaling_mode = ScalingMode::DISABLED;
|
||||
else if (s == "stretch")
|
||||
video.scaling_mode = ScalingMode::STRETCH;
|
||||
else if (s == "letterbox")
|
||||
video.scaling_mode = ScalingMode::LETTERBOX;
|
||||
else if (s == "overscan")
|
||||
video.scaling_mode = ScalingMode::OVERSCAN;
|
||||
else
|
||||
video.scaling_mode = ScalingMode::INTEGER;
|
||||
}
|
||||
if (node.contains("vsync"))
|
||||
video.vsync = node["vsync"].get_value<bool>();
|
||||
@@ -290,11 +295,21 @@ namespace Options {
|
||||
{
|
||||
const char* m = "integer";
|
||||
switch (video.scaling_mode) {
|
||||
case ScalingMode::DISABLED: m = "disabled"; break;
|
||||
case ScalingMode::STRETCH: m = "stretch"; break;
|
||||
case ScalingMode::LETTERBOX: m = "letterbox"; break;
|
||||
case ScalingMode::OVERSCAN: m = "overscan"; break;
|
||||
case ScalingMode::INTEGER: m = "integer"; break;
|
||||
case ScalingMode::DISABLED:
|
||||
m = "disabled";
|
||||
break;
|
||||
case ScalingMode::STRETCH:
|
||||
m = "stretch";
|
||||
break;
|
||||
case ScalingMode::LETTERBOX:
|
||||
m = "letterbox";
|
||||
break;
|
||||
case ScalingMode::OVERSCAN:
|
||||
m = "overscan";
|
||||
break;
|
||||
case ScalingMode::INTEGER:
|
||||
m = "integer";
|
||||
break;
|
||||
}
|
||||
file << " scaling_mode: " << m << " # disabled|stretch|letterbox|overscan|integer\n";
|
||||
}
|
||||
|
||||
@@ -46,9 +46,9 @@ namespace Options {
|
||||
TextureFilter texture_filter{TextureFilter::NEAREST};
|
||||
int downscale_algo{Defaults::Video::DOWNSCALE_ALGO};
|
||||
int internal_resolution{Defaults::Video::INTERNAL_RESOLUTION}; // Multiplicador enter ≥ 1, clampat a max_zoom
|
||||
std::string current_shader{"postfx"}; // "postfx" o "crtpi"
|
||||
std::string current_postfx_preset{"CRT"}; // Nom del preset PostFX actiu
|
||||
std::string current_crtpi_preset{"DEFAULT"}; // Nom del preset CrtPi actiu
|
||||
std::string current_shader{"postfx"}; // "postfx" o "crtpi"
|
||||
std::string current_postfx_preset{"CRT"}; // Nom del preset PostFX actiu
|
||||
std::string current_crtpi_preset{"DEFAULT"}; // Nom del preset CrtPi actiu
|
||||
};
|
||||
|
||||
// Opcions del render info
|
||||
|
||||
@@ -21,9 +21,7 @@ namespace {
|
||||
// comú aplicat tant al blit del logo com als CURSOR_X de sota.
|
||||
constexpr int LOGO_DST_X = (320 - LETTER_WIDTHS[8]) / 2; // 66
|
||||
constexpr int CENTER_SHIFT = LOGO_DST_X - LOGO_SRC_X; // +6
|
||||
constexpr int CURSOR_X[9] = {77 + CENTER_SHIFT, 100 + CENTER_SHIFT, 111 + CENTER_SHIFT,
|
||||
130 + CENTER_SHIFT, 153 + CENTER_SHIFT, 176 + CENTER_SHIFT,
|
||||
207 + CENTER_SHIFT, 230 + CENTER_SHIFT, 249 + CENTER_SHIFT};
|
||||
constexpr int CURSOR_X[9] = {77 + CENTER_SHIFT, 100 + CENTER_SHIFT, 111 + CENTER_SHIFT, 130 + CENTER_SHIFT, 153 + CENTER_SHIFT, 176 + CENTER_SHIFT, 207 + CENTER_SHIFT, 230 + CENTER_SHIFT, 249 + CENTER_SHIFT};
|
||||
constexpr int CURSOR_W = 12;
|
||||
constexpr int CURSOR_H = 3;
|
||||
constexpr int CURSOR_Y = LOGO_DST_Y + LOGO_HEIGHT - CURSOR_H; // y = 103
|
||||
|
||||
Reference in New Issue
Block a user