VideoCommon: VertexManager -> VertexManagerBase
It may be a bit weird to see calls to static functions in VertexManagerBase now, but at least it's easier to see what's going on.
This commit is contained in:
parent
89f6451513
commit
c52c73f762
|
@ -9,7 +9,7 @@
|
|||
namespace DX11
|
||||
{
|
||||
|
||||
class VertexManager : public ::VertexManager
|
||||
class VertexManager : public VertexManagerBase
|
||||
{
|
||||
public:
|
||||
VertexManager();
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace OGL
|
|||
|
||||
// Handles the OpenGL details of drawing lots of vertices quickly.
|
||||
// Other functionality is moving out.
|
||||
class VertexManager : public ::VertexManager
|
||||
class VertexManager : public VertexManagerBase
|
||||
{
|
||||
public:
|
||||
VertexManager();
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace BPFunctions
|
|||
|
||||
void FlushPipeline()
|
||||
{
|
||||
VertexManager::Flush();
|
||||
VertexManagerBase::Flush();
|
||||
}
|
||||
|
||||
void SetGenerationMode()
|
||||
|
|
|
@ -367,7 +367,7 @@ void RunGpuLoop()
|
|||
|
||||
// The fifo is empty and it's unlikely we will get any more work in the near future.
|
||||
// Make sure VertexManager finishes drawing any primitives it has stored in it's buffer.
|
||||
VertexManager::Flush();
|
||||
VertexManagerBase::Flush();
|
||||
}
|
||||
}, 100);
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ int RunVertices(int vtx_attr_group, int primitive, int count, DataReader src, bo
|
|||
if (loader->m_native_vertex_format != s_current_vtx_fmt ||
|
||||
loader->m_native_components != g_current_components)
|
||||
{
|
||||
VertexManager::Flush();
|
||||
VertexManagerBase::Flush();
|
||||
}
|
||||
s_current_vtx_fmt = loader->m_native_vertex_format;
|
||||
g_current_components = loader->m_native_components;
|
||||
|
@ -197,14 +197,14 @@ int RunVertices(int vtx_attr_group, int primitive, int count, DataReader src, bo
|
|||
// They still need to go through vertex loading, because we need to calculate a zfreeze refrence slope.
|
||||
bool cullall = (bpmem.genMode.cullmode == GenMode::CULL_ALL && primitive < 5);
|
||||
|
||||
DataReader dst = VertexManager::PrepareForAdditionalData(primitive, count,
|
||||
DataReader dst = VertexManagerBase::PrepareForAdditionalData(primitive, count,
|
||||
loader->m_native_vtx_decl.stride, cullall);
|
||||
|
||||
count = loader->RunVertices(src, dst, count);
|
||||
|
||||
IndexGenerator::AddIndices(primitive, count);
|
||||
|
||||
VertexManager::FlushData(count, loader->m_native_vtx_decl.stride);
|
||||
VertexManagerBase::FlushData(count, loader->m_native_vtx_decl.stride);
|
||||
|
||||
ADDSTAT(stats.thisFrame.numPrims, count);
|
||||
INCSTAT(stats.thisFrame.numPrimitiveJoins);
|
||||
|
|
|
@ -22,18 +22,18 @@
|
|||
#include "VideoCommon/VideoConfig.h"
|
||||
#include "VideoCommon/XFMemory.h"
|
||||
|
||||
VertexManager *g_vertex_manager;
|
||||
VertexManagerBase* g_vertex_manager;
|
||||
|
||||
u8 *VertexManager::s_pCurBufferPointer;
|
||||
u8 *VertexManager::s_pBaseBufferPointer;
|
||||
u8 *VertexManager::s_pEndBufferPointer;
|
||||
u8* VertexManagerBase::s_pCurBufferPointer;
|
||||
u8* VertexManagerBase::s_pBaseBufferPointer;
|
||||
u8* VertexManagerBase::s_pEndBufferPointer;
|
||||
|
||||
PrimitiveType VertexManager::current_primitive_type;
|
||||
PrimitiveType VertexManagerBase::current_primitive_type;
|
||||
|
||||
Slope VertexManager::s_zslope;
|
||||
Slope VertexManagerBase::s_zslope;
|
||||
|
||||
bool VertexManager::s_is_flushed;
|
||||
bool VertexManager::s_cull_all;
|
||||
bool VertexManagerBase::s_is_flushed;
|
||||
bool VertexManagerBase::s_cull_all;
|
||||
|
||||
static const PrimitiveType primitive_from_gx[8] = {
|
||||
PRIMITIVE_TRIANGLES, // GX_DRAW_QUADS
|
||||
|
@ -46,22 +46,22 @@ static const PrimitiveType primitive_from_gx[8] = {
|
|||
PRIMITIVE_POINTS, // GX_DRAW_POINTS
|
||||
};
|
||||
|
||||
VertexManager::VertexManager()
|
||||
VertexManagerBase::VertexManagerBase()
|
||||
{
|
||||
s_is_flushed = true;
|
||||
s_cull_all = false;
|
||||
}
|
||||
|
||||
VertexManager::~VertexManager()
|
||||
VertexManagerBase::~VertexManagerBase()
|
||||
{
|
||||
}
|
||||
|
||||
u32 VertexManager::GetRemainingSize()
|
||||
u32 VertexManagerBase::GetRemainingSize()
|
||||
{
|
||||
return (u32)(s_pEndBufferPointer - s_pCurBufferPointer);
|
||||
}
|
||||
|
||||
DataReader VertexManager::PrepareForAdditionalData(int primitive, u32 count, u32 stride, bool cullall)
|
||||
DataReader VertexManagerBase::PrepareForAdditionalData(int primitive, u32 count, u32 stride, bool cullall)
|
||||
{
|
||||
// The SSE vertex loader can write up to 4 bytes past the end
|
||||
u32 const needed_vertex_bytes = count * stride + 4;
|
||||
|
@ -99,12 +99,12 @@ DataReader VertexManager::PrepareForAdditionalData(int primitive, u32 count, u32
|
|||
return DataReader(s_pCurBufferPointer, s_pEndBufferPointer);
|
||||
}
|
||||
|
||||
void VertexManager::FlushData(u32 count, u32 stride)
|
||||
void VertexManagerBase::FlushData(u32 count, u32 stride)
|
||||
{
|
||||
s_pCurBufferPointer += count * stride;
|
||||
}
|
||||
|
||||
u32 VertexManager::GetRemainingIndices(int primitive)
|
||||
u32 VertexManagerBase::GetRemainingIndices(int primitive)
|
||||
{
|
||||
u32 index_len = MAXIBUFFERSIZE - IndexGenerator::GetIndexLen();
|
||||
|
||||
|
@ -162,7 +162,7 @@ u32 VertexManager::GetRemainingIndices(int primitive)
|
|||
}
|
||||
}
|
||||
|
||||
void VertexManager::Flush()
|
||||
void VertexManagerBase::Flush()
|
||||
{
|
||||
if (s_is_flushed)
|
||||
return;
|
||||
|
@ -270,13 +270,13 @@ void VertexManager::Flush()
|
|||
s_cull_all = false;
|
||||
}
|
||||
|
||||
void VertexManager::DoState(PointerWrap& p)
|
||||
void VertexManagerBase::DoState(PointerWrap& p)
|
||||
{
|
||||
p.Do(s_zslope);
|
||||
g_vertex_manager->vDoState(p);
|
||||
}
|
||||
|
||||
void VertexManager::CalculateZSlope(NativeVertexFormat* format)
|
||||
void VertexManagerBase::CalculateZSlope(NativeVertexFormat* format)
|
||||
{
|
||||
float out[12];
|
||||
float viewOffset[2] = { xfmem.viewport.xOrig - bpmem.scissorOffset.x * 2,
|
||||
|
|
|
@ -27,7 +27,7 @@ struct Slope
|
|||
bool dirty;
|
||||
};
|
||||
|
||||
class VertexManager
|
||||
class VertexManagerBase
|
||||
{
|
||||
private:
|
||||
static const u32 SMALLEST_POSSIBLE_VERTEX = sizeof(float)*3; // 3 pos
|
||||
|
@ -41,9 +41,9 @@ public:
|
|||
// We may convert triangle-fans to triangle-lists, almost 3x as many indices.
|
||||
static const u32 MAXIBUFFERSIZE = ROUND_UP_POW2(MAX_PRIMITIVES_PER_COMMAND * 3);
|
||||
|
||||
VertexManager();
|
||||
VertexManagerBase();
|
||||
// needs to be virtual for DX11's dtor
|
||||
virtual ~VertexManager();
|
||||
virtual ~VertexManagerBase();
|
||||
|
||||
static DataReader PrepareForAdditionalData(int primitive, u32 count, u32 stride, bool cullall);
|
||||
static void FlushData(u32 count, u32 stride);
|
||||
|
@ -82,4 +82,4 @@ private:
|
|||
virtual void DestroyDeviceObjects() {}
|
||||
};
|
||||
|
||||
extern VertexManager *g_vertex_manager;
|
||||
extern VertexManagerBase* g_vertex_manager;
|
||||
|
|
|
@ -657,7 +657,7 @@ void VertexShaderManager::SetTexMatrixChangedA(u32 Value)
|
|||
{
|
||||
if (g_main_cp_state.matrix_index_a.Hex != Value)
|
||||
{
|
||||
VertexManager::Flush();
|
||||
VertexManagerBase::Flush();
|
||||
if (g_main_cp_state.matrix_index_a.PosNormalMtxIdx != (Value & 0x3f))
|
||||
bPosNormalMatrixChanged = true;
|
||||
bTexMatricesChanged[0] = true;
|
||||
|
@ -669,7 +669,7 @@ void VertexShaderManager::SetTexMatrixChangedB(u32 Value)
|
|||
{
|
||||
if (g_main_cp_state.matrix_index_b.Hex != Value)
|
||||
{
|
||||
VertexManager::Flush();
|
||||
VertexManagerBase::Flush();
|
||||
bTexMatricesChanged[1] = true;
|
||||
g_main_cp_state.matrix_index_b.Hex = Value;
|
||||
}
|
||||
|
@ -738,7 +738,7 @@ void VertexShaderManager::TransformToClipSpace(const float* data, float* out, u3
|
|||
|
||||
// We use the projection matrix calculated by VertexShaderManager, because it
|
||||
// includes any free look transformations.
|
||||
// Make sure VertexManager::SetConstants() has been called first.
|
||||
// Make sure VertexShaderManager::SetConstants() has been called first.
|
||||
const float* proj_matrix = &g_fProjectionMatrix[0];
|
||||
|
||||
const float t[3] = {
|
||||
|
|
|
@ -54,7 +54,7 @@ static void DoState(PointerWrap &p)
|
|||
GeometryShaderManager::DoState(p);
|
||||
p.DoMarker("GeometryShaderManager");
|
||||
|
||||
VertexManager::DoState(p);
|
||||
VertexManagerBase::DoState(p);
|
||||
p.DoMarker("VertexManager");
|
||||
|
||||
BoundingBox::DoState(p);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
static void XFMemWritten(u32 transferSize, u32 baseAddress)
|
||||
{
|
||||
VertexManager::Flush();
|
||||
VertexManagerBase::Flush();
|
||||
VertexShaderManager::InvalidateXFRange(baseAddress, baseAddress + transferSize);
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ static void XFRegWritten(int transferSize, u32 baseAddress, DataReader src)
|
|||
|
||||
case XFMEM_SETNUMCHAN:
|
||||
if (xfmem.numChan.numColorChans != (newValue & 3))
|
||||
VertexManager::Flush();
|
||||
VertexManagerBase::Flush();
|
||||
break;
|
||||
|
||||
case XFMEM_SETCHAN0_AMBCOLOR: // Channel Ambient Color
|
||||
|
@ -61,7 +61,7 @@ static void XFRegWritten(int transferSize, u32 baseAddress, DataReader src)
|
|||
u8 chan = address - XFMEM_SETCHAN0_AMBCOLOR;
|
||||
if (xfmem.ambColor[chan] != newValue)
|
||||
{
|
||||
VertexManager::Flush();
|
||||
VertexManagerBase::Flush();
|
||||
VertexShaderManager::SetMaterialColorChanged(chan);
|
||||
}
|
||||
break;
|
||||
|
@ -73,7 +73,7 @@ static void XFRegWritten(int transferSize, u32 baseAddress, DataReader src)
|
|||
u8 chan = address - XFMEM_SETCHAN0_MATCOLOR;
|
||||
if (xfmem.matColor[chan] != newValue)
|
||||
{
|
||||
VertexManager::Flush();
|
||||
VertexManagerBase::Flush();
|
||||
VertexShaderManager::SetMaterialColorChanged(chan + 2);
|
||||
}
|
||||
break;
|
||||
|
@ -84,12 +84,12 @@ static void XFRegWritten(int transferSize, u32 baseAddress, DataReader src)
|
|||
case XFMEM_SETCHAN0_ALPHA: // Channel Alpha
|
||||
case XFMEM_SETCHAN1_ALPHA:
|
||||
if (((u32*)&xfmem)[address] != (newValue & 0x7fff))
|
||||
VertexManager::Flush();
|
||||
VertexManagerBase::Flush();
|
||||
break;
|
||||
|
||||
case XFMEM_DUALTEX:
|
||||
if (xfmem.dualTexTrans.enabled != (newValue & 1))
|
||||
VertexManager::Flush();
|
||||
VertexManagerBase::Flush();
|
||||
break;
|
||||
|
||||
|
||||
|
@ -108,7 +108,7 @@ static void XFRegWritten(int transferSize, u32 baseAddress, DataReader src)
|
|||
case XFMEM_SETVIEWPORT+3:
|
||||
case XFMEM_SETVIEWPORT+4:
|
||||
case XFMEM_SETVIEWPORT+5:
|
||||
VertexManager::Flush();
|
||||
VertexManagerBase::Flush();
|
||||
VertexShaderManager::SetViewportChanged();
|
||||
PixelShaderManager::SetViewportChanged();
|
||||
GeometryShaderManager::SetViewportChanged();
|
||||
|
@ -123,7 +123,7 @@ static void XFRegWritten(int transferSize, u32 baseAddress, DataReader src)
|
|||
case XFMEM_SETPROJECTION+4:
|
||||
case XFMEM_SETPROJECTION+5:
|
||||
case XFMEM_SETPROJECTION+6:
|
||||
VertexManager::Flush();
|
||||
VertexManagerBase::Flush();
|
||||
VertexShaderManager::SetProjectionChanged();
|
||||
GeometryShaderManager::SetProjectionChanged();
|
||||
|
||||
|
@ -132,7 +132,7 @@ static void XFRegWritten(int transferSize, u32 baseAddress, DataReader src)
|
|||
|
||||
case XFMEM_SETNUMTEXGENS: // GXSetNumTexGens
|
||||
if (xfmem.numTexGen.numTexGens != (newValue & 15))
|
||||
VertexManager::Flush();
|
||||
VertexManagerBase::Flush();
|
||||
break;
|
||||
|
||||
case XFMEM_SETTEXMTXINFO:
|
||||
|
@ -143,7 +143,7 @@ static void XFRegWritten(int transferSize, u32 baseAddress, DataReader src)
|
|||
case XFMEM_SETTEXMTXINFO+5:
|
||||
case XFMEM_SETTEXMTXINFO+6:
|
||||
case XFMEM_SETTEXMTXINFO+7:
|
||||
VertexManager::Flush();
|
||||
VertexManagerBase::Flush();
|
||||
|
||||
nextAddress = XFMEM_SETTEXMTXINFO + 8;
|
||||
break;
|
||||
|
@ -156,7 +156,7 @@ static void XFRegWritten(int transferSize, u32 baseAddress, DataReader src)
|
|||
case XFMEM_SETPOSMTXINFO+5:
|
||||
case XFMEM_SETPOSMTXINFO+6:
|
||||
case XFMEM_SETPOSMTXINFO+7:
|
||||
VertexManager::Flush();
|
||||
VertexManagerBase::Flush();
|
||||
|
||||
nextAddress = XFMEM_SETPOSMTXINFO + 8;
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue