[GPU] GCC build fix for render target cache

This commit is contained in:
Joel Linn 2021-09-22 15:06:10 +02:00 committed by Triang3l
parent 247cb91ac5
commit cfd18b89f8
2 changed files with 21 additions and 10 deletions

View File

@ -1342,7 +1342,7 @@ void RenderTargetCache::ChangeOwnership(
nullptr, resolve_clear_cutout)) {
RenderTargetKey transfer_host_depth_source =
host_depth_encoding_different
? it->second.host_depth_render_targets[dest.resource_format]
? it->second.GetHostDepthRenderTarget(dest.GetDepthFormat())
: RenderTargetKey();
if (transfer_host_depth_source == transfer_source) {
// Same render target, don't provide a separate host depth source.
@ -1387,7 +1387,7 @@ void RenderTargetCache::ChangeOwnership(
// Claim the current range.
it->second.render_target = dest;
if (host_depth_encoding_different) {
it->second.host_depth_render_targets[dest.resource_format] = dest;
it->second.GetHostDepthRenderTarget(dest.GetDepthFormat()) = dest;
}
// Check if can merge with the next range after claiming.
std::map<uint32_t, OwnershipRange>::iterator it_next;

View File

@ -538,13 +538,8 @@ class RenderTargetCache {
// float32 value to that of an unorm24 with a totally wrong value). If the
// range hasn't been used yet (render_target.IsEmpty() == true), these are
// empty too.
union {
struct {
RenderTargetKey host_depth_render_target_unorm24;
RenderTargetKey host_depth_render_target_float24;
};
RenderTargetKey host_depth_render_targets[2];
};
RenderTargetKey host_depth_render_target_unorm24;
RenderTargetKey host_depth_render_target_float24;
OwnershipRange(uint32_t end_tiles, RenderTargetKey render_target,
RenderTargetKey host_depth_render_target_unorm24,
RenderTargetKey host_depth_render_target_float24)
@ -552,6 +547,22 @@ class RenderTargetCache {
render_target(render_target),
host_depth_render_target_unorm24(host_depth_render_target_unorm24),
host_depth_render_target_float24(host_depth_render_target_float24) {}
const RenderTargetKey& GetHostDepthRenderTarget(
xenos::DepthRenderTargetFormat resource_format) const {
assert_true(
resource_format == xenos::DepthRenderTargetFormat::kD24S8 ||
resource_format == xenos::DepthRenderTargetFormat::kD24FS8,
"Illegal resource format");
return resource_format == xenos::DepthRenderTargetFormat::kD24S8
? host_depth_render_target_unorm24
: host_depth_render_target_float24;
}
RenderTargetKey& GetHostDepthRenderTarget(
xenos::DepthRenderTargetFormat resource_format) {
return const_cast<RenderTargetKey&>(
const_cast<const OwnershipRange*>(this)->GetHostDepthRenderTarget(
resource_format));
}
bool IsOwnedBy(RenderTargetKey key,
bool host_depth_encoding_different) const {
if (render_target != key) {
@ -561,7 +572,7 @@ class RenderTargetCache {
return false;
}
if (host_depth_encoding_different && !key.is_depth &&
host_depth_render_targets[key.resource_format] != key) {
GetHostDepthRenderTarget(key.GetDepthFormat()) != key) {
// Depth encoding is the same, but different addressing is needed.
return false;
}