Cleanup: DRW: Overlay: Make simple fragment shaders local

This avoids reusing gpu shader files that have different requirements.
This commit is contained in:
Clément Foucault 2022-06-02 23:50:06 +02:00
parent 4a72b64c7b
commit 1fb36e9a7c
12 changed files with 119 additions and 96 deletions

View File

@ -457,10 +457,9 @@ set(GLSL_SRC
engines/basic/shaders/basic_depth_pointcloud_vert.glsl
engines/basic/shaders/basic_depth_frag.glsl
engines/overlay/shaders/overlay_common_lib.glsl
engines/overlay/shaders/overlay_antialiasing_frag.glsl
engines/overlay/shaders/overlay_armature_dof_vert.glsl
engines/overlay/shaders/overlay_armature_dof_solid_frag.glsl
engines/overlay/shaders/overlay_armature_dof_vert.glsl
engines/overlay/shaders/overlay_armature_envelope_outline_vert.glsl
engines/overlay/shaders/overlay_armature_envelope_solid_frag.glsl
engines/overlay/shaders/overlay_armature_envelope_solid_vert.glsl
@ -478,6 +477,8 @@ set(GLSL_SRC
engines/overlay/shaders/overlay_armature_wire_vert.glsl
engines/overlay/shaders/overlay_background_frag.glsl
engines/overlay/shaders/overlay_clipbound_vert.glsl
engines/overlay/shaders/overlay_common_lib.glsl
engines/overlay/shaders/overlay_depth_only_frag.glsl
engines/overlay/shaders/overlay_depth_only_vert.glsl
engines/overlay/shaders/overlay_edit_curve_handle_geom.glsl
engines/overlay/shaders/overlay_edit_curve_handle_vert.glsl
@ -488,34 +489,34 @@ set(GLSL_SRC
engines/overlay/shaders/overlay_edit_gpencil_vert.glsl
engines/overlay/shaders/overlay_edit_lattice_point_vert.glsl
engines/overlay/shaders/overlay_edit_lattice_wire_vert.glsl
engines/overlay/shaders/overlay_edit_mesh_analysis_frag.glsl
engines/overlay/shaders/overlay_edit_mesh_analysis_vert.glsl
engines/overlay/shaders/overlay_edit_mesh_common_lib.glsl
engines/overlay/shaders/overlay_edit_mesh_frag.glsl
engines/overlay/shaders/overlay_edit_mesh_geom.glsl
engines/overlay/shaders/overlay_edit_mesh_normal_vert.glsl
engines/overlay/shaders/overlay_edit_mesh_analysis_frag.glsl
engines/overlay/shaders/overlay_edit_mesh_analysis_vert.glsl
engines/overlay/shaders/overlay_edit_mesh_skin_root_vert.glsl
engines/overlay/shaders/overlay_edit_mesh_vert.glsl
engines/overlay/shaders/overlay_edit_particle_strand_vert.glsl
engines/overlay/shaders/overlay_edit_particle_point_vert.glsl
engines/overlay/shaders/overlay_edit_uv_edges_vert.glsl
engines/overlay/shaders/overlay_edit_uv_edges_geom.glsl
engines/overlay/shaders/overlay_edit_particle_strand_vert.glsl
engines/overlay/shaders/overlay_edit_uv_edges_frag.glsl
engines/overlay/shaders/overlay_edit_uv_verts_vert.glsl
engines/overlay/shaders/overlay_edit_uv_verts_frag.glsl
engines/overlay/shaders/overlay_edit_uv_faces_vert.glsl
engines/overlay/shaders/overlay_edit_uv_edges_geom.glsl
engines/overlay/shaders/overlay_edit_uv_edges_vert.glsl
engines/overlay/shaders/overlay_edit_uv_face_dots_vert.glsl
engines/overlay/shaders/overlay_edit_uv_image_vert.glsl
engines/overlay/shaders/overlay_edit_uv_faces_vert.glsl
engines/overlay/shaders/overlay_edit_uv_image_mask_frag.glsl
engines/overlay/shaders/overlay_edit_uv_image_vert.glsl
engines/overlay/shaders/overlay_edit_uv_stretching_vert.glsl
engines/overlay/shaders/overlay_edit_uv_tiled_image_borders_vert.glsl
engines/overlay/shaders/overlay_edit_uv_verts_frag.glsl
engines/overlay/shaders/overlay_edit_uv_verts_vert.glsl
engines/overlay/shaders/overlay_extra_frag.glsl
engines/overlay/shaders/overlay_extra_vert.glsl
engines/overlay/shaders/overlay_extra_groundline_vert.glsl
engines/overlay/shaders/overlay_extra_lightprobe_grid_vert.glsl
engines/overlay/shaders/overlay_extra_loose_point_frag.glsl
engines/overlay/shaders/overlay_extra_loose_point_vert.glsl
engines/overlay/shaders/overlay_extra_point_vert.glsl
engines/overlay/shaders/overlay_extra_vert.glsl
engines/overlay/shaders/overlay_extra_wire_frag.glsl
engines/overlay/shaders/overlay_extra_wire_vert.glsl
engines/overlay/shaders/overlay_facing_frag.glsl
@ -523,16 +524,16 @@ set(GLSL_SRC
engines/overlay/shaders/overlay_grid_background_frag.glsl
engines/overlay/shaders/overlay_grid_frag.glsl
engines/overlay/shaders/overlay_grid_vert.glsl
engines/overlay/shaders/overlay_image_vert.glsl
engines/overlay/shaders/overlay_image_frag.glsl
engines/overlay/shaders/overlay_image_vert.glsl
engines/overlay/shaders/overlay_motion_path_line_frag.glsl
engines/overlay/shaders/overlay_motion_path_line_geom.glsl
engines/overlay/shaders/overlay_motion_path_line_vert.glsl
engines/overlay/shaders/overlay_motion_path_point_vert.glsl
engines/overlay/shaders/overlay_outline_detect_frag.glsl
engines/overlay/shaders/overlay_outline_prepass_frag.glsl
engines/overlay/shaders/overlay_outline_prepass_gpencil_frag.glsl
engines/overlay/shaders/overlay_outline_prepass_geom.glsl
engines/overlay/shaders/overlay_outline_prepass_gpencil_frag.glsl
engines/overlay/shaders/overlay_outline_prepass_gpencil_vert.glsl
engines/overlay/shaders/overlay_outline_prepass_pointcloud_vert.glsl
engines/overlay/shaders/overlay_outline_prepass_vert.glsl
@ -545,14 +546,18 @@ set(GLSL_SRC
engines/overlay/shaders/overlay_paint_weight_frag.glsl
engines/overlay/shaders/overlay_paint_weight_vert.glsl
engines/overlay/shaders/overlay_paint_wire_vert.glsl
engines/overlay/shaders/overlay_particle_vert.glsl
engines/overlay/shaders/overlay_particle_frag.glsl
engines/overlay/shaders/overlay_sculpt_mask_vert.glsl
engines/overlay/shaders/overlay_particle_vert.glsl
engines/overlay/shaders/overlay_point_varying_color_frag.glsl
engines/overlay/shaders/overlay_point_varying_color_varying_outline_aa_frag.glsl
engines/overlay/shaders/overlay_sculpt_mask_frag.glsl
engines/overlay/shaders/overlay_volume_velocity_vert.glsl
engines/overlay/shaders/overlay_sculpt_mask_vert.glsl
engines/overlay/shaders/overlay_uniform_color_frag.glsl
engines/overlay/shaders/overlay_varying_color.glsl
engines/overlay/shaders/overlay_volume_gridlines_vert.glsl
engines/overlay/shaders/overlay_wireframe_vert.glsl
engines/overlay/shaders/overlay_volume_velocity_vert.glsl
engines/overlay/shaders/overlay_wireframe_frag.glsl
engines/overlay/shaders/overlay_wireframe_vert.glsl
engines/overlay/shaders/overlay_xray_fade_frag.glsl
engines/overlay/overlay_shader_shared.h

View File

@ -15,11 +15,9 @@ GPU_SHADER_CREATE_INFO(overlay_background)
GPU_SHADER_CREATE_INFO(overlay_clipbound)
.do_static_compilation(true)
/* NOTE: Color already in Linear space. Which is what we want. */
.define("srgbTarget", "false")
.push_constant(Type::VEC4, "color")
.push_constant(Type::VEC3, "boundbox", 8)
.vertex_source("overlay_clipbound_vert.glsl")
.fragment_out(0, Type::VEC4, "fragColor")
.fragment_source("gpu_shader_uniform_color_frag.glsl")
.fragment_source("overlay_uniform_color_frag.glsl")
.additional_info("draw_view");

View File

@ -29,13 +29,12 @@ GPU_SHADER_INTERFACE_INFO(overlay_edit_mesh_vert_iface, "")
GPU_SHADER_CREATE_INFO(overlay_edit_mesh_vert)
.do_static_compilation(true)
.builtins(BuiltinBits::POINT_SIZE)
.define("srgbTarget", "false") /* Colors are already in linear space. */
.define("VERT")
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::IVEC4, "data")
.vertex_in(2, Type::VEC3, "vnor")
.vertex_out(overlay_edit_mesh_vert_iface)
.fragment_source("gpu_shader_point_varying_color_frag.glsl")
.fragment_source("overlay_point_varying_color_frag.glsl")
.additional_info("overlay_edit_mesh_common");
GPU_SHADER_INTERFACE_INFO(overlay_edit_mesh_edge_iface, "geometry_in")
@ -69,13 +68,12 @@ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_flat)
GPU_SHADER_CREATE_INFO(overlay_edit_mesh_face)
.do_static_compilation(true)
.define("srgbTarget", "false") /* Colors are already in linear space. */
.define("FACE")
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::IVEC4, "data")
.vertex_in(2, Type::VEC3, "vnor")
.vertex_out(overlay_edit_flat_color_iface)
.fragment_source("gpu_shader_3D_smooth_color_frag.glsl")
.fragment_source("overlay_varying_color.glsl")
.additional_info("overlay_edit_mesh_common");
GPU_SHADER_CREATE_INFO(overlay_edit_mesh_facedot)
@ -86,12 +84,11 @@ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_facedot)
.vertex_in(2, Type::VEC4, "norAndFlag")
.define("vnor", "norAndFlag.xyz")
.vertex_out(overlay_edit_flat_color_iface)
.fragment_source("gpu_shader_point_varying_color_frag.glsl")
.fragment_source("overlay_point_varying_color_frag.glsl")
.additional_info("overlay_edit_mesh_common");
GPU_SHADER_CREATE_INFO(overlay_edit_mesh_normal)
.do_static_compilation(true)
.define("srgbTarget", "false") /* Colors are already in linear space. */
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::VEC4, "lnor")
.vertex_in(2, Type::VEC4, "vnor")
@ -104,7 +101,7 @@ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_normal)
.vertex_out(overlay_edit_flat_color_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_edit_mesh_normal_vert.glsl")
.fragment_source("gpu_shader_flat_color_frag.glsl")
.fragment_source("overlay_varying_color.glsl")
.additional_info("draw_modelmat_instanced_attr", "draw_globals");
GPU_SHADER_INTERFACE_INFO(overlay_edit_mesh_analysis_iface, "").smooth(Type::VEC4, "weightColor");
@ -122,14 +119,13 @@ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_analysis)
GPU_SHADER_CREATE_INFO(overlay_edit_mesh_skin_root)
.do_static_compilation(true)
.define("srgbTarget", "false") /* Colors are already in linear space. */
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::FLOAT, "size")
.vertex_in(2, Type::VEC3, "local_pos")
.vertex_out(overlay_edit_flat_color_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_edit_mesh_skin_root_vert.glsl")
.fragment_source("gpu_shader_flat_color_frag.glsl")
.fragment_source("overlay_varying_color.glsl")
.additional_info("draw_modelmat_instanced_attr", "draw_globals");
GPU_SHADER_CREATE_INFO(overlay_edit_mesh_vert_clipped)
@ -205,28 +201,24 @@ GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges_select)
GPU_SHADER_CREATE_INFO(overlay_edit_uv_faces)
.do_static_compilation(true)
/* NOTE: Color already in Linear space. Which is what we want. */
.define("srgbTarget", "false")
.vertex_in(0, Type::VEC2, "au")
.vertex_in(1, Type::INT, "flag")
.push_constant(Type::FLOAT, "uvOpacity")
.vertex_out(overlay_edit_flat_color_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_edit_uv_faces_vert.glsl")
.fragment_source("gpu_shader_flat_color_frag.glsl")
.fragment_source("overlay_varying_color.glsl")
.additional_info("draw_mesh", "draw_globals");
GPU_SHADER_CREATE_INFO(overlay_edit_uv_face_dots)
.do_static_compilation(true)
/* NOTE: Color already in Linear space. Which is what we want. */
.define("srgbTarget", "false")
.vertex_in(0, Type::VEC2, "au")
.vertex_in(1, Type::INT, "flag")
.push_constant(Type::FLOAT, "pointSize")
.vertex_out(overlay_edit_flat_color_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_edit_uv_face_dots_vert.glsl")
.fragment_source("gpu_shader_flat_color_frag.glsl")
.fragment_source("overlay_varying_color.glsl")
.additional_info("draw_mesh", "draw_globals");
GPU_SHADER_INTERFACE_INFO(overlay_edit_uv_vert_iface, "")
@ -236,8 +228,6 @@ GPU_SHADER_INTERFACE_INFO(overlay_edit_uv_vert_iface, "")
GPU_SHADER_CREATE_INFO(overlay_edit_uv_verts)
.do_static_compilation(true)
/* NOTE: Color already in Linear space. Which is what we want. */
.define("srgbTarget", "false")
.vertex_in(0, Type::VEC2, "au")
.vertex_in(1, Type::INT, "flag")
.push_constant(Type::FLOAT, "pointSize")
@ -251,13 +241,11 @@ GPU_SHADER_CREATE_INFO(overlay_edit_uv_verts)
GPU_SHADER_CREATE_INFO(overlay_edit_uv_tiled_image_borders)
.do_static_compilation(true)
/* NOTE: Color already in Linear space. Which is what we want. */
.define("srgbTarget", "false")
.vertex_in(0, Type::VEC3, "pos")
.push_constant(Type::VEC4, "color")
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_edit_uv_tiled_image_borders_vert.glsl")
.fragment_source("gpu_shader_uniform_color_frag.glsl")
.fragment_source("overlay_uniform_color_frag.glsl")
.additional_info("draw_mesh");
GPU_SHADER_INTERFACE_INFO(edit_uv_image_iface, "").smooth(Type::VEC2, "uvs");
@ -293,14 +281,12 @@ GPU_SHADER_CREATE_INFO(overlay_edit_uv_mask_image)
* \{ */
GPU_SHADER_CREATE_INFO(overlay_edit_uv_stretching)
/* NOTE: Color already in Linear space. Which is what we want. */
.define("srgbTarget", "false")
.vertex_in(0, Type::VEC2, "pos")
.push_constant(Type::VEC2, "aspect")
.vertex_out(overlay_edit_nopersp_color_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_edit_uv_stretching_vert.glsl")
.fragment_source("gpu_shader_2D_smooth_color_frag.glsl")
.fragment_source("overlay_varying_color.glsl")
.additional_info("draw_mesh", "draw_globals");
GPU_SHADER_CREATE_INFO(overlay_edit_uv_stretching_area)
@ -328,8 +314,6 @@ GPU_SHADER_INTERFACE_INFO(overlay_edit_curve_handle_iface, "vert").flat(Type::IN
GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle)
.do_static_compilation(true)
.typedef_source("overlay_shader_shared.h")
/* NOTE: Color already in Linear space. Which is what we want. */
.define("srgbTarget", "false")
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::INT, "data")
.vertex_out(overlay_edit_curve_handle_iface)
@ -340,7 +324,7 @@ GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_edit_curve_handle_vert.glsl")
.geometry_source("overlay_edit_curve_handle_geom.glsl")
.fragment_source("gpu_shader_3D_smooth_color_frag.glsl")
.fragment_source("overlay_varying_color.glsl")
.additional_info("draw_mesh", "draw_globals");
GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle_clipped)
@ -350,8 +334,6 @@ GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle_clipped)
GPU_SHADER_CREATE_INFO(overlay_edit_curve_point)
.do_static_compilation(true)
.typedef_source("overlay_shader_shared.h")
/* NOTE: Color already in Linear space. Which is what we want. */
.define("srgbTarget", "false")
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::INT, "data")
.vertex_out(overlay_edit_flat_color_iface)
@ -359,7 +341,7 @@ GPU_SHADER_CREATE_INFO(overlay_edit_curve_point)
.push_constant(Type::INT, "curveHandleDisplay")
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_edit_curve_point_vert.glsl")
.fragment_source("gpu_shader_point_varying_color_frag.glsl")
.fragment_source("overlay_point_varying_color_frag.glsl")
.additional_info("draw_mesh", "draw_globals");
GPU_SHADER_CREATE_INFO(overlay_edit_curve_point_clipped)
@ -368,8 +350,6 @@ GPU_SHADER_CREATE_INFO(overlay_edit_curve_point_clipped)
GPU_SHADER_CREATE_INFO(overlay_edit_curve_wire)
.do_static_compilation(true)
/* NOTE: Color already in Linear space. Which is what we want. */
.define("srgbTarget", "false")
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::VEC3, "nor")
.vertex_in(2, Type::VEC3, "tan")
@ -378,7 +358,7 @@ GPU_SHADER_CREATE_INFO(overlay_edit_curve_wire)
.vertex_out(overlay_edit_flat_color_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_edit_curve_wire_vert.glsl")
.fragment_source("gpu_shader_flat_color_frag.glsl")
.fragment_source("overlay_varying_color.glsl")
.additional_info("draw_modelmat", "draw_resource_id_uniform", "draw_globals");
GPU_SHADER_CREATE_INFO(overlay_edit_curve_wire_clipped)
@ -393,14 +373,12 @@ GPU_SHADER_CREATE_INFO(overlay_edit_curve_wire_clipped)
GPU_SHADER_CREATE_INFO(overlay_edit_lattice_point)
.do_static_compilation(true)
/* NOTE: Color already in Linear space. Which is what we want. */
.define("srgbTarget", "false")
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::INT, "data")
.vertex_out(overlay_edit_flat_color_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_edit_lattice_point_vert.glsl")
.fragment_source("gpu_shader_point_varying_color_frag.glsl")
.fragment_source("overlay_point_varying_color_frag.glsl")
.additional_info("draw_mesh", "draw_globals");
GPU_SHADER_CREATE_INFO(overlay_edit_lattice_point_clipped)
@ -409,15 +387,13 @@ GPU_SHADER_CREATE_INFO(overlay_edit_lattice_point_clipped)
GPU_SHADER_CREATE_INFO(overlay_edit_lattice_wire)
.do_static_compilation(true)
/* NOTE: Color already in Linear space. Which is what we want. */
.define("srgbTarget", "false")
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::FLOAT, "weight")
.sampler(0, ImageType::FLOAT_1D, "weightTex")
.vertex_out(overlay_edit_smooth_color_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_edit_lattice_wire_vert.glsl")
.fragment_source("gpu_shader_3D_smooth_color_frag.glsl")
.fragment_source("overlay_varying_color.glsl")
.additional_info("draw_mesh", "draw_globals");
GPU_SHADER_CREATE_INFO(overlay_edit_lattice_wire_clipped)
@ -432,8 +408,6 @@ GPU_SHADER_CREATE_INFO(overlay_edit_lattice_wire_clipped)
GPU_SHADER_CREATE_INFO(overlay_edit_particle_strand)
.do_static_compilation(true)
/* NOTE: Color already in Linear space. Which is what we want. */
.define("srgbTarget", "false")
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::FLOAT, "color")
.sampler(0, ImageType::FLOAT_1D, "weightTex")
@ -441,7 +415,7 @@ GPU_SHADER_CREATE_INFO(overlay_edit_particle_strand)
.vertex_out(overlay_edit_smooth_color_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_edit_particle_strand_vert.glsl")
.fragment_source("gpu_shader_3D_smooth_color_frag.glsl")
.fragment_source("overlay_varying_color.glsl")
.additional_info("draw_mesh", "draw_globals");
GPU_SHADER_CREATE_INFO(overlay_edit_particle_strand_clipped)
@ -450,14 +424,12 @@ GPU_SHADER_CREATE_INFO(overlay_edit_particle_strand_clipped)
GPU_SHADER_CREATE_INFO(overlay_edit_particle_point)
.do_static_compilation(true)
/* NOTE: Color already in Linear space. Which is what we want. */
.define("srgbTarget", "false")
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::FLOAT, "color")
.vertex_out(overlay_edit_flat_color_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_edit_particle_point_vert.glsl")
.fragment_source("gpu_shader_point_varying_color_frag.glsl")
.fragment_source("overlay_point_varying_color_frag.glsl")
.additional_info("draw_mesh", "draw_globals");
GPU_SHADER_CREATE_INFO(overlay_edit_particle_point_clipped)
@ -472,8 +444,6 @@ GPU_SHADER_CREATE_INFO(overlay_edit_particle_point_clipped)
GPU_SHADER_CREATE_INFO(overlay_edit_gpencil)
.typedef_source("overlay_shader_shared.h")
/* NOTE: Color already in Linear space. Which is what we want. */
.define("srgbTarget", "false")
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::INT, "ma")
.vertex_in(2, Type::UINT, "vflag")
@ -493,7 +463,7 @@ GPU_SHADER_CREATE_INFO(overlay_edit_gpencil)
GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_wire)
.do_static_compilation(true)
.vertex_out(overlay_edit_smooth_color_iface)
.fragment_source("gpu_shader_3D_smooth_color_frag.glsl")
.fragment_source("overlay_varying_color.glsl")
.additional_info("overlay_edit_gpencil");
GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_wire_clipped)
@ -504,7 +474,7 @@ GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_point)
.do_static_compilation(true)
.define("USE_POINTS")
.vertex_out(overlay_edit_flat_color_iface)
.fragment_source("gpu_shader_point_varying_color_frag.glsl")
.fragment_source("overlay_point_varying_color_frag.glsl")
.additional_info("overlay_edit_gpencil");
GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_point_clipped)
@ -514,8 +484,6 @@ GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_point_clipped)
/* TODO(fclem): Refactor this to take list of point instead of drawing 1 point per drawcall. */
GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_guide_point)
.do_static_compilation(true)
/* NOTE: Color already in Linear space. Which is what we want. */
.define("srgbTarget", "false")
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::INT, "data")
.vertex_out(overlay_edit_flat_color_iface)
@ -524,7 +492,7 @@ GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_guide_point)
.push_constant(Type::VEC4, "pColor")
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_edit_gpencil_guide_vert.glsl")
.fragment_source("gpu_shader_point_varying_color_frag.glsl")
.fragment_source("overlay_point_varying_color_frag.glsl")
.additional_info("draw_mesh", "draw_globals");
GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_guide_point_clipped)
@ -543,7 +511,7 @@ GPU_SHADER_CREATE_INFO(overlay_depth_only)
.do_static_compilation(true)
.vertex_in(0, Type::VEC3, "pos")
.vertex_source("overlay_depth_only_vert.glsl")
.fragment_source("gpu_shader_depth_only_frag.glsl")
.fragment_source("overlay_depth_only_frag.glsl")
.additional_info("draw_mesh");
GPU_SHADER_CREATE_INFO(overlay_depth_only_clipped)
@ -558,13 +526,11 @@ GPU_SHADER_CREATE_INFO(overlay_depth_only_clipped)
GPU_SHADER_CREATE_INFO(overlay_uniform_color)
.do_static_compilation(true)
/* NOTE: Color already in Linear space. Which is what we want. */
.define("srgbTarget", "false")
.vertex_in(0, Type::VEC3, "pos")
.push_constant(Type::VEC4, "color")
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_depth_only_vert.glsl")
.fragment_source("gpu_shader_uniform_color_frag.glsl")
.fragment_source("overlay_uniform_color_frag.glsl")
.additional_info("draw_mesh");
GPU_SHADER_CREATE_INFO(overlay_uniform_color_clipped)

