Skip to content

Commit

Permalink
Use D3DBLEND_SRCALPHA/D3DBLEND_INVSRCALPHA instead of D3DBLEND_ONE/D3…
Browse files Browse the repository at this point in the history
…DBLEND_INVSRCALPHA
  • Loading branch information
pvandommelen committed Nov 13, 2017
1 parent bcfd442 commit 3258fee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/engine/RasterD3D9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ class D3D9RasterizerImpl : public D3D9Rasterizer
CD3DDevice9::Get()->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
CD3DDevice9::Get()->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
D3DCall(CD3DDevice9::Get()->SetRenderState(D3DRS_ALPHABLENDENABLE, true));
D3DCall(CD3DDevice9::Get()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE));
D3DCall(CD3DDevice9::Get()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA));
D3DCall(CD3DDevice9::Get()->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA));
break;

Expand Down
10 changes: 5 additions & 5 deletions src/engine/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ class ContextImpl : public PrivateContext {
pDev->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
pDev->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
pDev->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
pDev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
pDev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
pDev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
break;
default:
Expand Down Expand Up @@ -968,23 +968,23 @@ class ContextImpl : public PrivateContext {
{
case BlendModeSource:
pDev->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
pDev->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
pDev->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
pDev->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
pDev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCCOLOR);
pDev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCCOLOR);
break;
case BlendModeAdd:
pDev->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
pDev->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
pDev->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
pDev->SetRenderState(D3DRS_ALPHABLENDENABLE, true);
pDev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
pDev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);
break;
case BlendModeSourceAlpha:
pDev->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
pDev->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
pDev->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
pDev->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
pDev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
pDev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
pDev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
break;
default:
Expand Down

0 comments on commit 3258fee

Please sign in to comment.