summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authordegasus <wickmarkus@web.de>2014-12-09 08:30:38 +0100
committerdegasus <wickmarkus@web.de>2014-12-09 18:56:27 +0100
commit02cdb41d3d3eec73d2c843fe865ff906e01b44a4 (patch)
treefc2c7ad8da7c7351a740bfefd6c62a5c9e754f23 /Source/Core
parent50de4238bb1bbceb4797821d8ec428ab1d075aaa (diff)
VideoCommon: Rename s_pCurBufferPointer
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/VideoBackends/Software/SWVertexLoader.cpp8
-rw-r--r--Source/Core/VideoCommon/BoundingBox.cpp2
-rw-r--r--Source/Core/VideoCommon/VertexLoader.cpp9
-rw-r--r--Source/Core/VideoCommon/VertexLoader.h10
-rw-r--r--Source/Core/VideoCommon/VertexLoaderUtils.h5
-rw-r--r--Source/Core/VideoCommon/VertexLoader_Normal.cpp6
-rw-r--r--Source/Core/VideoCommon/VertexLoader_Position.cpp10
-rw-r--r--Source/Core/VideoCommon/VertexLoader_TextCoord.cpp12
-rw-r--r--Source/Core/VideoCommon/VertexManagerBase.h1
-rw-r--r--Source/Core/VideoCommon/VideoCommon.h2
10 files changed, 35 insertions, 30 deletions
diff --git a/Source/Core/VideoBackends/Software/SWVertexLoader.cpp b/Source/Core/VideoBackends/Software/SWVertexLoader.cpp
index baa1a60164..d847f87cfe 100644
--- a/Source/Core/VideoBackends/Software/SWVertexLoader.cpp
+++ b/Source/Core/VideoBackends/Software/SWVertexLoader.cpp
@@ -285,20 +285,20 @@ void SWVertexLoader::LoadTexMtx(SWVertexLoader *vertexLoader, InputVertexData *v
void SWVertexLoader::LoadPosition(SWVertexLoader *vertexLoader, InputVertexData *vertex, u8 unused)
{
- VertexManager::s_pCurBufferPointer = (u8*)&vertex->position;
+ g_vertex_manager_write_ptr = (u8*)&vertex->position;
vertexLoader->m_positionLoader();
}
void SWVertexLoader::LoadNormal(SWVertexLoader *vertexLoader, InputVertexData *vertex, u8 unused)
{
- VertexManager::s_pCurBufferPointer = (u8*)&vertex->normal;
+ g_vertex_manager_write_ptr = (u8*)&vertex->normal;
vertexLoader->m_normalLoader();
}
void SWVertexLoader::LoadColor(SWVertexLoader *vertexLoader, InputVertexData *vertex, u8 index)
{
u32 color;
- VertexManager::s_pCurBufferPointer = (u8*)&color;
+ g_vertex_manager_write_ptr = (u8*)&color;
colIndex = index;
vertexLoader->m_colorLoader[index]();
@@ -308,7 +308,7 @@ void SWVertexLoader::LoadColor(SWVertexLoader *vertexLoader, InputVertexData *ve
void SWVertexLoader::LoadTexCoord(SWVertexLoader *vertexLoader, InputVertexData *vertex, u8 index)
{
- VertexManager::s_pCurBufferPointer = (u8*)&vertex->texCoords[index];
+ g_vertex_manager_write_ptr = (u8*)&vertex->texCoords[index];
tcIndex = index;
vertexLoader->m_texCoordLoader[index]();
}
diff --git a/Source/Core/VideoCommon/BoundingBox.cpp b/Source/Core/VideoCommon/BoundingBox.cpp
index 1c007677e0..4b4400f2e7 100644
--- a/Source/Core/VideoCommon/BoundingBox.cpp
+++ b/Source/Core/VideoCommon/BoundingBox.cpp
@@ -32,7 +32,7 @@ static PortableVertexDeclaration vertexDecl;
// Gets the pointer to the current buffer position
void LOADERDECL SetVertexBufferPosition()
{
- bufferPos = VertexManager::s_pCurBufferPointer;
+ bufferPos = g_vertex_manager_write_ptr;
}
// Prepares the bounding box for new primitive data
diff --git a/Source/Core/VideoCommon/VertexLoader.cpp b/Source/Core/VideoCommon/VertexLoader.cpp
index dfdefd42eb..e767f46638 100644
--- a/Source/Core/VideoCommon/VertexLoader.cpp
+++ b/Source/Core/VideoCommon/VertexLoader.cpp
@@ -45,8 +45,9 @@ int colElements[2];
GC_ALIGNED128(float posScale[4]);
GC_ALIGNED64(float tcScale[8][2]);
-// This pointer is used as the source for all fixed function loader calls
+// This pointer is used as the source/dst for all fixed function loader calls
u8* g_video_buffer_read_ptr;
+u8* g_vertex_manager_write_ptr;
static const float fractionTable[32] = {
1.0f / (1U << 0), 1.0f / (1U << 1), 1.0f / (1U << 2), 1.0f / (1U << 3),
@@ -96,8 +97,8 @@ static void LOADERDECL TexMtx_Write_Float4()
{
#if _M_SSE >= 0x200
__m128 output = _mm_cvtsi32_ss(_mm_castsi128_ps(_mm_setzero_si128()), s_curtexmtx[s_texmtxwrite++]);
- _mm_storeu_ps((float*)VertexManager::s_pCurBufferPointer, _mm_shuffle_ps(output, output, 0x45 /* 1, 1, 0, 1 */));
- VertexManager::s_pCurBufferPointer += sizeof(float) * 4;
+ _mm_storeu_ps((float*)g_vertex_manager_write_ptr, _mm_shuffle_ps(output, output, 0x45 /* 1, 1, 0, 1 */));
+ g_vertex_manager_write_ptr += sizeof(float) * 4;
#else
DataWrite(0.f);
DataWrite(0.f);
@@ -492,8 +493,10 @@ void VertexLoader::ConvertVertices ( int count )
void VertexLoader::RunVertices(const VAT& vat, int primitive, int const count)
{
+ g_vertex_manager_write_ptr = g_vertex_manager->s_pCurBufferPointer;
SetupRunVertices(vat, primitive, count);
ConvertVertices(count);
+ g_vertex_manager->s_pCurBufferPointer = g_vertex_manager_write_ptr;
}
void VertexLoader::SetVAT(const VAT& vat)
diff --git a/Source/Core/VideoCommon/VertexLoader.h b/Source/Core/VideoCommon/VertexLoader.h
index 1eedd13b25..60b9bb3def 100644
--- a/Source/Core/VideoCommon/VertexLoader.h
+++ b/Source/Core/VideoCommon/VertexLoader.h
@@ -194,9 +194,9 @@ __forceinline void Vertex_Read_SSSE3(const T* pData, __m128 scale)
{
coords = _mm_shuffle_epi8(coords, threeIn ? kMaskSwap32_3 : kMaskSwap32_2);
if (threeOut)
- _mm_storeu_si128((__m128i*)VertexManager::s_pCurBufferPointer, coords);
+ _mm_storeu_si128((__m128i*)g_vertex_manager_write_ptr, coords);
else
- _mm_storel_epi64((__m128i*)VertexManager::s_pCurBufferPointer, coords);
+ _mm_storel_epi64((__m128i*)g_vertex_manager_write_ptr, coords);
}
else
{
@@ -213,11 +213,11 @@ __forceinline void Vertex_Read_SSSE3(const T* pData, __m128 scale)
__m128 out = _mm_mul_ps(_mm_cvtepi32_ps(coords), scale);
if (threeOut)
- _mm_storeu_ps((float*)VertexManager::s_pCurBufferPointer, out);
+ _mm_storeu_ps((float*)g_vertex_manager_write_ptr, out);
else
- _mm_storel_pi((__m64*)VertexManager::s_pCurBufferPointer, out);
+ _mm_storel_pi((__m64*)g_vertex_manager_write_ptr, out);
}
- VertexManager::s_pCurBufferPointer += sizeof(float) * (2 + threeOut);
+ g_vertex_manager_write_ptr += sizeof(float) * (2 + threeOut);
}
#endif
diff --git a/Source/Core/VideoCommon/VertexLoaderUtils.h b/Source/Core/VideoCommon/VertexLoaderUtils.h
index 0477437876..f9befb8444 100644
--- a/Source/Core/VideoCommon/VertexLoaderUtils.h
+++ b/Source/Core/VideoCommon/VertexLoaderUtils.h
@@ -7,6 +7,7 @@
#include "VideoCommon/VertexManagerBase.h"
extern u8* g_video_buffer_read_ptr;
+extern u8* g_vertex_manager_write_ptr;
__forceinline void DataSkip(u32 skip)
@@ -88,6 +89,6 @@ __forceinline u8* DataGetPosition()
template <typename T>
__forceinline void DataWrite(T data)
{
- *(T*)VertexManager::s_pCurBufferPointer = data;
- VertexManager::s_pCurBufferPointer += sizeof(T);
+ *(T*)g_vertex_manager_write_ptr = data;
+ g_vertex_manager_write_ptr += sizeof(T);
}
diff --git a/Source/Core/VideoCommon/VertexLoader_Normal.cpp b/Source/Core/VideoCommon/VertexLoader_Normal.cpp
index c66cedbb78..1e428b66a2 100644
--- a/Source/Core/VideoCommon/VertexLoader_Normal.cpp
+++ b/Source/Core/VideoCommon/VertexLoader_Normal.cpp
@@ -14,7 +14,7 @@
#include "VideoCommon/VideoCommon.h"
// warning: mapping buffer should be disabled to use this
-#define LOG_NORM() // PRIM_LOG("norm: %f %f %f, ", ((float*)VertexManager::s_pCurBufferPointer)[-3], ((float*)VertexManager::s_pCurBufferPointer)[-2], ((float*)VertexManager::s_pCurBufferPointer)[-1]);
+#define LOG_NORM() // PRIM_LOG("norm: %f %f %f, ", ((float*)g_vertex_manager_write_ptr)[-3], ((float*)g_vertex_manager_write_ptr)[-2], ((float*)g_vertex_manager_write_ptr)[-1]);
VertexLoader_Normal::Set VertexLoader_Normal::m_Table[NUM_NRM_TYPE][NUM_NRM_INDICES][NUM_NRM_ELEMENTS][NUM_NRM_FORMAT];
@@ -43,14 +43,14 @@ 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!");
- DataReader dst(VertexManager::s_pCurBufferPointer, nullptr);
+ DataReader dst(g_vertex_manager_write_ptr, nullptr);
for (int i = 0; i != N; ++i)
{
dst.Write(FracAdjust(Common::FromBigEndian(data[i])));
}
- dst.WritePointer(&VertexManager::s_pCurBufferPointer);
+ dst.WritePointer(&g_vertex_manager_write_ptr);
LOG_NORM();
}
diff --git a/Source/Core/VideoCommon/VertexLoader_Position.cpp b/Source/Core/VideoCommon/VertexLoader_Position.cpp
index 4dacfd6042..60a6115ee0 100644
--- a/Source/Core/VideoCommon/VertexLoader_Position.cpp
+++ b/Source/Core/VideoCommon/VertexLoader_Position.cpp
@@ -13,7 +13,7 @@
#include "VideoCommon/VideoCommon.h"
// Thoughts on the implementation of a vertex loader compiler.
-// s_pCurBufferPointer should definitely be in a register.
+// g_vertex_manager_write_ptr should definitely be in a register.
// Could load the position scale factor in XMM7, for example.
// The pointer inside DataReadU8 in another.
@@ -75,13 +75,13 @@ void LOADERDECL Pos_ReadDirect()
{
static_assert(N <= 3, "N > 3 is not sane!");
auto const scale = posScale[0];
- DataReader dst(VertexManager::s_pCurBufferPointer, nullptr);
+ DataReader dst(g_vertex_manager_write_ptr, nullptr);
DataReader src(g_video_buffer_read_ptr, nullptr);
for (int i = 0; i < 3; ++i)
dst.Write(i<N ? PosScale(src.Read<T>(), scale) : 0.f);
- dst.WritePointer(&VertexManager::s_pCurBufferPointer);
+ dst.WritePointer(&g_vertex_manager_write_ptr);
src.WritePointer(&g_video_buffer_read_ptr);
LOG_VTX();
}
@@ -95,12 +95,12 @@ void LOADERDECL Pos_ReadIndex()
auto const index = DataRead<I>();
auto const data = reinterpret_cast<const T*>(cached_arraybases[ARRAY_POSITION] + (index * g_main_cp_state.array_strides[ARRAY_POSITION]));
auto const scale = posScale[0];
- DataReader dst(VertexManager::s_pCurBufferPointer, nullptr);
+ DataReader dst(g_vertex_manager_write_ptr, nullptr);
for (int i = 0; i < 3; ++i)
dst.Write(i<N ? PosScale(Common::FromBigEndian(data[i]), scale) : 0.f);
- dst.WritePointer(&VertexManager::s_pCurBufferPointer);
+ dst.WritePointer(&g_vertex_manager_write_ptr);
LOG_VTX();
}
diff --git a/Source/Core/VideoCommon/VertexLoader_TextCoord.cpp b/Source/Core/VideoCommon/VertexLoader_TextCoord.cpp
index 7889e2abcb..002ec13e55 100644
--- a/Source/Core/VideoCommon/VertexLoader_TextCoord.cpp
+++ b/Source/Core/VideoCommon/VertexLoader_TextCoord.cpp
@@ -19,14 +19,14 @@ template <>
__forceinline void LOG_TEX<1>()
{
// warning: mapping buffer should be disabled to use this
- // PRIM_LOG("tex: %f, ", ((float*)VertexManager::s_pCurBufferPointer)[-1]);
+ // PRIM_LOG("tex: %f, ", ((float*)g_vertex_manager_write_ptr)[-1]);
}
template <>
__forceinline void LOG_TEX<2>()
{
// warning: mapping buffer should be disabled to use this
- // PRIM_LOG("tex: %f %f, ", ((float*)VertexManager::s_pCurBufferPointer)[-2], ((float*)VertexManager::s_pCurBufferPointer)[-1]);
+ // PRIM_LOG("tex: %f %f, ", ((float*)g_vertex_manager_write_ptr)[-2], ((float*)g_vertex_manager_write_ptr)[-1]);
}
static void LOADERDECL TexCoord_Read_Dummy()
@@ -50,13 +50,13 @@ template <typename T, int N>
void LOADERDECL TexCoord_ReadDirect()
{
auto const scale = tcScale[tcIndex][0];
- DataReader dst(VertexManager::s_pCurBufferPointer, nullptr);
+ DataReader dst(g_vertex_manager_write_ptr, nullptr);
DataReader src(g_video_buffer_read_ptr, nullptr);
for (int i = 0; i != N; ++i)
dst.Write(TCScale(src.Read<T>(), scale));
- dst.WritePointer(&VertexManager::s_pCurBufferPointer);
+ dst.WritePointer(&g_vertex_manager_write_ptr);
src.WritePointer(&g_video_buffer_read_ptr);
LOG_TEX<N>();
@@ -72,12 +72,12 @@ void LOADERDECL TexCoord_ReadIndex()
auto const data = reinterpret_cast<const T*>(cached_arraybases[ARRAY_TEXCOORD0 + tcIndex]
+ (index * g_main_cp_state.array_strides[ARRAY_TEXCOORD0 + tcIndex]));
auto const scale = tcScale[tcIndex][0];
- DataReader dst(VertexManager::s_pCurBufferPointer, nullptr);
+ DataReader dst(g_vertex_manager_write_ptr, nullptr);
for (int i = 0; i != N; ++i)
dst.Write(TCScale(Common::FromBigEndian(data[i]), scale));
- dst.WritePointer(&VertexManager::s_pCurBufferPointer);
+ dst.WritePointer(&g_vertex_manager_write_ptr);
LOG_TEX<N>();
++tcIndex;
}
diff --git a/Source/Core/VideoCommon/VertexManagerBase.h b/Source/Core/VideoCommon/VertexManagerBase.h
index 604bf0a480..d506d273d2 100644
--- a/Source/Core/VideoCommon/VertexManagerBase.h
+++ b/Source/Core/VideoCommon/VertexManagerBase.h
@@ -3,6 +3,7 @@
#include <vector>
#include "Common/CommonFuncs.h"
#include "Common/CommonTypes.h"
+#include "VideoCommon/DataReader.h"
class NativeVertexFormat;
class PointerWrap;
diff --git a/Source/Core/VideoCommon/VideoCommon.h b/Source/Core/VideoCommon/VideoCommon.h
index e4ba92adda..cdc14b0b1d 100644
--- a/Source/Core/VideoCommon/VideoCommon.h
+++ b/Source/Core/VideoCommon/VideoCommon.h
@@ -61,7 +61,7 @@ struct TargetRectangle : public MathUtil::Rectangle<int>
#endif
// warning: mapping buffer should be disabled to use this
-// #define LOG_VTX() DEBUG_LOG(VIDEO, "vtx: %f %f %f, ", ((float*)VertexManager::s_pCurBufferPointer)[-3], ((float*)VertexManager::s_pCurBufferPointer)[-2], ((float*)VertexManager::s_pCurBufferPointer)[-1]);
+// #define LOG_VTX() DEBUG_LOG(VIDEO, "vtx: %f %f %f, ", ((float*)g_vertex_manager_write_ptr)[-3], ((float*)g_vertex_manager_write_ptr)[-2], ((float*)g_vertex_manager_write_ptr)[-1]);
#define LOG_VTX()