[Scummvm-git-logs] scummvm master -> c2f4ec7fce52b048015ba49c9a75545e36e9c131
aquadran
noreply at scummvm.org
Tue Mar 25 04:50:39 UTC 2025
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
2cb01134be TINYGL: Fix TGL_TRIANGLE_FAN iteration
c2f4ec7fce TINYGL: Fix off by one access error
Commit: 2cb01134be66de69236823fc102e5b1ffac7b567
https://github.com/scummvm/scummvm/commit/2cb01134be66de69236823fc102e5b1ffac7b567
Author: unknown (john.presley.27 at gmail.com)
Date: 2025-03-25T05:50:36+01:00
Commit Message:
TINYGL: Fix TGL_TRIANGLE_FAN iteration
Triangle fans need to use a vertex from the previous triangle to create the next
one. The original TGL code does this properly but it was edited at some time and
the iteration changed to move on to the next triangle rather than using the previous
vertex, causing the triangle fan to skip a triangle and render a weird rays thing.
Changed paths:
graphics/tinygl/zdirtyrect.cpp
diff --git a/graphics/tinygl/zdirtyrect.cpp b/graphics/tinygl/zdirtyrect.cpp
index 89b48dc21c4..20f5968ac39 100644
--- a/graphics/tinygl/zdirtyrect.cpp
+++ b/graphics/tinygl/zdirtyrect.cpp
@@ -392,7 +392,7 @@ void RasterizationDrawCall::execute(bool restoreState) const {
}
break;
case TGL_TRIANGLE_FAN:
- for(int i = 1; i < cnt; i += 2) {
+ for(int i = 1; i < cnt; i++) {
c->gl_draw_triangle(&c->vertex[0], &c->vertex[i], &c->vertex[i + 1]);
}
break;
Commit: c2f4ec7fce52b048015ba49c9a75545e36e9c131
https://github.com/scummvm/scummvm/commit/c2f4ec7fce52b048015ba49c9a75545e36e9c131
Author: unknown (john.presley.27 at gmail.com)
Date: 2025-03-25T05:50:36+01:00
Commit Message:
TINYGL: Fix off by one access error
The TGL_TRIANLE_FAN was looping past the valid array size due to the way the
loop is written, relying on i and i+1 to draw the fan. Reducing iteration to
cnt - 1 fixes the access violation and the triangle fan draws properly.
Changed paths:
graphics/tinygl/zdirtyrect.cpp
diff --git a/graphics/tinygl/zdirtyrect.cpp b/graphics/tinygl/zdirtyrect.cpp
index 20f5968ac39..e6ab707291f 100644
--- a/graphics/tinygl/zdirtyrect.cpp
+++ b/graphics/tinygl/zdirtyrect.cpp
@@ -392,7 +392,7 @@ void RasterizationDrawCall::execute(bool restoreState) const {
}
break;
case TGL_TRIANGLE_FAN:
- for(int i = 1; i < cnt; i++) {
+ for(int i = 1; i < cnt - 1; i++) {
c->gl_draw_triangle(&c->vertex[0], &c->vertex[i], &c->vertex[i + 1]);
}
break;
More information about the Scummvm-git-logs
mailing list