mcst-linux-kernel/patches-2024.06.26/gl4es-1.1.4/0159-GLES2-Added-a-workarou...

39 lines
1.6 KiB
Diff

From ef6cbd63a4e23ba3aa0c6bb64a355f65930ca796 Mon Sep 17 00:00:00 2001
From: ptitSeb <sebastien.chev@gmail.com>
Date: Tue, 29 Jun 2021 17:37:39 +0200
Subject: [PATCH 159/233] [GLES2] Added a workaround for enabled VA attached to
buffer 0 with NULL pointer to disabled that VA
---
src/gl/fpe.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/gl/fpe.c b/src/gl/fpe.c
index 6f5b591d..c2e1bd01 100644
--- a/src/gl/fpe.c
+++ b/src/gl/fpe.c
@@ -1409,12 +1409,17 @@ void realize_glenv(int ispoint, int first, int count, GLenum type, const void* i
{
vertexattrib_t *v = &glstate->gleshard->vertexattrib[i];
vertexattrib_t *w = &glstate->vao->vertexattrib[i];
+ int enabled = w->enabled;
int dirty = 0;
+ if(enabled && !w->buffer && !w->pointer) {
+ DBG(printf("Warning: VA %d Enabled with buffer:0 and NULL pointer, disabling\n", i));
+ enabled = 0;
+ }
// enable / disable Array if needed
- if(v->enabled != w->enabled || (v->enabled && w->divisor)) {
+ if(v->enabled != enabled || (v->enabled && w->divisor)) {
dirty = 1;
- v->enabled = (w->divisor)?0:w->enabled;
- DBG(printf("VertexAttribArray[%d]:%s, divisor=%d\n", i, (w->enabled)?"Enable":"Disable", w->divisor);)
+ v->enabled = (w->divisor)?0:enabled;
+ DBG(printf("VertexAttribArray[%d]:%s, divisor=%d\n", i, (enabled)?"Enable":"Disable", w->divisor);)
if(v->enabled)
gles_glEnableVertexAttribArray(i);
else
--
2.11.0