citra-emu
/
citra-canary
Archived
1
0
Fork 0

Merge pull request #3719 from wwylele/regs-pipeline-type

regs_pipeline: use proper unsigned type where applicable
This commit is contained in:
Weiyi Wang 2018-05-09 13:51:36 +03:00 committed by GitHub
commit 3bd1cd0b2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 11 deletions

View File

@ -5,7 +5,6 @@
#pragma once
#include <array>
#include "common/assert.h"
#include "common/bit_field.h"
#include "common/common_funcs.h"
@ -64,35 +63,35 @@ struct PipelineRegs {
BitField<28, 4, u32> max_attribute_index;
};
inline VertexAttributeFormat GetFormat(int n) const {
VertexAttributeFormat GetFormat(std::size_t n) const {
VertexAttributeFormat formats[] = {format0, format1, format2, format3,
format4, format5, format6, format7,
format8, format9, format10, format11};
return formats[n];
}
inline int GetNumElements(int n) const {
u32 GetNumElements(std::size_t n) const {
u32 sizes[] = {size0, size1, size2, size3, size4, size5,
size6, size7, size8, size9, size10, size11};
return (int)sizes[n] + 1;
return sizes[n] + 1;
}
inline int GetElementSizeInBytes(int n) const {
u32 GetElementSizeInBytes(std::size_t n) const {
return (GetFormat(n) == VertexAttributeFormat::FLOAT)
? 4
: (GetFormat(n) == VertexAttributeFormat::SHORT) ? 2 : 1;
}
inline int GetStride(int n) const {
u32 GetStride(std::size_t n) const {
return GetNumElements(n) * GetElementSizeInBytes(n);
}
inline bool IsDefaultAttribute(int id) const {
bool IsDefaultAttribute(std::size_t id) const {
return (id >= 12) || (attribute_mask & (1ULL << id)) != 0;
}
inline int GetNumTotalAttributes() const {
return (int)max_attribute_index + 1;
u32 GetNumTotalAttributes() const {
return max_attribute_index + 1;
}
// Attribute loaders map the source vertex data to input attributes
@ -124,10 +123,10 @@ struct PipelineRegs {
BitField<28, 4, u32> component_count;
};
inline int GetComponent(int n) const {
u32 GetComponent(std::size_t n) const {
u32 components[] = {comp0, comp1, comp2, comp3, comp4, comp5,
comp6, comp7, comp8, comp9, comp10, comp11};
return (int)components[n];
return components[n];
}
} attribute_loaders[12];
} vertex_attributes;