summaryrefslogtreecommitdiff
path: root/src/video_core/swrasterizer/clipper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/swrasterizer/clipper.cpp')
-rw-r--r--src/video_core/swrasterizer/clipper.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/video_core/swrasterizer/clipper.cpp b/src/video_core/swrasterizer/clipper.cpp
index cdbc71502..cc76ba555 100644
--- a/src/video_core/swrasterizer/clipper.cpp
+++ b/src/video_core/swrasterizer/clipper.cpp
@@ -127,8 +127,7 @@ void ProcessTriangle(const OutputVertex& v0, const OutputVertex& v1, const Outpu
127 127
128 // Simple implementation of the Sutherland-Hodgman clipping algorithm. 128 // Simple implementation of the Sutherland-Hodgman clipping algorithm.
129 // TODO: Make this less inefficient (currently lots of useless buffering overhead happens here) 129 // TODO: Make this less inefficient (currently lots of useless buffering overhead happens here)
130 for (auto edge : clipping_edges) { 130 auto Clip = [&](const ClippingEdge& edge) {
131
132 std::swap(input_list, output_list); 131 std::swap(input_list, output_list);
133 output_list->clear(); 132 output_list->clear();
134 133
@@ -147,12 +146,24 @@ void ProcessTriangle(const OutputVertex& v0, const OutputVertex& v1, const Outpu
147 } 146 }
148 reference_vertex = &vertex; 147 reference_vertex = &vertex;
149 } 148 }
149 };
150
151 for (auto edge : clipping_edges) {
152 Clip(edge);
150 153
151 // Need to have at least a full triangle to continue... 154 // Need to have at least a full triangle to continue...
152 if (output_list->size() < 3) 155 if (output_list->size() < 3)
153 return; 156 return;
154 } 157 }
155 158
159 if (g_state.regs.rasterizer.clip_enable) {
160 ClippingEdge custom_edge{-g_state.regs.rasterizer.GetClipCoef()};
161 Clip(custom_edge);
162
163 if (output_list->size() < 3)
164 return;
165 }
166
156 InitScreenCoordinates((*output_list)[0]); 167 InitScreenCoordinates((*output_list)[0]);
157 InitScreenCoordinates((*output_list)[1]); 168 InitScreenCoordinates((*output_list)[1]);
158 169