From 97d0ff58c8dbe374a1b87e1a72f1f245ed27ed96 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Wed, 13 Apr 2022 16:12:53 -0700 Subject: Convert vertex loader position cache to std::array --- Source/Core/VideoCommon/VertexLoaderManager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Source/Core/VideoCommon/VertexLoaderManager.cpp') diff --git a/Source/Core/VideoCommon/VertexLoaderManager.cpp b/Source/Core/VideoCommon/VertexLoaderManager.cpp index b0922e5a6e..e2881a8e3d 100644 --- a/Source/Core/VideoCommon/VertexLoaderManager.cpp +++ b/Source/Core/VideoCommon/VertexLoaderManager.cpp @@ -31,11 +31,11 @@ namespace VertexLoaderManager { -float position_cache[3][4]; - +// Used by zfreeze +std::array, 3> position_cache; // The counter added to the address of the array is 1, 2, or 3, but never zero. // So only index 1 - 3 are used. -u32 position_matrix_index[4]; +std::array position_matrix_index_cache; static NativeVertexFormatMap s_native_vertex_map; static NativeVertexFormat* s_current_vtx_fmt; -- cgit v1.2.3 From 39b2854b981aadec1576254ad5e4d91dc21c9709 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Thu, 14 Apr 2022 12:01:57 -0700 Subject: VertexLoader: Convert count register to remaining register This more accurately represents what's going on, and also ends at 0 instead of 1, making some indexing operations easier. This also changes it so that position_matrix_index_cache actually starts from index 0 instead of index 1. --- Source/Core/VideoCommon/VertexLoaderManager.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Source/Core/VideoCommon/VertexLoaderManager.cpp') diff --git a/Source/Core/VideoCommon/VertexLoaderManager.cpp b/Source/Core/VideoCommon/VertexLoaderManager.cpp index e2881a8e3d..f5c9578a70 100644 --- a/Source/Core/VideoCommon/VertexLoaderManager.cpp +++ b/Source/Core/VideoCommon/VertexLoaderManager.cpp @@ -32,10 +32,9 @@ namespace VertexLoaderManager { // Used by zfreeze -std::array, 3> position_cache; -// The counter added to the address of the array is 1, 2, or 3, but never zero. -// So only index 1 - 3 are used. -std::array position_matrix_index_cache; +std::array position_matrix_index_cache; +// 3 vertices, 4 floats each to allow SIMD overwrite +alignas(sizeof(std::array)) std::array, 3> position_cache; static NativeVertexFormatMap s_native_vertex_map; static NativeVertexFormat* s_current_vtx_fmt; @@ -251,8 +250,9 @@ static VertexLoaderBase* RefreshLoader(int vtx_attr_group, bool preprocess = fal int RunVertices(int vtx_attr_group, OpcodeDecoder::Primitive primitive, int count, DataReader src, bool is_preprocess) { - if (!count) + if (count == 0) return 0; + ASSERT(count > 0); VertexLoaderBase* loader = RefreshLoader(vtx_attr_group, is_preprocess); -- cgit v1.2.3 From 2a5c77f43ff1d69e78f12f13435a38c5eb2ed854 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Wed, 13 Apr 2022 22:03:34 -0700 Subject: VideoCommon: Handle emboss texgen with only a single normal Fixes a large number of effects in Rogue Squadron 2 and 3. --- Source/Core/VideoCommon/VertexLoaderManager.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Source/Core/VideoCommon/VertexLoaderManager.cpp') diff --git a/Source/Core/VideoCommon/VertexLoaderManager.cpp b/Source/Core/VideoCommon/VertexLoaderManager.cpp index f5c9578a70..7710b7cc20 100644 --- a/Source/Core/VideoCommon/VertexLoaderManager.cpp +++ b/Source/Core/VideoCommon/VertexLoaderManager.cpp @@ -35,6 +35,8 @@ namespace VertexLoaderManager std::array position_matrix_index_cache; // 3 vertices, 4 floats each to allow SIMD overwrite alignas(sizeof(std::array)) std::array, 3> position_cache; +alignas(sizeof(std::array)) std::array tangent_cache; +alignas(sizeof(std::array)) std::array binormal_cache; static NativeVertexFormatMap s_native_vertex_map; static NativeVertexFormat* s_current_vtx_fmt; -- cgit v1.2.3