From 2db294306f18b076b0458244a051fe5ad23c957c Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Sun, 7 Dec 2014 21:48:57 +0100 Subject: [PATCH 1/3] externals: Add boost submodule. --- .gitmodules | 3 +++ externals/boost | 1 + 2 files changed, 4 insertions(+) create mode 160000 externals/boost diff --git a/.gitmodules b/.gitmodules index d7201387a9..54714e5cd9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "externals/inih/inih"] path = externals/inih/inih url = https://github.com/svn2github/inih +[submodule "externals/boost"] + path = externals/boost + url = https://github.com/citra-emu/ext-boost.git diff --git a/externals/boost b/externals/boost new file mode 160000 index 0000000000..b060148c08 --- /dev/null +++ b/externals/boost @@ -0,0 +1 @@ +Subproject commit b060148c08ae87a3a5809c4f48cb26ac667487ab From 4d4572c697616c43ce47f43fc5de1a1b9ae27d5f Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Sun, 7 Dec 2014 22:22:04 +0100 Subject: [PATCH 2/3] Integrate Boost into build system and perform a trivial cleanup in vertex_shader.cpp. --- CMakeLists.txt | 8 ++++++++ src/video_core/vertex_shader.cpp | 16 ++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 05a560404e..61d5d524ad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,14 @@ if (PNG_FOUND) add_definitions(-DHAVE_PNG) endif () +find_package(Boost) +if (Boost_FOUND) + include_directories(${Boost_INCLUDE_DIRS}) +else() + message(STATUS "Boost not found, falling back to externals") + include_directories(externals/boost) +endif() + # Include bundled CMake modules list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/externals/cmake-modules") diff --git a/src/video_core/vertex_shader.cpp b/src/video_core/vertex_shader.cpp index 96625791cf..0dff11a0f6 100644 --- a/src/video_core/vertex_shader.cpp +++ b/src/video_core/vertex_shader.cpp @@ -2,11 +2,16 @@ // Licensed under GPLv2 // Refer to the license.txt file included. +#include + +#include + +#include + +#include "debug_utils/debug_utils.h" + #include "pica.h" #include "vertex_shader.h" -#include "debug_utils/debug_utils.h" -#include -#include namespace Pica { @@ -238,7 +243,7 @@ OutputVertex RunShader(const InputVertex& input, int num_attributes) // Setup input register table const auto& attribute_register_map = registers.vs_input_register_map; float24 dummy_register; - std::fill(&state.input_register_table[0], &state.input_register_table[16], &dummy_register); + boost::fill(state.input_register_table, &dummy_register); if(num_attributes > 0) state.input_register_table[attribute_register_map.attribute0_register] = &input.attr[0].x; if(num_attributes > 1) state.input_register_table[attribute_register_map.attribute1_register] = &input.attr[1].x; if(num_attributes > 2) state.input_register_table[attribute_register_map.attribute2_register] = &input.attr[2].x; @@ -272,8 +277,7 @@ OutputVertex RunShader(const InputVertex& input, int num_attributes) state.status_registers[0] = false; state.status_registers[1] = false; - std::fill(state.call_stack, state.call_stack + sizeof(state.call_stack) / sizeof(state.call_stack[0]), - VertexShaderState::INVALID_ADDRESS); + boost::fill(state.call_stack, VertexShaderState::INVALID_ADDRESS); state.call_stack_pointer = &state.call_stack[0]; ProcessShaderCode(state); From 3d8c6e61beef922f79733718c5314c0d7015e93f Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Sun, 7 Dec 2014 23:36:33 +0100 Subject: [PATCH 3/3] StringUtil: Perform some minimal cleanup. --- src/common/string_util.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index 7fb7ede5e3..2ec4c8e055 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -2,7 +2,7 @@ // Licensed under GPLv2 // Refer to the license.txt file included. -#include +#include #include "common/common.h" #include "common/string_util.h" @@ -18,13 +18,13 @@ namespace Common { /// Make a string lowercase std::string ToLower(std::string str) { - std::transform(str.begin(), str.end(), str.begin(), ::tolower); + boost::transform(str, str.begin(), ::tolower); return str; } /// Make a string uppercase std::string ToUpper(std::string str) { - std::transform(str.begin(), str.end(), str.begin(), ::toupper); + boost::transform(str, str.begin(), ::toupper); return str; }