summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/VertexLoaderManager.cpp
diff options
context:
space:
mode:
authorTilka <tilkax@gmail.com>2024-04-20 21:16:54 +0100
committerGitHub <noreply@github.com>2024-04-20 21:16:54 +0100
commitf1e40f73bd2a9da298d9aceafa7f956041bac142 (patch)
tree16727f3ab7552bc6d668df2c0b3482ba3a23284b /Source/Core/VideoCommon/VertexLoaderManager.cpp
parent6443084e8c355001ad298b03423b8e4f1a6cf042 (diff)
parentc204b33314802d5e5719990d76bccc87a1907c9d (diff)
Merge pull request #12705 from JosJuice/get-span-for-address
Memmap: Replace GetPointer with GetSpanForAddress
Diffstat (limited to 'Source/Core/VideoCommon/VertexLoaderManager.cpp')
-rw-r--r--Source/Core/VideoCommon/VertexLoaderManager.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/Source/Core/VideoCommon/VertexLoaderManager.cpp b/Source/Core/VideoCommon/VertexLoaderManager.cpp
index 8ae9a9aa46..0c48bf32a8 100644
--- a/Source/Core/VideoCommon/VertexLoaderManager.cpp
+++ b/Source/Core/VideoCommon/VertexLoaderManager.cpp
@@ -91,26 +91,35 @@ void UpdateVertexArrayPointers()
// Note: Only array bases 0 through 11 are used by the Vertex loaders.
// 12 through 15 are used for loading data into xfmem.
// We also only update the array base if the vertex description states we are going to use it.
+ // TODO: For memory safety, we need to check the sizes returned by GetSpanForAddress
if (IsIndexed(g_main_cp_state.vtx_desc.low.Position))
+ {
cached_arraybases[CPArray::Position] =
- memory.GetPointer(g_main_cp_state.array_bases[CPArray::Position]);
+ memory.GetSpanForAddress(g_main_cp_state.array_bases[CPArray::Position]).data();
+ }
if (IsIndexed(g_main_cp_state.vtx_desc.low.Normal))
+ {
cached_arraybases[CPArray::Normal] =
- memory.GetPointer(g_main_cp_state.array_bases[CPArray::Normal]);
+ memory.GetSpanForAddress(g_main_cp_state.array_bases[CPArray::Normal]).data();
+ }
for (u8 i = 0; i < g_main_cp_state.vtx_desc.low.Color.Size(); i++)
{
if (IsIndexed(g_main_cp_state.vtx_desc.low.Color[i]))
+ {
cached_arraybases[CPArray::Color0 + i] =
- memory.GetPointer(g_main_cp_state.array_bases[CPArray::Color0 + i]);
+ memory.GetSpanForAddress(g_main_cp_state.array_bases[CPArray::Color0 + i]).data();
+ }
}
for (u8 i = 0; i < g_main_cp_state.vtx_desc.high.TexCoord.Size(); i++)
{
if (IsIndexed(g_main_cp_state.vtx_desc.high.TexCoord[i]))
+ {
cached_arraybases[CPArray::TexCoord0 + i] =
- memory.GetPointer(g_main_cp_state.array_bases[CPArray::TexCoord0 + i]);
+ memory.GetSpanForAddress(g_main_cp_state.array_bases[CPArray::TexCoord0 + i]).data();
+ }
}
g_bases_dirty = false;