summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2019-06-29 17:29:39 -0300
committerGravatar ReinUsesLisp2019-06-29 17:29:39 -0300
commit3f3c3ca5f96fd5742524703f20b531338fa2e5f7 (patch)
tree8d1cbe2d6c6c565cd239aaddf7bb5f97b4aba09f /src
parenttexture_cache: Correct variable naming. (diff)
downloadyuzu-3f3c3ca5f96fd5742524703f20b531338fa2e5f7.tar.gz
yuzu-3f3c3ca5f96fd5742524703f20b531338fa2e5f7.tar.xz
yuzu-3f3c3ca5f96fd5742524703f20b531338fa2e5f7.zip
texture_cache: Address feedback
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_texture_cache.cpp5
-rw-r--r--src/video_core/renderer_opengl/gl_texture_cache.h15
-rw-r--r--src/video_core/texture_cache/surface_base.h2
-rw-r--r--src/video_core/texture_cache/texture_cache.h21
4 files changed, 13 insertions, 30 deletions
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp
index 672f26f37..97014a676 100644
--- a/src/video_core/renderer_opengl/gl_texture_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp
@@ -236,10 +236,7 @@ CachedSurface::CachedSurface(const GPUVAddr gpu_addr, const SurfaceParams& param
236 true); 236 true);
237} 237}
238 238
239CachedSurface::~CachedSurface() { 239CachedSurface::~CachedSurface() = default;
240 views.clear();
241 main_view = nullptr;
242}
243 240
244void CachedSurface::DownloadTexture(std::vector<u8>& staging_buffer) { 241void CachedSurface::DownloadTexture(std::vector<u8>& staging_buffer) {
245 MICROPROFILE_SCOPE(OpenGL_Texture_Download); 242 MICROPROFILE_SCOPE(OpenGL_Texture_Download);
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.h b/src/video_core/renderer_opengl/gl_texture_cache.h
index 8da81dba3..d4c6e9a30 100644
--- a/src/video_core/renderer_opengl/gl_texture_cache.h
+++ b/src/video_core/renderer_opengl/gl_texture_cache.h
@@ -89,21 +89,6 @@ public:
89 return surface.GetSurfaceParams(); 89 return surface.GetSurfaceParams();
90 } 90 }
91 91
92 u32 GetWidth() const {
93 const auto& owner_params = GetSurfaceParams();
94 return owner_params.GetMipWidth(params.base_level);
95 }
96
97 u32 GetHeight() const {
98 const auto& owner_params = GetSurfaceParams();
99 return owner_params.GetMipHeight(params.base_level);
100 }
101
102 u32 GetDepth() const {
103 const auto& owner_params = GetSurfaceParams();
104 return owner_params.GetMipDepth(params.base_level);
105 }
106
107 void ApplySwizzle(Tegra::Texture::SwizzleSource x_source, 92 void ApplySwizzle(Tegra::Texture::SwizzleSource x_source,
108 Tegra::Texture::SwizzleSource y_source, 93 Tegra::Texture::SwizzleSource y_source,
109 Tegra::Texture::SwizzleSource z_source, 94 Tegra::Texture::SwizzleSource z_source,
diff --git a/src/video_core/texture_cache/surface_base.h b/src/video_core/texture_cache/surface_base.h
index d632630ce..eaed6545d 100644
--- a/src/video_core/texture_cache/surface_base.h
+++ b/src/video_core/texture_cache/surface_base.h
@@ -294,8 +294,8 @@ protected:
294 294
295 virtual TView CreateView(const ViewParams& view_key) = 0; 295 virtual TView CreateView(const ViewParams& view_key) = 0;
296 296
297 std::unordered_map<ViewParams, TView> views;
298 TView main_view; 297 TView main_view;
298 std::unordered_map<ViewParams, TView> views;
299 299
300private: 300private:
301 TView GetView(const ViewParams& key) { 301 TView GetView(const ViewParams& key) {
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h
index b5b0e91ef..9436a5ff2 100644
--- a/src/video_core/texture_cache/texture_cache.h
+++ b/src/video_core/texture_cache/texture_cache.h
@@ -79,10 +79,9 @@ public:
79 if (surfaces.empty()) { 79 if (surfaces.empty()) {
80 return; 80 return;
81 } 81 }
82 std::sort(surfaces.begin(), surfaces.end(), 82 std::sort(surfaces.begin(), surfaces.end(), [](const TSurface& a, const TSurface& b) {
83 [](const TSurface& a, const TSurface& b) -> bool { 83 return a->GetModificationTick() < b->GetModificationTick();
84 return a->GetModificationTick() < b->GetModificationTick(); 84 });
85 });
86 for (const auto& surface : surfaces) { 85 for (const auto& surface : surfaces) {
87 FlushSurface(surface); 86 FlushSurface(surface);
88 } 87 }
@@ -181,13 +180,15 @@ public:
181 } 180 }
182 181
183 void MarkColorBufferInUse(std::size_t index) { 182 void MarkColorBufferInUse(std::size_t index) {
184 if (render_targets[index].target) 183 if (auto& render_target = render_targets[index].target) {
185 render_targets[index].target->MarkAsModified(true, Tick()); 184 render_target->MarkAsModified(true, Tick());
185 }
186 } 186 }
187 187
188 void MarkDepthBufferInUse() { 188 void MarkDepthBufferInUse() {
189 if (depth_buffer.target) 189 if (depth_buffer.target) {
190 depth_buffer.target->MarkAsModified(true, Tick()); 190 depth_buffer.target->MarkAsModified(true, Tick());
191 }
191 } 192 }
192 193
193 void SetEmptyDepthBuffer() { 194 void SetEmptyDepthBuffer() {
@@ -245,11 +246,11 @@ protected:
245 } 246 }
246 SetEmptyDepthBuffer(); 247 SetEmptyDepthBuffer();
247 staging_cache.SetSize(2); 248 staging_cache.SetSize(2);
248 auto make_siblings = ([this](PixelFormat a, PixelFormat b) { 249 const auto make_siblings = [this](PixelFormat a, PixelFormat b) {
249 siblings_table[a] = b; 250 siblings_table[a] = b;
250 siblings_table[b] = a; 251 siblings_table[b] = a;
251 }); 252 };
252 const u32 max_formats = static_cast<u32>(PixelFormat::Max); 253 const auto max_formats = static_cast<u32>(PixelFormat::Max);
253 siblings_table.reserve(max_formats); 254 siblings_table.reserve(max_formats);
254 for (u32 i = 0; i < max_formats; i++) { 255 for (u32 i = 0; i < max_formats; i++) {
255 siblings_table[static_cast<PixelFormat>(i)] = PixelFormat::Invalid; 256 siblings_table[static_cast<PixelFormat>(i)] = PixelFormat::Invalid;