mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
VideoCommon: Use std::array in PortableVertexDeclaration
This commit is contained in:
parent
28b31b8327
commit
1eb3aaa548
@ -289,7 +289,8 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
template <size_t N>
|
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)
|
for (size_t i = 0; i < N; ++i)
|
||||||
output[i] = VertexAttribute(input[i]);
|
output[i] = VertexAttribute(input[i]);
|
||||||
|
@ -125,7 +125,7 @@ static void SetAttribute(MTLVertexDescriptor* desc, u32 attribute, const Attribu
|
|||||||
|
|
||||||
template <size_t N>
|
template <size_t N>
|
||||||
static void SetAttributes(MTLVertexDescriptor* desc, u32 attribute,
|
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)
|
for (size_t i = 0; i < N; ++i)
|
||||||
SetAttribute(desc, attribute + i, format[i]);
|
SetAttribute(desc, attribute + i, format[i]);
|
||||||
|
@ -95,11 +95,11 @@ struct VertexShaderConstants
|
|||||||
float4 cached_binormal;
|
float4 cached_binormal;
|
||||||
// For UberShader vertex loader
|
// For UberShader vertex loader
|
||||||
u32 vertex_stride;
|
u32 vertex_stride;
|
||||||
u32 vertex_offset_normals[3];
|
std::array<u32, 3> vertex_offset_normals;
|
||||||
u32 vertex_offset_position;
|
u32 vertex_offset_position;
|
||||||
u32 vertex_offset_posmtx;
|
u32 vertex_offset_posmtx;
|
||||||
u32 vertex_offset_colors[2];
|
std::array<u32, 2> vertex_offset_colors;
|
||||||
u32 vertex_offset_texcoords[8];
|
std::array<u32, 8> vertex_offset_texcoords;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GeometryShaderConstants
|
struct GeometryShaderConstants
|
||||||
|
@ -58,9 +58,9 @@ struct PortableVertexDeclaration
|
|||||||
int stride;
|
int stride;
|
||||||
|
|
||||||
AttributeFormat position;
|
AttributeFormat position;
|
||||||
AttributeFormat normals[3];
|
std::array<AttributeFormat, 3> normals;
|
||||||
AttributeFormat colors[2];
|
std::array<AttributeFormat, 2> colors;
|
||||||
AttributeFormat texcoords[8];
|
std::array<AttributeFormat, 8> texcoords;
|
||||||
AttributeFormat posmtx;
|
AttributeFormat posmtx;
|
||||||
|
|
||||||
inline bool operator<(const PortableVertexDeclaration& b) const
|
inline bool operator<(const PortableVertexDeclaration& b) const
|
||||||
|
@ -626,8 +626,8 @@ static void UpdateOffset(bool* dirty, bool include_components, u32* old_value,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t N>
|
template <size_t N>
|
||||||
static void UpdateOffsets(bool* dirty, bool include_components, u32 (*old_value)[N],
|
static void UpdateOffsets(bool* dirty, bool include_components, std::array<u32, N>* old_value,
|
||||||
const AttributeFormat (&attribute)[N])
|
const std::array<AttributeFormat, N>& attribute)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < N; i++)
|
for (size_t i = 0; i < N; i++)
|
||||||
UpdateOffset(dirty, include_components, &(*old_value)[i], attribute[i]);
|
UpdateOffset(dirty, include_components, &(*old_value)[i], attribute[i]);
|
||||||
|
Loading…
Reference in New Issue
Block a user