GPU: Remove remaining metal geometry shader workarounds

_No response_

Pull Request: https://projects.blender.org/blender/blender/pulls/131267
This commit is contained in:
Clément Foucault
2024-12-03 10:18:50 +01:00
committed by Clément Foucault
parent 5e66ece252
commit 18f3a11955
16 changed files with 0 additions and 1550 deletions

View File

@@ -616,7 +616,6 @@ set(GLSL_SRC
engines/basic/shaders/basic_conservative_depth_geom.glsl
engines/basic/shaders/basic_depth_vert.glsl
engines/basic/shaders/basic_depth_vert_conservative_no_geom.glsl
engines/basic/shaders/basic_depth_curves_vert.glsl
engines/basic/shaders/basic_depth_pointcloud_vert.glsl
engines/basic/shaders/basic_depth_frag.glsl
@@ -630,12 +629,10 @@ set(GLSL_SRC
engines/overlay/shaders/overlay_armature_shape_outline_geom.glsl
engines/overlay/shaders/overlay_armature_shape_outline_next_vert.glsl
engines/overlay/shaders/overlay_armature_shape_outline_vert.glsl
engines/overlay/shaders/overlay_armature_shape_outline_vert_no_geom.glsl
engines/overlay/shaders/overlay_armature_shape_solid_frag.glsl
engines/overlay/shaders/overlay_armature_shape_solid_vert.glsl
engines/overlay/shaders/overlay_armature_shape_wire_next_vert.glsl
engines/overlay/shaders/overlay_armature_shape_wire_vert.glsl
engines/overlay/shaders/overlay_armature_shape_wire_vert_no_geom.glsl
engines/overlay/shaders/overlay_armature_shape_wire_frag.glsl
engines/overlay/shaders/overlay_armature_shape_wire_geom.glsl
engines/overlay/shaders/overlay_armature_sphere_outline_vert.glsl
@@ -656,12 +653,10 @@ set(GLSL_SRC
engines/overlay/shaders/overlay_edit_curve_handle_geom.glsl
engines/overlay/shaders/overlay_edit_curve_handle_next_vert.glsl
engines/overlay/shaders/overlay_edit_curve_handle_vert.glsl
engines/overlay/shaders/overlay_edit_curve_handle_vert_no_geom.glsl
engines/overlay/shaders/overlay_edit_curve_point_vert.glsl
engines/overlay/shaders/overlay_edit_curves_handle_geom.glsl
engines/overlay/shaders/overlay_edit_curves_handle_next_vert.glsl
engines/overlay/shaders/overlay_edit_curves_handle_vert.glsl
engines/overlay/shaders/overlay_edit_curves_handle_vert_no_geom.glsl
engines/overlay/shaders/overlay_edit_curve_wire_vert.glsl
engines/overlay/shaders/overlay_edit_curve_wire_next_vert.glsl
engines/overlay/shaders/overlay_edit_gpencil_canvas_vert.glsl
@@ -678,7 +673,6 @@ set(GLSL_SRC
engines/overlay/shaders/overlay_edit_mesh_normal_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_mesh_vert_no_geom.glsl
engines/overlay/shaders/overlay_edit_mesh_lib.glsl
engines/overlay/shaders/overlay_edit_mesh_edge_vert.glsl
engines/overlay/shaders/overlay_edit_mesh_face_vert.glsl
@@ -689,7 +683,6 @@ set(GLSL_SRC
engines/overlay/shaders/overlay_edit_uv_edges_frag.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_edges_vert_no_geom.glsl
engines/overlay/shaders/overlay_edit_uv_edges_next_frag.glsl
engines/overlay/shaders/overlay_edit_uv_edges_next_vert.glsl
engines/overlay/shaders/overlay_edit_uv_face_dots_vert.glsl
@@ -720,7 +713,6 @@ set(GLSL_SRC
engines/overlay/shaders/overlay_motion_path_line_geom.glsl
engines/overlay/shaders/overlay_motion_path_line_next_vert.glsl
engines/overlay/shaders/overlay_motion_path_line_vert.glsl
engines/overlay/shaders/overlay_motion_path_line_vert_no_geom.glsl
engines/overlay/shaders/overlay_motion_path_point_vert.glsl
engines/overlay/shaders/overlay_outline_detect_frag.glsl
engines/overlay/shaders/overlay_outline_prepass_curves_vert.glsl
@@ -730,7 +722,6 @@ set(GLSL_SRC
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
engines/overlay/shaders/overlay_outline_prepass_vert_no_geom.glsl
engines/overlay/shaders/overlay_outline_prepass_wire_vert.glsl
engines/overlay/shaders/overlay_paint_face_vert.glsl
engines/overlay/shaders/overlay_paint_point_vert.glsl

View File

@@ -1,79 +0,0 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma USE_SSBO_VERTEX_FETCH(TriangleList, 3)
#include "common_view_clipping_lib.glsl"
#include "common_view_lib.glsl"
void main()
{
/* Calculate triangle vertex info. */
int output_triangle_id = gl_VertexID / 3;
int output_triangle_vertex_id = gl_VertexID % 3;
int base_vertex_id = 0;
if (vertex_fetch_get_input_prim_type() == GPU_PRIM_TRIS) {
base_vertex_id = output_triangle_id * 3;
}
else if (vertex_fetch_get_input_prim_type() == GPU_PRIM_TRI_STRIP) {
base_vertex_id = output_triangle_id;
}
/* NOTE: Triangle fan unsupported in Metal. Will be converted upfront. */
/* Perform vertex shader calculations per input vertex. */
/* input pos vertex attribute. */
vec3 in_pos[3];
/* Calculated per-vertex world pos. */
vec3 world_pos[3];
/* Output gl_Position per vertex. */
vec3 ndc_pos[3];
/* Geometry shader normalized position. */
vec3 pos[3];
for (int i = 0; i < 3; i++) {
in_pos[0] = vertex_fetch_attribute(base_vertex_id + i, pos, vec3);
world_pos[0] = point_object_to_world(in_pos[i]);
ndc_pos[i] = point_world_to_ndc(world_pos[i]);
pos[i] = ndc_pos[i].xyz / ndc_pos[i].w;
}
/* Geometry Shader equivalent calculation
* In this no_geom mode using SSBO vertex fetch, rather than emitting 3 vertices, the vertex
* shader is invocated 3 times, and output is determined based on vertex ID within a triangle
* 0..2. */
vec3 plane = normalize(cross(pos[1] - pos[0], pos[2] - pos[0]));
/* Compute NDC bound box. */
vec4 bbox = vec4(min(min(pos[0].xy, pos[1].xy), pos[2].xy),
max(max(pos[0].xy, pos[1].xy), pos[2].xy));
/* Convert to pixel space. */
bbox = (bbox * 0.5 + 0.5) * sizeViewport.xyxy;
/* Detect failure cases where triangles would produce no fragments. */
bvec2 is_subpixel = lessThan(bbox.zw - bbox.xy, vec2(1.0));
/* View aligned triangle. */
const float threshold = 0.00001;
bool is_coplanar = abs(plane.z) < threshold;
/* Determine output position per-vertex in each triangle */
gl_Position = ndc_pos[output_triangle_vertex_id];
if (all(is_subpixel)) {
vec2 ofs = (i == 0) ? vec2(-1.0) : ((i == 1) ? vec2(2.0, -1.0) : vec2(-1.0, 2.0));
/* HACK: Fix cases where the triangle is too small make it cover at least one pixel. */
gl_Position.xy += sizeViewportInv * gl_Position.w * ofs;
}
/* Test if the triangle is almost parallel with the view to avoid precision issues. */
else if (any(is_subpixel) || is_coplanar) {
/* HACK: Fix cases where the triangle is Parallel to the view by deforming it slightly. */
vec2 ofs = (i == 0) ? vec2(-1.0) : ((i == 1) ? vec2(1.0, -1.0) : vec2(1.0));
gl_Position.xy += sizeViewportInv * gl_Position.w * ofs;
}
else {
/* Triangle expansion should happen here, but we decide to not implement it for
* depth precision & performance reasons. */
}
/* Assign vertex shader clipping distances. */
view_clipping_distances(world_pos[output_triangle_vertex_id]);
}

View File

@@ -37,19 +37,6 @@ VERTEX_SOURCE("basic_depth_curves_vert.glsl")
ADDITIONAL_INFO(draw_hair)
GPU_SHADER_CREATE_END()
/* Geometry-shader alternative paths. */
GPU_SHADER_CREATE_INFO(basic_mesh_conservative_no_geom)
VERTEX_IN(0, VEC3, pos)
VERTEX_SOURCE("basic_depth_vert_conservative_no_geom.glsl")
ADDITIONAL_INFO(draw_mesh)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(basic_pointcloud_conservative_no_geom)
DEFINE("CONSERVATIVE_RASTER")
VERTEX_SOURCE("basic_depth_pointcloud_vert.glsl")
ADDITIONAL_INFO(draw_pointcloud)
GPU_SHADER_CREATE_END()
/** \} */
/* -------------------------------------------------------------------- */
@@ -62,7 +49,6 @@ GPU_SHADER_CREATE_END()
#define BASIC_CONSERVATIVE_VARIATIONS(prefix, ...) \
BASIC_CLIPPING_VARIATIONS(prefix##_conservative, basic_conservative, __VA_ARGS__) \
BASIC_CLIPPING_VARIATIONS(prefix##_conservative_no_geom, __VA_ARGS__) \
BASIC_CLIPPING_VARIATIONS(prefix, __VA_ARGS__)
#define BASIC_OBTYPE_VARIATIONS(prefix, ...) \

View File

@@ -111,20 +111,6 @@ ADDITIONAL_INFO(overlay_armature_common)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline_no_geom)
METAL_BACKEND_ONLY()
DO_STATIC_COMPILATION()
VERTEX_IN(0, VEC3, pos)
/* Per instance. */
VERTEX_IN(3, MAT4, inst_obmat)
VERTEX_OUT(overlay_armature_shape_outline_no_geom_iface)
VERTEX_SOURCE("overlay_armature_shape_outline_vert_no_geom.glsl")
FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl")
ADDITIONAL_INFO(overlay_frag_output)
ADDITIONAL_INFO(overlay_armature_common)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline_next)
DO_STATIC_COMPILATION()
STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY)
@@ -145,13 +131,6 @@ ADDITIONAL_INFO(overlay_armature_shape_outline)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline_clipped_no_geom)
METAL_BACKEND_ONLY()
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_armature_shape_outline_no_geom)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_solid_iface)
SMOOTH(VEC4, finalColor)
FLAT(INT, inverted)
@@ -224,23 +203,6 @@ ADDITIONAL_INFO(overlay_armature_shape_wire)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
#ifdef WITH_METAL_BACKEND
GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire_no_geom)
METAL_BACKEND_ONLY()
DO_STATIC_COMPILATION()
PUSH_CONSTANT(BOOL, do_smooth_wire)
VERTEX_IN(0, VEC3, pos)
VERTEX_IN(2, MAT4, inst_obmat)
VERTEX_OUT(overlay_armature_wire_iface)
VERTEX_SOURCE("overlay_armature_shape_wire_vert_no_geom.glsl")
FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl")
TYPEDEF_SOURCE("overlay_shader_shared.h")
ADDITIONAL_INFO(overlay_frag_output)
ADDITIONAL_INFO(overlay_armature_common)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
#endif
GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire_next)
DO_STATIC_COMPILATION()
DEFINE("NO_GEOM")

View File

@@ -33,25 +33,6 @@ PUSH_CONSTANT(IVEC4, dataMask)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
#ifdef WITH_METAL_BACKEND
GPU_SHADER_CREATE_INFO(overlay_edit_mesh_common_no_geom)
METAL_BACKEND_ONLY()
DEFINE_VALUE("blender_srgb_to_framebuffer_space(a)", "a")
DEFINE("LINE_OUTPUT")
SAMPLER(0, DEPTH_2D, depthTex)
FRAGMENT_OUT(0, VEC4, fragColor)
FRAGMENT_OUT(1, VEC4, lineOutput)
PUSH_CONSTANT(BOOL, wireShading)
PUSH_CONSTANT(BOOL, selectFace)
PUSH_CONSTANT(BOOL, selectEdge)
PUSH_CONSTANT(FLOAT, alpha)
PUSH_CONSTANT(FLOAT, retopologyOffset)
PUSH_CONSTANT(IVEC4, dataMask)
VERTEX_SOURCE("overlay_edit_mesh_vert_no_geom.glsl")
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
#endif
GPU_SHADER_CREATE_INFO(overlay_edit_mesh_depth)
DO_STATIC_COMPILATION()
VERTEX_IN(0, VEC3, pos)
@@ -138,25 +119,6 @@ ADDITIONAL_INFO(draw_modelmat)
ADDITIONAL_INFO(overlay_edit_mesh_common)
GPU_SHADER_CREATE_END()
/* The Non-Geometry shader variant passes directly to fragment. */
#ifdef WITH_METAL_BACKEND
GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_no_geom)
METAL_BACKEND_ONLY()
DO_STATIC_COMPILATION()
DEFINE("EDGE")
VERTEX_IN(0, VEC3, pos)
VERTEX_IN(1, UCHAR4, data)
VERTEX_IN(2, VEC3_101010I2, vnor)
PUSH_CONSTANT(BOOL, do_smooth_wire)
VERTEX_OUT(overlay_edit_mesh_edge_geom_iface)
VERTEX_OUT(overlay_edit_mesh_edge_geom_flat_iface)
VERTEX_OUT(overlay_edit_mesh_edge_geom_noperspective_iface)
FRAGMENT_SOURCE("overlay_edit_mesh_frag.glsl")
ADDITIONAL_INFO(draw_modelmat)
ADDITIONAL_INFO(overlay_edit_mesh_common_no_geom)
GPU_SHADER_CREATE_END()
#endif
/* Vertex Pull version for overlay next. */
GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_next)
DO_STATIC_COMPILATION()
@@ -187,15 +149,6 @@ DEFINE("FLAT")
ADDITIONAL_INFO(overlay_edit_mesh_edge)
GPU_SHADER_CREATE_END()
#ifdef WITH_METAL_BACKEND
GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_flat_no_geom)
METAL_BACKEND_ONLY()
DO_STATIC_COMPILATION()
DEFINE("FLAT")
ADDITIONAL_INFO(overlay_edit_mesh_edge_no_geom)
GPU_SHADER_CREATE_END()
#endif
GPU_SHADER_CREATE_INFO(overlay_edit_mesh_face)
DO_STATIC_COMPILATION()
DEFINE("FACE")
@@ -318,30 +271,12 @@ ADDITIONAL_INFO(overlay_edit_mesh_edge)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
#ifdef WITH_METAL_BACKEND
GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_clipped_no_geom)
METAL_BACKEND_ONLY()
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_edit_mesh_edge_no_geom)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
#endif
GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_flat_clipped)
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_edit_mesh_edge_flat)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
#ifdef WITH_METAL_BACKEND
GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_flat_clipped_no_geom)
METAL_BACKEND_ONLY()
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_edit_mesh_edge_flat_no_geom)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
#endif
GPU_SHADER_CREATE_INFO(overlay_edit_mesh_face_clipped)
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_edit_mesh_face)
@@ -426,18 +361,6 @@ VERTEX_SOURCE("overlay_edit_uv_edges_vert.glsl")
GEOMETRY_SOURCE("overlay_edit_uv_edges_geom.glsl")
GPU_SHADER_CREATE_END()
#ifdef WITH_METAL_BACKEND
GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges_no_geom)
METAL_BACKEND_ONLY()
ADDITIONAL_INFO(overlay_edit_uv_edges_common)
DO_STATIC_COMPILATION()
VERTEX_OUT(overlay_edit_uv_geom_iface)
VERTEX_OUT(overlay_edit_uv_geom_flat_iface)
VERTEX_OUT(overlay_edit_uv_geom_noperspective_iface)
VERTEX_SOURCE("overlay_edit_uv_edges_vert_no_geom.glsl")
GPU_SHADER_CREATE_END()
#endif
GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges_select)
DO_STATIC_COMPILATION()
DEFINE("USE_EDGE_SELECT")
@@ -625,26 +548,6 @@ ADDITIONAL_INFO(draw_mesh)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
#ifdef WITH_METAL_BACKEND
GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle_no_geom)
METAL_BACKEND_ONLY()
DO_STATIC_COMPILATION()
TYPEDEF_SOURCE("overlay_shader_shared.h")
/* NOTE: Color already in Linear space. Which is what we want. */
DEFINE_VALUE("srgbTarget", "false")
VERTEX_IN(0, VEC3, pos)
VERTEX_IN(1, UINT, data)
VERTEX_OUT(overlay_edit_smooth_color_iface)
PUSH_CONSTANT(BOOL, showCurveHandles)
PUSH_CONSTANT(INT, curveHandleDisplay)
FRAGMENT_OUT(0, VEC4, fragColor)
VERTEX_SOURCE("overlay_edit_curve_handle_vert_no_geom.glsl")
FRAGMENT_SOURCE("overlay_varying_color.glsl")
ADDITIONAL_INFO(draw_mesh)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
#endif
GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle_next)
DO_STATIC_COMPILATION()
TYPEDEF_SOURCE("overlay_shader_shared.h")
@@ -672,15 +575,6 @@ ADDITIONAL_INFO(overlay_edit_curve_handle)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
#ifdef WITH_METAL_BACKEND
GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle_clipped_no_geom)
METAL_BACKEND_ONLY()
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_edit_curve_handle_no_geom)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
#endif
GPU_SHADER_CREATE_INFO(overlay_edit_curve_point)
DO_STATIC_COMPILATION()
TYPEDEF_SOURCE("overlay_shader_shared.h")
@@ -803,31 +697,6 @@ ADDITIONAL_INFO(gpu_index_buffer_load)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
#ifdef WITH_METAL_BACKEND
GPU_SHADER_CREATE_INFO(overlay_edit_curves_handle_no_geom)
METAL_BACKEND_ONLY()
DO_STATIC_COMPILATION()
TYPEDEF_SOURCE("overlay_shader_shared.h")
VERTEX_IN(0, VEC3, pos)
VERTEX_IN(1, UINT, data)
VERTEX_IN(2, FLOAT, selection)
VERTEX_OUT(overlay_edit_smooth_color_iface)
PUSH_CONSTANT(INT, curveHandleDisplay)
FRAGMENT_OUT(0, VEC4, fragColor)
VERTEX_SOURCE("overlay_edit_curves_handle_vert_no_geom.glsl")
FRAGMENT_SOURCE("overlay_varying_color.glsl")
ADDITIONAL_INFO(draw_mesh)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_edit_curves_handle_clipped_no_geom)
METAL_BACKEND_ONLY()
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_edit_curves_handle_no_geom)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
#endif
GPU_SHADER_CREATE_INFO(overlay_edit_curves_point)
DO_STATIC_COMPILATION()
TYPEDEF_SOURCE("overlay_shader_shared.h")

