GlobalInputs F1-F12 + Escape, Screen sense destruir finestra, escalat al GPU, presets i fons canvas (v0.11.0)

This commit is contained in:
JailDesigner committed 2026-04-19 14:27:16 +02:00
1 parent 837eb73398
commit 297dc85e47
23 files changed
+653 -34

No files matched your search

@@ -3,6 +3,8 @@
#include <cstring>
#include <iostream>
#include "core/rendering/sdl3gpu/viewport.hpp"
#ifndef __APPLE__
#include "core/rendering/sdl3gpu/spv/crtpi_frag_spv.h"
#include "core/rendering/sdl3gpu/spv/postfx_vert_spv.h"
@@ -280,7 +282,10 @@ namespace Rendering {
SDL_GPUTexture* scene,
SDL_GPUSampler* sampler,
int game_width,
int game_height) {
int game_height,
Defaults::ScalingMode scaling_mode,
std::uint32_t swapchain_w,
std::uint32_t swapchain_h) {
if (pipeline_ == nullptr) { return; }
SDL_GPUColorTargetInfo color_target{};
@@ -292,6 +297,11 @@ namespace Rendering {
SDL_GPURenderPass* pass = SDL_BeginGPURenderPass(cmd, &color_target, 1, nullptr);
if (pass == nullptr) { return; }
// Viewport per aplicar letterbox/integer/... sense modificar el
// triangle fullscreen; la resta del swapchain queda a clear_color.
const SDL_GPUViewport VP = computeViewport(scaling_mode, swapchain_w, swapchain_h, game_width, game_height);
SDL_SetGPUViewport(pass, &VP);
SDL_BindGPUGraphicsPipeline(pass, pipeline_);
SDL_GPUTextureSamplerBinding binding{};
@@ -3,6 +3,8 @@
#include <SDL3/SDL.h>
#include <SDL3/SDL_gpu.h>
#include <cstdint>
#include "core/rendering/shader_backend.hpp"
// Uniforms del shader CRT-Pi. 4 × vec4 (64 bytes) per a alineament Metal/Vulkan.
@@ -56,7 +58,10 @@ namespace Rendering {
SDL_GPUTexture* scene,
SDL_GPUSampler* sampler,
int game_width,
int game_height);
int game_height,
Defaults::ScalingMode scaling_mode,
std::uint32_t swapchain_w,
std::uint32_t swapchain_h);
private:
SDL_GPUDevice* device_{nullptr};