[Bf-blender-cvs] [66078594d13] master: GPUState: Fix missing changed program point size state

Clément Foucault noreply at git.blender.org
Thu Sep 10 23:55:32 CEST 2020


Commit: 66078594d130f640f479949856630aa23083c9fa
Author: Clément Foucault
Date:   Thu Sep 10 23:55:22 2020 +0200
Branches: master
https://developer.blender.org/rB66078594d130f640f479949856630aa23083c9fa

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

===================================================================

M	source/blender/gpu/intern/gpu_state.cc
M	source/blender/gpu/opengl/gl_state.cc

===================================================================

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);
     }



More information about the Bf-blender-cvs mailing list