View File

@@ -250,23 +250,6 @@ ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_motion_path_line_no_geom)
METAL_BACKEND_ONLY()
DO_STATIC_COMPILATION()
VERTEX_IN(0, VEC3, pos)
PUSH_CONSTANT(IVEC4, mpathLineSettings)
PUSH_CONSTANT(BOOL, selected)
PUSH_CONSTANT(VEC3, customColorPre)
PUSH_CONSTANT(VEC3, customColorPost)
PUSH_CONSTANT(INT, lineThickness) /* In pixels. */
VERTEX_OUT(overlay_motion_path_line_iface)
FRAGMENT_OUT(0, VEC4, fragColor)
VERTEX_SOURCE("overlay_motion_path_line_vert_no_geom.glsl")
FRAGMENT_SOURCE("overlay_motion_path_line_frag.glsl")
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_globals)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_motion_path_line_next)
DO_STATIC_COMPILATION()
STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY)
@@ -292,13 +275,6 @@ ADDITIONAL_INFO(overlay_motion_path_line)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_motion_path_line_clipped_no_geom)
METAL_BACKEND_ONLY()
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_motion_path_line_no_geom)
ADDITIONAL_INFO(drw_clipped)
GPU_SHADER_CREATE_END()
GPU_SHADER_INTERFACE_INFO(overlay_motion_path_point_iface)
FLAT(VEC4, finalColor)
GPU_SHADER_INTERFACE_END()

