diff options
Diffstat (limited to 'source/blender/draw/modes/paint_weight_mode.c')
-rw-r--r-- | source/blender/draw/modes/paint_weight_mode.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/source/blender/draw/modes/paint_weight_mode.c b/source/blender/draw/modes/paint_weight_mode.c index d52a5540ee6..910ffecd9ba 100644 --- a/source/blender/draw/modes/paint_weight_mode.c +++ b/source/blender/draw/modes/paint_weight_mode.c @@ -31,8 +31,6 @@ #include "DEG_depsgraph_query.h" -extern char datatoc_gpu_shader_cfg_world_clip_lib_glsl[]; - extern char datatoc_paint_face_vert_glsl[]; extern char datatoc_paint_weight_vert_glsl[]; extern char datatoc_paint_weight_frag_glsl[]; @@ -92,38 +90,35 @@ static void PAINT_WEIGHT_engine_init(void *UNUSED(vedata)) { const DRWContextState *draw_ctx = DRW_context_state_get(); PAINT_WEIGHT_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; - const bool is_clip = (draw_ctx->rv3d->rflag & RV3D_CLIPPING) != 0; + const GPUShaderConfigData *sh_cfg_data = &GPU_shader_cfg_data[draw_ctx->sh_cfg]; - if (is_clip) { + if (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) { DRW_state_clip_planes_set_from_rv3d(draw_ctx->rv3d); } if (!sh_data->weight_face) { - const char *world_clip_lib_or_empty = is_clip ? datatoc_gpu_shader_cfg_world_clip_lib_glsl : ""; - const char *world_clip_def_or_empty = is_clip ? "#define USE_WORLD_CLIP_PLANES\n" : ""; - sh_data->weight_face = GPU_shader_create_from_arrays({ - .vert = (const char *[]){world_clip_lib_or_empty, datatoc_common_globals_lib_glsl, datatoc_paint_weight_vert_glsl, NULL}, + .vert = (const char *[]){sh_cfg_data->lib, datatoc_common_globals_lib_glsl, datatoc_paint_weight_vert_glsl, NULL}, .frag = (const char *[]){datatoc_common_globals_lib_glsl, datatoc_paint_weight_frag_glsl, NULL}, - .defs = (const char *[]){world_clip_def_or_empty, NULL}, + .defs = (const char *[]){sh_cfg_data->def, NULL}, }); sh_data->wire_overlay = GPU_shader_create_from_arrays({ - .vert = (const char *[]){world_clip_lib_or_empty, datatoc_common_globals_lib_glsl, datatoc_paint_wire_vert_glsl, NULL}, + .vert = (const char *[]){sh_cfg_data->lib, datatoc_common_globals_lib_glsl, datatoc_paint_wire_vert_glsl, NULL}, .frag = (const char *[]){datatoc_paint_wire_frag_glsl, NULL}, - .defs = (const char *[]){world_clip_def_or_empty, "#define WEIGHT_MODE\n", NULL}, + .defs = (const char *[]){sh_cfg_data->def, "#define WEIGHT_MODE\n", NULL}, }); sh_data->face_overlay = GPU_shader_create_from_arrays({ - .vert = (const char *[]){world_clip_lib_or_empty, datatoc_paint_face_vert_glsl, NULL}, + .vert = (const char *[]){sh_cfg_data->lib, datatoc_paint_face_vert_glsl, NULL}, .frag = (const char *[]){datatoc_gpu_shader_uniform_color_frag_glsl, NULL}, - .defs = (const char *[]){world_clip_def_or_empty, NULL}, + .defs = (const char *[]){sh_cfg_data->def, NULL}, }); sh_data->vert_overlay = GPU_shader_create_from_arrays({ - .vert = (const char *[]){world_clip_lib_or_empty, datatoc_common_globals_lib_glsl, datatoc_paint_wire_vert_glsl, NULL}, + .vert = (const char *[]){sh_cfg_data->lib, datatoc_common_globals_lib_glsl, datatoc_paint_wire_vert_glsl, NULL}, .frag = (const char *[]){datatoc_common_globals_lib_glsl, datatoc_paint_vert_frag_glsl, NULL}, - .defs = (const char *[]){world_clip_def_or_empty, NULL}, + .defs = (const char *[]){sh_cfg_data->def, NULL}, }); } } |