mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-09 23:59:27 +01:00
VideoCommon: Rename s_pCurBufferPointer
This commit is contained in:
parent
50de4238bb
commit
02cdb41d3d
@ -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]();
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <vector>
|
||||
#include "Common/CommonFuncs.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "VideoCommon/DataReader.h"
|
||||
|
||||
class NativeVertexFormat;
|
||||
class PointerWrap;
|
||||
|
@ -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()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user