Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2020-08-25 19:18:43 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-08-25 19:18:55 +0300
commit97f75ca87f72e8cbb744728bfd49b2c3f2f1ebdb (patch)
tree7f79fd5997112c57a854869eba42bc41ad9efe00 /source/blender/gpu/intern/gpu_texture.cc
parent2c34e09b08fb65dd4c8b587847887564f7ec0bd4 (diff)
GPUState: Move state limits getter to the area they belong
This fix a GL_INVALID_VALUE error on startup due to 0.0f max line width. Also moves the max anisotropy filter to the sampler creation. This reduces code fragmentation.
Diffstat (limited to 'source/blender/gpu/intern/gpu_texture.cc')
-rw-r--r--source/blender/gpu/intern/gpu_texture.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/gpu/intern/gpu_texture.cc b/source/blender/gpu/intern/gpu_texture.cc
index 91990dac83f..3d84ca14423 100644
--- a/source/blender/gpu/intern/gpu_texture.cc
+++ b/source/blender/gpu/intern/gpu_texture.cc
@@ -2179,6 +2179,11 @@ void GPU_texture_get_mipmap_size(GPUTexture *tex, int lvl, int *size)
void GPU_samplers_init(void)
{
+ float max_anisotropy = 1.0f;
+ if (GLEW_EXT_texture_filter_anisotropic) {
+ glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &max_anisotropy);
+ }
+
glGenSamplers(GPU_SAMPLER_MAX, GG.samplers);
for (int i = 0; i < GPU_SAMPLER_MAX; i++) {
eGPUSamplerState state = static_cast<eGPUSamplerState>(i);
@@ -2193,7 +2198,7 @@ void GPU_samplers_init(void)
GLenum compare_mode = (state & GPU_SAMPLER_COMPARE) ? GL_COMPARE_REF_TO_TEXTURE : GL_NONE;
/* TODO(fclem) Anisotropic level should be a render engine parameter. */
float aniso_filter = ((state & GPU_SAMPLER_MIPMAP) && (state & GPU_SAMPLER_ANISO)) ?
- U.anisotropic_filter :
+ max_ff(max_anisotropy, U.anisotropic_filter) :
1.0f;
glSamplerParameteri(GG.samplers[i], GL_TEXTURE_WRAP_S, wrap_s);