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
This commit is contained in:
Clément Foucault 2020-09-10 23:55:22 +02:00
parent 8ff397b3b1
commit 66078594d1
Notes: blender-bot 2023-02-13 21:12:23 +01:00
Referenced by issue #80664, Tiny node sockets
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

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