diff options
5 files changed, 21 insertions, 15 deletions
diff --git a/source/blender/draw/engines/overlay/overlay_shader.c b/source/blender/draw/engines/overlay/overlay_shader.c index bd3f87a51c5..69b76389c4c 100644 --- a/source/blender/draw/engines/overlay/overlay_shader.c +++ b/source/blender/draw/engines/overlay/overlay_shader.c @@ -666,17 +666,10 @@ GPUShader *OVERLAY_shader_extra_point(void) GPUShader *OVERLAY_shader_facing(void) { const DRWContextState *draw_ctx = DRW_context_state_get(); - const GPUShaderConfigData *sh_cfg = &GPU_shader_cfg_data[draw_ctx->sh_cfg]; OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; if (!sh_data->facing) { - sh_data->facing = GPU_shader_create_from_arrays({ - .vert = (const char *[]){sh_cfg->lib, - datatoc_common_view_lib_glsl, - datatoc_facing_vert_glsl, - NULL}, - .frag = (const char *[]){datatoc_common_globals_lib_glsl, datatoc_facing_frag_glsl, NULL}, - .defs = (const char *[]){sh_cfg->def, NULL}, - }); + sh_data->facing = GPU_shader_create_from_info_name( + draw_ctx->sh_cfg ? "overlay_facing_clipped" : "overlay_facing"); } return sh_data->facing; } diff --git a/source/blender/draw/engines/overlay/shaders/facing_frag.glsl b/source/blender/draw/engines/overlay/shaders/facing_frag.glsl index ca7b4eeaf47..8208689d113 100644 --- a/source/blender/draw/engines/overlay/shaders/facing_frag.glsl +++ b/source/blender/draw/engines/overlay/shaders/facing_frag.glsl @@ -1,4 +1,3 @@ -out vec4 fragColor; void main() { diff --git a/source/blender/draw/engines/overlay/shaders/facing_vert.glsl b/source/blender/draw/engines/overlay/shaders/facing_vert.glsl index 2dd84c0a060..d98caee6a25 100644 --- a/source/blender/draw/engines/overlay/shaders/facing_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/facing_vert.glsl @@ -1,12 +1,10 @@ -in vec3 pos; +#pragma BLENDER_REQUIRE(common_view_clipping_lib.glsl) +#pragma BLENDER_REQUIRE(common_view_lib.glsl) void main() { vec3 world_pos = point_object_to_world(pos); gl_Position = point_world_to_ndc(world_pos); - -#ifdef USE_WORLD_CLIP_PLANES - world_clip_planes_calc_clip_distance(world_pos); -#endif + view_clipping_distances(world_pos); } diff --git a/source/blender/draw/engines/overlay/shaders/infos/facing_info.hh b/source/blender/draw/engines/overlay/shaders/infos/facing_info.hh new file mode 100644 index 00000000000..6d6806eaa80 --- /dev/null +++ b/source/blender/draw/engines/overlay/shaders/infos/facing_info.hh @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "gpu_shader_create_info.hh" + +GPU_SHADER_CREATE_INFO(overlay_facing) + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .vertex_source("facing_vert.glsl") + .fragment_source("facing_frag.glsl") + .fragment_out(0, Type::VEC4, "fragColor") + .additional_info("draw_mesh", "draw_globals"); + +GPU_SHADER_CREATE_INFO(overlay_facing_clipped) + .do_static_compilation(true) + .additional_info("overlay_facing", "drw_clipped"); diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index 333369887e0..8cff3d079c2 100644 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@ -448,6 +448,7 @@ set(SRC_SHADER_CREATE_INFOS ../draw/engines/overlay/shaders/infos/background_info.hh ../draw/engines/overlay/shaders/infos/edit_mode_info.hh ../draw/engines/overlay/shaders/infos/extra_info.hh + ../draw/engines/overlay/shaders/infos/facing_info.hh ../draw/engines/overlay/shaders/infos/grid_info.hh ../draw/engines/overlay/shaders/infos/outline_info.hh ../draw/engines/overlay/shaders/infos/paint_info.hh |