mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Minor change to ease video plugin merging. Made static NativeVertexFormat::Create function into a virtual function of VertexManager. I believe this is the last bit of code which is only declared in VideoCommon and defined in each of the plugins.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6479 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -99,15 +99,14 @@ public:
|
|||||||
|
|
||||||
int GetVertexStride() const { return vertex_stride; }
|
int GetVertexStride() const { return vertex_stride; }
|
||||||
|
|
||||||
static NativeVertexFormat *Create();
|
// TODO: move this under private:
|
||||||
|
|
||||||
// TODO: move these in under private:
|
|
||||||
u32 m_components; // VB_HAS_X. Bitmask telling what vertex components are present.
|
u32 m_components; // VB_HAS_X. Bitmask telling what vertex components are present.
|
||||||
u32 vertex_stride;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Let subclasses construct.
|
// Let subclasses construct.
|
||||||
NativeVertexFormat() {}
|
NativeVertexFormat() {}
|
||||||
|
|
||||||
|
u32 vertex_stride;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _NATIVEVERTEXFORMAT_H
|
#endif // _NATIVEVERTEXFORMAT_H
|
||||||
|
@ -183,7 +183,7 @@ VertexLoader::VertexLoader(const TVtxDesc &vtx_desc, const VAT &vtx_attr)
|
|||||||
m_numLoadedVertices = 0;
|
m_numLoadedVertices = 0;
|
||||||
m_VertexSize = 0;
|
m_VertexSize = 0;
|
||||||
m_numPipelineStages = 0;
|
m_numPipelineStages = 0;
|
||||||
m_NativeFmt = NativeVertexFormat::Create();
|
m_NativeFmt = g_vertex_manager->CreateNativeVertexFormat();
|
||||||
loop_counter = 0;
|
loop_counter = 0;
|
||||||
VertexLoader_Normal::Init();
|
VertexLoader_Normal::Init();
|
||||||
VertexLoader_Position::Init();
|
VertexLoader_Position::Init();
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
#ifndef _VERTEXMANAGERBASE_H
|
#ifndef _VERTEXMANAGERBASE_H
|
||||||
#define _VERTEXMANAGERBASE_H
|
#define _VERTEXMANAGERBASE_H
|
||||||
|
|
||||||
|
class NativeVertexFormat;
|
||||||
|
|
||||||
class VertexManager
|
class VertexManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -35,6 +37,8 @@ public:
|
|||||||
|
|
||||||
static void Flush();
|
static void Flush();
|
||||||
|
|
||||||
|
virtual ::NativeVertexFormat* CreateNativeVertexFormat() = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// TODO: make private after Flush() is merged
|
// TODO: make private after Flush() is merged
|
||||||
static void ResetBuffer();
|
static void ResetBuffer();
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include "CPMemory.h"
|
#include "CPMemory.h"
|
||||||
#include "NativeVertexFormat.h"
|
#include "NativeVertexFormat.h"
|
||||||
|
#include "VertexManager.h"
|
||||||
|
|
||||||
class D3DVertexFormat : public NativeVertexFormat
|
class D3DVertexFormat : public NativeVertexFormat
|
||||||
{
|
{
|
||||||
@ -33,19 +34,20 @@ class D3DVertexFormat : public NativeVertexFormat
|
|||||||
UINT m_num_elems;
|
UINT m_num_elems;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
D3DVertexFormat();
|
D3DVertexFormat() : m_num_elems(0) {}
|
||||||
~D3DVertexFormat();
|
|
||||||
void Initialize(const PortableVertexDeclaration &_vtx_decl);
|
void Initialize(const PortableVertexDeclaration &_vtx_decl);
|
||||||
void SetupVertexPointers() const;
|
void SetupVertexPointers() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
NativeVertexFormat* NativeVertexFormat::Create()
|
namespace DX11
|
||||||
|
{
|
||||||
|
|
||||||
|
NativeVertexFormat* VertexManager::CreateNativeVertexFormat()
|
||||||
{
|
{
|
||||||
return new D3DVertexFormat();
|
return new D3DVertexFormat();
|
||||||
}
|
}
|
||||||
|
|
||||||
D3DVertexFormat::D3DVertexFormat() : m_num_elems(0) { }
|
}
|
||||||
D3DVertexFormat::~D3DVertexFormat() {}
|
|
||||||
|
|
||||||
DXGI_FORMAT VarToD3D(VarType t, int size)
|
DXGI_FORMAT VarToD3D(VarType t, int size)
|
||||||
{
|
{
|
||||||
|
@ -33,6 +33,8 @@ public:
|
|||||||
VertexManager();
|
VertexManager();
|
||||||
~VertexManager();
|
~VertexManager();
|
||||||
|
|
||||||
|
NativeVertexFormat* CreateNativeVertexFormat();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void CreateDeviceObjects();
|
void CreateDeviceObjects();
|
||||||
void DestroyDeviceObjects();
|
void DestroyDeviceObjects();
|
||||||
|
@ -26,25 +26,27 @@
|
|||||||
|
|
||||||
#include "CPMemory.h"
|
#include "CPMemory.h"
|
||||||
#include "NativeVertexFormat.h"
|
#include "NativeVertexFormat.h"
|
||||||
|
#include "VertexManager.h"
|
||||||
|
|
||||||
class D3DVertexFormat : public NativeVertexFormat
|
class D3DVertexFormat : public NativeVertexFormat
|
||||||
{
|
{
|
||||||
LPDIRECT3DVERTEXDECLARATION9 d3d_decl;
|
LPDIRECT3DVERTEXDECLARATION9 d3d_decl;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
D3DVertexFormat();
|
D3DVertexFormat() : d3d_decl(NULL) {}
|
||||||
~D3DVertexFormat();
|
~D3DVertexFormat();
|
||||||
virtual void Initialize(const PortableVertexDeclaration &_vtx_decl);
|
virtual void Initialize(const PortableVertexDeclaration &_vtx_decl);
|
||||||
virtual void SetupVertexPointers() const;
|
virtual void SetupVertexPointers() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
NativeVertexFormat *NativeVertexFormat::Create()
|
namespace DX9
|
||||||
|
{
|
||||||
|
|
||||||
|
NativeVertexFormat* VertexManager::CreateNativeVertexFormat()
|
||||||
{
|
{
|
||||||
return new D3DVertexFormat();
|
return new D3DVertexFormat();
|
||||||
}
|
}
|
||||||
|
|
||||||
D3DVertexFormat::D3DVertexFormat() : d3d_decl(NULL)
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
D3DVertexFormat::~D3DVertexFormat()
|
D3DVertexFormat::~D3DVertexFormat()
|
||||||
@ -93,8 +95,8 @@ void D3DVertexFormat::Initialize(const PortableVertexDeclaration &_vtx_decl)
|
|||||||
{
|
{
|
||||||
vertex_stride = _vtx_decl.stride;
|
vertex_stride = _vtx_decl.stride;
|
||||||
|
|
||||||
D3DVERTEXELEMENT9 *elems = new D3DVERTEXELEMENT9[32];
|
D3DVERTEXELEMENT9 elems[32];
|
||||||
memset(elems, 0, sizeof(D3DVERTEXELEMENT9) * 32);
|
memset(elems, 0, sizeof(elems));
|
||||||
|
|
||||||
// There's only one stream and it's 0, so the above memset takes care of that - no need to set Stream.
|
// There's only one stream and it's 0, so the above memset takes care of that - no need to set Stream.
|
||||||
// Same for method.
|
// Same for method.
|
||||||
@ -161,7 +163,6 @@ void D3DVertexFormat::Initialize(const PortableVertexDeclaration &_vtx_decl)
|
|||||||
PanicAlert("Failed to create D3D vertex declaration!");
|
PanicAlert("Failed to create D3D vertex declaration!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
delete [] elems;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void D3DVertexFormat::SetupVertexPointers() const
|
void D3DVertexFormat::SetupVertexPointers() const
|
||||||
|
@ -28,6 +28,8 @@ namespace DX9
|
|||||||
|
|
||||||
class VertexManager : public ::VertexManager
|
class VertexManager : public ::VertexManager
|
||||||
{
|
{
|
||||||
|
NativeVertexFormat* CreateNativeVertexFormat();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Draw(int stride);
|
void Draw(int stride);
|
||||||
// temp
|
// temp
|
||||||
|
@ -24,10 +24,11 @@
|
|||||||
|
|
||||||
#include "CPMemory.h"
|
#include "CPMemory.h"
|
||||||
#include "NativeVertexFormat.h"
|
#include "NativeVertexFormat.h"
|
||||||
#include "VertexManagerBase.h"
|
#include "VertexManager.h"
|
||||||
|
|
||||||
#define COMPILED_CODE_SIZE 4096
|
#define COMPILED_CODE_SIZE 4096
|
||||||
|
|
||||||
|
// TODO: this guy is never initialized
|
||||||
u32 s_prevcomponents; // previous state set
|
u32 s_prevcomponents; // previous state set
|
||||||
/*
|
/*
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -67,12 +68,16 @@ public:
|
|||||||
virtual void EnableComponents(u32 components);
|
virtual void EnableComponents(u32 components);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace OGL
|
||||||
|
{
|
||||||
|
|
||||||
NativeVertexFormat *NativeVertexFormat::Create()
|
NativeVertexFormat* VertexManager::CreateNativeVertexFormat()
|
||||||
{
|
{
|
||||||
return new GLVertexFormat();
|
return new GLVertexFormat();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
GLVertexFormat::GLVertexFormat()
|
GLVertexFormat::GLVertexFormat()
|
||||||
{
|
{
|
||||||
#ifdef USE_JIT
|
#ifdef USE_JIT
|
||||||
|
@ -32,6 +32,8 @@ class VertexManager : public ::VertexManager
|
|||||||
public:
|
public:
|
||||||
VertexManager();
|
VertexManager();
|
||||||
|
|
||||||
|
NativeVertexFormat* CreateNativeVertexFormat();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Draw();
|
void Draw();
|
||||||
// temp
|
// temp
|
||||||
|
Reference in New Issue
Block a user