mes comandos per a Console

This commit is contained in:
2026-03-28 14:14:33 +01:00
parent 854a5f04b2
commit 71c7b8e553
6 changed files with 47 additions and 3 deletions

View File

@@ -529,6 +529,11 @@ void Screen::setDownscaleAlgo(int algo) {
}
}
auto Screen::getSsTextureSize() const -> std::pair<int, int> {
if (!shader_backend_) { return {0, 0}; }
return shader_backend_->getSsTextureSize();
}
// Activa/desactiva el supersampling global (Ctrl+F4)
void Screen::toggleSupersampling() {
Options::video.supersampling = !Options::video.supersampling;

View File

@@ -6,6 +6,7 @@
#include <cstddef> // Para size_t
#include <memory> // Para shared_ptr, __shared_ptr_access
#include <string> // Para string
#include <utility> // Para std::pair
#include <vector> // Para vector
#include "utils/utils.hpp" // Para Color
@@ -77,6 +78,7 @@ class Screen {
[[nodiscard]] auto getGPUDriver() const -> const std::string& { return gpu_driver_; }
[[nodiscard]] auto getLastFPS() const -> int { return fps_.last_value; }
[[nodiscard]] auto getZoomFactor() const -> float { return zoom_factor_; }
[[nodiscard]] auto getSsTextureSize() const -> std::pair<int, int>;
private:
// Estructuras

View File

@@ -924,6 +924,11 @@ namespace Rendering {
downscale_algo_ = std::max(0, std::min(algo, 2));
}
auto SDL3GPUShader::getSsTextureSize() const -> std::pair<int, int> {
if (ss_factor_ <= 1) { return {0, 0}; }
return {game_width_ * ss_factor_, game_height_ * ss_factor_};
}
// ---------------------------------------------------------------------------
// reinitTexturesAndBuffer — recrea scene_texture_, scaled_texture_ y
// upload_buffer_ con el factor oversample_ actual. No toca pipelines ni samplers.

View File

@@ -82,6 +82,9 @@ namespace Rendering {
// Selecciona algoritmo de downscale: 0=bilinear legacy, 1=Lanczos2, 2=Lanczos3
void setDownscaleAlgo(int algo) override;
// Devuelve las dimensiones de la textura de supersampling (0,0 si SS desactivado)
[[nodiscard]] auto getSsTextureSize() const -> std::pair<int, int> override;
private:
static auto createShaderMSL(SDL_GPUDevice* device,
const char* msl_source,

View File

@@ -3,6 +3,7 @@
#include <SDL3/SDL.h>
#include <string>
#include <utility>
namespace Rendering {
@@ -105,6 +106,12 @@ namespace Rendering {
virtual void setDownscaleAlgo(int /*algo*/) {}
[[nodiscard]] virtual auto getDownscaleAlgo() const -> int { return 0; }
/**
* @brief Devuelve las dimensiones de la textura de supersampling.
* @return Par (ancho, alto) en píxeles; (0, 0) si SS está desactivado.
*/
[[nodiscard]] virtual auto getSsTextureSize() const -> std::pair<int, int> { return {0, 0}; }
/**
* @brief Verifica si el backend está usando aceleración por hardware
* @return true si usa aceleración (OpenGL/Metal/Vulkan)