diff options
| author | Lioncash <mathew1800@gmail.com> | 2019-05-30 09:29:20 -0400 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2019-05-30 10:29:50 -0400 |
| commit | be9a03b35fbf53e2e7a68d869607d8913dd2a699 (patch) | |
| tree | 08b5c13480fcc5f2647cc6264dd4756d97279aaf /Source/Core/VideoCommon/VertexLoader_Position.cpp | |
| parent | 60a1d0593c27315743d336ca11ed04a9fc2464c4 (diff) | |
VertexLoader_Position: Place helper functions in anonymous namespace
Diffstat (limited to 'Source/Core/VideoCommon/VertexLoader_Position.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/VertexLoader_Position.cpp | 123 |
1 files changed, 33 insertions, 90 deletions
diff --git a/Source/Core/VideoCommon/VertexLoader_Position.cpp b/Source/Core/VideoCommon/VertexLoader_Position.cpp index a21061ac55..1cb38a88c4 100644 --- a/Source/Core/VideoCommon/VertexLoader_Position.cpp +++ b/Source/Core/VideoCommon/VertexLoader_Position.cpp @@ -16,14 +16,16 @@ #include "VideoCommon/VertexLoaderUtils.h" #include "VideoCommon/VideoCommon.h" +namespace +{ template <typename T> -float PosScale(T val, float scale) +constexpr float PosScale(T val, float scale) { return val * scale; } template <> -float PosScale(float val, float scale) +constexpr float PosScale(float val, [[maybe_unused]] float scale) { return val; } @@ -32,13 +34,13 @@ template <typename T, int N> void Pos_ReadDirect(VertexLoader* loader) { static_assert(N <= 3, "N > 3 is not sane!"); - auto const scale = loader->m_posScale; + const auto scale = loader->m_posScale; DataReader dst(g_vertex_manager_write_ptr, nullptr); DataReader src(g_video_buffer_read_ptr, nullptr); for (int i = 0; i < N; ++i) { - float value = PosScale(src.Read<T>(), scale); + const float value = PosScale(src.Read<T>(), scale); if (loader->m_counter < 3) VertexLoaderManager::position_cache[loader->m_counter][i] = value; dst.Write(value); @@ -55,17 +57,17 @@ void Pos_ReadIndex(VertexLoader* loader) static_assert(std::is_unsigned<I>::value, "Only unsigned I is sane!"); static_assert(N <= 3, "N > 3 is not sane!"); - auto const index = DataRead<I>(); + const auto index = DataRead<I>(); loader->m_vertexSkip = index == std::numeric_limits<I>::max(); - auto const data = + const auto data = reinterpret_cast<const T*>(VertexLoaderManager::cached_arraybases[ARRAY_POSITION] + (index * g_main_cp_state.array_strides[ARRAY_POSITION])); - auto const scale = loader->m_posScale; + const auto scale = loader->m_posScale; DataReader dst(g_vertex_manager_write_ptr, nullptr); for (int i = 0; i < N; ++i) { - float value = PosScale(Common::FromBigEndian(data[i]), scale); + const float value = PosScale(Common::FromBigEndian(data[i]), scale); if (loader->m_counter < 3) VertexLoaderManager::position_cache[loader->m_counter][i] = value; dst.Write(value); @@ -75,7 +77,7 @@ void Pos_ReadIndex(VertexLoader* loader) LOG_VTX(); } -static TPipelineFunction tableReadPosition[4][8][2] = { +TPipelineFunction tableReadPosition[4][8][2] = { { { nullptr, @@ -166,96 +168,37 @@ static TPipelineFunction tableReadPosition[4][8][2] = { }, }; -static int tableReadPositionVertexSize[4][8][2] = { +int tableReadPositionVertexSize[4][8][2] = { { - { - 0, - 0, - }, - { - 0, - 0, - }, - { - 0, - 0, - }, - { - 0, - 0, - }, - { - 0, - 0, - }, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, }, { - { - 2, - 3, - }, - { - 2, - 3, - }, - { - 4, - 6, - }, - { - 4, - 6, - }, - { - 8, - 12, - }, + {2, 3}, + {2, 3}, + {4, 6}, + {4, 6}, + {8, 12}, }, { - { - 1, - 1, - }, - { - 1, - 1, - }, - { - 1, - 1, - }, - { - 1, - 1, - }, - { - 1, - 1, - }, + {1, 1}, + {1, 1}, + {1, 1}, + {1, 1}, + {1, 1}, }, { - { - 2, - 2, - }, - { - 2, - 2, - }, - { - 2, - 2, - }, - { - 2, - 2, - }, - { - 2, - 2, - }, + {2, 2}, + {2, 2}, + {2, 2}, + {2, 2}, + {2, 2}, }, }; +} // Anonymous namespace unsigned int VertexLoader_Position::GetSize(u64 _type, unsigned int _format, unsigned int _elements) { |
