summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl
diff options
context:
space:
mode:
authorFernandoS27 <fsahmkow27@gmail.com>2018-10-30 03:46:09 +0100
committerFernandoS27 <fsahmkow27@gmail.com>2018-11-02 00:22:12 +0100
commit60a184455c5aef7cce7e6232cab738f66cb0aac0 (patch)
tree7421f8289ad911124dd68ad5c8059ebc8ba3a017 /src/video_core/renderer_opengl
parentFix ASTC formats (diff)
downloadyuzu-60a184455c5aef7cce7e6232cab738f66cb0aac0.tar
yuzu-60a184455c5aef7cce7e6232cab738f66cb0aac0.tar.gz
yuzu-60a184455c5aef7cce7e6232cab738f66cb0aac0.tar.bz2
yuzu-60a184455c5aef7cce7e6232cab738f66cb0aac0.tar.lz
yuzu-60a184455c5aef7cce7e6232cab738f66cb0aac0.tar.xz
yuzu-60a184455c5aef7cce7e6232cab738f66cb0aac0.tar.zst
yuzu-60a184455c5aef7cce7e6232cab738f66cb0aac0.zip
Diffstat (limited to 'src/video_core/renderer_opengl')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp21
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h2
2 files changed, 11 insertions, 12 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 19b1d04b9..0e11557c4 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -58,16 +58,14 @@ void SurfaceParams::InitCacheParameters(Tegra::GPUVAddr gpu_addr_) {
std::size_t SurfaceParams::InnerMipmapMemorySize(u32 mip_level, bool force_gl, bool layer_only,
bool uncompressed) const {
- const u32 compression_factor{GetCompressionFactor(pixel_format)};
+ const u32 tile_x{GetDefaultBlockWidth(pixel_format)};
+ const u32 tile_y{GetDefaultBlockHeight(pixel_format)};
const u32 bytes_per_pixel{GetBytesPerPixel(pixel_format)};
u32 m_depth = (layer_only ? 1U : depth);
u32 m_width = MipWidth(mip_level);
u32 m_height = MipHeight(mip_level);
- m_width = uncompressed ? m_width
- : std::max(1U, (m_width + compression_factor - 1) / compression_factor);
- m_height = uncompressed
- ? m_height
- : std::max(1U, (m_height + compression_factor - 1) / compression_factor);
+ m_width = uncompressed ? m_width : std::max(1U, (m_width + tile_x - 1) / tile_x);
+ m_height = uncompressed ? m_height : std::max(1U, (m_height + tile_y - 1) / tile_y);
m_depth = std::max(1U, m_depth >> mip_level);
u32 m_block_height = MipBlockHeight(mip_level);
u32 m_block_depth = MipBlockDepth(mip_level);
@@ -366,8 +364,8 @@ void MortonCopy(u32 stride, u32 block_height, u32 height, u32 block_depth, u32 d
// With the BCn formats (DXT and DXN), each 4x4 tile is swizzled instead of just individual
// pixel values.
- const u32 tile_size_x{SurfaceParams::GetDefaultBlockWidth(format)};
- const u32 tile_size_y{SurfaceParams::GetDefaultBlockHeight(format)};
+ const u32 tile_size_x{GetDefaultBlockWidth(format)};
+ const u32 tile_size_y{GetDefaultBlockHeight(format)};
if (morton_to_gl) {
const std::vector<u8> data =
@@ -906,7 +904,7 @@ static void ConvertG8R8ToR8G8(std::vector<u8>& data, u32 width, u32 height) {
* typical desktop GPUs.
*/
static void ConvertFormatAsNeeded_LoadGLBuffer(std::vector<u8>& data, PixelFormat pixel_format,
- u32 width, u32 height) {
+ u32 width, u32 height, u32 depth) {
switch (pixel_format) {
case PixelFormat::ASTC_2D_4X4:
case PixelFormat::ASTC_2D_8X8:
@@ -922,7 +920,8 @@ static void ConvertFormatAsNeeded_LoadGLBuffer(std::vector<u8>& data, PixelForma
u32 block_width{};
u32 block_height{};
std::tie(block_width, block_height) = GetASTCBlockSize(pixel_format);
- data = Tegra::Texture::ASTC::Decompress(data, width, height, block_width, block_height);
+ data =
+ Tegra::Texture::ASTC::Decompress(data, width, height, depth, block_width, block_height);
break;
}
case PixelFormat::S8Z24:
@@ -982,7 +981,7 @@ void CachedSurface::LoadGLBuffer() {
}
for (u32 i = 0; i < params.max_mip_level; i++)
ConvertFormatAsNeeded_LoadGLBuffer(gl_buffer[i], params.pixel_format, params.MipWidth(i),
- params.MipHeight(i));
+ params.MipHeight(i), params.MipDepth(i));
}
MICROPROFILE_DEFINE(OpenGL_SurfaceFlush, "OpenGL", "Surface Flush", MP_RGB(128, 192, 64));
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
index f255f4419..46ad37897 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -139,7 +139,7 @@ struct SurfaceParams {
}
u32 MipDepth(u32 mip_level) const {
- return std::max(1U, depth >> mip_level);
+ return is_layered ? depth : std::max(1U, depth >> mip_level);
}
// Auto block resizing algorithm from: