Warning fixes/suppressions(aui), assorted code cleanup, d3d vertex shader cache expiration interval increased.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4165 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2009-09-02 18:55:36 +00:00
parent dd7eba0bb9
commit e97bc516e6
15 changed files with 68 additions and 82 deletions

View File

@ -58,7 +58,7 @@
AssemblerListingLocation="$(IntDir)\" AssemblerListingLocation="$(IntDir)\"
ObjectFile="$(IntDir)\" ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="$(IntDir)\wxmsw28d_aui.pdb" ProgramDataBaseFileName="$(IntDir)\wxmsw28d_aui.pdb"
WarningLevel="4" WarningLevel="1"
SuppressStartupBanner="true" SuppressStartupBanner="true"
DebugInformationFormat="3" DebugInformationFormat="3"
/> />
@ -136,7 +136,7 @@
AssemblerListingLocation="$(IntDir)\" AssemblerListingLocation="$(IntDir)\"
ObjectFile="$(IntDir)\" ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="$(IntDir)\wxmsw28d_aui.pdb" ProgramDataBaseFileName="$(IntDir)\wxmsw28d_aui.pdb"
WarningLevel="4" WarningLevel="1"
SuppressStartupBanner="true" SuppressStartupBanner="true"
DebugInformationFormat="3" DebugInformationFormat="3"
/> />
@ -215,7 +215,7 @@
AssemblerListingLocation="$(IntDir)\" AssemblerListingLocation="$(IntDir)\"
ObjectFile="$(IntDir)\" ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="$(IntDir)\wxmsw28_aui.pdb" ProgramDataBaseFileName="$(IntDir)\wxmsw28_aui.pdb"
WarningLevel="4" WarningLevel="1"
SuppressStartupBanner="true" SuppressStartupBanner="true"
/> />
<Tool <Tool
@ -294,7 +294,7 @@
AssemblerListingLocation="$(IntDir)\" AssemblerListingLocation="$(IntDir)\"
ObjectFile="$(IntDir)\" ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="$(IntDir)\wxmsw28_aui.pdb" ProgramDataBaseFileName="$(IntDir)\wxmsw28_aui.pdb"
WarningLevel="4" WarningLevel="1"
SuppressStartupBanner="true" SuppressStartupBanner="true"
/> />
<Tool <Tool
@ -429,6 +429,10 @@
<Filter <Filter
Name="Setup Headers" Name="Setup Headers"
> >
<File
RelativePath="..\..\include\wx\univ\setup.h"
>
</File>
<File <File
RelativePath="..\..\include\wx\msw\setup.h" RelativePath="..\..\include\wx\msw\setup.h"
> >
@ -473,10 +477,6 @@
/> />
</FileConfiguration> </FileConfiguration>
</File> </File>
<File
RelativePath="..\..\include\wx\univ\setup.h"
>
</File>
</Filter> </Filter>
<Filter <Filter
Name="MSW Headers" Name="MSW Headers"

View File

@ -309,7 +309,7 @@ bool CEXIETHERNET::sendPacket(u8 *etherpckt, int size)
bool CEXIETHERNET::handleRecvdPacket() bool CEXIETHERNET::handleRecvdPacket()
{ {
int rbwpp = mCbw.p_write() + CB_OFFSET; //read buffer write page pointer int rbwpp = (int)(mCbw.p_write() + CB_OFFSET); // read buffer write page pointer
u32 available_bytes_in_cb; u32 available_bytes_in_cb;
if (rbwpp < mRBRPP) if (rbwpp < mRBRPP)
available_bytes_in_cb = mRBRPP - rbwpp; available_bytes_in_cb = mRBRPP - rbwpp;
@ -328,7 +328,7 @@ bool CEXIETHERNET::handleRecvdPacket()
cbwriteDescriptor(mRecvBufferLength); cbwriteDescriptor(mRecvBufferLength);
mCbw.write(mRecvBuffer, mRecvBufferLength); mCbw.write(mRecvBuffer, mRecvBufferLength);
mCbw.align(); mCbw.align();
rbwpp = mCbw.p_write() + CB_OFFSET; rbwpp = (int)(mCbw.p_write() + CB_OFFSET);
//DUMPWORD(rbwpp); //DUMPWORD(rbwpp);
//mPacketsRcvd++; //mPacketsRcvd++;
@ -384,7 +384,7 @@ bool CEXIETHERNET::startRecv()
return true; return true;
} }
DWORD res = ReadFile(mHAdapter, mRecvBuffer, mRecvBuffer.size(), DWORD res = ReadFile(mHAdapter, mRecvBuffer, (DWORD)mRecvBuffer.size(),
&mRecvBufferLength, &mReadOverlapped); &mRecvBufferLength, &mReadOverlapped);
if (res) if (res)
@ -471,11 +471,11 @@ bool CEXIETHERNET::cbwriteDescriptor(u32 size)
u32 npp; u32 npp;
if (mCbw.p_write() + size < CB_SIZE) if (mCbw.p_write() + size < CB_SIZE)
{ {
npp = mCbw.p_write() + size + CB_OFFSET; npp = (u32)(mCbw.p_write() + size + CB_OFFSET);
} }
else else
{ {
npp = mCbw.p_write() + size + CB_OFFSET - CB_SIZE; npp = (u32)(mCbw.p_write() + size + CB_OFFSET - CB_SIZE);
} }
npp = (npp + 0xff) & ~0xff; npp = (npp + 0xff) & ~0xff;

