mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-27 06:35:39 +00:00
VertexLoader: inline destionation buffer
This commit is contained in:
parent
c613868f57
commit
0b97b33ceb
@ -132,11 +132,17 @@ __forceinline u8* DataGetPosition()
|
||||
return g_pVideoData;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__forceinline void DataWrite(u8* &dst, T data)
|
||||
{
|
||||
*(T*)dst = data;
|
||||
dst += sizeof(T);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__forceinline void DataWrite(T data)
|
||||
{
|
||||
*(T*)VertexManager::s_pCurBufferPointer = data;
|
||||
VertexManager::s_pCurBufferPointer += sizeof(T);
|
||||
DataWrite(VertexManager::s_pCurBufferPointer, data);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -48,12 +48,15 @@ template <typename T, int N>
|
||||
__forceinline void ReadIndirect(const T* data)
|
||||
{
|
||||
static_assert(3 == N || 9 == N, "N is only sane as 3 or 9!");
|
||||
auto dst = VertexManager::s_pCurBufferPointer;
|
||||
|
||||
for (int i = 0; i != N; ++i)
|
||||
{
|
||||
DataWrite(FracAdjust(Common::FromBigEndian(data[i])));
|
||||
DataWrite(dst, FracAdjust(Common::FromBigEndian(data[i])));
|
||||
}
|
||||
|
||||
VertexManager::s_pCurBufferPointer = dst;
|
||||
|
||||
LOG_NORM();
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -56,9 +56,13 @@ template <typename T, int N>
|
||||
void LOADERDECL TexCoord_ReadDirect()
|
||||
{
|
||||
auto const scale = tcScale[tcIndex];
|
||||
auto dst = VertexManager::s_pCurBufferPointer;
|
||||
|
||||
|
||||
for (int i = 0; i != N; ++i)
|
||||
DataWrite(TCScale(DataRead<T>(), scale));
|
||||
DataWrite(dst, TCScale(DataRead<T>(), scale));
|
||||
|
||||
VertexManager::s_pCurBufferPointer = dst;
|
||||
|
||||
LOG_TEX<N>();
|
||||
|
||||
@ -74,9 +78,12 @@ void LOADERDECL TexCoord_ReadIndex()
|
||||
auto const data = reinterpret_cast<const T*>(cached_arraybases[ARRAY_TEXCOORD0 + tcIndex]
|
||||
+ (index * arraystrides[ARRAY_TEXCOORD0 + tcIndex]));
|
||||
auto const scale = tcScale[tcIndex];
|
||||
auto dst = VertexManager::s_pCurBufferPointer;
|
||||
|
||||
for (int i = 0; i != N; ++i)
|
||||
DataWrite(TCScale(Common::FromBigEndian(data[i]), scale));
|
||||
DataWrite(dst, TCScale(Common::FromBigEndian(data[i]), scale));
|
||||
|
||||
VertexManager::s_pCurBufferPointer = dst;
|
||||
|
||||
LOG_TEX<N>();
|
||||
++tcIndex;
|
||||
|
Loading…
x
Reference in New Issue
Block a user