mcst-linux-kernel/patches-2024.06.26/gl4es-1.1.4/0184-Added-texture-copy-ski...

69 lines
2.6 KiB
Diff

From 6d577515a0a2410eeced1d8a9203ec3345c3e6c1 Mon Sep 17 00:00:00 2001
From: JohnnyonFlame <johnnyonflame@hotmail.com>
Date: Sun, 7 Nov 2021 05:13:43 -0300
Subject: [PATCH 184/233] Added texture copy skip hack. The envvar
LIBGL_SKIPTEXCOPIES controls whether or not to skip texture copies are
skipped.
---
src/gl/init.c | 1 +
src/gl/init.h | 1 +
src/gl/texture_read.c | 10 ++++++++++
3 files changed, 12 insertions(+)
diff --git a/src/gl/init.c b/src/gl/init.c
index bc81924e..a1ffa094 100644
--- a/src/gl/init.c
+++ b/src/gl/init.c
@@ -686,6 +686,7 @@ void initialize_gl4es() {
}
}
+ env(LIBGL_SKIPTEXCOPIES, globals4es.skiptexcopies, "Texture Copies will be skipped");
if(GetEnvVarFloat("LIBGL_FB_TEX_SCALE",&globals4es.fbtexscale,0.0f)) {
SHUT_LOGD("Framebuffer Textures will be scaled by %.2f\n", globals4es.fbtexscale);
}
diff --git a/src/gl/init.h b/src/gl/init.h
index bdfbbae9..22b95ac5 100644
--- a/src/gl/init.h
+++ b/src/gl/init.h
@@ -74,6 +74,7 @@ typedef struct _globals4es {
int glxnative;
int normalize; // force normal normalization (workaround a bug)
int blitfb0;
+ int skiptexcopies;
float fbtexscale;
#ifndef NO_GBM
char drmcard[50];
diff --git a/src/gl/texture_read.c b/src/gl/texture_read.c
index 74f99fe7..e994b78c 100644
--- a/src/gl/texture_read.c
+++ b/src/gl/texture_read.c
@@ -41,6 +41,11 @@ void APIENTRY_GL4ES gl4es_glCopyTexImage2D(GLenum target, GLint level, GLenum
// actualy bound if targetting shared TEX2D
realize_bound(glstate->texture.active, target);
+ if (globals4es.skiptexcopies) {
+ DBG(printf("glCopyTexImage2D skipped.\n"));
+ return;
+ }
+
errorGL();
// "Unmap" if buffer mapped...
@@ -101,6 +106,11 @@ void APIENTRY_GL4ES gl4es_glCopyTexSubImage2D(GLenum target, GLint level, GLint
DBG(printf("glCopyTexSubImage2D(%s, %i, %i, %i, %i, %i, %i, %i), bounded texture=%u format/type=%s, %s\n", PrintEnum(target), level, xoffset, yoffset, x, y, width, height, (glstate->texture.bound[glstate->texture.active][itarget])?glstate->texture.bound[glstate->texture.active][itarget]->texture:0, PrintEnum((glstate->texture.bound[glstate->texture.active][itarget])?glstate->texture.bound[glstate->texture.active][itarget]->format:0), PrintEnum((glstate->texture.bound[glstate->texture.active][itarget])?glstate->texture.bound[glstate->texture.active][itarget]->type:0));)
// PUSH_IF_COMPILING(glCopyTexSubImage2D);
FLUSH_BEGINEND;
+
+ if (globals4es.skiptexcopies) {
+ DBG(printf("glCopyTexSubImage2D skipped.\n"));
+ return;
+ }
LOAD_GLES(glCopyTexSubImage2D);
errorGL();
--
2.11.0