summaryrefslogtreecommitdiff
path: root/src/video_core/texture_cache
diff options
context:
space:
mode:
authorGravatar Lioncash2020-12-05 04:51:14 -0500
committerGravatar Lioncash2020-12-05 06:39:35 -0500
commit414a87a4f4570344140d77a7985b4d118b754341 (patch)
tree6eac8e13f3333c89d8c0f3428b8664cab63a484a /src/video_core/texture_cache
parentMerge pull request #5124 from lioncash/video-shadow (diff)
downloadyuzu-414a87a4f4570344140d77a7985b4d118b754341.tar.gz
yuzu-414a87a4f4570344140d77a7985b4d118b754341.tar.xz
yuzu-414a87a4f4570344140d77a7985b4d118b754341.zip
video_core: Resolve more variable shadowing scenarios pt.2
Migrates the video core code closer to enabling variable shadowing warnings as errors. This primarily sorts out shadowing occurrences within the Vulkan code.
Diffstat (limited to 'src/video_core/texture_cache')
-rw-r--r--src/video_core/texture_cache/surface_base.cpp27
-rw-r--r--src/video_core/texture_cache/surface_base.h4
-rw-r--r--src/video_core/texture_cache/surface_params.cpp14
3 files changed, 23 insertions, 22 deletions
diff --git a/src/video_core/texture_cache/surface_base.cpp b/src/video_core/texture_cache/surface_base.cpp
index b44c09d71..42a1c0c6f 100644
--- a/src/video_core/texture_cache/surface_base.cpp
+++ b/src/video_core/texture_cache/surface_base.cpp
@@ -167,27 +167,28 @@ std::vector<CopyParams> SurfaceBaseImpl::BreakDownNonLayered(const SurfaceParams
167 return result; 167 return result;
168} 168}
169 169
170void SurfaceBaseImpl::SwizzleFunc(MortonSwizzleMode mode, u8* memory, const SurfaceParams& params, 170void SurfaceBaseImpl::SwizzleFunc(MortonSwizzleMode mode, u8* memory,
171 u8* buffer, u32 level) { 171 const SurfaceParams& surface_params, u8* buffer, u32 level) {
172 const u32 width{params.GetMipWidth(level)}; 172 const u32 width{surface_params.GetMipWidth(level)};
173 const u32 height{params.GetMipHeight(level)}; 173 const u32 height{surface_params.GetMipHeight(level)};
174 const u32 block_height{params.GetMipBlockHeight(level)}; 174 const u32 block_height{surface_params.GetMipBlockHeight(level)};
175 const u32 block_depth{params.GetMipBlockDepth(level)}; 175 const u32 block_depth{surface_params.GetMipBlockDepth(level)};
176 176
177 std::size_t guest_offset{mipmap_offsets[level]}; 177 std::size_t guest_offset{mipmap_offsets[level]};
178 if (params.is_layered) { 178 if (surface_params.is_layered) {
179 std::size_t host_offset = 0; 179 std::size_t host_offset = 0;
180 const std::size_t guest_stride = layer_size; 180 const std::size_t guest_stride = layer_size;
181 const std::size_t host_stride = params.GetHostLayerSize(level); 181 const std::size_t host_stride = surface_params.GetHostLayerSize(level);
182 for (u32 layer = 0; layer < params.depth; ++layer) { 182 for (u32 layer = 0; layer < surface_params.depth; ++layer) {
183 MortonSwizzle(mode, params.pixel_format, width, block_height, height, block_depth, 1, 183 MortonSwizzle(mode, surface_params.pixel_format, width, block_height, height,
184 params.tile_width_spacing, buffer + host_offset, memory + guest_offset); 184 block_depth, 1, surface_params.tile_width_spacing, buffer + host_offset,
185 memory + guest_offset);
185 guest_offset += guest_stride; 186 guest_offset += guest_stride;
186 host_offset += host_stride; 187 host_offset += host_stride;
187 } 188 }
188 } else { 189 } else {
189 MortonSwizzle(mode, params.pixel_format, width, block_height, height, block_depth, 190 MortonSwizzle(mode, surface_params.pixel_format, width, block_height, height, block_depth,
190 params.GetMipDepth(level), params.tile_width_spacing, buffer, 191 surface_params.GetMipDepth(level), surface_params.tile_width_spacing, buffer,
191 memory + guest_offset); 192 memory + guest_offset);
192 } 193 }
193} 194}
diff --git a/src/video_core/texture_cache/surface_base.h b/src/video_core/texture_cache/surface_base.h
index 173f2edba..cfcfa5b3a 100644
--- a/src/video_core/texture_cache/surface_base.h
+++ b/src/video_core/texture_cache/surface_base.h
@@ -167,8 +167,8 @@ protected:
167 std::vector<std::size_t> mipmap_offsets; 167 std::vector<std::size_t> mipmap_offsets;
168 168
169private: 169private:
170 void SwizzleFunc(MortonSwizzleMode mode, u8* memory, const SurfaceParams& params, u8* buffer, 170 void SwizzleFunc(MortonSwizzleMode mode, u8* memory, const SurfaceParams& surface_params,
171 u32 level); 171 u8* buffer, u32 level);
172 172
173 std::vector<CopyParams> BreakDownLayered(const SurfaceParams& in_params) const; 173 std::vector<CopyParams> BreakDownLayered(const SurfaceParams& in_params) const;
174 174
diff --git a/src/video_core/texture_cache/surface_params.cpp b/src/video_core/texture_cache/surface_params.cpp
index 13dd16356..305297719 100644
--- a/src/video_core/texture_cache/surface_params.cpp
+++ b/src/video_core/texture_cache/surface_params.cpp
@@ -356,18 +356,18 @@ std::size_t SurfaceParams::GetLayerSize(bool as_host_size, bool uncompressed) co
356 356
357std::size_t SurfaceParams::GetInnerMipmapMemorySize(u32 level, bool as_host_size, 357std::size_t SurfaceParams::GetInnerMipmapMemorySize(u32 level, bool as_host_size,
358 bool uncompressed) const { 358 bool uncompressed) const {
359 const u32 width{GetMipmapSize(uncompressed, GetMipWidth(level), GetDefaultBlockWidth())}; 359 const u32 mip_width{GetMipmapSize(uncompressed, GetMipWidth(level), GetDefaultBlockWidth())};
360 const u32 height{GetMipmapSize(uncompressed, GetMipHeight(level), GetDefaultBlockHeight())}; 360 const u32 mip_height{GetMipmapSize(uncompressed, GetMipHeight(level), GetDefaultBlockHeight())};
361 const u32 depth{is_layered ? 1U : GetMipDepth(level)}; 361 const u32 mip_depth{is_layered ? 1U : GetMipDepth(level)};
362 if (is_tiled) { 362 if (is_tiled) {
363 return Tegra::Texture::CalculateSize(!as_host_size, GetBytesPerPixel(), width, height, 363 return Tegra::Texture::CalculateSize(!as_host_size, GetBytesPerPixel(), mip_width,
364 depth, GetMipBlockHeight(level), 364 mip_height, mip_depth, GetMipBlockHeight(level),
365 GetMipBlockDepth(level)); 365 GetMipBlockDepth(level));
366 } else if (as_host_size || IsBuffer()) { 366 } else if (as_host_size || IsBuffer()) {
367 return GetBytesPerPixel() * width * height * depth; 367 return GetBytesPerPixel() * mip_width * mip_height * mip_depth;
368 } else { 368 } else {
369 // Linear Texture Case 369 // Linear Texture Case
370 return pitch * height * depth; 370 return pitch * mip_height * mip_depth;
371 } 371 }
372} 372}
373 373