View File

@@ -84,17 +84,6 @@ PUSH_CONSTANT(IVEC2, gpu_attr_0)
VERTEX_SOURCE("overlay_outline_prepass_wire_vert.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_outline_prepass_wire_no_geom)
METAL_BACKEND_ONLY()
DO_STATIC_COMPILATION()
VERTEX_IN(0, VEC3, pos)
ADDITIONAL_INFO(overlay_outline_prepass)
ADDITIONAL_INFO(draw_object_infos)
ADDITIONAL_INFO(draw_mesh)
ADDITIONAL_INFO(draw_resource_handle)
VERTEX_SOURCE("overlay_outline_prepass_vert_no_geom.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(overlay_outline_prepass_wire_clipped)
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(overlay_outline_prepass_wire)

View File

@@ -1,157 +0,0 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma USE_SSBO_VERTEX_FETCH(LineList, 2)
#include "common_view_clipping_lib.glsl"
#include "common_view_lib.glsl"
#define DISCARD_VERTEX \
gl_Position = finalColor = vec4(0.0); \
edgeStart = edgePos = vec2(0.0); \
return;
/* Project to screen space. */
vec2 proj(vec4 pos)
{
return (0.5 * (pos.xy / pos.w) + 0.5) * sizeViewport.xy;
}
void do_vertex_shader(mat4 in_inst_obmat,
vec3 in_pos,
out vec4 out_pPos,
out vec3 out_vPos,
out vec2 out_ssPos,
out vec4 out_vColSize,
out int out_inverted,
out vec4 out_wpos)
{
vec4 bone_color, state_color;
mat4 model_mat = extract_matrix_packed_data(in_inst_obmat, state_color, bone_color);
vec4 worldPosition = model_mat * vec4(in_pos, 1.0);
vec4 viewpos = ViewMatrix * worldPosition;
out_wpos = worldPosition;
out_vPos = viewpos.xyz;
out_pPos = ProjectionMatrix * viewpos;
out_inverted = int(dot(cross(model_mat[0].xyz, model_mat[1].xyz), model_mat[2].xyz) < 0.0);
/* This is slow and run per vertex, but it's still faster than
* doing it per instance on CPU and sending it on via instance attribute. */
mat3 normal_mat = transpose(inverse(to_float3x3(model_mat)));
out_ssPos = proj(out_pPos);
out_vColSize = bone_color;
}
void main()
{
/* Outputs a singular vertex as part of a LineList primitive, however, requires access to
* neighboring 4 vertices. */
/* Fetch verts from input type lines adjacency. */
int line_prim_id = (gl_VertexID / 2);
int line_vertex_id = gl_VertexID % 2;
int base_vertex_id = line_prim_id * 2;
/* IF Input Primitive Type == Lines_Adjacency, then indices are accessed as per GL specification:
* i.e. 4 indices per unique prim (Provoking vert 4i-2)
*
* IF Input Primitive Type == LineStrip_Adjacency, then indices are accessed using:
* - 2 indices per unique prim, plus 1 index at each end, such that the strided
* - 4-index block can be walked. */
vec3 in_pos[4];
in_pos[0] = vertex_fetch_attribute_raw(vertex_id_from_index_id(4 * line_prim_id), pos, vec3);
in_pos[1] = vertex_fetch_attribute_raw(vertex_id_from_index_id(4 * line_prim_id + 1), pos, vec3);
in_pos[2] = vertex_fetch_attribute_raw(vertex_id_from_index_id(4 * line_prim_id + 2), pos, vec3);
in_pos[3] = vertex_fetch_attribute_raw(vertex_id_from_index_id(4 * line_prim_id + 3), pos, vec3);
mat4 in_inst_obmat = vertex_fetch_attribute(gl_VertexID, inst_obmat, mat4);
/* Run original GL vertex shader implementation per vertex in adjacency list. */
vec4 pPos[4];
vec3 vPos[4];
vec2 ssPos[4];
vec4 vColSize[4];
int inverted[4];
vec4 wPos[4];
for (int v = 0; v < 4; v++) {
do_vertex_shader(
in_inst_obmat, in_pos[v], pPos[v], vPos[v], ssPos[v], vColSize[v], inverted[v], wPos[v]);
}
/* Geometry Shader equivalent to calculate vertex output position. */
finalColor = vec4(vColSize[0].rgb, 1.0);
bool is_persp = (ProjectionMatrix[3][3] == 0.0);
vec3 view_vec = (is_persp) ? normalize(vPos[1]) : vec3(0.0, 0.0, -1.0);
vec3 v10 = vPos[0] - vPos[1];
vec3 v12 = vPos[2] - vPos[1];
vec3 v13 = vPos[3] - vPos[1];
vec3 n0 = cross(v12, v10);
vec3 n3 = cross(v13, v12);
float fac0 = dot(view_vec, n0);
float fac3 = dot(view_vec, n3);
/* If one of the face is perpendicular to the view,
* consider it and outline edge. */
if (abs(fac0) > 1e-5 && abs(fac3) > 1e-5) {
/* If both adjacent verts are facing the camera the same way,
* then it isn't an outline edge. */
if (sign(fac0) == sign(fac3)) {
DISCARD_VERTEX
}
}
n0 = (inverted[0] == 1) ? -n0 : n0;
/* Don't outline if concave edge. */
if (dot(n0, v13) > 0.0001) {
DISCARD_VERTEX
}
vec2 perp = normalize(ssPos[2] - ssPos[1]);
vec2 edge_dir = vec2(-perp.y, perp.x);
vec2 hidden_point;
/* Take the farthest point to compute edge direction
* (avoid problems with point behind near plane).
* If the chosen point is parallel to the edge in screen space,
* choose the other point anyway.
* This fixes some issue with cubes in orthographic views. */
if (vPos[0].z < vPos[3].z) {
hidden_point = (abs(fac0) > 1e-5) ? ssPos[0] : ssPos[3];
}
else {
hidden_point = (abs(fac3) > 1e-5) ? ssPos[3] : ssPos[0];
}
vec2 hidden_dir = normalize(hidden_point - ssPos[1]);
float fac = dot(-hidden_dir, edge_dir);
edge_dir *= (fac < 0.0) ? -1.0 : 1.0;
/* Output corresponding value based on which vertex this corresponds to in the
* original input primitive. */
if (line_vertex_id == 0) {
gl_Position = pPos[1];
/* Offset away from the center to avoid overlap with solid shape. */
gl_Position.xy += (edge_dir - perp) * sizeViewportInv * gl_Position.w;
/* Improve AA bleeding inside bone silhouette. */
gl_Position.z -= (is_persp) ? 1e-4 : 1e-6;
edgeStart = edgePos = ((gl_Position.xy / gl_Position.w) * 0.5 + 0.5) * sizeViewport.xy;
view_clipping_distances(wPos[1].xyz);
}
else {
gl_Position = pPos[2];
/* Offset away from the center to avoid overlap with solid shape. */
gl_Position.xy += (edge_dir + perp) * sizeViewportInv * gl_Position.w;
/* Improve AA bleeding inside bone silhouette. */
gl_Position.z -= (is_persp) ? 1e-4 : 1e-6;
edgeStart = edgePos = ((gl_Position.xy / gl_Position.w) * 0.5 + 0.5) * sizeViewport.xy;
view_clipping_distances(wPos[2].xyz);
}
}

View File

@@ -1,23 +0,0 @@
/* SPDX-FileCopyrightText: 2024 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "common_view_clipping_lib.glsl"
#include "common_view_lib.glsl"
void main()
{
/* Disabled per bone wire width due to drawing issues on Mac. See #124691. */
vec4 bone_color, state_color;
mat4 model_mat = extract_matrix_packed_data(inst_obmat, state_color, bone_color);
vec3 world_pos = (model_mat * vec4(pos, 1.0)).xyz;
gl_Position = point_world_to_ndc(world_pos);
finalColor.rgb = mix(state_color.rgb, bone_color.rgb, 0.5);
finalColor.a = 1.0;
edgeStart = edgePos = ((gl_Position.xy / gl_Position.w) * 0.5 + 0.5) * sizeViewport.xy;
view_clipping_distances(world_pos);
}

View File

@@ -1,200 +0,0 @@
/* SPDX-FileCopyrightText: 2017-2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "common_view_clipping_lib.glsl"
#include "common_view_lib.glsl"
#pragma USE_SSBO_VERTEX_FETCH(TriangleList, 24)
#define DISCARD_VERTEX \
gl_Position = vec4(0.0); \
finalColor = vec4(0.0); \
return;
void output_vert(vec2 offset, vec4 color, vec3 out_world_pos, vec4 out_ndc_pos)
{
finalColor = color;
gl_Position = out_ndc_pos;
gl_Position.xy += offset * out_ndc_pos.w;
view_clipping_distances(out_world_pos);
}
void main()
{
GPU_INTEL_VERTEX_SHADER_WORKAROUND
/* Perform vertex shader for each input primitive. */
vec3 in_pos[2];
vec3 world_pos[2];
vec4 ndc_pos[2];
uint vert_flag[2];
/* Input prim is LineList. */
/* Index of the input line primitive. */
int input_line_id = gl_VertexID / 24;
/* Index of output vertex set. Grouped into pairs as outputted by original "output_line" function
* in overlay_edit_curve_handle_geom.glsl. */
int output_quad_id = (gl_VertexID / 6) % 4;
/* ID of vertex within generated line segment geometry. */
int output_prim_vert_id = gl_VertexID % 24;
for (int i = 0; i < 2; i++) {
in_pos[i] = vertex_fetch_attribute((input_line_id * 2) + i, pos, vec3).xyz;
vert_flag[i] = (uint)vertex_fetch_attribute((input_line_id * 2) + i, data, uchar);
world_pos[i] = point_object_to_world(in_pos[i]);
ndc_pos[i] = point_world_to_ndc(world_pos[i]);
}
/* Perform Geometry shader equivalent calculation. */
uint is_active_nurb = (vert_flag[1] & ACTIVE_NURB);
uint color_id = (vert_flag[1] >> COLOR_SHIFT);
/* Don't output any edges if we don't show handles */
if (!showCurveHandles && (color_id < 5u)) {
DISCARD_VERTEX
return;
}
bool edge_selected = (((vert_flag[1] | vert_flag[0]) & VERT_SELECTED) != 0u);
bool handle_selected = (showCurveHandles &&
(((vert_flag[1] | vert_flag[0]) & VERT_SELECTED_BEZT_HANDLE) != 0u));
bool is_gpencil = ((vert_flag[1] & VERT_GPENCIL_BEZT_HANDLE) != 0u);
/* If handle type is only selected and the edge is not selected, don't show. */
if ((uint(curveHandleDisplay) != CURVE_HANDLE_ALL) && (!handle_selected)) {
/* Nurbs must show the handles always. */
bool is_u_segment = (((vert_flag[1] ^ vert_flag[0]) & EVEN_U_BIT) != 0u);
if ((!is_u_segment) && (color_id <= 4u)) {
return;
}
if (is_gpencil) {
return;
}
}
vec4 inner_color;
if (color_id == 0u) {
inner_color = (edge_selected) ? colorHandleSelFree : colorHandleFree;
}
else if (color_id == 1u) {
inner_color = (edge_selected) ? colorHandleSelAuto : colorHandleAuto;
}
else if (color_id == 2u) {
inner_color = (edge_selected) ? colorHandleSelVect : colorHandleVect;
}
else if (color_id == 3u) {
inner_color = (edge_selected) ? colorHandleSelAlign : colorHandleAlign;
}
else if (color_id == 4u) {
inner_color = (edge_selected) ? colorHandleSelAutoclamp : colorHandleAutoclamp;
}
else {
bool is_selected = (((vert_flag[1] & vert_flag[0]) & VERT_SELECTED) != 0u);
bool is_u_segment = (((vert_flag[1] ^ vert_flag[0]) & EVEN_U_BIT) != 0u);
if (is_u_segment) {
inner_color = (is_selected) ? colorNurbSelUline : colorNurbUline;
}
else {
inner_color = (is_selected) ? colorNurbSelVline : colorNurbVline;
}
}
vec4 outer_color = (is_active_nurb != 0u) ?
mix(colorActiveSpline,
inner_color,
0.25) /* Minimize active color bleeding on inner_color. */
:
vec4(inner_color.rgb, 0.0);
vec2 v1_2 = (ndc_pos[1].xy / ndc_pos[1].w - ndc_pos[0].xy / ndc_pos[0].w);
vec2 offset = sizeEdge * 4.0 * sizeViewportInv; /* 4.0 is eyeballed */
if (abs(v1_2.x * sizeViewport.x) < abs(v1_2.y * sizeViewport.y)) {
offset.y = 0.0;
}
else {
offset.x = 0.0;
}
/* Each output vertex falls into 10 possible positions to generate 8 output triangles between 5
* lines. */
/* Discard transparent border quads up-front. */
if (!(is_active_nurb != 0u)) {
if (output_quad_id == 0 || output_quad_id == 3) {
DISCARD_VERTEX
return;
}
}
switch (output_prim_vert_id) {
/* Top transparent border left (AA). */
case 0: {
offset *= 0.75; /* Don't make the active "halo" appear very thick. */
output_vert(offset * 2.0, vec4(colorActiveSpline.rgb, 0.0), world_pos[0], ndc_pos[0]);
break;
}
/* Top transparent border right (AA). */
case 1:
case 4: {
offset *= 0.75; /* Don't make the active "halo" appear very thick. */
output_vert(offset * 2.0, vec4(colorActiveSpline.rgb, 0.0), world_pos[1], ndc_pos[1]);
break;
}
/* Top Outline row left point. */
case 2:
case 3:
case 6: {
output_vert(offset, outer_color, world_pos[0], ndc_pos[0]);
break;
}
/* Top Outline row right point. */
case 5:
case 7:
case 10: {
output_vert(offset, outer_color, world_pos[1], ndc_pos[1]);
break;
}
/* Core line left point. */
case 8:
case 9:
case 12: {
output_vert(vec2(0.0), inner_color, world_pos[0], ndc_pos[0]);
break;
}
/* Core line right point. */
case 11:
case 13:
case 16: {
output_vert(vec2(0.0), inner_color, world_pos[1], ndc_pos[1]);
break;
}
/* Bottom outline left point. */
case 14:
case 15:
case 18: {
output_vert(-offset, outer_color, world_pos[0], ndc_pos[0]);
break;
}
/* Bottom outline right point. */
case 17:
case 19:
case 22: {
output_vert(-offset, outer_color, world_pos[1], ndc_pos[1]);
break;
}
/* Bottom transparent border left. */
case 20:
case 21: {
output_vert(offset * -2.0, vec4(colorActiveSpline.rgb, 0.0), world_pos[0], ndc_pos[0]);
}
/* Bottom transparent border right. */
case 23: {
output_vert(offset * -2.0, vec4(colorActiveSpline.rgb, 0.0), world_pos[1], ndc_pos[1]);
}
default: {
DISCARD_VERTEX
break;
}
}
}

View File

@@ -1,207 +0,0 @@
/* SPDX-FileCopyrightText: 2017-2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "common_math_lib.glsl"
#include "common_view_clipping_lib.glsl"
#include "common_view_lib.glsl"
#pragma USE_SSBO_VERTEX_FETCH(TriangleList, 24)
#define M_TAN_PI_BY_8 tan(M_PI / 8)
#define M_TAN_3_PI_BY_8 tan(3 * M_PI / 8)
#define M_SQRT2_BY_2 (M_SQRT2 / 2)
#define DISCARD_VERTEX \
gl_Position = vec4(0.0); \
finalColor = vec4(0.0); \
return;
float4 get_bezier_handle_color(uint color_id, float sel)
{
switch (color_id) {
case 0u: /* BEZIER_HANDLE_FREE */
return mix(globalsBlock.color_handle_free, globalsBlock.color_handle_sel_free, sel);
case 1u: /* BEZIER_HANDLE_AUTO */
return mix(globalsBlock.color_handle_auto, globalsBlock.color_handle_sel_auto, sel);
case 2u: /* BEZIER_HANDLE_VECTOR */
return mix(globalsBlock.color_handle_vect, globalsBlock.color_handle_sel_vect, sel);
case 3u: /* BEZIER_HANDLE_ALIGN */
return mix(globalsBlock.color_handle_align, globalsBlock.color_handle_sel_align, sel);
}
return mix(globalsBlock.color_handle_autoclamp, globalsBlock.color_handle_sel_autoclamp, sel);
}
void output_vert(vec2 offset, vec4 color, vec3 out_world_pos, vec4 out_ndc_pos)
{
finalColor = color;
gl_Position = out_ndc_pos;
gl_Position.xy += offset * out_ndc_pos.w;
view_clipping_distances(out_world_pos);
}
void main()
{
GPU_INTEL_VERTEX_SHADER_WORKAROUND
/* Perform vertex shader for each input primitive. */
vec3 in_pos[2];
vec3 world_pos[2];
vec4 ndc_pos[2];
uint vert_flag[2];
float vert_selection[2];
/* Input prim is LineList. */
/* Index of the input line primitive. */
int input_line_id = gl_VertexID / 24;
/* Index of output vertex set. Grouped into pairs as outputted by original "output_line" function
* in overlay_edit_curve_handle_geom.glsl. */
int output_quad_id = (gl_VertexID / 6) % 4;
/* ID of vertex within generated line segment geometry. */
int output_prim_vert_id = gl_VertexID % 24;
int quotient = output_prim_vert_id / 3;
int remainder = output_prim_vert_id % 3;
int line_end_point = remainder == 0 || (quotient % 2 == 0 && remainder == 2) ? 0 : 1;
for (int i = 0; i < 2; i++) {
in_pos[i] = vertex_fetch_attribute((input_line_id * 2) + i, pos, vec3).xyz;
vert_flag[i] = (uint)vertex_fetch_attribute((input_line_id * 2) + i, data, uchar);
vert_selection[i] = (float)vertex_fetch_attribute((input_line_id * 2) + i, selection, float);
world_pos[i] = point_object_to_world(in_pos[i]);
ndc_pos[i] = point_world_to_ndc(world_pos[i]);
}
/* Perform Geometry shader equivalent calculation. */
bool is_active = (vert_flag[0] & EDIT_CURVES_ACTIVE_HANDLE) != 0u;
uint color_id = (vert_flag[0] >> EDIT_CURVES_HANDLE_TYPES_SHIFT) & 7;
bool is_bezier_handle = (vert_flag[0] & EDIT_CURVES_BEZIER_HANDLE) != 0;
/* Don't output any edges if we don't show handles */
if ((uint(curveHandleDisplay) == CURVE_HANDLE_NONE) && is_bezier_handle) {
DISCARD_VERTEX
return;
}
/* If handle type is only selected and the edge is not selected, don't show.
* Nurbs and other curves must show the handles always. */
if ((uint(curveHandleDisplay) == CURVE_HANDLE_SELECTED) && is_bezier_handle && !is_active) {
return;
}
vec4 inner_color;
if ((vert_flag[line_end_point] & (EDIT_CURVES_BEZIER_HANDLE | EDIT_CURVES_BEZIER_KNOT)) != 0u) {
inner_color = get_bezier_handle_color(color_id, vert_selection[line_end_point]);
}
else if ((vert_flag[line_end_point] & EDIT_CURVES_NURBS_CONTROL_POINT) != 0u) {
inner_color = mix(globalsBlock.color_nurb_uline,
globalsBlock.color_nurb_sel_uline,
vert_selection[line_end_point]);
}
else {
inner_color = mix(
globalsBlock.color_wire, globalsBlock.color_vertex_select, vert_selection[line_end_point]);
}
vec4 outer_color = is_active ? mix(colorActiveSpline,
inner_color,
0.25) /* Minimize active color bleeding on inner_color. */
:
vec4(inner_color.rgb, 0.0);
vec2 v1_2 = (ndc_pos[1].xy / ndc_pos[1].w - ndc_pos[0].xy / ndc_pos[0].w) * sizeViewport;
vec2 offset = sizeEdge * 4.0 * sizeViewportInv; /* 4.0 is eyeballed */
if (abs(v1_2.x) <= M_TAN_PI_BY_8 * abs(v1_2.y)) {
offset.y = 0.0;
}
else if (abs(v1_2.x) <= M_TAN_3_PI_BY_8 * abs(v1_2.y)) {
offset = offset * vec2(-M_SQRT2_BY_2 * sign(v1_2.x), M_SQRT2_BY_2 * sign(v1_2.y));
}
else {
offset.x = 0.0;
}
/* Each output vertex falls into 10 possible positions to generate 8 output triangles between 5
* lines. */
/* Discard transparent border quads up-front. */
if (!is_active) {
if (output_quad_id == 0 || output_quad_id == 3) {
DISCARD_VERTEX
return;
}
}
switch (output_prim_vert_id) {
/* Top transparent border left (AA). */
case 0: {
offset *= 0.75; /* Don't make the active "halo" appear very thick. */
output_vert(offset * 2.0, vec4(colorActiveSpline.rgb, 0.0), world_pos[0], ndc_pos[0]);
break;
}
/* Top transparent border right (AA). */
case 1:
case 4: {
offset *= 0.75; /* Don't make the active "halo" appear very thick. */
output_vert(offset * 2.0, vec4(colorActiveSpline.rgb, 0.0), world_pos[1], ndc_pos[1]);
break;
}
/* Top Outline row left point. */
case 2:
case 3:
case 6: {
output_vert(offset, outer_color, world_pos[0], ndc_pos[0]);
break;
}
/* Top Outline row right point. */
case 5:
case 7:
case 10: {
output_vert(offset, outer_color, world_pos[1], ndc_pos[1]);
break;
}
/* Core line left point. */
case 8:
case 9:
case 12: {
output_vert(vec2(0.0), inner_color, world_pos[0], ndc_pos[0]);
break;
}
/* Core line right point. */
case 11:
case 13:
case 16: {
output_vert(vec2(0.0), inner_color, world_pos[1], ndc_pos[1]);
break;
}
/* Bottom outline left point. */
case 14:
case 15:
case 18: {
output_vert(-offset, outer_color, world_pos[0], ndc_pos[0]);
break;
}
/* Bottom outline right point. */
case 17:
case 19:
case 22: {
output_vert(-offset, outer_color, world_pos[1], ndc_pos[1]);
break;
}
/* Bottom transparent border left. */
case 20:
case 21: {
offset *= 0.75; /* Don't make the active "halo" appear very thick. */
output_vert(offset * -2.0, vec4(colorActiveSpline.rgb, 0.0), world_pos[0], ndc_pos[0]);
break;
}
/* Bottom transparent border right. */
case 23: {
offset *= 0.75; /* Don't make the active "halo" appear very thick. */
output_vert(offset * -2.0, vec4(colorActiveSpline.rgb, 0.0), world_pos[1], ndc_pos[1]);
break;
}
default: {
DISCARD_VERTEX
break;
}
}
}

