diff --git a/GLMakie/assets/shader/line_segment.geom b/GLMakie/assets/shader/line_segment.geom index 443cfb7f31d..cc879972e0a 100644 --- a/GLMakie/assets/shader/line_segment.geom +++ b/GLMakie/assets/shader/line_segment.geom @@ -6,14 +6,6 @@ struct Nothing{ //Nothing type, to encode if some variable doesn't contain any d }; layout(lines) in; - -// Need to set size of ClipDistance -in gl_PerVertex { - vec4 gl_Position; - float gl_PointSize; - float gl_ClipDistance[8]; -} gl_in[]; - layout(triangle_strip, max_vertices = 4) out; uniform vec2 resolution; @@ -24,6 +16,7 @@ uniform int linecap; in {{stripped_color_type}} g_color[]; in uvec2 g_id[]; in float g_thickness[]; +in float g_clip_distance[][8]; out vec3 f_quad_sdf; out vec2 f_truncation; @@ -118,7 +111,7 @@ void main(void) f_id = g_id[x]; for (int i = 0; i < 8; i++) - gl_ClipDistance[i] = gl_in[x].gl_ClipDistance[i]; + gl_ClipDistance[i] = g_clip_distance[x][i]; for (int y = 0; y < 2; y++) { // Get offset in y direction & compute vertex position diff --git a/GLMakie/assets/shader/line_segment.vert b/GLMakie/assets/shader/line_segment.vert index ffc61c35a15..fdb58161406 100644 --- a/GLMakie/assets/shader/line_segment.vert +++ b/GLMakie/assets/shader/line_segment.vert @@ -24,18 +24,18 @@ vec4 to_vec4(vec2 v){return vec4(v, 0, 1);} uniform int num_clip_planes; uniform vec4 clip_planes[8]; -out float gl_ClipDistance[8]; +out float g_clip_distance[8]; void process_clip_planes(vec3 world_pos) { // distance = dot(world_pos - plane.point, plane.normal) // precalculated: dot(plane.point, plane.normal) -> plane.w for (int i = 0; i < num_clip_planes; i++) - gl_ClipDistance[i] = dot(world_pos, clip_planes[i].xyz) - clip_planes[i].w; + g_clip_distance[i] = dot(world_pos, clip_planes[i].xyz) - clip_planes[i].w; // TODO: can be skipped? for (int i = num_clip_planes; i < 8; i++) - gl_ClipDistance[i] = 1.0; + g_clip_distance[i] = 1.0; } diff --git a/GLMakie/assets/shader/lines.geom b/GLMakie/assets/shader/lines.geom index f207eadd54b..e2068bc1fa0 100644 --- a/GLMakie/assets/shader/lines.geom +++ b/GLMakie/assets/shader/lines.geom @@ -9,14 +9,6 @@ struct Nothing{ //Nothing type, to encode if some variable doesn't contain any d {{define_fast_path}} layout(lines_adjacency) in; - -// Need to set size of ClipDistance -in gl_PerVertex { - vec4 gl_Position; - float gl_PointSize; - float gl_ClipDistance[8]; -} gl_in[]; - layout(triangle_strip, max_vertices = 4) out; in {{stripped_color_type}} g_color[]; @@ -24,6 +16,7 @@ in float g_lastlen[]; in uvec2 g_id[]; in int g_valid_vertex[]; in float g_thickness[]; +in float g_clip_distance[][8]; out highp vec3 f_quad_sdf; out vec2 f_truncation; @@ -89,7 +82,7 @@ void emit_vertex(LineVertex vertex) { f_linelength = vertex.linelength; f_id = g_id[vertex.index]; for (int i = 0; i < 8; i++) - gl_ClipDistance[i] = gl_in[vertex.index].gl_ClipDistance[i]; + gl_ClipDistance[i] = g_clip_distance[vertex.index][i]; EmitVertex(); } diff --git a/GLMakie/assets/shader/lines.vert b/GLMakie/assets/shader/lines.vert index 1914884a7bb..052c47f0380 100644 --- a/GLMakie/assets/shader/lines.vert +++ b/GLMakie/assets/shader/lines.vert @@ -36,18 +36,18 @@ uniform float depth_shift; uniform int num_clip_planes; uniform vec4 clip_planes[8]; -out float gl_ClipDistance[8]; +out float g_clip_distance[8]; void process_clip_planes(vec3 world_pos) { // distance = dot(world_pos - plane.point, plane.normal) // precalculated: dot(plane.point, plane.normal) -> plane.w for (int i = 0; i < num_clip_planes; i++) - gl_ClipDistance[i] = dot(world_pos, clip_planes[i].xyz) - clip_planes[i].w; + g_clip_distance[i] = dot(world_pos, clip_planes[i].xyz) - clip_planes[i].w; // TODO: can be skipped? for (int i = num_clip_planes; i < 8; i++) - gl_ClipDistance[i] = 1.0; + g_clip_distance[i] = 1.0; } void main()