Aligned all vertex components to 4 byte boundaries - maybe ATI likes that? Renamed and reorganized misc things.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@981 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2008-10-27 21:38:30 +00:00
parent d35fb4e2b0
commit 5129341a9c
33 changed files with 437 additions and 524 deletions

View File

@ -1205,14 +1205,6 @@
RelativePath=".\Src\OpcodeDecoding.cpp"
>
</File>
<File
RelativePath=".\Src\VertexHandler.cpp"
>
</File>
<File
RelativePath=".\Src\VertexHandler.h"
>
</File>
<File
RelativePath=".\Src\VertexLoader.cpp"
>
@ -1245,6 +1237,14 @@
RelativePath=".\Src\VertexLoader_TextCoord.h"
>
</File>
<File
RelativePath=".\Src\VertexManager.cpp"
>
</File>
<File
RelativePath=".\Src\VertexManager.h"
>
</File>
<File
RelativePath=".\Src\XFStructs.cpp"
>

View File

@ -24,7 +24,7 @@
#include "OpcodeDecoding.h"
#include "TextureCache.h"
#include "TextureDecoder.h"
#include "VertexHandler.h"
#include "VertexManager.h"
#include "PixelShader.h"
#include "Utils.h"
@ -112,7 +112,7 @@ void BPWritten(int addr, int changes, int newval)
case BPMEM_GENMODE:
if (changes)
{
CVertexHandler::Flush();
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
// dev->SetRenderState(D3DRS_CULLMODE, d3dCullModes[bpmem.genMode.cullmode]);
@ -146,7 +146,7 @@ void BPWritten(int addr, int changes, int newval)
case BPMEM_IND_MTX+7:
case BPMEM_IND_MTX+8:
if (changes) {
CVertexHandler::Flush();
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
// PixelShaderMngr::SetIndMatrixChanged((addr-BPMEM_IND_MTX)/3);
}
@ -154,7 +154,7 @@ void BPWritten(int addr, int changes, int newval)
case BPMEM_RAS1_SS0:
case BPMEM_RAS1_SS1:
if (changes) {
CVertexHandler::Flush();
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
// PixelShaderMngr::SetIndTexScaleChanged();
}
@ -163,7 +163,7 @@ void BPWritten(int addr, int changes, int newval)
case BPMEM_ZMODE:
if (changes)
{
CVertexHandler::Flush();
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
if (bpmem.zmode.testenable)
{
@ -190,7 +190,7 @@ void BPWritten(int addr, int changes, int newval)
case BPMEM_ALPHACOMPARE:
if (changes)
{
CVertexHandler::Flush();
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
float f[4] =
{
@ -217,7 +217,7 @@ void BPWritten(int addr, int changes, int newval)
case BPMEM_CONSTANTALPHA:
if (changes)
{
CVertexHandler::Flush();
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
float f[4] = {
bpmem.dstalpha.alpha/255.0f,0,0,0
@ -238,7 +238,7 @@ void BPWritten(int addr, int changes, int newval)
case 0x43:
if (changes) {
CVertexHandler::Flush();
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
}
break;
@ -246,7 +246,7 @@ void BPWritten(int addr, int changes, int newval)
case BPMEM_BLENDMODE:
if (changes & 0xFFFF)
{
CVertexHandler::Flush();
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
if (changes & 1)
{
@ -328,7 +328,7 @@ void BPWritten(int addr, int changes, int newval)
{
// u32 fogATemp = bpmem.fog.a<<12;
// float fogA = *(float*)(&fogATemp);
CVertexHandler::Flush();
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
}
break;
@ -336,7 +336,7 @@ void BPWritten(int addr, int changes, int newval)
case BPMEM_FOGBEXPONENT:
case BPMEM_FOGBMAGNITUDE:
{
CVertexHandler::Flush();
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
}
break;
@ -345,7 +345,7 @@ void BPWritten(int addr, int changes, int newval)
//fog settings
if(changes) {
static bool bFog = false;
CVertexHandler::Flush();
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
if(!renderFog)
@ -393,7 +393,7 @@ void BPWritten(int addr, int changes, int newval)
case BPMEM_FOGCOLOR:
if(changes) {
CVertexHandler::Flush();
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
if(!renderFog)
@ -412,7 +412,7 @@ void BPWritten(int addr, int changes, int newval)
case BPMEM_SCISSOROFFSET: //TODO: investigate
{
CVertexHandler::Flush();
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
}
break;
@ -420,7 +420,7 @@ void BPWritten(int addr, int changes, int newval)
case BPMEM_SCISSORTL:
case BPMEM_SCISSORBR:
{
CVertexHandler::Flush();
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
int xoff = bpmem.scissorOffset.x*2-342;
int yoff = bpmem.scissorOffset.y*2-342;
@ -445,7 +445,7 @@ void BPWritten(int addr, int changes, int newval)
break;
case BPMEM_ZTEX1:
if (changes) {
CVertexHandler::Flush();
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
//PRIM_LOG("ztex bias=0x%x\n", bpmem.ztex1.bias);
//PixelShaderMngr::SetZTextureBias(bpmem.ztex1.bias);
@ -453,7 +453,7 @@ void BPWritten(int addr, int changes, int newval)
break;
case BPMEM_ZTEX2:
if (changes) {
CVertexHandler::Flush();
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
#ifdef _DEBUG
const char* pzop[] = {"DISABLE", "ADD", "REPLACE", "?"};
@ -473,7 +473,7 @@ void BPWritten(int addr, int changes, int newval)
case 0xfd: // ksel7
if (changes)
{
CVertexHandler::Flush();
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
// PixelShaderMngr::SetTevKSelChanged(addr-0xf6);
}
@ -486,7 +486,7 @@ void BPWritten(int addr, int changes, int newval)
case 0xA0:
if (changes)
{
CVertexHandler::Flush();
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
FourTexUnits &tex = bpmem.tex[(addr&0xE0)==0xA0];
int stage = (addr&3);//(addr>>4)&2;
@ -534,7 +534,7 @@ void BPWritten(int addr, int changes, int newval)
if (changes)
{
textureChanged[((addr&0xE0)==0xA0)*4+(addr&3)] = true;
CVertexHandler::Flush();
VertexManager::Flush();
}
break;
case 0x8C://TEX IMAGE 1
@ -542,7 +542,7 @@ void BPWritten(int addr, int changes, int newval)
if (changes)
{
textureChanged[((addr&0xE0)==0xA0)*4+(addr&3)] = true;
CVertexHandler::Flush();
VertexManager::Flush();
}
break;
case 0x90://TEX IMAGE 2
@ -550,7 +550,7 @@ void BPWritten(int addr, int changes, int newval)
if (changes)
{
textureChanged[((addr&0xE0)==0xA0)*4+(addr&3)] = true;
CVertexHandler::Flush();
VertexManager::Flush();
}
break;
case 0x94://TEX IMAGE 3
@ -558,7 +558,7 @@ void BPWritten(int addr, int changes, int newval)
if (changes)
{
textureChanged[((addr&0xE0)==0xA0)*4+(addr&3)] = true;
CVertexHandler::Flush();
VertexManager::Flush();
}
break;
case 0x98://TEX TLUT
@ -566,7 +566,7 @@ void BPWritten(int addr, int changes, int newval)
if (changes)
{
textureChanged[((addr&0xE0)==0xA0)*4+(addr&3)] = true;
CVertexHandler::Flush();
VertexManager::Flush();
}
break;
case 0x9C://TEX UNKNOWN
@ -588,7 +588,7 @@ void BPWritten(int addr, int changes, int newval)
case 0xD0:
if (changes)
{
CVertexHandler::Flush();
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
// PixelShaderMngr::SetTevCombinerChanged((addr&0x1f)/2);
}
@ -599,7 +599,7 @@ void BPWritten(int addr, int changes, int newval)
{
if (addr&1)
{
CVertexHandler::Flush();
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
static int lastRGBA[2][4] = {
{0xEEEEEEEE, 0xEEEEEEEE, 0xEEEEEEEE, 0xEEEEEEEE},
@ -616,7 +616,7 @@ void BPWritten(int addr, int changes, int newval)
int rgba = ((a<<24) | (r << 16) | (g << 8) | b) & 0xFCFCFCFC; //let's not detect minimal changes
if (rgba != lastRGBA[type][num])
{
CVertexHandler::Flush();
VertexManager::Flush();
lastRGBA[type][num] = rgba;
float temp[4] = {
r/255.0f, g/255.0f, b/255.0f, a/255.0f
@ -634,7 +634,7 @@ void BPWritten(int addr, int changes, int newval)
default:
if (changes)
{
CVertexHandler::Flush();
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
}
break;
@ -665,7 +665,7 @@ void LoadBPReg(u32 value0)
switch (opcode)
{
case 0x45: //GXSetDrawDone
CVertexHandler::Flush();
VertexManager::Flush();
switch (value0 & 0xFF)
{
case 0x02:
@ -694,7 +694,7 @@ void LoadBPReg(u32 value0)
case 0x52:
{
CVertexHandler::Flush();
VertexManager::Flush();
((u32*)&bpmem)[opcode] = newval;
RECT rc = {
@ -778,7 +778,7 @@ void LoadBPReg(u32 value0)
case 0x65: //GXLoadTlut
{
CVertexHandler::Flush();
VertexManager::Flush();
((u32*)&bpmem)[opcode] = newval;
u32 tlutTMemAddr = (value0&0x3FF)<<9;

View File

@ -20,7 +20,7 @@
#include "CPStructs.h"
#include "XFStructs.h"
#include "TransformEngine.h"
#include "VertexHandler.h"
#include "VertexManager.h"
#include "VertexLoader.h"
// PROBLEM - matrix switching within vbuffers may be stateful!
@ -59,8 +59,12 @@ void LoadCPReg(u32 SubCmd, u32 Value)
CPUpdateMatricesB();
break;
case 0x50: CVertexHandler::Flush(); VertexLoader::SetVtxDesc_Lo(Value); break;
case 0x60: CVertexHandler::Flush(); VertexLoader::SetVtxDesc_Hi(Value); break;
case 0x50:
VertexManager::Flush(); VertexLoader::SetVtxDesc_Lo(Value);
break;
case 0x60:
VertexManager::Flush(); VertexLoader::SetVtxDesc_Hi(Value);
break;
case 0x70: g_VertexLoaders[SubCmd & 7].SetVAT_group0(Value); _assert_((SubCmd & 0x0F) < 8); break;
case 0x80: g_VertexLoaders[SubCmd & 7].SetVAT_group1(Value); _assert_((SubCmd & 0x0F) < 8); break;

View File

@ -1,3 +1,20 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _CPSTRUCTS_H
#define _CPSTRUCTS_H

View File

@ -29,7 +29,7 @@
#include "Common.h"
#include "Statistics.h"
#include "Profiler.h"
#include "VertexHandler.h"
#include "VertexManager.h"
#include "TransformEngine.h"
#include "OpcodeDecoding.h"
#include "TextureCache.h"
@ -288,9 +288,9 @@ static void Decode(void)
int vsize = vtxLoader.GetVertexSize();
vtxLoader.RunVertices(numVertices);
// draw vertices
// add vertices
int primitive = (Cmd & GX_PRIMITIVE_MASK) >> GX_PRIMITIVE_SHIFT;
CVertexHandler::DrawVertices(primitive, numVertices, &tempvarray);
VertexManager::AddVertices(primitive, numVertices, &tempvarray);
}
else
{

View File

@ -22,7 +22,7 @@
#include "Config.h"
#include "main.h"
#include "VertexHandler.h"
#include "VertexManager.h"
#include "Render.h"
#include "OpcodeDecoding.h"
#include "BPStructs.h"
@ -105,7 +105,7 @@ void Renderer::Initialize(void)
Postprocess::Initialize();
Postprocess::BeginFrame();
D3D::BeginFrame(true, 0);
CVertexHandler::BeginFrame();
VertexManager::BeginFrame();
}
void Renderer::AddMessage(const std::string &message, u32 ms)
@ -274,7 +274,7 @@ void Renderer::SwapBuffers(void)
// D3D::EnableAlphaToCoverage();
Postprocess::BeginFrame();
CVertexHandler::BeginFrame();
VertexManager::BeginFrame();
if (g_Config.bOldCard)
D3D::font.SetRenderStates(); //compatibility with low end cards

View File

@ -22,7 +22,7 @@
// #include "Globals.h"
#include "Vec3.h"
#include "TransformEngine.h"
#include "VertexHandler.h"
#include "VertexManager.h"
#include "VertexLoader.h"
#include "BPStructs.h"

View File

@ -22,7 +22,7 @@
//as much work as possible will be delegated to vertex shaders later
//to take full advantage of current PC HW
#include "VertexHandler.h"
#include "VertexManager.h"
#include "DecodedVArray.h"
class CTransformEngine

View File

@ -22,7 +22,7 @@
#include "Common.h"
#include "LookUpTables.h"
#include "Profiler.h"
#include "VertexHandler.h"
#include "VertexManager.h"
#include "VertexLoader.h"
#include "XFStructs.h"
#include "BPStructs.h"
@ -207,15 +207,6 @@ void VertexLoader::Setup()
m_VtxAttr.texCoord[i].Format,
m_VtxAttr.texCoord[i].Elements,
m_VtxAttr.texCoord[i].Frac);
Compile();
//RET();
/*
char temp[256];
sprintf(temp,"Size: %08x Pos: %i Norm:%i Col0: %i Col1: %i",m_VertexSize,m_VtxDesc.Position,m_VtxDesc.Normal,m_VtxDesc.Color0,m_VtxDesc.Color1);
g_VideoInitialize.pLog(temp);
sprintf(temp,"Pos: %i Norm:%i Col0: %i Col1: %i",_VtxAttr.PosFormat,_VtxAttr.NormalFormat,_VtxAttr.color[0].Comp,_VtxAttr.color[1].Comp);
g_VideoInitialize.pLog(temp);*/
}
void VertexLoader::SetupColor(int num, int mode, int format, int elements)
@ -280,14 +271,14 @@ void VertexLoader::SetupTexCoord(int num, int mode, int format, int elements, in
int sizePro=0;
switch (format)
{
case FORMAT_UBYTE: sizePro=1; WriteCall(TexCoord_ReadDirect_UByte); break;
case FORMAT_BYTE: sizePro=1; WriteCall(TexCoord_ReadDirect_Byte); break;
case FORMAT_USHORT: sizePro=2; WriteCall(TexCoord_ReadDirect_UShort); break;
case FORMAT_SHORT: sizePro=2; WriteCall(TexCoord_ReadDirect_Short); break;
case FORMAT_FLOAT: sizePro=4; WriteCall(TexCoord_ReadDirect_Float); break;
case FORMAT_UBYTE: sizePro = 1; WriteCall(TexCoord_ReadDirect_UByte); break;
case FORMAT_BYTE: sizePro = 1; WriteCall(TexCoord_ReadDirect_Byte); break;
case FORMAT_USHORT: sizePro = 2; WriteCall(TexCoord_ReadDirect_UShort); break;
case FORMAT_SHORT: sizePro = 2; WriteCall(TexCoord_ReadDirect_Short); break;
case FORMAT_FLOAT: sizePro = 4; WriteCall(TexCoord_ReadDirect_Float); break;
default: _assert_(0); break;
}
m_VertexSize += sizePro * (elements?2:1);
m_VertexSize += sizePro * (elements ? 2 : 1);
}
break;
case INDEX8:
@ -324,37 +315,6 @@ void VertexLoader::WriteCall(TPipelineFunction func)
using namespace Gen;
// See comment in RunVertices
void VertexLoader::Compile()
{
return;
/* Gen::SetCodePtr(m_compiledCode);
//INT3();
Gen::Util::EmitPrologue(0);
const u8 *loopStart = Gen::GetCodePtr();
MOV(32, M(&tcIndex), Imm32(0));
MOV(32, M(&colIndex), Imm32(0));
for (int i = 0; i < m_numPipelineStates; i++)
{
ABI_AlignStack(1 * 4);
PUSH(32, Imm32((u32)&m_VtxAttr));
CALL(m_PipelineStates[i]);
ABI_RestoreStack(1 * 4);
}
ADD(32, M(&varray->count), Imm8(1));
SUB(32, M(&this->m_counter), Imm8(1));
J_CC(CC_NZ, loopStart, true);
// Epilogue
Gen::Util::EmitEpilogue(0);
if (Gen::GetCodePtr()-(u8*)m_compiledCode > sizeof(m_compiledCode))
{
Crash();
}*/
}
void VertexLoader::PrepareRun()
{
posScale = shiftLookup[m_VtxAttr.PosFrac];

View File

@ -18,29 +18,6 @@
#ifndef _VERTEXLOADER_H
#define _VERTEXLOADER_H
/*
Ideas for new intermediate vertex format
Produce a mask specifying with components are present.
Decoder always produces a canonical format for all components:
Ubyte4 for matrix indices (x,y,z,w) and colors
FloatN for all others, texcoords are always XY at this stage
The decoders will write a continuous stream of vertices, to take maximum
advantage of write combining hardware
a map<mask, vdecl> will keep track of vertex declarations
this time, we are going to minimize transfers to the gfx card
it turns out that with PS2.0 we can easily do all the pipeline in hardware.
The decision will be how granular to be with the number of shaders and lighting settin
*/
int ComputeVertexSize(u32 components);
#include "CPStructs.h"
@ -97,7 +74,6 @@ private:
int m_numPipelineStates;
int m_VertexSize;
int m_counter;
u8 m_compiledCode[1024];
u32 m_components;
@ -106,7 +82,6 @@ private:
UVAT_group2 m_group2;
bool m_AttrDirty;
TVtxAttr m_VtxAttr; //Decoded into easy format
//common for all loaders
@ -124,7 +99,6 @@ public:
// run the pipeline
static void SetVArray(DecodedVArray *_varray);
void Setup();
void Compile();
void PrepareRun();
void RunVertices(int count);
void WriteCall(TPipelineFunction func);

View File

@ -21,7 +21,7 @@
#include "Statistics.h"
#include "Profiler.h"
#include "VertexHandler.h"
#include "VertexManager.h"
#include "OpcodeDecoding.h"
#include "TransformEngine.h"
#include "IndexGenerator.h"
@ -32,13 +32,17 @@
using namespace D3D;
IndexGenerator indexGen;
Collection CVertexHandler::collection;
LPDIRECT3DVERTEXDECLARATION9 vDecl;
namespace VertexManager
{
D3DVertex *fakeVBuffer;
u16 *fakeIBuffer;
static IndexGenerator indexGen;
static Collection collection;
static LPDIRECT3DVERTEXDECLARATION9 vDecl;
static D3DVertex *fakeVBuffer;
static u16 *fakeIBuffer;
#define MAXVBUFFERSIZE 65536*3
#define MAXIBUFFERSIZE 65536*3
@ -60,23 +64,24 @@ const D3DVERTEXELEMENT9 decl[] =
D3DDECL_END()
};
void CVertexHandler::Init()
bool Init()
{
collection = C_NOTHING;
fakeVBuffer = new D3DVertex[65536];
fakeIBuffer = new u16[65536];
CreateDeviceObjects();
return true;
}
void CVertexHandler::Shutdown()
void Shutdown()
{
DestroyDeviceObjects();
delete [] fakeVBuffer;
delete [] fakeIBuffer;
}
void CVertexHandler::CreateDeviceObjects()
void CreateDeviceObjects()
{
HRESULT hr;
if (FAILED(hr = D3D::dev->CreateVertexDeclaration(decl, &vDecl)))
@ -86,13 +91,13 @@ void CVertexHandler::CreateDeviceObjects()
}
}
void CVertexHandler::BeginFrame()
void BeginFrame()
{
D3D::dev->SetVertexDeclaration(vDecl);
//D3D::dev->SetStreamSource(0,vBuffer,0,sizeof(D3DVertex));
}
void CVertexHandler::DestroyDeviceObjects()
void DestroyDeviceObjects()
{
if (vDecl)
vDecl->Release();
@ -100,7 +105,7 @@ void CVertexHandler::DestroyDeviceObjects()
}
void CVertexHandler::AddIndices(int _primitive, int _numVertices)
void AddIndices(int _primitive, int _numVertices)
{
switch(_primitive) {
case GX_DRAW_QUADS: indexGen.AddQuads(_numVertices); return;
@ -127,7 +132,7 @@ const Collection collectionTypeLUT[8] =
D3DVertex *vbufferwrite;
void CVertexHandler::DrawVertices(int _primitive, int _numVertices, const DecodedVArray *varray)
void AddVertices(int _primitive, int _numVertices, const DecodedVArray *varray)
{
if (_numVertices <= 0) //This check is pretty stupid...
return;
@ -163,7 +168,7 @@ void CVertexHandler::DrawVertices(int _primitive, int _numVertices, const Decode
if (_numVertices >= MAXVBUFFERSIZE)
MessageBox(NULL, "To much vertices for the buffer", "Video.DLL", MB_OK);
CTransformEngine::TransformVertices(_numVertices,varray,vbufferwrite);
CTransformEngine::TransformVertices(_numVertices, varray, vbufferwrite);
}
else //We are collecting the right type, keep going
{
@ -171,11 +176,11 @@ void CVertexHandler::DrawVertices(int _primitive, int _numVertices, const Decode
INCSTAT(stats.numJoins);
//Success, keep adding to unlocked buffer
int last=indexGen.GetNumVerts();
AddIndices(_primitive,_numVertices);
AddIndices(_primitive, _numVertices);
if (_numVertices >= MAXVBUFFERSIZE)
MessageBox(NULL, "Too many vertices for the buffer", "Video.DLL", MB_OK);
CTransformEngine::TransformVertices(_numVertices,varray,vbufferwrite + last);
CTransformEngine::TransformVertices(_numVertices, varray, vbufferwrite + last);
}
}
@ -186,7 +191,7 @@ const D3DPRIMITIVETYPE pts[3] =
D3DPT_LINELIST,
};
void CVertexHandler::Flush()
void Flush()
{
DVSTARTPROFILE();
@ -226,46 +231,4 @@ void CVertexHandler::Flush()
}
}
/*
char szTmp[256];
sprintf(szTmp, "Batch size : %i",_numVertices);
g_VideoInitialize.pLog(szTmp);
char szTemp[256];
sprintf(szTemp, "count: %i", count);
SendMessage(g_VideoInitialize.hStatusBar, SB_SETTEXT,0,(LPARAM)szTemp);
static bool bWaitStep = false;
if (count == 24800)
{
bWaitStep = true;
Renderer::Flush();
}
if (GetAsyncKeyState('J'))
bWaitStep = true;
if (GetAsyncKeyState('U'))
bWaitStep = false;
if (bWaitStep)
{
static bool bKey = false;
while (GetAsyncKeyState('H') == 0)
{
if (GetAsyncKeyState(VK_SPACE))
_asm int 3;
if (GetAsyncKeyState('U'))
{
bWaitStep = false;
break;
}
}
Renderer::Flush();
// wait for key release
while (GetAsyncKeyState ('H')){
};
}
}
*/
// old = bpmem.combiners[0].colorC.hex;
} // namespace

View File

@ -41,26 +41,21 @@ enum Collection
C_LINES=2,
C_POINTS=3
};
namespace VertexManager
{
extern const Collection collectionTypeLUT[8];
class CVertexHandler
{
private:
static Collection collection;
// Pipeline
bool Init();
void Shutdown();
static void PrepareRender();
static void AddIndices(int _primitive, int _numVertices);
void BeginFrame();
public:
static void Init();
static void Shutdown();
void CreateDeviceObjects();
void DestroyDeviceObjects();
static void BeginFrame();
static void CreateDeviceObjects();
static void DestroyDeviceObjects();
void AddVertices(int _primitive, int _numVertices, const DecodedVArray *varray);
void Flush();
static void DrawVertices(int _primitive, int _numVertices, const DecodedVArray *varray);
static void Flush();
};
} // namespace

View File

@ -20,18 +20,15 @@
#include "XFStructs.h"
#include "Render.h"
#include "main.h"
#include "VertexHandler.h"
#include "VertexManager.h"
#include "Utils.h"
float rawViewPort[6];
float rawProjection[7];
// LoadXFReg 0x10
void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData)
{
DVSTARTPROFILE();
u32 address = baseAddress;
for (int i=0; i<(int)transferSize; i++)
for (int i = 0; i < (int)transferSize; i++)
{
address = baseAddress + i;
@ -68,15 +65,15 @@ void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData)
break;
case 0x101a:
CVertexHandler::Flush();
memcpy(rawViewPort, &pData[i], sizeof(rawViewPort));
VertexManager::Flush();
memcpy(xfregs.rawViewport, &pData[i], sizeof(xfregs.rawViewport));
XFUpdateVP();
i += 6;
break;
case 0x1020:
CVertexHandler::Flush();
memcpy(rawProjection, &pData[i], sizeof(rawProjection));
VertexManager::Flush();
memcpy(xfregs.rawProjection, &pData[i], sizeof(xfregs.rawProjection));
XFUpdatePJ();
i += 7;
return;
@ -130,10 +127,10 @@ void LoadIndexedXF(u32 val, int array)
void XFUpdateVP()
{
Renderer::SetViewport(rawViewPort);
Renderer::SetViewport(xfregs.rawViewport);
}
void XFUpdatePJ()
{
Renderer::SetProjection(rawProjection, 0);
Renderer::SetProjection(xfregs.rawProjection, 0);
}

View File

@ -22,15 +22,9 @@
#include "Vec3.h"
#include "XFMemory.h"
extern float rawViewPort[6];
extern float rawProjection[7];
void XFUpdateVP();
void XFUpdatePJ();
void LoadXFReg(u32 transferSize, u32 address, u32 *pData);
void LoadIndexedXF(u32 val, int array);
#pragma pack()
#endif

View File

@ -29,7 +29,7 @@
#include "OpcodeDecoding.h"
#include "TextureCache.h"
#include "BPStructs.h"
#include "VertexHandler.h"
#include "VertexManager.h"
#include "TransformEngine.h"
#include "DlgSettings.h"
#include "D3DPostprocess.h"
@ -213,7 +213,7 @@ void Video_Prepare(void)
TextureCache::Init();
BPInit();
CVertexHandler::Init();
VertexManager::Init();
Fifo_Init();
OpcodeDecoder_Init();
}
@ -221,7 +221,7 @@ void Video_Prepare(void)
void Video_Shutdown(void)
{
Fifo_Shutdown();
CVertexHandler::Shutdown();
VertexManager::Shutdown();
TextureCache::Shutdown();
Renderer::Shutdown();
OpcodeDecoder_Shutdown();