From 7fc516cc1ad81b02308b5b23fd18562e651c770e Mon Sep 17 00:00:00 2001 From: Subv Date: Tue, 17 Apr 2018 10:08:10 -0500 Subject: MaxwellToGL: Added a TODO and partial implementation of maxwell wrap mode 4 (Clamp, GL_CLAMP). This clamp mode was removed from OpenGL as of 3.1, we can emulate it by using GL_CLAMP_TO_BORDER to get the border color of the texture, and then manually sampling the edge to mix them in the fragment shader. --- src/video_core/renderer_opengl/maxwell_to_gl.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.h index 7909dcfc3..9d04a4d65 100644 --- a/src/video_core/renderer_opengl/maxwell_to_gl.h +++ b/src/video_core/renderer_opengl/maxwell_to_gl.h @@ -74,6 +74,11 @@ inline GLenum WrapMode(Tegra::Texture::WrapMode wrap_mode) { switch (wrap_mode) { case Tegra::Texture::WrapMode::ClampToEdge: return GL_CLAMP_TO_EDGE; + case Tegra::Texture::WrapMode::ClampOGL: + // TODO(Subv): GL_CLAMP was removed as of OpenGL 3.1, to implement GL_CLAMP, we can use + // GL_CLAMP_TO_BORDER to get the border color of the texture, and then sample the edge to + // manually mix them. However the shader part of this is not yet implemented. + return GL_CLAMP_TO_BORDER; } LOG_CRITICAL(Render_OpenGL, "Unimplemented texture wrap mode=%u", static_cast(wrap_mode)); UNREACHABLE(); -- cgit v1.2.3 From 636ad347071b387bd8ff3c45190115fa5b6caf65 Mon Sep 17 00:00:00 2001 From: Subv Date: Tue, 17 Apr 2018 10:17:18 -0500 Subject: MaxwellToGL: Implemented tex wrap mode 1 (Wrap, GL_REPEAT). --- src/video_core/renderer_opengl/maxwell_to_gl.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.h index 9d04a4d65..8600ea91a 100644 --- a/src/video_core/renderer_opengl/maxwell_to_gl.h +++ b/src/video_core/renderer_opengl/maxwell_to_gl.h @@ -72,6 +72,8 @@ inline GLenum TextureFilterMode(Tegra::Texture::TextureFilter filter_mode) { inline GLenum WrapMode(Tegra::Texture::WrapMode wrap_mode) { switch (wrap_mode) { + case Tegra::Texture::WrapMode::Wrap: + return GL_REPEAT; case Tegra::Texture::WrapMode::ClampToEdge: return GL_CLAMP_TO_EDGE; case Tegra::Texture::WrapMode::ClampOGL: -- cgit v1.2.3