diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-09-11 00:55:22 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-09-11 00:55:22 +0300 |
commit | 66078594d130f640f479949856630aa23083c9fa (patch) | |
tree | ea4ad4a6b2d26bea1e051e5605a6d3f41e9764c9 | |
parent | 8ff397b3b1a95a8fa69752d4c0cdc95f2b3daadd (diff) |
GPUState: Fix missing changed program point size state
Also avoid a case where size is zero and making it impossible to change it
back.
This fix T80664 Tiny node sockets
-rw-r--r-- | source/blender/gpu/intern/gpu_state.cc | 4 | ||||
-rw-r--r-- | source/blender/gpu/opengl/gl_state.cc | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/gpu/intern/gpu_state.cc b/source/blender/gpu/intern/gpu_state.cc index 07eacc06bcf..be523020e8a 100644 --- a/source/blender/gpu/intern/gpu_state.cc +++ b/source/blender/gpu/intern/gpu_state.cc @@ -175,8 +175,8 @@ void GPU_point_size(float size) { GPUStateManager *stack = Context::get()->state_manager; auto &state = stack->mutable_state; - /* Set point size sign negative to disable. */ - state.point_size = size * signf(state.point_size); + /* Keep the sign of point_size since it represents the enable state. */ + state.point_size = size * ((state.point_size > 0.0) ? 1.0f : -1.0f); } /* Programmable point size diff --git a/source/blender/gpu/opengl/gl_state.cc b/source/blender/gpu/opengl/gl_state.cc index 487cd4369cc..1678760e9cd 100644 --- a/source/blender/gpu/opengl/gl_state.cc +++ b/source/blender/gpu/opengl/gl_state.cc @@ -141,7 +141,7 @@ void GLStateManager::set_mutable_state(const GPUStateMutable &state) GPUStateMutable changed = state ^ current_mutable_; /* TODO remove, should be uniform. */ - if (changed.point_size != 0.0f) { + if (float_as_uint(changed.point_size) != 0) { if (state.point_size > 0.0f) { glEnable(GL_PROGRAM_POINT_SIZE); } |