SDL/Qt: Better resizing & fullscreen support

This commit is contained in:
wheremyfoodat 2025-06-28 20:35:38 +03:00
parent bfeee04d3e
commit 630952f36b
6 changed files with 85 additions and 7 deletions

View file

@ -53,10 +53,12 @@ class Renderer {
// Should hw renderers hash textures? Stored separately from emulatorConfig because we'll be accessing it constantly, might be merged eventually
bool hashTextures = false;
bool outputSizeChanged = true;
EmulatorConfig* emulatorConfig = nullptr;
void doSoftwareTextureCopy(u32 inputAddr, u32 outputAddr, u32 copySize, u32 inputWidth, u32 inputGap, u32 outputWidth, u32 outputGap);
public:
Renderer(GPU& gpu, const std::array<u32, regNum>& internalRegs, const std::array<u32, extRegNum>& externalRegs);
virtual ~Renderer();
@ -121,6 +123,7 @@ class Renderer {
void setDepthBufferLoc(u32 loc) { depthBufferLoc = loc; }
void setOutputSize(u32 width, u32 height) {
outputSizeChanged = true;
outputWindowWidth = width;
outputWindowHeight = height;
}

View file

@ -40,7 +40,7 @@ class RendererGL final : public Renderer {
OpenGL::VertexArray hwShaderVAO;
OpenGL::VertexBuffer vbo;
// Data
// Data that will be uploaded to the ubershader
struct {
// TEV configuration uniform locations
GLint textureEnvSourceLoc = -1;
@ -146,6 +146,15 @@ class RendererGL final : public Renderer {
PICA::ShaderGen::FragmentGenerator fragShaderGen;
OpenGL::Driver driverInfo;
// Information about the final 3DS screen -> Window blit, accounting for things like scaling and shifting the output based on
// the window's dimensions.
struct {
int destX = 0;
int destY = 0;
int destWidth = 400;
int destHeight = 480;
} blitInfo;
MAKE_LOG_FUNCTION(log, rendererLogger)
void setupBlending();
void setupStencilTest(bool stencilEnable);

View file

@ -88,6 +88,16 @@ class RendererMTL final : public Renderer {
MTL::Texture* lastColorTexture = nullptr;
MTL::Texture* lastDepthTexture = nullptr;
// Information about the final 3DS screen -> Window blit, accounting for things like scaling and shifting the output based on
// the window's dimensions.
struct {
float topScreenX = 0;
float topScreenY = 0;
float bottomScreenX = 40;
float bottomScreenY = 240;
float scale = 1.0;
} blitInfo;
// Debug
std::string nextRenderPassName;