Commit cc6cae2e authored by nadro's avatar nadro

- Fixed issue related to D3D9 device lost and broken blending. Thanks...

- Fixed issue related to D3D9 device lost and broken blending. Thanks CuteAlien for report this bug.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5080 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 818f8563
...@@ -2876,6 +2876,10 @@ bool CD3D9Driver::reset() ...@@ -2876,6 +2876,10 @@ bool CD3D9Driver::reset()
HRESULT hr = pID3DDevice->Reset(&present); HRESULT hr = pID3DDevice->Reset(&present);
// reset bridge calls.
if (BridgeCalls)
BridgeCalls->reset();
// restore screen depthbuffer descriptor // restore screen depthbuffer descriptor
if (SUCCEEDED(pID3DDevice->GetDepthStencilSurface(&DepthStencilSurface))) if (SUCCEEDED(pID3DDevice->GetDepthStencilSurface(&DepthStencilSurface)))
DepthStencilSurface->Release(); DepthStencilSurface->Release();
...@@ -3469,20 +3473,36 @@ CD3D9CallBridge* CD3D9Driver::getBridgeCalls() const ...@@ -3469,20 +3473,36 @@ CD3D9CallBridge* CD3D9Driver::getBridgeCalls() const
CD3D9CallBridge::CD3D9CallBridge(IDirect3DDevice9* p, CD3D9Driver* driver) : pID3DDevice(p), CD3D9CallBridge::CD3D9CallBridge(IDirect3DDevice9* p, CD3D9Driver* driver) : pID3DDevice(p),
BlendOperation(D3DBLENDOP_ADD), BlendSourceRGB(D3DBLEND_ONE), BlendDestinationRGB(D3DBLEND_ZERO), BlendOperation(D3DBLENDOP_ADD), BlendSourceRGB(D3DBLEND_ONE), BlendDestinationRGB(D3DBLEND_ZERO),
BlendSourceAlpha(D3DBLEND_ONE), BlendDestinationAlpha(D3DBLEND_ZERO), Blend(false), BlendSeparate(false) BlendSourceAlpha(D3DBLEND_ONE), BlendDestinationAlpha(D3DBLEND_ZERO), Blend(false), BlendSeparate(false),
FeatureBlendSeparate(false)
{ {
FeatureBlendSeparate = driver->queryFeature(EVDF_BLEND_SEPARATE); FeatureBlendSeparate = driver->queryFeature(EVDF_BLEND_SEPARATE);
pID3DDevice->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD); reset();
pID3DDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE); }
pID3DDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ZERO);
void CD3D9CallBridge::reset()
{
BlendOperation = D3DBLENDOP_ADD;
BlendSourceRGB = D3DBLEND_ONE;
BlendDestinationRGB = D3DBLEND_ZERO;
BlendSourceAlpha = D3DBLEND_ONE;
BlendDestinationAlpha = D3DBLEND_ZERO;
Blend = false;
BlendSeparate = false;
pID3DDevice->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD);
pID3DDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
pID3DDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ZERO);
pID3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); pID3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
if (FeatureBlendSeparate) if (FeatureBlendSeparate)
{ {
pID3DDevice->SetRenderState(D3DRS_SRCBLENDALPHA, D3DBLEND_ONE); pID3DDevice->SetRenderState(D3DRS_SRCBLENDALPHA, D3DBLEND_ONE);
pID3DDevice->SetRenderState(D3DRS_DESTBLENDALPHA, D3DBLEND_ZERO); pID3DDevice->SetRenderState(D3DRS_DESTBLENDALPHA, D3DBLEND_ZERO);
pID3DDevice->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, FALSE); pID3DDevice->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, FALSE);
} }
} }
......
...@@ -473,6 +473,10 @@ namespace video ...@@ -473,6 +473,10 @@ namespace video
public: public:
CD3D9CallBridge(IDirect3DDevice9* p, CD3D9Driver* driver); CD3D9CallBridge(IDirect3DDevice9* p, CD3D9Driver* driver);
// Reset to default state.
void reset();
// Blending calls. // Blending calls.
void setBlendOperation(DWORD mode); void setBlendOperation(DWORD mode);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment