summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl/gl_rasterizer.cpp
diff options
context:
space:
mode:
authorRodolfo Bogado <rodolfoosvaldobogado@gmail.com>2018-11-07 04:25:16 +0100
committerRodolfo Bogado <rodolfoosvaldobogado@gmail.com>2018-11-11 20:31:00 +0100
commite9610ec0dd3d47ae7dc2b14932faef0318d36125 (patch)
treede37e454dba87fd1e1e20c260a0f6876910ed881 /src/video_core/renderer_opengl/gl_rasterizer.cpp
parentMerge pull request #1669 from ReinUsesLisp/fixup-gs (diff)
downloadyuzu-e9610ec0dd3d47ae7dc2b14932faef0318d36125.tar
yuzu-e9610ec0dd3d47ae7dc2b14932faef0318d36125.tar.gz
yuzu-e9610ec0dd3d47ae7dc2b14932faef0318d36125.tar.bz2
yuzu-e9610ec0dd3d47ae7dc2b14932faef0318d36125.tar.lz
yuzu-e9610ec0dd3d47ae7dc2b14932faef0318d36125.tar.xz
yuzu-e9610ec0dd3d47ae7dc2b14932faef0318d36125.tar.zst
yuzu-e9610ec0dd3d47ae7dc2b14932faef0318d36125.zip
Diffstat (limited to 'src/video_core/renderer_opengl/gl_rasterizer.cpp')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp31
1 files changed, 21 insertions, 10 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index a404764f5..40f474e07 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -740,9 +740,9 @@ void RasterizerOpenGL::SamplerInfo::Create() {
glSamplerParameteri(sampler.handle, GL_TEXTURE_COMPARE_FUNC, GL_NEVER);
}
-void RasterizerOpenGL::SamplerInfo::SyncWithConfig(const Tegra::Texture::TSCEntry& config) {
+void RasterizerOpenGL::SamplerInfo::SyncWithConfig(const Tegra::Texture::FullTextureInfo& info) {
const GLuint s = sampler.handle;
-
+ const Tegra::Texture::TSCEntry& config = info.tsc;
if (mag_filter != config.mag_filter) {
mag_filter = config.mag_filter;
glSamplerParameteri(
@@ -793,6 +793,17 @@ void RasterizerOpenGL::SamplerInfo::SyncWithConfig(const Tegra::Texture::TSCEntr
glSamplerParameterfv(s, GL_TEXTURE_BORDER_COLOR, border_color.data());
}
}
+ if (info.tic.use_header_opt_control == 0) {
+ glSamplerParameterf(s, GL_TEXTURE_MAX_ANISOTROPY_EXT,
+ static_cast<float>(1 << info.tic.max_anisotropy.Value()));
+ glSamplerParameterf(s, GL_TEXTURE_MIN_LOD,
+ static_cast<float>(info.tic.res_min_mip_level.Value()));
+ glSamplerParameterf(s, GL_TEXTURE_MAX_LOD,
+ static_cast<float>(info.tic.res_max_mip_level.Value() == 0
+ ? 16
+ : info.tic.res_max_mip_level.Value()));
+ glSamplerParameterf(s, GL_TEXTURE_LOD_BIAS, info.tic.mip_lod_bias.Value() / 256.f);
+ }
}
u32 RasterizerOpenGL::SetupConstBuffers(Maxwell::ShaderStage stage, Shader& shader,
@@ -890,7 +901,7 @@ u32 RasterizerOpenGL::SetupTextures(Maxwell::ShaderStage stage, Shader& shader,
continue;
}
- texture_samplers[current_bindpoint].SyncWithConfig(texture.tsc);
+ texture_samplers[current_bindpoint].SyncWithConfig(texture);
Surface surface = res_cache.GetTextureSurface(texture, entry);
if (surface != nullptr) {
state.texture_units[current_bindpoint].texture = surface->Texture().handle;
@@ -996,13 +1007,13 @@ void RasterizerOpenGL::SyncStencilTestState() {
state.stencil.front.action_depth_pass = MaxwellToGL::StencilOp(regs.stencil_front_op_zpass);
state.stencil.front.write_mask = regs.stencil_front_mask;
- state.stencil.back.test_func = MaxwellToGL::ComparisonOp(regs.stencil_back_func_func);
- state.stencil.back.test_ref = regs.stencil_back_func_ref;
- state.stencil.back.test_mask = regs.stencil_back_func_mask;
- state.stencil.back.action_stencil_fail = MaxwellToGL::StencilOp(regs.stencil_back_op_fail);
- state.stencil.back.action_depth_fail = MaxwellToGL::StencilOp(regs.stencil_back_op_zfail);
- state.stencil.back.action_depth_pass = MaxwellToGL::StencilOp(regs.stencil_back_op_zpass);
- state.stencil.back.write_mask = regs.stencil_back_mask;
+ state.stencil.back.test_func = MaxwellToGL::ComparisonOp(regs.stencil_back_func_func);
+ state.stencil.back.test_ref = regs.stencil_back_func_ref;
+ state.stencil.back.test_mask = regs.stencil_back_func_mask;
+ state.stencil.back.action_stencil_fail = MaxwellToGL::StencilOp(regs.stencil_back_op_fail);
+ state.stencil.back.action_depth_fail = MaxwellToGL::StencilOp(regs.stencil_back_op_zfail);
+ state.stencil.back.action_depth_pass = MaxwellToGL::StencilOp(regs.stencil_back_op_zpass);
+ state.stencil.back.write_mask = regs.stencil_back_mask;
}
void RasterizerOpenGL::SyncColorMask() {