Apply Const correctness to SwizzleKepler and replace u32 for size_t on iterators.
This commit is contained in:
parent
3e96c367bd
commit
da91e6e4b6
|
@ -288,18 +288,20 @@ void UnswizzleSubrect(u32 subrect_width, u32 subrect_height, u32 dest_pitch, u32
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwizzleKepler(u32 width, u32 height, u32 dst_x, u32 dst_y, u32 block_height,
|
void SwizzleKepler(const u32 width, const u32 height, const u32 dst_x, const u32 dst_y,
|
||||||
std::size_t copy_size, u8* source_data, u8* swizzle_data) {
|
const u32 block_height, const std::size_t copy_size, const u8* source_data,
|
||||||
|
u8* swizzle_data) {
|
||||||
const u32 image_width_in_gobs{(width + gob_size_x - 1) / gob_size_x};
|
const u32 image_width_in_gobs{(width + gob_size_x - 1) / gob_size_x};
|
||||||
std::size_t count = 0;
|
std::size_t count = 0;
|
||||||
for (u32 y = dst_y; y < height && count < copy_size; ++y) {
|
for (std::size_t y = dst_y; y < height && count < copy_size; ++y) {
|
||||||
const u32 gob_address_y =
|
const std::size_t gob_address_y =
|
||||||
(y / (gob_size_y * block_height)) * gob_size * block_height * image_width_in_gobs +
|
(y / (gob_size_y * block_height)) * gob_size * block_height * image_width_in_gobs +
|
||||||
((y % (gob_size_y * block_height)) / gob_size_y) * gob_size;
|
((y % (gob_size_y * block_height)) / gob_size_y) * gob_size;
|
||||||
const auto& table = legacy_swizzle_table[y % gob_size_y];
|
const auto& table = legacy_swizzle_table[y % gob_size_y];
|
||||||
for (u32 x = dst_x; x < width && count < copy_size; ++x) {
|
for (std::size_t x = dst_x; x < width && count < copy_size; ++x) {
|
||||||
const u32 gob_address = gob_address_y + (x / gob_size_x) * gob_size * block_height;
|
const std::size_t gob_address =
|
||||||
const u32 swizzled_offset = gob_address + table[x % gob_size_x];
|
gob_address_y + (x / gob_size_x) * gob_size * block_height;
|
||||||
|
const std::size_t swizzled_offset = gob_address + table[x % gob_size_x];
|
||||||
const u8* source_line = source_data + count;
|
const u8* source_line = source_data + count;
|
||||||
u8* dest_addr = swizzle_data + swizzled_offset;
|
u8* dest_addr = swizzle_data + swizzled_offset;
|
||||||
count++;
|
count++;
|
||||||
|
|
|
@ -51,7 +51,8 @@ void UnswizzleSubrect(u32 subrect_width, u32 subrect_height, u32 dest_pitch, u32
|
||||||
u32 bytes_per_pixel, u8* swizzled_data, u8* unswizzled_data, u32 block_height,
|
u32 bytes_per_pixel, u8* swizzled_data, u8* unswizzled_data, u32 block_height,
|
||||||
u32 offset_x, u32 offset_y);
|
u32 offset_x, u32 offset_y);
|
||||||
|
|
||||||
void SwizzleKepler(u32 width, u32 height, u32 dst_x, u32 dst_y, u32 block_height,
|
void SwizzleKepler(const u32 width, const u32 height, const u32 dst_x, const u32 dst_y,
|
||||||
std::size_t copy_size, u8* source_data, u8* swizzle_data);
|
const u32 block_height, const std::size_t copy_size, const u8* source_data,
|
||||||
|
u8* swizzle_data);
|
||||||
|
|
||||||
} // namespace Tegra::Texture
|
} // namespace Tegra::Texture
|
||||||
|
|
Reference in New Issue