diff options
| author | 2018-11-06 19:05:57 +0100 | |
|---|---|---|
| committer | 2018-11-06 19:05:57 +0100 | |
| commit | d3b9599b2dd084db5b180a6b13ea0ceaec5c7587 (patch) | |
| tree | 79bcd8922cb90d06b61e07b5cc6e84e320aa3128 /src/video_core/textures | |
| parent | correct syntax (diff) | |
| parent | Merge pull request #1649 from degasus/split_resource_manager (diff) | |
| download | yuzu-d3b9599b2dd084db5b180a6b13ea0ceaec5c7587.tar.gz yuzu-d3b9599b2dd084db5b180a6b13ea0ceaec5c7587.tar.xz yuzu-d3b9599b2dd084db5b180a6b13ea0ceaec5c7587.zip | |
Merge branch 'master' into Texture2DArray
Diffstat (limited to 'src/video_core/textures')
| -rw-r--r-- | src/video_core/textures/astc.cpp | 32 | ||||
| -rw-r--r-- | src/video_core/textures/astc.h | 2 | ||||
| -rw-r--r-- | src/video_core/textures/decoders.cpp | 12 | ||||
| -rw-r--r-- | src/video_core/textures/decoders.h | 4 |
4 files changed, 27 insertions, 23 deletions
diff --git a/src/video_core/textures/astc.cpp b/src/video_core/textures/astc.cpp index b1feacae9..bc50a4876 100644 --- a/src/video_core/textures/astc.cpp +++ b/src/video_core/textures/astc.cpp | |||
| @@ -1598,27 +1598,29 @@ static void DecompressBlock(uint8_t inBuf[16], const uint32_t blockWidth, | |||
| 1598 | namespace Tegra::Texture::ASTC { | 1598 | namespace Tegra::Texture::ASTC { |
| 1599 | 1599 | ||
| 1600 | std::vector<uint8_t> Decompress(std::vector<uint8_t>& data, uint32_t width, uint32_t height, | 1600 | std::vector<uint8_t> Decompress(std::vector<uint8_t>& data, uint32_t width, uint32_t height, |
| 1601 | uint32_t block_width, uint32_t block_height) { | 1601 | uint32_t depth, uint32_t block_width, uint32_t block_height) { |
| 1602 | uint32_t blockIdx = 0; | 1602 | uint32_t blockIdx = 0; |
| 1603 | std::vector<uint8_t> outData(height * width * 4); | 1603 | std::vector<uint8_t> outData(height * width * depth * 4); |
| 1604 | for (uint32_t j = 0; j < height; j += block_height) { | 1604 | for (uint32_t k = 0; k < depth; k++) { |
| 1605 | for (uint32_t i = 0; i < width; i += block_width) { | 1605 | for (uint32_t j = 0; j < height; j += block_height) { |
| 1606 | for (uint32_t i = 0; i < width; i += block_width) { | ||
| 1606 | 1607 | ||
| 1607 | uint8_t* blockPtr = data.data() + blockIdx * 16; | 1608 | uint8_t* blockPtr = data.data() + blockIdx * 16; |
| 1608 | 1609 | ||
| 1609 | // Blocks can be at most 12x12 | 1610 | // Blocks can be at most 12x12 |
| 1610 | uint32_t uncompData[144]; | 1611 | uint32_t uncompData[144]; |
| 1611 | ASTCC::DecompressBlock(blockPtr, block_width, block_height, uncompData); | 1612 | ASTCC::DecompressBlock(blockPtr, block_width, block_height, uncompData); |
| 1612 | 1613 | ||
| 1613 | uint32_t decompWidth = std::min(block_width, width - i); | 1614 | uint32_t decompWidth = std::min(block_width, width - i); |
| 1614 | uint32_t decompHeight = std::min(block_height, height - j); | 1615 | uint32_t decompHeight = std::min(block_height, height - j); |
| 1615 | 1616 | ||
| 1616 | uint8_t* outRow = outData.data() + (j * width + i) * 4; | 1617 | uint8_t* outRow = outData.data() + (j * width + i) * 4; |
| 1617 | for (uint32_t jj = 0; jj < decompHeight; jj++) { | 1618 | for (uint32_t jj = 0; jj < decompHeight; jj++) { |
| 1618 | memcpy(outRow + jj * width * 4, uncompData + jj * block_width, decompWidth * 4); | 1619 | memcpy(outRow + jj * width * 4, uncompData + jj * block_width, decompWidth * 4); |
| 1619 | } | 1620 | } |
| 1620 | 1621 | ||
| 1621 | blockIdx++; | 1622 | blockIdx++; |
| 1623 | } | ||
| 1622 | } | 1624 | } |
| 1623 | } | 1625 | } |
| 1624 | 1626 | ||
diff --git a/src/video_core/textures/astc.h b/src/video_core/textures/astc.h index f0d7c0e56..d419dd025 100644 --- a/src/video_core/textures/astc.h +++ b/src/video_core/textures/astc.h | |||
| @@ -10,6 +10,6 @@ | |||
| 10 | namespace Tegra::Texture::ASTC { | 10 | namespace Tegra::Texture::ASTC { |
| 11 | 11 | ||
| 12 | std::vector<uint8_t> Decompress(std::vector<uint8_t>& data, uint32_t width, uint32_t height, | 12 | std::vector<uint8_t> Decompress(std::vector<uint8_t>& data, uint32_t width, uint32_t height, |
| 13 | uint32_t block_width, uint32_t block_height); | 13 | uint32_t depth, uint32_t block_width, uint32_t block_height); |
| 14 | 14 | ||
| 15 | } // namespace Tegra::Texture::ASTC | 15 | } // namespace Tegra::Texture::ASTC |
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp index 550ca856c..3066abf61 100644 --- a/src/video_core/textures/decoders.cpp +++ b/src/video_core/textures/decoders.cpp | |||
| @@ -227,12 +227,14 @@ u32 BytesPerPixel(TextureFormat format) { | |||
| 227 | } | 227 | } |
| 228 | } | 228 | } |
| 229 | 229 | ||
| 230 | std::vector<u8> UnswizzleTexture(VAddr address, u32 tile_size, u32 bytes_per_pixel, u32 width, | 230 | std::vector<u8> UnswizzleTexture(VAddr address, u32 tile_size_x, u32 tile_size_y, |
| 231 | u32 height, u32 depth, u32 block_height, u32 block_depth) { | 231 | u32 bytes_per_pixel, u32 width, u32 height, u32 depth, |
| 232 | u32 block_height, u32 block_depth) { | ||
| 232 | std::vector<u8> unswizzled_data(width * height * depth * bytes_per_pixel); | 233 | std::vector<u8> unswizzled_data(width * height * depth * bytes_per_pixel); |
| 233 | CopySwizzledData(width / tile_size, height / tile_size, depth, bytes_per_pixel, bytes_per_pixel, | 234 | CopySwizzledData((width + tile_size_x - 1) / tile_size_x, |
| 234 | Memory::GetPointer(address), unswizzled_data.data(), true, block_height, | 235 | (height + tile_size_y - 1) / tile_size_y, depth, bytes_per_pixel, |
| 235 | block_depth); | 236 | bytes_per_pixel, Memory::GetPointer(address), unswizzled_data.data(), true, |
| 237 | block_height, block_depth); | ||
| 236 | return unswizzled_data; | 238 | return unswizzled_data; |
| 237 | } | 239 | } |
| 238 | 240 | ||
diff --git a/src/video_core/textures/decoders.h b/src/video_core/textures/decoders.h index b390219e4..ba065510b 100644 --- a/src/video_core/textures/decoders.h +++ b/src/video_core/textures/decoders.h | |||
| @@ -19,8 +19,8 @@ inline std::size_t GetGOBSize() { | |||
| 19 | /** | 19 | /** |
| 20 | * Unswizzles a swizzled texture without changing its format. | 20 | * Unswizzles a swizzled texture without changing its format. |
| 21 | */ | 21 | */ |
| 22 | std::vector<u8> UnswizzleTexture(VAddr address, u32 tile_size, u32 bytes_per_pixel, u32 width, | 22 | std::vector<u8> UnswizzleTexture(VAddr address, u32 tile_size_x, u32 tile_size_y, |
| 23 | u32 height, u32 depth, | 23 | u32 bytes_per_pixel, u32 width, u32 height, u32 depth, |
| 24 | u32 block_height = TICEntry::DefaultBlockHeight, | 24 | u32 block_height = TICEntry::DefaultBlockHeight, |
| 25 | u32 block_depth = TICEntry::DefaultBlockHeight); | 25 | u32 block_depth = TICEntry::DefaultBlockHeight); |
| 26 | 26 | ||