summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/video_core/texture_cache/texture_cache.h33
-rw-r--r--src/video_core/texture_cache/texture_cache_base.h5
2 files changed, 24 insertions, 14 deletions
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h
index 26ab857c9..c8031b695 100644
--- a/src/video_core/texture_cache/texture_cache.h
+++ b/src/video_core/texture_cache/texture_cache.h
@@ -192,19 +192,8 @@ void TextureCache<P>::SynchronizeComputeDescriptors() {
}
template <class P>
-void TextureCache<P>::UpdateRenderTargets(bool is_clear) {
- using namespace VideoCommon::Dirty;
+bool TextureCache<P>::RescaleRenderTargets(bool is_clear) {
auto& flags = maxwell3d.dirty.flags;
- if (!flags[Dirty::RenderTargets]) {
- for (size_t index = 0; index < NUM_RT; ++index) {
- ImageViewId& color_buffer_id = render_targets.color_buffer_ids[index];
- PrepareImageView(color_buffer_id, true, is_clear && IsFullClear(color_buffer_id));
- }
- const ImageViewId depth_buffer_id = render_targets.depth_buffer_id;
- PrepareImageView(depth_buffer_id, true, is_clear && IsFullClear(depth_buffer_id));
- return;
- }
-
u32 scale_rating = 0;
bool rescaled = false;
std::array<ImageId, NUM_RT> tmp_color_images{};
@@ -281,8 +270,6 @@ void TextureCache<P>::UpdateRenderTargets(bool is_clear) {
scale_rating = 1;
}
} while (has_deleted_images);
- // Rescale End
-
const auto set_rating = [this, scale_rating](ImageId image_id) {
if (image_id != CORRUPT_ID) {
Image& image = slot_images[image_id];
@@ -297,6 +284,24 @@ void TextureCache<P>::UpdateRenderTargets(bool is_clear) {
}
set_rating(tmp_depth_image);
+ return rescaled;
+}
+
+template <class P>
+void TextureCache<P>::UpdateRenderTargets(bool is_clear) {
+ using namespace VideoCommon::Dirty;
+ auto& flags = maxwell3d.dirty.flags;
+ if (!flags[Dirty::RenderTargets]) {
+ for (size_t index = 0; index < NUM_RT; ++index) {
+ ImageViewId& color_buffer_id = render_targets.color_buffer_ids[index];
+ PrepareImageView(color_buffer_id, true, is_clear && IsFullClear(color_buffer_id));
+ }
+ const ImageViewId depth_buffer_id = render_targets.depth_buffer_id;
+ PrepareImageView(depth_buffer_id, true, is_clear && IsFullClear(depth_buffer_id));
+ return;
+ }
+
+ const bool rescaled = RescaleRenderTargets(is_clear);
if (is_rescaling != rescaled) {
flags[Dirty::RescaleViewports] = true;
flags[Dirty::RescaleScissors] = true;
diff --git a/src/video_core/texture_cache/texture_cache_base.h b/src/video_core/texture_cache/texture_cache_base.h
index eea589269..643ad811c 100644
--- a/src/video_core/texture_cache/texture_cache_base.h
+++ b/src/video_core/texture_cache/texture_cache_base.h
@@ -119,6 +119,11 @@ public:
/// Refresh the state for compute image view and sampler descriptors
void SynchronizeComputeDescriptors();
+ /// Updates the Render Targets if they can be rescaled
+ /// @param is_clear True when the render targets are being used for clears
+ /// @retval True if the Render Targets have been rescaled.
+ bool RescaleRenderTargets(bool is_clear);
+
/// Update bound render targets and upload memory if necessary
/// @param is_clear True when the render targets are being used for clears
void UpdateRenderTargets(bool is_clear);