[D3D12] Clear both color and depth in resolves
This commit is contained in:
parent
f8506d6b62
commit
ae3d0bbb57
|
@ -812,6 +812,10 @@ bool RenderTargetCache::Resolve(SharedMemory* shared_memory,
|
||||||
uint32_t surface_pitch = rb_surface_info & 0x3FFF;
|
uint32_t surface_pitch = rb_surface_info & 0x3FFF;
|
||||||
MsaaSamples msaa_samples = MsaaSamples((rb_surface_info >> 16) & 0x3);
|
MsaaSamples msaa_samples = MsaaSamples((rb_surface_info >> 16) & 0x3);
|
||||||
uint32_t rb_copy_control = regs[XE_GPU_REG_RB_COPY_CONTROL].u32;
|
uint32_t rb_copy_control = regs[XE_GPU_REG_RB_COPY_CONTROL].u32;
|
||||||
|
// Depth info is always needed because color resolve may also clear depth.
|
||||||
|
uint32_t rb_depth_info = regs[XE_GPU_REG_RB_DEPTH_INFO].u32;
|
||||||
|
uint32_t depth_edram_base = rb_depth_info & 0xFFF;
|
||||||
|
uint32_t depth_format = (rb_depth_info >> 16) & 0x1;
|
||||||
uint32_t surface_index = rb_copy_control & 0x7;
|
uint32_t surface_index = rb_copy_control & 0x7;
|
||||||
if (surface_index > 4) {
|
if (surface_index > 4) {
|
||||||
assert_always();
|
assert_always();
|
||||||
|
@ -821,9 +825,8 @@ bool RenderTargetCache::Resolve(SharedMemory* shared_memory,
|
||||||
uint32_t surface_edram_base;
|
uint32_t surface_edram_base;
|
||||||
uint32_t surface_format;
|
uint32_t surface_format;
|
||||||
if (surface_is_depth) {
|
if (surface_is_depth) {
|
||||||
uint32_t rb_depth_info = regs[XE_GPU_REG_RB_DEPTH_INFO].u32;
|
surface_edram_base = depth_edram_base;
|
||||||
surface_edram_base = rb_depth_info & 0xFFF;
|
surface_format = depth_format;
|
||||||
surface_format = (rb_depth_info >> 16) & 0x1;
|
|
||||||
} else {
|
} else {
|
||||||
uint32_t rb_color_info;
|
uint32_t rb_color_info;
|
||||||
switch (surface_index) {
|
switch (surface_index) {
|
||||||
|
@ -898,12 +901,18 @@ bool RenderTargetCache::Resolve(SharedMemory* shared_memory,
|
||||||
msaa_samples != MsaaSamples::k1X ? "s" : "", surface_format,
|
msaa_samples != MsaaSamples::k1X ? "s" : "", surface_format,
|
||||||
surface_edram_base);
|
surface_edram_base);
|
||||||
|
|
||||||
bool copied = ResolveCopy(shared_memory, texture_cache, surface_edram_base,
|
bool result = ResolveCopy(shared_memory, texture_cache, surface_edram_base,
|
||||||
surface_pitch, msaa_samples, surface_is_depth,
|
surface_pitch, msaa_samples, surface_is_depth,
|
||||||
surface_format, src_rect);
|
surface_format, src_rect);
|
||||||
bool cleared = ResolveClear(surface_edram_base, surface_pitch, msaa_samples,
|
// Clear the color RT if needed.
|
||||||
surface_is_depth, surface_format, src_rect);
|
if (!surface_is_depth) {
|
||||||
return copied || cleared;
|
result &= ResolveClear(surface_edram_base, surface_pitch, msaa_samples,
|
||||||
|
false, surface_format, src_rect);
|
||||||
|
}
|
||||||
|
// Clear the depth RT if needed (may be cleared alongside color).
|
||||||
|
result &= ResolveClear(depth_edram_base, surface_pitch, msaa_samples, true,
|
||||||
|
depth_format, src_rect);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RenderTargetCache::ResolveCopy(SharedMemory* shared_memory,
|
bool RenderTargetCache::ResolveCopy(SharedMemory* shared_memory,
|
||||||
|
@ -1422,7 +1431,8 @@ bool RenderTargetCache::ResolveClear(uint32_t edram_base,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
XELOGGPU("Resolve: Clearing the render target");
|
XELOGGPU("Resolve: Clearing the %s render target",
|
||||||
|
is_depth ? "depth" : "color");
|
||||||
|
|
||||||
// Calculate the layout.
|
// Calculate the layout.
|
||||||
bool is_64bpp =
|
bool is_64bpp =
|
||||||
|
|
Loading…
Reference in New Issue