From 2db294306f18b076b0458244a051fe5ad23c957c Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Sun, 7 Dec 2014 21:48:57 +0100 Subject: externals: Add boost submodule. --- externals/boost | 1 + 1 file changed, 1 insertion(+) create mode 160000 externals/boost (limited to 'externals') diff --git a/externals/boost b/externals/boost new file mode 160000 index 000000000..b060148c0 --- /dev/null +++ b/externals/boost @@ -0,0 +1 @@ +Subproject commit b060148c08ae87a3a5809c4f48cb26ac667487ab -- cgit v1.2.3 From 056a8f9dfa5f3da3bc3dfc0b032283db0ff6ab15 Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Thu, 27 Nov 2014 19:09:37 +0100 Subject: Add nihstro (a 3DS shader tools suite) as a submodule. --- .gitmodules | 3 +++ CMakeLists.txt | 2 ++ externals/nihstro | 1 + 3 files changed, 6 insertions(+) create mode 160000 externals/nihstro (limited to 'externals') diff --git a/.gitmodules b/.gitmodules index 54714e5cd..a9e0a5c1a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "externals/boost"] path = externals/boost url = https://github.com/citra-emu/ext-boost.git +[submodule "externals/nihstro"] + path = externals/nihstro + url = https://github.com/neobrain/nihstro.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 61d5d524a..638b468a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -141,6 +141,8 @@ set(INI_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/externals/inih") include_directories(${INI_PREFIX}) add_subdirectory(${INI_PREFIX}) +include_directories(externals/nihstro/include) + # process subdirectories if(ENABLE_QT) include_directories(externals/qhexedit) diff --git a/externals/nihstro b/externals/nihstro new file mode 160000 index 000000000..fc71f8684 --- /dev/null +++ b/externals/nihstro @@ -0,0 +1 @@ +Subproject commit fc71f8684d26ccf277ad68809c8bd7273141fe89 -- cgit v1.2.3 From a320d1a5b4b7ce3b90372697fbe50242b78d082e Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Sun, 28 Dec 2014 00:56:32 -0200 Subject: Clipper: Avoid dynamic allocations The triangle clipper was allocating its temporary input, output and work buffers using a std::vector. Since this is a hot path, it's desirable to use stack allocation instead. --- externals/boost | 2 +- src/video_core/clipper.cpp | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) (limited to 'externals') diff --git a/externals/boost b/externals/boost index b060148c0..97052c28a 160000 --- a/externals/boost +++ b/externals/boost @@ -1 +1 @@ -Subproject commit b060148c08ae87a3a5809c4f48cb26ac667487ab +Subproject commit 97052c28acb141dbf3c5e14114af99045344b695 diff --git a/src/video_core/clipper.cpp b/src/video_core/clipper.cpp index 0bcd0b895..e89b7a0c0 100644 --- a/src/video_core/clipper.cpp +++ b/src/video_core/clipper.cpp @@ -2,7 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include +#include #include "clipper.h" #include "pica.h" @@ -98,18 +98,15 @@ static void InitScreenCoordinates(OutputVertex& vtx) } void ProcessTriangle(OutputVertex &v0, OutputVertex &v1, OutputVertex &v2) { + using boost::container::static_vector; // TODO (neobrain): // The list of output vertices has some fixed maximum size, // however I haven't taken the time to figure out what it is exactly. - // For now, we hence just assume a maximal size of 1000 vertices. - const size_t max_vertices = 1000; - std::vector buffer_vertices; - std::vector output_list{ &v0, &v1, &v2 }; - - // Make sure to reserve space for all vertices. - // Without this, buffer reallocation would invalidate references. - buffer_vertices.reserve(max_vertices); + // For now, we hence just assume a maximal size of 256 vertices. + static const size_t MAX_VERTICES = 256; + static_vector buffer_vertices; + static_vector output_list = { &v0, &v1, &v2 }; // Simple implementation of the Sutherland-Hodgman clipping algorithm. // TODO: Make this less inefficient (currently lots of useless buffering overhead happens here) @@ -120,7 +117,7 @@ void ProcessTriangle(OutputVertex &v0, OutputVertex &v1, OutputVertex &v2) { ClippingEdge(ClippingEdge::POS_Z, float24::FromFloat32(+1.0)), ClippingEdge(ClippingEdge::NEG_Z, float24::FromFloat32(-1.0)) }) { - const std::vector input_list = output_list; + const static_vector input_list = output_list; output_list.clear(); const OutputVertex* reference_vertex = input_list.back(); -- cgit v1.2.3