diff options
author | FernandoS27 <fsahmkow27@gmail.com> | 2018-10-25 01:25:28 +0200 |
---|---|---|
committer | FernandoS27 <fsahmkow27@gmail.com> | 2018-10-29 00:00:01 +0100 |
commit | 258f0f5c31decbb25eddde798b3a4bcc6a7cc6dd (patch) | |
tree | 8c805cb136b2d938f24e5aaaa2e7a3f723f4ccb1 | |
parent | Zero out memory region of recreated surface before flushing (diff) | |
download | yuzu-258f0f5c31decbb25eddde798b3a4bcc6a7cc6dd.tar yuzu-258f0f5c31decbb25eddde798b3a4bcc6a7cc6dd.tar.gz yuzu-258f0f5c31decbb25eddde798b3a4bcc6a7cc6dd.tar.bz2 yuzu-258f0f5c31decbb25eddde798b3a4bcc6a7cc6dd.tar.lz yuzu-258f0f5c31decbb25eddde798b3a4bcc6a7cc6dd.tar.xz yuzu-258f0f5c31decbb25eddde798b3a4bcc6a7cc6dd.tar.zst yuzu-258f0f5c31decbb25eddde798b3a4bcc6a7cc6dd.zip |
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 10 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.h | 1 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.h | 4 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/maxwell_to_gl.h | 28 |
4 files changed, 33 insertions, 10 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index cb180b93c..7bb5544fc 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -731,11 +731,15 @@ void RasterizerOpenGL::SamplerInfo::SyncWithConfig(const Tegra::Texture::TSCEntr if (mag_filter != config.mag_filter) { mag_filter = config.mag_filter; - glSamplerParameteri(s, GL_TEXTURE_MAG_FILTER, MaxwellToGL::TextureFilterMode(mag_filter)); + glSamplerParameteri( + s, GL_TEXTURE_MAG_FILTER, + MaxwellToGL::TextureFilterMode(mag_filter, Tegra::Texture::TextureMipmapFilter::None)); } - if (min_filter != config.min_filter) { + if (min_filter != config.min_filter || mip_filter != config.mip_filter) { min_filter = config.min_filter; - glSamplerParameteri(s, GL_TEXTURE_MIN_FILTER, MaxwellToGL::TextureFilterMode(min_filter)); + mip_filter = config.mip_filter; + glSamplerParameteri(s, GL_TEXTURE_MIN_FILTER, + MaxwellToGL::TextureFilterMode(min_filter, mip_filter)); } if (wrap_u != config.wrap_u) { diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index 5020a5392..7b0615125 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h @@ -93,6 +93,7 @@ private: private: Tegra::Texture::TextureFilter mag_filter; Tegra::Texture::TextureFilter min_filter; + Tegra::Texture::TextureMipmapFilter mip_filter; Tegra::Texture::WrapMode wrap_u; Tegra::Texture::WrapMode wrap_v; Tegra::Texture::WrapMode wrap_p; diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 5bcd33156..68479d55a 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h @@ -919,7 +919,7 @@ struct SurfaceParams { u32 height = MipHeight(mip_level); u32 bh = block_height; // Magical block resizing algorithm, needs more testing. - while (bh != 1 && height / bh <= 16) { + while (bh > 1 && (height + bh - 1) / bh <= 16) { bh = bh >> 1; } return bh; @@ -929,7 +929,7 @@ struct SurfaceParams { u32 depth = MipDepth(mip_level); u32 bd = block_depth; // Magical block resizing algorithm, needs more testing. - while (bd != 1 && depth / bd <= 16) { + while (bd > 1 && depth / bd <= 16) { 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 0f6dcab2b..76c3b65bd 100644 --- a/src/video_core/renderer_opengl/maxwell_to_gl.h +++ b/src/video_core/renderer_opengl/maxwell_to_gl.h @@ -135,12 +135,29 @@ inline GLenum PrimitiveTopology(Maxwell::PrimitiveTopology topology) { return {}; } -inline GLenum TextureFilterMode(Tegra::Texture::TextureFilter filter_mode) { +inline GLenum TextureFilterMode(Tegra::Texture::TextureFilter filter_mode, + Tegra::Texture::TextureMipmapFilter mip_filter_mode) { switch (filter_mode) { - case Tegra::Texture::TextureFilter::Linear: - return GL_LINEAR; - case Tegra::Texture::TextureFilter::Nearest: - return GL_NEAREST; + case Tegra::Texture::TextureFilter::Linear: { + switch (mip_filter_mode) { + case Tegra::Texture::TextureMipmapFilter::None: + return GL_LINEAR; + case Tegra::Texture::TextureMipmapFilter::Nearest: + return GL_NEAREST_MIPMAP_LINEAR; + case Tegra::Texture::TextureMipmapFilter::Linear: + return GL_LINEAR_MIPMAP_LINEAR; + } + } + case Tegra::Texture::TextureFilter::Nearest: { + switch (mip_filter_mode) { + case Tegra::Texture::TextureMipmapFilter::None: + return GL_NEAREST; + case Tegra::Texture::TextureMipmapFilter::Nearest: + return GL_NEAREST_MIPMAP_NEAREST; + case Tegra::Texture::TextureMipmapFilter::Linear: + return GL_LINEAR_MIPMAP_NEAREST; + } + } } LOG_CRITICAL(Render_OpenGL, "Unimplemented texture filter mode={}", static_cast<u32>(filter_mode)); @@ -148,6 +165,7 @@ 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: |