diff options
author | Jeroen Bakker <jeroen@blender.org> | 2022-01-19 16:46:24 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2022-01-19 16:46:24 +0300 |
commit | 7f5219caa4037e831943d44a4c355fdab11cf898 (patch) | |
tree | e383d17297d53a6b1810d986de17514f0e25f680 /source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c | |
parent | 17882988042e3b8adeffbc2072a5a457cb6efb52 (diff) |
Migrating polyline shaders to create info.tmp-gpu-polyline-shaders
GPU_SHADER_3D_POLYLINE_(FLAT/SMOOTH/UNIFORM/CLIPPED_UNIFORM)_COLOR
TODO:
* GPU_SHADER_3D_CLIPPED_UNIFORM_COLOR
* Check all usages of clipped uniform shaders.
{T95016}
Diffstat (limited to 'source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c')
-rw-r--r-- | source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c index d4d4c889209..49b8c805017 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c @@ -42,6 +42,7 @@ #include "GPU_immediate_util.h" #include "GPU_matrix.h" #include "GPU_select.h" +#include "GPU_shader_shared.h" #include "GPU_state.h" #include "RNA_access.h" @@ -114,11 +115,18 @@ static void dial_geom_draw(const float color[4], GPUVertFormat *format = immVertexFormat(); uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + struct ClippingData clipping_data; + GPUUniformBuf *ubo = NULL; + if (clip_plane) { immBindBuiltinProgram(filled ? GPU_SHADER_3D_CLIPPED_UNIFORM_COLOR : GPU_SHADER_3D_POLYLINE_CLIPPED_UNIFORM_COLOR); - immUniform4fv("ClipPlane", clip_plane); - immUniformMatrix4fv("ModelMatrix", axis_modal_mat); + copy_v4_v4(clipping_data.clip_plane, clip_plane); + copy_m4_m4(clipping_data.ModelMatrix, axis_modal_mat); + ubo = GPU_uniformbuf_create_ex(sizeof(struct ClippingData), &clipping_data, __func__); + immBindUniformBuf("clipping_data", ubo); + + GPU_uniformbuf_bind(ubo, GPU_shader_uniformbuf_block()) } else { immBindBuiltinProgram(filled ? GPU_SHADER_3D_UNIFORM_COLOR : @@ -175,6 +183,11 @@ static void dial_geom_draw(const float color[4], immUnbindProgram(); + if (ubo != NULL) { + GPU_uniformbuf_free(ubo); + ubo = NULL; + } + UNUSED_VARS(select); #endif } |