View File

@@ -1,220 +0,0 @@
/* SPDX-FileCopyrightText: 2022-2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma USE_SSBO_VERTEX_FETCH(TriangleList, 6)
#include "common_view_clipping_lib.glsl"
#include "common_view_lib.glsl"
#include "overlay_edit_mesh_common_lib.glsl"
#define DISCARD_VERTEX \
gl_Position = geometry_flat_out.finalColorOuter = geometry_out.finalColor = vec4(0.0); \
geometry_noperspective_out.edgeCoord = 0.0; \
return;
bool test_occlusion(vec4 pos)
{
vec3 ndc = (pos.xyz / pos.w) * 0.5 + 0.5;
return ndc.z > texture(depthTex, ndc.xy).r;
}
vec3 non_linear_blend_color(vec3 col1, vec3 col2, float fac)
{
col1 = pow(col1, vec3(1.0 / 2.2));
col2 = pow(col2, vec3(1.0 / 2.2));
vec3 col = mix(col1, col2, fac);
return pow(col, vec3(2.2));
}
vec3 vec3_1010102_Inorm_to_vec3(vec3 data)
{
return data;
}
vec3 vec3_1010102_Inorm_to_vec3(int data)
{
vec3 out_vec;
out_vec.x = float(clamp(data, -512, 511)) / 511.0f;
out_vec.y = float(clamp(data >> 10, -512, 511)) / 511.0f;
out_vec.z = float(clamp(data >> 20, -512, 511)) / 511.0f;
return out_vec;
}
void do_vertex(vec4 color, vec4 pos, float coord, vec2 offset)
{
geometry_out.finalColor = color;
geometry_noperspective_out.edgeCoord = coord;
gl_Position = pos;
/* Multiply offset by 2 because gl_Position range is [-1..1]. */
gl_Position.xy += offset * 2.0 * pos.w;
}
void main()
{
/* Index of the quad primitive -- corresponds to one line prim. */
int quad_id = gl_VertexID / 6;
/* Determine vertex within the output 2-triangle quad (A, B, C)(A, C, D). */
int quad_vertex_id = gl_VertexID % 6;
/* Base index of the line primitive:
* IF PrimType == LineList: base_vertex_id = quad_id*2
* IF PrimType == LineStrip: base_vertex_id = quad_id
*
* NOTE: This is currently used as LineList.
*
* NOTE: Primitive Restart Will not work with this setup as-is. We should avoid using
* input primitive types which use restart indices. */
int base_vertex_id = quad_id * 2;
/* Fetch attribute values for self and neighboring vertex. */
vec3 in_pos0 = vertex_fetch_attribute(base_vertex_id, pos, vec3);
vec3 in_pos1 = vertex_fetch_attribute(base_vertex_id + 1, pos, vec3);
uchar4 in_data0 = vertex_fetch_attribute(base_vertex_id, data, uchar4);
uchar4 in_data1 = vertex_fetch_attribute(base_vertex_id + 1, data, uchar4);
vec3 in_vnor0 = vec3_1010102_Inorm_to_vec3(
vertex_fetch_attribute(base_vertex_id, vnor, vec3_1010102_Inorm));
vec3 in_vnor1 = vec3_1010102_Inorm_to_vec3(
vertex_fetch_attribute(base_vertex_id + 1, vnor, vec3_1010102_Inorm));
/* Calculate values for self and neighboring vertex. */
vec4 out_finalColor[2];
vec4 out_finalColorOuter[2];
int selectOveride[2];
vec3 world_pos0 = point_object_to_world(in_pos0);
vec3 world_pos1 = point_object_to_world(in_pos1);
vec3 view_pos0 = point_world_to_view(world_pos0);
vec3 view_pos1 = point_world_to_view(world_pos1);
vec4 out_pos0 = point_view_to_ndc(view_pos0);
vec4 out_pos1 = point_view_to_ndc(view_pos1);
/* Offset Z position for retopology overlay. */
out_pos0.z += get_homogenous_z_offset(view_pos0.z, out_pos0.w, retopologyOffset);
out_pos1.z += get_homogenous_z_offset(view_pos1.z, out_pos1.w, retopologyOffset);
uvec4 m_data0 = uvec4(in_data0) & uvec4(dataMask);
uvec4 m_data1 = uvec4(in_data1) & uvec4(dataMask);
#if defined(EDGE)
# ifdef FLAT
out_finalColor[0] = EDIT_MESH_edge_color_inner(m_data0.y);
out_finalColor[1] = EDIT_MESH_edge_color_inner(m_data1.y);
selectOveride[0] = 1;
selectOveride[1] = 1;
# else
out_finalColor[0] = EDIT_MESH_edge_vertex_color(m_data0.y);
out_finalColor[1] = EDIT_MESH_edge_vertex_color(m_data1.y);
selectOveride[0] = (m_data0.y & EDGE_SELECTED);
selectOveride[1] = (m_data1.y & EDGE_SELECTED);
# endif
float crease0 = float(m_data0.z) / 255.0;
float crease1 = float(m_data1.z) / 255.0;
float bweight0 = float(m_data0.w) / 255.0;
float bweight1 = float(m_data1.w) / 255.0;
out_finalColorOuter[0] = EDIT_MESH_edge_color_outer(m_data0.y, m_data0.x, crease0, bweight0);
out_finalColorOuter[1] = EDIT_MESH_edge_color_outer(m_data1.y, m_data1.x, crease1, bweight1);
if (out_finalColorOuter[0].a > 0.0) {
out_pos0.z -= 5e-7 * abs(out_pos0.w);
}
if (out_finalColorOuter[1].a > 0.0) {
out_pos1.z -= 5e-7 * abs(out_pos1.w);
}
/* Occlusion done in fragment shader. */
bool occluded0 = false;
bool occluded1 = false;
#endif
out_finalColor[0].a *= (occluded0) ? alpha : 1.0;
out_finalColor[1].a *= (occluded1) ? alpha : 1.0;
#if !defined(FACE)
/* Facing based color blend */
vec3 view_normal0 = normalize(normal_object_to_view(in_vnor0) + 1e-4);
vec3 view_vec0 = (ProjectionMatrix[3][3] == 0.0) ? normalize(view_pos0) : vec3(0.0, 0.0, 1.0);
float facing0 = dot(view_vec0, view_normal0);
facing0 = 1.0 - abs(facing0) * 0.2;
vec3 view_normal1 = normalize(normal_object_to_view(in_vnor1) + 1e-4);
vec3 view_vec1 = (ProjectionMatrix[3][3] == 0.0) ? normalize(view_pos1) : vec3(0.0, 0.0, 1.0);
float facing1 = dot(view_vec1, view_normal1);
facing1 = 1.0 - abs(facing1) * 0.2;
/* Do interpolation in a non-linear space to have a better visual result. */
out_finalColor[0].rgb = mix(
out_finalColor[0].rgb,
non_linear_blend_color(colorEditMeshMiddle.rgb, out_finalColor[0].rgb, facing0),
fresnelMixEdit);
out_finalColor[1].rgb = mix(
out_finalColor[1].rgb,
non_linear_blend_color(colorEditMeshMiddle.rgb, out_finalColor[1].rgb, facing1),
fresnelMixEdit);
#endif
// -------- GEOM SHADER ALTERNATIVE ----------- //
vec2 ss_pos[2];
/* Clip line against near plane to avoid deformed lines. */
vec4 pos0 = out_pos0;
vec4 pos1 = out_pos1;
vec2 pz_ndc = vec2(pos0.z / pos0.w, pos1.z / pos1.w);
bvec2 clipped = lessThan(pz_ndc, vec2(-1.0));
if (all(clipped)) {
/* Totally clipped. */
DISCARD_VERTEX;
}
vec4 pos01 = pos0 - pos1;
float ofs = abs((pz_ndc.y + 1.0) / (pz_ndc.x - pz_ndc.y));
if (clipped.y) {
pos1 += pos01 * ofs;
}
else if (clipped.x) {
pos0 -= pos01 * (1.0 - ofs);
}
ss_pos[0] = pos0.xy / pos0.w;
ss_pos[1] = pos1.xy / pos1.w;
vec2 line = ss_pos[0] - ss_pos[1];
line = abs(line) * sizeViewport.xy;
geometry_flat_out.finalColorOuter = out_finalColorOuter[0];
float half_size = sizeEdge;
/* Enlarge edge for flag display. */
half_size += (geometry_flat_out.finalColorOuter.a > 0.0) ? max(sizeEdge, 1.0) : 0.0;
if (do_smooth_wire) {
/* Add 1px for AA */
half_size += 0.5;
}
vec3 edge_ofs = vec3(half_size * sizeViewportInv, 0.0);
bool horizontal = line.x > line.y;
edge_ofs = (horizontal) ? edge_ofs.zyz : edge_ofs.xzz;
vec4 final_color = (selectOveride[0] == 0) ? out_finalColor[1] : out_finalColor[0];
/* Output specific Vertex data depending on quad_vertex_id. */
if (quad_vertex_id == 0) {
view_clipping_distances(world_pos0);
do_vertex(out_finalColor[0], pos0, half_size, edge_ofs.xy);
}
else if (quad_vertex_id == 1 || quad_vertex_id == 3) {
view_clipping_distances(world_pos0);
do_vertex(out_finalColor[0], pos0, -half_size, -edge_ofs.xy);
}
else if (quad_vertex_id == 2 || quad_vertex_id == 5) {
view_clipping_distances(world_pos1);
do_vertex(final_color, pos1, half_size, edge_ofs.xy);
}
else if (quad_vertex_id == 4) {
view_clipping_distances(world_pos1);
do_vertex(final_color, pos1, -half_size, -edge_ofs.xy);
}
}

