mcst-linux-kernel/patches-2024.06.26/gl4es-1.1.4/0112-Added-LIBGL_BLITFB0-en...

66 lines
2.4 KiB
Diff

From dc798f40e828347b9cacb700981ccc9ecf1af7e2 Mon Sep 17 00:00:00 2001
From: ptitSeb <sebastien.chev@gmail.com>
Date: Sun, 17 Jan 2021 12:46:18 +0100
Subject: [PATCH 112/233] Added LIBGL_BLITFB0 env var to help some Wine titles
---
USAGE.md | 4 ++++
src/gl/framebuffers.c | 2 +-
src/gl/init.c | 2 +-
src/gl/init.h | 1 +
4 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/USAGE.md b/USAGE.md
index ca87a762..d69f7dc5 100644
--- a/USAGE.md
+++ b/USAGE.md
@@ -372,3 +372,7 @@ Force normals to be normliazed in FPE
* 0 : Default, don't force normalizations
* 1 : Force normalization on normals on FPE, even when it's disabled (workaround for a bug that prevent colors on Minecraft 1.16+)
+###### LIBGL_BLITFB0
+Blit to FB 0 force a SwapBuffer
+* 0 : Default, don't force a SwapBuffer when glBlitFramebuffer to draw fb0 is used (unless the full FB0 if blitted)
+* 1 : Force a SwapBuffer each time glBlitFramebuffer on FB0 is used (can help some windowed Wine games)
diff --git a/src/gl/framebuffers.c b/src/gl/framebuffers.c
index 2e1149a4..134a3825 100644
--- a/src/gl/framebuffers.c
+++ b/src/gl/framebuffers.c
@@ -1455,7 +1455,7 @@ void gl4es_glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
int fbowidth, fboheight;
int blitfullscreen = 0;
if(glstate->fbo.fbo_draw->id==0/* && glstate->fbo.mainfbo_fbo*/) {
- if(globals4es.usefb && !globals4es.usefbo)
+ if(globals4es.blitfb0 || (globals4es.usefb && !globals4es.usefbo))
blitfullscreen = 1;
else {
fbowidth = glstate->fbo.mainfbo_width;
diff --git a/src/gl/init.c b/src/gl/init.c
index 5ba74561..a233f40d 100644
--- a/src/gl/init.c
+++ b/src/gl/init.c
@@ -123,7 +123,7 @@ void initialize_gl4es() {
default:
break;
}
-
+ env(LIBGL_BLITFB0, globals4es.blitfb0, "Blit to FB 0 force a SwapBuffer");
env(LIBGL_FPS, globals4es.showfps, "fps counter enabled");
#ifdef USE_FBIO
env(LIBGL_VSYNC, globals4es.vsync, "vsync enabled");
diff --git a/src/gl/init.h b/src/gl/init.h
index b74bf8f7..87d73139 100644
--- a/src/gl/init.h
+++ b/src/gl/init.h
@@ -73,6 +73,7 @@ typedef struct _globals4es {
int noarbprogram; // to disable ARB Program
int glxnative;
int normalize; // force normal normalization (workaround a bug)
+ int blitfb0;
#ifndef NO_GBM
char drmcard[50];
#endif
--
2.11.0