Fix: Node grid dot sizes on Metal

The changes in #112906 (Vulkan: Use Point Shaders When Drawing Points)
broke point sizes for the nodes editor grid on Metal. That PR switched the grid
point drawing code to a shader that sets its own point size, but (at least on Metal)
setting the point size in the shader has no effect unless `GPU_program_point_size(true)`
has been called to allow shader-specified point sizes.

This PR adds the necessary call to `GPU_program_point_size(true)` to fix that problem,
as well as a corresponding "cleanup" call to set it to `false` again.

Pull Request: https://projects.blender.org/blender/blender/pulls/114218
This commit is contained in:
Douglas Paul
2023-10-30 10:53:13 +01:00
committed by Jeroen Bakker
parent ccfe952f34
commit b62a5db37b

View File

@@ -1304,6 +1304,7 @@ void UI_view2d_dot_grid_draw(const View2D *v2d,
GPUVertFormat *format = immVertexFormat();
const uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
GPU_program_point_size(true);
immBindBuiltinProgram(GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA);
/* Scaling the dots fully with the zoom looks too busy, but a bit of size variation is nice. */
@@ -1385,6 +1386,7 @@ void UI_view2d_dot_grid_draw(const View2D *v2d,
}
immUnbindProgram();
GPU_program_point_size(false);
}
/** \} */