View File

@@ -1,129 +0,0 @@
/* SPDX-FileCopyrightText: 2022-2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma USE_SSBO_VERTEX_FETCH(TriangleList, 6)
#include "common_view_lib.glsl"
#include "overlay_common_lib.glsl"
#define DISCARD_VERTEX \
gl_Position = vec4(0.0); \
return;
void do_vertex(
vec4 pos, float selection_fac, vec2 stipple_start, vec2 stipple_pos, float coord, vec2 offset)
{
geom_out.selectionFac = selection_fac;
geom_noperspective_out.edgeCoord = coord;
geom_flat_out.stippleStart = stipple_start;
geom_noperspective_out.stipplePos = stipple_pos;
gl_Position = pos;
/* Multiply offset by 2 because gl_Position range is [-1..1]. */
gl_Position.xy += offset * 2.0;
}
void main()
{
/* Determine output geometry parameters. */
int quad_id = gl_VertexID / 6;
int quad_vertex_id = gl_VertexID % 6;
int base_vertex_id = 0;
if (vertex_fetch_get_input_prim_type() == GPU_PRIM_LINES) {
base_vertex_id = quad_id * 2;
}
else if (vertex_fetch_get_input_prim_type() == GPU_PRIM_LINE_STRIP) {
base_vertex_id = quad_id;
}
else {
DISCARD_VERTEX
}
/* Read vertex attributes for line prims. */
vec2 root_au0 = vertex_fetch_attribute(base_vertex_id, au, vec2);
vec2 root_au1 = vertex_fetch_attribute(base_vertex_id + 1, au, vec2);
int root_flag0 = vertex_fetch_attribute(base_vertex_id, flag, int);
int root_flag1 = vertex_fetch_attribute(base_vertex_id + 1, flag, int);
/* Vertex shader per input vertex. */
vec3 world_pos0 = point_object_to_world(vec3(root_au0, 0.0));
vec3 world_pos1 = point_object_to_world(vec3(root_au1, 0.0));
vec4 ndc_pos0 = point_world_to_ndc(world_pos0);
vec4 ndc_pos1 = point_world_to_ndc(world_pos1);
/* Snap vertices to the pixel grid to reduce artifacts. */
vec2 half_viewport_res = sizeViewport * 0.5;
vec2 half_pixel_offset = sizeViewportInv * 0.5;
ndc_pos0.xy = floor(ndc_pos0.xy * half_viewport_res) / half_viewport_res + half_pixel_offset;
ndc_pos1.xy = floor(ndc_pos1.xy * half_viewport_res) / half_viewport_res + half_pixel_offset;
#ifdef USE_EDGE_SELECT
bool is_select0 = (root_flag0 & EDGE_UV_SELECT) != 0;
bool is_select1 = (root_flag1 & EDGE_UV_SELECT) != 0;
#else
bool is_select0 = (root_flag0 & VERT_UV_SELECT) != 0;
bool is_select1 = (root_flag1 & VERT_UV_SELECT) != 0;
#endif
float selectionFac0 = is_select0 ? 1.0 : 0.0; // out float selectionFac;
float selectionFac1 = is_select1 ? 1.0 : 0.0; // out float selectionFac;
#ifdef USE_EDGE_SELECT
/* No blending with edge selection. */
selectionFac1 = selectionFac0;
#endif
/* Move selected edges to the top
* Vertices are between 0.0 and 0.2, Edges between 0.2 and 0.4
* actual pixels are at 0.75, 1.0 is used for the background. */
float depth0 = is_select0 ? 0.25 : 0.35;
float depth1 = is_select1 ? 0.25 : 0.35;
ndc_pos0.z = depth0;
ndc_pos1.z = depth1;
/* Avoid precision loss. */
vec2 stipplePos0 = 500.0 + 500.0 * (ndc_pos0.xy / ndc_pos0.w);
vec2 stipplePos1 = 500.0 + 500.0 * (ndc_pos1.xy / ndc_pos1.w);
vec2 stippleStart0 = stipplePos0;
vec2 stippleStart1 = stipplePos1;
/* Geometry shader equivalent calculations. */
vec2 ss_pos[2];
ss_pos[0] = ndc_pos0.xy / ndc_pos0.w;
ss_pos[1] = ndc_pos1.xy / ndc_pos1.w;
float half_size = sizeEdge;
/* Enlarge edge for outline drawing. */
/* Factor of 3.0 out of nowhere! Seems to fix issues with float imprecision. */
half_size += (lineStyle == OVERLAY_UV_LINE_STYLE_OUTLINE) ?
max(sizeEdge * (doSmoothWire ? 1.0 : 3.0), 1.0) :
0.0;
/* Add 1px for AA */
if (doSmoothWire) {
half_size += 0.5;
}
vec2 line = ss_pos[0] - ss_pos[1];
vec2 line_dir = normalize(line);
vec2 line_perp = vec2(-line_dir.y, line_dir.x);
vec2 edge_ofs = line_perp * sizeViewportInv * ceil(half_size);
switch (quad_vertex_id) {
case 1: /* vertex A */
case 3:
do_vertex(ndc_pos1, selectionFac1, stippleStart1, stipplePos1, half_size, edge_ofs.xy);
break;
case 0: /* B */
do_vertex(ndc_pos0, selectionFac0, stippleStart0, stipplePos0, half_size, edge_ofs.xy);
break;
case 2: /* C */
case 4:
do_vertex(ndc_pos0, selectionFac0, stippleStart0, stipplePos0, -half_size, -edge_ofs.xy);
break;
case 5: /* D */
do_vertex(ndc_pos1, selectionFac1, stippleStart1, stipplePos1, -half_size, -edge_ofs.xy);
break;
}
}

