diff options
Diffstat (limited to 'src/video_core')
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 7 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.h | 23 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/maxwell_to_gl.h | 1 |
3 files changed, 19 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 28f17bc75..cbe5bf664 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp @@ -100,7 +100,7 @@ std::size_t SurfaceParams::InnerMipmapMemorySize(u32 mip_level, bool force_gl, b m_width = std::max(1U, m_width >> mip_level); m_height = std::max(1U, m_height >> mip_level); m_depth = std::max(1U, m_depth >> mip_level); - u32 m_block_height = MipBlockHeight(mip_level); + u32 m_block_height = MipBlockHeight(mip_level, m_height); u32 m_block_depth = MipBlockDepth(mip_level); return Tegra::Texture::CalculateSize(force_gl ? false : is_tiled, bytes_per_pixel, m_width, m_height, m_depth, m_block_height, m_block_depth); @@ -875,6 +875,9 @@ CachedSurface::CachedSurface(const SurfaceParams& params) glTexParameteri(SurfaceTargetToGL(params.target), GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(SurfaceTargetToGL(params.target), GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(SurfaceTargetToGL(params.target), GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + if (params.max_mip_level == 1) { + glTexParameterf(SurfaceTargetToGL(params.target), GL_TEXTURE_LOD_BIAS, 1000.0); + } VideoCore::LabelGLObject(GL_TEXTURE, texture.handle, params.addr, SurfaceParams::SurfaceTargetName(params.target)); @@ -1325,8 +1328,6 @@ void RasterizerCacheOpenGL::AccurateCopySurface(const Surface& src_surface, const Surface& dst_surface) { const auto& src_params{src_surface->GetSurfaceParams()}; const auto& dst_params{dst_surface->GetSurfaceParams()}; - auto* start = Memory::GetPointer(src_params.addr); - std::fill(start, start + dst_params.MemorySize(), 0); FlushRegion(src_params.addr, dst_params.MemorySize()); LoadSurface(dst_surface); } diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 68479d55a..951e03ba6 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h @@ -915,21 +915,28 @@ struct SurfaceParams { return std::max(1U, depth >> mip_level); } - u32 MipBlockHeight(u32 mip_level) const { - u32 height = MipHeight(mip_level); - u32 bh = block_height; - // Magical block resizing algorithm, needs more testing. - while (bh > 1 && (height + bh - 1) / bh <= 16) { - bh = bh >> 1; + // Auto block resizing algorithm from: + // https://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/drivers/nouveau/nv50/nv50_miptree.c + u32 MipBlockHeight(u32 mip_level, u32 alt_height = 0) const { + if (mip_level == 0) + return block_height; + if (alt_height == 0) + alt_height = MipHeight(mip_level); + u32 blocks_in_y = (alt_height + 7) / 8; + u32 bh = 32; + while (bh > 1 && blocks_in_y <= bh * 2) { + bh >>= 1; } return bh; } u32 MipBlockDepth(u32 mip_level) const { + if (mip_level == 0) + return block_depth; u32 depth = MipDepth(mip_level); - u32 bd = block_depth; + u32 bd = 32; // Magical block resizing algorithm, needs more testing. - while (bd > 1 && depth / bd <= 16) { + while (bd > 1 && depth / depth <= bd) { bd = bd >> 1; } return bd; diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.h index 76c3b65bd..87d511c38 100644 --- a/src/video_core/renderer_opengl/maxwell_to_gl.h +++ b/src/video_core/renderer_opengl/maxwell_to_gl.h @@ -165,7 +165,6 @@ inline GLenum TextureFilterMode(Tegra::Texture::TextureFilter filter_mode, return {}; } - inline GLenum WrapMode(Tegra::Texture::WrapMode wrap_mode) { switch (wrap_mode) { case Tegra::Texture::WrapMode::Wrap: |