diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-08-25 19:18:43 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-08-25 19:18:55 +0300 |
commit | 97f75ca87f72e8cbb744728bfd49b2c3f2f1ebdb (patch) | |
tree | 7f79fd5997112c57a854869eba42bc41ad9efe00 /source/blender/gpu/opengl/gl_state.cc | |
parent | 2c34e09b08fb65dd4c8b587847887564f7ec0bd4 (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/opengl/gl_state.cc')
-rw-r--r-- | source/blender/gpu/opengl/gl_state.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/gpu/opengl/gl_state.cc b/source/blender/gpu/opengl/gl_state.cc index 4e21ab43b45..7dc3e44c516 100644 --- a/source/blender/gpu/opengl/gl_state.cc +++ b/source/blender/gpu/opengl/gl_state.cc @@ -26,6 +26,7 @@ #include "glew-mx.h" +#include "gl_context.hh" #include "gl_state.hh" using namespace blender::gpu; @@ -53,6 +54,9 @@ GLStateManager::GLStateManager(void) : GPUStateManager() glEnable(GL_PRIMITIVE_RESTART_FIXED_INDEX); } + /* Limits. */ + glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, line_width_range_); + /* Force update using default state. */ current_ = ~state; current_mutable_ = ~mutable_state; @@ -150,7 +154,7 @@ void GLStateManager::set_mutable_state(const GPUStateMutable &state) if (changed.line_width != 0) { /* TODO remove, should use wide line shader. */ - glLineWidth(clamp_f(state.line_width, 1.0f, GPU_max_line_width())); + glLineWidth(clamp_f(state.line_width, line_width_range_[0], line_width_range_[1])); } if (changed.depth_range[0] != 0 || changed.depth_range[1] != 0) { |