-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrt64.patch
60 lines (58 loc) · 3.45 KB
/
rt64.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
diff --git a/src/hle/rt64_rdp.cpp b/src/hle/rt64_rdp.cpp
index 4540cd4..2a6a21e 100644
--- a/src/hle/rt64_rdp.cpp
+++ b/src/hle/rt64_rdp.cpp
@@ -206,10 +206,16 @@ namespace RT64 {
overlapDetected = true;
}
}
-
- if (overlapDetected && (colorImage.changed || depthImage.changed)) {
+
+ if (colorImage.changed || depthImage.changed) {
state->flush();
- state->submitFramebufferPair(colorImage.changed ? FramebufferPair::FlushReason::SamplingFromColorImage : FramebufferPair::FlushReason::SamplingFromDepthImage);
+
+ if (overlapDetected) {
+ state->submitFramebufferPair(colorImage.changed ? FramebufferPair::FlushReason::SamplingFromColorImage : FramebufferPair::FlushReason::SamplingFromDepthImage);
+ }
+ else {
+ state->submitFramebufferPair(colorImage.changed ? FramebufferPair::FlushReason::ColorImageChanged : FramebufferPair::FlushReason::DepthImageChanged);
+ }
}
}
diff --git a/src/render/rt64_framebuffer_renderer.cpp b/src/render/rt64_framebuffer_renderer.cpp
index bafe3d5..f289717 100644
--- a/src/render/rt64_framebuffer_renderer.cpp
+++ b/src/render/rt64_framebuffer_renderer.cpp
@@ -1604,10 +1604,30 @@ namespace RT64 {
tileCopiesUsed = drawData.callTiles[call.callDesc.tileIndex + t].tileCopyUsed;
}
+ // HACK: Check if there are any adjacent rectangles on the same height slice and treat them as if they were a single rectangle.
+ bool coversScissorWidthMerged = false;
+ int32_t furthestLeft = INT32_MAX;
+ int32_t furthestRight = INT32_MIN;
+
+ for (uint32_t i = 0; i < proj.gameCallCount; i++) {
+ const GameCall& otherCall = proj.gameCalls[i];
+ const FixedRect otherRect = fixRect(otherCall.callDesc.rect, fbPair.scissorRect, p.fixRectLR);
+
+ if ((otherRect.uly == fixedRect.uly) && (otherRect.lry == fixedRect.lry)) {
+ furthestLeft = fmin(furthestLeft, otherRect.ulx);
+ furthestRight = fmax(furthestRight, otherRect.lrx);
+
+ if ((furthestLeft <= fbPair.scissorRect.ulx) && (furthestRight >= fbPair.scissorRect.lrx)) {
+ coversScissorWidthMerged = true;
+ break;
+ }
+ }
+ }
+
// The call's scissor spans the whole width of the framebuffer pair scissor. The rect must not be using extended origins.
const bool regularOrigins = (call.callDesc.rectLeftOrigin == G_EX_ORIGIN_NONE) && (call.callDesc.rectRightOrigin == G_EX_ORIGIN_NONE);
const bool coversScissorWidth = regularOrigins && (fixedRect.ulx <= fbPair.scissorRect.ulx) && (fixedRect.lrx >= fbPair.scissorRect.lrx);
- if (tileCopiesUsed || coversScissorWidth) {
+ if (tileCopiesUsed || coversScissorWidth || coversScissorWidthMerged) {
invRatioScale = 1.0f;
}
else {