View File

@@ -1,158 +0,0 @@
/* SPDX-FileCopyrightText: 2022-2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma USE_SSBO_VERTEX_FETCH(TriangleList, 6)
#include "common_view_clipping_lib.glsl"
#include "common_view_lib.glsl"
#define frameCurrent mpathLineSettings.x
#define frameStart mpathLineSettings.y
#define frameEnd mpathLineSettings.z
#define cacheStart mpathLineSettings.w
/* Project to screen space. */
vec2 proj(vec4 pos)
{
return (0.5 * (pos.xy / pos.w) + 0.5) * sizeViewport.xy;
}
#define SET_INTENSITY(A, B, C, min, max) \
(((1.0 - (float(C - B) / float(C - A))) * (max - min)) + min)
vec2 compute_dir(vec2 v0, vec2 v1)
{
vec2 dir = normalize(v1 - v0 + 1e-8);
dir = vec2(-dir.y, dir.x);
return dir;
}
void do_vertex_shader(vec4 pos, int vertex_id, out vec2 out_sspos, out vec4 out_finalcolor)
{
out_sspos = proj(pos);
out_finalcolor = vec4(0.0);
int frame = vertex_id + cacheStart;
float intensity; /* how faint */
vec3 blend_base = (abs(frame - frameCurrent) == 0) ?
colorCurrentFrame.rgb :
colorBackground.rgb; /* "bleed" CFRAME color to ease color blending. */
bool use_custom_color = customColorPre.x >= 0.0;
if (frame < frameCurrent) {
if (use_custom_color) {
out_finalcolor.rgb = customColorPre;
}
else {
if (selected) {
intensity = SET_INTENSITY(frameStart, frame, frameCurrent, 0.25, 0.75);
}
else {
intensity = SET_INTENSITY(frameStart, frame, frameCurrent, 0.68, 0.92);
}
out_finalcolor.rgb = mix(colorWire.rgb, blend_base, intensity);
}
}
else if (frame > frameCurrent) {
if (use_custom_color) {
out_finalcolor.rgb = customColorPost;
}
else {
if (selected) {
intensity = SET_INTENSITY(frameCurrent, frame, frameEnd, 0.25, 0.75);
}
else {
intensity = SET_INTENSITY(frameCurrent, frame, frameEnd, 0.68, 0.92);
}
out_finalcolor.rgb = mix(colorBonePose.rgb, blend_base, intensity);
}
}
else {
if (use_custom_color) {
out_finalcolor.rgb = colorCurrentFrame.rgb;
}
else {
if (selected) {
intensity = 0.92f;
}
else {
intensity = 0.75f;
}
out_finalcolor.rgb = mix(colorCurrentFrame.rgb, blend_base, intensity);
}
}
out_finalcolor.a = 1.0;
}
void main()
{
/** Determine Output Primitive ID and relative vertex. */
/* Index of the quad primitive. We generate one quad for each input line. */
int quad_id = gl_VertexID / 6;
/* Determine vertex within the quad (A, B, C)(A, C, D). */
int quad_vertex_id = gl_VertexID % 6;
/* Base index of the line primitive:
* - IF PrimType == LineList: base_vertex_id = quad_id*2
* - IF PrimType == LineStrip: base_vertex_id = quad_id
*
* NOTE: Primitive is LineStrip for this shader. */
int base_vertex_id = quad_id;
/* Fetch attributes for self and neighboring vertex. */
vec3 in_pos0 = vertex_fetch_attribute(base_vertex_id, pos, vec3);
vec3 in_pos1 = vertex_fetch_attribute(base_vertex_id + 1, pos, vec3);
vec4 out_pos0 = drw_view.winmat * (drw_view.viewmat * vec4(in_pos0, 1.0));
vec4 out_pos1 = drw_view.winmat * (drw_view.viewmat * vec4(in_pos1, 1.0));
/* Final calculations required for Geometry Shader alternative.
* We need to calculate values for each vertex position to correctly determine the final output
* position. */
vec2 ssPos[2];
vec4 finalColor_geom[2];
do_vertex_shader(out_pos0, base_vertex_id, ssPos[0], finalColor_geom[0]);
do_vertex_shader(out_pos1, base_vertex_id + 1, ssPos[1], finalColor_geom[1]);
/* Geometry shader alternative -- Output is triangle-list consisting of 6 vertices.
* Each vertex shader invocation is one vertex in the output primitive, so output
* required ID. */
vec2 t;
vec2 edge_dir = compute_dir(ssPos[0], ssPos[1]) * sizeViewportInv;
bool is_persp = (ProjectionMatrix[3][3] == 0.0);
float line_size = float(lineThickness) * sizePixel;
if (quad_vertex_id == 0) {
view_clipping_distances(out_pos0.xyz);
interp.color = finalColor_geom[0];
t = edge_dir * (line_size * (is_persp ? out_pos0.w : 1.0));
gl_Position = out_pos0 + vec4(t, 0.0, 0.0);
}
else if (quad_vertex_id == 1 || quad_vertex_id == 3) {
view_clipping_distances(out_pos0.xyz);
interp.color = finalColor_geom[0];
t = edge_dir * (line_size * (is_persp ? out_pos0.w : 1.0));
gl_Position = out_pos0 - vec4(t, 0.0, 0.0);
}
else if (quad_vertex_id == 2 || quad_vertex_id == 5) {
view_clipping_distances(out_pos1.xyz);
interp.color = finalColor_geom[1];
t = edge_dir * (line_size * (is_persp ? out_pos1.w : 1.0));
gl_Position = out_pos1 + vec4(t, 0.0, 0.0);
}
else if (quad_vertex_id == 4) {
view_clipping_distances(out_pos1.xyz);
interp.color = finalColor_geom[1];
t = edge_dir * (line_size * (is_persp ? out_pos1.w : 1.0));
gl_Position = out_pos1 - vec4(t, 0.0, 0.0);
}
}

