mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:47:35 +00:00
LibSoftGPU: Avoid copying data when doing triangle rasterization
Several large-ish objects shouldn't be copied to the stack when a reference will do.
This commit is contained in:
parent
9f59d7d9a0
commit
759857b597
1 changed files with 4 additions and 4 deletions
|
@ -184,9 +184,9 @@ void Device::rasterize_triangle(const Triangle& triangle)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Vertices
|
// Vertices
|
||||||
Vertex const vertex0 = triangle.vertices[0];
|
Vertex const& vertex0 = triangle.vertices[0];
|
||||||
Vertex const vertex1 = triangle.vertices[1];
|
Vertex const& vertex1 = triangle.vertices[1];
|
||||||
Vertex const vertex2 = triangle.vertices[2];
|
Vertex const& vertex2 = triangle.vertices[2];
|
||||||
|
|
||||||
// Calculate area of the triangle for later tests
|
// Calculate area of the triangle for later tests
|
||||||
FloatVector2 const v0 = vertex0.window_coordinates.xy();
|
FloatVector2 const v0 = vertex0.window_coordinates.xy();
|
||||||
|
@ -262,7 +262,7 @@ void Device::rasterize_triangle(const Triangle& triangle)
|
||||||
auto stencil_buffer = m_frame_buffer->stencil_buffer();
|
auto stencil_buffer = m_frame_buffer->stencil_buffer();
|
||||||
|
|
||||||
// Stencil configuration and writing
|
// Stencil configuration and writing
|
||||||
auto const stencil_configuration = m_stencil_configuration[Face::Front];
|
auto const& stencil_configuration = m_stencil_configuration[Face::Front];
|
||||||
auto const stencil_reference_value = stencil_configuration.reference_value & stencil_configuration.test_mask;
|
auto const stencil_reference_value = stencil_configuration.reference_value & stencil_configuration.test_mask;
|
||||||
|
|
||||||
auto write_to_stencil = [](StencilType* stencil_ptrs[4], i32x4 stencil_value, StencilOperation op, StencilType reference_value, StencilType write_mask, i32x4 pixel_mask) {
|
auto write_to_stencil = [](StencilType* stencil_ptrs[4], i32x4 stencil_value, StencilOperation op, StencilType reference_value, StencilType write_mask, i32x4 pixel_mask) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue