Fix build errors related to formatting non-scoped enums

This commit is contained in:
Pokechu22
2022-10-11 14:23:38 -07:00
parent b051903c3d
commit cc5640245c
31 changed files with 234 additions and 182 deletions

View File

@ -32,18 +32,18 @@ static inline GLuint VarToGL(ComponentFormat t)
return lookup[t];
}
static void SetPointer(u32 attrib, u32 stride, const AttributeFormat& format)
static void SetPointer(ShaderAttrib attrib, u32 stride, const AttributeFormat& format)
{
if (!format.enable)
return;
glEnableVertexAttribArray(attrib);
glEnableVertexAttribArray(static_cast<GLuint>(attrib));
if (format.integer)
glVertexAttribIPointer(attrib, format.components, VarToGL(format.type), stride,
(u8*)nullptr + format.offset);
glVertexAttribIPointer(static_cast<GLuint>(attrib), format.components, VarToGL(format.type),
stride, (u8*)nullptr + format.offset);
else
glVertexAttribPointer(attrib, format.components, VarToGL(format.type), true, stride,
(u8*)nullptr + format.offset);
glVertexAttribPointer(static_cast<GLuint>(attrib), format.components, VarToGL(format.type),
true, stride, (u8*)nullptr + format.offset);
}
GLVertexFormat::GLVertexFormat(const PortableVertexDeclaration& vtx_decl)
@ -65,18 +65,18 @@ GLVertexFormat::GLVertexFormat(const PortableVertexDeclaration& vtx_decl)
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vm->GetIndexBufferHandle());
glBindBuffer(GL_ARRAY_BUFFER, vm->GetVertexBufferHandle());
SetPointer(SHADER_POSITION_ATTRIB, vertex_stride, vtx_decl.position);
SetPointer(ShaderAttrib::Position, vertex_stride, vtx_decl.position);
for (int i = 0; i < 3; i++)
SetPointer(SHADER_NORMAL_ATTRIB + i, vertex_stride, vtx_decl.normals[i]);
for (u32 i = 0; i < 3; i++)
SetPointer(ShaderAttrib::Normal + i, vertex_stride, vtx_decl.normals[i]);
for (int i = 0; i < 2; i++)
SetPointer(SHADER_COLOR0_ATTRIB + i, vertex_stride, vtx_decl.colors[i]);
for (u32 i = 0; i < 2; i++)
SetPointer(ShaderAttrib::Color0 + i, vertex_stride, vtx_decl.colors[i]);
for (int i = 0; i < 8; i++)
SetPointer(SHADER_TEXTURE0_ATTRIB + i, vertex_stride, vtx_decl.texcoords[i]);
for (u32 i = 0; i < 8; i++)
SetPointer(ShaderAttrib::TexCoord0 + i, vertex_stride, vtx_decl.texcoords[i]);
SetPointer(SHADER_POSMTX_ATTRIB, vertex_stride, vtx_decl.posmtx);
SetPointer(ShaderAttrib::PositionMatrix, vertex_stride, vtx_decl.posmtx);
}
GLVertexFormat::~GLVertexFormat()