GSdx: the BeginScene/EndScene optimization for dx9 (Issue 256)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1312 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gabest11 2009-06-03 22:45:28 +00:00
parent 02167e90b3
commit db8feac8c3
4 changed files with 30 additions and 13 deletions

View File

@ -78,15 +78,15 @@ public:
virtual bool IsLost() {return false;}
virtual void Present(const GSVector4i& r, int shader);
virtual void Flip() {};
virtual void Flip() {}
virtual void BeginScene() {};
virtual void EndScene() {};
virtual void BeginScene() {}
virtual void EndScene() {}
virtual void ClearRenderTarget(GSTexture* t, const GSVector4& c) {};
virtual void ClearRenderTarget(GSTexture* t, uint32 c) {};
virtual void ClearDepth(GSTexture* t, float c) {};
virtual void ClearStencil(GSTexture* t, uint8 c) {};
virtual void ClearRenderTarget(GSTexture* t, const GSVector4& c) {}
virtual void ClearRenderTarget(GSTexture* t, uint32 c) {}
virtual void ClearDepth(GSTexture* t, float c) {}
virtual void ClearStencil(GSTexture* t, uint8 c) {}
virtual GSTexture* CreateRenderTarget(int w, int h, int format = 0);
virtual GSTexture* CreateDepthStencil(int w, int h, int format = 0);
@ -105,5 +105,5 @@ public:
void Interlace(const GSVector2i& ds, int field, int mode, float yoffset);
virtual void PSSetShaderResources(GSTexture* sr0, GSTexture* sr1) {}
virtual void OMSetRenderTargets(GSTexture* rt, GSTexture* ds) {};
virtual void OMSetRenderTargets(GSTexture* rt, GSTexture* ds) {}
};

View File

@ -349,6 +349,8 @@ bool GSDevice9::IsLost()
void GSDevice9::Flip()
{
m_dev->EndScene();
if(m_swapchain)
{
m_swapchain->Present(NULL, NULL, NULL, NULL, 0);
@ -357,11 +359,13 @@ void GSDevice9::Flip()
{
m_dev->Present(NULL, NULL, NULL, NULL);
}
m_dev->BeginScene();
}
void GSDevice9::BeginScene()
{
m_dev->BeginScene();
// m_dev->BeginScene();
}
void GSDevice9::DrawPrimitive()
@ -393,7 +397,7 @@ void GSDevice9::DrawPrimitive()
void GSDevice9::EndScene()
{
m_dev->EndScene();
// m_dev->EndScene();
m_vertices.start += m_vertices.count;
m_vertices.count = 0;

View File

@ -143,7 +143,8 @@ bool GSTextureFX10::SetupVS(VSSelector sel, const VSConstantBuffer* cb)
}
m_vs[sel] = vs;
i = m_vs.find( sel );
i = m_vs.find(sel);
}
if(m_vs_cb_cache.Update(cb))
@ -247,9 +248,11 @@ void GSTextureFX10::UpdatePS(PSSelector sel, const PSConstantBuffer* cb, PSSampl
};
CComPtr<ID3D10PixelShader> ps;
hr = m_dev->CompileShader(IDR_TFX10_FX, "ps_main", macro, &ps);
m_ps[sel] = ps;
i = m_ps.find(sel);
}
@ -364,9 +367,11 @@ void GSTextureFX10::UpdateOM(OMDepthStencilSelector dssel, OMBlendSelector bsel,
}
CComPtr<ID3D10DepthStencilState> dss;
hr = (*m_dev)->CreateDepthStencilState(&dsd, &dss);
m_om_dss[dssel] = dss;
i = m_om_dss.find(dssel);
}
@ -503,9 +508,11 @@ void GSTextureFX10::UpdateOM(OMDepthStencilSelector dssel, OMBlendSelector bsel,
if(bsel.wa) bd.RenderTargetWriteMask[0] |= D3D10_COLOR_WRITE_ENABLE_ALPHA;
CComPtr<ID3D10BlendState> bs;
hr = (*m_dev)->CreateBlendState(&bd, &bs);
m_om_bs[bsel] = bs;
j = m_om_bs.find(bsel);
}

View File

@ -135,10 +135,11 @@ bool GSTextureFX9::SetupVS(VSSelector sel, const VSConstantBuffer* cb)
}
m_vs[sel] = vs;
i = m_vs.find( sel );
i = m_vs.find(sel);
}
m_dev->VSSetShader( (*i).second, (const float*)cb, sizeof(*cb) / sizeof(GSVector4));
m_dev->VSSetShader((*i).second, (const float*)cb, sizeof(*cb) / sizeof(GSVector4));
return true;
}
@ -218,9 +219,11 @@ void GSTextureFX9::UpdatePS(PSSelector sel, const PSConstantBuffer* cb, PSSample
};
CComPtr<IDirect3DPixelShader9> ps;
hr = m_dev->CompileShader(IDR_TFX9_FX, "ps_main", macro, &ps);
m_ps[sel] = ps;
i = m_ps.find(sel);
}
@ -313,6 +316,7 @@ void GSTextureFX9::UpdateOM(OMDepthStencilSelector dssel, OMBlendSelector bsel,
}
m_om_dss[dssel] = dss;
i = m_om_dss.find(dssel);
}
@ -323,6 +327,7 @@ void GSTextureFX9::UpdateOM(OMDepthStencilSelector dssel, OMBlendSelector bsel,
if(j == m_om_bs.end())
{
Direct3DBlendState9* bs = new Direct3DBlendState9();
memset(bs, 0, sizeof(*bs));
bs->BlendEnable = bsel.abe;
@ -448,6 +453,7 @@ void GSTextureFX9::UpdateOM(OMDepthStencilSelector dssel, OMBlendSelector bsel,
if(bsel.wa) bs->RenderTargetWriteMask |= D3DCOLORWRITEENABLE_ALPHA;
m_om_bs[bsel] = bs;
j = m_om_bs.find(bsel);
}