Skip to content

Commit

Permalink
Update antialiasing.ixx
Browse files Browse the repository at this point in the history
- fixes #385

Co-Authored-By: RaphaelK12 <[email protected]>
  • Loading branch information
ThirteenAG and RaphaelK12 committed Jan 4, 2024
1 parent 7df8ccb commit c15ac89
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions source/antialiasing.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,12 @@ public:
{
if (Format == D3DFMT_A16B16G16R16F && ppTexture && (getWindowWidth() * (bUseSSAA ? 2 : 1)) && Height == (getWindowHeight() * (bUseSSAA ? 2 : 1)))
{
SAFE_RELEASE(ShadersAA::pHDRTex2);
SAFE_RELEASE(ShadersAA::areaTex);
SAFE_RELEASE(ShadersAA::searchTex);
SAFE_RELEASE(ShadersAA::edgesTex);
SAFE_RELEASE(ShadersAA::blendTex);

// create new texture to postfx
if (SUCCEEDED(CreateTextureOriginalPtr(pDevice, Width, Height, Levels, Usage, Format, Pool, &ShadersAA::pHDRTex2, 0)) && ShadersAA::pHDRTex2)
{
Expand Down Expand Up @@ -207,7 +213,7 @@ public:
IDirect3DSurface9* blendSurf = nullptr;
DWORD OldSRGB = 0;
DWORD OldSampler = 0;
#define PostfxTextureCount 6
#define PostfxTextureCount 5
IDirect3DBaseTexture9* prePostFx[PostfxTextureCount] = { 0 };
DWORD Samplers[PostfxTextureCount] = { D3DTEXF_LINEAR };

Expand Down Expand Up @@ -344,9 +350,11 @@ public:

// restore sampler state
for(int i = 0; i < PostfxTextureCount; i++) {
pDevice->SetTexture(i, prePostFx[i]);
pDevice->SetSamplerState(i, D3DSAMP_MAGFILTER, Samplers[i]);
SAFE_RELEASE(prePostFx[i]);
if(prePostFx[i]) {
pDevice->SetTexture(i, prePostFx[i]);
pDevice->SetSamplerState(i, D3DSAMP_MAGFILTER, Samplers[i]);
SAFE_RELEASE(prePostFx[i]);
}
}

SAFE_RELEASE(backBuffer);
Expand All @@ -356,6 +364,7 @@ public:
}
doPostFxAA = false;
};
SAFE_RELEASE(backBuffer);
}
};

Expand Down

0 comments on commit c15ac89

Please sign in to comment.