View File

@ -296,7 +296,7 @@ u32 CWII_IPC_HLE_Device_net_ip_top::ExecuteCommand(u32 _Command, u32 _BufferIn,
u32 TYPE = Memory::Read_U32(_BufferIn + 0x04); u32 TYPE = Memory::Read_U32(_BufferIn + 0x04);
u32 PROT = Memory::Read_U32(_BufferIn + 0x04 * 2); u32 PROT = Memory::Read_U32(_BufferIn + 0x04 * 2);
u32 Unk1 = Memory::Read_U32(_BufferIn + 0x04 * 3); u32 Unk1 = Memory::Read_U32(_BufferIn + 0x04 * 3);
u32 Socket = socket(AF, TYPE, PROT); u32 Socket = (u32)socket(AF, TYPE, PROT);
return Common::swap32(Socket); // So it doesn't get mangled later on return Common::swap32(Socket); // So it doesn't get mangled later on
} }
break; break;
@ -322,13 +322,13 @@ u32 CWII_IPC_HLE_Device_net_ip_top::ExecuteCommand(u32 _Command, u32 _BufferIn,
return Return; return Return;
} }
break; break;
case IOCTL_SO_ACCEPT: case IOCTL_SO_ACCEPT:
{ {
//TODO: (Sonic)Check if this is correct //TODO: (Sonic)Check if this is correct
u32 S = Memory::Read_U32(_BufferIn); u32 S = Memory::Read_U32(_BufferIn);
socklen_t addrlen; socklen_t addrlen;
struct sockaddr_in address; struct sockaddr_in address;
int Return = accept(S, (struct sockaddr *)&address, &addrlen); u32 Return = (u32)accept(S, (struct sockaddr *)&address, &addrlen);
GC_sockaddr_in *addr = (GC_sockaddr_in*)Memory::GetPointer(BufferOut); GC_sockaddr_in *addr = (GC_sockaddr_in*)Memory::GetPointer(BufferOut);
addr->sin_family = (u8)address.sin_family; addr->sin_family = (u8)address.sin_family;
addr->sin_addr.s_addr_ = address.sin_addr.s_addr; addr->sin_addr.s_addr_ = address.sin_addr.s_addr;

View File

@ -370,21 +370,23 @@ void CFrame::OnAllowNotebookDnD(wxAuiNotebookEvent& event)
void CFrame::HidePane() void CFrame::HidePane()
{ {
// Get the first notebook // Get the first notebook
wxAuiNotebook * NB; wxAuiNotebook * NB = NULL;
for (u32 i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++) for (u32 i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
{ {
if (m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook))) if (m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook)))
NB = (wxAuiNotebook*)m_Mgr->GetAllPanes().Item(i).window; NB = (wxAuiNotebook*)m_Mgr->GetAllPanes().Item(i).window;
} }
if (NB->GetPageCount() == 0) if (NB) {
m_Mgr->GetPane(wxT("Pane 1")).Hide(); if (NB->GetPageCount() == 0)
else m_Mgr->GetPane(wxT("Pane 1")).Hide();
m_Mgr->GetPane(wxT("Pane 1")).Show(); else
m_Mgr->Update(); m_Mgr->GetPane(wxT("Pane 1")).Show();
m_Mgr->Update();
}
SetSimplePaneSize(); SetSimplePaneSize();
} }
void CFrame::DoRemovePageString(wxString Str, bool _hide, bool _destroy)
void CFrame::DoRemovePageString(wxString Str, bool /*_hide*/, bool _destroy)
{ {
for (u32 i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++) for (u32 i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
{ {
@ -673,7 +675,7 @@ void CFrame::OnDropDownToolbarSelect(wxCommandEvent& event)
void CFrame::ResetToolbarStyle() void CFrame::ResetToolbarStyle()
{ {
wxAuiPaneInfoArray& AllPanes = m_Mgr->GetAllPanes(); wxAuiPaneInfoArray& AllPanes = m_Mgr->GetAllPanes();
for (int i = 0, Count = AllPanes.GetCount(); i < Count; ++i) for (int i = 0, Count = (int)AllPanes.GetCount(); i < Count; ++i)
{ {
wxAuiPaneInfo& Pane = AllPanes.Item(i); wxAuiPaneInfo& Pane = AllPanes.Item(i);
if (Pane.window->IsKindOf(CLASSINFO(wxAuiToolBar))) if (Pane.window->IsKindOf(CLASSINFO(wxAuiToolBar)))
@ -726,7 +728,7 @@ void CFrame::TogglePaneStyle(bool On, int EventId)
void CFrame::ToggleNotebookStyle(long Style) void CFrame::ToggleNotebookStyle(long Style)
{ {
wxAuiPaneInfoArray& AllPanes = m_Mgr->GetAllPanes(); wxAuiPaneInfoArray& AllPanes = m_Mgr->GetAllPanes();
for (int i = 0, Count = AllPanes.GetCount(); i < Count; ++i) for (int i = 0, Count = (int)AllPanes.GetCount(); i < Count; ++i)
{ {
wxAuiPaneInfo& Pane = AllPanes.Item(i); wxAuiPaneInfo& Pane = AllPanes.Item(i);
if (Pane.window->IsKindOf(CLASSINFO(wxAuiNotebook))) if (Pane.window->IsKindOf(CLASSINFO(wxAuiNotebook)))

View File

@ -224,7 +224,7 @@ void BPWritten(const BPCmd& bp)
float xfbLines = ((bpmem.copyTexSrcWH.y + 1.0f) * yScale); float xfbLines = ((bpmem.copyTexSrcWH.y + 1.0f) * yScale);
if ((u32)xfbLines > MAX_XFB_HEIGHT) if ((u32)xfbLines > MAX_XFB_HEIGHT)
{ {
WARN_LOG(VIDEO, "Tried to scale EFB to too many XFB lines (%f)", xfbLines); INFO_LOG(VIDEO, "Tried to scale EFB to too many XFB lines (%f)", xfbLines);
xfbLines = MAX_XFB_HEIGHT; xfbLines = MAX_XFB_HEIGHT;
} }
@ -460,6 +460,7 @@ void BPWritten(const BPCmd& bp)
case BPMEM_TX_SETMODE0+1: case BPMEM_TX_SETMODE0+1:
case BPMEM_TX_SETMODE0+2: case BPMEM_TX_SETMODE0+2:
case BPMEM_TX_SETMODE0+3: case BPMEM_TX_SETMODE0+3:
SetSamplerState(bp);
case BPMEM_TX_SETMODE1: case BPMEM_TX_SETMODE1:
case BPMEM_TX_SETMODE1+1: case BPMEM_TX_SETMODE1+1:
case BPMEM_TX_SETMODE1+2: case BPMEM_TX_SETMODE1+2:
@ -472,7 +473,6 @@ void BPWritten(const BPCmd& bp)
case BPMEM_TX_SETMODE1_4+1: case BPMEM_TX_SETMODE1_4+1:
case BPMEM_TX_SETMODE1_4+2: case BPMEM_TX_SETMODE1_4+2:
case BPMEM_TX_SETMODE1_4+3: case BPMEM_TX_SETMODE1_4+3:
SetSamplerState(bp);
break; break;
// -------------------------------------------- // --------------------------------------------
// BPMEM_TX_SETIMAGE0 - Texture width, height, format // BPMEM_TX_SETIMAGE0 - Texture width, height, format

View File

@ -322,7 +322,7 @@ inline u32 makecol(int r, int g, int b, int a)
void decodeDXTBlock(u32 *dst, const DXTBlock *src, int pitch) void decodeDXTBlock(u32 *dst, const DXTBlock *src, int pitch)
{ {
// S3TC Decoder (Note: GCN decodes differently from PC) // S3TC Decoder (Note: GCN decodes differently from PC so we can't use native support)
u16 c1 = Common::swap16(src->color1); u16 c1 = Common::swap16(src->color1);
u16 c2 = Common::swap16(src->color2); u16 c2 = Common::swap16(src->color2);
u8 blue1 = Convert5To8(c1 & 0x1F); u8 blue1 = Convert5To8(c1 & 0x1F);
@ -331,9 +331,7 @@ void decodeDXTBlock(u32 *dst, const DXTBlock *src, int pitch)
u8 green2 = Convert6To8((c2 >> 5) & 0x3F); u8 green2 = Convert6To8((c2 >> 5) & 0x3F);
u8 red1 = Convert5To8((c1 >> 11) & 0x1F); u8 red1 = Convert5To8((c1 >> 11) & 0x1F);
u8 red2 = Convert5To8((c2 >> 11) & 0x1F); u8 red2 = Convert5To8((c2 >> 11) & 0x1F);
int colors[4]; int colors[4];
if (c1 > c2) if (c1 > c2)
{ {
colors[0] = makecol(red1, green1, blue1, 255); colors[0] = makecol(red1, green1, blue1, 255);
@ -457,10 +455,7 @@ PC_TexFormat TexDecoder_Decode_real(u8 *dst, const u8 *src, int width, int heigh
for (int y = 0; y < height; y += 4) for (int y = 0; y < height; y += 4)
for (int x = 0; x < width; x += 8) for (int x = 0; x < width; x += 8)
for (int iy = 0; iy < 4; iy++, src += 8) for (int iy = 0; iy < 4; iy++, src += 8)
{
//decodebytesIA4((u32*)dst+(y+iy)*width+x, src, 8);
decodebytesIA4((u16*)dst + (y + iy) * width + x, src); decodebytesIA4((u16*)dst + (y + iy) * width + x, src);
}
} }
return PC_TEX_FMT_IA4_AS_IA8; return PC_TEX_FMT_IA4_AS_IA8;
case GX_TF_IA8: case GX_TF_IA8:

View File

@ -111,7 +111,7 @@ void CMailHandler::DoState(PointerWrap &p)
else // WRITE and MEASURE else // WRITE and MEASURE
{ {
std::queue<u32> temp; std::queue<u32> temp;
int sz = m_Mails.size(); int sz = (int)m_Mails.size();
p.Do(sz); p.Do(sz);
for (int i = 0; i < sz; i++) for (int i = 0; i < sz; i++)
{ {

View File

@ -127,30 +127,24 @@ void SetScissor(const BPCmd &bp)
{ {
Renderer::SetScissorRect(); Renderer::SetScissorRect();
} }
void SetLineWidth(const BPCmd &bp) void SetLineWidth(const BPCmd &bp)
{ {
// We can't change line width in D3D unless we use ID3DXLine // We can't change line width in D3D unless we use ID3DXLine
float psize = float(bpmem.lineptwidth.pointsize) * 6.0f; float psize = float(bpmem.lineptwidth.pointsize) * 6.0f;
Renderer::SetRenderState(D3DRS_POINTSIZE, *((DWORD*)&psize)); Renderer::SetRenderState(D3DRS_POINTSIZE, *((DWORD*)&psize));
} }
void SetDepthMode(const BPCmd &bp) void SetDepthMode(const BPCmd &bp)
{ {
if (bpmem.zmode.testenable) if (bpmem.zmode.testenable)
{ {
// dev->SetRenderState(D3DRS_ZENABLE, TRUE);
// dev->SetRenderState(D3DRS_ZWRITEENABLE, bpmem.zmode.updateenable);
// dev->SetRenderState(D3DRS_ZFUNC,d3dCmpFuncs[bpmem.zmode.func]);
Renderer::SetRenderState(D3DRS_ZENABLE, TRUE); Renderer::SetRenderState(D3DRS_ZENABLE, TRUE);
Renderer::SetRenderState(D3DRS_ZWRITEENABLE, bpmem.zmode.updateenable); Renderer::SetRenderState(D3DRS_ZWRITEENABLE, bpmem.zmode.updateenable);
Renderer::SetRenderState(D3DRS_ZFUNC, d3dCmpFuncs[bpmem.zmode.func]); Renderer::SetRenderState(D3DRS_ZFUNC, d3dCmpFuncs[bpmem.zmode.func]);
} }
else else
{ {
// if the test is disabled write is disabled too
// dev->SetRenderState(D3DRS_ZENABLE, FALSE);
// dev->SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
Renderer::SetRenderState(D3DRS_ZENABLE, FALSE); Renderer::SetRenderState(D3DRS_ZENABLE, FALSE);
Renderer::SetRenderState(D3DRS_ZWRITEENABLE, FALSE); Renderer::SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
} }
@ -193,7 +187,8 @@ void SetBlendMode(const BPCmd &bp)
Renderer::SetRenderState(D3DRS_DESTBLEND, dst); Renderer::SetRenderState(D3DRS_DESTBLEND, dst);
} }
Renderer::SetRenderState(D3DRS_BLENDOP, bpmem.blendmode.subtract ? D3DBLENDOP_SUBTRACT : D3DBLENDOP_ADD); Renderer::SetRenderState(D3DRS_BLENDOP,
bpmem.blendmode.subtract ? D3DBLENDOP_SUBTRACT : D3DBLENDOP_ADD);
} }
} }
void SetDitherMode(const BPCmd &bp) void SetDitherMode(const BPCmd &bp)
@ -218,9 +213,8 @@ void SetColorMask(const BPCmd &bp)
void CopyEFB(const BPCmd &bp, const EFBRectangle &rc, const u32 &address, const bool &fromZBuffer, const bool &isIntensityFmt, const u32 &copyfmt, const bool &scaleByHalf) void CopyEFB(const BPCmd &bp, const EFBRectangle &rc, const u32 &address, const bool &fromZBuffer, const bool &isIntensityFmt, const u32 &copyfmt, const bool &scaleByHalf)
{ {
// TODO: Scale EFBRectangle correctly // TODO: Scale EFBRectangle correctly
RECT rec = { rc.left, rc.top, rc.right, rc.bottom }; RECT rec = { rc.left, rc.top, rc.right, rc.bottom };
TextureCache::CopyEFBToRenderTarget(bpmem.copyTexDest<<5, &rec); TextureCache::CopyEFBToRenderTarget(bpmem.copyTexDest << 5, &rec);
} }
void RenderToXFB(const BPCmd &bp, const EFBRectangle &rc, const float &yScale, const float &xfbLines, u32 xfbAddr, const u32 &dstWidth, const u32 &dstHeight) void RenderToXFB(const BPCmd &bp, const EFBRectangle &rc, const float &yScale, const float &xfbLines, u32 xfbAddr, const u32 &dstWidth, const u32 &dstHeight)
@ -229,6 +223,7 @@ void RenderToXFB(const BPCmd &bp, const EFBRectangle &rc, const float &yScale, c
PRIM_LOG("Renderer::SwapBuffers()"); PRIM_LOG("Renderer::SwapBuffers()");
g_VideoInitialize.pCopiedToXFB(false); g_VideoInitialize.pCopiedToXFB(false);
} }
void ClearScreen(const BPCmd &bp, const EFBRectangle &rc) void ClearScreen(const BPCmd &bp, const EFBRectangle &rc)
{ {
// TODO: Scale EFBRectangle correctly // TODO: Scale EFBRectangle correctly
@ -248,7 +243,7 @@ void ClearScreen(const BPCmd &bp, const EFBRectangle &rc)
{ {
if (bpmem.blendmode.colorupdate || bpmem.blendmode.alphaupdate) if (bpmem.blendmode.colorupdate || bpmem.blendmode.alphaupdate)
col = (bpmem.clearcolorAR << 16) | bpmem.clearcolorGB; col = (bpmem.clearcolorAR << 16) | bpmem.clearcolorGB;
// clearflags |= D3DCLEAR_TARGET; set to break animal crossing :p clearflags |= D3DCLEAR_TARGET; // set to break animal crossing :p ??
} }
// clear z-buffer // clear z-buffer
@ -283,10 +278,12 @@ bool GetConfig(const int &type)
return false; return false;
} }
} }
u8 *GetPointer(const u32 &address) u8 *GetPointer(const u32 &address)
{ {
return g_VideoInitialize.pGetMemoryPointer(address); return g_VideoInitialize.pGetMemoryPointer(address);
} }
void SetSamplerState(const BPCmd &bp) void SetSamplerState(const BPCmd &bp)
{ {
FourTexUnits &tex = bpmem.tex[(bp.address & 0xE0) == 0xA0]; FourTexUnits &tex = bpmem.tex[(bp.address & 0xE0) == 0xA0];

View File

@ -197,7 +197,8 @@ namespace D3D
void SaveRenderStates() void SaveRenderStates()
{ {
for (int i = 0; i < 6; i++) { for (int i = 0; i < 6; i++)
{
dev->GetRenderState((_D3DRENDERSTATETYPE)RS[i][0], &(RS_old[i])); dev->GetRenderState((_D3DRENDERSTATETYPE)RS[i][0], &(RS_old[i]));
dev->GetTextureStageState(0, (_D3DTEXTURESTAGESTATETYPE)int(TS[i][0]), &(TS_old[i])); dev->GetTextureStageState(0, (_D3DTEXTURESTAGESTATETYPE)int(TS[i][0]), &(TS_old[i]));
} }
@ -215,10 +216,8 @@ namespace D3D
dev->SetPixelShader(0); dev->SetPixelShader(0);
dev->SetVertexShader(0); dev->SetVertexShader(0);
dev->SetVertexDeclaration(0);
// dev->SetFVF(D3DFVF_FONT2DVERTEX); dev->SetFVF(D3DFVF_FONT2DVERTEX);
Renderer::SetFVF(D3DFVF_FONT2DVERTEX);
for (int i = 0; i < 6; i++) { for (int i = 0; i < 6; i++) {
// dev->SetRenderState((_D3DRENDERSTATETYPE)RS[i][0],RS[i][1]); // dev->SetRenderState((_D3DRENDERSTATETYPE)RS[i][0],RS[i][1]);
@ -236,10 +235,8 @@ namespace D3D
dev->SetPixelShader(ps_old); dev->SetPixelShader(ps_old);
dev->SetVertexShader(vs_old); dev->SetVertexShader(vs_old);
dev->SetVertexDeclaration(decl_old);
// dev->SetFVF(FVF_old); dev->SetFVF(FVF_old);
Renderer::SetFVF(FVF_old);
for (int i = 0; i < 6; i++) for (int i = 0; i < 6; i++)
{ {
@ -384,7 +381,7 @@ namespace D3D
dev->SetVertexShader(0); dev->SetVertexShader(0);
dev->SetVertexDeclaration(0); dev->SetVertexDeclaration(0);
Renderer::SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1); dev->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1);
dev->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, coords, sizeof(Q2DVertex)); dev->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, coords, sizeof(Q2DVertex));
RestoreRenderStates(); RestoreRenderStates();

View File

@ -98,7 +98,6 @@ void PixelShaderCache::SetShader(bool dstAlpha)
PixelShaders[uid] = newentry; PixelShaders[uid] = newentry;
last_entry = &PixelShaders[uid]; last_entry = &PixelShaders[uid];
Renderer::SetFVF(NULL);
D3D::dev->SetPixelShader(shader); D3D::dev->SetPixelShader(shader);
last_shader = shader; last_shader = shader;
@ -119,7 +118,7 @@ void PixelShaderCache::Cleanup()
while (iter != PixelShaders.end()) while (iter != PixelShaders.end())
{ {
PSCacheEntry &entry = iter->second; PSCacheEntry &entry = iter->second;
if (entry.frameCount < frameCount - 400) if (entry.frameCount < frameCount - 1400)
{ {
entry.Destroy(); entry.Destroy();
iter = PixelShaders.erase(iter); iter = PixelShaders.erase(iter);

View File

@ -56,7 +56,6 @@ std::vector<LPDIRECT3DBASETEXTURE9> Renderer::m_Textures;
DWORD Renderer::m_RenderStates[MaxRenderStates+46]; DWORD Renderer::m_RenderStates[MaxRenderStates+46];
DWORD Renderer::m_TextureStageStates[MaxTextureStages][MaxTextureTypes]; DWORD Renderer::m_TextureStageStates[MaxTextureStages][MaxTextureTypes];
DWORD Renderer::m_SamplerStates[MaxSamplerSize][MaxSamplerTypes]; DWORD Renderer::m_SamplerStates[MaxSamplerSize][MaxSamplerTypes];
DWORD Renderer::m_FVF;
bool Renderer::m_LastFrameDumped; bool Renderer::m_LastFrameDumped;
bool Renderer::m_AVIDumping; bool Renderer::m_AVIDumping;
@ -116,7 +115,6 @@ void Renderer::Shutdown()
void Renderer::Initialize() void Renderer::Initialize()
{ {
m_FVF = 0;
m_Textures.reserve(MaxTextureStages); m_Textures.reserve(MaxTextureStages);
for (int i = 0; i < MaxTextureStages; i++) for (int i = 0; i < MaxTextureStages; i++)
m_Textures.push_back(NULL); m_Textures.push_back(NULL);
@ -360,12 +358,17 @@ void Renderer::SwapBuffers()
D3D::dev->SetScissorRect(&rc); D3D::dev->SetScissorRect(&rc);
D3D::dev->SetRenderState(D3DRS_SCISSORTESTENABLE, false); D3D::dev->SetRenderState(D3DRS_SCISSORTESTENABLE, false);
D3D::dev->Clear(0, 0, D3DCLEAR_TARGET, 0x101010, 0, 0); // We probably shouldn't clear here.
D3D::dev->Clear(0, 0, D3DCLEAR_TARGET, 0x00000000, 0, 0);
u32 clearColor = (bpmem.clearcolorAR << 16) | bpmem.clearcolorGB; u32 clearColor = (bpmem.clearcolorAR << 16) | bpmem.clearcolorGB;
// clearColor |= 0x003F003F; // clearColor |= 0x003F003F;
// D3D::BeginFrame(true,clearColor,1.0f); // D3D::BeginFrame(true,clearColor,1.0f);
D3D::BeginFrame(false, clearColor, 1.0f); D3D::BeginFrame(false, clearColor, 1.0f);
D3D::EnableAlphaToCoverage();
// This probably causes problems, and the visual difference is tiny anyway.
// So let's keep it commented out.
// D3D::EnableAlphaToCoverage();
Postprocess::BeginFrame(); Postprocess::BeginFrame();
VertexManager::BeginFrame(); VertexManager::BeginFrame();
@ -502,15 +505,6 @@ void Renderer::SetTexture(DWORD Stage, LPDIRECT3DBASETEXTURE9 pTexture)
} }
} }
void Renderer::SetFVF(DWORD FVF)
{
if (m_FVF != FVF)
{
m_FVF = FVF;
D3D::dev->SetFVF(FVF);
}
}
void Renderer::SetRenderState(D3DRENDERSTATETYPE State, DWORD Value) void Renderer::SetRenderState(D3DRENDERSTATETYPE State, DWORD Value)
{ {
if (m_RenderStates[State] != Value) if (m_RenderStates[State] != Value)

View File

@ -51,7 +51,6 @@ class Renderer
static DWORD m_RenderStates[MaxRenderStates+46]; static DWORD m_RenderStates[MaxRenderStates+46];
static DWORD m_TextureStageStates[MaxTextureStages][MaxTextureTypes]; static DWORD m_TextureStageStates[MaxTextureStages][MaxTextureTypes];
static DWORD m_SamplerStates[MaxSamplerSize][MaxSamplerTypes]; static DWORD m_SamplerStates[MaxSamplerSize][MaxSamplerTypes];
static DWORD m_FVF;
public: public:
static void Init(SVideoInitialize &_VideoInitialize); static void Init(SVideoInitialize &_VideoInitialize);
@ -79,7 +78,6 @@ public:
// The following are "filtered" versions of the corresponding D3Ddev-> functions. // The following are "filtered" versions of the corresponding D3Ddev-> functions.
static void SetTexture(DWORD Stage, IDirect3DBaseTexture9 *pTexture); static void SetTexture(DWORD Stage, IDirect3DBaseTexture9 *pTexture);
static void SetFVF(DWORD FVF);
static void SetRenderState(D3DRENDERSTATETYPE State, DWORD Value); static void SetRenderState(D3DRENDERSTATETYPE State, DWORD Value);
static void SetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value); static void SetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value);
static void SetSamplerState(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value); static void SetSamplerState(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value);

View File

@ -105,8 +105,8 @@ void TextureCache::Cleanup()
TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width, int height, int format, int tlutaddr, int tlutfmt) TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width, int height, int format, int tlutaddr, int tlutfmt)
{ {
if (address == 0)
if (address == 0) return NULL; return NULL;
TexCache::iterator iter = textures.find(address); TexCache::iterator iter = textures.find(address);
@ -185,7 +185,7 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width,
d3d_fmt = D3DFMT_R5G6B5; d3d_fmt = D3DFMT_R5G6B5;
break; break;
case PC_TEX_FMT_IA4_AS_IA8: case PC_TEX_FMT_IA4_AS_IA8:
d3d_fmt = D3DFMT_A8L8; //D3DFMT_A4L4; d3d_fmt = D3DFMT_A8L8;
break; break;
case PC_TEX_FMT_I8: case PC_TEX_FMT_I8:
case PC_TEX_FMT_I4_AS_I8: case PC_TEX_FMT_I4_AS_I8:
@ -262,24 +262,25 @@ void TextureCache::CopyEFBToRenderTarget(u32 address, RECT *source)
{ {
if (!iter->second.isRenderTarget) if (!iter->second.isRenderTarget)
{ {
g_VideoInitialize.pLog("Using non-rendertarget texture as render target!!! WTF?", FALSE); ERROR_LOG(VIDEO, "Using non-rendertarget texture as render target!!! WTF?", FALSE);
//TODO: remove it and recreate it as a render target //TODO: remove it and recreate it as a render target
} }
tex = iter->second.texture; tex = iter->second.texture;
iter->second.frameCount=frameCount; iter->second.frameCount = frameCount;
} }
else else
{ {
TCacheEntry entry; TCacheEntry entry;
entry.isRenderTarget=true; entry.isRenderTarget = true;
entry.hash = 0; entry.hash = 0;
entry.hashoffset = 0; entry.hashoffset = 0;
entry.frameCount = frameCount; entry.frameCount = frameCount;
// TODO(ector): infer this size in some sensible way // TODO(ector): infer this size in some sensible way
D3D::dev->CreateTexture(512,512,1,D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &entry.texture, 0); D3D::dev->CreateTexture(512, 512, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &entry.texture, 0);
textures[address] = entry; textures[address] = entry;
tex = entry.texture; tex = entry.texture;
} }
LPDIRECT3DSURFACE9 srcSurface,destSurface; LPDIRECT3DSURFACE9 srcSurface,destSurface;
tex->GetSurfaceLevel(0,&destSurface); tex->GetSurfaceLevel(0,&destSurface);
srcSurface = D3D::GetBackBufferSurface(); srcSurface = D3D::GetBackBufferSurface();

View File

@ -110,8 +110,7 @@ void VertexShaderCache::SetShader(u32 components)
PanicAlert("Failed to compile Vertex Shader:\n\n%s", code); PanicAlert("Failed to compile Vertex Shader:\n\n%s", code);
} }
Renderer::SetFVF(NULL); D3D::dev->SetFVF(NULL);
//D3D::dev->SetVertexShader(shader);
} }
void VertexShaderCache::Cleanup() void VertexShaderCache::Cleanup()
@ -119,7 +118,7 @@ void VertexShaderCache::Cleanup()
for (VSCache::iterator iter = vshaders.begin(); iter != vshaders.end();) for (VSCache::iterator iter = vshaders.begin(); iter != vshaders.end();)
{ {
VSCacheEntry &entry = iter->second; VSCacheEntry &entry = iter->second;
if (entry.frameCount < frameCount - 30) if (entry.frameCount < frameCount - 1400)
{ {
entry.Destroy(); entry.Destroy();
iter = vshaders.erase(iter); iter = vshaders.erase(iter);

View File

@ -166,16 +166,20 @@ bool GetConfig(const int &type)
return false; return false;
} }
} }
u8 *GetPointer(const u32 &address) u8 *GetPointer(const u32 &address)
{ {
return g_VideoInitialize.pGetMemoryPointer(address); return g_VideoInitialize.pGetMemoryPointer(address);
} }
void SetSamplerState(const BPCmd &bp) void SetSamplerState(const BPCmd &bp)
{ {
// TODO // TODO
} }
void SetInterlacingMode(const BPCmd &bp) void SetInterlacingMode(const BPCmd &bp)
{ {
// TODO // TODO
} }
}; };