diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-04-29 21:38:33 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-04-29 21:38:42 +0300 |
commit | eaa63c7d68a5a17f8f51e9346f58ad8a8a9dbfda (patch) | |
tree | 4f09bc422451e7bdb1eb5d47025843c3dba4dbaa /source/blender/draw/engines/overlay | |
parent | fc2c22e90c252f683a42574d4382f7e3c23940e1 (diff) |
Overlay: Port extra shaders to use shaderCreateInfo
This should have no functional changes.
Diffstat (limited to 'source/blender/draw/engines/overlay')
11 files changed, 235 insertions, 162 deletions
diff --git a/source/blender/draw/engines/overlay/overlay_shader.c b/source/blender/draw/engines/overlay/overlay_shader.c index a9b796a5e85..da06a5f5b78 100644 --- a/source/blender/draw/engines/overlay/overlay_shader.c +++ b/source/blender/draw/engines/overlay/overlay_shader.c @@ -676,19 +676,12 @@ GPUShader *OVERLAY_shader_edit_particle_point(void) GPUShader *OVERLAY_shader_extra(bool is_select) { 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]; GPUShader **sh = (is_select) ? &sh_data->extra_select : &sh_data->extra; if (!*sh) { - *sh = GPU_shader_create_from_arrays({ - .vert = (const char *[]){sh_cfg->lib, - datatoc_common_globals_lib_glsl, - datatoc_common_view_lib_glsl, - datatoc_extra_vert_glsl, - NULL}, - .frag = (const char *[]){datatoc_common_view_lib_glsl, datatoc_extra_frag_glsl, NULL}, - .defs = (const char *[]){sh_cfg->def, (is_select) ? "#define SELECT_EDGES\n" : NULL, NULL}, - }); + *sh = GPU_shader_create_from_info_name( + draw_ctx->sh_cfg ? (is_select ? "overlay_extra_select_clipped" : "overlay_extra_clipped") : + (is_select ? "overlay_extra_select" : "overlay_extra")); } return *sh; } @@ -696,19 +689,10 @@ GPUShader *OVERLAY_shader_extra(bool is_select) GPUShader *OVERLAY_shader_extra_grid(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->extra_lightprobe_grid) { - sh_data->extra_lightprobe_grid = GPU_shader_create_from_arrays({ - .vert = (const char *[]){sh_cfg->lib, - datatoc_common_view_lib_glsl, - datatoc_common_globals_lib_glsl, - datatoc_gpu_shader_common_obinfos_lib_glsl, - datatoc_extra_lightprobe_grid_vert_glsl, - NULL}, - .frag = (const char *[]){datatoc_gpu_shader_point_varying_color_frag_glsl, NULL}, - .defs = (const char *[]){sh_cfg->def, NULL}, - }); + sh_data->extra_lightprobe_grid = GPU_shader_create_from_info_name( + draw_ctx->sh_cfg ? "overlay_extra_grid_clipped" : "overlay_extra_grid"); } return sh_data->extra_lightprobe_grid; } @@ -716,18 +700,10 @@ GPUShader *OVERLAY_shader_extra_grid(void) GPUShader *OVERLAY_shader_extra_groundline(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->extra_groundline) { - sh_data->extra_groundline = GPU_shader_create_from_arrays({ - .vert = (const char *[]){sh_cfg->lib, - datatoc_common_globals_lib_glsl, - datatoc_common_view_lib_glsl, - datatoc_extra_groundline_vert_glsl, - NULL}, - .frag = (const char *[]){datatoc_common_view_lib_glsl, datatoc_extra_frag_glsl, NULL}, - .defs = (const char *[]){sh_cfg->def, NULL}, - }); + sh_data->extra_groundline = GPU_shader_create_from_info_name( + draw_ctx->sh_cfg ? "overlay_extra_groundline_clipped" : "overlay_extra_groundline"); } return sh_data->extra_groundline; } @@ -735,37 +711,28 @@ GPUShader *OVERLAY_shader_extra_groundline(void) GPUShader *OVERLAY_shader_extra_wire(bool use_object, bool is_select) { 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]; GPUShader **sh = (is_select) ? &sh_data->extra_wire_select : &sh_data->extra_wire[use_object]; if (!*sh) { - char colorids[1024]; - /* NOTE: define all ids we need here. */ - BLI_snprintf(colorids, - sizeof(colorids), - "#define TH_ACTIVE %d\n" - "#define TH_SELECT %d\n" - "#define TH_TRANSFORM %d\n" - "#define TH_WIRE %d\n" - "#define TH_CAMERA_PATH %d\n", - TH_ACTIVE, - TH_SELECT, - TH_TRANSFORM, - TH_WIRE, - TH_CAMERA_PATH); - *sh = GPU_shader_create_from_arrays({ - .vert = (const char *[]){sh_cfg->lib, - datatoc_common_globals_lib_glsl, - datatoc_common_view_lib_glsl, - datatoc_extra_wire_vert_glsl, - NULL}, - .frag = (const char *[]){datatoc_common_view_lib_glsl, datatoc_extra_wire_frag_glsl, NULL}, - .defs = (const char *[]){sh_cfg->def, - colorids, - (is_select) ? "#define SELECT_EDGES\n" : "", - (use_object) ? "#define OBJECT_WIRE \n" : NULL, - NULL}, - }); + const char *info_name = NULL; + if (draw_ctx->sh_cfg) { + if (is_select) { + info_name = "overlay_extra_wire_select_clipped"; + } + else { + info_name = use_object ? "overlay_extra_wire_object_clipped" : + "overlay_extra_wire_clipped"; + } + } + else { + if (is_select) { + info_name = "overlay_extra_wire_select"; + } + else { + info_name = use_object ? "overlay_extra_wire_object" : "overlay_extra_wire"; + } + } + *sh = GPU_shader_create_from_info_name(info_name); } return *sh; } @@ -773,20 +740,10 @@ GPUShader *OVERLAY_shader_extra_wire(bool use_object, bool is_select) GPUShader *OVERLAY_shader_extra_loose_point(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->extra_loose_point) { - sh_data->extra_loose_point = GPU_shader_create_from_arrays({ - .vert = (const char *[]){sh_cfg->lib, - datatoc_common_globals_lib_glsl, - datatoc_common_view_lib_glsl, - datatoc_extra_loose_point_vert_glsl, - NULL}, - .frag = (const char *[]){datatoc_common_globals_lib_glsl, - datatoc_extra_loose_point_frag_glsl, - NULL}, - .defs = (const char *[]){sh_cfg->def, NULL}, - }); + sh_data->extra_loose_point = GPU_shader_create_from_info_name( + draw_ctx->sh_cfg ? "overlay_extra_loose_point_clipped" : "overlay_extra_loose_point"); } return sh_data->extra_loose_point; } @@ -794,20 +751,10 @@ GPUShader *OVERLAY_shader_extra_loose_point(void) GPUShader *OVERLAY_shader_extra_point(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->extra_point) { - sh_data->extra_point = GPU_shader_create_from_arrays({ - .vert = (const char *[]){sh_cfg->lib, - datatoc_common_globals_lib_glsl, - datatoc_common_view_lib_glsl, - datatoc_extra_point_vert_glsl, - NULL}, - .frag = - (const char *[]){datatoc_gpu_shader_point_varying_color_varying_outline_aa_frag_glsl, - NULL}, - .defs = (const char *[]){sh_cfg->def, NULL}, - }); + sh_data->extra_point = GPU_shader_create_from_info_name( + draw_ctx->sh_cfg ? "overlay_extra_point_clipped" : "overlay_extra_point"); } return sh_data->extra_point; } diff --git a/source/blender/draw/engines/overlay/shaders/extra_frag.glsl b/source/blender/draw/engines/overlay/shaders/extra_frag.glsl index a2572f44e70..bf29b2b057e 100644 --- a/source/blender/draw/engines/overlay/shaders/extra_frag.glsl +++ b/source/blender/draw/engines/overlay/shaders/extra_frag.glsl @@ -1,10 +1,5 @@ -noperspective in vec2 edgePos; -flat in vec2 edgeStart; -flat in vec4 finalColor; - -layout(location = 0) out vec4 fragColor; -layout(location = 1) out vec4 lineOutput; +#pragma BLENDER_REQUIRE(common_view_lib.glsl) void main() { diff --git a/source/blender/draw/engines/overlay/shaders/extra_groundline_vert.glsl b/source/blender/draw/engines/overlay/shaders/extra_groundline_vert.glsl index a82c13b9fb7..ff7aae523e7 100644 --- a/source/blender/draw/engines/overlay/shaders/extra_groundline_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/extra_groundline_vert.glsl @@ -1,12 +1,6 @@ -in vec3 pos; - -/* Instance */ -in vec3 inst_pos; - -flat out vec4 finalColor; -flat out vec2 edgeStart; -noperspective out vec2 edgePos; +#pragma BLENDER_REQUIRE(common_view_clipping_lib.glsl) +#pragma BLENDER_REQUIRE(common_view_lib.glsl) void main() { @@ -24,7 +18,5 @@ void main() /* Convert to screen position [0..sizeVp]. */ edgePos = edgeStart = ((gl_Position.xy / gl_Position.w) * 0.5 + 0.5) * sizeViewport.xy; -#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/extra_lightprobe_grid_vert.glsl b/source/blender/draw/engines/overlay/shaders/extra_lightprobe_grid_vert.glsl index 8006c51a946..1eee7ab251b 100644 --- a/source/blender/draw/engines/overlay/shaders/extra_lightprobe_grid_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/extra_lightprobe_grid_vert.glsl @@ -1,9 +1,6 @@ -uniform depth2D depthBuffer; -uniform mat4 gridModelMatrix; -uniform bool isTransform; - -out vec4 finalColor; +#pragma BLENDER_REQUIRE(common_view_clipping_lib.glsl) +#pragma BLENDER_REQUIRE(common_view_lib.glsl) vec4 color_from_id(float color_id) { @@ -60,7 +57,5 @@ void main() finalColor = mix(colorBackground, finalColor, clamp(fac, 0.5, 1.0)); } -#ifdef USE_WORLD_CLIP_PLANES - world_clip_planes_calc_clip_distance(ws_cell_location); -#endif + view_clipping_distances(ws_cell_location); } diff --git a/source/blender/draw/engines/overlay/shaders/extra_loose_point_frag.glsl b/source/blender/draw/engines/overlay/shaders/extra_loose_point_frag.glsl index fd3518523ab..d92b947ef89 100644 --- a/source/blender/draw/engines/overlay/shaders/extra_loose_point_frag.glsl +++ b/source/blender/draw/engines/overlay/shaders/extra_loose_point_frag.glsl @@ -1,9 +1,4 @@ -in vec4 finalColor; - -layout(location = 0) out vec4 fragColor; -layout(location = 1) out vec4 lineOutput; - void main() { vec2 centered = abs(gl_PointCoord - vec2(0.5)); diff --git a/source/blender/draw/engines/overlay/shaders/extra_loose_point_vert.glsl b/source/blender/draw/engines/overlay/shaders/extra_loose_point_vert.glsl index 7e31bf966bc..f283934816c 100644 --- a/source/blender/draw/engines/overlay/shaders/extra_loose_point_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/extra_loose_point_vert.glsl @@ -1,7 +1,6 @@ -in vec3 pos; - -out vec4 finalColor; +#pragma BLENDER_REQUIRE(common_view_clipping_lib.glsl) +#pragma BLENDER_REQUIRE(common_view_lib.glsl) void main() { @@ -14,7 +13,5 @@ void main() gl_PointSize = sizeVertex * 2.0; -#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/extra_point_vert.glsl b/source/blender/draw/engines/overlay/shaders/extra_point_vert.glsl index 537c55cf3f5..de999c241c0 100644 --- a/source/blender/draw/engines/overlay/shaders/extra_point_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/extra_point_vert.glsl @@ -1,11 +1,6 @@ -uniform vec4 color; - -in vec3 pos; - -out vec4 radii; -out vec4 fillColor; -out vec4 outlineColor; +#pragma BLENDER_REQUIRE(common_view_clipping_lib.glsl) +#pragma BLENDER_REQUIRE(common_view_lib.glsl) void main() { @@ -24,7 +19,5 @@ void main() fillColor = color; outlineColor = colorOutline; -#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/extra_vert.glsl b/source/blender/draw/engines/overlay/shaders/extra_vert.glsl index 59c9d0a665d..b2578970c9b 100644 --- a/source/blender/draw/engines/overlay/shaders/extra_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/extra_vert.glsl @@ -1,10 +1,6 @@ -in vec3 pos; -in int vclass; - -/* Instance */ -in mat4 inst_obmat; -in vec4 color; +#pragma BLENDER_REQUIRE(common_view_clipping_lib.glsl) +#pragma BLENDER_REQUIRE(common_view_lib.glsl) #define lamp_area_size inst_data.xy #define lamp_clip_sta inst_data.z @@ -15,7 +11,7 @@ in vec4 color; #define camera_corner inst_data.xy #define camera_center inst_data.zw -#define camera_dist inst_color_data +#define camera_dist color.a #define camera_dist_sta inst_data.z #define camera_dist_end inst_data.w #define camera_distance_color inst_data.x @@ -23,6 +19,7 @@ in vec4 color; #define empty_size inst_data.xyz #define empty_scale inst_data.w +/* TODO(fclem): Share with C code. */ #define VCLASS_LIGHT_AREA_SHAPE (1 << 0) #define VCLASS_LIGHT_SPOT_SHAPE (1 << 1) #define VCLASS_LIGHT_SPOT_BLEND (1 << 2) @@ -42,10 +39,6 @@ in vec4 color; #define VCLASS_EMPTY_AXES_SHADOW (1 << 13) #define VCLASS_EMPTY_SIZE (1 << 14) -flat out vec4 finalColor; -flat out vec2 edgeStart; -noperspective out vec2 edgePos; - void main() { /* Extract data packed inside the unused mat4 members. */ @@ -225,10 +218,9 @@ void main() /* HACK: to avoid losing sub-pixel object in selections, we add a bit of randomness to the * wire to at least create one fragment that will pass the occlusion query. */ /* TODO(fclem): Limit this workaround to selection. It's not very noticeable but still... */ - gl_Position.xy += sizeViewportInv.xy * gl_Position.w * ((gl_VertexID % 2 == 0) ? -1.0 : 1.0); + gl_Position.xy += drw_view.viewport_size_inverse * gl_Position.w * + ((gl_VertexID % 2 == 0) ? -1.0 : 1.0); #endif -#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/extra_wire_frag.glsl b/source/blender/draw/engines/overlay/shaders/extra_wire_frag.glsl index a2bc13ba443..f32e3a8564e 100644 --- a/source/blender/draw/engines/overlay/shaders/extra_wire_frag.glsl +++ b/source/blender/draw/engines/overlay/shaders/extra_wire_frag.glsl @@ -1,10 +1,5 @@ -noperspective in vec2 stipple_coord; -flat in vec2 stipple_start; -flat in vec4 finalColor; - -layout(location = 0) out vec4 fragColor; -layout(location = 1) out vec4 lineOutput; +#pragma BLENDER_REQUIRE(common_view_lib.glsl) void main() { diff --git a/source/blender/draw/engines/overlay/shaders/extra_wire_vert.glsl b/source/blender/draw/engines/overlay/shaders/extra_wire_vert.glsl index 91f45329018..cd217021e8f 100644 --- a/source/blender/draw/engines/overlay/shaders/extra_wire_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/extra_wire_vert.glsl @@ -1,11 +1,6 @@ -in vec3 pos; -in vec4 color; -in int colorid; /* if equal 0 (i.e: Not specified) use color attribute and stippling. */ - -noperspective out vec2 stipple_coord; -flat out vec2 stipple_start; -flat out vec4 finalColor; +#pragma BLENDER_REQUIRE(common_view_clipping_lib.glsl) +#pragma BLENDER_REQUIRE(common_view_lib.glsl) vec2 screen_position(vec4 p) { @@ -21,7 +16,8 @@ void main() /* HACK: to avoid losing sub-pixel object in selections, we add a bit of randomness to the * wire to at least create one fragment that will pass the occlusion query. */ /* TODO(fclem): Limit this workaround to selection. It's not very noticeable but still... */ - gl_Position.xy += sizeViewportInv.xy * gl_Position.w * ((gl_VertexID % 2 == 0) ? -1.0 : 1.0); + gl_Position.xy += drw_view.viewport_size_inverse * gl_Position.w * + ((gl_VertexID % 2 == 0) ? -1.0 : 1.0); #endif stipple_coord = stipple_start = screen_position(gl_Position); @@ -31,7 +27,9 @@ void main() finalColor = vec4(ModelMatrix[0][3], ModelMatrix[1][3], ModelMatrix[2][3], ModelMatrix[3][3]); #else - if (colorid == TH_CAMERA_PATH) { + if (colorid != 0) { + /* TH_CAMERA_PATH is the only color code at the moment. + * Checking `colorid != 0` to avoid having to sync its value with the GLSL code. */ finalColor = colorCameraPath; finalColor.a = 0.0; /* No Stipple */ } @@ -45,7 +43,5 @@ void main() finalColor.a = 0.0; /* No Stipple */ #endif -#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/extra_info.hh b/source/blender/draw/engines/overlay/shaders/infos/extra_info.hh new file mode 100644 index 00000000000..d80db60748d --- /dev/null +++ b/source/blender/draw/engines/overlay/shaders/infos/extra_info.hh @@ -0,0 +1,176 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "gpu_shader_create_info.hh" + +/* -------------------------------------------------------------------- */ +/** \name Extra shapes + * \{ */ + +GPU_SHADER_INTERFACE_INFO(overlay_extra_iface, "") + .no_perspective(Type::VEC2, "edgePos") + .flat(Type::VEC2, "edgeStart") + .flat(Type::VEC4, "finalColor"); + +GPU_SHADER_CREATE_INFO(overlay_extra) + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::INT, "vclass") + /* Instance attributes. */ + .vertex_in(2, Type::MAT4, "inst_obmat") + .vertex_in(3, Type::VEC4, "color") + .vertex_out(overlay_extra_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .fragment_out(1, Type::VEC4, "lineOutput") + .vertex_source("extra_vert.glsl") + .fragment_source("extra_frag.glsl") + .additional_info("draw_view", "draw_globals"); + +GPU_SHADER_CREATE_INFO(overlay_extra_select) + .do_static_compilation(true) + .define("SELECT_EDGES") + .additional_info("overlay_extra"); + +GPU_SHADER_CREATE_INFO(overlay_extra_clipped) + .do_static_compilation(true) + .additional_info("overlay_extra", "drw_clipped"); + +GPU_SHADER_CREATE_INFO(overlay_extra_select_clipped) + .do_static_compilation(true) + .additional_info("overlay_extra_select", "drw_clipped"); + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Irradiance Grid + * \{ */ + +GPU_SHADER_INTERFACE_INFO(overlay_extra_grid_iface, "").flat(Type::VEC4, "finalColor"); + +GPU_SHADER_CREATE_INFO(overlay_extra_grid) + .do_static_compilation(true) + .sampler(0, ImageType::DEPTH_2D, "depthBuffer") + .push_constant(Type::MAT4, "gridModelMatrix") + .push_constant(Type::BOOL, "isTransform") + .vertex_out(overlay_extra_grid_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("extra_lightprobe_grid_vert.glsl") + .fragment_source("gpu_shader_point_varying_color_frag.glsl") + .additional_info("draw_view", "draw_globals"); + +GPU_SHADER_CREATE_INFO(overlay_extra_grid_clipped) + .do_static_compilation(true) + .additional_info("overlay_extra_grid", "drw_clipped"); + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Ground-lines + * \{ */ + +GPU_SHADER_CREATE_INFO(overlay_extra_groundline) + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + /* Instance attributes. */ + .vertex_in(1, Type::VEC3, "inst_pos") + .vertex_out(overlay_extra_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .fragment_out(1, Type::VEC4, "lineOutput") + .vertex_source("extra_groundline_vert.glsl") + .fragment_source("extra_frag.glsl") + .additional_info("draw_view", "draw_globals"); + +GPU_SHADER_CREATE_INFO(overlay_extra_groundline_clipped) + .do_static_compilation(true) + .additional_info("overlay_extra_groundline", "drw_clipped"); + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Extra wires + * \{ */ + +GPU_SHADER_INTERFACE_INFO(overlay_extra_wire_iface, "") + .no_perspective(Type::VEC2, "stipple_coord") + .flat(Type::VEC2, "stipple_start") + .flat(Type::VEC4, "finalColor"); + +GPU_SHADER_CREATE_INFO(overlay_extra_wire) + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::VEC4, "color") + /* If colorid is equal to 0 (i.e: Not specified) use color attribute and stippling. */ + .vertex_in(2, Type::INT, "colorid") + .vertex_out(overlay_extra_wire_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .fragment_out(1, Type::VEC4, "lineOutput") + .vertex_source("extra_wire_vert.glsl") + .fragment_source("extra_wire_frag.glsl") + .additional_info("draw_modelmat", "draw_globals"); + +GPU_SHADER_CREATE_INFO(overlay_extra_wire_select) + .do_static_compilation(true) + .define("SELECT_EDGES") + .additional_info("overlay_extra_wire", "drw_clipped"); + +GPU_SHADER_CREATE_INFO(overlay_extra_wire_object) + .do_static_compilation(true) + .define("OBJECT_WIRE") + .additional_info("overlay_extra_wire", "drw_clipped"); + +GPU_SHADER_CREATE_INFO(overlay_extra_wire_select_clipped) + .do_static_compilation(true) + .additional_info("overlay_extra_wire_select", "drw_clipped"); + +GPU_SHADER_CREATE_INFO(overlay_extra_wire_object_clipped) + .do_static_compilation(true) + .additional_info("overlay_extra_wire_object", "drw_clipped"); + +GPU_SHADER_CREATE_INFO(overlay_extra_wire_clipped) + .do_static_compilation(true) + .additional_info("overlay_extra_wire", "drw_clipped"); + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Extra points + * \{ */ + +GPU_SHADER_INTERFACE_INFO(overlay_extra_point_iface, "") + .flat(Type::VEC4, "radii") + .flat(Type::VEC4, "fillColor") + .flat(Type::VEC4, "outlineColor"); + +GPU_SHADER_CREATE_INFO(overlay_extra_point) + .do_static_compilation(true) + /* TODO(fclem): Move the vertex shader to Overlay engine and remove this bypass. */ + .define("blender_srgb_to_framebuffer_space(a)", "a") + .vertex_in(0, Type::VEC3, "pos") + .push_constant(Type::VEC4, "color") + .vertex_out(overlay_extra_point_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("extra_point_vert.glsl") + .fragment_source("gpu_shader_point_varying_color_varying_outline_aa_frag.glsl") + .additional_info("draw_modelmat", "draw_globals"); + +GPU_SHADER_CREATE_INFO(overlay_extra_point_clipped) + .do_static_compilation(true) + .additional_info("overlay_extra_point", "drw_clipped"); + +GPU_SHADER_INTERFACE_INFO(overlay_extra_loose_point_iface, "").smooth(Type::VEC4, "finalColor"); + +GPU_SHADER_CREATE_INFO(overlay_extra_loose_point) + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .push_constant(Type::VEC4, "color") + .vertex_out(overlay_extra_loose_point_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .fragment_out(1, Type::VEC4, "lineOutput") + .vertex_source("extra_loose_point_vert.glsl") + .fragment_source("extra_loose_point_frag.glsl") + .additional_info("draw_modelmat", "draw_globals"); + +GPU_SHADER_CREATE_INFO(overlay_extra_loose_point_clipped) + .do_static_compilation(true) + .additional_info("overlay_extra_loose_point", "drw_clipped"); + +/** \} */ |