[Bf-blender-cvs] [72f63ba7e9b] master: GPUState: Fix Point Size issues
Clément Foucault
noreply at git.blender.org
Thu Sep 10 15:55:22 CEST 2020
Commit: 72f63ba7e9be0c41dff4c3ed3c4fb527b607dbc3
Author: Clément Foucault
Date: Thu Sep 10 15:51:20 2020 +0200
Branches: master
https://developer.blender.org/rB72f63ba7e9be0c41dff4c3ed3c4fb527b607dbc3
GPUState: Fix Point Size issues
The point size was not updated in the right branch and setting the point
size via GPU_point_size was effectively disabling its use.
===================================================================
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 529c8795327..07eacc06bcf 100644
--- a/source/blender/gpu/intern/gpu_state.cc
+++ b/source/blender/gpu/intern/gpu_state.cc
@@ -173,12 +173,15 @@ void GPU_line_width(float width)
void GPU_point_size(float size)
{
- SET_MUTABLE_STATE(point_size, size * PIXELSIZE);
+ 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);
}
/* Programmable point size
* - shaders set their own point size when enabled
- * - use glPointSize when disabled */
+ * - use GPU_point_size when disabled */
/* TODO remove and use program point size everywhere */
void GPU_program_point_size(bool enable)
{
diff --git a/source/blender/gpu/opengl/gl_state.cc b/source/blender/gpu/opengl/gl_state.cc
index 03762edac93..487cd4369cc 100644
--- a/source/blender/gpu/opengl/gl_state.cc
+++ b/source/blender/gpu/opengl/gl_state.cc
@@ -141,13 +141,13 @@ void GLStateManager::set_mutable_state(const GPUStateMutable &state)
GPUStateMutable changed = state ^ current_mutable_;
/* TODO remove, should be uniform. */
- if (changed.point_size != 0) {
+ if (changed.point_size != 0.0f) {
if (state.point_size > 0.0f) {
glEnable(GL_PROGRAM_POINT_SIZE);
- glPointSize(state.point_size);
}
else {
glDisable(GL_PROGRAM_POINT_SIZE);
+ glPointSize(fabsf(state.point_size));
}
}
More information about the Bf-blender-cvs
mailing list