View File

@ -54,7 +54,7 @@ GPU_SHADER_CREATE_INFO(overlay_extra_grid)
.vertex_out(overlay_extra_grid_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_extra_lightprobe_grid_vert.glsl")
.fragment_source("gpu_shader_point_varying_color_frag.glsl")
.fragment_source("overlay_point_varying_color_frag.glsl")
.additional_info("draw_view", "draw_globals");
GPU_SHADER_CREATE_INFO(overlay_extra_grid_clipped)
@ -149,7 +149,7 @@ GPU_SHADER_CREATE_INFO(overlay_extra_point)
.vertex_out(overlay_extra_point_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_extra_point_vert.glsl")
.fragment_source("gpu_shader_point_varying_color_varying_outline_aa_frag.glsl")
.fragment_source("overlay_point_varying_color_varying_outline_aa_frag.glsl")
.additional_info("draw_modelmat", "draw_globals");
GPU_SHADER_CREATE_INFO(overlay_extra_point_clipped)
@ -216,7 +216,7 @@ GPU_SHADER_CREATE_INFO(overlay_motion_path_point)
.vertex_out(overlay_motion_path_point_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_motion_path_point_vert.glsl")
.fragment_source("gpu_shader_point_varying_color_frag.glsl")
.fragment_source("overlay_point_varying_color_frag.glsl")
.additional_info("draw_view", "draw_globals");
GPU_SHADER_CREATE_INFO(overlay_motion_path_point_clipped)
@ -308,13 +308,11 @@ GPU_SHADER_CREATE_INFO(overlay_particle_dot_clipped)
GPU_SHADER_CREATE_INFO(overlay_particle_shape)
.do_static_compilation(true)
/* NOTE: Color already in Linear space. Which is what we want. */
.define("srgbTarget", "false")
/* Instantiated Attrs. */
.vertex_in(3, Type::VEC3, "pos")
.vertex_in(4, Type::INT, "vclass")
.fragment_out(0, Type::VEC4, "fragColor")
.fragment_source("gpu_shader_flat_color_frag.glsl")
.fragment_source("overlay_varying_color.glsl")
.additional_info("overlay_particle", "draw_modelmat", "draw_resource_id_uniform");
GPU_SHADER_CREATE_INFO(overlay_particle_shape_clipped)

View File

@ -31,11 +31,9 @@ GPU_SHADER_CREATE_INFO(overlay_grid_background)
GPU_SHADER_CREATE_INFO(overlay_grid_image)
.do_static_compilation(true)
/* NOTE: Color already in Linear space. Which is what we want. */
.define("srgbTarget", "false")
.vertex_in(0, Type::VEC3, "pos")
.push_constant(Type::VEC4, "color")
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_edit_uv_tiled_image_borders_vert.glsl")
.fragment_source("gpu_shader_uniform_color_frag.glsl")
.fragment_source("overlay_uniform_color_frag.glsl")
.additional_info("draw_modelmat");

View File

@ -10,13 +10,12 @@
GPU_SHADER_CREATE_INFO(overlay_paint_face)
.do_static_compilation(true)
.define("srgbTarget", "false") /* NOTE: Color already in Linear space. */
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::VEC4, "nor") /* Select flag on the 4th component. */
.push_constant(Type::VEC4, "color")
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_paint_face_vert.glsl")
.fragment_source("gpu_shader_uniform_color_frag.glsl")
.fragment_source("overlay_uniform_color_frag.glsl")
.additional_info("draw_modelmat");
GPU_SHADER_CREATE_INFO(overlay_paint_face_clipped)
@ -41,7 +40,7 @@ GPU_SHADER_CREATE_INFO(overlay_paint_point)
.vertex_out(overlay_overlay_paint_point_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_paint_point_vert.glsl")
.fragment_source("gpu_shader_point_varying_color_frag.glsl")
.fragment_source("overlay_point_varying_color_frag.glsl")
.additional_info("draw_modelmat", "draw_globals");
GPU_SHADER_CREATE_INFO(overlay_paint_point_clipped)
@ -162,14 +161,13 @@ GPU_SHADER_INTERFACE_INFO(overlay_paint_wire_iface, "").flat(Type::VEC4, "finalC
GPU_SHADER_CREATE_INFO(overlay_paint_wire)
.do_static_compilation(true)
.define("srgbTarget", "false") /* NOTE: Color already in Linear space. */
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::VEC4, "nor") /* flag stored in w */
.vertex_out(overlay_paint_wire_iface)
.push_constant(Type::BOOL, "useSelect")
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_paint_wire_vert.glsl")
.fragment_source("gpu_shader_flat_color_frag.glsl")
.fragment_source("overlay_varying_color.glsl")
.additional_info("draw_modelmat", "draw_globals");
GPU_SHADER_CREATE_INFO(overlay_paint_wire_clipped)

View File

@ -10,8 +10,6 @@ GPU_SHADER_INTERFACE_INFO(overlay_volume_velocity_iface, "").smooth(Type::VEC4,
GPU_SHADER_CREATE_INFO(overlay_volume_velocity)
.do_static_compilation(true)
/* Colors are already in linear space. */
.define("srgbTarget", "false")
.sampler(0, ImageType::FLOAT_3D, "velocityX")
.sampler(1, ImageType::FLOAT_3D, "velocityY")
.sampler(2, ImageType::FLOAT_3D, "velocityZ")
@ -29,7 +27,7 @@ GPU_SHADER_CREATE_INFO(overlay_volume_velocity)
.vertex_out(overlay_volume_velocity_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_volume_velocity_vert.glsl")
.fragment_source("gpu_shader_3D_smooth_color_frag.glsl")
.fragment_source("overlay_varying_color.glsl")
.additional_info("draw_volume");
GPU_SHADER_CREATE_INFO(overlay_volume_velocity_mac)
@ -55,8 +53,6 @@ GPU_SHADER_INTERFACE_INFO(overlay_volume_gridlines_iface, "").flat(Type::VEC4, "
GPU_SHADER_CREATE_INFO(overlay_volume_gridlines)
.do_static_compilation(true)
/* Colors are already in linear space. */
.define("srgbTarget", "false")
.push_constant(Type::FLOAT, "slicePosition")
.push_constant(Type::INT, "sliceAxis")
/* FluidDomainSettings.res */
@ -70,7 +66,7 @@ GPU_SHADER_CREATE_INFO(overlay_volume_gridlines)
.vertex_out(overlay_volume_gridlines_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.vertex_source("overlay_volume_gridlines_vert.glsl")
.fragment_source("gpu_shader_flat_color_frag.glsl")
.fragment_source("overlay_varying_color.glsl")
.additional_info("draw_volume");
GPU_SHADER_CREATE_INFO(overlay_volume_gridlines_flags)

View File

@ -0,0 +1,6 @@
void main()
{
/* No color output, only depth (line below is implicit). */
// gl_FragDepth = gl_FragCoord.z;
}

View File

@ -0,0 +1,23 @@
void main()
{
vec2 centered = gl_PointCoord - vec2(0.5);
float dist_squared = dot(centered, centered);
const float rad_squared = 0.25;
// round point with jaggy edges
if (dist_squared > rad_squared) {
discard;
}
#if defined(VERT)
fragColor = finalColor;
float midStroke = 0.5 * rad_squared;
if (vertexCrease > 0.0 && dist_squared > midStroke) {
fragColor.rgb = mix(finalColor.rgb, colorEdgeCrease.rgb, vertexCrease);
}
#else
fragColor = finalColor;
#endif
}

View File

@ -0,0 +1,27 @@
void main()
{
float dist = length(gl_PointCoord - vec2(0.5));
/* transparent outside of point
* --- 0 ---
* smooth transition
* --- 1 ---
* pure outline color
* --- 2 ---
* smooth transition
* --- 3 ---
* pure fill color
* ...
* dist = 0 at center of point */
float midStroke = 0.5 * (radii[1] + radii[2]);
if (dist > midStroke) {
fragColor.rgb = outlineColor.rgb;
fragColor.a = mix(outlineColor.a, 0.0, smoothstep(radii[1], radii[0], dist));
}
else {
fragColor = mix(fillColor, outlineColor, smoothstep(radii[3], radii[2], dist));
}
}

View File

@ -0,0 +1,4 @@
void main()
{
fragColor = color;
}

View File

@ -0,0 +1,4 @@
void main()
{
fragColor = finalColor;
}