diff options
author | wwylele <wwylele@gmail.com> | 2017-08-22 08:49:26 +0200 |
---|---|---|
committer | wwylele <wwylele@gmail.com> | 2017-08-24 14:34:27 +0200 |
commit | ea51a3af261254e5455f63a0ef41e55ef1dfc471 (patch) | |
tree | 1240b8835ade7b50c633e233787b319c498a4d1d /src/video_core/swrasterizer | |
parent | Merge pull request #2839 from Subv/global_kernel_lock (diff) | |
download | yuzu-ea51a3af261254e5455f63a0ef41e55ef1dfc471.tar yuzu-ea51a3af261254e5455f63a0ef41e55ef1dfc471.tar.gz yuzu-ea51a3af261254e5455f63a0ef41e55ef1dfc471.tar.bz2 yuzu-ea51a3af261254e5455f63a0ef41e55ef1dfc471.tar.lz yuzu-ea51a3af261254e5455f63a0ef41e55ef1dfc471.tar.xz yuzu-ea51a3af261254e5455f63a0ef41e55ef1dfc471.tar.zst yuzu-ea51a3af261254e5455f63a0ef41e55ef1dfc471.zip |
Diffstat (limited to 'src/video_core/swrasterizer')
-rw-r--r-- | src/video_core/swrasterizer/clipper.cpp | 15 |
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 // Simple implementation of the Sutherland-Hodgman clipping algorithm. // TODO: Make this less inefficient (currently lots of useless buffering overhead happens here) - for (auto edge : clipping_edges) { - + auto Clip = [&](const ClippingEdge& edge) { std::swap(input_list, output_list); output_list->clear(); @@ -147,12 +146,24 @@ void ProcessTriangle(const OutputVertex& v0, const OutputVertex& v1, const Outpu } reference_vertex = &vertex; } + }; + + for (auto edge : clipping_edges) { + Clip(edge); // Need to have at least a full triangle to continue... if (output_list->size() < 3) return; } + if (g_state.regs.rasterizer.clip_enable) { + ClippingEdge custom_edge{-g_state.regs.rasterizer.GetClipCoef()}; + Clip(custom_edge); + + if (output_list->size() < 3) + return; + } + InitScreenCoordinates((*output_list)[0]); InitScreenCoordinates((*output_list)[1]); |