mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-24 06:51:17 +01:00
Attempt to fix recent D3D plugin issue. Fix bug in debugger *<:-)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@198 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
6d887ea18a
commit
870194db21
@ -209,6 +209,8 @@ namespace Jit64
|
||||
|
||||
if (gpr.R(a).IsImm() && !update)
|
||||
{
|
||||
// If we already know the address through constant folding, we can do some
|
||||
// fun tricks...
|
||||
u32 addr = (u32)gpr.R(a).offset;
|
||||
addr += offset;
|
||||
if ((addr & 0xFFFFF000) == 0xCC008000 && jo.optimizeGatherPipe)
|
||||
@ -219,6 +221,7 @@ namespace Jit64
|
||||
switch (accessSize)
|
||||
{
|
||||
// No need to protect these, they don't touch any state
|
||||
// question - should we inline them instead? Pro: Lose a CALL Con: Code bloat
|
||||
case 8: CALL((void *)Asm::fifoDirectWrite8); break;
|
||||
case 16: CALL((void *)Asm::fifoDirectWrite16); break;
|
||||
case 32: CALL((void *)Asm::fifoDirectWrite32); break;
|
||||
@ -240,7 +243,7 @@ namespace Jit64
|
||||
}
|
||||
|
||||
// Optimized stack access?
|
||||
if (accessSize == 32 && !gpr.R(a).IsImm() && a == 1 && js.st.isFirstBlockOfFunction && jo.optimizeStack) //Zelda does not like this
|
||||
if (accessSize == 32 && !gpr.R(a).IsImm() && a == 1 && js.st.isFirstBlockOfFunction && jo.optimizeStack)
|
||||
{
|
||||
gpr.FlushLockX(ABI_PARAM1);
|
||||
MOV(32, R(ABI_PARAM1), gpr.R(a));
|
||||
@ -272,14 +275,7 @@ namespace Jit64
|
||||
}
|
||||
TEST(32, R(ABI_PARAM2), Imm32(0x0C000000));
|
||||
FixupBranch unsafe_addr = J_CC(CC_NZ);
|
||||
if (accessSize == 32)
|
||||
BSWAP(32, ABI_PARAM1);
|
||||
else if (accessSize == 16)
|
||||
{
|
||||
// TODO(ector): xchg ch, cl?
|
||||
BSWAP(32, ABI_PARAM1);
|
||||
SHR(32, R(ABI_PARAM1), Imm8(16));
|
||||
}
|
||||
BSWAP(accessSize, ABI_PARAM1);
|
||||
#ifdef _M_X64
|
||||
MOV(accessSize, MComplex(RBX, ABI_PARAM2, SCALE_1, 0), R(ABI_PARAM1));
|
||||
#else
|
||||
|
@ -420,8 +420,6 @@ void CCodeWindow::Update()
|
||||
|
||||
UpdateButtonStates();
|
||||
|
||||
codeview->Center(PC);
|
||||
|
||||
Host_UpdateLogDisplay();
|
||||
}
|
||||
|
||||
@ -676,7 +674,7 @@ void CCodeWindow::PopulateToolbar(wxToolBar* toolBar)
|
||||
toolBar->AddTool(IDM_STEPOVER, _T("Step Over"), m_Bitmaps[Toolbar_StepOver]);
|
||||
toolBar->AddTool(IDM_SKIP, _T("Skip"), m_Bitmaps[Toolbar_Skip]);
|
||||
toolBar->AddSeparator();
|
||||
toolBar->AddTool(IDM_GOTOPC, _T("Goto PC"), m_Bitmaps[Toolbar_GotoPC]);
|
||||
toolBar->AddTool(IDM_GOTOPC, _T("Show PC"), m_Bitmaps[Toolbar_GotoPC]);
|
||||
toolBar->AddTool(IDM_SETPC, _T("Set PC"), m_Bitmaps[Toolbar_SetPC]);
|
||||
toolBar->AddSeparator();
|
||||
toolBar->AddControl(new wxTextCtrl(toolBar, IDM_ADDRBOX, _T("")));
|
||||
|
@ -368,6 +368,8 @@ CFrame::InitBitmaps()
|
||||
void
|
||||
CFrame::OnOpen(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||
return;
|
||||
wxString path = wxFileSelector(
|
||||
_T("Select the file to load"),
|
||||
wxEmptyString, wxEmptyString, wxEmptyString,
|
||||
|
@ -29,26 +29,6 @@ namespace D3D
|
||||
m_pTexture = NULL;
|
||||
m_pVB = NULL;
|
||||
}
|
||||
|
||||
const int RS[6][2] =
|
||||
{
|
||||
{ D3DRS_ALPHABLENDENABLE, TRUE },
|
||||
{ D3DRS_SRCBLEND, D3DBLEND_SRCALPHA },
|
||||
{ D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA },
|
||||
{ D3DRS_CULLMODE, D3DCULL_NONE },
|
||||
{ D3DRS_ZENABLE, FALSE },
|
||||
{ D3DRS_FOGENABLE, FALSE },
|
||||
};
|
||||
const int TS[6][2] =
|
||||
{
|
||||
{D3DTSS_COLOROP, D3DTOP_MODULATE},
|
||||
{D3DTSS_COLORARG1, D3DTA_TEXTURE},
|
||||
{D3DTSS_COLORARG2, D3DTA_DIFFUSE },
|
||||
{D3DTSS_ALPHAOP, D3DTOP_MODULATE },
|
||||
{D3DTSS_ALPHAARG1, D3DTA_TEXTURE },
|
||||
{D3DTSS_ALPHAARG2, D3DTA_DIFFUSE },
|
||||
};
|
||||
|
||||
enum {m_dwTexWidth = 512, m_dwTexHeight = 512};
|
||||
|
||||
int CD3DFont::Init()
|
||||
@ -171,22 +151,77 @@ namespace D3D
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CD3DFont::SetRenderStates()
|
||||
|
||||
const int RS[6][2] =
|
||||
{
|
||||
for (int i=0; i<6; i++)
|
||||
dev->SetRenderState((_D3DRENDERSTATETYPE)RS[i][0],RS[i][1]);
|
||||
for (int i=0; i<6; i++)
|
||||
dev->SetTextureStageState(0,(_D3DTEXTURESTAGESTATETYPE)int(TS[i][0]),TS[i][1]);
|
||||
{ D3DRS_ALPHABLENDENABLE, TRUE },
|
||||
{ D3DRS_SRCBLEND, D3DBLEND_SRCALPHA },
|
||||
{ D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA },
|
||||
{ D3DRS_CULLMODE, D3DCULL_NONE },
|
||||
{ D3DRS_ZENABLE, FALSE },
|
||||
{ D3DRS_FOGENABLE, FALSE },
|
||||
};
|
||||
const int TS[6][2] =
|
||||
{
|
||||
{D3DTSS_COLOROP, D3DTOP_MODULATE},
|
||||
{D3DTSS_COLORARG1, D3DTA_TEXTURE},
|
||||
{D3DTSS_COLORARG2, D3DTA_DIFFUSE },
|
||||
{D3DTSS_ALPHAOP, D3DTOP_MODULATE },
|
||||
{D3DTSS_ALPHAARG1, D3DTA_TEXTURE },
|
||||
{D3DTSS_ALPHAARG2, D3DTA_DIFFUSE },
|
||||
};
|
||||
|
||||
static DWORD RS_old[6];
|
||||
static DWORD TS_old[6];
|
||||
static LPDIRECT3DBASETEXTURE9 texture_old;
|
||||
static DWORD FVF_old;
|
||||
static LPDIRECT3DVERTEXDECLARATION9 decl_old;
|
||||
static LPDIRECT3DPIXELSHADER9 ps_old;
|
||||
static LPDIRECT3DVERTEXSHADER9 vs_old;
|
||||
|
||||
void SaveRenderStates()
|
||||
{
|
||||
for (int i = 0; i < 6; i++) {
|
||||
dev->GetRenderState((_D3DRENDERSTATETYPE)RS[i][0], &(RS_old[i]));
|
||||
dev->GetTextureStageState(0, (_D3DTEXTURESTAGESTATETYPE)int(TS[i][0]), &(TS_old[i]));
|
||||
}
|
||||
dev->GetTexture(0, &texture_old);
|
||||
dev->GetPixelShader(&ps_old);
|
||||
dev->GetVertexShader(&vs_old);
|
||||
dev->GetVertexDeclaration(&decl_old);
|
||||
dev->GetFVF(&FVF_old);
|
||||
}
|
||||
|
||||
int CD3DFont::DrawTextScaled( float x, float y, float fXScale, float fYScale, float spacing, int dwColor, const char* strText, bool center )
|
||||
void CD3DFont::SetRenderStates()
|
||||
{
|
||||
SetRenderStates();
|
||||
dev->SetTexture(0, m_pTexture);
|
||||
dev->SetPixelShader(0);
|
||||
dev->SetVertexShader(0);
|
||||
dev->SetVertexDeclaration(0);
|
||||
dev->SetFVF(D3DFVF_FONT2DVERTEX);
|
||||
for (int i = 0; i < 6; i++) {
|
||||
dev->SetRenderState((_D3DRENDERSTATETYPE)RS[i][0],RS[i][1]);
|
||||
dev->SetTextureStageState(0, (_D3DTEXTURESTAGESTATETYPE)int(TS[i][0]), TS[i][1]);
|
||||
}
|
||||
}
|
||||
|
||||
void RestoreRenderStates()
|
||||
{
|
||||
dev->SetTexture(0, texture_old);
|
||||
dev->SetPixelShader(ps_old);
|
||||
dev->SetVertexShader(vs_old);
|
||||
dev->SetVertexDeclaration(decl_old);
|
||||
dev->SetFVF(FVF_old);
|
||||
for (int i = 0; i < 6; i++) {
|
||||
dev->SetRenderState((_D3DRENDERSTATETYPE)RS[i][0], RS_old[i]);
|
||||
dev->SetTextureStageState(0, (_D3DTEXTURESTAGESTATETYPE)int(TS[i][0]), TS_old[i]);
|
||||
}
|
||||
}
|
||||
|
||||
int CD3DFont::DrawTextScaled( float x, float y, float fXScale, float fYScale, float spacing, int dwColor, const char* strText, bool center )
|
||||
{
|
||||
SaveRenderStates();
|
||||
SetRenderStates();
|
||||
dev->SetStreamSource( 0, m_pVB, 0, sizeof(FONT2DVERTEX) );
|
||||
|
||||
float vpWidth = 1;
|
||||
@ -293,13 +328,13 @@ namespace D3D
|
||||
m_pVB->Unlock();
|
||||
if( dwNumTriangles > 0 )
|
||||
dev->DrawPrimitive( D3DPT_TRIANGLELIST, 0, dwNumTriangles );
|
||||
|
||||
dev->SetRenderState(D3DRS_ZENABLE,TRUE);
|
||||
RestoreRenderStates();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void quad2d(float x1, float y1, float x2, float y2, DWORD color, float u1, float v1, float u2, float v2)
|
||||
{
|
||||
SaveRenderStates();
|
||||
struct Q2DVertex { float x,y,z,rhw; int color; float u, v; } coords[4] = {
|
||||
{x1-0.5f, y1-0.5f, 0, 1, color, u1, v1},
|
||||
{x2-0.5f, y1-0.5f, 0, 1, color, u2, v1},
|
||||
@ -311,6 +346,7 @@ namespace D3D
|
||||
dev->SetVertexDeclaration(0);
|
||||
dev->SetFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1);
|
||||
dev->DrawPrimitiveUP(D3DPT_TRIANGLEFAN,2,coords,sizeof(Q2DVertex));
|
||||
RestoreRenderStates();
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user