Skip to content

Commit 35fc535

Browse files
simplify
sss
1 parent 0e5512e commit 35fc535

2 files changed

Lines changed: 4 additions & 69 deletions

File tree

Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DSmudge.cpp

Lines changed: 3 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -168,40 +168,7 @@ Int copyRect(unsigned char *buf, Int bufSize, int oX, int oY, int width, int hei
168168
if (hr != S_OK)
169169
goto error;
170170

171-
RECT* pSrcRect;
172-
unsigned int numRects;
173-
POINT* pDstPoint;
174-
175-
pSrcRect = &srcRect;
176-
numRects = 1;
177-
pDstPoint = &dstPoint;
178-
if (oX == 0 && oY == 0 && width == desc.Width && height == desc.Height)
179-
{
180-
pSrcRect = nullptr;
181-
numRects = 0;
182-
pDstPoint = nullptr;
183-
}
184-
185-
// TheSuperHackers @bugfix 27/02/2026 CopyRects with sub-rects is illegal on MSAA surfaces in DX8.
186-
// Resolving to an intermediate surface first.
187-
if (desc.MultiSampleType != D3DMULTISAMPLE_NONE)
188-
{
189-
IDirect3DSurface8 *resolvedSurface = nullptr;
190-
hr = m_pDev->CreateImageSurface(desc.Width, desc.Height, desc.Format, &resolvedSurface);
191-
if (hr == S_OK)
192-
{
193-
hr = m_pDev->CopyRects(surface, nullptr, 0, resolvedSurface, nullptr);
194-
if (hr == S_OK)
195-
{
196-
hr = m_pDev->CopyRects(resolvedSurface, pSrcRect, numRects, tempSurface, pDstPoint);
197-
}
198-
resolvedSurface->Release();
199-
}
200-
}
201-
else
202-
{
203-
hr=m_pDev->CopyRects(surface,pSrcRect,numRects,tempSurface,pDstPoint);
204-
}
171+
hr=m_pDev->CopyRects(surface,&srcRect,1,tempSurface,&dstPoint);
205172

206173
if (hr != S_OK)
207174
goto error;
@@ -389,22 +356,9 @@ void W3DSmudgeManager::render(RenderInfoClass &rinfo)
389356
camera.Get_View_Matrix(&view);
390357
camera.Get_Projection_Matrix(&proj);
391358

392-
IDirect3DTexture8 *backTexture = nullptr;
393359
SurfaceClass *background=m_backgroundTexture ? m_backgroundTexture->Get_Surface_Level() : nullptr;
394360

395-
bool useCopy = false;
396-
if (d3d_desc.MultiSampleType != D3DMULTISAMPLE_NONE) useCopy = true;
397-
398-
if (!useCopy)
399-
{
400-
backTexture=W3DShaderManager::getRenderTexture();
401-
if (!backTexture || !W3DShaderManager::isRenderingToTexture())
402-
{
403-
useCopy = true;
404-
}
405-
}
406-
407-
if (useCopy && !background)
361+
if (!background)
408362
{
409363
REF_PTR_RELEASE(backBuffer);
410364
return;
@@ -492,11 +446,8 @@ void W3DSmudgeManager::render(RenderInfoClass &rinfo)
492446
return; //nothing to render.
493447
}
494448

495-
if (useCopy)
496-
{
497449
//Copy the area of backbuffer occupied by smudges into an alternate buffer.
498450
background->Copy(0,0,0,0,surface_desc.Width,surface_desc.Height,backBuffer);
499-
}
500451

501452
REF_PTR_RELEASE(background);
502453
REF_PTR_RELEASE(backBuffer);
@@ -510,14 +461,7 @@ void W3DSmudgeManager::render(RenderInfoClass &rinfo)
510461

511462
DX8Wrapper::Set_Shader(ShaderClass::_PresetAlphaShader);
512463

513-
if (useCopy)
514-
{
515-
DX8Wrapper::Set_Texture(0,m_backgroundTexture);
516-
}
517-
else
518-
{
519-
DX8Wrapper::Set_DX8_Texture(0,backTexture);
520-
}
464+
DX8Wrapper::Set_Texture(0,m_backgroundTexture);
521465
//Need these states in case texture is non-power-of-2
522466
DX8Wrapper::Set_DX8_Texture_Stage_State( 0, D3DTSS_ADDRESSU, D3DTADDRESS_CLAMP);
523467
DX8Wrapper::Set_DX8_Texture_Stage_State( 0, D3DTSS_ADDRESSV, D3DTADDRESS_CLAMP);

Core/Libraries/Source/WWVegas/WW3D2/surfaceclass.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -461,16 +461,7 @@ void SurfaceClass::Copy(
461461
POINT dst;
462462
dst.x=dstx;
463463
dst.y=dsty;
464-
465-
// TheSuperHackers @bugfix 27/02/2026 Use NULL for whole-surface copies to support MSAA
466-
if (srcx == 0 && srcy == 0 && width == osd.Width && height == osd.Height && dstx == 0 && dsty == 0)
467-
{
468-
DX8Wrapper::_Copy_DX8_Rects(other->D3DSurface,nullptr,0,D3DSurface,nullptr);
469-
}
470-
else
471-
{
472-
DX8Wrapper::_Copy_DX8_Rects(other->D3DSurface,&src,1,D3DSurface,&dst);
473-
}
464+
DX8Wrapper::_Copy_DX8_Rects(other->D3DSurface,&src,1,D3DSurface,&dst);
474465
}
475466
else
476467
{

0 commit comments

Comments
 (0)