VideoCommon: Use std::array in PortableVertexDeclaration

This commit is contained in:
TellowKrinkle 2022-08-03 01:13:55 -05:00
parent 28b31b8327
commit 1eb3aaa548
5 changed files with 11 additions and 10 deletions

View File

@ -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]);

View File

@ -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]);

View File

@ -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

View File

@ -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

View File

@ -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]);