Fix #139565: PyGPU: Add builtin point shaders

This PR adds builtin shaders for drawing points. Using `FLAT_COLOR`,
`SMOOTH_COLOR`, `UNIFORM_COLOR` can lead to undesired behavior
on Metal and Vulkan backends. To ensure future compatibility this PR
adds `POINT_FLAT_COLOR` and `POINT_UNIFORM_COLOR`.

The point size can be set using `gpu.state.point_size_set`.

Pull Request: https://projects.blender.org/blender/blender/pulls/139583
This commit is contained in:
Jeroen Bakker
2025-05-29 14:36:32 +02:00
parent fd58d730b0
commit c56a855b9f
9 changed files with 119 additions and 2 deletions

View File

@@ -104,6 +104,8 @@ enum eGPUBuiltinShader {
*/
GPU_SHADER_3D_FLAT_COLOR,
GPU_SHADER_3D_POLYLINE_FLAT_COLOR,
GPU_SHADER_3D_POINT_FLAT_COLOR,
/**
* Take a 3D position and color for each vertex with perspective correct interpolation.
*
@@ -112,6 +114,7 @@ enum eGPUBuiltinShader {
*/
GPU_SHADER_3D_SMOOTH_COLOR,
GPU_SHADER_3D_POLYLINE_SMOOTH_COLOR,
/**
* Take a single color for all the vertices and a 3D position for each vertex.
*
@@ -120,6 +123,8 @@ enum eGPUBuiltinShader {
*/
GPU_SHADER_3D_UNIFORM_COLOR,
GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR,
GPU_SHADER_3D_POINT_UNIFORM_COLOR,
/**
* Draw a texture in 3D. Take a 3D position and a 2D texture coordinate for each vertex.
*