View File

@@ -1,99 +0,0 @@
/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma USE_SSBO_VERTEX_FETCH(LineList, 2)
#include "common_view_clipping_lib.glsl"
#include "common_view_lib.glsl"
#include "gpu_shader_utildefines_lib.glsl"
#define DISCARD_VERTEX \
gl_Position = vec4(0.0); \
return;
uint outline_colorid_get()
{
#ifdef OBINFO_NEW
eObjectInfoFlag ob_flag = eObjectInfoFlag(floatBitsToUint(drw_infos[resource_id].infos.w));
bool is_active = flag_test(ob_flag, OBJECT_ACTIVE);
#else
int flag = int(abs(ObjectInfo.w));
bool is_active = (flag & DRW_BASE_ACTIVE) != 0;
#endif
if (isTransform) {
return 0u; /* colorTransform */
}
else if (is_active) {
return 3u; /* colorActive */
}
else {
return 1u; /* colorSelect */
}
return 0u;
}
/* Replace top 2 bits (of the 16bit output) by outlineId.
* This leaves 16K different IDs to create outlines between objects.
* SHIFT = (32 - (16 - 2)) */
#define SHIFT 18u
void main()
{
/* Outputs a singular vertex as part of a LineList primitive, however, requires access to
* neighboring 4 vertices. */
/* Fetch verts from input type lines adjacency. */
int line_prim_id = (gl_VertexID / 2);
int line_vertex_id = gl_VertexID % 2;
int base_vertex_id = line_prim_id * 2;
vec4 gl_pos[4];
vec3 world_pos[4];
vec3 view_pos[4];
for (int i = 0; i < 4; i++) {
vec3 in_pos = vertex_fetch_attribute_raw(
vertex_id_from_index_id(4 * line_prim_id + i), pos, vec3);
world_pos[i] = point_object_to_world(in_pos);
view_pos[i] = point_world_to_view(world_pos[i]);
gl_pos[i] = point_world_to_ndc(world_pos[i]);
gl_pos[i].z -= 1e-3;
}
/* Perform geometry shader equivalent logic. */
bool is_persp = (drw_view.winmat[3][3] == 0.0);
vec3 view_vec = (is_persp) ? normalize(view_pos[1]) : vec3(0.0, 0.0, -1.0);
vec3 v10 = view_pos[0] - view_pos[1];
vec3 v12 = view_pos[2] - view_pos[1];
vec3 v13 = view_pos[3] - view_pos[1];
vec3 n0 = cross(v12, v10);
vec3 n3 = cross(v13, v12);
float fac0 = dot(view_vec, n0);
float fac3 = dot(view_vec, n3);
/* If both adjacent verts are facing the camera the same way,
* then it isn't an outline edge. */
if (sign(fac0) == sign(fac3)) {
DISCARD_VERTEX
}
/* Output final position. */
int output_vert_select = (line_vertex_id + 1);
gl_Position = gl_pos[output_vert_select];
/* ID 0 is nothing (background). */
interp.ob_id = uint(resource_handle + 1);
/* Should be 2 bits only [0..3]. */
uint outline_id = outline_colorid_get();
/* Combine for 16bit uint target. */
interp.ob_id = (outline_id << 14u) | ((interp.ob_id << SHIFT) >> SHIFT);
/* Clip final output position. */
view_clipping_distances(world_pos[output_vert_select]);
}

View File

@@ -491,57 +491,6 @@ void gpu_shader_create_info_init()
12, Qualifier::READ_WRITE, "uint", "dummy_workaround_buf[]");
}
#ifdef WITH_METAL_BACKEND
/* Metal-specific alternatives for Geometry shaders. */
if (GPU_type_matches_ex(GPU_DEVICE_ANY, GPU_OS_MAC, GPU_DRIVER_ANY, GPU_BACKEND_METAL)) {
/* Overlay Edit Mesh. */
overlay_edit_mesh_edge = overlay_edit_mesh_edge_no_geom;
overlay_edit_mesh_edge_flat = overlay_edit_mesh_edge_flat_no_geom;
overlay_edit_mesh_edge_clipped = overlay_edit_mesh_edge_clipped_no_geom;
overlay_edit_mesh_edge_flat_clipped = overlay_edit_mesh_edge_flat_clipped_no_geom;
/* Overlay Edit Curve. */
overlay_edit_curve_handle = overlay_edit_curve_handle_no_geom;
overlay_edit_curve_handle_clipped = overlay_edit_curve_handle_clipped_no_geom;
/* Overlay Edit Curves. */
overlay_edit_curves_handle = overlay_edit_curves_handle_no_geom;
overlay_edit_curves_handle_clipped = overlay_edit_curves_handle_clipped_no_geom;
/* Overlay Armature Shape outline. */
overlay_armature_shape_outline = overlay_armature_shape_outline_no_geom;
overlay_armature_shape_outline_clipped = overlay_armature_shape_outline_clipped_no_geom;
overlay_armature_shape_wire = overlay_armature_shape_wire_no_geom;
/* Overlay Motion Path Line. */
overlay_motion_path_line = overlay_motion_path_line_no_geom;
overlay_motion_path_line_clipped = overlay_motion_path_line_clipped_no_geom;
/* Conservative rasterization. */
basic_depth_mesh_conservative = basic_depth_mesh_conservative_no_geom;
basic_depth_mesh_conservative_clipped = basic_depth_mesh_conservative_no_geom_clipped;
basic_depth_pointcloud_conservative = basic_depth_pointcloud_conservative_no_geom;
basic_depth_pointcloud_conservative_clipped =
basic_depth_pointcloud_conservative_no_geom_clipped;
/* Overlay pre-pass wire. */
overlay_outline_prepass_wire = overlay_outline_prepass_wire_no_geom;
/* Edit UV Edges. */
overlay_edit_uv_edges = overlay_edit_uv_edges_no_geom;
/* NOTE: As atomic data types can alter shader gen if native atomics are unsupported, we need
* to use differing create info's to handle the tile optimized check. This does prevent
* the shadow techniques from being dynamically switchable. */
# if 0
/* Temp: Disable TILE_COPY path while efficient solution for parameter buffer overflow is
* identified. This path can be re-enabled in future. */
const bool is_tile_based_arch = (GPU_platform_architecture() == GPU_ARCHITECTURE_TBDR);
if (is_tile_based_arch) {
eevee_shadow_data = eevee_shadow_data_non_atomic;
}
# endif
}
#endif
for (ShaderCreateInfo *info : g_create_infos->values()) {
info->builtins_ |= gpu_shader_dependency_get_builtins(info->vertex_source_);
info->builtins_ |= gpu_shader_dependency_get_builtins(info->fragment_source_);