diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/engines/fermi_2d.cpp | 14 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_dma.cpp | 10 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_dma.h | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 32 | ||||
| -rw-r--r-- | src/video_core/textures/decoders.cpp | 40 | ||||
| -rw-r--r-- | src/video_core/textures/decoders.h | 15 | ||||
| -rw-r--r-- | src/video_core/textures/texture.h | 1 | ||||
| -rw-r--r-- | src/yuzu/debugger/graphics/graphics_surface.cpp | 5 |
8 files changed, 67 insertions, 54 deletions
diff --git a/src/video_core/engines/fermi_2d.cpp b/src/video_core/engines/fermi_2d.cpp index 912e785b9..597b279b9 100644 --- a/src/video_core/engines/fermi_2d.cpp +++ b/src/video_core/engines/fermi_2d.cpp | |||
| @@ -62,14 +62,16 @@ void Fermi2D::HandleSurfaceCopy() { | |||
| 62 | u8* dst_buffer = Memory::GetPointer(dest_cpu); | 62 | u8* dst_buffer = Memory::GetPointer(dest_cpu); |
| 63 | if (!regs.src.linear && regs.dst.linear) { | 63 | if (!regs.src.linear && regs.dst.linear) { |
| 64 | // If the input is tiled and the output is linear, deswizzle the input and copy it over. | 64 | // If the input is tiled and the output is linear, deswizzle the input and copy it over. |
| 65 | Texture::CopySwizzledData(regs.src.width, regs.src.height, src_bytes_per_pixel, | 65 | Texture::CopySwizzledData(regs.src.width, regs.src.height, regs.src.depth, |
| 66 | dst_bytes_per_pixel, src_buffer, dst_buffer, true, | 66 | src_bytes_per_pixel, dst_bytes_per_pixel, src_buffer, |
| 67 | regs.src.BlockHeight()); | 67 | dst_buffer, true, regs.src.BlockHeight(), |
| 68 | regs.src.BlockDepth()); | ||
| 68 | } else { | 69 | } else { |
| 69 | // If the input is linear and the output is tiled, swizzle the input and copy it over. | 70 | // If the input is linear and the output is tiled, swizzle the input and copy it over. |
| 70 | Texture::CopySwizzledData(regs.src.width, regs.src.height, src_bytes_per_pixel, | 71 | Texture::CopySwizzledData(regs.src.width, regs.src.height, regs.src.depth, |
| 71 | dst_bytes_per_pixel, dst_buffer, src_buffer, false, | 72 | src_bytes_per_pixel, dst_bytes_per_pixel, dst_buffer, |
| 72 | regs.dst.BlockHeight()); | 73 | src_buffer, false, regs.dst.BlockHeight(), |
| 74 | regs.dst.BlockDepth()); | ||
| 73 | } | 75 | } |
| 74 | } | 76 | } |
| 75 | } | 77 | } |
diff --git a/src/video_core/engines/maxwell_dma.cpp b/src/video_core/engines/maxwell_dma.cpp index aa7481b8c..bf2a21bb6 100644 --- a/src/video_core/engines/maxwell_dma.cpp +++ b/src/video_core/engines/maxwell_dma.cpp | |||
| @@ -68,12 +68,14 @@ void MaxwellDMA::HandleCopy() { | |||
| 68 | 68 | ||
| 69 | if (regs.exec.is_dst_linear && !regs.exec.is_src_linear) { | 69 | if (regs.exec.is_dst_linear && !regs.exec.is_src_linear) { |
| 70 | // If the input is tiled and the output is linear, deswizzle the input and copy it over. | 70 | // If the input is tiled and the output is linear, deswizzle the input and copy it over. |
| 71 | Texture::CopySwizzledData(regs.src_params.size_x, regs.src_params.size_y, 1, 1, src_buffer, | 71 | Texture::CopySwizzledData(regs.src_params.size_x, regs.src_params.size_y, |
| 72 | dst_buffer, true, regs.src_params.BlockHeight()); | 72 | regs.src_params.size_z, 1, 1, src_buffer, dst_buffer, true, |
| 73 | regs.src_params.BlockHeight(), regs.src_params.BlockDepth()); | ||
| 73 | } else { | 74 | } else { |
| 74 | // If the input is linear and the output is tiled, swizzle the input and copy it over. | 75 | // If the input is linear and the output is tiled, swizzle the input and copy it over. |
| 75 | Texture::CopySwizzledData(regs.dst_params.size_x, regs.dst_params.size_y, 1, 1, dst_buffer, | 76 | Texture::CopySwizzledData(regs.dst_params.size_x, regs.dst_params.size_y, |
| 76 | src_buffer, false, regs.dst_params.BlockHeight()); | 77 | regs.dst_params.size_z, 1, 1, dst_buffer, src_buffer, false, |
| 78 | regs.dst_params.BlockHeight(), regs.dst_params.BlockDepth()); | ||
| 77 | } | 79 | } |
| 78 | } | 80 | } |
| 79 | 81 | ||
diff --git a/src/video_core/engines/maxwell_dma.h b/src/video_core/engines/maxwell_dma.h index 311ccb616..df19e02e2 100644 --- a/src/video_core/engines/maxwell_dma.h +++ b/src/video_core/engines/maxwell_dma.h | |||
| @@ -43,6 +43,10 @@ public: | |||
| 43 | u32 BlockHeight() const { | 43 | u32 BlockHeight() const { |
| 44 | return 1 << block_height; | 44 | return 1 << block_height; |
| 45 | } | 45 | } |
| 46 | |||
| 47 | u32 BlockDepth() const { | ||
| 48 | return 1 << block_depth; | ||
| 49 | } | ||
| 46 | }; | 50 | }; |
| 47 | 51 | ||
| 48 | static_assert(sizeof(Parameters) == 24, "Parameters has wrong size"); | 52 | static_assert(sizeof(Parameters) == 24, "Parameters has wrong size"); |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 65a220c41..86cb62dae 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -323,8 +323,8 @@ static bool IsFormatBCn(PixelFormat format) { | |||
| 323 | } | 323 | } |
| 324 | 324 | ||
| 325 | template <bool morton_to_gl, PixelFormat format> | 325 | template <bool morton_to_gl, PixelFormat format> |
| 326 | void MortonCopy(u32 stride, u32 block_height, u32 height, u8* gl_buffer, std::size_t gl_buffer_size, | 326 | void MortonCopy(u32 stride, u32 block_height, u32 height, u32 block_depth, u32 depth, u8* gl_buffer, |
| 327 | VAddr addr) { | 327 | std::size_t gl_buffer_size, VAddr addr) { |
| 328 | constexpr u32 bytes_per_pixel = SurfaceParams::GetFormatBpp(format) / CHAR_BIT; | 328 | constexpr u32 bytes_per_pixel = SurfaceParams::GetFormatBpp(format) / CHAR_BIT; |
| 329 | constexpr u32 gl_bytes_per_pixel = CachedSurface::GetGLBytesPerPixel(format); | 329 | constexpr u32 gl_bytes_per_pixel = CachedSurface::GetGLBytesPerPixel(format); |
| 330 | 330 | ||
| @@ -333,7 +333,7 @@ void MortonCopy(u32 stride, u32 block_height, u32 height, u8* gl_buffer, std::si | |||
| 333 | // pixel values. | 333 | // pixel values. |
| 334 | const u32 tile_size{IsFormatBCn(format) ? 4U : 1U}; | 334 | const u32 tile_size{IsFormatBCn(format) ? 4U : 1U}; |
| 335 | const std::vector<u8> data = Tegra::Texture::UnswizzleTexture( | 335 | const std::vector<u8> data = Tegra::Texture::UnswizzleTexture( |
| 336 | addr, tile_size, bytes_per_pixel, stride, height, block_height); | 336 | addr, tile_size, bytes_per_pixel, stride, height, depth, block_height, block_depth); |
| 337 | const std::size_t size_to_copy{std::min(gl_buffer_size, data.size())}; | 337 | const std::size_t size_to_copy{std::min(gl_buffer_size, data.size())}; |
| 338 | memcpy(gl_buffer, data.data(), size_to_copy); | 338 | memcpy(gl_buffer, data.data(), size_to_copy); |
| 339 | } else { | 339 | } else { |
| @@ -345,7 +345,7 @@ void MortonCopy(u32 stride, u32 block_height, u32 height, u8* gl_buffer, std::si | |||
| 345 | } | 345 | } |
| 346 | } | 346 | } |
| 347 | 347 | ||
| 348 | static constexpr std::array<void (*)(u32, u32, u32, u8*, std::size_t, VAddr), | 348 | static constexpr std::array<void (*)(u32, u32, u32, u32, u32, u8*, std::size_t, VAddr), |
| 349 | SurfaceParams::MaxPixelFormat> | 349 | SurfaceParams::MaxPixelFormat> |
| 350 | morton_to_gl_fns = { | 350 | morton_to_gl_fns = { |
| 351 | // clang-format off | 351 | // clang-format off |
| @@ -403,7 +403,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, std::size_t, VAddr), | |||
| 403 | // clang-format on | 403 | // clang-format on |
| 404 | }; | 404 | }; |
| 405 | 405 | ||
| 406 | static constexpr std::array<void (*)(u32, u32, u32, u8*, std::size_t, VAddr), | 406 | static constexpr std::array<void (*)(u32, u32, u32, u32, u32, u8*, std::size_t, VAddr), |
| 407 | SurfaceParams::MaxPixelFormat> | 407 | SurfaceParams::MaxPixelFormat> |
| 408 | gl_to_morton_fns = { | 408 | gl_to_morton_fns = { |
| 409 | // clang-format off | 409 | // clang-format off |
| @@ -827,25 +827,27 @@ void CachedSurface::LoadGLBuffer() { | |||
| 827 | 827 | ||
| 828 | if (params.is_tiled) { | 828 | if (params.is_tiled) { |
| 829 | gl_buffer.resize(total_size); | 829 | gl_buffer.resize(total_size); |
| 830 | u32 depth = params.depth; | ||
| 831 | u32 block_depth = params.block_depth; | ||
| 830 | 832 | ||
| 831 | ASSERT_MSG(params.block_width == 1, "Block width is defined as {} on texture type {}", | 833 | ASSERT_MSG(params.block_width == 1, "Block width is defined as {} on texture type {}", |
| 832 | params.block_width, static_cast<u32>(params.target)); | 834 | params.block_width, static_cast<u32>(params.target)); |
| 833 | ASSERT_MSG(params.block_depth == 1, "Block depth is defined as {} on texture type {}", | ||
| 834 | params.block_depth, static_cast<u32>(params.target)); | ||
| 835 | 835 | ||
| 836 | // TODO(bunnei): This only unswizzles and copies a 2D texture - we do not yet know how to do | ||
| 837 | // this for 3D textures, etc. | ||
| 838 | switch (params.target) { | 836 | switch (params.target) { |
| 839 | case SurfaceParams::SurfaceTarget::Texture2D: | 837 | case SurfaceParams::SurfaceTarget::Texture2D: |
| 840 | // Pass impl. to the fallback code below | 838 | // TODO(Blinkhawk): Eliminate this condition once all texture types are implemented. |
| 839 | depth = 1U; | ||
| 840 | block_depth = 1U; | ||
| 841 | break; | 841 | break; |
| 842 | case SurfaceParams::SurfaceTarget::Texture2DArray: | 842 | case SurfaceParams::SurfaceTarget::Texture2DArray: |
| 843 | case SurfaceParams::SurfaceTarget::TextureCubemap: | 843 | case SurfaceParams::SurfaceTarget::TextureCubemap: |
| 844 | depth = 1U; | ||
| 845 | block_depth = 1U; | ||
| 844 | for (std::size_t index = 0; index < params.depth; ++index) { | 846 | for (std::size_t index = 0; index < params.depth; ++index) { |
| 845 | const std::size_t offset{index * copy_size}; | 847 | const std::size_t offset{index * copy_size}; |
| 846 | morton_to_gl_fns[static_cast<std::size_t>(params.pixel_format)]( | 848 | morton_to_gl_fns[static_cast<std::size_t>(params.pixel_format)]( |
| 847 | params.width, params.block_height, params.height, gl_buffer.data() + offset, | 849 | params.width, params.block_height, params.height, 1U, 1U, |
| 848 | copy_size, params.addr + offset); | 850 | gl_buffer.data() + offset, copy_size, params.addr + offset); |
| 849 | } | 851 | } |
| 850 | break; | 852 | break; |
| 851 | default: | 853 | default: |
| @@ -854,9 +856,11 @@ void CachedSurface::LoadGLBuffer() { | |||
| 854 | UNREACHABLE(); | 856 | UNREACHABLE(); |
| 855 | } | 857 | } |
| 856 | 858 | ||
| 859 | const std::size_t size = copy_size * depth; | ||
| 860 | |||
| 857 | morton_to_gl_fns[static_cast<std::size_t>(params.pixel_format)]( | 861 | morton_to_gl_fns[static_cast<std::size_t>(params.pixel_format)]( |
| 858 | params.width, params.block_height, params.height, gl_buffer.data(), copy_size, | 862 | params.width, params.block_height, params.height, block_depth, depth, gl_buffer.data(), |
| 859 | params.addr); | 863 | size, params.addr); |
| 860 | } else { | 864 | } else { |
| 861 | const u8* const texture_src_data_end{texture_src_data + total_size}; | 865 | const u8* const texture_src_data_end{texture_src_data + total_size}; |
| 862 | gl_buffer.assign(texture_src_data, texture_src_data_end); | 866 | gl_buffer.assign(texture_src_data, texture_src_data_end); |
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp index 5e2d3ac32..6693067f8 100644 --- a/src/video_core/textures/decoders.cpp +++ b/src/video_core/textures/decoders.cpp | |||
| @@ -51,18 +51,18 @@ void Precise3DProcessBlock(u8* swizzled_data, u8* unswizzled_data, const bool un | |||
| 51 | const u32 xy_block_size, const u32 layer_z, const u32 stride_x, | 51 | const u32 xy_block_size, const u32 layer_z, const u32 stride_x, |
| 52 | const u32 bytes_per_pixel, const u32 out_bytes_per_pixel) { | 52 | const u32 bytes_per_pixel, const u32 out_bytes_per_pixel) { |
| 53 | std::array<u8*, 2> data_ptrs; | 53 | std::array<u8*, 2> data_ptrs; |
| 54 | u32 z_adress = tile_offset; | 54 | u32 z_address = tile_offset; |
| 55 | const u32 gob_size_x = 64; | 55 | const u32 gob_size_x = 64; |
| 56 | const u32 gob_size_y = 8; | 56 | const u32 gob_size_y = 8; |
| 57 | const u32 gob_size_z = 1; | 57 | const u32 gob_size_z = 1; |
| 58 | const u32 gob_size = gob_size_x * gob_size_y * gob_size_z; | 58 | const u32 gob_size = gob_size_x * gob_size_y * gob_size_z; |
| 59 | for (u32 z = z_start; z < z_end; z++) { | 59 | for (u32 z = z_start; z < z_end; z++) { |
| 60 | u32 y_adress = z_adress; | 60 | u32 y_address = z_address; |
| 61 | u32 pixel_base = layer_z * z + y_start * stride_x; | 61 | u32 pixel_base = layer_z * z + y_start * stride_x; |
| 62 | for (u32 y = y_start; y < y_end; y++) { | 62 | for (u32 y = y_start; y < y_end; y++) { |
| 63 | const auto& table = legacy_swizzle_table[y % gob_size_y]; | 63 | const auto& table = legacy_swizzle_table[y % gob_size_y]; |
| 64 | for (u32 x = x_start; x < x_end; x++) { | 64 | for (u32 x = x_start; x < x_end; x++) { |
| 65 | const u32 swizzle_offset{y_adress + table[x * bytes_per_pixel % gob_size_x]}; | 65 | const u32 swizzle_offset{y_address + table[x * bytes_per_pixel % gob_size_x]}; |
| 66 | const u32 pixel_index{x * out_bytes_per_pixel + pixel_base}; | 66 | const u32 pixel_index{x * out_bytes_per_pixel + pixel_base}; |
| 67 | data_ptrs[unswizzle] = swizzled_data + swizzle_offset; | 67 | data_ptrs[unswizzle] = swizzled_data + swizzle_offset; |
| 68 | data_ptrs[!unswizzle] = unswizzled_data + pixel_index; | 68 | data_ptrs[!unswizzle] = unswizzled_data + pixel_index; |
| @@ -70,9 +70,9 @@ void Precise3DProcessBlock(u8* swizzled_data, u8* unswizzled_data, const bool un | |||
| 70 | } | 70 | } |
| 71 | pixel_base += stride_x; | 71 | pixel_base += stride_x; |
| 72 | if ((y + 1) % gob_size_y == 0) | 72 | if ((y + 1) % gob_size_y == 0) |
| 73 | y_adress += gob_size; | 73 | y_address += gob_size; |
| 74 | } | 74 | } |
| 75 | z_adress += xy_block_size; | 75 | z_address += xy_block_size; |
| 76 | } | 76 | } |
| 77 | } | 77 | } |
| 78 | 78 | ||
| @@ -136,7 +136,7 @@ void Fast3DProcessBlock(u8* swizzled_data, u8* unswizzled_data, const bool unswi | |||
| 136 | const u32 xy_block_size, const u32 layer_z, const u32 stride_x, | 136 | const u32 xy_block_size, const u32 layer_z, const u32 stride_x, |
| 137 | const u32 bytes_per_pixel, const u32 out_bytes_per_pixel) { | 137 | const u32 bytes_per_pixel, const u32 out_bytes_per_pixel) { |
| 138 | std::array<u8*, 2> data_ptrs; | 138 | std::array<u8*, 2> data_ptrs; |
| 139 | u32 z_adress = tile_offset; | 139 | u32 z_address = tile_offset; |
| 140 | const u32 x_startb = x_start * bytes_per_pixel; | 140 | const u32 x_startb = x_start * bytes_per_pixel; |
| 141 | const u32 x_endb = x_end * bytes_per_pixel; | 141 | const u32 x_endb = x_end * bytes_per_pixel; |
| 142 | const u32 copy_size = 16; | 142 | const u32 copy_size = 16; |
| @@ -145,12 +145,12 @@ void Fast3DProcessBlock(u8* swizzled_data, u8* unswizzled_data, const bool unswi | |||
| 145 | const u32 gob_size_z = 1; | 145 | const u32 gob_size_z = 1; |
| 146 | const u32 gob_size = gob_size_x * gob_size_y * gob_size_z; | 146 | const u32 gob_size = gob_size_x * gob_size_y * gob_size_z; |
| 147 | for (u32 z = z_start; z < z_end; z++) { | 147 | for (u32 z = z_start; z < z_end; z++) { |
| 148 | u32 y_adress = z_adress; | 148 | u32 y_address = z_address; |
| 149 | u32 pixel_base = layer_z * z + y_start * stride_x; | 149 | u32 pixel_base = layer_z * z + y_start * stride_x; |
| 150 | for (u32 y = y_start; y < y_end; y++) { | 150 | for (u32 y = y_start; y < y_end; y++) { |
| 151 | const auto& table = fast_swizzle_table[y % gob_size_y]; | 151 | const auto& table = fast_swizzle_table[y % gob_size_y]; |
| 152 | for (u32 xb = x_startb; xb < x_endb; xb += copy_size) { | 152 | for (u32 xb = x_startb; xb < x_endb; xb += copy_size) { |
| 153 | const u32 swizzle_offset{y_adress + table[(xb / copy_size) % 4]}; | 153 | const u32 swizzle_offset{y_address + table[(xb / copy_size) % 4]}; |
| 154 | const u32 out_x = xb * out_bytes_per_pixel / bytes_per_pixel; | 154 | const u32 out_x = xb * out_bytes_per_pixel / bytes_per_pixel; |
| 155 | const u32 pixel_index{out_x + pixel_base}; | 155 | const u32 pixel_index{out_x + pixel_base}; |
| 156 | data_ptrs[unswizzle] = swizzled_data + swizzle_offset; | 156 | data_ptrs[unswizzle] = swizzled_data + swizzle_offset; |
| @@ -159,9 +159,9 @@ void Fast3DProcessBlock(u8* swizzled_data, u8* unswizzled_data, const bool unswi | |||
| 159 | } | 159 | } |
| 160 | pixel_base += stride_x; | 160 | pixel_base += stride_x; |
| 161 | if ((y + 1) % gob_size_y == 0) | 161 | if ((y + 1) % gob_size_y == 0) |
| 162 | y_adress += gob_size; | 162 | y_address += gob_size; |
| 163 | } | 163 | } |
| 164 | z_adress += xy_block_size; | 164 | z_address += xy_block_size; |
| 165 | } | 165 | } |
| 166 | } | 166 | } |
| 167 | 167 | ||
| @@ -214,14 +214,15 @@ void Fast3DSwizzledData(u8* swizzled_data, u8* unswizzled_data, const bool unswi | |||
| 214 | } | 214 | } |
| 215 | } | 215 | } |
| 216 | 216 | ||
| 217 | void CopySwizzledData(u32 width, u32 height, u32 bytes_per_pixel, u32 out_bytes_per_pixel, | 217 | void CopySwizzledData(u32 width, u32 height, u32 depth, u32 bytes_per_pixel, |
| 218 | u8* swizzled_data, u8* unswizzled_data, bool unswizzle, u32 block_height) { | 218 | u32 out_bytes_per_pixel, u8* swizzled_data, u8* unswizzled_data, |
| 219 | bool unswizzle, u32 block_height, u32 block_depth) { | ||
| 219 | if (bytes_per_pixel % 3 != 0 && (width * bytes_per_pixel) % 16 == 0) { | 220 | if (bytes_per_pixel % 3 != 0 && (width * bytes_per_pixel) % 16 == 0) { |
| 220 | Fast3DSwizzledData(swizzled_data, unswizzled_data, unswizzle, width, height, 1U, | 221 | Fast3DSwizzledData(swizzled_data, unswizzled_data, unswizzle, width, height, depth, |
| 221 | bytes_per_pixel, out_bytes_per_pixel, block_height, 1U); | 222 | bytes_per_pixel, out_bytes_per_pixel, block_height, block_depth); |
| 222 | } else { | 223 | } else { |
| 223 | Precise3DSwizzledData(swizzled_data, unswizzled_data, unswizzle, width, height, 1U, | 224 | Precise3DSwizzledData(swizzled_data, unswizzled_data, unswizzle, width, height, depth, |
| 224 | bytes_per_pixel, out_bytes_per_pixel, block_height, 1U); | 225 | bytes_per_pixel, out_bytes_per_pixel, block_height, block_depth); |
| 225 | } | 226 | } |
| 226 | } | 227 | } |
| 227 | 228 | ||
| @@ -269,10 +270,11 @@ u32 BytesPerPixel(TextureFormat format) { | |||
| 269 | } | 270 | } |
| 270 | 271 | ||
| 271 | std::vector<u8> UnswizzleTexture(VAddr address, u32 tile_size, u32 bytes_per_pixel, u32 width, | 272 | std::vector<u8> UnswizzleTexture(VAddr address, u32 tile_size, u32 bytes_per_pixel, u32 width, |
| 272 | u32 height, u32 block_height) { | 273 | u32 height, u32 depth, u32 block_height, u32 block_depth) { |
| 273 | std::vector<u8> unswizzled_data(width * height * bytes_per_pixel); | 274 | std::vector<u8> unswizzled_data(width * height * bytes_per_pixel); |
| 274 | CopySwizzledData(width / tile_size, height / tile_size, bytes_per_pixel, bytes_per_pixel, | 275 | CopySwizzledData(width / tile_size, height / tile_size, depth, bytes_per_pixel, bytes_per_pixel, |
| 275 | Memory::GetPointer(address), unswizzled_data.data(), true, block_height); | 276 | Memory::GetPointer(address), unswizzled_data.data(), true, block_height, |
| 277 | block_depth); | ||
| 276 | return unswizzled_data; | 278 | return unswizzled_data; |
| 277 | } | 279 | } |
| 278 | 280 | ||
diff --git a/src/video_core/textures/decoders.h b/src/video_core/textures/decoders.h index 234d250af..aaf316947 100644 --- a/src/video_core/textures/decoders.h +++ b/src/video_core/textures/decoders.h | |||
| @@ -14,17 +14,14 @@ namespace Tegra::Texture { | |||
| 14 | * Unswizzles a swizzled texture without changing its format. | 14 | * Unswizzles a swizzled texture without changing its format. |
| 15 | */ | 15 | */ |
| 16 | std::vector<u8> UnswizzleTexture(VAddr address, u32 tile_size, u32 bytes_per_pixel, u32 width, | 16 | std::vector<u8> UnswizzleTexture(VAddr address, u32 tile_size, u32 bytes_per_pixel, u32 width, |
| 17 | u32 height, u32 block_height = TICEntry::DefaultBlockHeight); | 17 | u32 height, u32 depth, |
| 18 | 18 | u32 block_height = TICEntry::DefaultBlockHeight, | |
| 19 | /** | 19 | u32 block_depth = TICEntry::DefaultBlockHeight); |
| 20 | * Unswizzles a swizzled depth texture without changing its format. | ||
| 21 | */ | ||
| 22 | std::vector<u8> UnswizzleDepthTexture(VAddr address, DepthFormat format, u32 width, u32 height, | ||
| 23 | u32 block_height = TICEntry::DefaultBlockHeight); | ||
| 24 | 20 | ||
| 25 | /// Copies texture data from a buffer and performs swizzling/unswizzling as necessary. | 21 | /// Copies texture data from a buffer and performs swizzling/unswizzling as necessary. |
| 26 | void CopySwizzledData(u32 width, u32 height, u32 bytes_per_pixel, u32 out_bytes_per_pixel, | 22 | void CopySwizzledData(u32 width, u32 height, u32 depth, u32 bytes_per_pixel, |
| 27 | u8* swizzled_data, u8* unswizzled_data, bool unswizzle, u32 block_height); | 23 | u32 out_bytes_per_pixel, u8* swizzled_data, u8* unswizzled_data, |
| 24 | bool unswizzle, u32 block_height, u32 block_depth); | ||
| 28 | 25 | ||
| 29 | /** | 26 | /** |
| 30 | * Decodes an unswizzled texture into a A8R8G8B8 texture. | 27 | * Decodes an unswizzled texture into a A8R8G8B8 texture. |
diff --git a/src/video_core/textures/texture.h b/src/video_core/textures/texture.h index 58d17abcb..5947bd2b9 100644 --- a/src/video_core/textures/texture.h +++ b/src/video_core/textures/texture.h | |||
| @@ -141,6 +141,7 @@ static_assert(sizeof(TextureHandle) == 4, "TextureHandle has wrong size"); | |||
| 141 | 141 | ||
| 142 | struct TICEntry { | 142 | struct TICEntry { |
| 143 | static constexpr u32 DefaultBlockHeight = 16; | 143 | static constexpr u32 DefaultBlockHeight = 16; |
| 144 | static constexpr u32 DefaultBlockDepth = 1; | ||
| 144 | 145 | ||
| 145 | union { | 146 | union { |
| 146 | u32 raw; | 147 | u32 raw; |
diff --git a/src/yuzu/debugger/graphics/graphics_surface.cpp b/src/yuzu/debugger/graphics/graphics_surface.cpp index cbcd5dd5f..44d423da2 100644 --- a/src/yuzu/debugger/graphics/graphics_surface.cpp +++ b/src/yuzu/debugger/graphics/graphics_surface.cpp | |||
| @@ -386,8 +386,9 @@ void GraphicsSurfaceWidget::OnUpdate() { | |||
| 386 | 386 | ||
| 387 | // TODO(bunnei): Will not work with BCn formats that swizzle 4x4 tiles. | 387 | // TODO(bunnei): Will not work with BCn formats that swizzle 4x4 tiles. |
| 388 | // Needs to be fixed if we plan to use this feature more, otherwise we may remove it. | 388 | // Needs to be fixed if we plan to use this feature more, otherwise we may remove it. |
| 389 | auto unswizzled_data = Tegra::Texture::UnswizzleTexture( | 389 | auto unswizzled_data = |
| 390 | *address, 1, Tegra::Texture::BytesPerPixel(surface_format), surface_width, surface_height); | 390 | Tegra::Texture::UnswizzleTexture(*address, 1, Tegra::Texture::BytesPerPixel(surface_format), |
| 391 | surface_width, surface_height, 1U); | ||
| 391 | 392 | ||
| 392 | auto texture_data = Tegra::Texture::DecodeTexture(unswizzled_data, surface_format, | 393 | auto texture_data = Tegra::Texture::DecodeTexture(unswizzled_data, surface_format, |
| 393 | surface_width, surface_height); | 394 | surface_width, surface_height); |