From db9f8cc26935ca2b39347c88f37546aba75c2076 Mon Sep 17 00:00:00 2001 From: Palana Date: Thu, 31 Oct 2013 18:06:01 +0100 Subject: [PATCH] =?UTF-8?q?restrict=20max=5Fanisotropy=20to=201=20?= =?UTF-8?q?=E2=89=A4=20max=5Fanisotropy=20=E2=89=A4=20max=5Fanisotropy=5Fm?= =?UTF-8?q?ax?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libobs-opengl/gl-subsystem.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libobs-opengl/gl-subsystem.c b/libobs-opengl/gl-subsystem.c index 5d85e5564..9663c684c 100644 --- a/libobs-opengl/gl-subsystem.c +++ b/libobs-opengl/gl-subsystem.c @@ -39,6 +39,21 @@ void convert_sampler_info(struct gs_sampler_state *sampler, sampler->address_v = convert_address_mode(info->address_v); sampler->address_w = convert_address_mode(info->address_w); sampler->max_anisotropy = info->max_anisotropy; + + GLint max_anisotropy_max = 1; + glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &max_anisotropy_max); + gl_success("glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX)"); + + if (1 <= sampler->max_anisotropy && sampler->max_anisotropy <= max_anisotropy_max) + return; + + if (sampler->max_anisotropy < 1) sampler->max_anisotropy = 1; + else if (sampler->max_anisotropy > max_anisotropy_max) + sampler->max_anisotropy = max_anisotropy_max; + + blog(LOG_INFO, "convert_sampler_info: 1 <= max_anisotropy <= %d violated, " + "selected: %d, set: %d", max_anisotropy_max, + info->max_anisotropy, sampler->max_anisotropy); } device_t device_create(struct gs_init_data *info)