1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-02 09:03:37 +00:00

Do not use clearDepthBuffer in FillRect. Use drawRect only.

This commit is contained in:
Sergey Lipskiy 2018-09-24 21:39:42 +07:00
parent 6a7c64dd6b
commit 5e1c8a6b58
4 changed files with 12 additions and 10 deletions

View File

@ -671,8 +671,7 @@ public:
void update(bool _force) override
{
int renderTarget = 0;
if ((gDP.colorImage.address == gDP.depthImageAddress ) ||
(gDP.fillColor.color == DepthClearColor && gDP.otherMode.cycleType == G_CYC_FILL)) {
if (isCurrentColorImageDepthImage()) {
renderTarget = gDP.otherMode.depthCompare + 1;
}
uRenderTarget.set(renderTarget, _force);

View File

@ -657,7 +657,7 @@ void GraphicsDrawer::_updateStates(DrawingState _drawingState) const
if (!config.generalEmulation.enableFragmentDepthWrite)
return;
if (gDP.colorImage.address == gDP.depthImageAddress &&
if (isCurrentColorImageDepthImage() &&
config.generalEmulation.enableFragmentDepthWrite != 0 &&
config.frameBufferEmulation.N64DepthCompare == 0 &&
(config.generalEmulation.hacks & hack_ZeldaMM) == 0

View File

@ -27,6 +27,12 @@ using namespace std;
gDPInfo gDP;
bool isCurrentColorImageDepthImage()
{
return (gDP.colorImage.address == gDP.depthImageAddress) ||
(gDP.fillColor.color == DepthClearColor && gDP.otherMode.cycleType == G_CYC_FILL);
}
void gDPSetOtherMode( u32 mode0, u32 mode1 )
{
gDP.otherMode.h = mode0;
@ -705,9 +711,7 @@ void gDPFillRectangle( s32 ulx, s32 uly, s32 lrx, s32 lry )
if (gDP.fillColor.color == DepthClearColor) {
frameBufferList().fillRDRAM(ulx, uly, lrx, lry);
depthBuffer = dbFound;
if (config.frameBufferEmulation.N64DepthCompare == 0 &&
(config.generalEmulation.enableFragmentDepthWrite == 0 ||
(ulx == 0 && uly == 0 && lrx == gDP.scissor.lrx && lry == gDP.scissor.lry))) {
if (config.generalEmulation.enableFragmentDepthWrite == 0) {
drawer.clearDepthBuffer(ulx, uly, lrx, lry);
depthBuffer = dbCleared;
} else
@ -717,9 +721,7 @@ void gDPFillRectangle( s32 ulx, s32 uly, s32 lrx, s32 lry )
depthBuffer = dbFound;
depthBufferList().saveBuffer(gDP.colorImage.address);
frameBufferList().fillRDRAM(ulx, uly, lrx, lry);
if (config.frameBufferEmulation.N64DepthCompare == 0 &&
(config.generalEmulation.enableFragmentDepthWrite == 0 ||
(ulx == 0 && uly == 0 && lrx == gDP.scissor.lrx && lry == gDP.scissor.lry))) {
if (config.generalEmulation.enableFragmentDepthWrite == 0) {
drawer.clearDepthBuffer(ulx, uly, lrx, lry);
depthBuffer = dbCleared;
} else

View File

@ -295,5 +295,6 @@ void gDPTriShadeZ( u32 w0, u32 w1 );
void gDPTriTxtrZ( u32 w0, u32 w1 );
void gDPTriShadeTxtrZ( u32 w0, u32 w1 );
#endif
bool isCurrentColorImageDepthImage();
#endif