mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:27:35 +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
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…
Add table
Add a link
Reference in a new issue