summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorTellowKrinkle <tellowkrinkle@gmail.com>2022-08-03 01:13:55 -0500
committerTellowKrinkle <tellowkrinkle@gmail.com>2022-09-19 16:28:24 -0500
commit1eb3aaa5484a05037d51899ff35d9c553962373e (patch)
tree4f277ae8547bdf2602f15760dfdbe0f1782df719 /Source/Core
parent28b31b83279925245d82627542c2928800e96d29 (diff)
VideoCommon: Use std::array in PortableVertexDeclaration
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/VideoBackends/Metal/MTLObjectCache.mm3
-rw-r--r--Source/Core/VideoBackends/Metal/MTLVertexFormat.mm2
-rw-r--r--Source/Core/VideoCommon/ConstantManager.h6
-rw-r--r--Source/Core/VideoCommon/NativeVertexFormat.h6
-rw-r--r--Source/Core/VideoCommon/VertexShaderManager.cpp4
5 files changed, 11 insertions, 10 deletions
diff --git a/Source/Core/VideoBackends/Metal/MTLObjectCache.mm b/Source/Core/VideoBackends/Metal/MTLObjectCache.mm
index 49a9f4b1fb..9b1fa92fb1 100644
--- a/Source/Core/VideoBackends/Metal/MTLObjectCache.mm
+++ b/Source/Core/VideoBackends/Metal/MTLObjectCache.mm
@@ -289,7 +289,8 @@ public:
}
};
template <size_t N>
- static void CopyAll(std::array<VertexAttribute, N>& output, const AttributeFormat (&input)[N])
+ static void CopyAll(std::array<VertexAttribute, N>& output,
+ const std::array<AttributeFormat, N>& input)
{
for (size_t i = 0; i < N; ++i)
output[i] = VertexAttribute(input[i]);
diff --git a/Source/Core/VideoBackends/Metal/MTLVertexFormat.mm b/Source/Core/VideoBackends/Metal/MTLVertexFormat.mm
index 6453c5189a..d9407402e2 100644
--- a/Source/Core/VideoBackends/Metal/MTLVertexFormat.mm
+++ b/Source/Core/VideoBackends/Metal/MTLVertexFormat.mm
@@ -125,7 +125,7 @@ static void SetAttribute(MTLVertexDescriptor* desc, u32 attribute, const Attribu
template <size_t N>
static void SetAttributes(MTLVertexDescriptor* desc, u32 attribute,
- const AttributeFormat (&format)[N])
+ const std::array<AttributeFormat, N>& format)
{
for (size_t i = 0; i < N; ++i)
SetAttribute(desc, attribute + i, format[i]);
diff --git a/Source/Core/VideoCommon/ConstantManager.h b/Source/Core/VideoCommon/ConstantManager.h
index b9ca0264ef..c3427ba37f 100644
--- a/Source/Core/VideoCommon/ConstantManager.h
+++ b/Source/Core/VideoCommon/ConstantManager.h
@@ -95,11 +95,11 @@ struct VertexShaderConstants
float4 cached_binormal;
// For UberShader vertex loader
u32 vertex_stride;
- u32 vertex_offset_normals[3];
+ std::array<u32, 3> vertex_offset_normals;
u32 vertex_offset_position;
u32 vertex_offset_posmtx;
- u32 vertex_offset_colors[2];
- u32 vertex_offset_texcoords[8];
+ std::array<u32, 2> vertex_offset_colors;
+ std::array<u32, 8> vertex_offset_texcoords;
};
struct GeometryShaderConstants
diff --git a/Source/Core/VideoCommon/NativeVertexFormat.h b/Source/Core/VideoCommon/NativeVertexFormat.h
index 55e1a40178..89f3a06db5 100644
--- a/Source/Core/VideoCommon/NativeVertexFormat.h
+++ b/Source/Core/VideoCommon/NativeVertexFormat.h
@@ -58,9 +58,9 @@ struct PortableVertexDeclaration
int stride;
AttributeFormat position;
- AttributeFormat normals[3];
- AttributeFormat colors[2];
- AttributeFormat texcoords[8];
+ std::array<AttributeFormat, 3> normals;
+ std::array<AttributeFormat, 2> colors;
+ std::array<AttributeFormat, 8> texcoords;
AttributeFormat posmtx;
inline bool operator<(const PortableVertexDeclaration& b) const
diff --git a/Source/Core/VideoCommon/VertexShaderManager.cpp b/Source/Core/VideoCommon/VertexShaderManager.cpp
index 78bf54da66..b74c820271 100644
--- a/Source/Core/VideoCommon/VertexShaderManager.cpp
+++ b/Source/Core/VideoCommon/VertexShaderManager.cpp
@@ -626,8 +626,8 @@ static void UpdateOffset(bool* dirty, bool include_components, u32* old_value,
}
template <size_t N>
-static void UpdateOffsets(bool* dirty, bool include_components, u32 (*old_value)[N],
- const AttributeFormat (&attribute)[N])
+static void UpdateOffsets(bool* dirty, bool include_components, std::array<u32, N>* old_value,
+ const std::array<AttributeFormat, N>& attribute)
{
for (size_t i = 0; i < N; i++)
UpdateOffset(dirty, include_components, &(*old_value)[i], attribute[i]);