diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-06-03 00:50:06 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-06-03 00:50:29 +0300 |
commit | 1fb36e9a7c67d28b1b6d1cefa255ef59a170855b (patch) | |
tree | 955527b9ce920a9cde273bb2c8b824e746c2cbde /source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh | |
parent | 4a72b64c7b36ec82f416fed7e12b6fb6b6a2b352 (diff) |
Cleanup: DRW: Overlay: Make simple fragment shaders local
This avoids reusing gpu shader files that have different requirements.
Diffstat (limited to 'source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh')
-rw-r--r-- | source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh | 76 |
1 files changed, 21 insertions, 55 deletions
diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh index 3624f26a4c3..58f96110887 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh @@ -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) |