Permalink
Browse files

Modify IndexConverter class to functor.

  • Loading branch information...
xebra committed Jan 30, 2018
1 parent d8ccc1c commit 15a11d58c99384a836d9ca9d377e774e44447c4f
Showing with 11 additions and 11 deletions.
  1. +4 −4 GPU/Common/SplineCommon.cpp
  2. +1 −1 GPU/Common/VertexDecoderCommon.h
  3. +6 −6 GPU/Software/TransformUnit.cpp
@@ -873,7 +873,7 @@ void DrawEngineCommon::SubmitSpline(const void *control_points, const void *indi
u16 index_lower_bound = 0;
u16 index_upper_bound = count_u * count_v - 1;
IndexConverter idxConv(vertType, indices);
IndexConverter ConvertIndex(vertType, indices);
if (indices)
GetIndexBounds(indices, count_u * count_v, vertType, &index_lower_bound, &index_upper_bound);
@@ -897,7 +897,7 @@ void DrawEngineCommon::SubmitSpline(const void *control_points, const void *indi
// Make an array of pointers to the control points, to get rid of indices.
const SimpleVertex **points = (const SimpleVertex **)managedBuf.Allocate(sizeof(SimpleVertex *) * count_u * count_v);
for (int idx = 0; idx < count_u * count_v; idx++)
points[idx] = simplified_control_points + (indices ? idxConv.convert(idx) : idx);
points[idx] = simplified_control_points + (indices ? ConvertIndex(idx) : idx);
int count = 0;
u8 *dest = splineBuffer;
@@ -960,7 +960,7 @@ void DrawEngineCommon::SubmitBezier(const void *control_points, const void *indi
u16 index_lower_bound = 0;
u16 index_upper_bound = count_u * count_v - 1;
IndexConverter idxConv(vertType, indices);
IndexConverter ConvertIndex(vertType, indices);
if (indices)
GetIndexBounds(indices, count_u*count_v, vertType, &index_lower_bound, &index_upper_bound);
@@ -989,7 +989,7 @@ void DrawEngineCommon::SubmitBezier(const void *control_points, const void *indi
// Make an array of pointers to the control points, to get rid of indices.
const SimpleVertex **points = (const SimpleVertex **)managedBuf.Allocate(sizeof(SimpleVertex *) * count_u * count_v);
for (int idx = 0; idx < count_u * count_v; idx++)
points[idx] = simplified_control_points + (indices ? idxConv.convert(idx) : idx);
points[idx] = simplified_control_points + (indices ? ConvertIndex(idx) : idx);
int count = 0;
u8 *dest = splineBuffer;
@@ -102,7 +102,7 @@ class IndexConverter {
: indices(indices), indexType(vertType & GE_VTYPE_IDX_MASK) {
}
inline u32 convert(u32 index) const {
u32 operator() (u32 index) const {
switch (indexType) {
case GE_VTYPE_IDX_8BIT:
return indices8[index];
@@ -280,7 +280,7 @@ void TransformUnit::SubmitPrimitive(void* vertices, void* indices, GEPrimitiveTy
u16 index_lower_bound = 0;
u16 index_upper_bound = vertex_count - 1;
IndexConverter idxConv(vertex_type, indices);
IndexConverter ConvertIndex(vertex_type, indices);
if (indices)
GetIndexBounds(indices, vertex_count, vertex_type, &index_lower_bound, &index_upper_bound);
@@ -321,7 +321,7 @@ void TransformUnit::SubmitPrimitive(void* vertices, void* indices, GEPrimitiveTy
{
for (int vtx = 0; vtx < vertex_count; ++vtx) {
if (indices) {
vreader.Goto(idxConv.convert(vtx) - index_lower_bound);
vreader.Goto(ConvertIndex(vtx) - index_lower_bound);
} else {
vreader.Goto(vtx);
}
@@ -380,7 +380,7 @@ void TransformUnit::SubmitPrimitive(void* vertices, void* indices, GEPrimitiveTy
int skip_count = data_index == 0 ? 1 : 0;
for (int vtx = 0; vtx < vertex_count; ++vtx) {
if (indices) {
vreader.Goto(idxConv.convert(vtx) - index_lower_bound);
vreader.Goto(ConvertIndex(vtx) - index_lower_bound);
} else {
vreader.Goto(vtx);
}
@@ -410,7 +410,7 @@ void TransformUnit::SubmitPrimitive(void* vertices, void* indices, GEPrimitiveTy
for (int vtx = 0; vtx < vertex_count; ++vtx) {
if (indices) {
vreader.Goto(idxConv.convert(vtx) - index_lower_bound);
vreader.Goto(ConvertIndex(vtx) - index_lower_bound);
} else {
vreader.Goto(vtx);
}
@@ -452,7 +452,7 @@ void TransformUnit::SubmitPrimitive(void* vertices, void* indices, GEPrimitiveTy
// Only read the central vertex if we're not continuing.
if (data_index == 0) {
if (indices) {
vreader.Goto(idxConv.convert(0) - index_lower_bound);
vreader.Goto(ConvertIndex(0) - index_lower_bound);
} else {
vreader.Goto(0);
}
@@ -463,7 +463,7 @@ void TransformUnit::SubmitPrimitive(void* vertices, void* indices, GEPrimitiveTy
for (int vtx = start_vtx; vtx < vertex_count; ++vtx) {
if (indices) {
vreader.Goto(idxConv.convert(vtx) - index_lower_bound);
vreader.Goto(ConvertIndex(vtx) - index_lower_bound);
} else {
vreader.Goto(vtx);
}

0 comments on commit 15a11d5

Please sign in to comment.