mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 19:17:44 +00:00
LibSoftGPU: Optimize clipping code
Three optimizations are applied: 1. If the list of vertices to clip is empty, return immediately after clearing the output list. 2. Remember the previous vertex instead of recalculating whether it is within the clip plane. 3. Instead of copying and swapping lists around, operate on the input and output lists directly. This prevents a lot of `malloc`/`free` traffic as a result of vector assignments. This takes the clipping code CPU load from 3.9% down to 1.8% for Quake 3 on my machine.
This commit is contained in:
parent
60fccdbd71
commit
4c1d8a7785
2 changed files with 25 additions and 28 deletions
|
@ -29,8 +29,7 @@ public:
|
|||
void clip_triangle_against_frustum(Vector<GPU::Vertex>& input_vecs);
|
||||
|
||||
private:
|
||||
Vector<GPU::Vertex> list_a;
|
||||
Vector<GPU::Vertex> list_b;
|
||||
Vector<GPU::Vertex> m_vertex_buffer;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue