mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-16 05:38:04 -05:00
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.
This commit is contained in:
@ -167,27 +167,28 @@ std::vector<CopyParams> SurfaceBaseImpl::BreakDownNonLayered(const SurfaceParams
|
||||
return result;
|
||||
}
|
||||
|
||||
void SurfaceBaseImpl::SwizzleFunc(MortonSwizzleMode mode, u8* memory, const SurfaceParams& params,
|
||||
u8* buffer, u32 level) {
|
||||
const u32 width{params.GetMipWidth(level)};
|
||||
const u32 height{params.GetMipHeight(level)};
|
||||
const u32 block_height{params.GetMipBlockHeight(level)};
|
||||
const u32 block_depth{params.GetMipBlockDepth(level)};
|
||||
void SurfaceBaseImpl::SwizzleFunc(MortonSwizzleMode mode, u8* memory,
|
||||
const SurfaceParams& surface_params, u8* buffer, u32 level) {
|
||||
const u32 width{surface_params.GetMipWidth(level)};
|
||||
const u32 height{surface_params.GetMipHeight(level)};
|
||||
const u32 block_height{surface_params.GetMipBlockHeight(level)};
|
||||
const u32 block_depth{surface_params.GetMipBlockDepth(level)};
|
||||
|
||||
std::size_t guest_offset{mipmap_offsets[level]};
|
||||
if (params.is_layered) {
|
||||
if (surface_params.is_layered) {
|
||||
std::size_t host_offset = 0;
|
||||
const std::size_t guest_stride = layer_size;
|
||||
const std::size_t host_stride = params.GetHostLayerSize(level);
|
||||
for (u32 layer = 0; layer < params.depth; ++layer) {
|
||||
MortonSwizzle(mode, params.pixel_format, width, block_height, height, block_depth, 1,
|
||||
params.tile_width_spacing, buffer + host_offset, memory + guest_offset);
|
||||
const std::size_t host_stride = surface_params.GetHostLayerSize(level);
|
||||
for (u32 layer = 0; layer < surface_params.depth; ++layer) {
|
||||
MortonSwizzle(mode, surface_params.pixel_format, width, block_height, height,
|
||||
block_depth, 1, surface_params.tile_width_spacing, buffer + host_offset,
|
||||
memory + guest_offset);
|
||||
guest_offset += guest_stride;
|
||||
host_offset += host_stride;
|
||||
}
|
||||
} else {
|
||||
MortonSwizzle(mode, params.pixel_format, width, block_height, height, block_depth,
|
||||
params.GetMipDepth(level), params.tile_width_spacing, buffer,
|
||||
MortonSwizzle(mode, surface_params.pixel_format, width, block_height, height, block_depth,
|
||||
surface_params.GetMipDepth(level), surface_params.tile_width_spacing, buffer,
|
||||
memory + guest_offset);
|
||||
}
|
||||
}
|
||||
|
@ -167,8 +167,8 @@ protected:
|
||||
std::vector<std::size_t> mipmap_offsets;
|
||||
|
||||
private:
|
||||
void SwizzleFunc(MortonSwizzleMode mode, u8* memory, const SurfaceParams& params, u8* buffer,
|
||||
u32 level);
|
||||
void SwizzleFunc(MortonSwizzleMode mode, u8* memory, const SurfaceParams& surface_params,
|
||||
u8* buffer, u32 level);
|
||||
|
||||
std::vector<CopyParams> BreakDownLayered(const SurfaceParams& in_params) const;
|
||||
|
||||
|
@ -356,18 +356,18 @@ std::size_t SurfaceParams::GetLayerSize(bool as_host_size, bool uncompressed) co
|
||||
|
||||
std::size_t SurfaceParams::GetInnerMipmapMemorySize(u32 level, bool as_host_size,
|
||||
bool uncompressed) const {
|
||||
const u32 width{GetMipmapSize(uncompressed, GetMipWidth(level), GetDefaultBlockWidth())};
|
||||
const u32 height{GetMipmapSize(uncompressed, GetMipHeight(level), GetDefaultBlockHeight())};
|
||||
const u32 depth{is_layered ? 1U : GetMipDepth(level)};
|
||||
const u32 mip_width{GetMipmapSize(uncompressed, GetMipWidth(level), GetDefaultBlockWidth())};
|
||||
const u32 mip_height{GetMipmapSize(uncompressed, GetMipHeight(level), GetDefaultBlockHeight())};
|
||||
const u32 mip_depth{is_layered ? 1U : GetMipDepth(level)};
|
||||
if (is_tiled) {
|
||||
return Tegra::Texture::CalculateSize(!as_host_size, GetBytesPerPixel(), width, height,
|
||||
depth, GetMipBlockHeight(level),
|
||||
return Tegra::Texture::CalculateSize(!as_host_size, GetBytesPerPixel(), mip_width,
|
||||
mip_height, mip_depth, GetMipBlockHeight(level),
|
||||
GetMipBlockDepth(level));
|
||||
} else if (as_host_size || IsBuffer()) {
|
||||
return GetBytesPerPixel() * width * height * depth;
|
||||
return GetBytesPerPixel() * mip_width * mip_height * mip_depth;
|
||||
} else {
|
||||
// Linear Texture Case
|
||||
return pitch * height * depth;
|
||||
return pitch * mip_height * mip_depth;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user