mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 17:10:23 +00:00
LibSoftGPU: Don't render triangle strip if there's less than 3 vertices
If there's less than 3 vertices, we cannot do triangle strip otherwise we will go out-of-bounds of the vertices vector. Required for Half-Life, which sometimes submits 0 vertices for triangle strip when drawing the electric disks around the pillars in Xen.
This commit is contained in:
parent
b397db9948
commit
f216df7d0f
Notes:
sideshowbarker
2024-07-17 21:05:58 +09:00
Author: https://github.com/Lubrsi Commit: https://github.com/SerenityOS/serenity/commit/f216df7d0f6 Pull-request: https://github.com/SerenityOS/serenity/pull/11830 Reviewed-by: https://github.com/Quaker762 ✅ Reviewed-by: https://github.com/sunverwerth ✅
1 changed files with 2 additions and 0 deletions
|
@ -609,6 +609,8 @@ void Device::draw_primitives(PrimitiveType primitive_type, FloatMatrix4x4 const&
|
|||
}
|
||||
} else if (primitive_type == PrimitiveType::TriangleStrip) {
|
||||
Triangle triangle;
|
||||
if (vertices.size() < 3)
|
||||
return;
|
||||
for (size_t i = 0; i < vertices.size() - 2; i++) {
|
||||
if (i % 2 == 0) {
|
||||
triangle.vertices[0] = vertices.at(i);
|
||||
|
|
Loading…
Reference in a new issue