VertexLoader: inline destionation buffer

This commit is contained in:
degasus
2014-01-21 19:23:07 +01:00
parent c613868f57
commit 0b97b33ceb
4 changed files with 29 additions and 7 deletions

View File

@ -77,9 +77,12 @@ void LOADERDECL Pos_ReadDirect()
{
static_assert(N <= 3, "N > 3 is not sane!");
auto const scale = posScale;
auto dst = VertexManager::s_pCurBufferPointer;
for (int i = 0; i < 3; ++i)
DataWrite(i<N ? PosScale(DataRead<T>(), scale) : 0.f);
DataWrite(dst, i<N ? PosScale(DataRead<T>(), scale) : 0.f);
VertexManager::s_pCurBufferPointer = dst;
LOG_VTX();
}
@ -93,9 +96,12 @@ void LOADERDECL Pos_ReadIndex()
auto const index = DataRead<I>();
auto const data = reinterpret_cast<const T*>(cached_arraybases[ARRAY_POSITION] + (index * arraystrides[ARRAY_POSITION]));
auto const scale = posScale;
auto dst = VertexManager::s_pCurBufferPointer;
for (int i = 0; i < 3; ++i)
DataWrite(i<N ? PosScale(Common::FromBigEndian(data[i]), scale) : 0.f);
DataWrite(dst, i<N ? PosScale(Common::FromBigEndian(data[i]), scale) : 0.f);
VertexManager::s_pCurBufferPointer = dst;
LOG_VTX();
}